init
This commit is contained in:
91
jssource/src_files/modules/ACLRoles/ACLRoles.js
Normal file
91
jssource/src_files/modules/ACLRoles/ACLRoles.js
Normal file
@@ -0,0 +1,91 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var aclviewer = function(){
|
||||
var lastDisplay = '';
|
||||
return {
|
||||
view: function(role_id, role_module){
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php',{'success':aclviewer.display, 'failure':aclviewer.failed}, 'module=ACLRoles&action=EditRole&record=' + role_id + '&category_name=' + role_module);
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'));
|
||||
},
|
||||
save: function(form_name){
|
||||
var formObject = document.getElementById(form_name);
|
||||
YAHOO.util.Connect.setForm(formObject);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php',{'success':aclviewer.postSave, 'failure':aclviewer.failed} );
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));
|
||||
},
|
||||
postSave: function(o){
|
||||
eval(o.responseText);
|
||||
aclviewer.view(result['role_id'], result['module']);
|
||||
},
|
||||
display:function(o){
|
||||
aclviewer.lastDisplay = '';
|
||||
ajaxStatus.flashStatus('Done');
|
||||
document.getElementById('category_data').innerHTML = o.responseText;
|
||||
|
||||
},
|
||||
failed:function(){
|
||||
ajax.flashStatus('Could Not Connect');
|
||||
},
|
||||
|
||||
toggleDisplay:function(id){
|
||||
if(aclviewer.lastDisplay != '' && typeof(aclviewer.lastDisplay) != 'undefined'){
|
||||
aclviewer.hideDisplay(aclviewer.lastDisplay);
|
||||
}
|
||||
if(aclviewer.lastDisplay != id){
|
||||
aclviewer.showDisplay(id);
|
||||
aclviewer.lastDisplay = id;
|
||||
} else{
|
||||
aclviewer.lastDisplay = '';
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
hideDisplay:function(id){
|
||||
document.getElementById(id).style.display = 'none';
|
||||
document.getElementById(id + 'link').style.display = '';
|
||||
|
||||
},
|
||||
|
||||
showDisplay:function(id){
|
||||
document.getElementById(id).style.display = '';
|
||||
document.getElementById(id + 'link').style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
}();
|
||||
89
jssource/src_files/modules/Accounts/Account.js
Normal file
89
jssource/src_files/modules/Accounts/Account.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function open_contact_popup(module_name, width, height, initial_filter, close_popup, hide_clear_button, popup_request_data, popup_mode, create, metadata)
|
||||
{
|
||||
// set the variables that the popup will pull from
|
||||
window.document.popup_request_data = popup_request_data;
|
||||
window.document.close_popup = close_popup;
|
||||
|
||||
// launch the popup
|
||||
URL = 'index.php?mode=MultiSelect&'
|
||||
+ 'module=' + module_name
|
||||
+ '&action=ContactAddressPopup';
|
||||
|
||||
if(initial_filter != '')
|
||||
{
|
||||
URL += '&query=true' + initial_filter;
|
||||
}
|
||||
|
||||
if(hide_clear_button)
|
||||
{
|
||||
URL += '&hide_clear_button=true';
|
||||
}
|
||||
|
||||
windowName = 'popup_window';
|
||||
|
||||
windowFeatures = 'width=' + width
|
||||
+ ',height=' + height
|
||||
+ ',resizable=1,scrollbars=1';
|
||||
|
||||
if (popup_mode == '' && popup_mode == 'undefined') {
|
||||
popup_mode='single';
|
||||
}
|
||||
URL+='&mode='+popup_mode;
|
||||
if (create == '' && create == 'undefined') {
|
||||
create = 'false';
|
||||
}
|
||||
URL+='&create='+create;
|
||||
|
||||
if (metadata != '' && metadata != 'undefined') {
|
||||
URL+='&metadata='+metadata;
|
||||
}
|
||||
|
||||
win = window.open(URL, windowName, windowFeatures);
|
||||
|
||||
if(window.focus)
|
||||
{
|
||||
// put the focus on the popup if the browser supports the focus() method
|
||||
win.focus();
|
||||
}
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
function set_focus(){
|
||||
document.getElementById('name').focus();
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
// defense
|
||||
if(typeof(SUGAR) == 'undefined') {
|
||||
var SUGAR = {};
|
||||
}
|
||||
|
||||
SUGAR.Administration = {
|
||||
/**
|
||||
* calls modules/Administration/Async.php with JSON objects
|
||||
*/
|
||||
Async : {
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility functions for RepairXSS screen
|
||||
* @param HTMLSelectObject select dropdown
|
||||
*/
|
||||
RepairXSS : {
|
||||
toRepair : new Object, // assoc array of items to be cleaned
|
||||
currentRepairObject : "", // bean currently worked on
|
||||
currentRepairIds : new Array(), // array of ids for above bean
|
||||
repairedCount : 0,
|
||||
numberToFix: 25, // how many IDs to send at once from client
|
||||
|
||||
/**
|
||||
* Calculates how many rows to iterate through
|
||||
*/
|
||||
refreshEstimate : function(select) {
|
||||
this.toRepair = new Object();
|
||||
this.repairedCount = 0;
|
||||
|
||||
var button = document.getElementById('repairXssButton');
|
||||
var selected = select.value;
|
||||
var totalDisplay = document.getElementById('repairXssDisplay');
|
||||
var counter = document.getElementById('repairXssCount');
|
||||
var repaired = document.getElementById('repairXssResults');
|
||||
var repairedCounter = document.getElementById('repairXssResultCount');
|
||||
|
||||
if(selected != "0") {
|
||||
button.style.display = 'inline';
|
||||
repairedCounter.value = 0;
|
||||
AjaxObject.startRequest(callbackRepairXssRefreshEstimate, "&adminAction=refreshEstimate&bean=" + selected);
|
||||
} else {
|
||||
button.style.display = 'none';
|
||||
totalDisplay.style.display = 'none';
|
||||
repaired.style.display = 'none';
|
||||
counter.value = 0;
|
||||
repaired.value= 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Takes selection and executes repair function
|
||||
*/
|
||||
executeRepair : function() {
|
||||
if(this.toRepair) {
|
||||
// if queue is empty load next
|
||||
if(this.currentRepairIds.length < 1) {
|
||||
if(!this.loadRepairQueue()) {
|
||||
alert(done);
|
||||
return; // we're done
|
||||
}
|
||||
}
|
||||
|
||||
var beanIds = new Array();
|
||||
|
||||
for(var i=0; i<this.numberToFix; i++) {
|
||||
if(this.currentRepairIds.length > 0) {
|
||||
beanIds.push(this.currentRepairIds.pop());
|
||||
}
|
||||
}
|
||||
|
||||
var beanId = JSON.stringifyNoSecurity(beanIds);
|
||||
AjaxObject.startRequest(callbackRepairXssExecute, "&adminAction=repairXssExecute&bean=" + this.currentRepairObject + "&id=" + beanId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the bean name and array of bean ids for repair
|
||||
* @return bool False if load did not occur
|
||||
*/
|
||||
loadRepairQueue : function() {
|
||||
var loaded = false;
|
||||
|
||||
this.currentRepairObject = '';
|
||||
this.currentRepairIds = new Array();
|
||||
|
||||
for(var bean in this.toRepair) {
|
||||
if(this.toRepair[bean].length > 0) {
|
||||
this.currentRepairObject = bean;
|
||||
this.currentRepairIds = this.toRepair[bean];
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 'unset' the IDs array so we don't iterate over it again
|
||||
this.toRepair[this.currentRepairObject] = new Array();
|
||||
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
118
jssource/src_files/modules/Administration/javascript/Async.js
Normal file
118
jssource/src_files/modules/Administration/javascript/Async.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var AjaxObject = {
|
||||
ret : '',
|
||||
currentRequestObject : null,
|
||||
timeout : 30000, // 30 second timeout default
|
||||
forceAbort : false,
|
||||
|
||||
/**
|
||||
*/
|
||||
_reset : function() {
|
||||
this.timeout = 30000;
|
||||
this.forceAbort = false;
|
||||
},
|
||||
handleFailure : function(o) {
|
||||
alert('asynchronous call failed.');
|
||||
},
|
||||
/**
|
||||
*/
|
||||
startRequest : function(callback, args, forceAbort) {
|
||||
if(this.currentRequestObject != null) {
|
||||
if(this.forceAbort == true || callback.forceAbort == true) {
|
||||
YAHOO.util.Connect.abort(this.currentRequestObject, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
this.currentRequestObject = YAHOO.util.Connect.asyncRequest('POST', "./index.php?module=Administration&action=Async&to_pdf=true", callback, args);
|
||||
this._reset();
|
||||
},
|
||||
|
||||
/**************************************************************************
|
||||
* Place callback handlers below this comment
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* gets an estimate of how many rows to process
|
||||
*/
|
||||
refreshEstimate : function(o) {
|
||||
this.ret = JSON.parse(o.responseText);
|
||||
document.getElementById('repairXssDisplay').style.display = 'inline';
|
||||
document.getElementById('repairXssCount').value = this.ret.count;
|
||||
|
||||
SUGAR.Administration.RepairXSS.toRepair = this.ret.toRepair;
|
||||
},
|
||||
showRepairXssResult : function(o) {
|
||||
var resultCounter = document.getElementById('repairXssResultCount');
|
||||
|
||||
this.ret = JSON.parse(o.responseText);
|
||||
document.getElementById('repairXssResults').style.display = 'inline';
|
||||
|
||||
if(this.ret.msg == 'success') {
|
||||
SUGAR.Administration.RepairXSS.repairedCount += this.ret.count;
|
||||
resultCounter.value = SUGAR.Administration.RepairXSS.repairedCount;
|
||||
} else {
|
||||
resultCounter.value = this.ret;
|
||||
}
|
||||
|
||||
SUGAR.Administration.RepairXSS.executeRepair();
|
||||
}
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* MODEL callback object:
|
||||
* ****************************************************************************
|
||||
var callback = {
|
||||
success:AjaxObject.handleSuccess,
|
||||
failure:AjaxObject.handleFailure,
|
||||
timeout:AjaxObject.timeout,
|
||||
scope:AjaxObject,
|
||||
forceAbort:true, // optional
|
||||
argument:[ieId, ieName, focusFolder] // optional
|
||||
};
|
||||
*/
|
||||
|
||||
var callbackRepairXssRefreshEstimate = {
|
||||
success:AjaxObject.refreshEstimate,
|
||||
failure:AjaxObject.handleFailure,
|
||||
timeout:AjaxObject.timeout,
|
||||
scope:AjaxObject
|
||||
};
|
||||
var callbackRepairXssExecute = {
|
||||
success:AjaxObject.showRepairXssResult,
|
||||
failure:AjaxObject.handleFailure,
|
||||
timeout:AjaxObject.timeout,
|
||||
scope:AjaxObject
|
||||
};
|
||||
62
jssource/src_files/modules/Campaigns/DetailView.js
Normal file
62
jssource/src_files/modules/Campaigns/DetailView.js
Normal file
@@ -0,0 +1,62 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
function set_return_prospect_list_and_save(popup_reply_data)
|
||||
{
|
||||
var form_name = popup_reply_data.form_name;
|
||||
var name_to_value_array = popup_reply_data.name_to_value_array;
|
||||
|
||||
|
||||
for (var the_key in name_to_value_array)
|
||||
{
|
||||
if(the_key == 'toJSON')
|
||||
{
|
||||
/* just ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
window.document.forms[form_name].elements[the_key].value = name_to_value_array[the_key];
|
||||
}
|
||||
}
|
||||
|
||||
window.document.forms[form_name].module.value = 'Campaigns';
|
||||
window.document.forms[form_name].return_module.value = window.document.forms[form_name].module.value;
|
||||
window.document.forms[form_name].return_action.value = 'DetailView';
|
||||
window.document.forms[form_name].return_id.value = window.document.forms[form_name].record.value;
|
||||
window.document.forms[form_name].action.value = 'SaveCampaignProspectListRelationship';
|
||||
window.document.forms[form_name].submit();
|
||||
}
|
||||
225
jssource/src_files/modules/Campaigns/WebToLead.js
Normal file
225
jssource/src_files/modules/Campaigns/WebToLead.js
Normal file
@@ -0,0 +1,225 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
//grid functions
|
||||
|
||||
var grid2, grid3, grid4, grid3F,grid4F;
|
||||
var add_all_fields = SUGAR.language.get('app_strings', 'LBL_ADD_ALL_LEAD_FIELDS');
|
||||
var remove_all_fields = SUGAR.language.get('app_strings', 'LBL_REMOVE_ALL_LEAD_FIELDS');
|
||||
|
||||
function addGrids(form_name) {
|
||||
//check if any vals selected in grid3 and grid4
|
||||
// if none then prompt for validation
|
||||
//alert(check_form('WebToLeadCreation'));
|
||||
if(!check_form('WebToLeadCreation')){
|
||||
return false;
|
||||
//stop
|
||||
}
|
||||
else{
|
||||
grid3 = SUGAR_GRID_grid1;
|
||||
grid4 = SUGAR_GRID_grid2;
|
||||
var webFormDiv = document.getElementById('webformfields');
|
||||
//add columns to webformfields div
|
||||
addCols(grid3,'colsFirst',webFormDiv);
|
||||
addCols(grid4,'colsSecond',webFormDiv);
|
||||
return true;
|
||||
} //return check_form(form_name);
|
||||
}
|
||||
function checkFields(REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS){
|
||||
grid2 = SUGAR_GRID_grid0;
|
||||
grid3 = SUGAR_GRID_grid1;
|
||||
grid4 = SUGAR_GRID_grid2;
|
||||
//check if all required fields are selected
|
||||
var reqFields = '';
|
||||
for(var i=0; i < grid2.getRecordSet().getLength(); i++){
|
||||
if(grid2.getRecord(i).getData()[2] != null){
|
||||
reqFields = reqFields+grid2.getRecord(i).getData()[0]+', ';
|
||||
}
|
||||
}
|
||||
if(reqFields){
|
||||
reqFields = reqFields.substring(0,reqFields.lastIndexOf(','));
|
||||
alert(REQUIRED_LEAD_FIELDS+' '+reqFields);
|
||||
return false;
|
||||
}
|
||||
else if(grid3.getRecordSet().getLength()==1 && grid4.getRecordSet().getLength()==1){
|
||||
alert(LEAD_SELECT_FIELDS);
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function askLeadQ(direction,REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS){
|
||||
//change current step value to that of the step being navigated to
|
||||
if(direction == 'back'){
|
||||
var grid_Div = document.getElementById('grid_Div');
|
||||
var lead_Div = document.getElementById('lead_queries_Div');
|
||||
grid_Div.style.display='block';
|
||||
lead_Div.style.display='none';
|
||||
}
|
||||
|
||||
if(direction == 'next'){
|
||||
if(!checkFields(REQUIRED_LEAD_FIELDS,LEAD_SELECT_FIELDS)){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
var lead_Div = document.getElementById('lead_queries_Div');
|
||||
var grid_Div = document.getElementById('grid_Div');
|
||||
lead_Div.style.display='block';
|
||||
grid_Div.style.display='none';
|
||||
}
|
||||
}
|
||||
}
|
||||
function campaignPopulated(){
|
||||
var camp_populated = document.getElementById('campaign_id');
|
||||
if(camp_populated.value == 0){
|
||||
return true;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
function selectFields(indexes,grid){
|
||||
var retStr='';
|
||||
for(var i=0;i<indexes.length;i++){
|
||||
retStr=retStr+grid.getRow(indexes[i]).childNodes[0].childNodes[0].innerHTML+','+'\n';
|
||||
retStr=retStr+'\n';
|
||||
}
|
||||
return retStr.substring(0,retStr.lastIndexOf(','));
|
||||
}
|
||||
// grid4.render();
|
||||
|
||||
function displayAddRemoveDragButtons(Add_All_Fields,Remove_All_Fields){
|
||||
var addRemove = document.getElementById("lead_add_remove_button");
|
||||
if(grid2.getRecordSet().getLength() ==0) {
|
||||
addRemove.setAttribute('value',Remove_All_Fields);
|
||||
addRemove.setAttribute('title',Remove_All_Fields);
|
||||
}
|
||||
else if(grid3.getRecordSet().getLength() ==0 && grid4.getRecordSet().getLength() ==0){
|
||||
addRemove.setAttribute('value',Add_All_Fields);
|
||||
addRemove.setAttribute('title',Add_All_Fields);
|
||||
}
|
||||
}
|
||||
|
||||
function displayAddRemoveButtons(Add_All_Fields,Remove_All_Fields){
|
||||
var addRemove = document.getElementById("lead_add_remove_button");
|
||||
if(grid2.getRecordSet().getLength() > 1) {
|
||||
addRemove.setAttribute('value',Add_All_Fields);
|
||||
addRemove.setAttribute('title',Add_All_Fields);
|
||||
}
|
||||
else{
|
||||
addRemove.setAttribute('value',Remove_All_Fields);
|
||||
addRemove.setAttribute('title',Remove_All_Fields);
|
||||
}
|
||||
}
|
||||
function dragDropAllFields(Add_All_Fields, Remove_All_Fields){
|
||||
//set the grids to the SUGAR_GRID grids
|
||||
|
||||
grid2 = SUGAR_GRID_grid0;
|
||||
grid3 = SUGAR_GRID_grid1;
|
||||
grid4 = SUGAR_GRID_grid2;
|
||||
//move from main grid to columns 1&2
|
||||
var addRemove = document.getElementById("lead_add_remove_button");
|
||||
var availibleSet = grid2.getRecordSet();
|
||||
var availibleCount = availibleSet.getLength() ;
|
||||
if(addRemove.value == Add_All_Fields && availibleCount > 1) { //Contains more than the empty node
|
||||
for(var i=0; i < availibleCount; i++){
|
||||
if(i%2 ==0 && availibleSet.getRecord(i).getData()[0] != " "){
|
||||
grid3.addRow(availibleSet.getRecord(i).getData(), (i / 2));
|
||||
}
|
||||
if(i%2 ==1 && availibleSet.getRecord(i).getData()[0] != " "){
|
||||
grid4.addRow(availibleSet.getRecord(i).getData(), ((i - 1) / 2));
|
||||
}
|
||||
}
|
||||
for (i = availibleCount - 1; i >= 0; i--) {
|
||||
if(grid2.getRecord(i) != null && grid2.getRecord(i).getData()[0] != " ") {
|
||||
grid2.deleteRow(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(addRemove.value==Remove_All_Fields){ //move back to the main grid if grid is empty and columns populated
|
||||
var count =0;
|
||||
if(grid3.getRecordSet().getLength() >= grid4.getRecordSet().getLength()){
|
||||
count = grid3.getRecordSet().getLength();
|
||||
}
|
||||
else{
|
||||
count = grid4.getRecordSet().getLength();
|
||||
}
|
||||
//put back into grid2 in the same order
|
||||
for(var i = 0; i < count; i++){
|
||||
if(grid3.getRecord(i) != null && grid3.getRecord(i).getData()[0] != " "){
|
||||
grid2.addRow(grid3.getRecord(i).getData(), grid2.getRecordSet().getLength() - 1);
|
||||
}
|
||||
if(grid4.getRecord(i) != null && grid4.getRecord(i).getData()[0] != " "){
|
||||
grid2.addRow(grid4.getRecord(i).getData(), grid2.getRecordSet().getLength() - 1);
|
||||
}
|
||||
}
|
||||
for(var i = count - 1; i >= 0; i--){
|
||||
if(grid4.getRecord(i) != null && grid4.getRecord(i).getData()[0] != " ") {
|
||||
grid4.deleteRow(i);
|
||||
}
|
||||
if(grid3.getRecord(i) != null && grid3.getRecord(i).getData()[0] != " ") {
|
||||
grid3.deleteRow(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
displayAddRemoveButtons(Add_All_Fields,Remove_All_Fields);
|
||||
}
|
||||
|
||||
|
||||
function addCols(grid, colsNumber, webFormDiv){
|
||||
for(var i = 0; i < grid.getRecordSet().getLength() - 1; i++){
|
||||
var selectedEl = grid.getRecord(i).getData()[1];
|
||||
var webField = document.createElement('input');
|
||||
webField.setAttribute('id', colsNumber+i);
|
||||
webField.setAttribute('name',colsNumber+'[]');
|
||||
webField.setAttribute('type', 'hidden');
|
||||
webField.setAttribute('value',selectedEl);
|
||||
webFormDiv.appendChild(webField);
|
||||
}
|
||||
}
|
||||
function editUrl(){
|
||||
var chk_url_elm = document.getElementById("chk_edit_url");
|
||||
if(chk_url_elm.checked==true){
|
||||
var url_elm = document.getElementById("post_url");
|
||||
url_elm.disabled=false;
|
||||
}
|
||||
if(chk_url_elm.checked==false){
|
||||
var url_elm = document.getElementById("post_url");
|
||||
url_elm.disabled=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
290
jssource/src_files/modules/Campaigns/wizard.js
Normal file
290
jssource/src_files/modules/Campaigns/wizard.js
Normal file
@@ -0,0 +1,290 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* this function hides a div element using the passed in id value
|
||||
*/
|
||||
function hide(divname){
|
||||
var elem1 = document.getElementById(divname);
|
||||
elem1.style.display = 'none';
|
||||
}
|
||||
|
||||
/*
|
||||
* this function shows a div using the passed in value
|
||||
*/
|
||||
function show(div){
|
||||
var elem1 = document.getElementById(div);
|
||||
elem1.style.display = '';
|
||||
}
|
||||
/*
|
||||
* this function calls the methods to hide all divs and show the passed in div
|
||||
*/
|
||||
function showdiv(div){
|
||||
hideall();
|
||||
show(div);
|
||||
}
|
||||
|
||||
/*
|
||||
* this function iterates through all "stepx" divs (ie. step1, step2,etc) and hides them
|
||||
*/
|
||||
function hideall(){
|
||||
var last_val = document.getElementById('wiz_total_steps');
|
||||
var last = parseInt(last_val.value);
|
||||
for(i=1; i<=last; i++){
|
||||
hide('step'+i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*this function should be run first. It will call the methods that:
|
||||
* 1.hide the divs initially
|
||||
* 2.show the first div
|
||||
* 3.shows/hides the proper buttons
|
||||
* 4.highlites the step title
|
||||
* 5.adjusts the step location message
|
||||
*/
|
||||
function showfirst(wiz_mode){
|
||||
//no validation needed.
|
||||
|
||||
//show first step
|
||||
showdiv('step1');
|
||||
|
||||
//set div value
|
||||
var current_step = document.getElementById('wiz_current_step');
|
||||
current_step.value="1";
|
||||
|
||||
//set button values
|
||||
|
||||
|
||||
var save_button = document.getElementById('wiz_submit_button');
|
||||
var next_button = document.getElementById('wiz_next_button');
|
||||
var save_button_div = document.getElementById('save_button_div');
|
||||
var next_button_div = document.getElementById('next_button_div');
|
||||
var back_button_div = document.getElementById('back_button_div');
|
||||
|
||||
save_button.disabled = true;
|
||||
back_button_div.style.display = 'none';
|
||||
save_button_div.style.display = 'none';
|
||||
next_button.focus();
|
||||
if(wiz_mode == 'marketing'){
|
||||
back_button_div.style.display = '';
|
||||
}
|
||||
|
||||
//set nav hi-lite
|
||||
hilite(current_step.value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*this function runs on each navigation in the wizard. It will call the methods that:
|
||||
* 1.hide the divs
|
||||
* 2.show the div being navigated to
|
||||
* 3.shows/hides the proper buttons
|
||||
* 4.highlites the step title
|
||||
* 5.adjusts the step location message
|
||||
*/
|
||||
|
||||
function navigate(direction){
|
||||
//get the current step
|
||||
var current_step = document.getElementById('wiz_current_step');
|
||||
var currentValue = parseInt(current_step.value);
|
||||
|
||||
//validation needed. (specialvalidation, plus step number, plus submit button)
|
||||
if(validate_wiz(current_step.value,direction)){
|
||||
|
||||
//change current step value to that of the step being navigated to
|
||||
if(direction == 'back'){
|
||||
current_step.value = currentValue-1;
|
||||
}
|
||||
if(direction == 'next'){
|
||||
current_step.value = currentValue+1;
|
||||
}
|
||||
if(direction == 'direct'){
|
||||
//no need to modify current step, this is a direct navigation
|
||||
}
|
||||
|
||||
//show next step
|
||||
showdiv("step"+current_step.value);
|
||||
|
||||
//set nav hi-lite
|
||||
hilite(current_step.value);
|
||||
|
||||
//enable save button if on last step
|
||||
var total = document.getElementById('wiz_total_steps').value;
|
||||
var save_button = document.getElementById('wiz_submit_button');
|
||||
var back_button_div = document.getElementById('back_button_div');
|
||||
var save_button_div = document.getElementById('save_button_div');
|
||||
var next_button_div = document.getElementById('next_button_div');
|
||||
if(current_step.value==total){
|
||||
//save_button.display='';
|
||||
save_button.disabled = false;
|
||||
back_button_div.style.display = '';
|
||||
save_button_div.style.display = '';
|
||||
next_button_div.style.display = 'none';
|
||||
|
||||
}else{
|
||||
if(current_step.value<2){
|
||||
back_button_div.style.display = 'none';
|
||||
}else{
|
||||
back_button_div.style.display = '';
|
||||
}
|
||||
var next_button = document.getElementById('wiz_next_button');
|
||||
next_button_div.style.display = '';
|
||||
save_button_div.style.display = 'none';
|
||||
next_button.focus();
|
||||
}
|
||||
|
||||
}else{
|
||||
//error occurred, do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* This function highlites the right title on the navigation div.
|
||||
* It also changes the title to a navigational link
|
||||
* */
|
||||
var already_linked ='';
|
||||
function hilite(hilite){
|
||||
var last = parseInt(document.getElementById('wiz_total_steps').value);
|
||||
for(i=1; i<=last; i++){
|
||||
var nav_step = document.getElementById('nav_step'+i);
|
||||
nav_step.className = '';
|
||||
}
|
||||
var nav_step = document.getElementById('nav_step'+hilite);
|
||||
nav_step.className = '';
|
||||
if(already_linked.indexOf(hilite)<0){
|
||||
nav_step.innerHTML= "<a href='#' onclick=\"javascript:direct('"+hilite+"');\">" +nav_step.innerHTML+ "</a>";
|
||||
already_linked +=',hilite';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a start and end, This function highlights the right title on the navigation div.
|
||||
* It also changes the title to a navigational link
|
||||
* */
|
||||
function link_navs(beg, end){
|
||||
if(beg==''){
|
||||
beg=1;
|
||||
}
|
||||
if(end==''){
|
||||
var last = document.getElementById('wiz_total_steps').value;
|
||||
end=last;
|
||||
}
|
||||
beg =parseInt(beg);
|
||||
end =parseInt(end);
|
||||
|
||||
for(i=beg; i<=end; i++){
|
||||
var nav_step = document.getElementById('nav_step'+ i);
|
||||
nav_step.innerHTML= "<a href='#' onclick=\"javascript:direct('"+i+"');\">" +nav_step.innerHTML+ "</a>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called when clicking on a title that has already been changed
|
||||
* to show a link. It is a direct navigation link
|
||||
*/
|
||||
function direct(stepnumber){
|
||||
//get the current step
|
||||
var current_step = document.getElementById('wiz_current_step');
|
||||
var currentValue = parseInt(current_step.value);
|
||||
|
||||
//validation needed. (specialvalidation, plus step number, plus submit button)
|
||||
if(validate_wiz(current_step.value,'direct')){
|
||||
|
||||
//lets set the current step to the selected step and invoke navigation
|
||||
current_step.value = stepnumber;
|
||||
navigate('direct');
|
||||
}else{
|
||||
//do nothing, validation failed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is a generic create summary function. It scrapes the form for all elements that
|
||||
* are not hidden and displays it's value. It uses the "title" parameter as the title
|
||||
* in the summary There is also a provision for overriding this function and providing more
|
||||
* precise summary functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function will perform basic navigation validation, and then call the customized
|
||||
* form validation specified for this step. This custom call should reside on wizard page itself.
|
||||
*
|
||||
*/
|
||||
function validate_wiz(step, direction){
|
||||
var total = document.getElementById('wiz_total_steps').value;
|
||||
var wiz_message = document.getElementById('wiz_message');
|
||||
//validate step
|
||||
if(direction =='back'){
|
||||
//cancel and alert if on step1
|
||||
if(step=='1'){
|
||||
var msg = SUGAR.language.get('mod_strings', 'LBL_WIZARD_FIRST_STEP_MESSAGE');
|
||||
wiz_message.innerHTML = "<font color=\'red\' size=\'2\'><b>"+msg+"</b></font>";
|
||||
return false;
|
||||
}else{
|
||||
wiz_message.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(direction =='next'){
|
||||
//cancel and alert if on last step
|
||||
if(step==total){
|
||||
var msg = SUGAR.language.get('mod_strings', 'LBL_WIZARD_LAST_STEP_MESSAGE');
|
||||
wiz_message.innerHTML = "<font color=\'red\' size=\'2\'><b>"+msg+"</b></font>";
|
||||
return false;
|
||||
}else{
|
||||
wiz_message.innerHTML = '';
|
||||
}
|
||||
}
|
||||
if(direction =='direct'){
|
||||
//no need to perform navigation validation
|
||||
}
|
||||
|
||||
//make call to custom form validation, do not call if this is a direct navigation
|
||||
//if this is a direct navigation, then validation has already happened, calling twice
|
||||
//will not allow page to navigate
|
||||
if((direction !='direct') && ( window.validate_wiz_form ) && (!validate_wiz_form('step'+step))){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
121
jssource/src_files/modules/Connectors/Connector.js
Normal file
121
jssource/src_files/modules/Connectors/Connector.js
Normal file
@@ -0,0 +1,121 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function run_test(source_id) {
|
||||
var callback = {
|
||||
success: function(data) {
|
||||
var resultDiv = document.getElementById(source_id + '_result');
|
||||
resultDiv.innerHTML = '<b>' + data.responseText + '</b>';
|
||||
},
|
||||
failure: function(data) {
|
||||
var resultDiv = document.getElementById(source_id + '_result');
|
||||
resultDiv.innerHTML = '<b>' + SUGAR.language.get('app_strings', 'ERROR_UNABLE_TO_RETRIEVE_DATA') + '</b>';
|
||||
},
|
||||
timeout: 300000
|
||||
}
|
||||
|
||||
var resultDiv = document.getElementById(source_id + '_result');
|
||||
resultDiv.innerHTML = '<img src=themes/default/images/sqsWait.gif>';
|
||||
document.ModifyProperties.source_id.value = source_id;
|
||||
document.ModifyProperties.action.value = 'RunTest';
|
||||
YAHOO.util.Connect.setForm(document.ModifyProperties);
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php?module=Connectors', callback);
|
||||
document.ModifyProperties.action.value = 'SaveModifyProperties';
|
||||
}
|
||||
|
||||
var widgetTimout;
|
||||
function dswidget_open(elt){
|
||||
|
||||
var wdiget_div = document.getElementById('dswidget_div');
|
||||
var objX = findPosX(elt);
|
||||
var objY = findPosY(elt);
|
||||
|
||||
wdiget_div.style.top = (objY+15) + 'px';
|
||||
wdiget_div.style.left = (objX) + 'px';
|
||||
|
||||
wdiget_div.style.display = 'block';
|
||||
}
|
||||
|
||||
function dswidget_close(){
|
||||
|
||||
widgetTimout = setTimeout("hide_widget()", 500);
|
||||
}
|
||||
|
||||
function hide_widget(){
|
||||
var wdiget_div = document.getElementById('dswidget_div');
|
||||
wdiget_div.style.display = 'none';
|
||||
}
|
||||
|
||||
function clearButtonTimeout(){
|
||||
if(widgetTimout){
|
||||
clearTimeout(widgetTimout);
|
||||
}
|
||||
}
|
||||
|
||||
function findPosX(obj)
|
||||
{
|
||||
var curleft = 0;
|
||||
if (obj.offsetParent)
|
||||
{
|
||||
while (obj.offsetParent)
|
||||
{
|
||||
curleft += obj.offsetLeft;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
if ( obj != null )
|
||||
curleft += obj.offsetLeft;
|
||||
}
|
||||
else if (obj.x)
|
||||
curleft += obj.x;
|
||||
return curleft;
|
||||
}
|
||||
|
||||
function findPosY(obj)
|
||||
{
|
||||
var curtop = 0;
|
||||
if (obj.offsetParent)
|
||||
{
|
||||
while (obj.offsetParent)
|
||||
{
|
||||
curtop += obj.offsetTop;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
if ( obj != null )
|
||||
curtop += obj.offsetTop;
|
||||
}
|
||||
else if (obj.y)
|
||||
curtop += obj.y;
|
||||
return curtop;
|
||||
}
|
||||
191
jssource/src_files/modules/Contacts/Contact.js
Normal file
191
jssource/src_files/modules/Contacts/Contact.js
Normal file
@@ -0,0 +1,191 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
function set_campaignlog_and_save_background(popup_reply_data)
|
||||
{
|
||||
var form_name = popup_reply_data.form_name;
|
||||
var name_to_value_array = popup_reply_data.name_to_value_array;
|
||||
var passthru_data = popup_reply_data.passthru_data;
|
||||
// construct the POST request
|
||||
var query_array = new Array();
|
||||
if (name_to_value_array != 'undefined') {
|
||||
for (var the_key in name_to_value_array)
|
||||
{
|
||||
if(the_key == 'toJSON')
|
||||
{
|
||||
/* just ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
query_array.push(the_key+'='+name_to_value_array[the_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//construct the muulti select list
|
||||
var selection_list;
|
||||
if(popup_reply_data.selection_list)
|
||||
{
|
||||
selection_list = popup_reply_data.selection_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_list = popup_reply_data.name_to_value_array;
|
||||
}
|
||||
|
||||
if (selection_list != 'undefined') {
|
||||
for (var the_key in selection_list)
|
||||
{
|
||||
query_array.push('subpanel_id[]='+selection_list[the_key])
|
||||
}
|
||||
}
|
||||
var module = get_module_name();
|
||||
var id = get_record_id();
|
||||
|
||||
query_array.push('value=DetailView');
|
||||
query_array.push('module='+module); //query_array.push('module='+module);
|
||||
query_array.push('http_method=get');
|
||||
query_array.push('return_module='+module);
|
||||
query_array.push('return_id='+id);
|
||||
query_array.push('record='+id);
|
||||
query_array.push('isDuplicate=false');
|
||||
query_array.push('return_type=addcampaignlog');
|
||||
query_array.push('action=Save2');
|
||||
query_array.push('inline=1');
|
||||
|
||||
var refresh_page = escape(passthru_data['refresh_page']);
|
||||
for (prop in passthru_data) {
|
||||
if (prop=='link_field_name') {
|
||||
query_array.push('subpanel_field_name='+escape(passthru_data[prop]));
|
||||
} else {
|
||||
if (prop=='module_name') {
|
||||
query_array.push('subpanel_module_name='+escape(passthru_data[prop]));
|
||||
} else {
|
||||
query_array.push(prop+'='+escape(passthru_data[prop]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var query_string = query_array.join('&');
|
||||
request_map[request_id] = passthru_data['child_field'];
|
||||
var returnstuff = http_fetch_sync('index.php',query_string);
|
||||
request_id++;
|
||||
got_data(returnstuff, true);
|
||||
if(refresh_page == 1){
|
||||
document.location.reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
function validatePortalName(e) {
|
||||
var portalName = document.getElementById('portal_name');
|
||||
var portalNameExisting = document.getElementById("portal_name_existing");
|
||||
var portalNameVerified = document.getElementById('portal_name_verified');
|
||||
if(typeof(portalName.parentNode.lastChild) != 'undefined' &&
|
||||
portalName.parentNode.lastChild.tagName =='SPAN'){
|
||||
portalName.parentNode.lastChild.innerHTML = '';
|
||||
}
|
||||
|
||||
if(portalName.value == portalNameExisting.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
var callbackFunction = function success(data) {
|
||||
//data.responseText contains the count of portal_name that matches input field
|
||||
count = data.responseText;
|
||||
if(count != 0) {
|
||||
add_error_style('EditView', 'portal_name', SUGAR.language.get('app_strings', 'ERR_EXISTING_PORTAL_USERNAME'));
|
||||
for(wp = 1; wp <= 10; wp++) {
|
||||
window.setTimeout('fade_error_style(style, ' + wp * 10 + ')', 1000 + (wp * 50));
|
||||
}
|
||||
portalName.focus();
|
||||
}
|
||||
|
||||
if(portalNameVerified.parentNode.childNodes.length > 1) {
|
||||
portalNameVerified.parentNode.removeChild(portalNameVerified.parentNode.lastChild);
|
||||
}
|
||||
|
||||
verifiedTextNode = document.createElement('span');
|
||||
verifiedTextNode.innerHTML = '';
|
||||
portalNameVerified.parentNode.appendChild(verifiedTextNode);
|
||||
|
||||
portalNameVerified.value = count == 0 ? "true" : "false";
|
||||
verifyingPortalName = false;
|
||||
}
|
||||
|
||||
if(portalNameVerified.parentNode.childNodes.length > 1) {
|
||||
portalNameVerified.parentNode.removeChild(portalNameVerified.parentNode.lastChild);
|
||||
}
|
||||
|
||||
if(portalName.value != '' && !verifyingPortalName) {
|
||||
document.getElementById('portal_name_verified').value = "false";
|
||||
verifiedTextNode = document.createElement('span');
|
||||
portalNameVerified.parentNode.appendChild(verifiedTextNode);
|
||||
verifiedTextNode.innerHTML = SUGAR.language.get('app_strings', 'LBL_VERIFY_PORTAL_NAME');
|
||||
verifyingPortalName = true;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', 'index.php?module=Contacts&action=ValidPortalUsername&portal_name=' + portalName.value, {success: callbackFunction, failure: callbackFunction});
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if ((kc = e["keyCode"])) {
|
||||
enterKeyPressed = (kc == 13) ? true : false;
|
||||
if(enterKeyPressed) {
|
||||
validatePortalName(e);
|
||||
freezeEvent(e);
|
||||
setTimeout(forceSubmit, 2100);
|
||||
}
|
||||
}
|
||||
}//handleKeyDown()
|
||||
|
||||
function freezeEvent(e) {
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
e.returnValue = false;
|
||||
e.cancelBubble = true;
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
return false;
|
||||
}//freezeEvent
|
||||
|
||||
function forceSubmit() {
|
||||
theForm = YAHOO.util.Dom.get('EditView');
|
||||
if(theForm) {
|
||||
theForm.action.value = 'Save';
|
||||
|
||||
if(!check_form('EditView')) {
|
||||
return false;
|
||||
}
|
||||
theForm.submit();
|
||||
}
|
||||
}
|
||||
|
||||
verifyingPortalName = false;
|
||||
enterKeyPressed = false;
|
||||
54
jssource/src_files/modules/Currencies/EditView.js
Normal file
54
jssource/src_files/modules/Currencies/EditView.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
function isoUpdate( formElem ) {
|
||||
if ( typeof(js_iso4217[formElem.value]) == 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var thisForm = formElem.form;
|
||||
var thisCurr = js_iso4217[formElem.value];
|
||||
|
||||
if ( thisForm.name.value == '' ) {
|
||||
thisForm.name.value = thisCurr.name;
|
||||
}
|
||||
if ( thisForm.symbol.value == '' ) {
|
||||
thisForm.symbol.value = '';
|
||||
for ( var i = 0 ; i < thisCurr.unicode.length ; i++ ) {
|
||||
thisForm.symbol.value = thisForm.symbol.value + String.fromCharCode(thisCurr.unicode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
126
jssource/src_files/modules/Documents/documents.js
Normal file
126
jssource/src_files/modules/Documents/documents.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
var rhandle=new RevisionListHandler();
|
||||
var from_popup_return = false;
|
||||
function document_set_return(popup_reply_data)
|
||||
{
|
||||
from_popup_return = true;
|
||||
var form_name = popup_reply_data.form_name;
|
||||
var name_to_value_array = popup_reply_data.name_to_value_array;
|
||||
related_doc_id='EMPTY';
|
||||
for (var the_key in name_to_value_array)
|
||||
{
|
||||
if(the_key == 'toJSON')
|
||||
{
|
||||
/* just ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
var displayValue=name_to_value_array[the_key];
|
||||
displayValue=displayValue.replace(''',"'"); //restore escaped single quote.
|
||||
displayValue=displayValue.replace( '&',"&"); //restore escaped &.
|
||||
displayValue=displayValue.replace( '>',">"); //restore escaped >.
|
||||
displayValue=displayValue.replace( '<',"<"); //restore escaped <.
|
||||
displayValue=displayValue.replace( '" ',"\""); //restore escaped ".
|
||||
if (the_key == 'related_doc_id') {
|
||||
related_doc_id =displayValue;
|
||||
}
|
||||
window.document.forms[form_name].elements[the_key].value = displayValue;
|
||||
}
|
||||
}
|
||||
related_doc_id=JSON.stringifyNoSecurity(related_doc_id);
|
||||
//make request for document revisions data.
|
||||
var conditions = new Array();
|
||||
conditions[conditions.length] = {"name":"document_id","op":"starts_with","value":related_doc_id};
|
||||
var query = new Array();
|
||||
var query = {"module":"DocumentRevisions","field_list":['id','revision','date_entered'],"conditions":conditions,"order":'date_entered desc'};
|
||||
|
||||
//make the call call synchronous for now...
|
||||
//todo: convert to async, test on mozilla..
|
||||
result = global_rpcClient.call_method('query',query,true);
|
||||
rhandle.display(result);
|
||||
|
||||
//req_id = global_rpcClient.call_method('query',query);
|
||||
//register the callback mathod.
|
||||
//global_request_registry[req_id] = [rhandle, 'display'];
|
||||
}
|
||||
|
||||
|
||||
function RevisionListHandler() { }
|
||||
|
||||
RevisionListHandler.prototype.display = function(result) {
|
||||
var names = result['list'];
|
||||
var rev_tag=document.getElementById('related_doc_rev_id');
|
||||
rev_tag.options.length=0;
|
||||
|
||||
for(i=0; i < names.length; i++) {
|
||||
rev_tag.options[i] = new Option(names[i].fields['revision'],names[i].fields['id'],false,false);
|
||||
}
|
||||
rev_tag.disabled=false;
|
||||
}
|
||||
|
||||
|
||||
function setvalue(source) {
|
||||
src = new String(source.value);
|
||||
target=new String(source.form.document_name.value);
|
||||
|
||||
if (target.length == 0) {
|
||||
lastindex=src.lastIndexOf("/");
|
||||
if (lastindex == -1) {
|
||||
lastindex=src.lastIndexOf("\\");
|
||||
}
|
||||
if (lastindex == -1) {
|
||||
source.form.document_name.value=src;
|
||||
source.form.escaped_document_name.value = src;
|
||||
} else {
|
||||
source.form.document_name.value=src.substr(++lastindex, src.length);
|
||||
source.form.escaped_document_name.value = src.substr(lastindex, src.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_template_type(istemplate) {
|
||||
template_type = document.getElementById('template_type');
|
||||
if (istemplate.checked) {
|
||||
//template_type.enabled=true;
|
||||
template_type.disabled=false;
|
||||
} else {
|
||||
//template_type.enabled=false;
|
||||
template_type.disabled=true;
|
||||
}
|
||||
}
|
||||
163
jssource/src_files/modules/EmailTemplates/EmailTemplate.js
Normal file
163
jssource/src_files/modules/EmailTemplates/EmailTemplate.js
Normal file
@@ -0,0 +1,163 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var focus_obj = false;
|
||||
var label = SUGAR.language.get('app_strings', 'LBL_DEFAULT_LINK_TEXT');
|
||||
|
||||
function remember_place(obj) {
|
||||
focus_obj = obj;
|
||||
}
|
||||
|
||||
function showVariable() {
|
||||
document.EditView.variable_text.value =
|
||||
document.EditView.variable_name.options[document.EditView.variable_name.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addVariables(the_select,the_module) {
|
||||
the_select.options.length = 0;
|
||||
for(var i=0;i<field_defs[the_module].length;i++) {
|
||||
var new_option = document.createElement("option");
|
||||
new_option.value = "$"+field_defs[the_module][i].name;
|
||||
new_option.text= field_defs[the_module][i].value;
|
||||
the_select.options.add(new_option,i);
|
||||
}
|
||||
showVariable();
|
||||
}
|
||||
function toggle_text_only(firstRun) {
|
||||
if (typeof(firstRun) == 'undefined')
|
||||
firstRun = false;
|
||||
var text_only = document.getElementById('text_only');
|
||||
//Initialization of TinyMCE
|
||||
if(firstRun){
|
||||
setTimeout("tinyMCE.execCommand('mceAddControl', false, 'body_text');", 500);
|
||||
var tiny = tinyMCE.getInstanceById('body_text');
|
||||
}
|
||||
//check to see if the toggle textonly flag is checked
|
||||
if(document.getElementById('toggle_textonly').checked == true) {
|
||||
//hide the html div (containing TinyMCE)
|
||||
document.getElementById('body_text_div').style.display = 'none';
|
||||
document.getElementById('toggle_textarea_option').style.display = 'none';
|
||||
document.getElementById('toggle_textarea_elem').checked = true;
|
||||
document.getElementById('text_div').style.display = 'inline';
|
||||
|
||||
text_only.value = 1;
|
||||
} else {
|
||||
//display the html div (containing TinyMCE)
|
||||
document.getElementById('body_text_div').style.display = 'inline';
|
||||
document.getElementById('toggle_textarea_option').style.display = 'inline';
|
||||
document.getElementById('toggle_textarea_elem').checked = false;
|
||||
document.getElementById('text_div').style.display = 'none';
|
||||
|
||||
text_only.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//This function checks that tinyMCE is initilized before setting the text (IE bug)
|
||||
function setTinyHTML(text) {
|
||||
var tiny = tinyMCE.getInstanceById('body_text');
|
||||
|
||||
if (tiny.getContent() != null) {
|
||||
tiny.setContent(text)
|
||||
} else {
|
||||
setTimeout(setTinyHTML(text), 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function stripTags(str) {
|
||||
var theText = new String(str);
|
||||
|
||||
if(theText != 'undefined') {
|
||||
return theText.replace(/<\/?[^>]+>/gi, '');
|
||||
}
|
||||
}
|
||||
/*
|
||||
* this function will insert variables into text area
|
||||
*/
|
||||
function insert_variable_text(myField, myValue) {
|
||||
//IE support
|
||||
if (document.selection) {
|
||||
myField.focus();
|
||||
sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
}
|
||||
//MOZILLA/NETSCAPE support
|
||||
else if (myField.selectionStart || myField.selectionStart == '0') {
|
||||
var startPos = myField.selectionStart;
|
||||
var endPos = myField.selectionEnd;
|
||||
myField.value = myField.value.substring(0, startPos)
|
||||
+ myValue
|
||||
+ myField.value.substring(endPos, myField.value.length);
|
||||
} else {
|
||||
myField.value += myValue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function inserts variables into a TinyMCE instance
|
||||
*/
|
||||
function insert_variable_html(text) {
|
||||
var inst = tinyMCE.getInstanceById("body_text");
|
||||
if (inst)
|
||||
inst.getWin().focus();
|
||||
//var html = inst.getContent(true);
|
||||
//inst.setContent(html + text);
|
||||
inst.execCommand('mceInsertRawHTML', false, text);
|
||||
}
|
||||
|
||||
function insert_variable_html_link(text) {
|
||||
|
||||
the_label = document.getElementById('url_text').value;
|
||||
if(typeof(the_label) =='undefined'){
|
||||
the_label = label;
|
||||
}
|
||||
|
||||
var thelink = "<a href='" + text + "' > "+the_label+" </a>";
|
||||
insert_variable_html(thelink);
|
||||
}
|
||||
/*
|
||||
* this function will check to see if text only flag has been checked.
|
||||
* If so, the it will call the text insert function, if not, then it
|
||||
* will call the html (tinyMCE eidtor) insert function
|
||||
*/
|
||||
function insert_variable(text) {
|
||||
//if text only flag is checked, then insert into text field
|
||||
if(document.getElementById('toggle_textonly').checked == true){
|
||||
//use text version insert
|
||||
insert_variable_text(document.getElementById('body_text_plain'), text) ;
|
||||
}else{
|
||||
//use html version insert
|
||||
insert_variable_html(text) ;
|
||||
}
|
||||
}
|
||||
|
||||
64
jssource/src_files/modules/Home/about.js
Normal file
64
jssource/src_files/modules/Home/about.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var abouter = function(){
|
||||
return {
|
||||
display:function(){
|
||||
abouter.div = document.getElementById('abouterdiv');
|
||||
abouter.div.style.display ='';
|
||||
abouter.div.src = "index.php?module=Home&action=PopupSugar&to_pdf=true&style=" + abouter.style;
|
||||
},
|
||||
ab:function(index, style){
|
||||
if(abouter.starter == 3){
|
||||
abouter.style = style;
|
||||
abouter.display();
|
||||
}else{
|
||||
if(index == abouter.starter + 1){
|
||||
abouter.starter++;
|
||||
}else{
|
||||
abouter.starter= 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}();
|
||||
abouter.starter = 0;
|
||||
abouter.style = 'inc';
|
||||
345
jssource/src_files/modules/InboundEmail/InboundEmail.js
Normal file
345
jssource/src_files/modules/InboundEmail/InboundEmail.js
Normal file
@@ -0,0 +1,345 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
SUGAR.inboundEmail = { };
|
||||
|
||||
|
||||
Rot13 = {
|
||||
map: null,
|
||||
|
||||
convert: function(a) {
|
||||
Rot13.init();
|
||||
|
||||
var s = "";
|
||||
for (i=0; i < a.length; i++) {
|
||||
var b = a.charAt(i);
|
||||
s += ((b>='A' && b<='Z') || (b>='a' && b<='z') ? Rot13.map[b] : b);
|
||||
}
|
||||
return s;
|
||||
},
|
||||
|
||||
init: function() {
|
||||
if (Rot13.map != null)
|
||||
return;
|
||||
|
||||
var map = new Array();
|
||||
var s = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
for (i=0; i<s.length; i++)
|
||||
map[s.charAt(i)] = s.charAt((i+13)%26);
|
||||
for (i=0; i<s.length; i++)
|
||||
map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();
|
||||
|
||||
Rot13.map = map;
|
||||
},
|
||||
|
||||
write: function(a) {
|
||||
return Rot13.convert(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getEncryptedPassword(login, password, mailbox) {
|
||||
var words = new Array(login, password, mailbox);
|
||||
for(i=0; i<3; i++) {
|
||||
word = words[i];
|
||||
if(word.indexOf('&') > 0) {
|
||||
fragment1 = word.substr(0, word.indexOf('&'));
|
||||
fragment2 = word.substr(word.indexOf('&') + 1, word.length);
|
||||
|
||||
newWord = fragment1 + '::amp::' + fragment2;
|
||||
words[i] = newWord;
|
||||
word = newWord; // setting it locally to pass on to next IF
|
||||
fragment1 = '';
|
||||
fragment2 = '';
|
||||
}
|
||||
if(word.indexOf('+') > 0) {
|
||||
fragment1 = word.substr(0, word.indexOf('+'));
|
||||
fragment2 = word.substr(word.indexOf('+') + 1, word.length);
|
||||
|
||||
newWord = fragment1 + '::plus::' + fragment2;
|
||||
words[i] = newWord;
|
||||
word = newWord; // setting it locally to pass on to next IF
|
||||
fragment1 = '';
|
||||
fragment2 = '';
|
||||
}
|
||||
if(word.indexOf('%') > 0) {
|
||||
fragment1 = word.substr(0, word.indexOf('%'));
|
||||
fragment2 = word.substr(word.indexOf('%') + 1, word.length);
|
||||
|
||||
newWord = fragment1 + '::percent::' + fragment2;
|
||||
words[i] = newWord;
|
||||
word = newWord; // setting it locally to pass on to next IF
|
||||
fragment1 = '';
|
||||
fragment2 = '';
|
||||
}
|
||||
} // for
|
||||
|
||||
return words;
|
||||
} // fn
|
||||
|
||||
function ie_test_open_popup_with_submit(module_name, action, pageTarget, width, height, mail_server, protocol, port, login, password, mailbox, ssl, personal, formName)
|
||||
{
|
||||
if (!formName) formName = "testSettingsView";
|
||||
var words = getEncryptedPassword(login, password, mailbox);
|
||||
var isPersonal = (personal) ? 'true' : 'false';
|
||||
|
||||
if (!isDataValid(formName, true)) {
|
||||
return;
|
||||
}
|
||||
// launch the popup
|
||||
|
||||
URL = 'index.php?'
|
||||
+ 'module=' + module_name
|
||||
+ '&to_pdf=1'
|
||||
+ '&action=' + action
|
||||
+ '&target=' + pageTarget
|
||||
+ '&target1=' + pageTarget
|
||||
+ '&server_url=' + mail_server
|
||||
+ '&email_user=' + words[0]
|
||||
+ '&protocol=' + protocol
|
||||
+ '&port=' + port
|
||||
+ '&email_password=' + words[1]
|
||||
+ '&mailbox=' + words[2]
|
||||
+ '&ssl=' + ssl
|
||||
+ '&personal=' + isPersonal;
|
||||
|
||||
var SI = SUGAR.inboundEmail;
|
||||
if (!SI.testDlg) {
|
||||
SI.testDlg = new YAHOO.widget.SimpleDialog("testSettingsDiv", {
|
||||
width: width + "px",
|
||||
draggable: true,
|
||||
dragOnly: true,
|
||||
close: true,
|
||||
constraintoviewport: true,
|
||||
modal: true,
|
||||
loadingText: SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING")
|
||||
});
|
||||
SI.testDlg._updateContent = function (o) {
|
||||
var w = this.cfg.config.width.value + "px";
|
||||
this.setBody(o.responseText);
|
||||
if (this.evalJS)
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
if (!SUGAR.isIE)
|
||||
this.body.style.width = w
|
||||
}
|
||||
}
|
||||
var title = SUGAR.language.get('Emails', 'LBL_TEST_SETTINGS');
|
||||
if (typeof(title) == "undefined" || title == "undefined")
|
||||
title = SUGAR.language.get('InboundEmail', 'LBL_TEST_SETTINGS');
|
||||
SI.testDlg.setHeader(title);
|
||||
SI.testDlg.setBody(SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING"));
|
||||
|
||||
SI.testDlg.render(document.body);
|
||||
var Connect = YAHOO.util.Connect;
|
||||
if (Connect.url) URL = Connect.url + "&" + url;
|
||||
Connect.asyncRequest("GET", URL, {success:SI.testDlg._updateContent, failure:SI.testDlg.hide, scope:SI.testDlg});
|
||||
SI.testDlg.show();
|
||||
|
||||
}
|
||||
|
||||
function isDataValid(formName, validateMonitoredFolder) {
|
||||
var formObject = document.getElementById(formName);
|
||||
var errors = new Array();
|
||||
var out = new String();
|
||||
|
||||
if(trim(formObject.server_url.value) == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_SERVER'));
|
||||
}
|
||||
if(trim(formObject.email_user.value) == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_USER'));
|
||||
}
|
||||
if(trim(formObject.email_password.value) == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PASSWORD'));
|
||||
}
|
||||
if(formObject.protocol.protocol == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PROTOCOL'));
|
||||
}
|
||||
if (formObject.protocol.value == 'imap' && validateMonitoredFolder) {
|
||||
if (trim(formObject.mailbox.value) == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_MONITORED_FOLDER'));
|
||||
} // if
|
||||
}
|
||||
if(formObject.port.value == "") {
|
||||
errors.push(SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_PORT'));
|
||||
}
|
||||
|
||||
if(errors.length > 0) {
|
||||
out = SUGAR.language.get('app_strings', 'LBL_EMAIL_ERROR_DESC');
|
||||
for(i=0; i<errors.length; i++) {
|
||||
if(out != "") {
|
||||
out += "\n";
|
||||
}
|
||||
out += errors[i];
|
||||
}
|
||||
|
||||
alert(out);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // fn
|
||||
|
||||
function getFoldersListForInboundAccount(module_name, action, pageTarget, width, height, mail_server, protocol, port, login, password, mailbox, ssl, personal, searchFieldValue, formName) {
|
||||
if (!formName) formName = "testSettingsView";
|
||||
|
||||
var words = getEncryptedPassword(login, password, mailbox);
|
||||
var isPersonal = (personal) ? 'true' : 'false';
|
||||
|
||||
// launch the popup
|
||||
URL = 'index.php?'
|
||||
+ 'module=' + module_name
|
||||
+ '&to_pdf=1'
|
||||
+ '&action=' + action
|
||||
+ '&target=' + pageTarget
|
||||
+ '&target1=' + pageTarget
|
||||
+ '&server_url=' + mail_server
|
||||
+ '&email_user=' + words[0]
|
||||
+ '&protocol=' + protocol
|
||||
+ '&port=' + port
|
||||
+ '&email_password=' + words[1]
|
||||
+ '&mailbox=' + words[2]
|
||||
+ '&ssl=' + ssl
|
||||
+ '&personal=' + isPersonal
|
||||
+ '&searchField='+ searchFieldValue;
|
||||
|
||||
var SI = SUGAR.inboundEmail;
|
||||
if (!SI.listDlg) {
|
||||
SI.listDlg = new YAHOO.widget.SimpleDialog("selectFoldersDiv", {
|
||||
width: width + "px",
|
||||
draggable: true,
|
||||
dragOnly: true,
|
||||
close: true,
|
||||
constraintoviewport: true,
|
||||
modal: true,
|
||||
loadingText: SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING")
|
||||
});
|
||||
SI.listDlg._updateContent = function (o) {
|
||||
var w = this.cfg.config.width.value + "px";
|
||||
this.setBody(o.responseText);
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
if (!SUGAR.isIE)
|
||||
this.body.style.width = w
|
||||
}
|
||||
}
|
||||
SI.listDlg.setHeader(SUGAR.language.get("app_strings", "LBL_EMAIL_LOADING"));
|
||||
SI.listDlg.setBody('');
|
||||
|
||||
SI.listDlg.render(document.body);
|
||||
var Connect = YAHOO.util.Connect;
|
||||
if (Connect.url) URL = Connect.url + "&" + url;
|
||||
Connect.asyncRequest("GET", URL, {success:SI.listDlg._updateContent, failure:SI.listDlg.hide, scope:SI.listDlg});
|
||||
SI.listDlg.show();
|
||||
|
||||
} // fn
|
||||
|
||||
function setPortDefault() {
|
||||
var prot = document.getElementById('protocol');
|
||||
var ssl = document.getElementById('ssl');
|
||||
var port = document.getElementById('port');
|
||||
var stdPorts= new Array("110", "143", "993", "995");
|
||||
var stdBool = new Boolean(false);
|
||||
|
||||
if(port.value == '') {
|
||||
stdBool.value = true;
|
||||
} else {
|
||||
for(i=0; i<stdPorts.length; i++) {
|
||||
if(stdPorts[i] == port.value) {
|
||||
stdBool.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(stdBool.value == true) {
|
||||
if(prot.value == 'imap' && ssl.checked == false) { // IMAP
|
||||
port.value = "143";
|
||||
} else if(prot.value == 'imap' && ssl.checked == true) { // IMAP-SSL
|
||||
port.value = '993';
|
||||
} else if(prot.value == 'pop3' && ssl.checked == false) { // POP3
|
||||
port.value = '110';
|
||||
} else if(prot.value == 'pop3' && ssl.checked == true) { // POP3-SSL
|
||||
port.value = '995';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_monitored_folder(field) {
|
||||
|
||||
var field1=document.getElementById('protocol');
|
||||
//var target=document.getElementById('pop3_warn');
|
||||
//var mark_read = document.getElementById('mark_read');
|
||||
var mailbox = document.getElementById('mailbox');
|
||||
//var inbox = document.getElementById('inbox');
|
||||
var label_inbox = document.getElementById('label_inbox');
|
||||
var subscribeFolderButton = document.getElementById('subscribeFolderButton');
|
||||
var trashFolderRow = document.getElementById('trashFolderRow');
|
||||
var trashFolderRow1 = document.getElementById('trashFolderRow1');
|
||||
var sentFolderRow = document.getElementById('sentFolderRow');
|
||||
|
||||
if (field1.value == 'imap') {
|
||||
//target.style.display="none";
|
||||
mailbox.disabled=false;
|
||||
// This is not supported in IE
|
||||
try {
|
||||
mailbox.style.display = '';
|
||||
trashFolderRow.style.display = '';
|
||||
sentFolderRow.style.display = '';
|
||||
trashFolderRow1.style.display = '';
|
||||
//mailbox.type='text';
|
||||
subscribeFolderButton.style.display = '';
|
||||
} catch(e) {};
|
||||
//inbox.style.display='';
|
||||
label_inbox.style.display='';
|
||||
}
|
||||
else {
|
||||
//target.style.display="";
|
||||
mailbox.value = "INBOX";
|
||||
mailbox.disabled=false; // cannot disable, else the value is not passed
|
||||
// This is not supported in IE
|
||||
try {
|
||||
mailbox.style.display = "none";
|
||||
trashFolderRow.style.display = "none";
|
||||
sentFolderRow.style.display = "none";
|
||||
trashFolderRow1.style.display = "none";
|
||||
subscribeFolderButton.style.display = "none";
|
||||
|
||||
//mailbox.type='hidden';
|
||||
} catch(e) {};
|
||||
|
||||
//inbox.style.display = "";
|
||||
label_inbox.style.display = "none";
|
||||
}
|
||||
}
|
||||
107
jssource/src_files/modules/Leads/Lead.js
Normal file
107
jssource/src_files/modules/Leads/Lead.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
function set_campaignlog_and_save_background(popup_reply_data)
|
||||
{
|
||||
var form_name = popup_reply_data.form_name;
|
||||
var name_to_value_array = popup_reply_data.name_to_value_array;
|
||||
var passthru_data = popup_reply_data.passthru_data;
|
||||
// construct the POST request
|
||||
var query_array = new Array();
|
||||
if (name_to_value_array != 'undefined') {
|
||||
for (var the_key in name_to_value_array)
|
||||
{
|
||||
if(the_key == 'toJSON')
|
||||
{
|
||||
/* just ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
query_array.push(the_key+'='+name_to_value_array[the_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//construct the muulti select list
|
||||
var selection_list;
|
||||
if(popup_reply_data.selection_list)
|
||||
{
|
||||
selection_list = popup_reply_data.selection_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_list = popup_reply_data.name_to_value_array;
|
||||
}
|
||||
|
||||
if (selection_list != 'undefined') {
|
||||
for (var the_key in selection_list)
|
||||
{
|
||||
query_array.push('subpanel_id[]='+selection_list[the_key])
|
||||
}
|
||||
}
|
||||
var module = get_module_name();
|
||||
var id = get_record_id();
|
||||
|
||||
query_array.push('value=DetailView');
|
||||
query_array.push('module='+module); //query_array.push('module='+module);
|
||||
query_array.push('http_method=get');
|
||||
query_array.push('return_module='+module);
|
||||
query_array.push('return_id='+id);
|
||||
query_array.push('record='+id);
|
||||
query_array.push('isDuplicate=false');
|
||||
query_array.push('return_type=addcampaignlog');
|
||||
query_array.push('action=Save2');
|
||||
query_array.push('inline=1');
|
||||
|
||||
var refresh_page = escape(passthru_data['refresh_page']);
|
||||
for (prop in passthru_data) {
|
||||
if (prop=='link_field_name') {
|
||||
query_array.push('subpanel_field_name='+escape(passthru_data[prop]));
|
||||
} else {
|
||||
if (prop=='module_name') {
|
||||
query_array.push('subpanel_module_name='+escape(passthru_data[prop]));
|
||||
} else {
|
||||
query_array.push(prop+'='+escape(passthru_data[prop]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var query_string = query_array.join('&');
|
||||
request_map[request_id] = passthru_data['child_field'];
|
||||
var returnstuff = http_fetch_sync('index.php',query_string);
|
||||
request_id++;
|
||||
got_data(returnstuff, true);
|
||||
if(refresh_page == 1){
|
||||
document.location.reload(true);
|
||||
}
|
||||
}
|
||||
618
jssource/src_files/modules/Meetings/jsclass_scheduler.js
Normal file
618
jssource/src_files/modules/Meetings/jsclass_scheduler.js
Normal file
@@ -0,0 +1,618 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// class: SugarWidgetListView
|
||||
// widget to display a list view
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
SugarClass.inherit("SugarWidgetListView","SugarClass");
|
||||
|
||||
function SugarWidgetListView() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
SugarWidgetListView.prototype.init = function() {
|
||||
|
||||
}
|
||||
|
||||
SugarWidgetListView.prototype.load = function(parentNode) {
|
||||
this.parentNode = parentNode;
|
||||
this.display();
|
||||
}
|
||||
|
||||
SugarWidgetListView.prototype.display = function() {
|
||||
if(typeof GLOBAL_REGISTRY['result_list'] == 'undefined') {
|
||||
this.display_loading();
|
||||
return;
|
||||
}
|
||||
|
||||
var div = document.getElementById('list_div_win');
|
||||
div.style.display = 'block';
|
||||
//div.style.height='125px';
|
||||
var html = '<table width="100%" cellpadding="0" cellspacing="0" border="0" class="list view">';
|
||||
html += '<tr>';
|
||||
html += '<th width="2%" nowrap="nowrap"> </th>';
|
||||
html += '<th width="20%" nowrap="nowrap">'+GLOBAL_REGISTRY['meeting_strings']['LBL_NAME']+'</th>';
|
||||
html += '<th width="20%" nowrap="nowrap">'+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+'</th>';
|
||||
html += '<th width="20%" nowrap="nowrap">'+GLOBAL_REGISTRY['meeting_strings']['LBL_PHONE']+'</th>';
|
||||
html += '<th width="18%" nowrap="nowrap"> </th>';
|
||||
html += '</tr>';
|
||||
//var html = '<table width="100%" cellpadding="0" cellspacing="0">';
|
||||
for(var i=0;i<GLOBAL_REGISTRY['result_list'].length;i++) {
|
||||
var bean = GLOBAL_REGISTRY['result_list'][i];
|
||||
var disabled = false;
|
||||
var className='evenListRowS1';
|
||||
|
||||
if(typeof(GLOBAL_REGISTRY.focus.users_arr_hash[ bean.fields.id]) != 'undefined') {
|
||||
disabled = true;
|
||||
}
|
||||
if((i%2) == 0) {
|
||||
className='oddListRowS1';
|
||||
} else {
|
||||
className='evenListRowS1';
|
||||
}
|
||||
if(typeof (bean.fields.first_name) == 'undefined') {
|
||||
bean.fields.first_name = '';
|
||||
}
|
||||
if(typeof (bean.fields.email1) == 'undefined' || bean.fields.email1 == "") {
|
||||
bean.fields.email1 = ' ';
|
||||
}
|
||||
if(typeof (bean.fields.phone_work) == 'undefined' || bean.fields.phone_work == "") {
|
||||
bean.fields.phone_work = ' ';
|
||||
}
|
||||
|
||||
html += '<tr class="'+className+'">';
|
||||
html += '<td><img src="'+GLOBAL_REGISTRY.config['site_url']+'/index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName='+bean.module+'s.gif"/></td>';
|
||||
html += '<td>'+bean.fields.full_name+'</td>';
|
||||
html += '<td>'+bean.fields.email1+'</td>';
|
||||
html += '<td>'+bean.fields.phone_work+'</td>';
|
||||
html += '<td align="right">';
|
||||
// hidden = 'hidden';
|
||||
hidden = 'visible';
|
||||
if(!disabled) {
|
||||
// hidden = 'visible';
|
||||
}
|
||||
html += '<input type="button" class="button" onclick="this.disabled=true;SugarWidgetSchedulerAttendees.form_add_attendee('+i+');" value="'+GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_BUTTON']+'"/ style="visibility: '+hidden+'"/>';
|
||||
html += '</td>';
|
||||
|
||||
html += '</tr>';
|
||||
}
|
||||
html += '</table>';
|
||||
this.parentNode.innerHTML = html;
|
||||
}
|
||||
|
||||
SugarWidgetListView.prototype.display_loading = function() {
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// class: SugarWidgetSchedulerSearch
|
||||
// widget to display the meeting scheduler search box
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
SugarClass.inherit("SugarWidgetSchedulerSearch","SugarClass");
|
||||
|
||||
function SugarWidgetSchedulerSearch() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerSearch.prototype.init = function() {
|
||||
this.form_id = 'scheduler_search';
|
||||
GLOBAL_REGISTRY['widget_element_map'] = new Object();
|
||||
GLOBAL_REGISTRY['widget_element_map'][this.form_id] = this;
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerSearch.prototype.load = function(parentNode) {
|
||||
this.parentNode = parentNode;
|
||||
this.display();
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerSearch.submit = function(form) {
|
||||
//construct query obj:
|
||||
var conditions = new Array();
|
||||
|
||||
if(form.search_first_name.value != '') {
|
||||
conditions[conditions.length] = {"name":"first_name","op":"starts_with","value":form.search_first_name.value}
|
||||
}
|
||||
if(form.search_last_name.value != '') {
|
||||
conditions[conditions.length] = {"name":"last_name","op":"starts_with","value":form.search_last_name.value}
|
||||
}
|
||||
if(form.search_email.value != '') {
|
||||
conditions[conditions.length] = {"name":"email1","op":"starts_with","value":form.search_email.value}
|
||||
}
|
||||
|
||||
var query = {"modules":["Users","Contacts"
|
||||
,"Leads"
|
||||
],"group":"and","field_list":['id','full_name','email1','phone_work'],"conditions":conditions};
|
||||
global_request_registry[req_count] = [this,'display'];
|
||||
req_id = global_rpcClient.call_method('query',query);
|
||||
global_request_registry[req_id] = [ GLOBAL_REGISTRY['widget_element_map'][form.id],'refresh_list'];
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerSearch.prototype.refresh_list = function(rslt) {
|
||||
GLOBAL_REGISTRY['result_list'] = rslt['list'];
|
||||
this.list_view.display();
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerSearch.prototype.display = function() {
|
||||
var html ='<div class="schedulerInvitees"><h3>'+GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_INVITEE']+'</h5><table border="0" cellpadding="0" cellspacing="0" width="100%" class="edit view">';
|
||||
html +='<tr><td>';
|
||||
html += '<form name="schedulerwidget" id="'+this.form_id+'" onsubmit="SugarWidgetSchedulerSearch.submit(this);return false;">';
|
||||
|
||||
html += '<table width="100%" cellpadding="0" cellspacing="0" width="100%" >'
|
||||
html += '<tr>';
|
||||
//html += '<form id="'+this.form_id+'"><table width="100%"><tbody><tr>';
|
||||
html += '<td scope="row" nowrap>'+GLOBAL_REGISTRY['meeting_strings']['LBL_FIRST_NAME']+': <input name="search_first_name" value="" type="text" size="10"></td>';
|
||||
html += '<td scope="row" nowrap>'+GLOBAL_REGISTRY['meeting_strings']['LBL_LAST_NAME']+': <input name="search_last_name" value="" type="text" size="10"></td>';
|
||||
html += '<td scope="row" nowrap>'+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+': <input name="search_email" type="text" value="" size="15"></td>';
|
||||
//html += '<td valign="center"><input type="submit" onclick="SugarWidgetSchedulerSearch.submit(this.form);" value="Search" ></td></tr></tbody></table></form>';
|
||||
html += '<td valign="center"><input type="submit" class="button" value="'+GLOBAL_REGISTRY['meeting_strings']['LBL_SEARCH_BUTTON']+'" ></td></tr>';
|
||||
html += '</table>';
|
||||
html += '</form>';
|
||||
html += '</td></tr></table></div>';
|
||||
|
||||
// append the list_view as the third row of the outside table
|
||||
this.parentNode.innerHTML += html;
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('id','list_div_win');
|
||||
div.style.overflow = 'auto';
|
||||
div.style.width = '100%';
|
||||
div.style.height= '125px';
|
||||
div.style.display = 'none';
|
||||
this.parentNode.appendChild(div);
|
||||
|
||||
this.list_view = new SugarWidgetListView();
|
||||
this.list_view.load(div);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// class: SugarWidgetScheduler
|
||||
// widget to display the meeting scheduler
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
SugarClass.inherit("SugarWidgetScheduler","SugarClass");
|
||||
|
||||
function SugarWidgetScheduler() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
SugarWidgetScheduler.prototype.init = function() {
|
||||
//var row = new SugarWidgetScheduleAttendees();
|
||||
//row.load(this);
|
||||
}
|
||||
|
||||
SugarWidgetScheduler.prototype.load = function(parentNode) {
|
||||
this.parentNode = parentNode;
|
||||
this.display();
|
||||
}
|
||||
|
||||
SugarWidgetScheduler.fill_invitees = function(form) {
|
||||
for(var i=0;i<GLOBAL_REGISTRY.focus.users_arr.length;i++) {
|
||||
if(GLOBAL_REGISTRY.focus.users_arr[i].module == 'User') {
|
||||
form.user_invitees.value += GLOBAL_REGISTRY.focus.users_arr[i].fields.id + ",";
|
||||
} else if(GLOBAL_REGISTRY.focus.users_arr[i].module == 'Contact') {
|
||||
form.contact_invitees.value += GLOBAL_REGISTRY.focus.users_arr[i].fields.id + ",";
|
||||
} else if(GLOBAL_REGISTRY.focus.users_arr[i].module == 'Lead') {
|
||||
form.lead_invitees.value += GLOBAL_REGISTRY.focus.users_arr[i].fields.id + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SugarWidgetScheduler.update_time = function() {
|
||||
|
||||
//For quick creates do nothing.
|
||||
if( typeof(document.EditView) == 'undefined')
|
||||
return;
|
||||
|
||||
var date_start = document.EditView.date_start.value;
|
||||
if(date_start.length < 16) {
|
||||
return;
|
||||
}
|
||||
var hour_start = parseInt(date_start.substring(11,13), 10);
|
||||
var minute_start = parseInt(date_start.substring(14,16), 10);
|
||||
var has_meridiem = /am|pm/i.test(date_start);
|
||||
if(has_meridiem) {
|
||||
var meridiem = trim(date_start.substring(16));
|
||||
}
|
||||
|
||||
GLOBAL_REGISTRY.focus.fields.date_start = date_start;
|
||||
|
||||
if(has_meridiem) {
|
||||
GLOBAL_REGISTRY.focus.fields.time_start = hour_start + time_separator + minute_start + meridiem;
|
||||
} else {
|
||||
GLOBAL_REGISTRY.focus.fields.time_start = hour_start + time_separator + minute_start;
|
||||
}
|
||||
|
||||
GLOBAL_REGISTRY.focus.fields.duration_hours = document.EditView.duration_hours.value;
|
||||
GLOBAL_REGISTRY.focus.fields.duration_minutes = document.EditView.duration_minutes.value;
|
||||
GLOBAL_REGISTRY.focus.fields.datetime_start = SugarDateTime.mysql2jsDateTime(GLOBAL_REGISTRY.focus.fields.date_start,GLOBAL_REGISTRY.focus.fields.time_start);
|
||||
|
||||
GLOBAL_REGISTRY.scheduler_attendees_obj.init();
|
||||
GLOBAL_REGISTRY.scheduler_attendees_obj.display();
|
||||
}
|
||||
|
||||
SugarWidgetScheduler.prototype.display = function() {
|
||||
this.parentNode.innerHTML = '';
|
||||
|
||||
var attendees = new SugarWidgetSchedulerAttendees();
|
||||
attendees.load(this.parentNode);
|
||||
|
||||
var search = new SugarWidgetSchedulerSearch();
|
||||
search.load(this.parentNode);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// class: SugarWidgetSchedulerAttendees
|
||||
// widget to display the meeting attendees and availability
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
SugarClass.inherit("SugarWidgetSchedulerAttendees","SugarClass");
|
||||
|
||||
function SugarWidgetSchedulerAttendees() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerAttendees.prototype.init = function() {
|
||||
// this.datetime = new SugarDateTime();
|
||||
GLOBAL_REGISTRY.scheduler_attendees_obj = this;
|
||||
var date_start = document.EditView.date_start.value;
|
||||
var hour_start = parseInt(date_start.substring(11,13), 10);
|
||||
var minute_start = parseInt(date_start.substring(14,16), 10);
|
||||
var has_meridiem = /am|pm/i.test(date_start);
|
||||
if(has_meridiem) {
|
||||
var meridiem = trim(date_start.substring(16));
|
||||
}
|
||||
|
||||
if(has_meridiem) {
|
||||
GLOBAL_REGISTRY.focus.fields.time_start = hour_start + time_separator + minute_start + meridiem;
|
||||
} else {
|
||||
GLOBAL_REGISTRY.focus.fields.time_start = hour_start+time_separator+minute_start;
|
||||
//GLOBAL_REGISTRY.focus.fields.time_start = document.EditView.time_hour_start.value+time_separator+minute_start;
|
||||
}
|
||||
|
||||
GLOBAL_REGISTRY.focus.fields.date_start = document.EditView.date_start.value;
|
||||
GLOBAL_REGISTRY.focus.fields.duration_hours = document.EditView.duration_hours.value;
|
||||
GLOBAL_REGISTRY.focus.fields.duration_minutes = document.EditView.duration_minutes.value;
|
||||
GLOBAL_REGISTRY.focus.fields.datetime_start = SugarDateTime.mysql2jsDateTime(GLOBAL_REGISTRY.focus.fields.date_start,GLOBAL_REGISTRY.focus.fields.time_start);
|
||||
|
||||
this.timeslots = new Array();
|
||||
this.hours = 9;
|
||||
this.segments = 4;
|
||||
this.start_hours_before = 4;
|
||||
|
||||
var minute_interval = 15;
|
||||
var dtstart = GLOBAL_REGISTRY.focus.fields.datetime_start;
|
||||
|
||||
// initialize first date in timeslots
|
||||
var curdate = new Date(dtstart.getFullYear(),dtstart.getMonth(),dtstart.getDate(),dtstart.getHours()-this.start_hours_before,0);
|
||||
|
||||
if(typeof(GLOBAL_REGISTRY.focus.fields.duration_minutes) == 'undefined') {
|
||||
GLOBAL_REGISTRY.focus.fields.duration_minutes = 0;
|
||||
}
|
||||
GLOBAL_REGISTRY.focus.fields.datetime_end = new Date(dtstart.getFullYear(),dtstart.getMonth(),dtstart.getDate(),dtstart.getHours()+parseInt(GLOBAL_REGISTRY.focus.fields.duration_hours),dtstart.getMinutes()+parseInt(GLOBAL_REGISTRY.focus.fields.duration_minutes),0);
|
||||
|
||||
var has_start = false;
|
||||
var has_end = false;
|
||||
|
||||
for(i=0;i < this.hours*this.segments; i++) {
|
||||
var hash = SugarDateTime.getUTCHash(curdate);
|
||||
var obj = {"hash":hash,"date_obj":curdate};
|
||||
if(has_start == false && GLOBAL_REGISTRY.focus.fields.datetime_start.getTime() <= curdate.getTime()) {
|
||||
obj.is_start = true;
|
||||
has_start = true;
|
||||
}
|
||||
if(has_end == false && GLOBAL_REGISTRY.focus.fields.datetime_end.getTime() <= curdate.getTime()) {
|
||||
obj.is_end = true;
|
||||
has_end = true;
|
||||
}
|
||||
this.timeslots.push(obj);
|
||||
|
||||
curdate = new Date(curdate.getFullYear(),curdate.getMonth(),curdate.getDate(),curdate.getHours(),curdate.getMinutes()+minute_interval);
|
||||
}
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerAttendees.prototype.load = function (parentNode) {
|
||||
this.parentNode = parentNode;
|
||||
this.display();
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerAttendees.prototype.display = function() {
|
||||
var dtstart = GLOBAL_REGISTRY.focus.fields.datetime_start;
|
||||
var top_date = SugarDateTime.getFormattedDate(dtstart);
|
||||
var html = '<h3>'+GLOBAL_REGISTRY['meeting_strings']['LBL_SCHEDULING_FORM_TITLE']+'</h3><table id ="schedulerTable">';
|
||||
html += '<tr class="schedulerTopRow">';
|
||||
html += '<th colspan="'+((this.hours*this.segments)+2)+'"><h4>'+ top_date +'</h4></th>';
|
||||
html += '</tr>';
|
||||
html += '<tr class="schedulerTimeRow">';
|
||||
html += '<td> </td>';
|
||||
|
||||
for(var i=0;i < (this.timeslots.length/this.segments); i++) {
|
||||
var hours = this.timeslots[i*this.segments].date_obj.getHours();
|
||||
var am_pm = '';
|
||||
|
||||
if(time_reg_format.indexOf('A') >= 0 || time_reg_format.indexOf('a') >= 0) {
|
||||
am_pm = "AM";
|
||||
|
||||
if(hours > 12) {
|
||||
am_pm = "PM";
|
||||
hours -= 12;
|
||||
}
|
||||
if(hours == 12) {
|
||||
am_pm = "PM";
|
||||
}
|
||||
if(hours == 0) {
|
||||
hours = 12;
|
||||
am_pm = "AM";
|
||||
}
|
||||
if(time_reg_format.indexOf('a') >= 0) {
|
||||
am_pm = am_pm.toLowerCase();
|
||||
}
|
||||
if(hours != 0 && hours != 12 && i != 0) {
|
||||
am_pm = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var form_hours = hours+time_separator+"00";
|
||||
html += '<td scope="col" colspan="'+this.segments+'">'+form_hours+am_pm+'</td>';
|
||||
}
|
||||
|
||||
html += '<td> </td>';
|
||||
html += '</tr>';
|
||||
html += '</table>';
|
||||
if ( this.parentNode.childNodes.length < 1 )
|
||||
this.parentNode.innerHTML += '<div class="schedulerDiv">' + html + '</div>';
|
||||
else
|
||||
this.parentNode.childNodes[0].innerHTML = html;
|
||||
|
||||
var thetable = "schedulerTable";
|
||||
|
||||
if(typeof (GLOBAL_REGISTRY) == 'undefined') {
|
||||
return;
|
||||
}
|
||||
// grab current user (as event-coordinator)
|
||||
if(typeof (GLOBAL_REGISTRY.focus.users_arr) == 'undefined' || GLOBAL_REGISTRY.focus.users_arr.length == 0) {
|
||||
GLOBAL_REGISTRY.focus.users_arr = [ GLOBAL_REGISTRY.current_user ];
|
||||
}
|
||||
if(typeof GLOBAL_REGISTRY.focus.users_arr_hash == 'undefined') {
|
||||
GLOBAL_REGISTRY.focus.users_arr_hash = new Object();
|
||||
}
|
||||
|
||||
// append attendee rows
|
||||
for(var i=0;i < GLOBAL_REGISTRY.focus.users_arr.length;i++) {
|
||||
var row = new SugarWidgetScheduleRow(this.timeslots);
|
||||
row.focus_bean = GLOBAL_REGISTRY.focus.users_arr[i];
|
||||
GLOBAL_REGISTRY.focus.users_arr_hash[ GLOBAL_REGISTRY.focus.users_arr[i]['fields']['id']] = GLOBAL_REGISTRY.focus.users_arr[i];
|
||||
row.load(thetable);
|
||||
}
|
||||
}
|
||||
|
||||
SugarWidgetSchedulerAttendees.form_add_attendee = function (list_row) {
|
||||
if(typeof (GLOBAL_REGISTRY.result_list[list_row]) != 'undefined' && typeof(GLOBAL_REGISTRY.focus.users_arr_hash[ GLOBAL_REGISTRY.result_list[list_row].fields.id]) == 'undefined') {
|
||||
GLOBAL_REGISTRY.focus.users_arr[ GLOBAL_REGISTRY.focus.users_arr.length ] = GLOBAL_REGISTRY.result_list[list_row];
|
||||
}
|
||||
GLOBAL_REGISTRY.scheduler_attendees_obj.display();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// class: SugarWidgetScheduleRow
|
||||
// widget to display each row in the scheduler
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
SugarClass.inherit("SugarWidgetScheduleRow","SugarClass");
|
||||
|
||||
function SugarWidgetScheduleRow(timeslots) {
|
||||
this.init(timeslots);
|
||||
}
|
||||
|
||||
SugarWidgetScheduleRow.prototype.init = function(timeslots) {
|
||||
this.timeslots = timeslots;
|
||||
}
|
||||
|
||||
SugarWidgetScheduleRow.prototype.load = function (thetableid) {
|
||||
this.thetableid = thetableid;
|
||||
var self = this;
|
||||
|
||||
vcalClient = new SugarVCalClient();
|
||||
if(typeof (GLOBAL_REGISTRY['freebusy_adjusted']) == 'undefined' || typeof (GLOBAL_REGISTRY['freebusy_adjusted'][this.focus_bean.fields.id]) == 'undefined') {
|
||||
global_request_registry[req_count] = [this,'display'];
|
||||
vcalClient.load(this.focus_bean.fields.id,req_count);
|
||||
req_count++;
|
||||
} else {
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
|
||||
SugarWidgetScheduleRow.prototype.display = function() {
|
||||
var self = this;
|
||||
var tr;
|
||||
this.thetable = document.getElementById(this.thetableid);
|
||||
|
||||
if(typeof (this.element) != 'undefined') {
|
||||
if (this.element.parentNode != null)
|
||||
this.thetable.deleteRow(this.element.rowIndex);
|
||||
|
||||
tr = document.createElement('tr');
|
||||
this.thetable.appendChild(tr);
|
||||
} else {
|
||||
tr = this.thetable.insertRow(this.thetable.rows.length);
|
||||
}
|
||||
tr.className = "schedulerAttendeeRow";
|
||||
|
||||
td = document.createElement('td');
|
||||
tr.appendChild(td);
|
||||
//insertCell(tr.cells.length);
|
||||
|
||||
// icon + full name
|
||||
td.scope = 'row';
|
||||
var img = '<img align="absmiddle" src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName='+self.focus_bean.module+'s.gif"/> ';
|
||||
td.innerHTML = img;
|
||||
|
||||
td.innerHTML = td.innerHTML;
|
||||
|
||||
if (self.focus_bean.fields.full_name)
|
||||
td.innerHTML += ' ' + self.focus_bean.fields.full_name;
|
||||
else
|
||||
td.innerHTML += ' ' + self.focus_bean.fields.name;
|
||||
|
||||
// add freebusy tds here:
|
||||
this.add_freebusy_nodes(tr);
|
||||
|
||||
// delete button
|
||||
var td = document.createElement('td');
|
||||
tr.appendChild(td);
|
||||
//var td = tr.insertCell(tr.cells.length);
|
||||
td.className = 'schedulerAttendeeDeleteCell';
|
||||
td.noWrap = true;
|
||||
if ( GLOBAL_REGISTRY.focus.fields.assigned_user_id != self.focus_bean.fields.id ) {
|
||||
td.innerHTML = '<a title="'+ GLOBAL_REGISTRY['meeting_strings']['LBL_DEL'] +'" class="listViewTdToolsS1" href="javascript:SugarWidgetScheduleRow.deleteRow(\''+self.focus_bean.fields.id+'\');"> <img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=delete_inline.gif" align="absmiddle" alt="'+ GLOBAL_REGISTRY['meeting_strings']['LBL_DEL'] +'" border="0"> '+ GLOBAL_REGISTRY['meeting_strings']['LBL_DEL'] +'</a>';
|
||||
}
|
||||
this.element = tr;
|
||||
this.element_index = this.thetable.rows.length - 1;
|
||||
}
|
||||
|
||||
SugarWidgetScheduleRow.deleteRow = function(bean_id) {
|
||||
// can't delete organizer
|
||||
if(GLOBAL_REGISTRY.focus.users_arr.length == 1 || GLOBAL_REGISTRY.focus.fields.assigned_user_id == bean_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i=0;i<GLOBAL_REGISTRY.focus.users_arr.length;i++) {
|
||||
if(GLOBAL_REGISTRY.focus.users_arr[i]['fields']['id']==bean_id) {
|
||||
delete GLOBAL_REGISTRY.focus.users_arr_hash[GLOBAL_REGISTRY.focus.users_arr[i]['fields']['id']];
|
||||
GLOBAL_REGISTRY.focus.users_arr.splice(i,1);
|
||||
GLOBAL_REGISTRY.container.root_widget.display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function DL_GetElementLeft(eElement) {
|
||||
/*
|
||||
* ifargument is invalid
|
||||
* (not specified, is null or is 0)
|
||||
* and function is a method
|
||||
* identify the element as the method owner
|
||||
*/
|
||||
if(!eElement && this) {
|
||||
eElement = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize var to store calculations
|
||||
* identify first offset parent element
|
||||
* move up through element hierarchy
|
||||
* appending left offset of each parent
|
||||
* until no more offset parents exist
|
||||
*/
|
||||
var nLeftPos = eElement.offsetLeft;
|
||||
var eParElement = eElement.offsetParent;
|
||||
while (eParElement != null) {
|
||||
nLeftPos += eParElement.offsetLeft;
|
||||
eParElement = eParElement.offsetParent;
|
||||
}
|
||||
return nLeftPos; // return the number calculated
|
||||
}
|
||||
|
||||
|
||||
function DL_GetElementTop(eElement) {
|
||||
if(!eElement && this) {
|
||||
eElement = this;
|
||||
}
|
||||
|
||||
var nTopPos = eElement.offsetTop;
|
||||
var eParElement = eElement.offsetParent;
|
||||
while (eParElement != null) {
|
||||
nTopPos += eParElement.offsetTop;
|
||||
eParElement = eParElement.offsetParent;
|
||||
}
|
||||
return nTopPos;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
// adds the <td>s for freebusy display within a row
|
||||
SugarWidgetScheduleRow.prototype.add_freebusy_nodes = function(tr,attendee) {
|
||||
var hours = 9;
|
||||
var segments = 4;
|
||||
var html = '';
|
||||
var is_loaded = false;
|
||||
|
||||
if(typeof GLOBAL_REGISTRY['freebusy_adjusted'] != 'undefined' && typeof GLOBAL_REGISTRY['freebusy_adjusted'][this.focus_bean.fields.id] != 'undefined') {
|
||||
is_loaded = true;
|
||||
}
|
||||
|
||||
for(var i=0;i < this.timeslots.length; i++) {
|
||||
var td = document.createElement('td');
|
||||
tr.appendChild(td);
|
||||
//var td = tr.insertCell(tr.cells.length);
|
||||
td.innerHTML = ' ';
|
||||
if(typeof(this.timeslots[i]['is_start']) != 'undefined') {
|
||||
td.className = 'schedulerSlotCellStartTime';
|
||||
}
|
||||
if(typeof(this.timeslots[i]['is_end']) != 'undefined') {
|
||||
td.className = 'schedulerSlotCellEndTime';
|
||||
}
|
||||
|
||||
if(is_loaded) {
|
||||
// iftheres a freebusy stack in this slice
|
||||
if( typeof(GLOBAL_REGISTRY['freebusy_adjusted'][this.focus_bean.fields.id][this.timeslots[i].hash]) != 'undefined') {
|
||||
td.style.backgroundColor="#4D5EAA";
|
||||
|
||||
if(td.className == 'schedulerSlotCellStartTime') {
|
||||
fb_limit = 1;
|
||||
if(typeof(GLOBAL_REGISTRY.focus.orig_users_arr_hash) != 'undefined' && typeof(GLOBAL_REGISTRY.focus.orig_users_arr_hash[this.focus_bean.fields.id]) != 'undefined') {
|
||||
fb_limit = 2;
|
||||
}
|
||||
|
||||
if( GLOBAL_REGISTRY['freebusy_adjusted'][this.focus_bean.fields.id][this.timeslots[i].hash] >= fb_limit) {
|
||||
td.style.backgroundColor="#AA4D4D";
|
||||
} else {
|
||||
td.style.backgroundColor="#4D5EAA";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
403
jssource/src_files/modules/MergeRecords/Merge.js
Normal file
403
jssource/src_files/modules/MergeRecords/Merge.js
Normal file
@@ -0,0 +1,403 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
var lbl_remove = SUGAR.language.get('app_strings', 'LBL_REMOVE');
|
||||
|
||||
function remove_filter(spanfieldid) {
|
||||
var selspan = document.getElementById(spanfieldid);
|
||||
//hide the span
|
||||
selspan.setAttribute("style","visibility:hidden");
|
||||
selspan.innerHTML='';//' '
|
||||
|
||||
//and id to avail list.
|
||||
var ops=object_refs['field_avail_list'].options;
|
||||
var newoption = new Option(selspan.getAttribute("Value"),selspan.getAttribute("ValueId"),false,true);
|
||||
ops.add(newoption);
|
||||
}
|
||||
function ajax_fetch_sync(url,post_data)
|
||||
{
|
||||
global_xmlhttp = getXMLHTTPinstance();
|
||||
|
||||
var method = 'GET';
|
||||
if ( typeof(post_data) != 'undefined' )
|
||||
{
|
||||
method = 'POST';
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
global_xmlhttp.open(method, url,false);
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
alert('message:'+error.message+":url:"+url);
|
||||
}
|
||||
|
||||
if ( method == 'POST')
|
||||
{
|
||||
global_xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
}
|
||||
|
||||
global_xmlhttp.send(post_data);
|
||||
var ajax_response = {"responseText":global_xmlhttp.responseText,"responseXML":global_xmlhttp.responseXML};
|
||||
|
||||
return ajax_response;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
function get_fields_to_dedup(parent_mod)
|
||||
{
|
||||
var rel_map_div_obj = document.getElementById('rel_map');
|
||||
|
||||
if(parent_mod != '')
|
||||
{
|
||||
var request_id = 1;
|
||||
var url = site_url + '/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module=' + parent_mod + '&module=MigrationMappings&action=GetRelationshipsToMap';
|
||||
var ajax_return_obj = ajax_fetch_sync(url);
|
||||
|
||||
try { eval("var responseObj =" + ajax_return_obj['responseText']); }
|
||||
catch(e) { alert(ajax_return_obj['responseText']); }
|
||||
|
||||
build_avail_rels_array(responseObj);
|
||||
|
||||
rel_map_div_obj.innerHTML = responseObj['html_content'];
|
||||
}
|
||||
else
|
||||
{
|
||||
rel_map_div_obj.innerHTML = '';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_dedup_fields()
|
||||
{
|
||||
var parent_div = document.getElementById('filter_def');
|
||||
var node;
|
||||
var spannode;
|
||||
var value;
|
||||
var valueid;
|
||||
var style;
|
||||
document.DedupSetup.dedup_fields.value='';
|
||||
for (node in parent_div.childNodes) {
|
||||
spannode=parent_div.childNodes[node];
|
||||
if (spannode.tagName=='SPAN') {
|
||||
value= spannode.getAttribute('value');
|
||||
valueid=spannode.getAttribute('valueid');
|
||||
style=spannode.getAttribute('style');
|
||||
if (typeof(style) == 'undefined' || style==null || style=='' || style.lastIndexOf('hidden') == -1 ) {
|
||||
if (document.DedupSetup.dedup_fields.value != '') {
|
||||
document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value + '#';
|
||||
}
|
||||
document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + valueid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var selected_fields_obj = document.getElementById('field_include_list[]');
|
||||
|
||||
//for(i=0; i < selected_fields_obj.length; i++)
|
||||
//{
|
||||
// document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + selected_fields_obj.options[i].value;
|
||||
// if(i != (selected_fields_obj.length - 1)) { document.DedupSetup.dedup_fields.value += '#'; }
|
||||
//}
|
||||
|
||||
// document.DedupSetup.submit();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
var object_refs = new Object();
|
||||
object_refs['field_include_list'] = document.DedupSetup['field_include_list'];
|
||||
object_refs['field_avail_list'] = document.DedupSetup['field_avail_list'];
|
||||
|
||||
function setselected(included_name,avail_name)
|
||||
{
|
||||
var included_columns_ref = object_refs[included_name];
|
||||
var avail_columns_ref = object_refs[avail_name];
|
||||
|
||||
var included_td = document.getElementById(included_name+'_td');
|
||||
var avail_td = document.getElementById(avail_name+'_td');
|
||||
|
||||
var selected_avail = new Array();
|
||||
var notselected_avail = new Array();
|
||||
var notselected_include = new Array();
|
||||
|
||||
for (i=0; i < avail_columns_ref.options.length; i++)
|
||||
{
|
||||
if (avail_columns_ref.options[i].selected == true)
|
||||
{
|
||||
selected_avail[selected_avail.length] = {text:avail_columns_ref.options[i].text, value:avail_columns_ref.options[i].value};
|
||||
}
|
||||
else
|
||||
{
|
||||
notselected_avail[notselected_avail.length] = {text:avail_columns_ref.options[i].text, value:avail_columns_ref.options[i].value};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var right_select_html_info = new Object();
|
||||
var right_options = new Array();
|
||||
var right_select = new Object();
|
||||
|
||||
right_select['name'] = avail_name+ '[]';
|
||||
right_select['id'] = avail_name;
|
||||
right_select['multiple'] = 'true';
|
||||
right_select['size'] = '10';
|
||||
|
||||
for (i=0;i < notselected_avail.length;i++)
|
||||
{
|
||||
right_options[right_options.length] = notselected_avail[i];
|
||||
}
|
||||
|
||||
right_select_html_info['options'] = right_options;
|
||||
right_select_html_info['select'] = right_select;
|
||||
|
||||
var right_html = buildSelectHTML(right_select_html_info);
|
||||
|
||||
avail_td.innerHTML = right_html;
|
||||
object_refs[avail_name] = avail_td.getElementsByTagName('select')[0];
|
||||
|
||||
//////////////////////////////
|
||||
for(p=0; p < selected_avail.length; p++)
|
||||
{
|
||||
addFieldRow(selected_avail[p].value, selected_avail[p].text)
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
}
|
||||
|
||||
|
||||
function up(name) {
|
||||
var td = document.getElementById(name+'_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
obj = (typeof obj == "string") ? document.getElementById(obj) : obj;
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
|
||||
for (i=0; i<obj.length; i++) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != 0 && !obj[sel[i]-1].selected) {
|
||||
var tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);
|
||||
obj[sel[i]-1].text = obj[sel[i]].text;
|
||||
obj[sel[i]-1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i]-1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function down(name) {
|
||||
var td = document.getElementById(name+'_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
for (i=obj.length-1; i>-1; i--) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {
|
||||
var tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);
|
||||
obj[sel[i]+1].text = obj[sel[i]].text;
|
||||
obj[sel[i]+1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i]+1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildSelectHTML(info)
|
||||
{
|
||||
var text;
|
||||
text = "<div align='left'><select";
|
||||
|
||||
if ( typeof (info['select']['size']) != 'undefined')
|
||||
{
|
||||
text +=" size=\""+ info['select']['size'] +"\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['name']) != 'undefined')
|
||||
{
|
||||
text +=" name=\""+ info['select']['name'] +"\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['style']) != 'undefined')
|
||||
{
|
||||
text +=" style=\""+ info['select']['style'] +"\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['onchange']) != 'undefined')
|
||||
{
|
||||
text +=" onChange=\""+ info['select']['onchange'] +"\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['multiple']) != 'undefined')
|
||||
{
|
||||
text +=" multiple";
|
||||
}
|
||||
text +=">";
|
||||
|
||||
for(i=0; i<info['options'].length;i++)
|
||||
{
|
||||
option = info['options'][i];
|
||||
text += "<option value=\""+option['value']+"\" ";
|
||||
if ( typeof (option['selected']) != 'undefined' && option['selected']== true)
|
||||
{
|
||||
text += "SELECTED";
|
||||
}
|
||||
text += ">"+option['text']+"</option>";
|
||||
}
|
||||
text += "</select></div>";
|
||||
return text;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
var fieldCount = 0;
|
||||
function addFieldRow(colName, colLabel) {
|
||||
var tableId = 'search_type';
|
||||
var rowIdName = 'field';
|
||||
|
||||
var fieldArrayCount;
|
||||
var optionVal;
|
||||
var optionDispVal;
|
||||
var optionsIndex = 0;
|
||||
|
||||
fieldCount = fieldCount + 1;
|
||||
document.DedupSetup.num_fields.value = fieldCount;
|
||||
|
||||
var selElement = document.createElement("select");
|
||||
var selectName = colName + "SearchType";
|
||||
selElement.setAttribute("name", selectName);
|
||||
|
||||
var i=0;
|
||||
for (theoption in operator_options) {
|
||||
selElement.options[i] = new Option(operator_options[theoption],theoption, false, false);
|
||||
i++;
|
||||
}
|
||||
|
||||
var aElement = document.createElement("a");
|
||||
aElement.setAttribute("href","javascript:remove_filter('filter_" + colName + "')");
|
||||
aElement.setAttribute("class","listViewTdToolsS1");
|
||||
|
||||
var imgElement = document.createElement("img");
|
||||
imgElement.setAttribute("src", delete_inline_image);
|
||||
imgElement.setAttribute("align","absmiddle");
|
||||
imgElement.setAttribute("alt",lbl_remove);
|
||||
imgElement.setAttribute("border","0");
|
||||
imgElement.setAttribute("height","12");
|
||||
imgElement.setAttribute("width","12");
|
||||
|
||||
aElement.appendChild(imgElement);
|
||||
aElement.appendChild(document.createTextNode(" "));
|
||||
|
||||
var div = document.getElementById('filter_def');
|
||||
var span1 = document.getElementById('filter_'+colName);
|
||||
if (span1 == null || span1=='' || typeof(span1)=='undefined') {
|
||||
span1=document.createElement("span");
|
||||
} else {
|
||||
span1.setAttribute("style","visibility:visible");
|
||||
}
|
||||
|
||||
span1.setAttribute("id",'filter_'+colName);
|
||||
span1.setAttribute("Value",colLabel);
|
||||
span1.setAttribute("ValueId",colName);
|
||||
|
||||
//table as a child of span element.
|
||||
//table with only row only.
|
||||
var table = document.createElement("table");
|
||||
//usage or insertRow is required by IE, ironically this call
|
||||
//produces bad UI when using IE on mac.
|
||||
var row = table.insertRow(table.rows.length );
|
||||
table.setAttribute("width","100%");
|
||||
table.setAttribute("border","0");
|
||||
table.setAttribute("cellpadding","0");
|
||||
|
||||
var td1= document.createElement("td");
|
||||
td1.setAttribute("width","2%");
|
||||
|
||||
td1.appendChild(aElement);
|
||||
row.appendChild(td1)
|
||||
|
||||
var td2= document.createElement("td");
|
||||
td2.setAttribute("width","20%");
|
||||
td2.appendChild(document.createTextNode(colLabel + ': '));
|
||||
row.appendChild(td2)
|
||||
|
||||
var td3= document.createElement("td");
|
||||
td3.setAttribute("width","10%");
|
||||
td3.appendChild(selElement);
|
||||
row.appendChild(td3);
|
||||
|
||||
var coldata;
|
||||
eval("coldata=bean_data."+ colName+ ";");
|
||||
|
||||
var edit=document.createElement("input");
|
||||
edit.setAttribute("type","text");
|
||||
edit.setAttribute("name",colName + 'SearchField');
|
||||
edit.setAttribute("id",colName + 'SearchField');
|
||||
edit.setAttribute("value",coldata);
|
||||
|
||||
|
||||
var td5= document.createElement("td");
|
||||
td5.setAttribute("width","68%");
|
||||
td5.appendChild(edit);
|
||||
row.appendChild(td5);
|
||||
|
||||
|
||||
//table.appendChild(row);
|
||||
span1.appendChild(table);
|
||||
div.appendChild(span1);
|
||||
}
|
||||
96
jssource/src_files/modules/Project/Project.js
Normal file
96
jssource/src_files/modules/Project/Project.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
function prep_edit(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='DetailView';
|
||||
the_form.return_id.value='{id}';
|
||||
the_form.action.value='EditView';
|
||||
the_form.sugar_body_only.value='0';
|
||||
}
|
||||
|
||||
function prep_edit_project_tasks(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='DetailView';
|
||||
the_form.return_id.value='{id}';
|
||||
the_form.action.value='EditGridView';
|
||||
the_form.sugar_body_only.value='0';
|
||||
}
|
||||
|
||||
function prep_duplicate(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='index';
|
||||
the_form.isDuplicate.value=true;
|
||||
the_form.action.value='EditView';
|
||||
the_form.sugar_body_only.value='0';
|
||||
}
|
||||
|
||||
function prep_delete(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='ListView';
|
||||
the_form.action.value='Delete';
|
||||
the_form.sugar_body_only.value='0';
|
||||
}
|
||||
|
||||
function prep_save_as_template(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='DetailView';
|
||||
the_form.return_id.value='{id}';
|
||||
the_form.action.value='Convert';
|
||||
the_form.sugar_body_only.value='0';
|
||||
}
|
||||
function prep_save_as_project(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='ProjectTemplatesDetailView';
|
||||
the_form.return_id.value='{id}';
|
||||
the_form.action.value='Convert';
|
||||
}
|
||||
|
||||
function prep_export_to_project(the_form)
|
||||
{
|
||||
the_form.return_module.value='Project';
|
||||
the_form.return_action.value='DetailView';
|
||||
the_form.return_id.value='{id}';
|
||||
the_form.action.value='Export';
|
||||
the_form.sugar_body_only.value='1';
|
||||
}
|
||||
65
jssource/src_files/modules/ProjectTask/ProjectTask.js
Normal file
65
jssource/src_files/modules/ProjectTask/ProjectTask.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
function update_status(percent_complete){
|
||||
if (percent_complete == '0'){
|
||||
document.getElementById('status').value = 'Not Started';
|
||||
}
|
||||
else if (percent_complete == '100'){
|
||||
document.getElementById('status').value = 'Completed';
|
||||
}
|
||||
else if (isNaN(percent_complete) || (percent_complete < 0 || percent_complete > 100)){
|
||||
document.getElementById('percent_complete').value = '';
|
||||
}
|
||||
else{
|
||||
document.getElementById('status').value = 'In Progress';
|
||||
}
|
||||
}
|
||||
|
||||
function update_percent_complete(status){
|
||||
if (status == 'In Progress'){
|
||||
percent_value = '50';
|
||||
}
|
||||
else if (status == 'Completed'){
|
||||
percent_value = '100';
|
||||
}
|
||||
else{
|
||||
percent_value = '0';
|
||||
}
|
||||
document.getElementById('percent_complete').value = percent_value;
|
||||
}
|
||||
78
jssource/src_files/modules/Studio/JSTransaction.js
Normal file
78
jssource/src_files/modules/Studio/JSTransaction.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
function JSTransaction(){
|
||||
this.JSTransactions = new Array();
|
||||
this.JSTransactionIndex = 0;
|
||||
this.JSTransactionCanRedo = false;
|
||||
this.JSTransactionTypes = new Array();
|
||||
|
||||
|
||||
}
|
||||
|
||||
JSTransaction.prototype.record = function(transaction, data){
|
||||
this.JSTransactions[this.JSTransactionIndex] = {'transaction':transaction , 'data':data};
|
||||
this.JSTransactionIndex++;
|
||||
this.JSTransactionCanRedo = false
|
||||
}
|
||||
JSTransaction.prototype.register = function(transaction, undo, redo){
|
||||
this.JSTransactionTypes[transaction] = {'undo': undo, 'redo':redo};
|
||||
}
|
||||
JSTransaction.prototype.undo = function(){
|
||||
if(this.JSTransactionIndex > 0){
|
||||
if(this.JSTransactionIndex > this.JSTransactions.length ){
|
||||
this.JSTransactionIndex = this.JSTransactions.length;
|
||||
}
|
||||
var transaction = this.JSTransactions[this.JSTransactionIndex - 1];
|
||||
var undoFunction = this.JSTransactionTypes[transaction['transaction']]['undo'];
|
||||
undoFunction(transaction['data']);
|
||||
this.JSTransactionIndex--;
|
||||
this.JSTransactionCanRedo = true;
|
||||
}
|
||||
}
|
||||
JSTransaction.prototype.redo = function(){
|
||||
if(this.JSTransactionCanRedo && this.JSTransactions.length < 0)this.JSTransactionIndex = 0;
|
||||
if(this.JSTransactionCanRedo && this.JSTransactionIndex <= this.JSTransactions.length ){
|
||||
this.JSTransactionIndex++;
|
||||
var transaction = this.JSTransactions[this.JSTransactionIndex - 1];
|
||||
var redoFunction = this.JSTransactionTypes[transaction['transaction']]['redo'];
|
||||
redoFunction(transaction['data']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
548
jssource/src_files/modules/Studio/studio.js
Normal file
548
jssource/src_files/modules/Studio/studio.js
Normal file
@@ -0,0 +1,548 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
var yahooSlots = new Array();
|
||||
function addNewRowToView(id){
|
||||
var curRow = document.getElementById(id);
|
||||
var parent = curRow.parentNode;
|
||||
var newRow = document.createElement('tr');
|
||||
var newRow = parent.insertRow(parent.rows.length);
|
||||
var re = /studiorow[0-9]+/g;
|
||||
var cell = newRow.insertCell(0);
|
||||
|
||||
cell.innerHTML = curRow.cells[0].innerHTML.replace(re, 'studiorow' + slotCount);
|
||||
cell.className = curRow.cells[0].className;
|
||||
for(var j = 1; j < curRow.cells.length ; j++){
|
||||
var cell = newRow.insertCell(j);
|
||||
cell.innerHTML = ' ';
|
||||
cell.className = curRow.cells[j].className;
|
||||
}
|
||||
var index = parent.rows.length;
|
||||
for(var i = 0; i < parent.rows.length ; i++){
|
||||
if(parent.rows[i].id == id){
|
||||
index = i + 1;
|
||||
}
|
||||
}
|
||||
newRow.id = 'studiorow' + slotCount;
|
||||
if(typeof(curRow.parentId) == 'undefined'){
|
||||
newRow.parentId = id;
|
||||
}else{
|
||||
newRow.parentId = curRow.parentId;
|
||||
}
|
||||
if(index < parent.rows.length){
|
||||
parent.insertBefore(newRow, parent.rows[index]);
|
||||
}else{
|
||||
parent.appendChild(newRow);
|
||||
}
|
||||
document.getElementById('add_' + newRow.parentId).value = 1 + parseInt(document.getElementById('add_' + newRow.parentId).value);
|
||||
slotCount++;
|
||||
}
|
||||
|
||||
function deleteRowFromView(id, index){
|
||||
var curRow = document.getElementById(id);
|
||||
curRow.parentNode.removeChild(curRow);
|
||||
if(typeof(curRow.parentId) == 'undefined'){
|
||||
document.getElementById('form_' + id).value=-1;
|
||||
}else{
|
||||
document.getElementById('add_' + curRow.parentId).value = parseInt(document.getElementById('add_' + curRow.parentId).value) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function addNewColToView(id, index){
|
||||
|
||||
var curCol = document.getElementById(id);
|
||||
var index = curCol.cellIndex;
|
||||
var parent = curCol.parentNode;
|
||||
var cell = parent.insertCell(index + 1);
|
||||
if(parent.parentNode.rows[parent.rowIndex + 1])parent.parentNode.rows[parent.rowIndex + 1].insertCell(index + 1)
|
||||
var re = /studiocol[0-9]+/g;
|
||||
cell.innerHTML = '[NEW]';
|
||||
cell.className = curCol.className;
|
||||
if(typeof(curCol.parentId) == 'undefined'){
|
||||
cell.parentId = id;
|
||||
}else{
|
||||
cell.parentId = curCol.parentId;
|
||||
}
|
||||
|
||||
document.getElementById('add_' + cell.parentId).value = 1 + parseInt(document.getElementById('add_' + cell.parentId).value);
|
||||
slotCount++;
|
||||
}
|
||||
|
||||
function deleteColFromView(id, index){
|
||||
var curCol = document.getElementById(id);
|
||||
var row = curCol.parentNode;
|
||||
var index = curCol.cellIndex;
|
||||
if(typeof(row.cells[index + 1].parentId) == 'undefined'){
|
||||
row.deleteCell(index);
|
||||
row.deleteCell(index - 1);
|
||||
if(row.parentNode.rows[row.rowIndex + 1]){
|
||||
row.parentNode.rows[row.rowIndex + 1].deleteCell(index );
|
||||
row.parentNode.rows[row.rowIndex + 1].deleteCell(index - 1);
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
row.deleteCell(index + 1);
|
||||
if(row.parentNode.rows[row.rowIndex + 1])row.parentNode.rows[row.rowIndex + 1].deleteCell(index +1);
|
||||
|
||||
}
|
||||
document.getElementById('add_' + curCol.id).value = parseInt(document.getElementById('add_' + curCol.id).value) - 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var field_count_MSI = 0;
|
||||
var studioLoaded = false;
|
||||
var dyn_field_count = 0;
|
||||
function addNewFieldType(type){
|
||||
var select = document.getElementById('studio_display_type').options;
|
||||
for(var i = 0; i < select.length; i++){
|
||||
if(select[i].value == type){
|
||||
return;
|
||||
}
|
||||
}
|
||||
select[i] = new Option(type, type);
|
||||
}
|
||||
|
||||
function filterStudioFields(type){
|
||||
var table = document.getElementById('studio_fields');
|
||||
for(var i = 0; i < table.rows.length; i++){
|
||||
children = table.rows[i].cells[0].childNodes;
|
||||
for(var j = 0; j < children.length; j++){
|
||||
child = children[j];
|
||||
if(child.nodeName == 'DIV' && typeof(child.fieldType) != 'undefined'){
|
||||
if(type == 'all'){
|
||||
table.rows[i].style.display = '';
|
||||
}else if(type == 'custom'){
|
||||
if(child.isCustom){
|
||||
table.rows[i].style.display = ''
|
||||
}else{
|
||||
table.rows[i].style.display = 'none';
|
||||
}
|
||||
}else{
|
||||
if(child.fieldType == type){
|
||||
table.rows[i].style.display = ''
|
||||
}else{
|
||||
table.rows[i].style.display = 'none';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function addNewField(id, name, label, html, fieldType,isCustom, table_id, top){
|
||||
|
||||
html = replaceAll(html, "&qt;", '"');
|
||||
html = replaceAll(html, "&sqt;", "'");
|
||||
var table = document.getElementById(table_id);
|
||||
var row = false;
|
||||
if(top){
|
||||
row = table.insertRow(1);
|
||||
}else{
|
||||
row = table.insertRow(table.rows.length);
|
||||
}
|
||||
|
||||
var cell = row.insertCell(0);
|
||||
var div = document.createElement('div');
|
||||
div.className = 'slot';
|
||||
div.setAttribute('id', id);
|
||||
div.fieldType = fieldType;
|
||||
addNewFieldType(fieldType);
|
||||
div.isCustom = isCustom;
|
||||
div.style.width='100%';
|
||||
var textEl = document.createElement('input');
|
||||
textEl.setAttribute('type', 'hidden')
|
||||
textEl.setAttribute('name', 'slot_field_' + field_count_MSI );
|
||||
textEl.setAttribute('id', 'slot_field_' + field_count_MSI );
|
||||
textEl.setAttribute('value', 'add:' + name );
|
||||
field_list_MSI['form_' + name] = textEl;
|
||||
document.studio.appendChild(textEl);
|
||||
div.innerHTML = label;
|
||||
var cell2 = row.insertCell(1);
|
||||
var div2 = document.createElement('div');
|
||||
setMouseOverForField(div, true);
|
||||
div2.style.display = 'none';
|
||||
div2.setAttribute('id', id + 'b' );
|
||||
html = html.replace(/(<input)([^>]*)/g, '$1 disabled readonly $2');
|
||||
html = html.replace(/(<select)([^>]*)/g, '$1 disabled readonly $2');
|
||||
html = html.replace(/(onclick=')([^']*)/g, '$1'); // to strip {} from after a JS onclick call
|
||||
div2.innerHTML += html;
|
||||
cell.appendChild(div);
|
||||
cell2.appendChild(div2);
|
||||
field_count_MSI++;
|
||||
if(top){
|
||||
yahooSlots[id] = new ygDDSlot(id, "studio");
|
||||
}else{
|
||||
dyn_field_count++;
|
||||
}
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removeFieldFromTable(field, table)
|
||||
{
|
||||
var table = document.getElementById(table);
|
||||
var rows = table.rows;
|
||||
for(i = 0 ; i < rows.length; i++){
|
||||
cells = rows[i].cells;
|
||||
for(j = 0; j < cells.length; j++){
|
||||
cell = rows[i].cells[j];
|
||||
children = cell.childNodes;
|
||||
for(k = 0; k < children.length; k++){
|
||||
child = children[k];
|
||||
if(child.nodeType == 1){
|
||||
|
||||
if(child.getAttribute('id') == 'slot_' + field){
|
||||
table.deleteRow(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function setMouseOverForField(field, on){
|
||||
|
||||
if(on){
|
||||
field.onmouseover = function(){
|
||||
return overlib(document.getElementById(this.id + 'b').innerHTML, FGCLASS, 'olFgClass',
|
||||
CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass');
|
||||
|
||||
};
|
||||
field.onmouseout = function(){
|
||||
return nd();
|
||||
};
|
||||
}else{
|
||||
field.onmouseover = function(){};
|
||||
field.onmouseout = function(){};
|
||||
}
|
||||
}
|
||||
var lastIDClick = '';
|
||||
var lastIDClickTime = 0;
|
||||
var dblDelay = 500;
|
||||
function wasDoubleClick(id) {
|
||||
var d = new Date();
|
||||
var now = d.getTime();
|
||||
|
||||
if (lastIDClick == id && (now - lastIDClickTime) < dblDelay) {
|
||||
lastIDClick = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
lastIDClickTime = now;
|
||||
lastIDClick = id;
|
||||
return false;
|
||||
}
|
||||
function confirmNoSave(){
|
||||
return confirm(SUGAR.language.get('Studio', 'LBL_CONFIRM_UNSAVE'));
|
||||
}
|
||||
var labelEdit = false;
|
||||
SUGAR.Studio = function(){
|
||||
this.labelEdit = false;
|
||||
this.lastLabel = false;
|
||||
}
|
||||
SUGAR.Studio.prototype.endLabelEdit = function(id){
|
||||
if(id == 'undefined')return;
|
||||
document.getElementById('span' + id).style.display = 'none';
|
||||
jstransaction.record('studioLabelEdit', {'id':id, 'new': document.getElementById(id).value , 'old':document.getElementById('label' + id).innerHTML});
|
||||
document.getElementById('label' + id).innerHTML = document.getElementById(id).value;
|
||||
document.getElementById('label_' + id).value = document.getElementById(id).value;
|
||||
document.getElementById('label' + id).style.display = '';
|
||||
this.labelEdit = false;
|
||||
YAHOO.util.DragDropMgr.unlock();
|
||||
};
|
||||
|
||||
SUGAR.Studio.prototype.undoLabelEdit = function (transaction){
|
||||
var id = transaction['id'];
|
||||
document.getElementById('span' + id).style.display = 'none';
|
||||
document.getElementById('label' + id).innerHTML = transaction['old'];
|
||||
document.getElementById('label_' + id).value = transaction['old'];
|
||||
};
|
||||
SUGAR.Studio.prototype.redoLabelEdit= function (transaction){
|
||||
var id = transaction['id'];
|
||||
document.getElementById('span' + id).style.display = 'none';
|
||||
document.getElementById('label' + id).innerHTML = transaction['new'];
|
||||
document.getElementById('label_' + id).value = transaction['new'];
|
||||
};
|
||||
|
||||
SUGAR.Studio.prototype.handleLabelClick = function(id, count){
|
||||
if(this.lastLabel != ''){
|
||||
//endLabelEdit(lastLabel);
|
||||
}
|
||||
if(wasDoubleClick(id) || count == 1){
|
||||
document.getElementById('span' + id).style.display = '';
|
||||
document.getElementById(id).focus();
|
||||
document.getElementById(id).select();
|
||||
document.getElementById('label' + id).style.display = 'none';
|
||||
this.lastLabel = id;
|
||||
YAHOO.util.DragDropMgr.lock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
jstransaction.register('studioLabelEdit', SUGAR.Studio.prototype.undoLabelEdit, SUGAR.Studio.prototype.redoLabelEdit);
|
||||
|
||||
|
||||
SUGAR.Studio.prototype.save = function(formName, publish){
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));
|
||||
var formObject = document.forms[formName];
|
||||
YAHOO.util.Connect.setForm(formObject);
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
|
||||
{success: SUGAR.Studio.prototype.saved, failure: SUGAR.Studio.prototype.saved,timeout:5000, argument: publish});
|
||||
}
|
||||
SUGAR.Studio.prototype.saved= function(o){
|
||||
if(o){
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVED'));
|
||||
window.setTimeout('ajaxStatus.hideStatus();', 2000);
|
||||
|
||||
if(o.argument){
|
||||
|
||||
studiojs.publish();
|
||||
}else{
|
||||
document.location.reload();
|
||||
}
|
||||
}else{
|
||||
ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_FAILED_TO_SAVE'));
|
||||
window.setTimeout('ajaxStatus.hideStatus();', 2000);
|
||||
}
|
||||
}
|
||||
|
||||
SUGAR.Studio.prototype.publish = function(){
|
||||
ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_PUBLISHING'));
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('GET','index.php?to_pdf=1&module=Studio&action=Publish',
|
||||
{success: SUGAR.Studio.prototype.published, failure: SUGAR.Studio.prototype.published}, null);
|
||||
}
|
||||
|
||||
SUGAR.Studio.prototype.published= function(o){
|
||||
if(o){
|
||||
ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_PUBLISHED'));
|
||||
window.setTimeout('ajaxStatus.hideStatus();', 2000);
|
||||
document.location.reload();
|
||||
}else{
|
||||
ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_FAILED_PUBLISHED'));
|
||||
window.setTimeout('ajaxStatus.hideStatus();', 2000);
|
||||
}
|
||||
}
|
||||
|
||||
var studiopopup = function() {
|
||||
return {
|
||||
// covers the page w/ white overlay
|
||||
display: function() {
|
||||
if(studiojs.popupVisible)return false;
|
||||
studiojs.popupVisible = true;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('GET','index.php?to_pdf=1&module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=CreateCustomFields&popup=true',
|
||||
{success: studiopopup.render, failure: studiopopup.render}, null);
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
destroy:function(){
|
||||
studiojs.popup.hide();
|
||||
},
|
||||
evalScript:function(text){
|
||||
SUGAR.util.evalScript(text);
|
||||
|
||||
},
|
||||
render: function(obj){
|
||||
if(obj){
|
||||
|
||||
studiojs.popup = new YAHOO.widget.Dialog("dlg", { effect:{effect:YAHOO.widget.ContainerEffect.SLIDE,duration:.5}, fixedcenter: false, constraintoviewport: false, underlay:"shadow",modal:true, close:true, visible:false, draggable:true, monitorresize:true} );
|
||||
|
||||
studiojs.popup.setBody(obj.responseText);
|
||||
studiojs.popupAvailable = true;
|
||||
studiojs.popup.render(document.body);
|
||||
studiojs.popup.center();
|
||||
studiojs.popup.beforeHideEvent.fire = function(e){
|
||||
studiojs.popupVisible = false;
|
||||
}
|
||||
studiopopup.evalScript(obj.responseText);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}();
|
||||
var studiojs = new SUGAR.Studio();
|
||||
studiojs.popupAvailable = false;
|
||||
studiojs.popupVisible = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var popupSave = function(o){
|
||||
var errorIndex = o.responseText.indexOf('[ERROR]');
|
||||
|
||||
if(errorIndex > -1){
|
||||
var error = o.responseText.substr(errorIndex + 7, o.responseText.length);
|
||||
ajaxStatus.showStatus(error);
|
||||
window.setTimeout('ajaxStatus.hideStatus();', 2000);
|
||||
return;
|
||||
}
|
||||
var typeIndex = o.responseText.indexOf('[TYPE]') ;
|
||||
var labelIndex = o.responseText.indexOf('[LABEL]') ;
|
||||
var dataIndex = o.responseText.indexOf('[DATA]');
|
||||
var errorIndex = o.responseText.indexOf('[ERROR]');
|
||||
var name = o.responseText.substr(6, typeIndex - 6);
|
||||
var type = o.responseText.substr(typeIndex + 6,labelIndex - (typeIndex + 6));
|
||||
var label = o.responseText.substr(labelIndex + 7,dataIndex - (labelIndex + 7));
|
||||
var data = o.responseText.substr(dataIndex + 6, o.responseText.length);
|
||||
|
||||
addNewField('dyn_field_' + field_count_MSI, name, label, data, type, 1, 'studio_fields', true)
|
||||
|
||||
|
||||
};
|
||||
function submitCustomFieldForm(isPopup){
|
||||
|
||||
if(typeof(document.popup_form.presave) != 'undefined'){
|
||||
document.popup_form.presave();
|
||||
}
|
||||
|
||||
if(!check_form('popup_form'))return;
|
||||
if(isPopup){
|
||||
|
||||
|
||||
var callback =
|
||||
{
|
||||
success: popupSave ,
|
||||
failure: popupSave ,
|
||||
argument: ''
|
||||
}
|
||||
YAHOO.util.Connect.setForm('popup_form');
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback);
|
||||
studiopopup.destroy();
|
||||
}else{
|
||||
|
||||
document.popup_form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function deleteCustomFieldForm(isPopup){
|
||||
|
||||
|
||||
|
||||
if(confirm("WARNING\nDeleting a custom field will delete all data related to that custom field. \nYou will still need to remove the field from any layouts you have added it to.")){
|
||||
document.popup_form.option.value = 'DeleteCustomField';
|
||||
document.popup_form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function dropdownChanged(value){
|
||||
if(typeof(app_list_strings[value]) == 'undefined')return;
|
||||
var select = document.getElementById('default_value').options;
|
||||
select.length = 0;
|
||||
|
||||
var count = 0;
|
||||
for(var key in app_list_strings[value]){
|
||||
select[count] = new Option(app_list_strings[value][key], key);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
function customFieldChanged(){
|
||||
}
|
||||
|
||||
var populateCustomField = function(response){
|
||||
var div = document.getElementById('customfieldbody');
|
||||
if(response.status = 0){
|
||||
div.innerHTML = 'Server Connection Failed';
|
||||
}else{
|
||||
validate['popup_form'] = new Array();
|
||||
inputsWithErrors = new Array();
|
||||
div.innerHTML = response.responseText;
|
||||
studiopopup.evalScript(response.responseText);
|
||||
if(studiojs.popupAvailable){
|
||||
|
||||
var region = YAHOO.util.Dom.getRegion('custom_field_table') ;
|
||||
studiojs.popup.cfg.setProperty('width', region.right - region.left + 30 + 'px');
|
||||
studiojs.popup.cfg.setProperty('height', region.bottom - region.top + 30 + 'px');
|
||||
|
||||
studiojs.popup.render(document.body);
|
||||
studiojs.popup.center();
|
||||
studiojs.popup.show();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
var populateCustomFieldCallback = {
|
||||
success: populateCustomField ,
|
||||
failure: populateCustomField,
|
||||
argument: 1
|
||||
};
|
||||
var COBJ = false;
|
||||
function changeTypeData(type){
|
||||
document.getElementById('customfieldbody').innerHTML = '<h2>Loading...</h2>';
|
||||
COBJ = YAHOO.util.Connect.asyncRequest('GET','index.php?module=Studio&popup=true&action=index&&ajax=editcustomfield&to_pdf=true&type=' + type,populateCustomFieldCallback,null);
|
||||
|
||||
}
|
||||
|
||||
function typeChanged(obj)
|
||||
{
|
||||
changeTypeData(obj.options[obj.selectedIndex].value);
|
||||
|
||||
}
|
||||
|
||||
function handle_duplicate(){
|
||||
document.popup_form.action.value = 'EditView';
|
||||
document.popup_form.duplicate.value = 'true';
|
||||
document.popup_form.submit();
|
||||
}
|
||||
|
||||
function forceRange(field, min, max){
|
||||
field.value = parseInt(field.value);
|
||||
if(field.value == 'NaN')field.value = max;
|
||||
if(field.value > max) field.value = max;
|
||||
if(field.value < min) field.value = min;
|
||||
}
|
||||
function changeMaxLength(field, length){
|
||||
field.maxLength = parseInt(length);
|
||||
field.value = field.value.substr(0, field.maxLength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
218
jssource/src_files/modules/Studio/studiodd.js
Normal file
218
jssource/src_files/modules/Studio/studiodd.js
Normal file
@@ -0,0 +1,218 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/*Portions Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a ygDDFramed implementation like ygDDMy, but the content channels are
|
||||
* not restricted to one column, and we drag a miniature representation of the
|
||||
* content channel rather than a frame of the channel.
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
|
||||
|
||||
function ygDDSlot(id, sGroup) {
|
||||
|
||||
if (id) {
|
||||
this.init(id, sGroup);
|
||||
this.initFrame();
|
||||
}
|
||||
|
||||
// Change the style of the frame to be a miniature representation of a
|
||||
// content channel
|
||||
var s = this.getDragEl().style;
|
||||
s.borderColor = "transparent";
|
||||
s.backgroundColor = "#f6f5e5";
|
||||
s.opacity = 0.76;
|
||||
s.filter = "alpha(opacity=76)";
|
||||
|
||||
// Specify that we do not want to resize the drag frame... we want to keep
|
||||
// the drag frame the size of our miniature content channel image
|
||||
this.resizeFrame = true;
|
||||
if(id == 's_field_delete'){
|
||||
this.isValidHandle = false;
|
||||
}
|
||||
// Specify that we want the drag frame centered around the cursor rather
|
||||
// than relative to the click location so that the miniature content
|
||||
// channel appears in the location that was clicked
|
||||
//this.centerFrame = true;
|
||||
}
|
||||
|
||||
ygDDSlot.prototype = new YAHOO.util.DDProxy();
|
||||
ygDDSlot.prototype.handleDelete = function(cur, curb){
|
||||
var parentID = (typeof(cur.parentID) == 'undefined')?cur.id.substr(4,cur.id.length):cur.parentID ;
|
||||
if(parentID.indexOf('field') == 0){
|
||||
return false;
|
||||
}
|
||||
var myfieldcount = field_count_MSI;
|
||||
addNewField('dyn_field_' + field_count_MSI, 'delete', ' ', ' ', 'deleted', 0, 'studio_fields')
|
||||
yahooSlots["dyn_field_" + myfieldcount] = new ygDDSlot("dyn_field_" + myfieldcount, "studio");
|
||||
ygDDSlot.prototype.handleSwap(cur, curb, document.getElementById("dyn_field_" + myfieldcount), document.getElementById("dyn_field_" + myfieldcount+ 'b'), true);
|
||||
}
|
||||
|
||||
ygDDSlot.prototype.undo = function(transaction){
|
||||
ygDDSlot.prototype.handleSwap(document.getElementById(transaction['el']),document.getElementById(transaction['elb']), document.getElementById(transaction['cur']), document.getElementById(transaction['curb']), false);
|
||||
}
|
||||
ygDDSlot.prototype.redo = function(transaction){
|
||||
ygDDSlot.prototype.handleSwap(document.getElementById(transaction['el']),document.getElementById(transaction['elb']), document.getElementById(transaction['cur']), document.getElementById(transaction['curb']), false);
|
||||
}
|
||||
|
||||
ygDDSlot.prototype.handleSwap = function(cur, curb,el, elb, record ){
|
||||
if(record){
|
||||
if(curb){
|
||||
jstransaction.record('studioSwap', {'cur': cur.id, 'curb': curb.id, 'el':el.id, 'elb':elb.id});
|
||||
}else{
|
||||
jstransaction.record('studioSwap', {'cur': cur.id, 'curb': null, 'el':el.id, 'elb':null});
|
||||
}
|
||||
}
|
||||
var parentID1 = (typeof(el.parentID) == 'undefined')?el.id.substr(4,el.id.length):el.parentID ;
|
||||
var parentID2 = (typeof(cur.parentID) == 'undefined')?cur.id.substr(4,cur.id.length):cur.parentID ;
|
||||
var slot1 = YAHOO.util.DDM.getElement("slot_" + parentID1);
|
||||
var slot2 = YAHOO.util.DDM.getElement("slot_" + parentID2);
|
||||
|
||||
var temp = slot1.value;
|
||||
slot1.value = slot2.value;
|
||||
slot2.value = temp;
|
||||
|
||||
YAHOO.util.DDM.swapNode(cur, el);
|
||||
if(curb){
|
||||
YAHOO.util.DDM.swapNode(curb, elb);
|
||||
}
|
||||
//swap ids also or else form swaps don't work properly since the actual div is swapped
|
||||
cur.parentID = parentID1;
|
||||
el.parentID = parentID2;
|
||||
if(parentID1.indexOf('field') == 0){
|
||||
if(curb)curb.style.display = 'none';
|
||||
setMouseOverForField(cur, true);
|
||||
}else{
|
||||
if(curb)curb.style.display = 'inline';
|
||||
setMouseOverForField(cur, false);
|
||||
}
|
||||
if(parentID2.indexOf('field') == 0){
|
||||
if(elb)elb.style.display = 'none';
|
||||
setMouseOverForField(el, true);
|
||||
}else{
|
||||
if(elb)elb.style.display = 'inline';
|
||||
setMouseOverForField(el, false);
|
||||
}
|
||||
}
|
||||
ygDDSlot.prototype.onDragDrop = function(e, id) {
|
||||
|
||||
var cur = this.getEl();
|
||||
|
||||
var curb;
|
||||
if ("string" == typeof id) {
|
||||
curb = YAHOO.util.DDM.getElement(cur.id + "b");
|
||||
} else {
|
||||
curb = YAHOO.util.DDM.getBestMatch(cur.id + "b").getEl();
|
||||
}
|
||||
if(id == 's_field_delete'){
|
||||
id = ygDDSlot.prototype.handleDelete(cur, curb);
|
||||
if(!id)return false;
|
||||
}
|
||||
|
||||
|
||||
var el;
|
||||
if ("string" == typeof id) {
|
||||
el = YAHOO.util.DDM.getElement(id);
|
||||
} else {
|
||||
el = YAHOO.util.DDM.getBestMatch(id).getEl();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
id2 = el.id + "b";
|
||||
if ("string" == typeof id) {
|
||||
elb =YAHOO.util.DDM.getElement(id2);
|
||||
} else {
|
||||
elb =YAHOO.util.DDM.getBestMatch(id2).getEl();
|
||||
}
|
||||
|
||||
ygDDSlot.prototype.handleSwap(cur, curb, el, elb, true)
|
||||
var dragEl = this.getDragEl();
|
||||
dragEl.innerHTML = '';
|
||||
};
|
||||
|
||||
ygDDSlot.prototype.startDrag = function(x, y) {
|
||||
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
dragEl.className = clickEl.className;
|
||||
dragEl.style.color = clickEl.style.color;
|
||||
dragEl.style.border = "2px solid #aaa";
|
||||
|
||||
// save the style of the object
|
||||
this.clickContent = clickEl.innerHTML;
|
||||
this.clickBorder = clickEl.style.border;
|
||||
this.clickHeight = clickEl.style.height;
|
||||
clickElRegion = YAHOO.util.Dom.getRegion(clickEl);
|
||||
dragEl.style.height = clickEl.style.height;
|
||||
|
||||
dragEl.style.width = (clickElRegion.right - clickElRegion.left) + 'px';
|
||||
clickEl.style.height = (clickElRegion.bottom - clickElRegion.top) + 'px';
|
||||
|
||||
//clickEl.innerHTML = ' ';
|
||||
clickEl.style.border = '2px dashed #cccccc';
|
||||
clickEl.style.opacity = .5;
|
||||
clickEl.style.filter = "alpha(opacity=10)";
|
||||
|
||||
};
|
||||
|
||||
ygDDSlot.prototype.endDrag = function(e) {
|
||||
// disable moving the linked element
|
||||
var clickEl = this.getEl();
|
||||
//clickEl.innerHTML = this.clickContent
|
||||
|
||||
if(this.clickHeight)
|
||||
clickEl.style.height = this.clickHeight;
|
||||
else
|
||||
clickEl.style.height = '';
|
||||
|
||||
if(this.clickBorder)
|
||||
clickEl.style.border = this.clickBorder;
|
||||
else
|
||||
clickEl.style.border = '';
|
||||
clickEl.style.opacity = 1;
|
||||
clickEl.style.filter = "alpha(opacity=100)";
|
||||
|
||||
};
|
||||
jstransaction.register('studioSwap',ygDDSlot.prototype.undo, ygDDSlot.prototype.redo);
|
||||
141
jssource/src_files/modules/Studio/studiotabgroups.js
Normal file
141
jssource/src_files/modules/Studio/studiotabgroups.js
Normal file
@@ -0,0 +1,141 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
var subtabCount = [];
|
||||
var subtabModules = [];
|
||||
var tabLabelToValue = [];
|
||||
StudioTabGroup = function(){
|
||||
this.lastEditTabGroupLabel = -1;
|
||||
};
|
||||
|
||||
|
||||
StudioTabGroup.prototype.editTabGroupLabel = function (id, done){
|
||||
if(!done){
|
||||
if(this.lastEditTabGroupLabel != -1)StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel, true);
|
||||
document.getElementById('tabname_'+id).style.display = 'none';
|
||||
document.getElementById('tablabel_'+id).style.display = '';
|
||||
document.getElementById('tabother_'+id).style.display = 'none';
|
||||
//#28274, I think this is a simple way when a element can't accept focus()
|
||||
try{
|
||||
document.getElementById('tablabel_'+id).focus();
|
||||
}
|
||||
catch(er){
|
||||
//TODO
|
||||
}
|
||||
this.lastEditTabGroupLabel = id;
|
||||
YAHOO.util.DragDropMgr.lock();
|
||||
}else{
|
||||
this.lastEditTabGroupLabel = -1;
|
||||
document.getElementById('tabname_'+id).innerHTML =document.getElementById('tablabel_'+id).value;
|
||||
document.getElementById('tabname_'+id).style.display = '';
|
||||
document.getElementById('tablabel_'+id).style.display = 'none';
|
||||
document.getElementById('tabother_'+id).style.display = '';
|
||||
YAHOO.util.DragDropMgr.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
StudioTabGroup.prototype.generateForm = function(formname){
|
||||
var form = document.getElementById(formname);
|
||||
for(var j = 0; j < slotCount; j++){
|
||||
var ul = document.getElementById('ul' + j);
|
||||
var items = ul.getElementsByTagName('li');
|
||||
for(var i = 0; i < items.length; i++) {
|
||||
if(typeof(subtabModules[items[i].id]) != 'undefined'){
|
||||
|
||||
var input = document.createElement('input');
|
||||
input.type='hidden';
|
||||
input.name= j + '_'+ i;
|
||||
input.value = tabLabelToValue[subtabModules[items[i].id]];
|
||||
form.appendChild(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
//set the slotcount in the form.
|
||||
form.slot_count.value = slotCount;
|
||||
};
|
||||
|
||||
StudioTabGroup.prototype.generateGroupForm = function(formname){
|
||||
var form = document.getElementById(formname);
|
||||
for(j = 0; j < slotCount; j++){
|
||||
var ul = document.getElementById('ul' + j);
|
||||
items = ul.getElementsByTagName('li');
|
||||
for(i = 0; i < items.length; i++) {
|
||||
if(typeof(subtabModules[items[i].id]) != 'undefined'){
|
||||
var input = document.createElement('input');
|
||||
input.type='hidden'
|
||||
input.name= 'group_'+ j + '[]';
|
||||
input.value = tabLabelToValue[subtabModules[items[i].id]];
|
||||
form.appendChild(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
StudioTabGroup.prototype.deleteTabGroup = function(id){
|
||||
if(document.getElementById('delete_' + id).value == 0){
|
||||
document.getElementById('ul' + id).style.display = 'none';
|
||||
document.getElementById('tabname_'+id).style.textDecoration = 'line-through'
|
||||
document.getElementById('delete_' + id).value = 1;
|
||||
}else{
|
||||
document.getElementById('ul' + id).style.display = '';
|
||||
document.getElementById('tabname_'+id).style.textDecoration = 'none'
|
||||
document.getElementById('delete_' + id).value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var lastField = '';
|
||||
var lastRowCount = -1;
|
||||
var undoDeleteDropDown = function(transaction){
|
||||
deleteDropDownValue(transaction['row'], document.getElementById(transaction['id']), false);
|
||||
}
|
||||
jstransaction.register('deleteDropDown', undoDeleteDropDown, undoDeleteDropDown);
|
||||
function deleteDropDownValue(rowCount, field, record){
|
||||
if(record){
|
||||
jstransaction.record('deleteDropDown',{'row':rowCount, 'id': field.id });
|
||||
}
|
||||
//We are deleting if the value is 0
|
||||
if(field.value == '0'){
|
||||
field.value = '1';
|
||||
document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'line-through';
|
||||
}else{
|
||||
field.value = '0';
|
||||
document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'none';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var studiotabs = new StudioTabGroup();
|
||||
239
jssource/src_files/modules/Studio/ygDDListStudio.js
Normal file
239
jssource/src_files/modules/Studio/ygDDListStudio.js
Normal file
@@ -0,0 +1,239 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a YAHOO.util.DDProxy implementation. During the drag over event, the
|
||||
* dragged element is inserted before the dragged-over element.
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
var addListStudioCount = 0;
|
||||
var moduleTabs = [];
|
||||
|
||||
|
||||
function ygDDListStudio(id, sGroup, fromOnly) {
|
||||
|
||||
if (id) {
|
||||
|
||||
if(id == 'trashcan' || id.indexOf('noselect') ==0){
|
||||
this.initTarget(id, sGroup);
|
||||
}else{
|
||||
this.init(id, sGroup);
|
||||
}
|
||||
this.initFrame();
|
||||
this.fromOnly = fromOnly;
|
||||
}
|
||||
|
||||
var s = this.getDragEl().style;
|
||||
s.borderColor = "transparent";
|
||||
s.backgroundColor = "#f6f5e5";
|
||||
s.opacity = 0.76;
|
||||
s.filter = "alpha(opacity=76)";
|
||||
}
|
||||
|
||||
|
||||
ygDDListStudio.prototype = new YAHOO.util.DDProxy();
|
||||
ygDDListStudio.prototype.clickContent = '';
|
||||
ygDDListStudio.prototype.clickBorder = '';
|
||||
ygDDListStudio.prototype.clickHeight = '';
|
||||
ygDDListStudio.prototype.lastNode = false;
|
||||
ygDDListStudio.prototype.startDrag
|
||||
ygDDListStudio.prototype.startDrag = function(x, y) {
|
||||
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
|
||||
this.parentID = clickEl.parentNode.id;
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
dragElObjects = dragEl.getElementsByTagName('object');
|
||||
|
||||
dragEl.className = clickEl.className;
|
||||
dragEl.style.color = clickEl.style.color;
|
||||
dragEl.style.border = "1px solid #aaa";
|
||||
|
||||
// save the style of the object
|
||||
this.clickContent = clickEl.innerHTML;
|
||||
this.clickBorder = clickEl.style.border;
|
||||
this.clickHeight = clickEl.style.height;
|
||||
|
||||
clickElRegion = YAHOO.util.Dom.getRegion(clickEl);
|
||||
clickEl.style.height = (clickElRegion.bottom - clickElRegion.top) + 'px';
|
||||
clickEl.style.opacity = .5;
|
||||
clickEl.style.filter = "alpha(opacity=10)";
|
||||
clickEl.style.border = '2px dashed #cccccc';
|
||||
};
|
||||
ygDDListStudio.prototype.updateTabs = function(){
|
||||
moduleTabs = [];
|
||||
for(j = 0; j < slotCount; j++){
|
||||
|
||||
var ul = document.getElementById('ul' + j);
|
||||
moduleTabs[j] = [];
|
||||
items = ul.getElementsByTagName("li");
|
||||
for(i = 0; i < items.length; i++) {
|
||||
if(items.length == 1){
|
||||
items[i].innerHTML = SUGAR.language.get('app_strings', 'LBL_DROP_HERE');
|
||||
|
||||
}else{
|
||||
if(items[i].innerHTML == SUGAR.language.get('app_strings', 'LBL_DROP_HERE')){
|
||||
items[i].innerHTML='';
|
||||
}
|
||||
}
|
||||
|
||||
moduleTabs[ul.id.substr(2, ul.id.length)][subtabModules[items[i].id]] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
ygDDListStudio.prototype.endDrag = function(e) {
|
||||
|
||||
var clickEl = this.getEl();
|
||||
clickEl.innerHTML = this.clickContent
|
||||
var p = clickEl.parentNode;
|
||||
if(p.id == 'trash'){
|
||||
p.removeChild(clickEl);
|
||||
this.lastNode = false;
|
||||
this.updateTabs();
|
||||
return;
|
||||
}
|
||||
if(this.clickHeight) {
|
||||
clickEl.style.height = this.clickHeight;
|
||||
if(this.lastNode)this.lastNode.style.height=this.clickHeight;
|
||||
}
|
||||
else{
|
||||
clickEl.style.height = '';
|
||||
if(this.lastNode)this.lastNode.style.height='';
|
||||
}
|
||||
|
||||
if(this.clickBorder){
|
||||
clickEl.style.border = this.clickBorder;
|
||||
if(this.lastNode)this.lastNode.style.border=this.clickBorder;
|
||||
}
|
||||
else {
|
||||
clickEl.style.border = '';
|
||||
if(this.lastNode)this.lastNode.style.border='';
|
||||
}
|
||||
clickEl.style.opacity = 1;
|
||||
clickEl.style.filter = "alpha(opacity=100)";
|
||||
if(this.lastNode){
|
||||
this.lastNode.id = 'addLS' + addListStudioCount;
|
||||
subtabModules[this.lastNode.id] = this.lastNode.module;
|
||||
yahooSlots[this.lastNode.id] = new ygDDListStudio(this.lastNode.id, 'subTabs', false);
|
||||
addListStudioCount++;
|
||||
this.lastNode.style.opacity = 1;
|
||||
this.lastNode.style.filter = "alpha(opacity=100)";
|
||||
}
|
||||
this.lastNode = false;
|
||||
this.updateTabs();
|
||||
};
|
||||
|
||||
ygDDListStudio.prototype.onDrag = function(e, id) {
|
||||
|
||||
};
|
||||
|
||||
ygDDListStudio.prototype.onDragOver = function(e, id) {
|
||||
// this.logger.debug(this.id.toString() + " onDragOver " + id);
|
||||
var el;
|
||||
if(this.lastNode){
|
||||
this.lastNode.parentNode.removeChild(this.lastNode);
|
||||
this.lastNode = false;
|
||||
}
|
||||
if(id.substr(0, 7) == 'modSlot'){
|
||||
return;
|
||||
}
|
||||
if ("string" == typeof id) {
|
||||
el = YAHOO.util.DDM.getElement(id);
|
||||
} else {
|
||||
el = YAHOO.util.DDM.getBestMatch(id).getEl();
|
||||
}
|
||||
|
||||
dragEl = this.getDragEl();
|
||||
elRegion = YAHOO.util.Dom.getRegion(el);
|
||||
|
||||
|
||||
var mid = YAHOO.util.DDM.getPosY(el) + (Math.floor((elRegion.bottom - elRegion.top) / 2));
|
||||
var el2 = this.getEl();
|
||||
var p = el.parentNode;
|
||||
if( (this.fromOnly || ( el.id != 'trashcan' && el2.parentNode.id != p.id && el2.parentNode.id == this.parentID)) ){
|
||||
if(typeof(moduleTabs[p.id.substr(2,p.id.length)][subtabModules[el2.id]]) != 'undefined')return;
|
||||
|
||||
}
|
||||
|
||||
if(this.fromOnly && el.id != 'trashcan'){
|
||||
el2 = el2.cloneNode(true);
|
||||
el2.module = subtabModules[el2.id];
|
||||
el2.id = 'addListStudio' + addListStudioCount;
|
||||
this.lastNode = el2;
|
||||
this.lastNode.clickContent = el2.clickContent;
|
||||
this.lastNode.clickBorder = el2.clickBorder;
|
||||
this.lastNode.clickHeight = el2.clickHeight
|
||||
|
||||
|
||||
}
|
||||
if (YAHOO.util.DDM.getPosY(dragEl) < mid ) { // insert on top triggering item
|
||||
p.insertBefore(el2, el);
|
||||
}
|
||||
if (YAHOO.util.DDM.getPosY(dragEl) >= mid ) { // insert below triggered item
|
||||
p.insertBefore(el2, el.nextSibling);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
ygDDListStudio.prototype.onDragEnter = function(e, id) {
|
||||
|
||||
};
|
||||
|
||||
ygDDListStudio.prototype.onDragOut = function(e, id) {
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ygDDListStudioBoundary(id, sGroup) {
|
||||
if (id) {
|
||||
this.init(id, sGroup);
|
||||
this.isBoundary = true;
|
||||
}
|
||||
}
|
||||
|
||||
ygDDListStudioBoundary.prototype = new YAHOO.util.DDTarget();
|
||||
136
jssource/src_files/modules/UpgradeWizard/upgradeWizard.js
Normal file
136
jssource/src_files/modules/UpgradeWizard/upgradeWizard.js
Normal file
@@ -0,0 +1,136 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
var req;
|
||||
var uw_check_msg = "";
|
||||
//var uw_check_type = '';
|
||||
var find_done = false;
|
||||
|
||||
function loadXMLDoc(url) {
|
||||
req = false;
|
||||
// branch for native XMLHttpRequest object
|
||||
if(window.XMLHttpRequest) {
|
||||
try {
|
||||
req = new XMLHttpRequest();
|
||||
} catch(e) {
|
||||
req = false;
|
||||
}
|
||||
// branch for IE/Windows ActiveX version
|
||||
} else if(window.ActiveXObject) {
|
||||
try {
|
||||
req = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch(e) {
|
||||
try {
|
||||
req = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch(e) {
|
||||
req = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(req) {
|
||||
req.onreadystatechange = processReqChange;
|
||||
req.open("GET", url, true);
|
||||
req.send("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///// preflight scripts
|
||||
function preflightToggleAll(cb) {
|
||||
var checkAll = false;
|
||||
var form = document.getElementById('diffs');
|
||||
|
||||
if(cb.checked == true) {
|
||||
checkAll = true;
|
||||
}
|
||||
|
||||
for(i=0; i<form.elements.length; i++) {
|
||||
if(form.elements[i].type == 'checkbox') {
|
||||
form.elements[i].checked = checkAll;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function checkSqlStatus(done) {
|
||||
var schemaSelect = document.getElementById('select_schema_change');
|
||||
var hideShow = document.getElementById('show_sql_run');
|
||||
var hideShowCB = document.getElementById('sql_run');
|
||||
var nextButton = document.getElementById('next_button');
|
||||
var schemaMethod = document.getElementById('schema');
|
||||
document.getElementById('sql_run').checked = false;
|
||||
|
||||
if(schemaSelect.options[schemaSelect.selectedIndex].value == 'manual' && done == false) {
|
||||
hideShow.style.display = 'block';
|
||||
nextButton.style.display = 'none';
|
||||
hideShowCB.disabled = false;
|
||||
schemaMethod.value = 'manual';
|
||||
} else {
|
||||
if(done == true) {
|
||||
hideShowCB.checked = true;
|
||||
hideShowCB.disabled = true;
|
||||
} else {
|
||||
hideShow.style.display = 'none';
|
||||
}
|
||||
nextButton.style.display = 'inline';
|
||||
schemaMethod.value = 'sugar';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleDisplay(targ) {
|
||||
target = document.getElementById("targ");
|
||||
if(target.style.display == 'none') {
|
||||
target.style.display = '';
|
||||
} else {
|
||||
target.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
function verifyMerge(cb) {
|
||||
if(cb.value == 'sugar') {
|
||||
var challenge = "{$mod_strings['LBL_UW_OVERWRITE_DESC']}";
|
||||
var answer = confirm(challenge);
|
||||
|
||||
if(!answer) {
|
||||
cb.options[0].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
132
jssource/src_files/modules/Users/DetailView.js
Normal file
132
jssource/src_files/modules/Users/DetailView.js
Normal file
@@ -0,0 +1,132 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
var appel;
|
||||
function generatepwd(id)
|
||||
{
|
||||
callback = {
|
||||
success: function(o)
|
||||
{
|
||||
checkok=o.responseText;
|
||||
if (checkok.charAt(0) != '1')
|
||||
YAHOO.SUGAR.MessageBox.show({title: SUGAR.language.get("Users", "LBL_CANNOT_SEND_PASSWORD"), msg: checkok});
|
||||
else
|
||||
YAHOO.SUGAR.MessageBox.show({title: SUGAR.language.get("Users", "LBL_PASSWORD_SENT"), msg: SUGAR.language.get("Users", "LBL_NEW_USER_PASSWORD_2")} );
|
||||
},
|
||||
failure: function(o)
|
||||
{
|
||||
YAHOO.SUGAR.MessageBox.show({title: SUGAR.language.get("Users", "LBL_CANNOT_SEND_PASSWORD"), msg: SUGAR.language.get("app_strings", "LBL_AJAX_FAILURE")});
|
||||
}
|
||||
}
|
||||
PostData = '&to_pdf=1&module=Users&action=GeneratePassword&userId='+id;
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, PostData);
|
||||
}
|
||||
|
||||
function set_return_user_and_save(popup_reply_data)
|
||||
{
|
||||
var form_name = popup_reply_data.form_name;
|
||||
var name_to_value_array;
|
||||
if(popup_reply_data.selection_list)
|
||||
{
|
||||
name_to_value_array = popup_reply_data.selection_list;
|
||||
}else if(popup_reply_data.teams){
|
||||
name_to_value_array = new Array();
|
||||
for (var the_key in popup_reply_data.teams){
|
||||
name_to_value_array.push(popup_reply_data.teams[the_key].team_id);
|
||||
}
|
||||
}else
|
||||
{
|
||||
name_to_value_array = popup_reply_data.name_to_value_array;
|
||||
}
|
||||
|
||||
var query_array = new Array();
|
||||
for (var the_key in name_to_value_array)
|
||||
{
|
||||
if(the_key == 'toJSON')
|
||||
{
|
||||
/* just ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
query_array.push("record[]="+name_to_value_array[the_key]);
|
||||
}
|
||||
}
|
||||
query_array.push('user_id='+get_user_id(form_name));
|
||||
query_array.push('action=AddUserToTeam');
|
||||
query_array.push('module=Teams');
|
||||
var query_string = query_array.join('&');
|
||||
|
||||
var returnstuff = http_fetch_sync('index.php',query_string);
|
||||
|
||||
document.location.reload(true);
|
||||
}
|
||||
|
||||
function get_user_id(form_name)
|
||||
{
|
||||
return window.document.forms[form_name].elements['user_id'].value;
|
||||
}
|
||||
|
||||
function user_status_display(field){
|
||||
switch (field){
|
||||
|
||||
case 'RegularUser':
|
||||
document.getElementById("calendar_options").style.display="";
|
||||
document.getElementById("edit_tabs").style.display="";
|
||||
document.getElementById("locale").style.display="";
|
||||
document.getElementById("settings").style.display="";
|
||||
document.getElementById("information").style.display="";
|
||||
break;
|
||||
|
||||
case 'GroupUser':
|
||||
document.getElementById("calendar_options").style.display="none";
|
||||
document.getElementById("edit_tabs").style.display="none";
|
||||
document.getElementById("locale").style.display="none";
|
||||
document.getElementById("settings").style.display="none";
|
||||
document.getElementById("information").style.display="none";
|
||||
document.getElementById("email_options_link_type").style.display="none";
|
||||
break;
|
||||
|
||||
case 'PortalUser':
|
||||
document.getElementById("calendar_options").style.display="none";
|
||||
document.getElementById("edit_tabs").style.display="none";
|
||||
document.getElementById("locale").style.display="none";
|
||||
document.getElementById("settings").style.display="none";
|
||||
document.getElementById("information").style.display="none";
|
||||
document.getElementById("email_options_link_type").style.display="none";
|
||||
break;
|
||||
}
|
||||
}
|
||||
187
jssource/src_files/modules/Users/PasswordRequirementBox.js
Normal file
187
jssource/src_files/modules/Users/PasswordRequirementBox.js
Normal file
@@ -0,0 +1,187 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function password_confirmation() {
|
||||
var new_pwd=document.getElementById('new_password').value;
|
||||
var old_pwd=document.getElementById('old_password').value;
|
||||
var confirm_pwd=document.getElementById('confirm_pwd');
|
||||
if (confirm_pwd.value != new_pwd)
|
||||
confirm_pwd.style.borderColor= 'red';
|
||||
else
|
||||
confirm_pwd.style.borderColor='';
|
||||
|
||||
if (confirm_pwd.value != (new_pwd.substring(0,confirm_pwd.value.length)))
|
||||
document.getElementById('comfirm_pwd_match').style.display = 'inline';
|
||||
else
|
||||
document.getElementById('comfirm_pwd_match').style.display = 'none';
|
||||
|
||||
if (new_pwd != "" || confirm_pwd.value != "" || old_pwd !="" || (document.getElementById('page') && document.getElementById('page').value=="Change"))
|
||||
document.getElementById('password_change').value = 'true';
|
||||
else
|
||||
document.getElementById('password_change').value = 'false';
|
||||
}
|
||||
|
||||
function set_password(form,rules) {
|
||||
if(form.password_change.value == 'true'){
|
||||
if( rules=='1'){
|
||||
alert(ERR_RULES_NOT_MET);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (form.is_admin.value != 1 && (form.is_current_admin && form.is_current_admin.value != '1')&& form.old_password.value == "" ){
|
||||
alert(ERR_ENTER_OLD_PASSWORD);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (form.new_password.value == "" ) {
|
||||
alert(ERR_ENTER_NEW_PASSWORD);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (form.confirm_pwd.value == ""){
|
||||
alert(ERR_ENTER_CONFIRMATION_PASSWORD);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (form.new_password.value == form.confirm_pwd.value)
|
||||
return true;
|
||||
else{
|
||||
alert(ERR_REENTER_PASSWORDS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
function newrules(minpwdlength,maxpwdlength,customregex){
|
||||
var good_rules=0;
|
||||
var passwd = document.getElementById('new_password').value;
|
||||
// length
|
||||
if(document.getElementById('lengths')){
|
||||
var length =document.getElementById('new_password').value.length;
|
||||
if((length < parseInt(minpwdlength) && parseInt(minpwdlength)>0) || (length > parseInt(maxpwdlength) && parseInt(maxpwdlength)>0 )){
|
||||
document.getElementById('lengths').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('lengths').className='good';}
|
||||
}
|
||||
|
||||
// One lower case
|
||||
if(document.getElementById('1lowcase')){
|
||||
if(!passwd.match('[abcdefghijklmnopqrstuvwxyz]')){
|
||||
document.getElementById('1lowcase').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('1lowcase').className='good';}
|
||||
}
|
||||
|
||||
// One upper case
|
||||
if(document.getElementById('1upcase')){
|
||||
if(!passwd.match('[ABCDEFGHIJKLMNOPQRSTUVWXYZ]')){
|
||||
document.getElementById('1upcase').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('1upcase').className='good';}
|
||||
}
|
||||
|
||||
// One number
|
||||
if(document.getElementById('1number')){
|
||||
if(!passwd.match('[0123456789]')){
|
||||
document.getElementById('1number').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('1number').className='good';}
|
||||
}
|
||||
|
||||
// One special character
|
||||
if(document.getElementById('1special')){
|
||||
var custom_regex= new RegExp('[|}{~!@#$%^&*()_+=-]');
|
||||
if(!custom_regex.test(passwd)){
|
||||
document.getElementById('1special').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('1special').className='good';}
|
||||
}
|
||||
|
||||
|
||||
// Custom regex
|
||||
if(document.getElementById('regex')){
|
||||
var regex = new RegExp(customregex);
|
||||
if(regex.test(passwd)){
|
||||
document.getElementById('regex').className='bad';
|
||||
good_rules=1;
|
||||
}
|
||||
else{document.getElementById('regex').className='good';}
|
||||
}
|
||||
return good_rules;
|
||||
}
|
||||
|
||||
|
||||
function set_focus() {
|
||||
if (document.getElementById('error_pwd')){
|
||||
if (document.forms.length > 0) {
|
||||
for (i = 0; i < document.forms.length; i++) {
|
||||
for (j = 0; j < document.forms[i].elements.length; j++) {
|
||||
var field = document.forms[i].elements[j];
|
||||
if ((field.type == "password") && (field.name == "old_password" )) {
|
||||
field.focus();
|
||||
if (field.type == "text") {
|
||||
field.select();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (document.forms.length > 0) {
|
||||
for (i = 0; i < document.forms.length; i++) {
|
||||
for (j = 0; j < document.forms[i].elements.length; j++) {
|
||||
var field = document.forms[i].elements[j];
|
||||
if ((field.type == "text" || field.type == "textarea" || field.type == "password") &&
|
||||
!field.disabled && (field.name == "first_name" || field.name == "name" || field.name == "user_name" || field.name=="document_name")) {
|
||||
field.focus();
|
||||
if (field.type == "text") {
|
||||
field.select();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
215
jssource/src_files/modules/Users/User.js
Normal file
215
jssource/src_files/modules/Users/User.js
Normal file
@@ -0,0 +1,215 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
function clearInboundSettings() {
|
||||
var url = document.getElementById('server_url');
|
||||
var user = document.getElementById('email_user');
|
||||
var prot = document.getElementById('protocol');
|
||||
var pass = document.getElementById('email_password');
|
||||
var port = document.getElementById('port');
|
||||
var inbox = document.getElementById('mailbox');
|
||||
|
||||
url.value = '';
|
||||
user.value ='';
|
||||
pass.value = '';
|
||||
port.value = '';
|
||||
inbox.value = '';
|
||||
|
||||
for(i=0; i<prot.options.length; i++) {
|
||||
if(prot.options[i].value == '') {
|
||||
prot.options[i].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkInboundEmailSettings() {
|
||||
var url = document.getElementById('server_url');
|
||||
var user = document.getElementById('email_user');
|
||||
var prot = document.getElementById('protocol');
|
||||
var pass = document.getElementById('email_password');
|
||||
var port = document.getElementById('port');
|
||||
var inbox = document.getElementById('mailbox');
|
||||
var doCheck = false;
|
||||
var IEAlert = SUGAR.language.get('Users', 'ERR_IE_MISSING_REQUIRED');
|
||||
|
||||
if(url.value != '') {
|
||||
doCheck = true;
|
||||
} else if(user.value != '') {
|
||||
doCheck = true;
|
||||
} else if(prot.value != '') {
|
||||
doCheck = true;
|
||||
} else if(pass.value != '') {
|
||||
doCheck = true;
|
||||
} else if(port.value != '') {
|
||||
doCheck = true;
|
||||
}
|
||||
/* else if(inbox.value != '') {
|
||||
doCheck = true;
|
||||
}*/
|
||||
|
||||
if(doCheck == true) {
|
||||
if(url.value == '' || url.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
} else if(user.value == '' || user.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
} else if(prot.value == '' || prot.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
} else if(pass.value == '' || pass.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
} else if(port.value == '' || port.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
} else if(inbox.value == '' || inbox.value == 'undefined') {
|
||||
alert(IEAlert);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function show_main() {
|
||||
var basic = document.getElementById('basic'); basic.style.display = "";
|
||||
var settings = document.getElementById('settings'); settings.style.display = "";
|
||||
var info = document.getElementById('information'); info.style.display = "";
|
||||
var address = document.getElementById('address'); address.style.display = "";
|
||||
var calendar_options = document.getElementById('calendar_options'); calendar_options.style.display = "";
|
||||
var edit_tabs = document.getElementById('edit_tabs'); edit_tabs.style.display = "";
|
||||
|
||||
var email_options = document.getElementById('email_options'); email_options.style.display = 'none';
|
||||
var email_inbound = document.getElementById('email_inbound'); email_inbound.style.display = 'none';
|
||||
}
|
||||
|
||||
function show_email() {
|
||||
var basic = document.getElementById('basic'); basic.style.display = "none";
|
||||
var settings = document.getElementById('settings'); settings.style.display = "none";
|
||||
var info = document.getElementById('information'); info.style.display = "none";
|
||||
var address = document.getElementById('address'); address.style.display = "none";
|
||||
var calendar_options = document.getElementById('calendar_options'); calendar_options.style.display = "none";
|
||||
var edit_tabs = document.getElementById('edit_tabs'); edit_tabs.style.display = "none";
|
||||
|
||||
var email_options = document.getElementById('email_options'); email_options.style.display = "";
|
||||
var email_inbound = document.getElementById('email_inbound'); email_inbound.style.display = "";
|
||||
}
|
||||
|
||||
|
||||
function enable_change_password_button() {
|
||||
var butt = document.getElementById('change_password_button');
|
||||
if(document.EditView.record.value != "" && document.EditView.record.value != 'undefined') {
|
||||
butt.style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleAdv() {
|
||||
var adv = document.getElementById("ie_adv");
|
||||
if(adv.style.display == 'none') {
|
||||
adv.style.display = "";
|
||||
} else {
|
||||
adv.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function refresh_signature_list(signature_id, signature_name) {
|
||||
var field=document.getElementById('signature_id');
|
||||
var bfound=0;
|
||||
for (var i=0; i < field.options.length; i++) {
|
||||
if (field.options[i].value == signature_id) {
|
||||
if (field.options[i].selected==false) {
|
||||
field.options[i].selected=true;
|
||||
}
|
||||
bfound=1;
|
||||
}
|
||||
}
|
||||
//add item to selection list.
|
||||
if (bfound == 0) {
|
||||
var newElement=document.createElement('option');
|
||||
newElement.text=signature_name;
|
||||
newElement.value=signature_id;
|
||||
field.options.add(newElement);
|
||||
newElement.selected=true;
|
||||
}
|
||||
|
||||
//enable the edit button.
|
||||
var field1=document.getElementById('edit_sig');
|
||||
field1.style.visibility="visible";
|
||||
}
|
||||
|
||||
function setSigEditButtonVisibility() {
|
||||
var field = document.getElementById('signature_id');
|
||||
var editButt = document.getElementById('edit_sig');
|
||||
if(field.value != '') {
|
||||
editButt.style.visibility = "visible";
|
||||
} else {
|
||||
editButt.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
function open_email_signature_form(record, the_user_id) {
|
||||
URL="index.php?module=Users&action=Popup";
|
||||
if(record != "") {
|
||||
URL += "&record="+record;
|
||||
}
|
||||
if(the_user_id != "") {
|
||||
URL += "&the_user_id="+the_user_id;
|
||||
}
|
||||
windowName = 'email_signature';
|
||||
windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1';
|
||||
|
||||
win = window.open(URL, windowName, windowFeatures);
|
||||
if(window.focus) {
|
||||
// put the focus on the popup if the browser supports the focus() method
|
||||
win.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function setDefaultSigId(id) {
|
||||
var checkbox = document.getElementById("signature_default");
|
||||
var default_sig = document.getElementById("signatureDefault");
|
||||
|
||||
if(checkbox.checked) {
|
||||
default_sig.value = id;
|
||||
} else {
|
||||
default_sig.value = "";
|
||||
}
|
||||
}
|
||||
87
jssource/src_files/modules/Users/login.js
Normal file
87
jssource/src_files/modules/Users/login.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
function set_focus() {
|
||||
if (document.DetailView.user_name.value != '') {
|
||||
document.DetailView.user_password.focus();
|
||||
document.DetailView.user_password.select();
|
||||
}
|
||||
else document.DetailView.user_name.focus();
|
||||
}
|
||||
|
||||
function toggleDisplay(id){
|
||||
|
||||
if(this.document.getElementById(id).style.display=='none'){
|
||||
this.document.getElementById(id).style.display='inline'
|
||||
if(this.document.getElementById(id+"link") != undefined){
|
||||
this.document.getElementById(id+"link").style.display='none';
|
||||
}
|
||||
document.getElementById(id+"_options").src = 'index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=basic_search.gif';
|
||||
}else{
|
||||
this.document.getElementById(id).style.display='none'
|
||||
if(this.document.getElementById(id+"link") != undefined){
|
||||
this.document.getElementById(id+"link").style.display='inline';
|
||||
}
|
||||
document.getElementById(id+"_options").src = 'index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=advanced_search.gif';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function generatepwd(){
|
||||
document.getElementById('generate_pwd_button').value='Please Wait';
|
||||
document.getElementById('generate_pwd_button').disabled =1;
|
||||
document.getElementById('wait_pwd_generation').innerHTML = '<img src="themes/default/images/img_loading.gif" >';
|
||||
var callback;
|
||||
callback = {
|
||||
success: function(o){
|
||||
document.getElementById('generate_pwd_button').value=LBL_LOGIN_SUBMIT;
|
||||
document.getElementById('generate_pwd_button').disabled =0;
|
||||
document.getElementById('wait_pwd_generation').innerHTML = '';
|
||||
checkok=o.responseText;
|
||||
if (checkok.charAt(0) != '1')
|
||||
document.getElementById('generate_success').innerHTML =checkok;
|
||||
if (checkok.charAt((checkok.length)-1) == '1')
|
||||
document.getElementById('generate_success').innerHTML =LBL_REQUEST_SUBMIT;
|
||||
},
|
||||
failure: function(o){
|
||||
document.getElementById('generate_pwd_button').value= LBL_LOGIN_SUBMIT;
|
||||
document.getElementById('generate_pwd_button').disabled =0;
|
||||
document.getElementById('wait_pwd_generation').innerHTML = '';
|
||||
alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
|
||||
}
|
||||
}
|
||||
postData = '&to_pdf=1&module=Home&action=index&entryPoint=GeneratePassword&username='+document.getElementById("fp_user_name").value+'&user_email='+document.getElementById("fp_user_mail").value+'&link=1';
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
|
||||
}
|
||||
Reference in New Issue
Block a user