public function run()
 {
     // Only run this when coming from a version lower than 7.2.0
     if (version_compare($this->from_version, '7.2', '>=')) {
         return;
     }
     // Find all the classes we want to convert.
     $customModules = array();
     $customFiles = glob('modules' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*_sugar.php', GLOB_NOSORT);
     foreach ($customFiles as $customFile) {
         $moduleName = str_replace('_sugar', '', pathinfo($customFile, PATHINFO_FILENAME));
         $customModules[] = $moduleName;
     }
     $customModules = array_flip($customModules);
     // Go through all the modules using the ModuleBuilder
     $mB = new ModuleBuilder();
     $mB->getPackages();
     foreach ($mB->packages as $package) {
         $this->log("FixClassConstructor: Found a custom package {$package->name}");
         foreach ($package->modules as $mbModule) {
             if (!isset($customModules[$mbModule->key_name])) {
                 continue;
             }
             $this->replaceCustomModuleClasses($mbModule);
             unset($customModules[$mbModule->key_name]);
         }
     }
     $customModules = array_flip($customModules);
     // Treat modules that have not been found by the ModuleBuilder
     foreach ($customModules as $moduleName) {
         $this->log("FixClassConstructor: Found a custom module {$moduleName} not recognized by ModuleBuilder");
         $this->replaceCustomModuleClassesByReflection($moduleName);
     }
 }
Beispiel #2
0
 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 $app_strings, $current_user, $mod_strings, $app_list_strings;
     $smarty = new Sugar_Smarty();
     require_once 'include/JSON.php';
     //Load the field list from the target module
     $selected_lang = $_SESSION['authenticated_user_language'];
     $vardef = array();
     //Copy app strings
     $my_list_strings = array_merge($app_list_strings);
     $child = $_REQUEST['field'];
     //if we are using ModuleBuilder then process the following
     if (!empty($_REQUEST['package']) && $_REQUEST['package'] != 'studio') {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $this->module = $mb->getPackageModule($_REQUEST['package'], $_REQUEST['view_module']);
         $vardef = $this->module->getVardefs();
         $this->module->mblanguage->generateAppStrings(false);
         $my_list_strings = array_merge($my_list_strings, $this->module->mblanguage->appListStrings[$selected_lang . '.lang.php']);
     } else {
         $vardef = BeanFactory::getBean($_REQUEST['view_module'])->field_defs;
     }
     foreach ($my_list_strings as $key => $value) {
         if (!is_array($value)) {
             unset($my_list_strings[$key]);
         }
     }
     $parents = $this->getParentDDs($vardef, $child, $my_list_strings);
     $visibility_grid = !empty($vardef[$child]['visibility_grid']) ? $vardef[$child]['visibility_grid'] : array();
     $smarty->assign('app_strings', $app_strings);
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('parents', JSON::encode($parents));
     $smarty->assign('visibility_grid', JSON::encode($visibility_grid));
     $smarty->display('modules/ExpressionEngine/tpls/ddEditor.tpl');
 }
 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveDropDown($params)
 {
     require_once 'modules/Administration/Common.php';
     $emptyMarker = translate('LBL_BLANK');
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $type = $_REQUEST['view_package'];
     $dir = '';
     $dropdown_name = $params['dropdown_name'];
     $json = getJSONobj();
     $list_value = str_replace('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $params['list_value']);
     //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
     $dropdown = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
     if (array_key_exists($emptyMarker, $dropdown)) {
         unset($dropdown[$emptyMarker]);
         $dropdown[''] = '';
     }
     if ($type != 'studio') {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($params['view_package'], $params['view_module']);
         $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
         //Can't use synch on selected lang as we want to overwrite values, not just keys
         $module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
         $module->mblanguage->save($module->key_name);
         // tyoung - key is required parameter as of
     } else {
         $contents = return_custom_app_list_strings_file_contents($selected_lang);
         $my_list_strings = return_app_list_strings_language($selected_lang);
         if ($selected_lang == $GLOBALS['current_language']) {
             $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
         }
         //write to contents
         $contents = str_replace("?>", '', $contents);
         if (empty($contents)) {
             $contents = "<?php";
         }
         //add new drop down to the bottom
         if (!empty($params['use_push'])) {
             //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
             foreach ($dropdown as $key => $value) {
                 //only if the value has changed or does not exist do we want to add it this way
                 if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
                     //clear out the old value
                     $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
                     $contents = preg_replace($pattern_match, "\n", $contents);
                     //add the new ones
                     $contents .= "\n\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
                 }
             }
         } else {
             //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
             $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
             $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
         }
         if (!empty($dir) && !is_dir($dir)) {
             $continue = mkdir_recursive($dir);
         }
         save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
     }
     sugar_cache_reset();
 }
 public function __construct()
 {
     parent::__construct();
     foreach ($this->vars as $var) {
         if (!isset($_REQUEST[$var])) {
             sugar_die("Required paramter {$var} not set in ViewRelFields");
         }
         $this->{$var} = $_REQUEST[$var];
     }
     $mb = new ModuleBuilder();
     $this->package = empty($_REQUEST['package']) || $_REQUEST['package'] == 'studio' ? "" : $mb->getPackage($_REQUEST['package']);
 }
 /**
  * The constructor
  * @param string $subpanelName
  * @param string $moduleName
  * @param string $packageName
  * @param string $client
  */
 public function __construct($subpanelName, $moduleName, $packageName, $client = '')
 {
     $this->mdc = new MetaDataConverter();
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     $this->client = empty($client) ? 'base' : $client;
     // TODO: history
     $this->historyPathname = "custom/history/modulebuilder/packages/{$packageName}/modules/{$moduleName}/metadata/" . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module = $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $templates = $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_subpanel_def = "include/SugarObjects/templates/{$template_def}/clients/{$this->client}/views/subpanel-list/subpanel-list.php";
     $viewdefs = array();
     if (file_exists($template_subpanel_def)) {
         include $template_subpanel_def;
         if (isset($viewdefs['<module_name>'])) {
             $viewdefs[$this->module->key_name] = $viewdefs['<module_name>'];
             unset($viewdefs['<module_name>']);
         }
     }
     if ($subpanelName != 'default' && !stristr($subpanelName, 'for')) {
         $subpanelName = 'For' . ucfirst($subpanelName);
     }
     $this->sidecarSubpanelName = $this->mdc->fromLegacySubpanelName($subpanelName);
     // Set the original view defs from the loaded file if there are any
     $this->_originalViewdefs = $this->getNewViewDefs($viewdefs);
     $this->sidecarFile = $this->module->getSubpanelFilePath($subpanelName, $this->client);
     if (file_exists($this->sidecarFile)) {
         include $this->sidecarFile;
     }
     $viewdefs = empty($viewdefs) ? array() : $viewdefs;
     $this->_viewdefs = $this->getNewViewDefs($viewdefs);
     $this->_fielddefs = $this->getFieldDefs();
     $this->_paneldefs = isset($this->_viewdefs['panels']) ? $this->_viewdefs['panels'] : array();
     // Set the global mod_strings directly as Sugar does not automatically load the
     // language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
 /**
  * Testing ModuleBuilder::getModuleAliases
  * 
  * @dataProvider getModuleAliasesData
  * @group 46152
  */
 public function testGetModuleAliases($module, $needAliases)
 {
     $aliases = ModuleBuilder::getModuleAliases($module);
     foreach ($needAliases as $needAlias) {
         $this->assertContains($needAlias, $aliases);
     }
 }
 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()
 {
     $this->ss = new Sugar_Smarty();
     foreach ($this->vars as $var) {
         if (isset($_REQUEST[$var])) {
             $this->{$var} = $_REQUEST[$var];
             $this->ss->assign($var, $_REQUEST[$var]);
         }
     }
     $mapping = empty($_REQUEST['mapping']) ? array() : json_decode(html_entity_decode($_REQUEST['mapping']), true);
     $this->ss->assign("mapping", $mapping);
     if (empty($_REQUEST['package']) || $_REQUEST['package'] == 'studio') {
         $sm = StudioModuleFactory::getStudioModule($_REQUEST['targetModule']);
         $fields = $sm->getFields();
         if (!empty($fields[$this->parentList]) && !empty($fields[$this->parentList]['options'])) {
             $this->parentList = $fields[$this->parentList]['options'];
         }
         $parentOptions = translate($this->parentList);
         $childOptions = translate($this->childList);
     } else {
         $mb = new ModuleBuilder();
         $moduleName = $_REQUEST['targetModule'];
         $sm = $mb->getPackageModule($_REQUEST['package'], $moduleName);
         $sm->getVardefs();
         $fields = $sm->mbvardefs->vardefs['fields'];
         if (!empty($fields[$this->parentList]) && !empty($fields[$this->parentList]['options'])) {
             $this->parentList = $fields[$this->parentList]['options'];
         }
         $parentOptions = $this->getMBOptions($this->parentList, $sm);
         $childOptions = $this->getMBOptions($this->childList, $sm);
     }
     $this->ss->assign("parent_list_options", $parentOptions);
     $parentOptionsArray = array();
     foreach ($parentOptions as $value => $label) {
         $parentOptionsArray[] = array("value" => $value, "label" => $label);
     }
     $this->ss->assign("parentOptions", json_encode($parentOptions));
     $this->ss->assign("child_list_options", $childOptions);
     $childOptionsArray = array();
     foreach ($childOptions as $value => $label) {
         $childOptionsArray[] = array("value" => $value, "label" => $label);
     }
     $this->ss->assign("childOptions", json_encode($childOptionsArray));
     $this->ss->display("modules/ModuleBuilder/tpls/depdropdown.tpl");
 }
 function __construct($subpanelName, $moduleName, $packageName)
 {
     // Needed to tap into the abstract for loading and saving
     $this->_view = 'subpanel_layout';
     $this->_fileVariables['subpanel_layout'] = 'subpanel_layout';
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $templates =& $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $templateFile = 'include/SugarObjects/templates/' . $template_def . '/metadata/subpanels/default.php';
     if (file_exists($templateFile)) {
         $subpanel_layout = $this->_loadFromFile($templateFile);
         if (!empty($subpanel_layout['list_fields'])) {
             $originalDef = $subpanel_layout['list_fields'];
             // This has to be done early because once they are in field defs
             // they won't be picked up
             $this->setNonFields($originalDef);
             $this->_mergeFielddefs($this->_fielddefs, $originalDef);
         }
     }
     $filename = $this->module->getSubpanelFilePath($this->_subpanelName, '', true);
     $subpanel_layout = $this->_loadFromFile($filename);
     $this->_originalViewdefs = $subpanel_layout['list_fields'];
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
 function __construct($subpanelName, $moduleName, $packageName)
 {
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $subpanel_layout = $this->module->getAvailibleSubpanelDef($this->_subpanelName);
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings());
 }
 /** {@inheritDoc} */
 public function getPath()
 {
     $path = $this->file->getPath();
     switch ($this->location) {
         case MB_HISTORYMETADATALOCATION:
             $path = array_merge(explode('/', trim(MetaDataFiles::$paths[MB_WORKINGMETADATALOCATION], '/')), array('modulebuilder', 'packages', $this->package), $path);
             break;
         default:
             // get the module again, all so we can call this method statically without relying
             // on the module stored in the class variables
             require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
             $mb = new ModuleBuilder();
             array_shift($path);
             $module = array_shift($path);
             $path = array_merge(explode('/', trim($mb->getPackageModule($this->package, $module)->getModuleDir(), '/')), $path);
     }
     return $path;
 }
 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();
 }
 public function display()
 {
     global $mod_strings, $locale;
     $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);
     $mbModule = $package->modules[$module_name];
     if (!empty($_REQUEST['selected_lang'])) {
         $selected_lang = $_REQUEST['selected_lang'];
     } else {
         $selected_lang = $locale->getAuthenticatedUserLanguage();
     }
     //need to change the following to interface with MBlanguage.
     $smarty->assign('MOD', $mbModule->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&view_package=' . $package->name . '&view_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();
 }
Beispiel #15
0
 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();
     }
 }
 /**
  * The constructor
  * @param string $moduleName
  * @param string $packageName
  * @param string $client
  */
 public function __construct($moduleName, $packageName, $client = '')
 {
     $this->_moduleName = $moduleName;
     $this->client = empty($client) ? 'base' : $client;
     // TODO: history
     $this->historyPathname = "custom/history/modulebuilder/packages/{$packageName}/modules/{$moduleName}/clients/{$client}/filters/default/" . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module = $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $templates = $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_filter_def = "include/SugarObjects/templates/{$template_def}/clients/{$this->client}/filters/default/default.php";
     if (file_exists($template_filter_def)) {
         include $template_filter_def;
     }
     $this->sidecarFile = "{$this->module->getModuleDir()}/clients/{$client}/filters/default/default.php";
     if (file_exists($this->sidecarFile)) {
         include $this->sidecarFile;
     }
     $viewdefs = empty($viewdefs) ? array('fields' => array()) : $viewdefs;
     $this->_viewdefs = $this->getNewViewDefs($viewdefs);
     $this->_fielddefs = $this->getFieldDefs();
     $this->_paneldefs = $this->_viewdefs;
     // Set the global mod_strings directly as Sugar does not automatically load the
     // language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
Beispiel #17
0
 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 __construct($subpanelName, $moduleName, $packageName)
 {
     $this->_subpanelName = $subpanelName;
     $this->_moduleName = $moduleName;
     // TODO: history
     $this->historyPathname = 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . self::HISTORYFILENAME;
     $this->_history = new History($this->historyPathname);
     //get the bean from ModuleBuilder
     $mb = new ModuleBuilder();
     $this->module =& $mb->getPackageModule($packageName, $moduleName);
     $this->module->mbvardefs->updateVardefs();
     $this->_fielddefs =& $this->module->mbvardefs->vardefs['fields'];
     $templates =& $this->module->config['templates'];
     $template_def = "";
     foreach ($templates as $template => $a) {
         if ($a === 1) {
             $template_def = $template;
         }
     }
     $template_subpanel_def = 'include/SugarObjects/templates/' . $template_def . '/metadata/subpanels/default.php';
     if (file_exists($template_subpanel_def)) {
         include $template_subpanel_def;
         if (!empty($subpanel_layout['list_fields'])) {
             $this->_mergeFielddefs($this->_fielddefs, $subpanel_layout['list_fields']);
         }
     }
     $subpanel_layout = $this->module->getAvailibleSubpanelDef($this->_subpanelName);
     $this->_viewdefs =& $subpanel_layout['list_fields'];
     $this->_mergeFielddefs($this->_fielddefs, $this->_viewdefs);
     // Set the global mod_strings directly as Sugar does not automatically load the language files for undeployed modules (how could it?)
     $selected_lang = 'en_us';
     if (isset($GLOBALS['current_language']) && !empty($GLOBALS['current_language'])) {
         $selected_lang = $GLOBALS['current_language'];
     }
     $GLOBALS['mod_strings'] = array_merge($GLOBALS['mod_strings'], $this->module->getModStrings($selected_lang));
 }
 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()
 {
     $smarty = new Sugar_Smarty();
     global $mod_strings;
     $bak_mod_strings = $mod_strings;
     $smarty->assign('mod_strings', $mod_strings);
     $module_name = $_REQUEST['view_module'];
     if (!isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
         //$this->loadPackageHelp($module_name);
         $studioClass = new stdClass();
         $studioClass->name = $module_name;
         global $beanList;
         $objectName = $beanList[$module_name];
         if ($objectName == 'aCase') {
             // Bug 17614 - renamed aCase as Case in vardefs for backwards compatibililty with 451 modules
             $objectName = 'Case';
         }
         VardefManager::loadVardef($module_name, $objectName, true);
         global $dictionary;
         $f = array($mod_strings['LBL_HCUSTOM'] => array(), $mod_strings['LBL_HDEFAULT'] => array());
         // TODO: replace this section to select fields to list with the algorithm in AbstractMetaDataImplmentation::validField()
         $def = $this->cullFields($dictionary[$objectName]['fields']);
         foreach ($dictionary[$objectName]['fields'] as $def) {
             if ($this->isValidStudioField($def)) {
                 //Custom relate fields will have a non-db source, but custom_module set
                 if (isset($def['source']) && $def['source'] == 'custom_fields' || isset($def['custom_module'])) {
                     $f[$mod_strings['LBL_HCUSTOM']][$def['name']] = $def;
                 } else {
                     $f[$mod_strings['LBL_HDEFAULT']][$def['name']] = $def;
                 }
             }
         }
         $studioClass->mbvardefs->vardefs['fields'] = $f;
         $smarty->assign('module', $studioClass);
         $package = new stdClass();
         $package->name = '';
         $smarty->assign('package', $package);
         $ajax = new AjaxCompose();
         $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
         $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")');
         $ajax->addCrumb($mod_strings['LBL_FIELDS'], '');
         $ajax->addSection('center', $mod_strings['LBL_EDIT_FIELDS'], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
         $_REQUEST['field'] = '';
         echo $ajax->getJavascript();
     } else {
         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];
         $this->loadPackageHelp($module_name);
         $this->module->getVardefs(true);
         $this->module->mbvardefs->vardefs['fields'] = array_reverse($this->module->mbvardefs->vardefs['fields'], true);
         $loadedFields = array();
         foreach ($this->module->mbvardefs->vardefs['fields'] as $k => $v) {
             if ($k != $module_name) {
                 $titleLBL[$k] = translate("LBL_" . strtoupper($k), 'ModuleBuilder');
             } else {
                 $titleLBL[$k] = $k;
             }
             foreach ($v as $field => $def) {
                 if (isset($loadedFields[$field])) {
                     unset($this->module->mbvardefs->vardefs['fields'][$k][$field]);
                 } else {
                     $loadedFields[$field] = true;
                 }
             }
         }
         $this->module->mbvardefs->vardefs['fields'][$module_name] = $this->cullFields($this->module->mbvardefs->vardefs['fields'][$module_name]);
         if (file_exists($this->module->path . '/language/' . $GLOBALS['current_language'] . '.lang.php')) {
             include $this->module->path . '/language/' . $GLOBALS['current_language'] . '.lang.php';
             $this->module->setModStrings($GLOBALS['current_language'], $mod_strings);
         } elseif (file_exists($this->module->path . '/language/en_us.lang.php')) {
             include $this->module->path . '/language/en_us.lang.php';
             $this->module->setModStrings('en_us', $mod_strings);
         }
         $smarty->assign('title', $titleLBL);
         $smarty->assign('package', $package);
         $smarty->assign('module', $this->module);
         $smarty->assign('editLabelsMb', '1');
         //need to merge MB labels and studio labels. quick fix for now.
         $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&view_package=' . $package->name . '&view_module=' . $module_name . '")');
         $ajax->addCrumb($bak_mod_strings['LBL_FIELDS'], '');
         $ajax->addSection('center', $bak_mod_strings["LBL_FIELDS"], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
         $_REQUEST['field'] = '';
         echo $ajax->getJavascript();
     }
 }
Beispiel #21
0
 function constructSmarty($parser)
 {
     global $mod_strings;
     $smarty = new Sugar_Smarty();
     $smarty->assign('translate', true);
     $smarty->assign('language', $parser->getLanguage());
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('module', "ModuleBuilder");
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $smarty->assign('action', 'listViewSave');
     $smarty->assign('view_module', $this->editModule);
     if (!empty($this->subpanel)) {
         $smarty->assign('subpanel', $this->subpanel);
         $smarty->assign('subpanelLabel', $this->subpanelLabel);
         if (!$this->fromModuleBuilder) {
             $subList = SubPanel::getModuleSubpanels($this->editModule);
             $subRef = $subList[strtolower($this->subpanel)];
             $subTitleKey = !empty($subRef) ? $subRef : "LBL_" . strtoupper($this->subpanel) . "_SUBPANEL_TITLE";
             $subTitle = !empty($subRef) ? translate($subTitleKey, $this->editModule) : UCfirst($this->subpanel);
             $smarty->assign('subpanel_label', $subTitleKey);
             $smarty->assign('subpanel_title', $subTitle);
         }
     }
     $helpName = $this->subpanel ? 'subPanelEditor' : 'listViewEditor';
     $smarty->assign('helpName', $helpName);
     $smarty->assign('helpDefault', 'modify');
     $smarty->assign('title', $this->_constructTitle());
     $groups = array();
     foreach ($parser->columns as $column => $function) {
         // update this so that each field has a properties set
         // properties are name, value, title (optional)
         $groups[$GLOBALS['mod_strings'][$column]] = $parser->{$function}();
         // call the parser functions to populate the list view columns, by default 'default', 'available' and 'hidden'
     }
     foreach ($groups as $groupKey => $group) {
         foreach ($group as $fieldKey => $field) {
             if (isset($field['width'])) {
                 if (substr($field['width'], -1, 1) == '%') {
                     $groups[$groupKey][$fieldKey]['width'] = substr($field['width'], 0, strlen($field['width']) - 1);
                 }
             }
         }
     }
     $smarty->assign('groups', $groups);
     $smarty->assign('from_mb', $this->fromModuleBuilder);
     global $image_path;
     $imageSave = SugarThemeRegistry::current()->getImage('studio_save', '', null, null, '.gif', $mod_strings['LBL_BTN_SAVE']);
     //        $imageHelp = SugarThemeRegistry::current()->getImage('help') ;
     $history = $parser->getHistory();
     $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")";
     if ($this->subpanel) {
         $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->subpanel}\")";
     }
     $restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'";
     if ($this->subpanel) {
         $restoreAction = "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"{$this->subpanel}\")'";
     }
     $buttons = array();
     $buttons[] = array('id' => 'savebtn', 'name' => 'savebtn', 'image' => $imageSave, 'text' => !$this->fromModuleBuilder ? $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'] : $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");if (countListFields()==0) ModuleBuilder.layoutValidation.popup() ; else ModuleBuilder.handleSave(\"edittabs\" )'");
     $buttons[] = array('id' => 'spacer', 'width' => '50px');
     $buttons[] = array('id' => 'historyBtn', 'name' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='{$histaction}'");
     $buttons[] = array('id' => 'historyDefault', 'name' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => $restoreAction);
     $smarty->assign('buttons', $this->_buildImageButtons($buttons));
     $editImage = SugarThemeRegistry::current()->getImage('edit_inline', '', null, null, '.gif', $mod_strings['LBL_EDIT']);
     $smarty->assign('editImage', $editImage);
     $deleteImage = SugarThemeRegistry::current()->getImage('delete_inline', '', null, null, '.gif', $mod_strings['LBL_MB_DELETE']);
     $smarty->assign('deleteImage', $deleteImage);
     $smarty->assign('MOD', $GLOBALS['mod_strings']);
     if ($this->fromModuleBuilder) {
         $smarty->assign('MB', true);
         $smarty->assign('view_package', $_REQUEST['view_package']);
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
         if ($this->subpanel) {
             if (isset($_REQUEST['local'])) {
                 $smarty->assign('local', '1');
             }
             $smarty->assign("subpanel", $this->subpanel);
         } else {
             $smarty->assign('description', $GLOBALS['mod_strings']['LBL_LISTVIEW_DESCRIPTION']);
         }
     } else {
         if ($this->subpanel) {
             $smarty->assign("subpanel", "{$this->subpanel}");
         } else {
             $smarty->assign('description', $GLOBALS['mod_strings']['LBL_LISTVIEW_DESCRIPTION']);
         }
     }
     return $smarty;
 }
Beispiel #22
0
 function action_get_app_list_string()
 {
     require_once 'include/JSON.php';
     $json = new JSON();
     if (isset($_REQUEST['key']) && !empty($_REQUEST['key'])) {
         $key = $_REQUEST['key'];
         $value = array();
         if (!empty($GLOBALS['app_list_strings'][$key])) {
             $value = $GLOBALS['app_list_strings'][$key];
         } else {
             $package_strings = array();
             if (!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio' && !empty($_REQUEST['view_module'])) {
                 require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
                 $mb = new ModuleBuilder();
                 $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
                 $lang = $GLOBALS['current_language'];
                 $module->mblanguage->generateAppStrings(false);
                 $package_strings = $module->mblanguage->appListStrings[$lang . '.lang.php'];
                 if (isset($package_strings[$key]) && is_array($package_strings[$key])) {
                     $value = $package_strings[$key];
                 }
             }
         }
         echo $json->encode($value);
     }
 }
 /**
  * Save label for id field
  *
  * @param string $idLabelName
  * @param DynamicField $df
  */
 protected function saveIdLabel($idLabelName, $df)
 {
     if ($df instanceof DynamicField) {
         $module = $df->module;
     } elseif ($df instanceof MBModule) {
         $module = $df->name;
     } else {
         Log::fatal('Unsupported DynamicField type');
     }
     $viewPackage = isset($df->package) ? $df->package : null;
     $idLabelValue = string_format($GLOBALS['mod_strings']['LBL_RELATED_FIELD_ID_NAME_LABEL'], array($this->label_value, $GLOBALS['app_list_strings']['moduleListSingular'][$this->ext2]));
     $idFieldLabelArr = array("label_{$idLabelName}" => $idLabelValue);
     foreach (ModuleBuilder::getModuleAliases($module) as $moduleName) {
         if ($df instanceof DynamicField) {
             $parser = new ParserLabel($moduleName, $viewPackage);
             $parser->handleSave($idFieldLabelArr, $GLOBALS['current_language']);
         } elseif ($df instanceof MBModule) {
             $df->setLabel($GLOBALS['current_language'], $idLabelName, $idLabelValue);
             $df->save();
         }
     }
 }
 protected function getRelateFieldDefinition($sourceModule, $relationshipName, $vnameLabel = '')
 {
     $vardef = array();
     $vardef['name'] = $relationshipName . "_name";
     // must end in _name for the QuickSearch code in TemplateHandler->createQuickSearchCode
     $vardef['type'] = 'relate';
     $vardef['source'] = 'non-db';
     if (!empty($vnameLabel)) {
         $vardef['vname'] = 'LBL_' . strtoupper($relationshipName . '_FROM_' . $vnameLabel) . '_TITLE';
     } else {
         $vardef['vname'] = 'LBL_' . strtoupper($relationshipName . '_FROM_' . $sourceModule) . '_TITLE';
     }
     $vardef['save'] = true;
     // the magic value to tell SugarBean to save this relate field even though it is not listed in the $relationship_fields array
     // id_name matches the join_key_ column in the relationship table for the sourceModule - that is, the column in the relationship table containing the id of the corresponding field in the source module's table (vardef['table'])
     $vardef['id_name'] = $this->getIDName($sourceModule);
     // link cannot match id_name otherwise the $bean->$id_name value set from the POST is overwritten by the Link object created by this 'link' entry
     $vardef['link'] = $relationshipName;
     // the name of the link field that points to the relationship - required for the save to function
     $vardef['table'] = $this->getTablename($sourceModule);
     $vardef['module'] = $sourceModule;
     require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php';
     $parsedModuleName = AbstractRelationships::parseDeployedModuleName($sourceModule);
     // now determine the appropriate 'rname' field for this relate
     // the 'rname' points to the field in source module that contains the displayable name for the record
     // usually this is 'name' but sometimes it is not...
     $vardef['rname'] = 'name';
     if (isset($parsedModuleName['packageName'])) {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $module = $mb->getPackageModule($parsedModuleName['packageName'], $parsedModuleName['moduleName']);
         if (in_array('file', array_keys($module->config['templates']))) {
             $vardef['rname'] = 'document_name';
         }
     } else {
         switch (strtolower($sourceModule)) {
             case 'prospects':
                 $vardef['rname'] = 'account_name';
                 break;
             case 'documents':
                 $vardef['rname'] = 'document_name';
                 break;
             case 'kbdocuments':
                 $vardef['rname'] = 'kbdocument_name';
                 break;
             case 'leads':
             case 'contacts':
                 // special handling as these modules lack a name column in the database; instead 'name' refers to a non-db field that concatenates first_name and last_name
                 // luckily, the relate field mechanism can handle this with an equivalent additional db_concat_fields entry
                 $vardef['rname'] = 'name';
                 $vardef['db_concat_fields'] = array(0 => 'first_name', 1 => 'last_name');
                 break;
             default:
                 // now see if we have any module inheriting from the 'file' template - records in file-type modules are named by the document_name field, not the usual 'name' field
                 $object = $GLOBALS['beanList'][$sourceModule];
                 require_once $GLOBALS['beanFiles'][$object];
                 $bean = new $object();
                 if (isset($GLOBALS['dictionary'][$object]['templates']) && in_array('file', $GLOBALS['dictionary'][$object]['templates'])) {
                     $vardef['rname'] = 'document_name';
                 }
         }
     }
     return $vardef;
 }
Beispiel #25
0
 function generateSmarty()
 {
     //get the selected language
     $selected_lang = !empty($_REQUEST['dropdown_lang']) ? $_REQUEST['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $vardef = array();
     $package_name = 'studio';
     $package_strings = array();
     $new = false;
     $my_list_strings = return_app_list_strings_language($selected_lang);
     //		$my_list_strings = $GLOBALS['app_list_strings'];
     //if we are using ModuleBuilder then process the following
     if (!empty($_REQUEST['view_package']) && $_REQUEST['view_package'] != 'studio') {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $this->module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         $package =& $mb->packages[$_REQUEST['view_package']];
         $package_name = $package->name;
         $this->module->getVardefs();
         if (empty($_REQUEST['dropdown_name']) && !empty($_REQUEST['field'])) {
             $new = true;
             $_REQUEST['dropdown_name'] = $_REQUEST['field'] . '_list';
         }
         $vardef = !empty($this->module->mbvardefs->fields[$_REQUEST['dropdown_name']]) ? $this->module->mbvardefs->fields[$_REQUEST['dropdown_name']] : array();
         $this->module->mblanguage->generateAppStrings(false);
         $my_list_strings = array_merge($my_list_strings, $this->module->mblanguage->appListStrings[$selected_lang . '.lang.php']);
     }
     foreach ($my_list_strings as $key => $value) {
         if (!is_array($value)) {
             unset($my_list_strings[$key]);
         }
     }
     $dropdowns = array_keys($my_list_strings);
     asort($dropdowns);
     $keys = array_keys($dropdowns);
     $first_string = $my_list_strings[$dropdowns[$keys[0]]];
     if (!empty($cf)) {
         $smarty->assign('cf', $cf);
     }
     $name = '';
     $selected_dropdown = array();
     $smarty = new Sugar_Smarty();
     $json = getJSONobj();
     if (!empty($_REQUEST['dropdown_name']) && !$new) {
         $name = $_REQUEST['dropdown_name'];
         // handle the case where we've saved a dropdown in one language, and now attempt to edit it for another language. The $name exists, but $my_list_strings[$name] doesn't
         // for now, we just treat it as if it was new. A better approach might be to use the first language version as a template for future languages
         if (!isset($my_list_strings[$name])) {
             $my_list_strings[$name] = array();
         }
         $selected_dropdown = !empty($vardef['options']) && !empty($my_list_strings[$vardef['options']]) ? $my_list_strings[$vardef['options']] : $my_list_strings[$name];
         $smarty->assign('ul_list', 'list = ' . $json->encode(array_keys($selected_dropdown)));
         $smarty->assign('dropdown_name', !empty($vardef['options']) ? $vardef['options'] : $_REQUEST['dropdown_name']);
         $smarty->assign('name', $_REQUEST['dropdown_name']);
         $smarty->assign('options', $selected_dropdown);
     } else {
         $smarty->assign('ul_list', 'list = {}');
         //we should try to find a name for this dropdown based on the field name.
         $pre_pop_name = '';
         if (!empty($_REQUEST['field'])) {
             $pre_pop_name = $_REQUEST['field'];
         }
         //ensure this dropdown name does not already exist
         $use_name = $pre_pop_name . '_list';
         for ($i = 0; $i < 100; $i++) {
             if (empty($my_list_strings[$use_name])) {
                 break;
             } else {
                 $use_name = $pre_pop_name . '_' . $i;
             }
         }
         $smarty->assign('prepopulated_name', $use_name);
     }
     $smarty->assign('module', $this->module);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('MOD', $GLOBALS['mod_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('available_languages', get_languages());
     $smarty->assign('package_name', $package_name);
     return $smarty;
 }
 public static function getFileName($view, $moduleName, $packageName, $type = MB_BASEMETADATALOCATION)
 {
     $type = strtolower($type);
     // BEGIN ASSERTIONS
     if ($type != MB_BASEMETADATALOCATION && $type != MB_HISTORYMETADATALOCATION) {
         // just warn rather than die
         $GLOBALS['log']->warning("UndeployedMetaDataImplementation->getFileName(): view type {$type} is not recognized");
     }
     // END ASSERTIONS
     $filenames = array(MB_DASHLETSEARCH => 'dashletviewdefs', MB_DASHLET => 'dashletviewdefs', MB_LISTVIEW => 'listviewdefs', MB_BASICSEARCH => 'searchdefs', MB_ADVANCEDSEARCH => 'searchdefs', MB_EDITVIEW => 'editviewdefs', MB_DETAILVIEW => 'detailviewdefs', MB_QUICKCREATE => 'quickcreatedefs', MB_POPUPSEARCH => 'popupdefs', MB_POPUPLIST => 'popupdefs');
     switch ($type) {
         case MB_HISTORYMETADATALOCATION:
             return 'custom/history/modulebuilder/packages/' . $packageName . '/modules/' . $moduleName . '/metadata/' . $filenames[$view] . '.php';
         default:
             // get the module again, all so we can call this method statically without relying on the module stored in the class variables
             $mb = new ModuleBuilder();
             $module =& $mb->getPackageModule($packageName, $moduleName);
             return $module->getModuleDir() . '/metadata/' . $filenames[$view] . '.php';
     }
 }
Beispiel #27
0
You should have received a copy of the GNU General Public License
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.

------------------------------------------------------------------

Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]  
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
*/
$moduleName = 'travel';
define('MODULE_PATH', dirname(__FILE__));
include APP_BASE_PATH . 'header.php';
include APP_BASE_PATH . 'modulejslibs.inc.php';
$options = array();
$options['setRemoteTable'] = 'true';
$moduleBuilder = new ModuleBuilder();
$moduleBuilder->addModuleOrGroup(new ModuleTab('EmployeeTravelRecord', 'EmployeeTravelRecord', 'Travel Requests', 'EmployeeTravelRecordAdapter', '', '', true, $options));
echo UIManager::getInstance()->renderModule($moduleBuilder);
$itemName = 'TravelRequest';
$moduleName = 'Travel Management';
$itemNameLower = strtolower($itemName);
$statuses = array("Approved", "Pending", "Rejected", "Cancelled");
?>
<div class="modal" id="<?php 
echo $itemNameLower;
?>
StatusModel" tabindex="-1" role="dialog" aria-labelledby="messageModelLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button>
 static function parseDeployedModuleName($deployedName)
 {
     require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
     $mb = new ModuleBuilder();
     $packageName = '';
     $moduleName = $deployedName;
     foreach ($mb->getPackageList() as $name) {
         // convert the keyName into a packageName, needed for checking to see if this is really an undeployed module, or just a module with a _ in the name...
         $package = $mb->getPackage($name);
         // seem to need to call getPackage twice to get the key correctly... TODO: figure out why...
         $key = $mb->getPackage($name)->key;
         if (strlen($key) < strlen($deployedName)) {
             $position = stripos($deployedName, $key);
             $moduleName = trim(substr($deployedName, strlen($key)), '_');
             //use trim rather than just assuming that _ is between packageName and moduleName in the deployedName
             if ($position !== false && $position == 0 && isset($mb->packages[$name]->modules[$moduleName])) {
                 $packageName = $name;
                 break;
             }
         }
     }
     if (!empty($packageName)) {
         return array('moduleName' => $moduleName, 'packageName' => $packageName);
     } else {
         return array('moduleName' => $deployedName);
     }
 }
 function constructSmarty($parser)
 {
     $smarty = new Sugar_Smarty();
     $smarty->assign('translate', true);
     $smarty->assign('language', $parser->getLanguage());
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('action', 'dashletSave');
     $smarty->assign('module', 'ModuleBuilder');
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $helpName = isset($_REQUEST['view']) && $_REQUEST['view'] == 'dashletsearch' ? 'searchViewEditor' : 'listViewEditor';
     $smarty->assign('helpName', $helpName);
     $smarty->assign('helpDefault', 'modify');
     if ($this->fromModuleBuilder) {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($this->editPackage, $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
     }
     $smarty->assign('title', $this->_constructTitle());
     $groups = array();
     foreach ($parser->columns as $column => $function) {
         // update this so that each field has a properties set
         // properties are name, value, title (optional)
         $groups[$GLOBALS['mod_strings'][$column]] = $parser->{$function}();
         // call the parser functions to populate the list view columns, by default 'default', 'available' and 'hidden'
     }
     foreach ($groups as $groupKey => $group) {
         foreach ($group as $fieldKey => $field) {
             if (isset($field['width'])) {
                 if (substr($field['width'], -1, 1) == '%') {
                     $groups[$groupKey][$fieldKey]['width'] = substr($field['width'], 0, strlen($field['width']) - 1);
                 }
             }
         }
     }
     $smarty->assign('groups', $groups);
     global $image_path;
     $imageSave = SugarThemeRegistry::current()->getImage('studio_save');
     //        $imageHelp = SugarThemeRegistry::current()->getImage('help') ;
     $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")";
     if (isset($this->searchlayout)) {
         $histaction = "ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$this->searchlayout}\")";
     }
     $buttons = array();
     if (!$this->fromModuleBuilder) {
         $buttons[] = array('name' => 'savebtn', 'image' => $imageSave, 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'], 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'");
     } else {
         $buttons[] = array('name' => 'mbsavebtn', 'image' => $imageSave, 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");ModuleBuilder.state.isDirty=false;ModuleBuilder.submitForm(\"edittabs\" )'");
     }
     $buttons[] = array('name' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='{$histaction}'");
     $smarty->assign('buttons', $this->_buildImageButtons($buttons));
     $editImage = SugarThemeRegistry::current()->getImage('edit_inline');
     $smarty->assign('editImage', $editImage);
     $deleteImage = SugarThemeRegistry::current()->getImage('delete_inline');
     $smarty->assign('deleteImage', $deleteImage);
     $smarty->assign('MOD', $GLOBALS['mod_strings']);
     if ($this->fromModuleBuilder) {
         $smarty->assign('MB', true);
         $smarty->assign('view_package', $this->editPackage);
         $smarty->assign('description', $GLOBALS['mod_strings']['LBL_LISTVIEW_DESCRIPTION']);
     } else {
         $smarty->assign('description', $GLOBALS['mod_strings']['LBL_LISTVIEW_DESCRIPTION']);
     }
     return $smarty;
 }
 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();
 }