function display() { global $mod_strings; $smarty = new Sugar_Smarty(); $mb = new ModuleBuilder(); //if (!empty($_REQUEST['package'])) { if (empty($_REQUEST['package']) && empty($_REQUEST['new'])) { $this->generatePackageButtons($mb->getPackageList()); $smarty->assign('buttons', $this->buttons); $smarty->assign('title', $GLOBALS['mod_strings']['LBL_MODULEBUILDER']); $smarty->assign("question", $GLOBALS['mod_strings']['LBL_QUESTION_PACKAGE']); $smarty->assign("defaultHelp", "mbHelp"); $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")'); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], ''); $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl')); echo $ajax->getJavascript(); } else { $name = !empty($_REQUEST['package']) ? $_REQUEST['package'] : ''; $mb->getPackage($name); require_once 'modules/ModuleBuilder/MB/MBPackageTree.php'; $mbt = new MBPackageTree(); $nodes = $mbt->fetchNodes(); $package_labels = array(); if (!empty($nodes['tree_data']['nodes'])) { foreach ($nodes['tree_data']['nodes'] as $entry) { if (!empty($entry['data']['label']) && $name != $entry['data']['label']) { $package_labels[] = strtoupper($entry['data']['label']); } } } $json = getJSONobj(); $smarty->assign('package_labels', $json->encode($package_labels)); $this->package =& $mb->packages[$name]; $this->loadModuleTypes(); $this->loadPackageHelp($name); $this->package->date_modified = $GLOBALS['timedate']->to_display_date_time($this->package->date_modified); $smarty->assign('package', $this->package); $smarty->assign('mod_strings', $mod_strings); $smarty->assign('package_already_deployed', 'false'); foreach ($this->package->modules as $a_module) { if (in_array($a_module->key_name, $GLOBALS['moduleList'])) { $smarty->assign('package_already_deployed', 'true'); break; } } $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")'); if (empty($name)) { $name = $mod_strings['LBL_NEW_PACKAGE']; } $ajax->addCrumb($name, ''); $html = $smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/package.tpl'); if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'SavePackage') { $html .= "<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>"; } $ajax->addSection('center', translate('LBL_SECTION_PACKAGE', 'ModuleBuilder'), $html); echo $ajax->getJavascript(); } }
function display() { global $mod_strings; $ajax = new AjaxCompose(); $ajax->addSection('center', $mod_strings['LBL_PACKAGE_DELETED'], str_replace('[[package]]', $_REQUEST['package'], $mod_strings['LBL_PACKAGE_WAS_DELETED'])); echo $ajax->getJavascript(); }
function display() { global $current_user, $mod_strings; $smarty = new Sugar_Smarty(); $mb = new MBPackage("packageCustom"); $mod = $mb->getCustomModules(); $modules = array(); $custom = array(); if (is_array($mod)) { foreach ($mod as $key => $value) { $modules[] = $key; $custom[] = $value; } } $nb_mod = count($modules); $smarty->assign('mod_strings', $mod_strings); $smarty->assign('modules', $mod); $smarty->assign('custom', $custom); $smarty->assign('nb_mod', $nb_mod); $smarty->assign('defaultHelp', 'exportHelp'); $smarty->assign('moduleList', $GLOBALS['app_list_strings']['moduleList']); $smarty->assign('moduleList', $GLOBALS['app_list_strings']['moduleList']); $ajax = new AjaxCompose(); $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")'); $ajax->addSection('center', $mod_strings['LBL_EC_TITLE'], $smarty->fetch($this->getCustomFilePathIfExists('modules/ModuleBuilder/tpls/exportcustomizations.tpl'))); echo $ajax->getJavascript(); }
function display() { $this->parser = ParserFactory::getParser(MB_PORTAL . strtolower($this->editLayout), $this->editModule, null, null, MB_PORTAL); $smarty = new Sugar_Smarty(); //Add in the module we are viewing to our current mod strings global $mod_strings, $current_language; $editModStrings = return_module_language($current_language, $this->editModule); $mod_strings = sugarArrayMerge($editModStrings, $mod_strings); $smarty->assign('mod', $mod_strings); $smarty->assign('MOD', $mod_strings); // assign buttons $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone'); foreach ($images as $image => $file) { $smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file)); } $smarty->assign('icon_delete', SugarThemeRegistry::current()->getImage('icon_Delete', '', 48, 48, '.gif', $mod_strings['LBL_MB_DELETE'])); $buttons = array(); $buttons[] = array('id' => 'saveBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_save'], '', null, null, '.gif', $mod_strings['LBL_BTN_SAVE']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handleSave();'"); $buttons[] = array('id' => 'publishBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_publish'], '', null, null, '.gif', $mod_strings['LBL_BTN_PUBLISH']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handlePublish();'"); $html = ""; foreach ($buttons as $button) { if ($button['id'] == "spacer") { $html .= "<td style='width:{$button['width']}'> </td>"; } else { $html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>"; } } $smarty->assign('buttons', $html); // assign fields and layout $smarty->assign('available_fields', $this->parser->getAvailableFields()); $smarty->assign('field_defs', $this->parser->getFieldDefs()); $smarty->assign('layout', $this->parser->getLayout()); $smarty->assign('view_module', $this->editModule); $smarty->assign('calc_field_list', json_encode($this->parser->getCalculatedFields())); $smarty->assign('view', $this->editLayout); $smarty->assign('maxColumns', $this->parser->getMaxColumns()); $smarty->assign('fieldwidth', '150px'); $smarty->assign('translate', true); $smarty->assign('fromPortal', true); // flag for form submittal - when the layout is submitted the actions are the same for layouts and portal layouts, but the parsers must be different... if (!empty($this->parser->usingWorkingFile)) { $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_LAYOUT_PREVIEW']); } else { $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_CURRENT_LAYOUT']); } $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&layout=1")'); $ajax->addCrumb(ucwords(translate('LBL_MODULE_NAME', $this->editModule)), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&view_module=' . $this->editModule . '")'); $ajax->addCrumb(ucwords($this->editLayout), ''); // set up language files $smarty->assign('language', $this->parser->getLanguage()); // for sugar_translate in the smarty template //navjeet- assistant logic has changed //include('modules/ModuleBuilder/language/en_us.lang.php'); //$smarty->assign('assistantBody', $mod_strings['assistantHelp']['module']['editView'] ); $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_EDIT_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl')); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); if ($this->fromModuleBuilder) { $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['view_package'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->editPackage . '")'); $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->editPackage . '&view_module=' . $this->editModule . '")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&layouts=1&MB=1&view_package=' . $this->editPackage . '&view_module=' . $this->editModule . '")'); $ajax->addCrumb(translate('LBL_DASHLET', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&dashlet=1&MB=1&view_package=' . $this->editPackage . '&view_module=' . $this->editModule . '")'); $ViewLabel = $this->editLayout == MB_DASHLET ? 'LBL_DASHLETLISTVIEW' : 'LBL_DASHLETSEARCHVIEW'; $ajax->addCrumb(translate($ViewLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=editLayout&view=' . $this->editLayout . '&view_module=' . $this->editModule . '&view_package=' . $this->editPackage . '")'); } return $ajax; }
function display() { global $mod_strings; $ajax = new AjaxCompose(); $smarty = new Sugar_Smarty(); if (isset($_REQUEST['MB']) && $_REQUEST['MB'] == "1") { $smarty->assign("MB", $_REQUEST['MB']); $smarty->assign("view_package", $_REQUEST['view_package']); } $selected_lang = !empty($_REQUEST['selected_lang']) ? $_REQUEST['selected_lang'] : $_SESSION['authenticated_user_language']; if (empty($selected_lang)) { $selected_lang = $GLOBALS['sugar_config']['default_language']; } $smarty->assign('available_languages', get_languages()); $smarty->assign('selected_lang', $selected_lang); ksort($this->properties); $smarty->assign("properties", $this->properties); // $smarty->assign("id",$this->id); $smarty->assign("mod_strings", $mod_strings); $smarty->assign('APP', $GLOBALS['app_strings']); $smarty->assign("view_module", $this->editModule); $smarty->assign("subpanel", $this->subpanel); if (isset($this->editPackage)) { $smarty->assign("view_package", $this->editPackage); } $ajax->addSection('east', translate('LBL_SECTION_PROPERTIES', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/editProperty.tpl')); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); switch ($this->editLayout) { default: $searchLabel = 'LBL_' . strtoupper($this->editLayout); } $layoutLabel = 'LBL_LAYOUTS'; $layoutView = 'layouts'; if ($this->fromModuleBuilder) { $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['view_package'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST['view_package'] . '")'); $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST['view_package'] . "&view_module={$this->editModule}" . '")'); $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $this->editModule . '&view_package=' . $_REQUEST['view_package'] . '")'); if ($layoutLabel == 'LBL_LAYOUTS') { $ajax->addCrumb(translate('LBL_SEARCH_FORMS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=search&view_module=' . $this->editModule . '&view_package=' . $_REQUEST['view_package'] . '")'); } $ajax->addCrumb(translate($searchLabel, 'ModuleBuilder'), ''); } else { $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")'); $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")'); if ($layoutLabel == 'LBL_LAYOUTS') { $ajax->addCrumb(translate('LBL_SEARCH_FORMS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=search&view_module=' . $this->editModule . '")'); } $ajax->addCrumb(translate($searchLabel, 'ModuleBuilder'), ''); } $this->title = $searchLabel; return $ajax; }
function display() { $moduleName = !empty($_REQUEST['view_module']) ? $_REQUEST['view_module'] : $_REQUEST['edit_module']; $smarty = new Sugar_Smarty(); // set the mod_strings as we can be called after doing a Repair and the mod_strings are set to Administration $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'ModuleBuilder'); $smarty->assign('mod_strings', $GLOBALS['mod_strings']); $smarty->assign('view_module', $moduleName); $ajax = new AjaxCompose(); $json = getJSONobj(); $this->fromModuleBuilder = !empty($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'; $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder); if (!$this->fromModuleBuilder) { $smarty->assign('view_package', ''); $relationships = new DeployedRelationships($moduleName); $ajaxRelationships = $this->getAjaxRelationships($relationships); $smarty->assign('relationships', $json->encode($ajaxRelationships)); $smarty->assign('empty', sizeof($ajaxRelationships) == 0); $smarty->assign('studio', true); //crumb global $app_list_strings; $moduleNames = array_change_key_case($app_list_strings['moduleList']); $translatedModule = $moduleNames[strtolower($moduleName)]; $ajax->addCrumb(translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb($translatedModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $moduleName . '")'); $ajax->addCrumb(translate('LBL_RELATIONSHIPS'), ''); $ajax->addSection('center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl')); } else { $smarty->assign('view_package', $_REQUEST['view_package']); $mb = new ModuleBuilder(); $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $package = $mb->packages[$_REQUEST['view_package']]; $package->loadModuleTitles(); $relationships = new UndeployedRelationships($module->getModuleDir()); $ajaxRelationships = $this->getAjaxRelationships($relationships); $smarty->assign('relationships', $json->encode($ajaxRelationships)); $smarty->assign('empty', sizeof($ajaxRelationships) == 0); $module->help['default'] = empty($_REQUEST['view_module']) ? 'create' : 'modify'; $module->help['group'] = 'module'; $ajax->addCrumb(translate('LBL_MODULEBUILDER'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")'); $ajax->addCrumb($moduleName, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $package->name . '&view_module=' . $moduleName . '")'); $ajax->addCrumb(translate('LBL_RELATIONSHIPS'), ''); $ajax->addSection('center', $moduleName . ' ' . translate('LBL_RELATIONSHIPS'), $this->fetchTemplate($smarty, 'modules/ModuleBuilder/tpls/studioRelationships.tpl')); } echo $ajax->getJavascript(); }
function display() { $smarty = new Sugar_Smarty(); $smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SYNCP_WELCOME']); $smarty->assign('mod', $GLOBALS['mod_strings']); if (isset($_REQUEST['label'])) { $smarty->assign('label', $_REQUEST['label']); } $options = !empty($GLOBALS['system_config']->settings['system_portal_url']) ? $GLOBALS['system_config']->settings['system_portal_url'] : 'https://'; $smarty->assign('options', $options); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(translate('LBL_SYNCPORTAL', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=portalsync")'); $ajax->addSection('center', translate('LBL_SYNCPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalsync.tpl')); $GLOBALS['log']->debug($smarty->fetch('modules/ModuleBuilder/tpls/portalsync.tpl')); echo $ajax->getJavascript(); }
function display() { $ajax = new AjaxCompose(); $smarty = $this->generateSmarty(); if (isset($_REQUEST['refreshTree'])) { require_once 'modules/ModuleBuilder/Module/DropDownTree.php'; $mbt = new DropDownTree(); $ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes()); $smarty->assign('refreshTree', true); } $smarty->assign('deleteImage', SugarThemeRegistry::current()->getImage('delete_inline', '')); $smarty->assign('editImage', SugarThemeRegistry::current()->getImage('edit_inline', '')); $smarty->assign('action', 'savedropdown'); $body = $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/dropdown.tpl'); $ajax->addSection('east2', $GLOBALS['mod_strings']['LBL_SECTION_DROPDOWNED'], $body); echo $ajax->getJavascript(); }
/** * This function loads portal config vars from db and sets them for the view * @see SugarView::display() for more info */ function display() { global $current_user, $app_strings; $smarty = new Sugar_Smarty(); $smarty->assign('mod', $GLOBALS['mod_strings']); $smarty->assign("token", session_id()); $smarty->assign("siteURL", $GLOBALS['sugar_config']['site_url']); //Loading label $smarty->assign('LBL_LOADING', $app_strings['LBL_ALERT_TITLE_LOADING']); $theme = new SidecarTheme(); $smarty->assign("css_url", $theme->getCSSURL()); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(ucwords(translate('LBL_PORTAL_THEME')), ''); $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portaltheme.tpl')); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); $layoutLabel = 'LBL_LAYOUTS'; $layoutView = 'layouts'; $labels = [MB_LISTVIEW => 'LBL_LISTVIEW']; $translatedViewType = ''; if (isset($labels[strtolower($this->editLayout)])) { $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder'); } $this->translatedViewType = $translatedViewType; if ($this->fromModuleBuilder) { $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['view_package'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST['view_package'] . '")'); $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST['view_package'] . '&view_module=' . $_REQUEST['view_module'] . '")'); if ($this->subpanel != "") { $ajax->addCrumb(translate('LBL_AVAILABLE_SUBPANELS', 'ModuleBuilder'), ''); if ($this->subpanelLabel) { $subpanelLabel = $this->subpanelLabel; // If the subpanel title has changed, use that for the label instead if (!empty($_REQUEST['subpanel_title']) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title']) { $subpanelLabel = $_REQUEST['subpanel_title']; } $ajax->addCrumb($subpanelLabel, ''); $this->translatedViewType = $subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder"); } else { $ajax->addCrumb($this->subpanel, ''); $this->translatedViewType = translate("LBL_SUBPANEL", "ModuleBuilder"); } } else { $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $_REQUEST['view_module'] . '&view_package=' . $_REQUEST['view_package'] . '")'); $ajax->addCrumb($translatedViewType, ''); } } else { $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")'); $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")'); if ($this->subpanel) { $ajax->addCrumb(translate('LBL_SUBPANELS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=subpanels&view_module=' . $this->editModule . '")'); if ($this->subpanelLabel) { $subpanelLabel = $this->subpanelLabel; // If the subpanel title has changed, use that for the label instead if (!empty($_REQUEST['subpanel_title']) && $_REQUEST['subpanelLabel'] != $_REQUEST['subpanel_title']) { $subpanelLabel = $_REQUEST['subpanel_title']; } $ajax->addCrumb($subpanelLabel, ''); $this->translatedViewType = $subpanelLabel . " " . translate("LBL_SUBPANEL", "ModuleBuilder"); } else { $ajax->addCrumb($this->subpanel, ''); $this->translatedViewType = translate("LBL_SUBPANEL", "ModuleBuilder"); } } else { $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")'); $ajax->addCrumb($translatedViewType, ''); } } return $ajax; }
function display() { $ajax = new AjaxCompose(); $params = $this->parseArguments($_REQUEST); $smarty = $this->generateSmarty($params); if (isset($_REQUEST['refreshTree'])) { $mbt = new DropDownTree(); $ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes()); $smarty->assign('refreshTree', true); } $smarty->assign('deleteImage', SugarThemeRegistry::current()->getImage('delete_inline', '', null, null, '.gif', translate('LBL_MB_DELETE'))); $smarty->assign('editImage', SugarThemeRegistry::current()->getImage('edit_inline', '', null, null, '.gif', translate('LBL_EDIT'))); $smarty->assign('action', 'savedropdown'); $smarty->assign('fromNewField', !empty($_REQUEST['is_new_field'])); $body = $smarty->fetch($this->template); $ajax->addSection('east2', translate('LBL_SECTION_DROPDOWNED'), $body); echo $ajax->getJavascript(); }
/** * This function loads portal config vars from db and sets them for the view * @see SugarView::display() for more info */ function display() { $portalFields = array('appStatus' => 'offline', 'logoURL' => '', 'maxQueryResult' => '20', 'maxSearchQueryResult' => '5', 'defaultUser' => ''); $userList = get_user_array(); $userList[''] = ''; require_once "modules/MySettings/TabController.php"; $controller = new TabController(); $disabledModulesFlag = false; $disabledModules = array_diff($controller->getAllPortalTabs(), $controller->getPortalTabs()); if (!empty($disabledModules)) { $disabledModulesFlag = true; array_walk($disabledModules, function (&$item) { $item = translate($item); }); } $admin = Administration::getSettings(); $portalConfig = $admin->getConfigForModule('portal', 'support', true); $portalConfig['appStatus'] = !empty($portalConfig['on']) ? 'online' : 'offline'; $smarty = new Sugar_Smarty(); $smarty->assign('disabledDisplayModulesList', $disabledModules); $smarty->assign('disabledDisplayModules', $disabledModulesFlag); foreach ($portalFields as $fieldName => $fieldDefault) { if (isset($portalConfig[$fieldName])) { $smarty->assign($fieldName, html_entity_decode($portalConfig[$fieldName])); } else { $smarty->assign($fieldName, $fieldDefault); } } $smarty->assign('userList', $userList); $smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SYNCP_WELCOME']); $smarty->assign('mod', $GLOBALS['mod_strings']); $smarty->assign('siteURL', $GLOBALS['sugar_config']['site_url']); if (isset($_REQUEST['label'])) { $smarty->assign('label', $_REQUEST['label']); } $options = !empty($GLOBALS['system_config']->settings['system_portal_url']) ? $GLOBALS['system_config']->settings['system_portal_url'] : 'https://'; $smarty->assign('options', $options); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(ucwords(translate('LBL_PORTAL_CONFIGURE')), ''); $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl')); $GLOBALS['log']->debug($smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl')); echo $ajax->getJavascript(); }
function display() { global $mod_strings; $smarty = new Sugar_Smarty(); $mb = new ModuleBuilder(); //if (!empty($_REQUEST['package'])) { if (empty($_REQUEST['package']) && empty($_REQUEST['new'])) { $this->generatePackageButtons($mb->getPackageList()); $smarty->assign('buttons', $this->buttons); $smarty->assign('title', $GLOBALS['mod_strings']['LBL_MODULEBUILDER']); $smarty->assign("question", $GLOBALS['mod_strings']['LBL_QUESTION_PACKAGE']); $smarty->assign("defaultHelp", "mbHelp"); $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")'); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], ''); $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_PACKAGE_LIST'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl')); echo $ajax->getJavascript(); } else { $name = !empty($_REQUEST['package']) ? $_REQUEST['package'] : ''; $mb->getPackage($name); $this->package =& $mb->packages[$name]; $this->loadModuleTypes(); $this->loadPackageHelp($name); $this->package->date_modified = $GLOBALS['timedate']->to_display_date_time($this->package->date_modified); $smarty->assign('package', $this->package); $smarty->assign('mod_strings', $mod_strings); $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package")'); if (empty($name)) { $name = $mod_strings['LBL_NEW_PACKAGE']; } $ajax->addCrumb($name, ''); $html = $smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/package.tpl'); if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'SavePackage') { $html .= "<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>"; } $ajax->addSection('center', translate('LBL_SECTION_PACKAGE', 'ModuleBuilder'), $html); echo $ajax->getJavascript(); } }
function handleSave() { $out = "<script>ajaxStatus.flashStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'), 2000);</script>"; if (!empty($_REQUEST['relationships'])) { $out .= $this->removeCustomRelationships(); } if (!empty($_REQUEST['fields'])) { $out .= $this->removeCustomFields(); } if (!empty($_REQUEST['layouts'])) { $out .= $this->removeCustomLayouts(); } if (!empty($_REQUEST['labels'])) { $out .= $this->removeCustomLabels(); } if (!empty($_REQUEST['extensions'])) { $out .= $this->removeCustomExtensions(); } if ($this->module === 'Opportunities') { $opp_settings = Opportunity::getSettings(); if ($opp_settings['opps_view_by'] == 'RevenueLineItems') { require_once 'modules/Opportunities/include/OpportunityWithRevenueLineItem.php'; $opp_setup = new OpportunityWithRevenueLineItem(); $opp_setup->doMetadataConvert(); $out .= 'Enabling Opportunities with RevenueLineItems<br />'; } } $out .= "Complete!"; $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_STUDIO'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb(translate($this->module), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->module . '")'); $ajax->addCrumb("Reset " . translate($this->module), ''); $ajax->addSection('center', "Reset " . translate($this->module), $out); echo $ajax->getJavascript(); }
function display() { global $current_user; global $mod_strings; $smarty = new Sugar_Smarty(); $smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']); $smarty->assign('question', $mod_strings['LBL_QUESTION_EDITOR']); $smarty->assign('defaultHelp', 'mainHelp'); $this->generateHomeButtons(); $smarty->assign('buttons', $this->buttons); $assistant = array('group' => 'main', 'key' => 'welcome'); $smarty->assign('assistant', $assistant); //initialize Assistant's display property. $userPref = $current_user->getPreference('mb_assist', 'Assistant'); if (!$userPref) { $userPref = "na"; } $smarty->assign('userPref', $userPref); $ajax = new AjaxCompose(); $ajax->addSection('center', $mod_strings['LBL_HOME'], $smarty->fetch('modules/ModuleBuilder/tpls/wizard.tpl')); echo $ajax->getJavascript(); }
function display() { global $mod_strings; $bak_mod_strings = $mod_strings; $smarty = new Sugar_Smarty(); $smarty->assign('mod_strings', $mod_strings); $package_name = $_REQUEST['view_package']; $module_name = $_REQUEST['view_module']; require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php'; $mb = new ModuleBuilder(); $mb->getPackage($_REQUEST['view_package']); $package = $mb->packages[$_REQUEST['view_package']]; $package->getModule($module_name); $this->module = $package->modules[$module_name]; $selected_lang = !empty($_REQUEST['selected_lang']) ? $_REQUEST['selected_lang'] : $_SESSION['authenticated_user_language']; if (empty($selected_lang)) { $selected_lang = $GLOBALS['sugar_config']['default_language']; } //need to change the following to interface with MBlanguage. $smarty->assign('MOD', $this->module->getModStrings($selected_lang)); $smarty->assign('APP', $GLOBALS['app_strings']); $smarty->assign('selected_lang', $selected_lang); $smarty->assign('view_package', $package_name); $smarty->assign('view_module', $module_name); $smarty->assign('mb', '1'); $smarty->assign('available_languages', get_languages()); /////////////////////////////////////////////////////////////////// ////ASSISTANT $smarty->assign('assistant', array('group' => 'module', 'key' => 'labels')); ///////////////////////////////////////////////////////////////// ////ASSISTANT $ajax = new AjaxCompose(); $ajax->addCrumb($bak_mod_strings['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")'); $ajax->addCrumb($package_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")'); $ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&package=' . $package->name . '&module=' . $module_name . '")'); $ajax->addCrumb($bak_mod_strings['LBL_LABELS'], ''); $ajax->addSection('center', $bak_mod_strings['LBL_LABELS'], $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl')); echo $ajax->getJavascript(); }
function display() { $ajax = new AjaxCompose(); $smarty = new Sugar_Smarty(); if (isset($_REQUEST['refreshTree'])) { require_once 'modules/ModuleBuilder/Module/DropDownTree.php'; $mbt = new DropDownTree(); $ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes()); $smarty->assign('refreshTree', true); } global $mod_strings; $ajax->addCrumb($mod_strings['LBL_DROPDOWNEDITOR'], 'ModuleBuilder.main("dropdowns")'); require_once 'modules/ModuleBuilder/Module/DropDownBrowser.php'; $dd = new DropDownBrowser(); $smarty->assign('LBL_BTN_ADDDROPDOWN', translate('LBL_BTN_ADDDROPDOWN')); $smarty->assign('dropdowns', $dd->getNodes()); $smarty->assign('deleteImage', SugarThemeRegistry::current()->getImage('delete_inline', '', null, null, '.gif', $mod_strings['LBL_MB_DELETE'])); $smarty->assign('editImage', SugarThemeRegistry::current()->getImage('edit_inline', '', null, null, '.gif', $mod_strings['LBL_EDIT'])); $smarty->assign('action', 'savedropdown'); $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_DROPDOWNEDITOR'], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/dropdowns.tpl')); echo $ajax->getJavascript(); }
public function display() { $smarty = $this->constructSmarty(); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")'); $ajax->addCrumb(translate('LBL_MODULE_NAME'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=Leads")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=layouts&view_module=Leads")'); $ajax->addCrumb(translate('LBL_CONVERTLEAD'), ""); $ajax->addSection('center', 'Convert Layout', $smarty->fetch("modules/Leads/tpls/EditConvertLead.tpl")); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&layout=1")'); $ajax->addCrumb(ucwords(translate('LBL_MODULE_NAME', $this->editModule)), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&view_module=' . $this->editModule . '")'); $ajax->addCrumb(ucwords($this->editLayout), ''); return $ajax; }
function ViewDisplaydeploy() { $smarty = new Sugar_Smarty(); $smarty->assign('package', $_REQUEST['name']); $smarty->assign('message', $GLOBALS['mod_strings']['LBL_DEPLOY_IN_PROGRESS']); $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['name'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST['name'] . '")'); $ajax->addCrumb(translate('LBL_SECTION_DEPLOY', 'ModuleBuilder'), ''); $ajax->addSection('center', translate('LBL_SECTION_DEPLOY', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/MBPackage/deploy.tpl')); echo $ajax->getJavascript(); }
function display() { $this->fromModuleBuilder = isset($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'; if ($this->fromModuleBuilder) { return; //no support for MB } global $current_user; global $mod_strings; $smarty = new Sugar_Smarty(); $smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']); $smarty->assign('question', $mod_strings['LBL_REMOVE_LAYOUT']); $smarty->assign('mod_strings', $mod_strings); $module_name = $_REQUEST['view_module']; $smarty->assign('view_module', $module_name); $groupLayout = $_REQUEST['grpLayout']; $smarty->assign('groupLayout', $groupLayout); require_once 'modules/SecurityGroups/SecurityGroup.php'; $groupFocus = new SecurityGroup(); $groupFocus->retrieve($groupLayout); $groupName = $groupFocus->name; // set up language files //$smarty->assign ( 'language', $parser->getLanguage() ) ; // for sugar_translate in the smarty template //$smarty->assign('from_mb',$this->fromModuleBuilder); $mb = new ModuleBuilder(); if (!isset($_REQUEST['view_package'])) { $_REQUEST['view_package'] = 'studio'; } $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $package = $mb->packages[$_REQUEST['view_package']]; $package->loadModuleTitles(); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=addlayout&layouts=1&view_module=' . $module_name . '")'); $ajax->addCrumb(translate($groupName), ''); $ajax->addCrumb($mod_strings['LBL_REMOVE_LAYOUT'], ''); //$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_ADD_LAYOUT'), $ajax->addSection('center', $mod_strings['LBL_ADD_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/removegrouplayoutprompt.tpl')); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); $layoutLabel = 'LBL_LAYOUTS'; $layoutView = 'layouts'; $labels = array(MB_LISTVIEW => 'LBL_LISTVIEW'); $translatedViewType = ''; if (isset($labels[strtolower($this->editLayout)])) { $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder'); } if ($this->fromModuleBuilder) { $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['view_package'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&view_package=' . $_REQUEST['view_package'] . '")'); $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST['view_package'] . '&view_module=' . $_REQUEST['view_module'] . '")'); $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $_REQUEST['view_module'] . '&view_package=' . $_REQUEST['view_package'] . '")'); if ($this->subpanel != "") { $ajax->addCrumb(translate('LBL_SUBPANELS', 'ModuleBuilder'), ''); if ($this->subpanelLabel) { $ajax->addCrumb($this->subpanelLabel, ''); } else { $ajax->addCrumb($this->subpanel, ''); } } else { $ajax->addCrumb($translatedViewType, 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=editLayout&view=' . $this->editLayout . '&view_module=' . $this->editModule . '&view_package=' . $_REQUEST['view_package'] . '")'); } } else { $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")'); $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")'); if ($this->subpanel) { $ajax->addCrumb(translate('LBL_SUBPANELS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&subpanels=1&view_module=' . $this->editModule . '")'); if ($this->subpanelLabel) { $ajax->addCrumb($this->subpanelLabel, 'ModuleBuilder.getContent("module=ModuleBuilder&action=editLayout&view=ListView&view_module=' . $this->editModule . '&subpanel=' . $this->subpanel . '&subpanelLabel=' . $this->subpanelLabel . '")'); } else { $ajax->addCrumb($this->subpanel, 'ModuleBuilder.getContent("module=ModuleBuilder&action=editLayout&view=ListView&view_module=' . $this->editModule . '&subpanel=' . $this->subpanel . '")'); } } else { $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")'); $ajax->addCrumb($translatedViewType, 'ModuleBuilder.getContent("module=ModuleBuilder&action=editLayout&view=' . $this->editLayout . '&view_module=' . $this->editModule . '")'); } } return $ajax; }
function display() { $smarty = new Sugar_Smarty(); //$smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SP_UPLOADSTYLE']); $smarty->assign('mod', $GLOBALS['mod_strings']); if (isset($_REQUEST['label'])) { $GLOBALS['log']->debug('ViewPortalStyle->display(): label = ' . $_REQUEST['label']); $smarty->assign('label', $_REQUEST['label']); } $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(translate('LBL_UP_STYLE_SHEET', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=portalstyle")'); $ajax->addSection('center', translate('LBL_UP_STYLE_SHEET', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalstyle.tpl')); $GLOBALS['log']->debug('ViewPortalStyle->display(): ' . $ajax->getJavascript()); echo $ajax->getJavascript(); }
function constructAjax() { require_once 'modules/ModuleBuilder/MB/AjaxCompose.php'; $ajax = new AjaxCompose(); switch ($this->editLayout) { case MB_WIRELESSBASICSEARCH: case MB_WIRELESSADVANCEDSEARCH: $searchLabel = 'LBL_WIRELESSSEARCH'; break; default: if (isModuleBWC($this->editModule)) { $searchLabel = 'LBL_' . strtoupper($this->editLayout); } else { $searchLabel = 'LBL_FILTER_SEARCH'; } break; } $layoutLabel = 'LBL_LAYOUTS'; $layoutView = 'layouts'; if (in_array($this->editLayout, array(MB_WIRELESSBASICSEARCH, MB_WIRELESSADVANCEDSEARCH))) { $layoutLabel = 'LBL_WIRELESSLAYOUTS'; $layoutView = 'wirelesslayouts'; } if ($this->fromModuleBuilder) { $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")'); $ajax->addCrumb($_REQUEST['view_package'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $_REQUEST['view_package'] . '")'); $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $_REQUEST['view_package'] . "&view_module={$this->editModule}" . '")'); $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view_module=' . $this->editModule . '&view_package=' . $_REQUEST['view_package'] . '")'); if ($layoutLabel == 'LBL_LAYOUTS') { $ajax->addCrumb(translate('LBL_SEARCH_FORMS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=search&view_module=' . $this->editModule . '&view_package=' . $_REQUEST['view_package'] . '")'); } $ajax->addCrumb(translate($searchLabel, 'ModuleBuilder'), ''); } else { $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb($this->translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $this->editModule . '")'); $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '")'); if ($layoutLabel == 'LBL_LAYOUTS') { $ajax->addCrumb(translate('LBL_SEARCH_FORMS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view=search&view_module=' . $this->editModule . '")'); } $ajax->addCrumb(translate($searchLabel, 'ModuleBuilder'), ''); } $this->title = $searchLabel; return $ajax; }
public function display() { global $mod_strings, $locale; $ajax = new AjaxCompose(); $smarty = new Sugar_Smarty(); if (isset($_REQUEST['MB']) && $_REQUEST['MB'] == "1") { $smarty->assign("MB", $_REQUEST['MB']); $smarty->assign("view_package", $_REQUEST['view_package']); } if (!empty($_REQUEST['selected_lang'])) { $selected_lang = $_REQUEST['selected_lang']; } else { $selected_lang = $locale->getAuthenticatedUserLanguage(); } if (empty($selected_lang)) { $selected_lang = $GLOBALS['sugar_config']['default_language']; } $smarty->assign('available_languages', get_languages()); $smarty->assign('selected_lang', $selected_lang); ksort($this->properties); if (isset($this->properties['width'])) { $smarty->assign('defaultWidths', SidecarListLayoutMetaDataParser::getDefaultWidths()); } // BWC modules width are in %, sidecar modules widths are in pixels. $smarty->assign('widthUnit', isModuleBWC($this->editModule) ? '%' : 'px'); $smarty->assign("properties", $this->properties); $smarty->assign("mod_strings", $mod_strings); $smarty->assign('APP', $GLOBALS['app_strings']); $smarty->assign("view_module", $this->editModule); $smarty->assign("subpanel", $this->subpanel); if (isset($this->editPackage)) { $smarty->assign("view_package", $this->editPackage); } $ajax->addSection('east', translate('LBL_SECTION_PROPERTIES', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/editProperty.tpl')); echo $ajax->getJavascript(); }
function display() { global $mod_strings; $smarty = new Sugar_Smarty(); require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php'; $mb = new ModuleBuilder(); $mb->getPackage($_REQUEST['view_package']); $package = $mb->packages[$_REQUEST['view_package']]; $module_name = !empty($_REQUEST['view_module']) ? $_REQUEST['view_module'] : ''; $package->getModule($module_name); $this->mbModule = $package->modules[$module_name]; $this->loadPackageHelp($module_name); // set up the list of either available types for a new module, or implemented types for an existing one $types = empty($module_name) ? MBModule::getTypes() : $this->mbModule->mbvardefs->templates; foreach ($types as $type => $definition) { $translated_type[$type] = translate('LBL_TYPE_' . strtoupper($type), 'ModuleBuilder'); } natcasesort($translated_type); $smarty->assign('types', $translated_type); $smarty->assign('package', $package); $smarty->assign('module', $this->mbModule); $smarty->assign('mod_strings', $mod_strings); $ajax = new AjaxCompose(); $ajax->addCrumb($GLOBALS['mod_strings']['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")'); $ajax->addCrumb(' ' . $package->name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")'); if (empty($module_name)) { $module_name = translate('LBL_NEW_MODULE', 'ModuleBuilder'); } $ajax->addCrumb($module_name, ''); $html = $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/module.tpl'); if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'SaveModule') { $html .= "<script>ModuleBuilder.treeRefresh('ModuleBuilder')</script>"; } $ajax->addSection('center', translate('LBL_SECTION_MODULE', 'ModuleBuilder'), $html); echo $ajax->getJavascript(); }
function display() { $selected_lang = !empty($_REQUEST['relationship_lang']) ? $_REQUEST['relationship_lang'] : $_SESSION['authenticated_user_language']; $this->smarty = new Sugar_Smarty(); $ac = new AjaxCompose(); $this->fromModuleBuilder = isset($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'; $this->smarty->assign('fromModuleBuilder', $this->fromModuleBuilder); if (!$this->fromModuleBuilder) { $module = StudioModuleFactory::getStudioModule($_REQUEST['view_module']); $moduleName = $_REQUEST['view_module']; $fields = $module->fields; require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php'; $relatableModules = DeployedRelationships::findRelatableModules(); $appStrings = return_app_list_strings_language($selected_lang); $modStrings = return_module_language($selected_lang, $_REQUEST['view_module'], true); $appStrings = $appStrings['moduleList']; } else { $mb = new ModuleBuilder(); $mb->getPackages(); //display the latest module name rather than what is in or not in the loaded app_list_strings. $mb->getPackage($_REQUEST['view_package'])->loadModuleTitles(); $module = $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $moduleName = empty($module->key_name) ? $module->getModuleName() : $module->key_name; $this->smarty->assign('view_package', $_REQUEST['view_package']); $mbvardefs = $module->getVardefs(); $fields = $mbvardefs['fields']; require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php'; $relatableModules = UndeployedRelationships::findRelatableModules(); $appStrings = $module->getModStrings($selected_lang); } ksort($relatableModules); $lhs_subpanels = $module->getProvidedSubpanels(); // Fix to re-add sorting of the subpanel names so that the 'default' subpanel always appears first in the list. // This assumes that subpanels are usually named ForXYZ which is the case currently, and hence 'default' will be sorted first. //I f this assumption is incorrect, then a better solution would be to remove 'default' from the subpanel list, then sort, and finally array_unshift it back on. natcasesort($lhs_subpanels); $cardinality = array(MB_ONETOONE => translate('LBL_ONETOONE'), MB_ONETOMANY => translate('LBL_ONETOMANY'), MB_MANYTOONE => translate('LBL_MANYTOONE'), MB_MANYTOMANY => translate('LBL_MANYTOMANY')); if (!$this->fromModuleBuilder) { unset($cardinality[MB_MANYTOONE]); } $relationships = $module->getRelationships(); // if a description for this relationship already exists, then load it so it can be modified if (!empty($_REQUEST['relationship_name'])) { $relationship = $relationships->get($_REQUEST['relationship_name']); $relationship->setName($_REQUEST['relationship_name']); $definition = $relationship->getDefinition(); if (!$this->fromModuleBuilder) { $modStrings = return_module_language($selected_lang, $relationship->rhs_module, true); $definition['lhs_label'] = isset($modStrings[$relationship->getTitleKey()]) ? $modStrings[$relationship->getTitleKey()] : $relationship->lhs_module; $modStrings = return_module_language($selected_lang, $relationship->lhs_module, true); $definition['rhs_label'] = isset($modStrings[$relationship->getTitleKey(true)]) ? $modStrings[$relationship->getTitleKey(true)] : $relationship->rhs_module; } else { #30624 if (!empty($_REQUEST['rhs_module'])) { $definition['rhs_label'] = $_REQUEST['rhs_module']; } } } else { $definition = array(); $firstModuleDefinition = each($relatableModules); $definition['rhs_module'] = $firstModuleDefinition['key']; $definition['lhs_module'] = $moduleName; $definition['lhs_label'] = translate($moduleName); $definition['relationship_type'] = MB_MANYTOMANY; } // load the relationship from post - required as we can call view.relationship.php from Ajax when changing the rhs_module for example $definition = $this->overrideDefinitionFromPOST($definition); if (empty($definition['rhs_label'])) { $definition['rhs_label'] = translate($definition['rhs_module']); } if (empty($definition['lhs_label'])) { $definition['lhs_label'] = translate($definition['lhs_module']); } $relationship = RelationshipFactory::newRelationship($definition); $rhs_subpanels = $relatableModules[$relationship->rhs_module]; // Fix to re-add sorting of the subpanel names so that the 'default' subpanel always appears first in the list. This assumes that subpanels are usually named ForXYZ which is the case currently, and hence 'default' will be sorted first. If this assumption is incorrect, then a better solution would be to remove 'default' from the subpanel list, then sort, and finally array_unshift it back on. natcasesort($rhs_subpanels); if (empty($_REQUEST['relationship_name'])) { // tidy up the options for the view based on the modules participating in the relationship and the cardinality // some modules (e.g., Knowledge Base/KBDocuments) lack subpanels. That means they can't be the lhs of a 1-many or many-many, or the rhs of a many-many for example // fix up the available cardinality options $relationship_type = $relationship->getType(); if (count($lhs_subpanels) == 0 || count($rhs_subpanels) == 0) { unset($cardinality[MB_MANYTOMANY]); } if (count($rhs_subpanels) == 0) { unset($cardinality[MB_ONETOMANY]); } if (isset($definition['rhs_module']) && $definition['rhs_module'] == 'Activities') { $cardinality = array(MB_ONETOMANY => translate('LBL_ONETOMANY')); } //Bug 23139, Campaigns module current cannot display custom subpanels, so we need to ban it from any //relationships that would require a new subpanel to be shown in Campaigns. if (isset($definition['lhs_module']) && $definition['lhs_module'] == 'Campaigns') { unset($cardinality[MB_MANYTOMANY]); unset($cardinality[MB_ONETOMANY]); } if (isset($definition['rhs_module']) && $definition['rhs_module'] == 'Campaigns' && isset($cardinality[MB_MANYTOMANY])) { unset($cardinality[MB_MANYTOMANY]); unset($cardinality[MB_MANYTOONE]); } if (!isset($cardinality[$relationship->getType()])) { end($cardinality); $definition['relationship_type'] = key($cardinality); $relationship = RelationshipFactory::newRelationship($definition); } $this->smarty->assign('is_new', true); } else { $this->smarty->assign('is_new', false); } //Remove Activities if one-to-many is not availible if (!isset($cardinality[MB_ONETOMANY]) && isset($relatableModules['Activities'])) { unset($relatableModules['Activities']); } // now enforce the relationship_only requirement - that is, only construct the underlying relationship and link fields, and not the UI, if the subpanel code will have troubles displaying the UI $relationships->enforceRelationshipOnly($relationship); $this->smarty->assign('view_module', $_REQUEST['view_module']); $this->smarty->assign('rel', $relationship->getDefinition()); $this->smarty->assign('mod_strings', $GLOBALS['mod_strings']); $this->smarty->assign('module_key', $relationship->lhs_module); $this->smarty->assign('cardinality', array_keys($cardinality)); $this->smarty->assign('translated_cardinality', $cardinality); $this->smarty->assign('selected_cardinality', translate($relationship->getType())); $relatable = array(); foreach ($relatableModules as $name => $dummy) { $relatable[$name] = translate($name); } unset($relatable['KBDocuments']); natcasesort($relatable); $this->smarty->assign('relatable', array_keys($relatable)); $this->smarty->assign('translated_relatable', $relatable); $this->smarty->assign('rhspanels', $rhs_subpanels); $this->smarty->assign('lhspanels', $lhs_subpanels); $this->smarty->assign('selected_lang', $selected_lang); $this->smarty->assign('available_languages', get_languages()); switch ($relationship->relationship_type) { case MB_ONETOONE: break; case MB_ONETOMANY: if (empty($relationship->relationship_column_name)) { $validRoleColumnFields = array(); foreach ($fields as $field) { $validRoleColumnFields[] = $field; } $this->smarty->assign('relationship_role_column_enum', $validRoleColumnFields); } if (!empty($relationship->relationship_role_column_value)) { $this->smarty->assign('relationship_role_column_value', $relationship->relationship_role_column_value); } break; case MB_MANYTOMANY: if (!empty($relationship->relationship_role_column_value)) { $this->smarty->assign('relationship_role_column_value', $relationship->relationship_role_column_value); } break; } //see if we use the new system if (isset($_REQUEST['json']) && $_REQUEST['json'] == 'false') { echo $this->smarty->fetch('modules/ModuleBuilder/tpls/studioRelationship.tpl'); } else { $ac->addSection('east', $module->name . ' ' . $GLOBALS['mod_strings']['LBL_RELATIONSHIPS'], $this->smarty->fetch('modules/ModuleBuilder/tpls/studioRelationship.tpl')); echo $ac->getJavascript(); } }
function display() { $this->fromModuleBuilder = isset($_REQUEST['MB']) || !empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio'; if ($this->fromModuleBuilder) { return; //no support for MB } global $current_user; global $mod_strings; $smarty = new Sugar_Smarty(); $smarty->assign('title', $mod_strings['LBL_DEVELOPER_TOOLS']); $smarty->assign('question', $mod_strings['LBL_QUESTION_ADD_LAYOUT']); $smarty->assign('mod_strings', $mod_strings); $module_name = $_REQUEST['view_module']; // set up language files //$smarty->assign ( 'language', $parser->getLanguage() ) ; // for sugar_translate in the smarty template //$smarty->assign('from_mb',$this->fromModuleBuilder); $mb = new ModuleBuilder(); if (!isset($_REQUEST['view_package'])) { $_REQUEST['view_package'] = 'studio'; } $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $package = $mb->packages[$_REQUEST['view_package']]; $package->loadModuleTitles(); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_STUDIO', 'ModuleBuilder'), 'ModuleBuilder.main("studio")'); $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")'); $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=addlayout&layouts=1&view_module=' . $module_name . '")'); $ajax->addCrumb($mod_strings['LBL_ADD_LAYOUT'], ''); //$ajax->addSection ( 'center', $moduleName . ' ' . translate('LBL_ADD_LAYOUT'), $html = $smarty->fetch('modules/ModuleBuilder/tpls/addlayoutdone.tpl'); $html .= "<script>ModuleBuilder.treeRefresh('Studio')</script>"; $ajax->addSection('center', $mod_strings['LBL_ADD_LAYOUT'], $html); echo $ajax->getJavascript(); }