[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /*+*********************************************************************************** 2 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 *************************************************************************************/ 9 10 Settings_Vtiger_List_Js("Settings_Users_List_Js",{ 11 12 /* 13 * function to trigger delete record action 14 * @params: delete record url. 15 */ 16 deleteRecord : function(deleteRecordActionUrl) { 17 var message = app.vtranslate('LBL_DELETE_USER_CONFIRMATION'); 18 Vtiger_Helper_Js.showConfirmationBox({'message' : message}).then(function(data) { 19 AppConnector.request(deleteRecordActionUrl).then( 20 function(data){ 21 if(data){ 22 var callback = function(data) { 23 var params = app.validationEngineOptions; 24 params.onValidationComplete = function(form, valid){ 25 if(valid){ 26 Settings_Users_List_Js.deleteUser(form) 27 } 28 return false; 29 } 30 jQuery('#deleteUser').validationEngine(app.validationEngineOptions); 31 } 32 app.showModalWindow(data, function(data){ 33 if(typeof callback == 'function'){ 34 callback(data); 35 } 36 }); 37 } 38 }); 39 }, 40 function(error, err){ 41 } 42 ); 43 }, 44 45 deleteUser: function (form){ 46 var userid = form.find('[name="userid"]').val(); 47 var transferUserId = form.find('[name="tranfer_owner_id"]').val(); 48 var progressInstance = jQuery.progressIndicator({ 49 'position' : 'html', 50 'blockInfo' : { 51 'enabled' : true 52 } 53 }); 54 var params = { 55 'module': app.getModuleName(), 56 'action' : "DeleteAjax", 57 'transfer_user_id' : transferUserId, 58 'userid' : userid, 59 'permanent' : jQuery('[name="deleteUserPermanent"]:checked', form).val() 60 } 61 AppConnector.request(params).then( 62 function(data) { 63 if(data.success){ 64 app.hideModalWindow(); 65 progressInstance.progressIndicator({ 66 'mode' : 'hide' 67 }); 68 params = { 69 title : app.vtranslate('JS_MESSAGE'), 70 text : data.result.message, 71 animation: 'show', 72 type: 'error' 73 }; 74 Vtiger_Helper_Js.showPnotify(params); 75 jQuery('[data-id='+userid+"]").hide(); 76 } 77 } 78 ); 79 }, 80 81 /* 82 *Function to delete a user permanently 83 *@param userId, event 84 */ 85 deleteUserPermanently : function(userId, e) { 86 e.stopPropagation(); 87 var message = app.vtranslate('LBL_DELETE_USER_PERMANENT_CONFIRMATION'); 88 var deleteRecordActionUrl = 'index.php?module='+app.getModuleName()+'&parent='+app.getParentModuleName()+'&view=DeleteUser&mode=permanent&record='+userId; 89 Vtiger_Helper_Js.showConfirmationBox({'message' : message}).then( 90 function(data) { 91 AppConnector.request(deleteRecordActionUrl).then( 92 function(data) { 93 if(data){ 94 var callback = function(data) { 95 var params = app.validationEngineOptions; 96 params.onValidationComplete = function(form, valid){ 97 if(valid){ 98 var progressInstance = jQuery.progressIndicator({ 99 'position' : 'html', 100 'blockInfo' : { 101 'enabled' : true 102 } 103 }); 104 var params = { 105 'module': app.getModuleName(), 106 'action' : "DeleteAjax", 107 'userid' : userId, 108 'transfer_user_id' : form.find('[name="tranfer_owner_id"]').val(), 109 'mode' : 'permanent' 110 } 111 app.hideModalWindow(); 112 AppConnector.request(params).then( 113 function(response) { 114 if(response.success){ 115 progressInstance.progressIndicator({ 116 'mode' : 'hide' 117 }); 118 params = { 119 title : app.vtranslate('JS_MESSAGE'), 120 text : response.result.message, 121 animation: 'show', 122 type: 'error' 123 }; 124 Vtiger_Helper_Js.showPnotify(params); 125 jQuery('[data-id='+userId+"]").hide(); 126 } 127 } 128 ); 129 } 130 return false; 131 } 132 jQuery('#deleteUser').validationEngine(app.validationEngineOptions); 133 } 134 app.showModalWindow(data, function(data){ 135 if(typeof callback == 'function'){ 136 callback(data); 137 } 138 }); 139 } 140 }); 141 } 142 ); 143 }, 144 145 /* 146 *Function to restore Inactive User 147 *@param userId, event 148 */ 149 restoreUser : function(userId, e) { 150 e.stopPropagation(); 151 Vtiger_Helper_Js.showConfirmationBox({ 152 'message' : app.vtranslate('LBL_RESTORE_CONFIRMATION') 153 }).then( function() { 154 var progressInstance = jQuery.progressIndicator({ 155 'position' : 'html', 156 'blockInfo' : { 157 'enabled' : true 158 } 159 }); 160 var params = { 161 'module': app.getModuleName(), 162 'action' : "SaveAjax", 163 'userid' : userId, 164 'mode' : 'restoreUser' 165 } 166 AppConnector.request(params).then( 167 function(response) { 168 if(response.success){ 169 progressInstance.progressIndicator({ 170 'mode' : 'hide' 171 }); 172 Vtiger_Helper_Js.showPnotify(response.result.message); 173 var url = response.result.listViewUrl; 174 window.location.href=url; 175 } 176 } 177 ); 178 }); 179 } 180 181 },{ 182 183 184 /* 185 * Function to get Page Jump Params 186 */ 187 getPageJumpParams : function(){ 188 var module = app.getModuleName(); 189 var cvId = this.getCurrentCvId(); 190 var pageCountParams = { 191 'module' : module, 192 'view' : "ListAjax", 193 'mode' : "getPageCount", 194 'search_key' : 'status', 195 'operator' : 'e', 196 'search_value' : jQuery('#usersFilter').val() 197 } 198 return pageCountParams; 199 }, 200 /* 201 * Function to register the list view delete record click event 202 */ 203 registerDeleteRecordClickEvent: function(){ 204 var listViewContentDiv = this.getListViewContentContainer(); 205 listViewContentDiv.on('click','.deleteRecordButton',function(e){ 206 var elem = jQuery(e.currentTarget); 207 var rowElement = elem.closest('tr'); 208 var deleteActionUrl = jQuery('[name="deleteActionUrl"]',rowElement).val(); 209 Settings_Users_List_Js.deleteRecord(deleteActionUrl); 210 e.stopPropagation(); 211 }); 212 }, 213 214 /* 215 *Function to filter Active and Inactive users from Users List View 216 */ 217 usersFilter : function() { 218 var thisInstance = this; 219 jQuery('#usersFilter').change(function() { 220 var progressInstance = jQuery.progressIndicator({ 221 'position' : 'html', 222 'blockInfo' : { 223 'enabled' : true 224 } 225 }); 226 var params = { 227 'module' : app.getModuleName(), 228 'view' : 'List', 229 'parent' : app.getParentModuleName(), 230 'search_key' : 'status', 231 'operator' : 'e', 232 'search_value' : jQuery('#usersFilter').val() 233 }; 234 AppConnector.request(params).then( 235 function(data){ 236 progressInstance.progressIndicator({ 237 'mode' : 'hide' 238 }); 239 jQuery('#listViewContents').html(data); 240 thisInstance.updatePagination(); 241 } 242 ); 243 }); 244 }, 245 246 247 registerEvents : function() { 248 this._super(); 249 this.registerEventForAlphabetSearch(); 250 this.registerEmailFieldClickEvent(); 251 this.registerUrlFieldClickEvent(); 252 this.registerDeleteRecordClickEvent(); 253 this.usersFilter(); 254 } 255 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |