/** * A Static method to Build the display for the package manager * * @param String form1 - the form to display for manual downloading * @param String hidden_fields - the hidden fields related to downloading a package * @param String form_action - the form_action to be used when downloading from the server * @param String types - the types of objects we will request from the server * @param String active_form - the form to display first * @return String - a string of html which will be used to display the forms */ function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1') { global $current_language; $mod_strings = return_module_language($current_language, "Administration"); $ss = new Sugar_Smarty(); $ss->assign('FORM_1_PLACE_HOLDER', $form1); $ss->assign('form_action', $form_action); $ss->assign('hidden_fields', $hidden_fields); $mod_strings = return_module_language($current_language, "Administration"); $ss->assign('MOD', $mod_strings); $result = PackageManagerDisplay::getHeader(); $header_text = $result['text']; $isAlive = $result['isAlive']; $show_login = $result['show_login']; $display = 'none'; //if($isAlive){ $display = 'block'; //} $form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>"; if (!$isAlive) { $form2 .= "<tr><td><span id='span_display_html'>" . $header_text . "</span></td></tr>"; } $form2 .= "</table>"; $form2 .= "<table width='100%'><tr><td align='left'>"; if ($show_login) { $form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='" . $mod_strings['LBL_MODIFY_CREDENTIALS'] . "'>"; } $form2 .= "</td><td align='right'><div id='workingStatusDiv' style='display:none;'>" . SugarThemeRegistry::current()->getImage("sqsWait", "border='0' align='bottom'", null, null, '.gif', "Loading") . "</div></td></tr><tr><td colspan='2'>"; $loginViewStyle = $isAlive ? 'none' : 'block'; $selectViewStyle = $isAlive ? 'block' : 'none'; $form2 .= "<div id='selectView' style='display:" . $selectViewStyle . "'>"; $form2 .= " <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: " . $display . ";'></div>"; $form2 .= "</div>"; if (!$show_login) { $loginViewStyle = 'none'; } //$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>"; //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive); //$form2 .= "</div>"; $form2 .= "</td></tr></table>"; $form2 = ''; $packages = array(); $releases = array(); if ($isAlive) { $filter = array(); $count = count($types); $index = 1; $type_str = '"'; foreach ($types as $type) { $type_str .= "'" . $type . "'"; if ($index < $count) { $type_str .= ","; } $index++; } $type_str .= '"'; $filter = array('type' => $type_str); $filter = PackageManager::toNameValueList($filter); $pm = new PackageManager(); /*if(in_array('patch', $types)){ $releases = $pm->getReleases('3', '3', $filter); }else{ $releases = $pm->getReleases('', '', $filter); }*/ } if ($form_action == 'install.php' && (empty($releases) || count($releases['packages']) == 0)) { //return false; } $tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive); $tree->tree_style = 'include/ytree/TreeView/css/check/tree.css'; $ss->assign('TREEHEADER', $tree->generate_header()); $ss->assign('module_load', 'false'); $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); $ss->assign('FORM_2_PLACE_HOLDER', $form2); $ss->assign('scripts', PackageManagerDisplay::getDisplayScript(false, 'patch', $releases, $types, $isAlive)); $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl'); return $str; }
/** * A Static method to Build the display for the package manager * * @param String form1 - the form to display for manual downloading * @param String hidden_fields - the hidden fields related to downloading a package * @param String form_action - the form_action to be used when downloading from the server * @param String types - the types of objects we will request from the server * @param String active_form - the form to display first * @return String - a string of html which will be used to display the forms */ function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false) { global $current_language; $mod_strings = return_module_language($current_language, "Administration"); global $app_strings; global $sugar_version, $sugar_config; $app_strings = return_application_language('en_us'); $ss = new Sugar_Smarty(); $ss->assign('FORM_1_PLACE_HOLDER', $form1); $ss->assign('form_action', $form_action); $ss->assign('hidden_fields', $hidden_fields); $result = PackageManagerDisplay::getHeader(); $header_text = $result['text']; $isAlive = $result['isAlive']; $show_login = $result['show_login']; $mi_errors = ModuleInstaller::getErrors(); $error_html = ""; if (!empty($mi_errors)) { $error_html = "<tr><td><span>"; foreach ($mi_errors as $error) { $error_html .= "<font color='red'>" . $error . "</font><br>"; } $error_html .= "</span></td></tr>"; } $form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>"; $form2 .= $error_html; if (!$isAlive) { $form2 .= "<tr><td><span id='span_display_html'>" . $header_text . "</span></td></tr>"; } $form2 .= "</table>"; $tree = null; //if($isAlive){ $tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive); $tree->tree_style = 'include/ytree/TreeView/css/check/tree.css'; $ss->assign('TREEHEADER', $tree->generate_header()); //} //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings); $form2 .= "<table class='tabForm' cellpadding='0' cellspacing='0' width='100%' border='0'>"; $form2 .= "<tr><td></td><td align='left'>"; if ($isAlive) { $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='" . $mod_strings['LBL_MODIFY_CREDENTIALS'] . "'>"; } else { $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='" . $mod_strings['LBL_MODIFY_CREDENTIALS'] . "'style='display:none;'>"; } $form2 .= "</td><td align='left'><div id='workingStatusDiv' style='display:none;'>" . SugarThemeRegistry::current()->getImage("sqsWait", "border='0' align='bottom'") . "</div></td><td align='right'>"; if ($isAlive) { $form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div'><img src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "' width='8' height='8' border='0'> Collapse</span></a></slot>"; } else { $form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div' style='display:none;'><img src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "' width='8' height='8' border='0'> Collapse</span></a></slot>"; } $form2 .= "</td></tr></table>"; $form2 = ''; //Commenting out the form as part of sugar depot hiding. $ss->assign('installation', $install ? 'true' : 'false'); $mod_strings = return_module_language($current_language, "Administration"); $ss->assign('MOD', $mod_strings); $ss->assign('module_load', 'true'); $ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install)); $show_login = false; //hiding install from sugar $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); $ss->assign('FORM_2_PLACE_HOLDER', $form2); $ss->assign('MOD', $mod_strings); $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED']; $ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types)); $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl'); return $str; }