var cmDateFormat = 'Y/m/d H:i'; var projectDateFormat = 'd.m.y'; var projectLongDateFormat = 'H:i d.m.Y'; var commonDateFormat = 'd.m.Y - H:i'; var eventRecordDef = Ext.data.Record.create([ 'CONTEXT_ID', 'EVENT_LOCATION', 'ARTICLE_ID', 'EVENT_DESCRIPTION', 'EVENT_TOPIC', 'EVENT_ID', 'USER_ID', 'USER_FNAME', 'USER_LNAME', 'USER_EMAIL', 'EVENT_TEXT', 'PROJECT_PUBLIC', {name: 'EVENT_START', type: 'date', dateFormat: cmDateFormat}, {name: 'EVENT_END', type: 'date', dateFormat: cmDateFormat}, {name: 'EVENT_REGISTRATION', type: 'int'}, 'EVENT_IMPORTED', 'NUMBER_OF_REGISTERED', 'REGISTRATION_DEADLINE', 'STATUS' ]); var articleRecordDef = Ext.data.Record.create([ 'ARTICLE_ID', 'CONTEXT_ID', 'USER_ID', 'ARTICLE_TEXT', 'ARTICLE_LANGUAGE_NAME', 'ARTICLE_DESCRIPTION', 'ARTICLE_LANGUAGE', 'ARTICLE_PREVIEWTEMPLATE', {name: 'ARTICLE_PUBLIC', type: 'boolean'}, {name: 'ARTICLE_START', type: 'date', dateFormat: cmDateFormat}, 'ARTICLE_OWNER' ]); var projectRecordDef = Ext.data.Record.create([ 'PROJECT_ID', 'PROJECT_NAME', 'PROJECT_LEADER', 'PROJECT_DATE_1', 'PROJECT_DATE_2', 'PROJECT_DESCRIPTION', 'resourceKey', 'PROJECT_PUBLIC', {name: 'ROLE_RECEIVE_MAIL', type: 'boolean'}, {name: 'ROLE_SHOW_CONTACT', type: 'boolean'} ]); var topicRecordDef = Ext.data.Record.create([ 'TOPIC_ID', 'TOPIC_TITLE', 'TOPIC_DESCRIPTION', 'REPLY_CONTENT', 'REPLY_ID', 'USER_ID', 'USER_FNAME', 'USER_LNAME', 'ARTICLE_ID', 'CONTEXT_ID', {name: 'REPLY_COUNT', type: 'int'}, {name: 'TOPIC_LAST', type: 'date', dateFormat: cmDateFormat}, {name: 'TOPIC_DATE', type: 'date', dateFormat: cmDateFormat} ]); var userRecordDef = Ext.data.Record.create([ 'USER_ID', {name: 'USER_NAME', type: 'string'}, {name: 'USER_FNAME', type: 'string'}, {name: 'USER_LNAME', type: 'string'}, {name: 'USER_EMAIL', type: 'string'}, 'USER_KEY', 'resourceKey', 'USER_DESCRIPTION', {name: 'USER_COMPANY', type: 'string'}, {name: 'USER_TITLE', type: 'string'}, 'USER_INTERESTS', 'USER_STATUS', 'USER_PHONE_1', 'USER_PHONE_2', 'USER_PHONE_3', 'EXTERNAL', {name: 'TOPIC_NOTIFICATION', type: 'boolean'}, {name: 'ROLE_RECEIVE_MAIL', type: 'boolean'}, {name: 'ROLE_SHOW_CONTACT', type: 'boolean'}, {name: 'ROLE_HAS_RECEIVED_INVITATION', type: 'boolean'}, {name: 'TOPIC_ORIGINAL_RECEIVER', type: 'boolean'}, {name: 'EVENT_ID', type: 'int'}, {name: 'MAIL_SENT', type: 'date', dateFormat: cmDateFormat}, {name: 'LAST_MAIL_SENT', type: 'date', dateFormat: cmDateFormat}, {name: 'USER_REGISTERED', type: 'int'}, 'REGISTRATION_ID', 'USER_FULLNAME', 'USER_COUNTRY', 'COUNTRY_NAME', 'USER_MAIL_PREFERENCE', 'USER_ADDRESS_1', 'USER_ADDRESS_2', 'USER_ZIP', 'USER_CITY', 'USER_WWW', 'ROLE_NAME', {name: 'LAST_INVOICE_INFO_REQUEST_SENT', type: 'date', dateFormat: cmDateFormat}, 'INVOICE_CONFIRMED', 'USER_MAIL_INVALID' ]); var templateRecordDef = Ext.data.Record.create([ 'TEMPLATE_ID', 'TEMPLATE_DESCRIPTION', 'TEMPLATE_ICON', 'TEMPLATE_TYPE' ]); var fileRecordDef = Ext.data.Record.create([ 'FILE_ID', 'CONTEXT_ID', 'FILE_NAME', 'MIME_TYPE', 'CONTEXT_LANGUAGE', 'FILE_DESCRIPTION', 'USER_ID', 'CONTEXT_LANGUAGE_NAME', 'CONTEXT_PARENT', {name: 'INSERTED', type: 'date', dateFormat: cmDateFormat}, {name: 'UPDATED', type: 'date', dateFormat: cmDateFormat}, {name: 'FILE_SIZE', type: 'int'}, {name: 'PUBLIC', type: 'int'} ]); var eventNotificationReceiversRecordDef = Ext.data.Record.create([ 'EVENT_ID', 'USER_ID', 'USER_NAME', 'USER_FNAME', 'USER_LNAME', 'USER_EMAIL', 'USER_TITLE', 'USER_COMPANY', 'USER_PHONE', 'USER_COUNTRY', 'COUNTRY_NAME', 'USER_ADDRESS_1', 'USER_ADDRESS_2' ]); var tabsRecordDef = Ext.data.Record.create([ 'TAB_ID', 'TAB_NAME', {name: 'TAB_SHOW_PUBLIC', type: 'boolean'}, {name: 'TAB_SHOW_MEMBERS', type: 'boolean'} ]); var eventRegistrationRecordDef = Ext.data.Record.create([ {name: 'REGISTRATION_ID', type: 'int'} ]); var countryRecordDef = Ext.data.Record.create([ 'COUNTRY_CODE', 'COUNTRY_NAME' ]); var userFieldsRecordDef = Ext.data.Record.create([ 'USER_FIELD_ID', 'USER_FIELD_NAME', 'USER_ADDRESS_1', {name: 'USER_FIELD_SHOW_PUBLIC', type: 'boolean'}, {name: 'USER_FIELD_SHOW_MEMBERS', type: 'boolean'} ]); var newslettersRecordDef = Ext.data.Record.create([ 'NEWSLETTER_ID', 'NEWSLETTER_SUBJECT', 'USER_ID', 'USER_FNAME', 'USER_LNAME', 'USER_EMAIL', {name: 'NEWSLETTER_INSERTED', type: 'date'}, {name: 'NUMBER_OF_RECEIVERS', type: 'int'} ]); var projectGroupRecordDef = Ext.data.Record.create([ 'PROJECT_ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SNAME', 'USER_KEY', 'resourceKey', 'DEFAULT_MEMBERS_GROUP', 'NUMBER_OF_USERS' ]); var statusStoreData = [ ['Pending', 0], ['OK', 1], ['Disabled', 2] ]; var statusStore = new Ext.data.SimpleStore({ fields: [{name: 'STATUS_TEXT'}, {name: 'LIST_STATUS', type: 'int'}] }); var locksCombo = new Ext.form.ComboBox({ store: new Ext.data.SimpleStore({ fields: ['key', 'access'], data: [ ['1', 'Observer'], ['5', 'Member'], ['13', 'Moderator'] ], autoLoad: true, id: 0 }), mode: 'local', editable: false, displayField: 'access', triggerAction: 'all', valueField: 'key' }); function loadScript(src) { var isLoaded = false; var s = document.getElementsByTagName('script'); for (var i = 0; i < s.length; i++) { if (s[i].getAttribute('src') === src) { isLoaded = true; } } if (isLoaded) return null; var scriptEl = document.createElement('script'); scriptEl.setAttribute('src', src); scriptEl.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptEl); return scriptEl; } function loadCss(src) { var isLoaded = false; var s = document.getElementsByTagName('link'); for (var i = 0; i < s.length; i++) { if (s[i].getAttribute('href') === src) { isLoaded = true; } } if (isLoaded) return null; var scriptEl = document.createElement('link'); scriptEl.setAttribute('href', src); scriptEl.setAttribute('type', 'text/css'); scriptEl.setAttribute('rel', 'stylesheet'); document.getElementsByTagName('head')[0].appendChild(scriptEl); return scriptEl; } var getEntity = function(recordDef, data, id) { var fi = recordDef.prototype.fields.items; for (var i = 0; i < fi.length; i++) { var f = fi[i]; var v = data[f.name]; data[f.name] = f.convert((v !== undefined) ? v : f.defaultValue); } var r = new recordDef(data, id); return r; } function fixUploader() { if (Ext.ux.UploadForm) { Ext.override(Ext.ux.UploadForm, { getProgressTemplate : function(){ var tpl = new Ext.Template( '' , '' , '' , '' , '' , '' , '' , '
' + this.pgSizeText + ':{bytes_uploaded}/{bytes_total}
' + this.pgSpeedAvgText + ':{speed_average}
' + this.pgEtaText + ':{est_sec}
' ); tpl.compile(); return tpl; }, createButtons: function() { this.toolbar = new Ext.Toolbar(); var tbel = Ext.DomHelper.insertFirst(this.el, {tag: 'div'}); this.toolbar.render(tbel); this.browseBtn = this.toolbar.addButton({text: 'Select files', icon: this.addIcon, cls: 'x-btn-text-icon'}); this.inputWrap = Ext.DomHelper.append(this.browseBtn.getEl().parent(), {cls: 'x-uf-input-wrap', tag: 'div', style: 'position: absolute; opacity: 0; top: 0px; height: ' + this.toolbar.getEl().getHeight() + 'px;'}); this.toolbar.addFill(); this.uploadBtn = this.toolbar.addButton({text: 'Upload', icon: this.uploadIcon, cls: 'x-btn-text-icon', handler: this.startUpload, scope:this}); this.clearBtn = this.toolbar.addButton({text: 'Cancel', icon: this.clearIcon, cls: 'x-btn-text-icon', handler: this.clearQueue, scope:this}); this.waitIcon = Ext.get(Ext.DomHelper.append(this.el, {tag: 'div'})); this.addBtnCt = this.waitIcon; this.ubtnCt = this.waitIcon; this.cbtnCt = this.waitIcon; } }); } if (Ext.gt.SWFUpload) { Ext.override(Ext.gt.SWFUpload, { getProgressTemplate : function(){ var tpl = new Ext.Template( '' , '' , '' , '' , '' , '' , '' , '
' + this.pgSizeText + ':{bytes_uploaded}/{bytes_total}
' + this.pgSpeedAvgText + ':{speed_average}
' + this.pgEtaText + ':{est_sec}
' ); tpl.compile(); return tpl; }, createButtons: function() { this.toolbar = new Ext.Toolbar(); var tbel = Ext.DomHelper.insertFirst(this.el, {tag: 'div'}); this.toolbar.render(tbel); this.browseBtn = this.toolbar.addButton({text: 'Select files', icon: this.addIcon, cls: 'x-btn-text-icon', handler:this.browse, scope:this}); this.uploadBtn = this.toolbar.addButton({text: 'Upload', icon: this.uploadIcon, cls: 'x-btn-text-icon', handler: this.startUpload, scope:this}); this.toolbar.addFill(); this.clearBtn = this.toolbar.addButton({text: 'Cancel', icon: this.clearIcon, cls: 'x-btn-text-icon', handler: this.cancelQueue, scope:this}); this.waitIcon = Ext.get(Ext.DomHelper.append(this.el, {tag: 'div'})); this.addBtnCt = this.waitIcon; this.ubtnCt = this.waitIcon; this.cbtnCt = this.waitIcon; } }); } } fixUploader(); function createSPUploader(config) { var iconPath = getApplicationBaseUrl() + '/util/admin/images/'; var uploader; if (checkFlashVersion() >= 9) { uploader = new Ext.gt.SWFUpload({ title: config.title || "", hideMode: "visibility", iconPath: iconPath, fileSizeLimit: '0', style: 'position: absolute', flashPath: getApplicationBaseUrl() + '/util/ext-2.2/ux/swfupload.swf', uploadTarget: config.url + '/admin/blank.html;jsessionid=' + getSessionId(), fileTypes: config.type, fileTypesDescription: config.typeDesc, labels: { browse: "Browse", upload: "Upload", cancel: "Cancel" } }); uploader.on('beforeupload', function(form) { var postParams = new Object(); postParams[config.uploadId] = config.uploadIdCallback(); postParams['TYPE'] = 'ARTICLE'; postParams['CHARACTER_ENCODING'] = 'UTF8'; form.setPostParams(postParams); }); uploader.on('render', function(u) { if (! config.showUploadButton && u.uploadBtn) u.uploadBtn.hide(); if (! config.showCancelButton && u.cancelBtn) u.cancelBtn.hide(); }); uploader.on('hide', function() { this.setHeight(0); }); } else { var id = Ext.id(); var el = Ext.DomHelper.append(document.body, {tag: 'div', id: id}); var uploadForm = new Ext.ux.UploadForm(el.id, { baseParams: {}, iconPath: iconPath, uploadIcon: 'transmit_go.png', clearIcon: 'cancel.png', autoCreate: true, url: config.url, method: 'post', maxNameLength: 30 , pgCfg: { uploadIdName: config.uploadId, uploadIdValue: '-1', options: { url: servletBase + '/openPage/admin/blank.html', method: 'post' } } }); uploadForm.on('beforeaction', function(form) { form.baseParams['TYPE'] = 'ARTICLE'; form.uploadId.value = config.uploadIdCallback(); }); uploader = new Ext.Panel({ autoScroll: true, autoHeight: true, layout: 'fit', title: config.title || "", contentEl: el }); uploader.relayEvents(uploadForm, ['stopupload', 'fileadded', 'fileremoved', 'clearqueue']); uploader.clearQueue = uploadForm.clearQueue.createDelegate(uploadForm); uploader.startUpload = uploadForm.startUpload.createDelegate(uploadForm); uploadForm.browseBtn.setText("Browse"); uploadForm.uploadBtn.setText("Upload"); uploadForm.clearBtn.setText("Cancel"); uploadForm.on('startupload', function() { uploader.body.mask('Uploading', 'x-mask-loading'); }); if (! config.showUploadButton) uploadForm.uploadBtn.hide(); if (! config.showCancelButton) uploadForm.clearBtn.hide(); } return uploader; } function openPrint(htmlTekst) { var iframe = Ext.get('IF-Print'); var doc; if (iframe.dom.contentDocument) { doc = iframe.dom.contentDocument; } else if (iframe.dom.contentWindow.document) { doc = iframe.dom.contentWindow.document; } var body = Ext.get(doc.body); body.update(htmlTekst); iframe.dom.contentWindow.focus(); iframe.dom.contentWindow.print(); } var memberWin; var iframe = document.createElement('iframe'); function openMember(userId) { if(!memberWin) { iframe.name = Ext.id(); iframe.frameBorder = 'no'; iframe.width = '100%'; iframe.height = '100%'; var panel = new Ext.Panel({ labelAlign: 'top', bodyStyle:'padding:5px', contentEl: iframe }); memberWin = new Ext.Window({ modal: false, layout: 'fit', title: '', width: 650, height: 300, items: panel, closeAction: 'hide' }); } iframe.src = 'http://www.stratmos.com/stratmos/public/openPage/project/person.html?USER_ID=' + userId; memberWin.show(); } Ext.namespace("no.origin.sp.project"); no.origin.sp.project.SelectModerator = Ext.extend(Ext.Window, { form: null, store: null, initComponent: function() { var btnOkId = Ext.id(); var cmbId = Ext.id(); this.store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: servletBase + "/getProjectUsersByRights/admin/jsonObjectsResult.html?objects=users" }), reader: new Ext.data.JsonReader({ root: "users", totalProperty: "results", id: "USER_ID" }, userRecordDef) }); this.store.load({params: {'CONTEXT_ID': contextId, 'USER_KEY': '13'}}); this.store.on('load', function(s){ var id = this.params.USER_ID; s.each(function(rec) { if(rec.id == id) { Ext.getCmp(cmbId).setValue(id); Ext.getCmp(cmbId).setRawValue(rec.get('USER_NAME') + ' - ' + rec.get('USER_FNAME') + ' ' + rec.get('USER_LNAME')); return; } }); }, this); this.form = new Ext.form.FormPanel({ bodyStyle: 'padding:10px;', layout: "form", monitorValid: true, monitorPoll: 1000, labelWidth: 60, items: [{ xtype: "combo", id: cmbId, anchor: '99%', allowBlank: false, store: this.store, mode: 'local', fieldLabel: 'Name', editable: false, triggerAction: 'all', displayField: 'USER_NAME', valueField: 'USER_ID', minChars: 1, tpl: '
{USER_NAME} - {USER_FNAME} {USER_LNAME}
', queryParam: '', hiddenName: 'USER_ID' }], buttons: [ {text: "Ok", id: btnOkId, handler: function() { var params = this.form.getForm().getValues(); for(p in this.params.POST_PARAMS) { params[p] = this.params.POST_PARAMS[p]; } Ext.Ajax.request({ url: servletBase + this.params.REQUEST, params: params, scope: this, success: function(res) { this.close(); }, failure: function(rec) { Ext.Msg.alert("Error", "Error while saving"); } }); }, scope: this} ] }); this.form.on('clientvalidation', function(f, v) { var btn = Ext.getCmp(btnOkId); if (v && btn){ btn.enable(); } else { btn.disable(); } }); Ext.apply(this, { width: 400, height: 150, layout: "fit", items: [this.form] }); no.origin.sp.project.SelectModerator.superclass.initComponent.apply(this); } }); var getUserPropsTemplate = function(user) { var template = "" + "" + "" + "" + "" + "" + "" + "" + "
E-mail: " + user.get("USER_EMAIL") + "Address:" + user.get('USER_ADDRESS_1') + "
First name: " + user.get("USER_FNAME") + "PO Box:" + user.get('USER_ADDRESS_2') + "
Surname: " + user.get("USER_LNAME") + "Zip code:" + user.get('USER_ZIP') + "
Title: " + user.get("USER_TITLE") + "Place:" + user.get('USER_CITY') + "
Company: " + user.get("USER_COMPANY") + "Country:" + user.get('USER_COUNTRY') + "
Direct telephone: " + user.get("USER_PHONE_1") + "  
Alternative telephone: " + user.get("USER_PHONE_2") + "  
"; return template; }