📄 packagemanagerscripts.tpl
字号:
{*
/**
* SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU 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 General Public License for more * details. * * You should have received a copy of the GNU 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 General Public License version 3. * * In accordance with Section 7(b) of the GNU 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". */
*}
{literal}
<script type="text/javascript" src="include/javascript/yui/container.js?s={$sugar_version}&c={$js_custom_version}"></script>
<script type='text/javascript' src='include/javascript/sugar_grp_yui_ext.js'></script>
<script type="text/javascript" src="include/javascript/yui/tabview.js"></script>
<script>
/*
* a reference to an instance of PackageManagerGrid
*/
var _pmg;
if(typeof PackageManager == 'undefined') {
PackageManager = function() {
var MAX_HEIGHT = 300;
var MIN_HEIGHT = 0;
var _treeHeight;
var _listHeight;
var _attributes = {
height: { to: MAX_HEIGHT }
};
var _anim;
var keys = [ "local_upload","server_upload"];
var tabPreviousKey = '';
/*
* Maintain an array to hold which packages we would like to download
*/
var _packages;
/*
* Keep track of the current number of packages that have successfully
* downloaded
*/
var _numDownloadsComplete = 0;
/*
* The number of downloads we have to retrieve
*/
var _numPackagesToDownload = 0;
var _loginPanel;
var _tabs;
var _loadingBar;
return {
search: function() {
PackageManager.showWaiting();
var searchTerm = document.getElementById('search_term').value;
postData = 'entryPoint=HandleAjaxCall&to_pdf=1&module=Administration&action=HandleAjaxCall&method=performBasicSearch&search_term=' + searchTerm;
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
{success: PackageManager.completeSearch, failure: PackageManager.completeSearch}, postData);
},
initWorkingDiv : function(){
statusDiv = document.getElementById('workingStatusDiv');
statusDiv.className = 'dataLabel';
statusDiv.style.position = 'absolute';
var fileview = document.getElementById('treeview');
var top = fileview.offsetTop;
var height = fileview.offsetHeight;
var left = fileview.offsetLeft;
var width = fileview.offsetWidth;
statusDiv.style.top = (top+(height/2));
statusDiv.style.left = (left+(width/2));
},
initDocumentationDiv : function(){
documentationDiv = document.createElement('div');
//documentationDiv.className = 'dataLabel';
//documentationDiv.style.background = '#ffffff';
documentationDiv.style.position = 'absolute';
var fileview = document.getElementById('catview');
var top = fileview.offsetTop;
var height = fileview.offsetHeight;
var left = fileview.offsetLeft;
var width = fileview.offsetWidth;
documentationDiv.style.top = (top+(height/2));
documentationDiv.style.left = (left+(width/2));
documentationDiv.id = 'documentation-div';
documentationDiv.style.display = 'block';
formDiv = document.createElement('form');
documentationDiv.appendChild(formDiv);
document.body.appendChild(documentationDiv);
},
initPMG: function(){
//PackageManager.showLoginDialog();
{/literal}{if $module_load == 'true'}{literal}
PackageManager.initTabs();
_pmg = new PackageManagerGrid();
_pmg.renderAll();
//PackageManager.initWorkingDiv();
//PackageManager.initDocumentationDiv();
{/literal}{elseif $IS_ALIVE == 'true'}{literal}
_loadingBar =
new YAHOO.widget.Panel("wait",
{ width:"240px",
fixedcenter:true,
close:false,
draggable:false,
modal:true,
visible:false,
effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.5}
}
);
_loadingBar.setHeader("{/literal}{$MOD.SEARCHING_UPDATES}{literal}");
_loadingBar.setBody("<img src=\"include/javascript/yui/assets/rel_interstitial_loading.gif\"/>");
_loadingBar.render(document.body);
_loadingBar.show();
_pmg = new PackageManagerGrid();
PackageManager.refreshGrid();
_pmg.renderAll();
{/literal}{/if}{literal}
//PackageManager.initLicenseDiv();
//PackageManager.initModuleStaging();
var tabView = new YAHOO.widget.TabView('demo');
PackageManager.checkForUpdates();
},
download : function(){
if(confirm('{/literal}{$MOD.DOWNLOAD_QUESTION}{literal}')){
_numDownloadsComplete = 0;
_numPackagesToDownload = 0;
var tree = YAHOO.widget.TreeView.getTree('treeview');
var nodes = tree.getNodesByProperty('isSelected', true);
//var nodes = YAHOO.widget.TreeView.getNode(treeid, index);
if(nodes){
PackageManager.showWaiting();
_loadingBar =
new YAHOO.widget.Panel("wait",
{ width:"240px",
fixedcenter:true,
close:false,
draggable:false,
modal:true,
visible:false,
effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.5}
}
);
_loadingBar.setHeader("{/literal}{$MOD.DOWNLOADING}{literal}");
_loadingBar.setBody("<img src=\"include/javascript/yui/assets/rel_interstitial_loading.gif\"/>");
_loadingBar.render(document.body);
_loadingBar.show();
//_numPackagesToDownload = nodes.length;
var count = nodes.length;
for(j = 0; j < count; j++){
if(nodes[j].type == 'release'){
_numPackagesToDownload++;
}
}
_loadingBar.setHeader("{/literal}{$MOD.DL_PACKAGES_DOWNLOADING}{literal} "+_numPackagesToDownload+" {/literal}{$MOD.DL_PACKAGES_PACKAGES}{literal}");
for (i = 0; i < count; i++){
var release_id = -1;
var package_id = -1;
var category_id = -1;
if(nodes[i].type == 'package'){
var package_id = nodes[i].data.id;
var category_id = nodes[i].category_id;
}else if(nodes[i].type == 'release'){
var release_id = nodes[i].data.id;
var package_id = nodes[i].package_id;
var category_id = nodes[i].category_id;
postData = 'entryPoint=HandleAjaxCall&to_pdf=1&module=Administration&action=HandleAjaxCall&method=download&release_id=' + release_id + '&package_id=' + package_id + '&category_id=' + category_id;
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
{success: PackageManager.downloadComplete, failure: PackageManager.downloadComplete}, postData);
}
}
}//fi
}
},
downloadComplete : function(data){
PackageManager.hideWaiting();
eval(data.responseText);
if(typeof result != 'undefined') {
_numDownloadsComplete++;
_loadingBar.setHeader("{/literal}{$MOD.DL_PACKAGES_DOWNLOADING}{literal} "+_numDownloadsComplete+" {/literal}{$MOD.DL_PACKAGES_OF}{literal} "+_numPackagesToDownload+ " {/literal}{$MOD.DL_PACKAGES_PACKAGES}{literal}");
if(_numPackagesToDownload == _numDownloadsComplete){
_loadingBar.hide();
if(!{/literal}{$INSTALLATION}{literal}){
PackageManager.getPackagesInStaging();
}else{
document.installForm.run.value = '';
document.installForm.mode.value = 'noop';
document.installForm.submit();
}
}
}
},
getPackagesInStaging : function(){
postData = 'entryPoint=HandleAjaxCall&to_pdf=1&module=Administration&action=HandleAjaxCall&method=getPackagesInStaging';
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
{success: PackageManager.populateGrid, failure: PackageManager.populateGrid}, postData);
},
buildListView : function(result, showDownloadButton){
var result_div = document.getElementById('search_results_div');
display = "<table class='listView' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>";
display += "<tr><th align=left class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_NAME}{literal}</th><th align=left class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_TYPE}{literal}</th><th align=left class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_VERSION}{literal}</th><th align=left class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_PUBLISHED}{literal}</th><th class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_DESCRIPTION}{literal}</th><th class='listViewThLinkS1'>{/literal}{$MOD.LBL_ML_ACTION}{literal}</th></tr>";
for (var x = 0; x < result['packages'].length; x++)
{
var class_css = "oddListRowS1";
if((x % 2) == 0){
class_css = "evenListRowS1";
}
install_link = '';
if(showDownloadButton){
install_link += "<input type=submit class='button' name=\"btn_mode\" onclick=\"this.form.mode.value='Install';this.form.package_id.value="+result['packages'][x]['id']+";this.form.submit();\" value=\"{/literal}{$MOD.LBL_UW_BTN_DOWNLOAD}{literal}\" />";
}
display += "<tr><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+result['packages'][x]['name']+"</td><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+result['packages'][x]['type']+"</td><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+result['packages'][x]['version']+"</td><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+result['packages'][x]['date_published']+"</td><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+result['packages'][x]['description']+"</td><td class=\""+class_css+"\" bgcolor='#ffffff' nowrap>"+install_link+"</td></tr>";
}//rof
display += "</table>";
return display;
},
showStatusMessages: function(message){
if(message != '')
ajaxStatus.flashStatus(message, 5000);
},
populateGrid : function(data){
eval(data.responseText);
if(typeof result != 'undefined') {
//uncheck all treenodes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -