});
				}
			}
		});
		
	},
	/**
	* Function deletes User
	*
	*@param int user_id, user to delete
	*/
	
	deleteUser: function (user_id) {
		if (user_id != <?php echo $sf_user->getAttribute('id'); ?>) {
			Ext.Ajax.request({  
				url : '<?php echo build_dynamic_javascript_url('usermanagement/DeleteUser')?>/id/' + user_id,
				success: function(objServerResponse){ 
					cf.UserGrid.theUserStore.reload();
					Ext.Msg.minWidth = 200;
					Ext.MessageBox.alert('<?php echo __('OK',null,'usermanagement'); ?>', '<?php echo __('User deleted',null,'usermanagement'); ?>');
				}
			});
		}
		else {
			Ext.Msg.minWidth = 200;
			Ext.MessageBox.alert('<?php echo __('Error',null,'usermanagement'); ?>', '<?php echo __('Own profile cannot be deleted',null,'usermanagement'); ?>');
		}
		
		
	}
		});
	},
	
	
	/**
	* save / update an template
	*
	*@param int id, id is set, if in editmode, is not set, then ''
	*/
	initSave: function (id) {
		if (id != '') {
			var url = '<?php echo build_dynamic_javascript_url('documenttemplate/UpdateDocumenttemplate')?>/id/' + id;
			var title = '<?php echo __('Data updated',null,'documenttemplate'); ?>';
		}
		else {
			var url = '<?php echo build_dynamic_javascript_url('documenttemplate/SaveDocumenttemplate')?>';
			var title = '<?php echo __('Data saved',null,'documenttemplate'); ?>';
		}
		var readyToSend = cf.documenttemplateCRUD.buildPanel(); // build panel to save
		if(readyToSend == true)	{
			cf.documenttemplateCRUD.doSubmit(url, title);	
		}
	},
	
	
	/**
	* Submit theFormPanel
	*
	*@param string url, SubmitURL, can be UpdateForm or SaveForm
	*@param string title, confirm box title
	*@return boolean, true when saveprocess can be started, false, if not
			url: '<?php echo build_dynamic_javascript_url('filter/SaveFilter')?>',
			method: 'POST',
			waitMsg: '<?php echo __('Saving Data',null,'workflowmanagement'); ?>',
			success: function(objServerResponse){
				cf.todoFilterCRUD.reloadGrid();
				cf.todoFilterCRUD.theWindow.hide();
				cf.todoFilterCRUD.theWindow.destroy();
				cf.todoFilterPanel.theHiddenFilterName.setValue();
			}
		});
	},
	
	
	deleteFilter: function (id) {
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('filter/DeleteFilter')?>/id/' + id,
			success: function(objServerResponse){
				cf.todoFilterCRUD.reloadGrid();
			}
		});
	},
	
	reloadGrid: function () {
		try {
			cf.todoFilterFilter.theStore.reload();
		}
		catch(e) {
			
		}
		try {
			cf.workflowFilterFilter.theStore.reload();
				autoCreate : {tag:'input', type: 'hidden', name: 'grid[]', value:row.data.group_id, width: 0}			
			});
			
			myPanel.add(hiddenfield);
			
		}
		// add items to formpanel
		cf.menueSettingGroupWindow.theFormPanel.setVisible(true);
		cf.menueSettingGroupWindow.theFormPanel.add(myPanel);
		cf.menueSettingGroupWindow.theFormPanel.doLayout();
	},
	
	/** save items **/
	saveGroup: function () {		
		cf.menueSettingGroupWindow.theFormPanel.getForm().submit({
			url: '<?php echo build_dynamic_javascript_url('menuesetting/SaveGroup')?>',
			method: 'POST',
			waitMsg: '<?php echo __('Saving Data',null,'menuesetting'); ?>',
			success: function() {
				try { // check if accordion has active item
					var ac_item_id = cf.Navigation.theAccordion.layout.activeItem.id;
				}
				catch(e) {
				}
				cf.menueSettingGroupWindow.theMenueSettingGroupWindow.hide();
				cf.menueSettingGroupWindow.theMenueSettingGroupWindow.destroy();
				
				cf.Navigation.isInitialized = false;
				cf.Layout.theRegionWest.remove(cf.Navigation.theAccordion);
				cf.Navigation.theAccordion.destroy();
				cf.Navigation.reloadNavigation();
		this.initTree(id);
		this.initFormPanel();
		this.theFormPanel.add(this.theTabpanel);
	},
	
	/**
	* Function loads the tree from server and stores it. When in edit mode, current settings will be loaded
	*
	* @param int id, id of the record, if edit button was pressed, when new record, id is null
	*/
	initTree: function (id) {
		if(id == '') {
			var url = '<?php echo build_dynamic_javascript_url('userrolemanagement/LoadRoleTree')?>';
		}
		else {
			var url = '<?php echo build_dynamic_javascript_url('userrolemanagement/LoadRoleTree')?>/role_id/' + id;
		}
		
		// load tree here
		Ext.Ajax.request({  
			url : url,
			success: function(objServerResponse){
				theJsonTreeData = Ext.util.JSON.decode(objServerResponse.responseText);
				cf.PopUpRoleTabpanel.buildTabs(theJsonTreeData,id);
				Ext.getCmp('userrole_title_id').setValue(theJsonTreeData.name);
				if (Ext.getCmp('userrole_title_id').getValue() != '') {
					Ext.getCmp('userrole_title_id').setDisabled(true);
				}
			}
		});
	},
	
	
	initSavePanel: function () {
		this.thePanel = new Ext.Panel({
			
		});
	},
	
	
	
	
	
	
	doSubmit: function(workflowtemplate_id, version_id) {
		cf.workflowedit.thePanel.getForm().submit({
			url: '<?php echo build_dynamic_javascript_url('workflowedit/SaveWorkflow')?>/workflowid/' + workflowtemplate_id + '/versionid/' + version_id,
			method: 'POST',
			waitMsg: '<?php echo __('Saving Data',null,'workflowmanagement'); ?>',
			success: function(objServerResponse){
				try {
					cf.todoPanelGrid.theTodoStore.reload();
				}
				catch(e) {
					
				}
				try {
					cf.workflowmanagementPanelGrid.theWorkflowGrid.reload();
				}
				catch(e) {
					
				}
			resizable: true,
	        plain: false,
			close : function(){
				cf.DeleteRoleWindow.theRoleDeleteWindow.hide();
				cf.DeleteRoleWindow.theRoleDeleteWindow.destroy();
			},
	        buttonAlign: 'center',
			buttons:[{
				id: 'removeButton',
				text:'<?php echo __('Delete',null,'userrolemanagement'); ?>', 
				icon: '/images/icons/accept.png',
				handler: function () { // delete role
					if(Ext.getCmp('deleteUserRightCombo').getValue() != '') {
						var updateid = (Ext.getCmp('deleteUserRightCombo').getValue());
						Ext.Ajax.request({ 
							url : '<?php echo build_dynamic_javascript_url('userrolemanagement/DeleteRole')?>/deleteid/' + deleteid + '/updateid/' + updateid, 
							success: function(objServerResponse){
								cf.UserRoleGrid.theUserRoleStore.reload();
								if(cf.UserGrid.theUserStoreIsInitialized == true) {
									cf.UserGrid.theUserStore.reload();
								}
								Ext.Msg.minWidth = 200;
								Ext.MessageBox.alert('<?php echo __('OK',null,'userrolemanagement'); ?>', objServerResponse.responseText + ' <?php echo __('profiles changed',null,'userrolemanagement'); ?>');
							}
						});
						cf.DeleteRoleWindow.theRoleDeleteWindow.hide();
						cf.DeleteRoleWindow.theRoleDeleteWindow.destroy();
					}
				}
			},
			{ // do nothing
			waitMsg: '<?php echo __('Saving Data',null,'userrolemanagement'); ?>',
			success: function() {
				cf.rolePopUpWindow.theRoleWindow.hide();
				cf.rolePopUpWindow.theRoleWindow.destroy();
			}
		});
	},
	
	/** add new role **/
	saveNewRole: function () {
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('userrolemanagement/CheckForExistingRole')?>/description/' + Ext.getCmp('userrole_title_id').getValue(),
			success: function(objServerResponse){
				if(objServerResponse.responseText == 1) { // save Role
					cf.PopUpRoleTabpanel.theFormPanel.getForm().submit({
						url: '<?php echo build_dynamic_javascript_url('userrolemanagement/AddRole')?>',
						method: 'POST',
						waitMsg: '<?php echo __('Saving Data',null,'userrolemanagement'); ?>',
						success: function() {
							cf.UserRoleGrid.theUserRoleStore.reload();
							cf.rolePopUpWindow.theRoleWindow.hide();
							cf.rolePopUpWindow.theRoleWindow.destroy();
						}
					});
				}
				else {
					Ext.MessageBox.alert('<?php echo __('Error',null,'userrolemanagement'); ?>', '<?php echo __('Role is already existing',null,'userrolemanagement'); ?>');
					cf.PopUpRoleTabpanel.theTabpanel.setActiveTab(0);
					Ext.getCmp('userrole_title_id').focus();
					Ext.getCmp('userrole_title_id').setValue();
				}
			{header: "<?php echo __('Group',null,'menuesetting'); ?>", width: 225, sortable: false, dataIndex: 'group', css : "text-align : left;font-size:12px;align:center;"}
		]);
		
	},
	
	/**
	*
	* init Store for grid
	*
	* @param int id, id of the loaded Group
	*/
	
	initStore: function (id) {
		this.theGroupStore = new Ext.data.JsonStore({
				root: 'result',
				url: '<?php echo build_dynamic_javascript_url('menuesetting/LoadGroup')?>/id/' + id,
				fields: [
					{name: '#'},
					{name: 'id'},
					{name: 'group'},
					{name: 'module'},
					{name: 'module_id'},
					{name: 'group_id'}
				]
		});
		this.theGroupStore.load();
		
	},
	

	
Beispiel #10
0
						}]
					}]
				}]
		});
		
		this.theUserSearchbar.on('expand', function() {
			cf.UserGrid.theGridPanel.setSize({width: 'auto', height: cf.Layout.theRegionWest.getHeight() - 262});
			cf.UserGrid.theUserGrid.setSize({width: 'auto', height: cf.Layout.theRegionWest.getHeight() - 282});
		});
		this.theUserSearchbar.on('collapse', function() {
			cf.UserGrid.theGridPanel.setSize({width: 'auto', height: cf.Layout.theRegionWest.getHeight() - 70});
			cf.UserGrid.theUserGrid.setSize({width: 'auto', height: cf.Layout.theRegionWest.getHeight() - 90});
		});
	},
	
	/** store for roles in searchbar **/
	initRoleStore: function () {
		this.theUserRoleStoreInitialized = true;
		this.theUserRoleStore = new Ext.data.JsonStore({
				root: 'result',
				url: '<?php echo build_dynamic_javascript_url('usermanagement/LoadAllRole')?>',
				autoload: true,
				fields: [
					{name: 'id'},
					{name: 'description'}
				]
		});
	}
	
	
};}();
				catch(e) {}
				try {
					cf.UserGrid.theUserStore.reload();
				}
				catch(e) {}
				
				
				if (user_id == <?php echo $sf_user->getAttribute('id'); ?>) {
					Ext.Msg.minWidth = 400;
					Ext.Msg.show({
					   title:'<?php echo __('Notice',null,'usermanagement'); ?>',
					   msg: '<?php echo __('For changes in own Profile it is recommended',null,'usermanagement'); ?><br><?php echo __('to reload the page. Unsaved data is getting lost. Proceed',null,'usermanagement'); ?>?',
					   buttons: Ext.Msg.YESNO,
					   fn: function(btn, text) {
							if(btn == 'yes') {
								window.location.href = '<?php echo build_dynamic_javascript_url('layout/index')?>'
							}
					   }
					});	
				}
					
			}
		});
	}



	
	
	
	
	*@param int id, id of the version
	*@param int created_at, date
	*@param int documenttemplateid, id of the template
	*/
	createShowButton: function (grid_id, id, created_at,documenttemplateid) {
		var btn_edit = new Ext.form.Label({
			renderTo: 'documenttemplateversion_show' + id,
			html: '<span style="cursor:pointer;"><img src="/images/icons/zoom.png" /></span>',
			listeners: {
				render: function(c){
					  c.getEl().on({
						click: function(el){
							cf.documenttemplateVersionFirstTab.theLoadingMask = new Ext.LoadMask(cf.documenttemplateVersionPopUp.theVersionWindow.body, {msg:'<?php echo __('Loading Data...',null,'documenttemplate'); ?>'});					
							cf.documenttemplateVersionFirstTab.theLoadingMask.show();
							Ext.Ajax.request({  
								url : '<?php echo build_dynamic_javascript_url('documenttemplate/LoadSingleDocumenttemplate')?>/id/' + id, 
								success: function(objServerResponse){
									theJsonTreeData = Ext.util.JSON.decode(objServerResponse.responseText);
									cf.documenttemplateVersionSecondTab.init(id, theJsonTreeData.result, created_at, grid_id, documenttemplateid);
								}
							});
						},
					scope: c
				});
				}
			}
		});
	},

	/** init grid **/
	initGrid: function () {
				emptyText:'<?php echo __('Search for name',null,'documenttemplate'); ?>',
				width:180
			},{
				xtype: 'button',
				text: '<?php echo __('Search',null,'documenttemplate'); ?>',
				icon: '/images/icons/table_go.png',
				handler: function (){
					cf.documenttemplatePanelGrid.doSearch();
				}
			},'-',{
				xtype: 'button',
				tooltip: '<?php echo __('Clear field',null,'documenttemplate'); ?>',
				icon: '/images/icons/delete.png',
				handler: function () {
					var textfield = Ext.getCmp('documenttemplatePanelGrid_searchtextfield').setValue();
					var url = encodeURI('<?php echo build_dynamic_javascript_url('documenttemplate/LoadAllDocumenttemplates')?>');
					cf.documenttemplatePanelGrid.theDocumenttemplateStore.proxy.setApi(Ext.data.Api.actions.read,url);
					cf.documenttemplatePanelGrid.theDocumenttemplateStore.reload();	
				}
			},'-',{	
				icon: '/images/icons/table_add.png',
	            tooltip:'<?php echo __('Add new Document template',null,'documenttemplate'); ?>',
				disabled: <?php $arr = $sf_user->getAttribute('credential');echo $arr['management_documenttemplate_addDocumenttemplate'];?>,
				style: 'margin-left:20px;',
	            handler: function () {
					cf.documenttemplatePopUpWindow.initNewDocumenttemplate('');
	            }
				
			},'->',
            {
            	xtype: 'label',
				]
		});
	},
	
	
	/** init toolbar for grid, contains ajax search **/
	initTopToolBar: function () {
		this.theTopToolBar = new Ext.Toolbar({
			items: [{
				icon: '/images/icons/zoom_out.png',
	            tooltip:'<?php echo __('Reset Filter',null,'workflowmanagement'); ?>',
	            handler: function () {
					cf.workflowFilterPanel.theCounter = 0;
					cf.archiveFilterPanel.theSearchPanel.getForm().reset();
					cf.archiveFilterPanel.theFieldGrid.store.removeAll();
					var loadUrl = '<?php echo build_dynamic_javascript_url('archiveoverview/LoadAllArchivedWorkflow')?>';
					cf.archiveWorkflow.theArchiveStore.proxy.setApi(Ext.data.Api.actions.read,loadUrl);
					cf.archiveWorkflow.theArchiveStore.load();
				}
				
			},'->',            {
            	xtype: 'label',
            	html: '<?php echo __('Items per Page',null,'usermanagement'); ?>: '
            },{
				xtype: 'combo', // number of records to display in grid
				mode: 'local',
				value: '<?php $arr = $sf_user->getAttribute('userSettings'); echo $arr['displayeditem'];?>',
				editable:false,
				triggerAction: 'all',
				foreSelection: true,
				fieldLabel: '',
 				id: 'installer_language_id',
 				hiddenName : 'installer_language',
				displayField:'text',
				selectOnFocus: true,
				value: language,
				triggerAction: 'all',
				foreSelection: true,
   				fieldLabel: '<?php echo __('Language',null,'installer'); ?>',
   				width: 200,
				store: this.theComboStore,
				listeners: {
					select: {
						fn:function(combo, value) {
							var id = (Ext.getCmp('installer_language_id').getValue());
							Ext.Ajax.request({
								url : '<?php echo build_dynamic_javascript_url('installer/changeLanguage')?>/value/' + id,
								success: function(objServerResponse){
									var url = Ext.get('url_installer').dom.value;
									window.location = url;
								}
							});
						}
					}
				}
				
			}]
		});
		Ext.getCmp('installer_language_id').on('afterrender', function(grid) {
			cf.installerSettingsTab.theComboStore.load();
		});
	},
			success: function(objServerResponse){
				Ext.Msg.minWidth = 200;
				Ext.MessageBox.alert('<?php echo __('OK',null,'workflowmanagement'); ?>', '<?php echo __('Email send',null,'workflowmanagement'); ?>');
				cf.workflowdetailsCRUD.theLoadingMask.hide();
			}
		});
			
	},
	
	
	
	setNewStation: function (templateversion_id, newWorkflowUserSlotId, currentWorkflowUserSlotId, direction) {
		cf.workflowdetailsCRUD.theLoadingMask = new Ext.LoadMask(cf.workflowdetailsSelectStation.thePopUpWindow.body, {msg:'<?php echo __('Updating Data...',null,'workflowmanagement'); ?>'});					
		cf.workflowdetailsCRUD.theLoadingMask.show();
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('workflowdetail/SetNewStation')?>/newworkflowuserslotid/' + newWorkflowUserSlotId + '/currentworkflowuserslotid/' + currentWorkflowUserSlotId + '/versionid/' + templateversion_id + '/direction/' + direction,
			success: function(objServerResponse){
				Ext.Msg.minWidth = 200;
				Ext.MessageBox.alert('<?php echo __('OK',null,'workflowmanagement'); ?>', '<?php echo __('Station set',null,'workflowmanagement'); ?>');
				var ServerResult = Ext.util.JSON.decode(objServerResponse.responseText);
				var detailData = ServerResult.detailData;
				cf.workflowdetailsSelectStation.thePopUpWindow.hide();
				cf.workflowdetailsSelectStation.thePopUpWindow.destroy();
				if(cf.workflowdetailsDetails.theWorkflowAdmin == false) {
					cf.workflowdetailsCRUD.theLoadingMask.hide();
					cf.workflowdetails.thePanelToShow.hide();
					cf.workflowdetails.thePanelToShow.destroy();
					cf.todoPanelGrid.theTodoStore.reload();
					try {
						cf.workflowmanagementPanelGrid.theWorkflowStore.reload();
					}
				]
		});
	},
	
	
	/** init toolbar for grid, contains ajax search **/
	initTopToolBar: function () {
		this.theTopToolBar = new Ext.Toolbar({
			items: [{
				icon: '/images/icons/zoom_out.png',
	            tooltip:'<?php echo __('Reset Filter',null,'workflowmanagement'); ?>',
	            handler: function () {
					cf.todoFilterPanel.theCounter = 0;
					cf.todoFilterPanel.theSearchPanel.getForm().reset();
					cf.todoFilterPanel.theFieldGrid.store.removeAll();
					var loadUrl = '<?php echo build_dynamic_javascript_url('todooverview/LoadAllOwnWorkflow')?>';
					cf.todoPanelGrid.theTodoStore.proxy.setApi(Ext.data.Api.actions.read,loadUrl);
					cf.todoPanelGrid.theTodoStore.load();
	            }
				
			},'->',{
            	xtype: 'label',
            	html: '<?php echo __('Items per Page',null,'usermanagement'); ?>: '
            },{
				xtype: 'combo', // number of records to display in grid
				mode: 'local',
				value: '<?php $arr = $sf_user->getAttribute('userSettings'); echo $arr['displayeditem'];?>',
				editable:false,
				triggerAction: 'all',
				foreSelection: true,
				fieldLabel: '',
cf.workflowedit = function(){return {
	
	theLoadingMask				:false,
	thePopUpWindow				:false,
	thePanel					:false,
	theLeftPanel				:false,
	theHiddenfield				:false,
	
	
	init: function (workflowtemplate_id, version_id) {
		cf.workflowedit.theLoadingMask = new Ext.LoadMask(Ext.getBody(), {msg:'<?php echo __('Loading Data...',null,'workflowmanagement'); ?>'});					
		cf.workflowedit.theLoadingMask.show();
		
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('workflowedit/LoadWorkflowData')?>/versionid/' + version_id + '/workflowtemplateid/' + workflowtemplate_id,
			success: function(objServerResponse){
				cf.workflowedit.initPanel();
				var ServerResult = Ext.util.JSON.decode(objServerResponse.responseText);
				var generalData = ServerResult.generalData;
				var slotData = ServerResult.slotData;
				var attachments = ServerResult.workflowAttachment;
				var userData = ServerResult.userData;
				var showNames = ServerResult.showName;
				cf.workflowedit.initWindow(workflowtemplate_id, version_id);
				cf.workflowedit.initLeftNavi();
				
				cf.workfloweditGeneral.init(generalData, workflowtemplate_id);
				cf.workfloweditSlot.init(slotData);
				cf.workfloweditAcceptWorkflow.init();
				cf.workfloweditAttachments.init(attachments);
				cf.workfloweditHiddenPanel.init(userData, showNames);
		});
		
		
	},
	
	initCurrentStationCombo: function () {
		this.theCurrentStation = new Ext.form.ComboBox({
			fieldLabel: '<?php echo __('Active Station',null,'workflowmanagement'); ?>',
			valueField: 'id',
			displayField: 'name',
			editable: false,
			hiddenName: 'filter_currentstation',
			mode: 'local',
			store: new Ext.data.JsonStore({
				root: 'result',
				url: '<?php echo build_dynamic_javascript_url('filter/LoadStation')?>',
				autoload: true,
				fields: [
					{name: 'id'},
					{name: 'name'}
				]
			}),
			triggerAction: 'all',
			selectOnFocus:true,
			allowBlank: true,
			forceSelection:true,
			labelWidth:300,
			width: 225
		});
		
		
	
	createLoadButton: function (id, idName) {
		var btn_copy = new Ext.form.Label({
			html: '<span style="cursor:pointer;"><img src="/images/icons/wand.png" /></span>',
			renderTo: 'TODOFilterLoad'+ id,
			listeners: {
				render: function(c){
					c.getEl().on({
						click: function(el){
							cf.todoFilterPanel.theSearchPanel.getForm().reset();
							cf.todoFilterPanel.theFieldGrid.store.removeAll();
							cf.todoFilterPanel.theCounter = 0;
							cf.todoFilterFilter.theLoadingMask = new Ext.LoadMask(Ext.getBody(), {msg:'<?php echo __('Loading Filter...',null,'workflowmanagement'); ?>'});					
							cf.todoFilterFilter.theLoadingMask.show();
							Ext.Ajax.request({  
								url : '<?php echo build_dynamic_javascript_url('filter/LoadSingleFilter')?>/id/' + id,
								success: function(objServerResponse){
									
									var filterData = Ext.util.JSON.decode(objServerResponse.responseText);
									var data = filterData.result;
									
									if(data.name != '') {
										cf.todoFilterPanel.theName.setValue(data.name);
									}
									if (data.sender_id != 0 && data.sender_id != '' && data.sender_id != -1) {
										cf.todoFilterPanel.theSenderCombo.setValue(data.sender_id);
									}
									if (data.daysfrom != '') {
										Ext.getCmp('todofilter_daysfrom').setValue(data.daysfrom);
									}
									if (data.daysto != '') {
	},
	
	/** add buttons to form **/
	initButtons: function () {
		this.theButtons = new Ext.form.FieldSet({
			style:'margin-top:5px;margin-left:10px;',
			width: 600,
			height: 'auto',
			border: false,
			buttonAlign: 'center',
			buttons:[{
				text:'<?php echo __('Send',null,'sendmessage'); ?>', 
				icon: '/images/icons/accept.png',
				handler: function () {
					cf.administration_sendmessage.theSendMessagePanel.getForm().submit({
						url: '<?php echo build_dynamic_javascript_url('sendmessage/SendMail')?>',
						method: 'POST',
						waitMsg: '<?php echo __('Sending...',null,'sendmessage'); ?>',
						success: function() {
							cf.TabPanel.theTabPanel.remove(cf.administration_sendmessage.theSystemMessageWindow);
							cf.administration_sendmessage.theSystemMessageWindow.hide();
							cf.administration_sendmessage.theSystemMessageWindow.destroy();
							Ext.MessageBox.alert('<?php echo __('OK',null,'sendmessage'); ?>', '<?php echo __('Emails send',null,'sendmessage'); ?>');
						}
					});
					
				}
			},{
				text:'<?php echo __('Close',null,'sendmessage'); ?>', 
				icon: '/images/icons/cancel.png',
				handler: function () {
	*
	*@param int id, id of the record
	*@param boolean isactive
	*/
	createRadiobox: function (id, isactive) {
		var check = isactive == 1 ? true : false;
		var radio = new Ext.form.Radio({
			renderTo: 'mailinglist_radiobox' + id,
			name: 'mailinglist_radioboxGrid_radioStandard',
			checked: check,
			listeners: {
				render: function(c){
					c.getEl().on({
						click: function(el){
							Ext.Ajax.request({  
								url : '<?php echo build_dynamic_javascript_url('mailinglist/SetStandard')?>/id/' + id, 
								success: function(objServerResponse){  
								}
							});
						},
						scope: c
					});
				}
			}
		});
		
	}
	
	
	
	
	},
	
	/** init CM for grid **/
	initCM: function () {
		this.theFieldCM = new Ext.grid.ColumnModel([
			{header: "#", width: 30, sortable: false, dataIndex: '#', css : "text-align : left;font-size:12px;align:center;"},
			{header: "<?php echo __('Field name',null,'documenttemplate'); ?>", width: 175, sortable: false, dataIndex: 'title', css : "text-align : left;font-size:12px;align:left;"},
			{header: "<?php echo __('Field type',null,'documenttemplate'); ?>", width: 120, sortable: false, dataIndex: 'type', css : "text-align : left;font-size:12px;align:left;"}
		]);
	},
	
	/** init store for grid **/
	initStore: function () {
		this.theFormStore = new Ext.data.JsonStore({
				root: 'result',
				url: '<?php echo build_dynamic_javascript_url('documenttemplate/LoadAllFields')?>',
				autoload: false,
				fields: [
					{name: '#'},
					{name: 'id'},
					{name: 'type'},
					{name: 'title'}
				]
		});
	},
	
	/** init grid and load store **/
	initGrid: function () {
		this.theFieldGrid = new Ext.grid.GridPanel({
			title: '<?php echo __('Available Fields',null,'documenttemplate'); ?>',
			stripeRows: true,
/** build useragent tab **/
cf.userSecondTab = function(){return {
	theUserAgentSettingsFieldset		:false,
	thePanel							:false,
	theUserAgenGridFieldset				:false,
	
	theUserGrid							:false,
	theUserCM							:false,
	theUserStore						:false,
	theUserToolbar						:false,
	
	theUserAgentGrid					:false,
	theUserAgentCM						:false,
	theUserAgentStore					:false,
	theUserAgentToolbar					:false,
	
	
	theUniqueId							:0,
	theRemoveField						:false,
	
	
	
	/** init functions **/
	init: function (id) {
		this.theRemoveField = '';
		this.initUserCM();
		this.initUserStore();
		this.initUserToolbar();
		this.initUserGrid();
		
	* 
	* @param int id, ID of the deleted record
	*/
	initDelete: function (id) {
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('additionaltext/DeleteText')?>/id/' + id, 
			success: function(objServerResponse){  
				Ext.Msg.minWidth = 200;
				cf.additionalTextGrid.theTextStore.reload();
				Ext.MessageBox.alert('<?php echo __('OK',null,'additionaltext'); ?>', '<?php echo __('Delete successful',null,'additionaltext'); ?>');
			}
		});
	},
	
	/**
	* function copies an item 
	*
	* @param int id, id of the record to copy
	*/
	initCopy: function (id) {
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('additionaltext/CopyText')?>/id/' + id, 
			success: function(objServerResponse){  
				Ext.Msg.minWidth = 200;
				cf.additionalTextGrid.theTextStore.reload();
				Ext.MessageBox.alert('<?php echo __('OK',null,'additionaltext'); ?>', '<?php echo __('Copy successful',null,'additionaltext'); ?>');
			}
		});
	
	}
};}();
			activeTab: 0,
			enableTabScroll:true,
			border: false,
			deferredRender:true,
			layoutOnTabChange: true,
			forceLayout : true,
			style: 'margin-top:5px;',
			closable:false
		});	
		
	},
	
	/** load and add userdata to elements **/
	addData: function () {
		Ext.Ajax.request({  
			url : '<?php echo build_dynamic_javascript_url('usermanagement/LoadSingleUser')?>/id/' + cf.administration_myprofile.theUserId,
			success: function(objServerResponse){  
				try {
					var data = Ext.util.JSON.decode(objServerResponse.responseText);
					// first Tab
					Ext.getCmp('userFirstTab_firstname').setValue(data.result.firstname);
					Ext.getCmp('userFirstTab_lastname').setValue(data.result.lastname);
					Ext.getCmp('userFirstTab_email').setValue(data.result.email);
					Ext.getCmp('userFirstTab_username').setValue(data.result.username);
					Ext.getCmp('userFirstTab_username').setDisabled(true);
					Ext.getCmp('userFirstTab_password').setValue(data.result.password);
					Ext.getCmp('userFirstTab_passwordagain').setValue(data.result.password);
					Ext.getCmp('userFirstTab_emailformat_id').setValue(data.result.emailformat);
					Ext.getCmp('userFirstTab_emailtype_id').setValue(data.result.emailtype);
					Ext.getCmp('userFirstTab_language_id').setValue(data.result.language);
					
cf.restartWorkflowCRUD = function(){return {
	
	
	doSubmit: function (versionid) {
		Ext.getCmp('restartWorkflowFirstTab_fieldset2').expand();
		Ext.getCmp('restartWorkflowFirstTab_fieldset3').expand();
		Ext.getCmp('restartWorkflowFirstTab_fieldset1').expand();
		cf.restartWorkflowFirstTab.theFirstTabPanel.getForm().submit({
			url: '<?php echo build_dynamic_javascript_url('restartworkflow/RestartWorkflow')?>/versionid/' + versionid,
			method: 'POST',
			waitMsg: '<?php echo __('Saving Data',null,'usermanagement'); ?>',
			success: function(objServerResponse){
				cf.workflowmanagementPanelGrid.theWorkflowStore.reload();
				cf.restartWorkflowWindow.theRestartWorkflowWindow.hide();
				cf.restartWorkflowWindow.theRestartWorkflowWindow.destroy();
				Ext.Msg.minWidth = 200;
				Ext.MessageBox.alert('<?php echo __('OK',null,'workflowmanagement'); ?>','<?php echo __('Workflow restarted',null,'workflowmanagement'); ?>');
				try {
					cf.todoPanelGrid.theTodoStore.reload();
				}
				catch(e) {
					
				}

			},
			failure: function(objServerResponse){
				cf.workflowmanagementPanelGrid.theWorkflowStore.reload();
				cf.restartWorkflowWindow.theRestartWorkflowWindow.hide();
				cf.restartWorkflowWindow.theRestartWorkflowWindow.destroy();
				Ext.Msg.minWidth = 200;
				Ext.MessageBox.alert('<?php echo __('OK',null,'workflowmanagement'); ?>','<?php echo __('Workflow restarted',null,'workflowmanagement'); ?>');
/** gui settings tab **/
cf.userFourthTab = function(){return {
	thePanel				:false,
	theGuiFieldset			:false,
	theWorkflowFieldset		:false,
	
	theFourthGrid			:false,
	theFourthCM				:false,
	theFourthStore			:false,
	theFourthTopToolBar		:false,
	theFirstComboStore		:false,
	theSecondComboStore		:false,
	theComboBox				:false,
	theComboStore			:false,
	theThemeFieldset		:false,
	
	
	
	/** inits all necessarry functions **/
	init: function (storeURL, userThemeUrl) {
		this.initComboStore();
		this.initCombo(userThemeUrl);
		this.initFirstComboboxStore();
		this.initSecondComboboxStore();
		this.initFourthPanel();
		this.initGuiFieldset();
		this.initWorkflowFieldset();
		this.initCM();
		this.initStore(storeURL);
		this.initGrid();
			width: 'auto',
			items: [{
				xtype: 'button',
				text: '<?php echo __('Activate Document template',null,'documenttemplate'); ?>',
				icon: '/images/icons/clock_go.png',
	            tooltip:'<?php echo __('Set Template to active',null,'documenttemplate'); ?>',
				style: 'margin-botton:10px;',
	            handler: function () {
					Ext.Msg.show({
					   title:'<?php echo __('Activate Template',null,'documenttemplate'); ?>?',
					   msg: '<?php echo __('Activate Template',null,'documenttemplate'); ?>?',
					   buttons: Ext.Msg.YESNO,
					   fn: function(btn, text) {
							if(btn == 'yes') {
								Ext.Ajax.request({  
									url : '<?php echo build_dynamic_javascript_url('documenttemplate/ActivateDocumenttemplate')?>/id/' + id + '/documenttemplateid/' + documenttemplateid, 
									success: function(objServerResponse){
										cf.documenttemplateVersionPopUp.theVersionWindow.hide();
										cf.documenttemplateVersionPopUp.theVersionWindow.destroy();
										cf.documenttemplatePanelGrid.theDocumenttemplateStore.reload();
										Ext.Msg.minWidth = 200;
										Ext.MessageBox.alert('<?php echo __('OK',null,'documenttemplate'); ?>','<?php echo __('Template activated',null,'documenttemplate'); ?>');
									}
								});
							}
					   }
					});
	            }
			}]
		});	
		return toolbar;	
cf.mailinglistFirstTab = function(){return {
	theNameFieldset				:false,
	theSenderFieldset			:false,
	theAuthorizationFieldset	:false,
	theFormPanel				:false,
	theComboDocumentStore		:false,
	theUserGrid					:false,
	theUserStore				:false,
	theUserCM					:false,
	theAllowedSenderGrid		:false,
	theAllowedSenderCM			:false,
	theAllowedSenderStore		:false,
	theColumnPanel				:false,
	theAuthorizationCM			:false,
	theAuthorizationStore		:false,
	theAuthorizationGrid		:false,
	theUniqueId					:false,
	theUserToolbar				:false,
	theAllowedSenderToolbar		:false,
	theComboLoadingMask			:false,
	theSendToAllSlots			:false,
	
	/** 
	*
	* init first tab
	*
	*@param string storeurl, url to load store for auth
	*@param int id, id of the record when in edit mode
	*
	*/