[ 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 11 Vtiger_List_Js("Calendar_List_Js",{ 12 13 triggerMassEdit : function(massEditUrl) { 14 Vtiger_List_Js.triggerMassAction(massEditUrl, function(container){ 15 var massEditForm = container.find('#massEdit'); 16 massEditForm.validationEngine(app.validationEngineOptions); 17 var listInstance = Vtiger_List_Js.getInstance(); 18 var editInstance = Vtiger_Edit_Js.getInstance(); 19 listInstance.registerRecordAccessCheckEvent(massEditForm); 20 editInstance.registerBasicEvents(jQuery(container)); 21 listInstance.postMassEdit(container); 22 }); 23 }, 24 25 triggerImportAction : function (importUrl) { 26 var progressIndicatorElement = jQuery.progressIndicator(); 27 AppConnector.request(importUrl).then( 28 function(data) { 29 progressIndicatorElement.progressIndicator({'mode' : 'hide'}); 30 if(data) { 31 app.showModalWindow(data, function(data){ 32 jQuery('#ical_import').validationEngine(app.validationEngineOptions); 33 }); 34 } 35 } 36 ); 37 }, 38 39 triggerExportAction : function (importUrl) { 40 var progressIndicatorElement = jQuery.progressIndicator(); 41 AppConnector.request(importUrl).then( 42 function(data) { 43 progressIndicatorElement.progressIndicator({'mode' : 'hide'}); 44 if(data) { 45 app.showModalWindow(data, function(data){ 46 }); 47 } 48 } 49 ); 50 } 51 52 },{ 53 54 registerHoldFollowupOnEvent : function(){ 55 var thisInstance = this; 56 var listViewContentDiv = this.getListViewContentContainer(); 57 listViewContentDiv.on('click','.holdFollowupOn',function(e){ 58 var elem = jQuery(e.currentTarget); 59 var recordId = elem.closest('tr').data('id'); 60 61 var url = 'index.php?module=Calendar&view=QuickCreateFollowupAjax&record='+recordId; 62 var progressIndicatorInstance = jQuery.progressIndicator({}); 63 AppConnector.request(url).then( 64 function(data){ 65 if(data){ 66 progressIndicatorInstance.hide(); 67 app.showModalWindow(data, function(data){ 68 var createFollowupForm = data.find('form.followupCreateView'); 69 createFollowupForm.validationEngine(app.validationEngineOptions); 70 app.registerEventForTimeFields(createFollowupForm); 71 //Form submit 72 createFollowupForm.submit(function(event){ 73 var createButton = jQuery(this).find('button.btn-success'); 74 createButton.attr('disabled','disabled'); 75 progressIndicatorInstance = jQuery.progressIndicator({}); 76 event.preventDefault(); 77 var result = createFollowupForm.validationEngine('validate'); 78 if(!result){ 79 createButton.removeAttr('disabled'); 80 progressIndicatorInstance.hide(); 81 return false; 82 } 83 var moduleName = jQuery(this).find("[name='module']").val(); 84 var recordId = jQuery(this).find("[name='record']").val(); 85 var followupStartDate = jQuery(this).find("[name='followup_date_start']").val(); 86 var followupStartTime = jQuery(this).find("[name='followup_time_start']").val(); 87 var action = jQuery(this).find("[name='action']").val(); 88 var mode = jQuery(this).find("[name='mode']").val(); 89 var defaultCallDuration = jQuery(this).find("[name='defaultCallDuration']").val(); 90 var defaultOtherEventDuration = jQuery(this).find("[name='defaultOtherEventDuration']").val(); 91 var params = { 92 module : moduleName, 93 action : action, 94 mode : mode, 95 record : recordId, 96 followup_date_start : followupStartDate, 97 followup_time_start : followupStartTime, 98 defaultOtherEventDuration : defaultOtherEventDuration, 99 defaultCallDuration : defaultCallDuration 100 } 101 AppConnector.request(params).then(function(data){ 102 app.hideModalWindow(); 103 progressIndicatorInstance.hide(); 104 if(data['result'] && data['result'].created){ 105 //Update listview and pagination 106 var orderBy = jQuery('#orderBy').val(); 107 var sortOrder = jQuery("#sortOrder").val(); 108 var urlParams = { 109 "orderby": orderBy, 110 "sortorder": sortOrder 111 } 112 jQuery('#recordsCount').val(''); 113 jQuery('#totalPageCount').text(''); 114 thisInstance.getListViewRecords(urlParams).then(function(){ 115 thisInstance.updatePagination(); 116 }); 117 } 118 }); 119 }); 120 }); 121 } 122 else{ 123 progressIndicatorInstance.hide(); 124 Vtiger_Helper_Js.showPnotify(app.vtranslate('JS_NO_EDIT_PERMISSION')); 125 } 126 }); 127 e.stopPropagation(); 128 }); 129 }, 130 131 registerMarkAsHeldEvent : function(){ 132 var thisInstance = this; 133 var listViewContentDiv = this.getListViewContentContainer(); 134 listViewContentDiv.on('click','.markAsHeld',function(e){ 135 var elem = jQuery(e.currentTarget); 136 var recordId = elem.closest('tr').data('id'); 137 var message = app.vtranslate('JS_CONFIRM_MARK_AS_HELD'); 138 Vtiger_Helper_Js.showConfirmationBox({'message' : message}).then( 139 function(e) { 140 var params = { 141 module : "Calendar", 142 action : "SaveFollowupAjax", 143 mode : "markAsHeldCompleted", 144 record : recordId 145 } 146 AppConnector.request(params).then(function(data){ 147 if(data['error']){ 148 var param = {text:app.vtranslate('JS_PERMISSION_DENIED')}; 149 Vtiger_Helper_Js.showPnotify(param); 150 } 151 else if(data['result'].valid && data['result'].markedascompleted){ 152 //Update listview and pagination 153 var orderBy = jQuery('#orderBy').val(); 154 var sortOrder = jQuery("#sortOrder").val(); 155 var urlParams = { 156 "orderby": orderBy, 157 "sortorder": sortOrder 158 } 159 jQuery('#recordsCount').val(''); 160 jQuery('#totalPageCount').text(''); 161 thisInstance.getListViewRecords(urlParams).then(function(){ 162 thisInstance.updatePagination(); 163 }); 164 if(data['result'].activitytype == 'Task') 165 var param = {text:app.vtranslate('JS_TODO_MARKED_AS_COMPLETED')}; 166 else 167 var param = {text:app.vtranslate('JS_EVENT_MARKED_AS_HELD')}; 168 Vtiger_Helper_Js.showMessage(param); 169 } 170 else{ 171 var param = {text:app.vtranslate('JS_FUTURE_EVENT_CANNOT_BE_MARKED_AS_HELD')}; 172 Vtiger_Helper_Js.showPnotify(param); 173 } 174 }); 175 }, 176 function(error, err){ 177 return false; 178 }); 179 e.stopPropagation(); 180 }); 181 }, 182 183 registerEvents : function(){ 184 this._super(); 185 this.registerHoldFollowupOnEvent(); 186 this.registerMarkAsHeldEvent(); 187 } 188 189 });
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 |