コード例 #1
0
 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();
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 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();
 }
コード例 #4
0
ファイル: view.package.php プロジェクト: jglaine/sugar761-ent
 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();
     }
 }
コード例 #5
0
 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();
 }
コード例 #6
0
ファイル: view.dropdown.php プロジェクト: klr2003/sourceread
 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();
 }
コード例 #7
0
 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();
 }
コード例 #8
0
 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();
 }
コード例 #9
0
 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();
 }
コード例 #10
0
 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();
 }
コード例 #11
0
 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();
 }
コード例 #12
0
 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();
 }
コード例 #13
0
 /**
  * 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();
 }
コード例 #14
0
 /**
  * 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();
 }
コード例 #15
0
 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();
 }
コード例 #16
0
 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();
 }
コード例 #17
0
ファイル: view.package.php プロジェクト: klr2003/sourceread
 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();
     }
 }
コード例 #18
0
ファイル: view.home.php プロジェクト: omusico/sugar_work
 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();
 }
コード例 #19
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();
 }
コード例 #20
0
 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();
     }
 }
コード例 #21
0
ファイル: view.labels.php プロジェクト: aldridged/gtg-sugar
 function display()
 {
     $editModule = $_REQUEST['view_module'];
     if (!isset($_REQUEST['MB'])) {
         global $app_list_strings;
         $moduleNames = array_change_key_case($app_list_strings['moduleList']);
         $translatedEditModule = $moduleNames[strtolower($editModule)];
     }
     $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 = new Sugar_Smarty();
     global $mod_strings;
     $smarty->assign('mod_strings', $mod_strings);
     $smarty->assign('available_languages', get_languages());
     global $beanList;
     $objectName = $beanList[$editModule];
     if ($objectName == 'aCase') {
         $objectName = 'Case';
     }
     VardefManager::loadVardef($editModule, $objectName);
     global $dictionary;
     $vnames = array();
     //jchi 24557 . We should list all the lables in viewdefs(list,detail,edit,quickcreate) that the user can edit them.
     require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
     $parser = new ListLayoutMetaDataParser(MB_LISTVIEW, $editModule);
     foreach ($parser->getLayout() as $key => $def) {
         if (isset($def['label'])) {
             $vnames[$def['label']] = $def['label'];
         }
     }
     require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php';
     $variableMap = array(MB_EDITVIEW => 'EditView', MB_DETAILVIEW => 'DetailView', MB_QUICKCREATE => 'QuickCreate');
     if ($editModule == 'KBDocuments') {
         $variableMap = array();
     }
     foreach ($variableMap as $key => $value) {
         $gridLayoutMetaDataParserTemp = new GridLayoutMetaDataParser($value, $editModule);
         foreach ($gridLayoutMetaDataParserTemp->getLayout() as $panel) {
             foreach ($panel as $row) {
                 foreach ($row as $fieldArray) {
                     // fieldArray is an array('name'=>name,'label'=>label)
                     if (isset($fieldArray['label'])) {
                         $vnames[$fieldArray['label']] = $fieldArray['label'];
                     }
                 }
             }
         }
     }
     //end
     //Get Subpanel Labels:
     require_once 'include/SubPanel/SubPanel.php';
     $subList = SubPanel::getModuleSubpanels($editModule);
     foreach ($subList as $subpanel => $titleLabel) {
         $vnames[$titleLabel] = $titleLabel;
     }
     foreach ($dictionary[$objectName]['fields'] as $name => $def) {
         if (isset($def['vname'])) {
             $vnames[$def['vname']] = $def['vname'];
         }
     }
     $formatted_mod_strings = array();
     //we shouldn't set the $refresh=true here, or will lost template language mod_strings.
     //return_module_language($selected_lang, $editModule,false) : the mod_strings will be included from cache files here.
     foreach (return_module_language($selected_lang, $editModule, false) as $name => $label) {
         //#25294
         if (isset($vnames[$name]) || preg_match('/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si', $name)) {
             $formatted_mod_strings[$name] = htmlentities($label, ENT_QUOTES, 'UTF-8');
         }
     }
     //Grab everything from the custom files
     $mod_bak = $mod_strings;
     $files = array("custom/modules/{$editModule}/language/{$selected_lang}.lang.php", "custom/modules/{$editModule}/Ext/Language/{$selected_lang}.lang.ext.php");
     foreach ($files as $langfile) {
         $mod_strings = array();
         if (is_file($langfile)) {
             include $langfile;
             foreach ($mod_strings as $key => $label) {
                 $formatted_mod_strings[$key] = htmlentities($label, ENT_QUOTES, 'UTF-8');
             }
         }
     }
     $mod_strings = $mod_bak;
     ksort($formatted_mod_strings);
     $smarty->assign('MOD', $formatted_mod_strings);
     $smarty->assign('view_module', $editModule);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('defaultHelp', 'labelsBtn');
     $smarty->assign('assistant', array('key' => 'labels', 'group' => 'module'));
     $ajax = new AjaxCompose();
     $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
     $ajax->addCrumb($translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $editModule . '")');
     $ajax->addCrumb($mod_strings['LBL_LABELS'], '');
     $html = $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl');
     $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_SECTION_EDLABELS'], $html);
     echo $ajax->getJavascript();
 }
コード例 #22
0
 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();
     }
 }
コード例 #23
0
ファイル: controller.php プロジェクト: klr2003/sourceread
 function action_ViewTree()
 {
     require_once 'modules/ModuleBuilder/MB/AjaxCompose.php';
     switch ($_REQUEST['tree']) {
         case 'ModuleBuilder':
             require_once 'modules/ModuleBuilder/MB/MBPackageTree.php';
             $mbt = new MBPackageTree();
             break;
         case 'Studio':
             require_once 'modules/ModuleBuilder/Module/StudioTree.php';
             $mbt = new StudioTree();
     }
     $ajax = new AjaxCompose();
     $ajax->addSection('west', $mbt->getName(), $mbt->fetchNodes());
     echo $ajax->getJavascript();
     sugar_cleanup(true);
 }
コード例 #24
0
ファイル: view.property.php プロジェクト: MexinaD/SuiteCRM
 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();
 }
コード例 #25
0
 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();
 }
コード例 #26
0
ファイル: view.resetmodule.php プロジェクト: MexinaD/SuiteCRM
 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();
     }
     $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();
 }
コード例 #27
0
ファイル: view.layoutview.php プロジェクト: MexinaD/SuiteCRM
 function display($preview = false)
 {
     global $mod_strings;
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->package);
     if (isset($this->view_object_map['new_parser'])) {
         $parser = $this->view_object_map['new_parser'];
     }
     $history = $parser->getHistory();
     $smarty = new Sugar_Smarty();
     //Add in the module we are viewing to our current mod strings
     if (!$this->fromModuleBuilder) {
         global $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));
     }
     $requiredFields = implode($parser->getRequiredFields(), ',');
     $slashedRequiredFields = addslashes($requiredFields);
     $buttons = array();
     $disableLayout = false;
     if ($preview) {
         $smarty->assign('layouttitle', translate('LBL_LAYOUT_PREVIEW', 'ModuleBuilder'));
     } else {
         $smarty->assign('layouttitle', translate('LBL_CURRENT_LAYOUT', 'ModuleBuilder'));
         //Check if we need to synch edit view to other layouts
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $parser2 = ParserFactory::getParser(MB_EDITVIEW, $this->editModule, $this->package);
             if ($this->editLayout == MB_DETAILVIEW) {
                 $disableLayout = $parser2->getSyncDetailEditViews();
             }
             if (!empty($_REQUEST['copyFromEditView'])) {
                 $editViewPanels = $parser2->convertFromCanonicalForm($parser2->_viewdefs['panels'], $parser2->_fielddefs);
                 $parser->_viewdefs['panels'] = $editViewPanels;
                 $parser->_fielddefs = $parser2->_fielddefs;
                 $parser->setUseTabs($parser2->getUseTabs());
                 $parser->setTabDefs($parser2->getTabDefs());
             }
         }
         if (!$this->fromModuleBuilder) {
             $buttons[] = array('id' => 'saveBtn', 'text' => translate('LBL_BTN_SAVE'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handleSave();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'publishBtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         } else {
             $buttons[] = array('id' => 'saveBtn', 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkGridLayout(\"{$this->editLayout}\")) Studio2.handlePublish();'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'spacer', 'width' => '33px');
             $buttons[] = array('id' => 'historyBtn', 'text' => translate('LBL_HISTORY'), 'actionScript' => "onclick='ModuleBuilder.history.browse(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
             $buttons[] = array('id' => 'historyDefault', 'text' => translate('LBL_RESTORE_DEFAULT'), 'actionScript' => "onclick='ModuleBuilder.history.revert(\"{$this->editModule}\", \"{$this->editLayout}\", \"{$history->getLast()}\", \"\")'", 'disabled' => $disableLayout);
         }
         if ($this->editLayout == MB_DETAILVIEW || $this->editLayout == MB_QUICKCREATE) {
             $buttons[] = array('id' => 'copyFromEditView', 'text' => translate('LBL_COPY_FROM_EDITVIEW'), 'actionScript' => "onclick='ModuleBuilder.copyFromView(\"{$this->editModule}\", \"{$this->editLayout}\")'", 'disabled' => $disableLayout);
         }
     }
     $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']}'";
             if (!empty($button['disabled'])) {
                 $html .= " disabled";
             }
             $html .= "></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $parser->getAvailableFields());
     $smarty->assign('disable_layout', $disableLayout);
     $smarty->assign('required_fields', $requiredFields);
     $smarty->assign('layout', $parser->getLayout());
     $smarty->assign('field_defs', $parser->getFieldDefs());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $parser->getMaxColumns());
     $smarty->assign('nextPanelId', $parser->getFirstNewPanelId());
     $smarty->assign('displayAsTabs', $parser->getUseTabs());
     $smarty->assign('tabDefs', $parser->getTabDefs());
     $smarty->assign('syncDetailEditViews', $parser->getSyncDetailEditViews());
     $smarty->assign('fieldwidth', 150);
     $smarty->assign('translate', $this->fromModuleBuilder ? false : true);
     if ($this->fromModuleBuilder) {
         $smarty->assign('fromModuleBuilder', $this->fromModuleBuilder);
         $smarty->assign('view_package', $this->package);
     }
     $labels = array(MB_EDITVIEW => 'LBL_EDITVIEW', MB_DETAILVIEW => 'LBL_DETAILVIEW', MB_QUICKCREATE => 'LBL_QUICKCREATE');
     $layoutLabel = 'LBL_LAYOUTS';
     $layoutView = 'layouts';
     $ajax = new AjaxCompose();
     $translatedViewType = '';
     if (isset($labels[strtolower($this->editLayout)])) {
         $translatedViewType = translate($labels[strtolower($this->editLayout)], 'ModuleBuilder');
     } else {
         if (isset($this->sm)) {
             foreach ($this->sm->sources as $file => $def) {
                 if (!empty($def['view']) && $def['view'] == $this->editLayout && !empty($def['name'])) {
                     $translatedViewType = $def['name'];
                 }
             }
             if (empty($translatedViewType)) {
                 $label = "LBL_" . strtoupper($this->editLayout);
                 $translated = translate($label, $this->editModule);
                 if ($translated != $label) {
                     $translatedViewType = $translated;
                 }
             }
         }
     }
     if ($this->fromModuleBuilder) {
         $ajax->addCrumb(translate('LBL_MODULEBUILDER', 'ModuleBuilder'), 'ModuleBuilder.main("mb")');
         $ajax->addCrumb($this->package, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $this->package . '")');
         $ajax->addCrumb($this->editModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $this->package . '&view_module=' . $this->editModule . '")');
         $ajax->addCrumb(translate($layoutLabel, 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&MB=true&action=wizard&view=' . $layoutView . '&view_module=' . $this->editModule . '&view_package=' . $this->package . '")');
         $ajax->addCrumb($translatedViewType, '');
     } 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 . '")');
         $ajax->addCrumb($translatedViewType, '');
     }
     // set up language files
     $smarty->assign('language', $parser->getLanguage());
     // for sugar_translate in the smarty template
     $smarty->assign('from_mb', $this->fromModuleBuilder);
     $smarty->assign('calc_field_list', json_encode($parser->getCalculatedFields()));
     if ($this->fromModuleBuilder) {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($this->package, $this->editModule);
         $smarty->assign('current_mod_strings', $module->getModStrings());
     }
     $ajax->addSection('center', $translatedViewType, $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
     if ($preview) {
         echo $smarty->fetch('modules/ModuleBuilder/tpls/Preview/layoutView.tpl');
     } else {
         echo $ajax->getJavascript();
     }
 }
コード例 #28
0
 function fetch($ac = false)
 {
     $fv = new FieldViewer();
     if (empty($_REQUEST['field']) && !empty($_REQUEST['name'])) {
         $_REQUEST['field'] = $_REQUEST['name'];
     }
     $field_name = '';
     if (!empty($this->view_object_map['field_name'])) {
         $field_name = $this->view_object_map['field_name'];
     } elseif (!empty($_REQUEST['field'])) {
         $field_name = $_REQUEST['field'];
     } else {
         $field_name = '';
     }
     $action = 'saveField';
     // tyoung bug 17606: default action is to save as a dynamic field; but for standard OOB
     // fields we override this so don't create a new dynamic field instead of updating the existing field
     $isClone = false;
     if (!empty($this->view_object_map['is_clone']) && $this->view_object_map['is_clone'] && strcmp($field_name, "name") != 0) {
         $isClone = true;
     }
     /*
     $field_types =  array('varchar'=>'YourField', 'int'=>'Integer', 'float'=>'Decimal','bool'=>'Checkbox','enum'=>'DropDown',
     		'date'=>'Date', 'phone' => 'Phone', 'currency' => 'Currency', 'html' => 'HTML', 'radioenum' => 'Radio',
     		'relate' => 'Relate', 'address' => 'Address', 'text' => 'TextArea', 'url' => 'Link');
     */
     $field_types = $GLOBALS['mod_strings']['fieldTypes'];
     if (isset($field_types['encrypt'])) {
         unset($field_types['encrypt']);
     }
     $field_name_exceptions = array('ADD', 'EXCEPT', 'PERCENT', 'ALL', 'EXEC', 'PLAN', 'ALTER', 'EXECUTE', 'PRECISION', 'AND', 'EXISTS', 'PRIMARY', 'ANY', 'EXIT', 'PRINT', 'AS', 'FETCH', 'PROC', 'ASC', 'FILE', 'PROCEDURE', 'AUTHORIZATION', 'FILLFACTOR', 'PUBLIC', 'BACKUP', 'FOR', 'RAISERROR', 'BEGIN', 'FOREIGN', 'READ', 'BETWEEN', 'FREETEXT', 'READTEXT', 'BREAK', 'FREETEXTTABLE', 'RECONFIGURE', 'BROWSE', 'FROM', 'REFERENCES', 'BULK', 'FULL', 'REPLICATION', 'BY', 'FUNCTION', 'RESTORE', 'CASCADE', 'GOTO', 'RESTRICT', 'CASE', 'GRANT', 'RETURN', 'CHECK', 'GROUP', 'REVOKE', 'CHECKPOINT', 'HAVING', 'RIGHT', 'CLOSE', 'HOLDLOCK', 'ROLLBACK', 'CLUSTERED', 'IDENTITY', 'ROWCOUNT', 'COALESCE', 'IDENTITY_INSERT', 'ROWGUIDCOL', 'COLLATE', 'IDENTITYCOL', 'RULE', 'COLUMN', 'IF', 'SAVE', 'COMMIT', 'IN', 'SCHEMA', 'COMPUTE', 'INDEX', 'SELECT', 'CONSTRAINT', 'INNER', 'SESSION_USER', 'CONTAINS', 'INSERT', 'SET', 'CONTAINSTABLE', 'INTERSECT', 'SETUSER', 'CONTINUE', 'INTO', 'SHUTDOWN', 'CONVERT', 'IS', 'SOME', 'CREATE', 'JOIN', 'STATISTICS', 'CROSS', 'KEY', 'SYSTEM_USER', 'CURRENT', 'KILL', 'TABLE', 'CURRENT_DATE', 'LEFT', 'TEXTSIZE', 'CURRENT_TIME', 'LIKE', 'THEN', 'CURRENT_TIMESTAMP', 'LINENO', 'TO', 'CURRENT_USER', 'LOAD', 'TOP', 'CURSOR', 'NATIONAL', 'TRAN', 'DATABASE', 'NOCHECK', 'TRANSACTION', 'DBCC', 'NONCLUSTERED', 'TRIGGER', 'DEALLOCATE', 'NOT', 'TRUNCATE', 'DECLARE', 'NULL', 'TSEQUAL', 'DEFAULT', 'NULLIF', 'UNION', 'DELETE', 'OF', 'UNIQUE', 'DENY', 'OFF', 'UPDATE', 'DESC', 'OFFSETS', 'UPDATETEXT', 'DISK', 'ON', 'USE', 'DISTINCT', 'OPEN', 'USER', 'DISTRIBUTED', 'OPENCONNECTOR', 'VALUES', 'DOUBLE', 'OPENQUERY', 'VARYING', 'DROP', 'OPENROWSET', 'VIEW', 'DUMMY', 'OPENXML', 'WAITFOR', 'DUMP', 'OPTION', 'WHEN', 'ELSE', 'OR', 'WHERE', 'END', 'ORDER', 'WHILE', 'ERRLVL', 'OUTER', 'WITH', 'ESCAPE', 'OVER', 'WRITETEXT', 'ANALYZE', 'ASENSITIVE', 'BEFORE', 'BIGINT', 'BINARY', 'BOTH', 'CALL', 'CHANGE', 'CHARACTER', 'CONDITION', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DELAYED', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCTROW', 'DIV', 'DUAL', 'EACH', 'ELSEIF', 'ENCLOSED', 'ESCAPED', 'EXPLAIN', 'FALSE', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FORCE', 'FULLTEXT', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IGNORE', 'INFILE', 'INOUT', 'INSENSITIVE', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'ITERATE', 'KEYS', 'LEADING', 'LEAVE', 'LIMIT', 'LINES', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MATCH', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NO_WRITE_TO_BINLOG', 'NUMERIC', 'OPTIMIZE', 'OPTIONALLY', 'OUT', 'OUTFILE', 'PURGE', 'READS', 'REAL', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RLIKE', 'SCHEMAS', 'SECOND_MICROSECOND', 'SENSITIVE', 'SEPARATOR', 'SHOW', 'SMALLINT', 'SONAME', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STRAIGHT_JOIN', 'TERMINATED', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TRAILING', 'TRUE', 'UNDO', 'UNLOCK', 'UNSIGNED', 'USAGE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VARBINARY', 'VARCHARACTER', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL', 'CONNECTION', 'LABEL', 'UPGRADE', 'DATE', 'VARCHAR', 'VARCHAR2', 'NVARCHAR2', 'CHAR', 'NCHAR', 'NUMBER', 'PLS_INTEGER', 'BINARY_INTEGER', 'LONG', 'TIMESTAMP', 'INTERVAL', 'RAW', 'ROWID', 'UROWID', 'MLSLABEL', 'CLOB', 'NCLOB', 'BLOB', 'BFILE', 'XMLTYPE', 'ID', 'ID_C', 'PARENT_NAME', 'PARENT_ID');
     //C.L. - Add support to mark related module id columns as reserved keywords
     require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php';
     $relatedModules = array_keys(DeployedRelationships::findRelatableModules());
     global $beanList, $current_language;
     foreach ($relatedModules as $relModule) {
         if (isset($beanList[$relModule])) {
             $field_name_exceptions[] = strtoupper($beanList[$relModule]) . '_ID';
         }
     }
     if (empty($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
         $moduleName = $_REQUEST['view_module'];
         $objectName = BeanFactory::getObjectName($moduleName);
         $module = BeanFactory::getBean($moduleName);
         VardefManager::loadVardef($moduleName, $objectName, true);
         global $dictionary;
         // Fix for issue #1177 - when trying to add or edit fields in a module an error message is shown:
         // "Warning: Creating default object from empty value"
         if (!isset($module->mbvardefs) || is_null($module->mbvardefs)) {
             $module->mbvardefs = new stdClass();
         }
         $module->mbvardefs->vardefs = $dictionary[$objectName];
         $module->name = $moduleName;
         if (!$ac) {
             $ac = new AjaxCompose();
         }
         $vardef = !empty($module->mbvardefs->vardefs['fields'][$field_name]) ? $module->mbvardefs->vardefs['fields'][$field_name] : array();
         if ($isClone) {
             unset($vardef['name']);
         }
         if (empty($vardef['name'])) {
             if (!empty($_REQUEST['type'])) {
                 $vardef['type'] = $_REQUEST['type'];
             }
             $fv->ss->assign('hideLevel', 0);
         } elseif (isset($vardef['custom_module'])) {
             $fv->ss->assign('hideLevel', 2);
         } else {
             $action = 'saveSugarField';
             // tyoung - for OOB fields we currently only support modifying the label
             $fv->ss->assign('hideLevel', 3);
         }
         if ($isClone && isset($vardef['type']) && $vardef['type'] == 'datetime') {
             $vardef['type'] = 'datetimecombo';
         }
         require_once 'modules/DynamicFields/FieldCases.php';
         $tf = get_widget(empty($vardef['type']) ? "" : $vardef['type']);
         $tf->module = $module;
         $tf->populateFromRow($vardef);
         $vardef = array_merge($vardef, $tf->get_field_def());
         //          $GLOBALS['log']->debug('vardefs after loading = '.print_r($vardef,true));
         //Check if autoincrement fields are allowed
         $allowAutoInc = true;
         $enumFields = array();
         foreach ($module->field_defs as $field => $def) {
             if (!empty($def['type']) && $def['type'] == "int" && !empty($def['auto_increment'])) {
                 $allowAutoInc = false;
                 continue;
             }
             if (!empty($def['type']) && $def['type'] == "enum" && $field != $vardef['name']) {
                 if (!empty($def['studio']) && $def['studio'] == "false") {
                     continue;
                 }
                 //bug51866
                 $enumFields[$field] = translate($def['vname'], $moduleName);
                 if (substr($enumFields[$field], -1) == ":") {
                     $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) - 1);
                 }
             }
         }
         $fv->ss->assign('allowAutoInc', $allowAutoInc);
         $GLOBALS['log']->warn('view.modulefield: hidelevel ' . $fv->ss->get_template_vars('hideLevel') . " " . print_r($vardef, true));
         if (!empty($vardef['vname'])) {
             $fv->ss->assign('lbl_value', htmlentities(translate($vardef['vname'], $moduleName), ENT_QUOTES, 'UTF-8'));
         }
         $fv->ss->assign('module', $module);
         if (empty($module->mbvardefs->vardefs['fields']['parent_name']) || isset($vardef['type']) && $vardef['type'] == 'parent') {
             $field_types['parent'] = $GLOBALS['mod_strings']['parent'];
         }
         $edit_or_add = 'editField';
     } else {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $moduleName = $_REQUEST['view_module'];
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $moduleName);
         $package =& $mb->packages[$_REQUEST['view_package']];
         $module->getVardefs();
         if (!$ac) {
             $ac = new AjaxCompose();
         }
         $vardef = !empty($module->mbvardefs->vardefs['fields'][$field_name]) ? $module->mbvardefs->vardefs['fields'][$field_name] : array();
         if ($isClone) {
             unset($vardef['name']);
         }
         if (empty($vardef['name'])) {
             if (!empty($_REQUEST['type'])) {
                 $vardef['type'] = $_REQUEST['type'];
             }
             $fv->ss->assign('hideLevel', 0);
         } else {
             if (!empty($module->mbvardefs->vardef['fields'][$vardef['name']])) {
                 $fv->ss->assign('hideLevel', 1);
             } elseif (isset($vardef['custom_module'])) {
                 $fv->ss->assign('hideLevel', 2);
             } else {
                 $fv->ss->assign('hideLevel', 3);
                 // tyoung bug 17350 - effectively mark template derived fields as readonly
             }
         }
         require_once 'modules/DynamicFields/FieldCases.php';
         $tf = get_widget(empty($vardef['type']) ? "" : $vardef['type']);
         $tf->module = $module;
         $tf->populateFromRow($vardef);
         $vardef = array_merge($vardef, $tf->get_field_def());
         $fv->ss->assign('module', $module);
         $fv->ss->assign('package', $package);
         $fv->ss->assign('MB', '1');
         if (isset($vardef['vname'])) {
             $fv->ss->assign('lbl_value', htmlentities($module->getLabel('en_us', $vardef['vname']), ENT_QUOTES, 'UTF-8'));
         }
         if (empty($module->mbvardefs->vardefs['fields']['parent_name']) || isset($vardef['type']) && $vardef['type'] == 'parent') {
             $field_types['parent'] = $GLOBALS['mod_strings']['parent'];
         }
         $enumFields = array();
         if (!empty($module->mbvardefs->vardefs['fields'])) {
             foreach ($module->mbvardefs->vardefs['fields'] as $field => $def) {
                 if (!empty($def['type']) && $def['type'] == "enum" && $field != $vardef['name']) {
                     $enumFields[$field] = isset($module->mblanguage->strings[$current_language][$def['vname']]) ? $this->mbModule->mblanguage->strings[$current_language][$def['vname']] : translate($field);
                     if (substr($enumFields[$field], -1) == ":") {
                         $enumFields[$field] = substr($enumFields[$field], 0, strlen($enumFields[$field]) - 1);
                     }
                 }
             }
         }
         $edit_or_add = 'mbeditField';
     }
     if ($_REQUEST['action'] == 'RefreshField') {
         require_once 'modules/DynamicFields/FieldCases.php';
         $field = get_widget($_POST['type']);
         $field->populateFromPost();
         $vardef = $field->get_field_def();
         $vardef['options'] = $_REQUEST['new_dropdown'];
         $fv->ss->assign('lbl_value', htmlentities($_REQUEST['labelValue'], ENT_QUOTES, 'UTF-8'));
     }
     foreach (array("formula", "default", "comments", "help", "visiblityGrid") as $toEscape) {
         if (!empty($vardef[$toEscape]) && is_string($vardef[$toEscape])) {
             $vardef[$toEscape] = htmlentities($vardef[$toEscape], ENT_QUOTES, 'UTF-8');
         }
     }
     if (!empty($vardef['studio']) && is_array($vardef['studio']) && !empty($vardef['studio']['no_duplicate']) && $vardef['studio']['no_duplicate'] == true || strcmp($field_name, "name") == 0 || isset($vardef['type']) && $vardef['type'] == 'name') {
         $fv->ss->assign('no_duplicate', true);
     }
     $fv->ss->assign('action', $action);
     $fv->ss->assign('isClone', $isClone ? 1 : 0);
     $fv->ss->assign("module_dd_fields", $enumFields);
     $json = getJSONobj();
     $fv->ss->assign('field_name_exceptions', $json->encode($field_name_exceptions));
     ksort($field_types);
     $fv->ss->assign('field_types', $field_types);
     $fv->ss->assign('importable_options', $GLOBALS['app_list_strings']['custom_fields_importable_dom']);
     $fv->ss->assign('duplicate_merge_options', $GLOBALS['app_list_strings']['custom_fields_merge_dup_dom']);
     $triggers = array();
     $existing_field_names = array();
     foreach ($module->mbvardefs->vardefs['fields'] as $field) {
         if ($field['type'] == 'enum' || $field['type'] == 'multienum') {
             $triggers[] = $field['name'];
         }
         if (!isset($field['source']) || $field['source'] != 'non-db') {
             if (preg_match('/^(.*?)(_c)?$/', $field['name'], $matches)) {
                 $existing_field_names[] = strtoupper($matches[1]);
             }
         }
     }
     $fv->ss->assign('triggers', $triggers);
     $fv->ss->assign('existing_field_names', $json->encode($existing_field_names));
     $fv->ss->assign('mod_strings', $GLOBALS['mod_strings']);
     // jchi #24880
     // end
     $layout = $fv->getLayout($vardef);
     $fv->ss->assign('fieldLayout', $layout);
     if (empty($vardef['type'])) {
         $vardef['type'] = 'varchar';
     }
     $fv->ss->assign('vardef', $vardef);
     if (empty($_REQUEST['field'])) {
         $edit_or_add = 'addField';
     }
     $fv->ss->assign('help_group', $edit_or_add);
     $body = $this->fetchTemplate($fv, 'modules/ModuleBuilder/tpls/MBModule/field.tpl');
     $ac->addSection('east', translate('LBL_SECTION_FIELDEDITOR', 'ModuleBuilder'), $body);
     return $ac;
 }
コード例 #29
0
 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'];
     global $current_language;
     $module_strings = return_module_language($current_language, $module_name);
     $fieldsData = array();
     $customFieldsData = array();
     //use fieldTypes variable to map field type to displayed field type
     $fieldTypes = $mod_strings['fieldTypes'];
     //add datetimecombo type field from the vardef overrides to point to Datetime type
     $fieldTypes['datetime'] = $fieldTypes['datetimecombo'];
     if (!isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
         //$this->loadPackageHelp($module_name);
         $studioClass = new stdClass();
         $studioClass->name = $module_name;
         $objectName = BeanFactory::getObjectName($module_name);
         VardefManager::loadVardef($module_name, $objectName, true);
         global $dictionary;
         $f = array($mod_strings['LBL_HCUSTOM'] => array(), $mod_strings['LBL_HDEFAULT'] => array());
         foreach ($dictionary[$objectName]['fields'] as $def) {
             if (!$this->isValidStudioField($def)) {
                 continue;
             }
             if (!empty($def['vname'])) {
                 $def['label'] = translate($def['vname'], $module_name);
             } elseif (!empty($def['label'])) {
                 $def['label'] = translate($def['label'], $module_name);
             } else {
                 $def['label'] = $def['name'];
             }
             //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;
                 $def['custom'] = true;
             } else {
                 $f[$mod_strings['LBL_HDEFAULT']][$def['name']] = $def;
                 $def['custom'] = false;
             }
             $def['type'] = isset($fieldTypes[$def['type']]) ? $fieldTypes[$def['type']] : ucfirst($def['type']);
             $fieldsData[] = $def;
             $customFieldsData[$def['name']] = $def['custom'];
         }
         $studioClass->mbvardefs->vardefs['fields'] = $f;
         $smarty->assign('module', $studioClass);
         $package = new stdClass();
         $package->name = '';
         $smarty->assign('package', $package);
         global $current_user;
         $sortPreferences = $current_user->getPreference('fieldsTableColumn', 'ModuleBuilder');
         $smarty->assign('sortPreferences', $sortPreferences);
         $smarty->assign('fieldsData', getJSONobj()->encode($fieldsData));
         $smarty->assign('customFieldsData', getJSONobj()->encode($customFieldsData));
         $smarty->assign('studio', true);
         $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->mbModule = $package->modules[$module_name];
         // We need the type to determine true custom fields
         $moduleType = $this->mbModule->getModuleType();
         $this->loadPackageHelp($module_name);
         $this->mbModule->getVardefs(true);
         $this->mbModule->mbvardefs->vardefs['fields'] = array_reverse($this->mbModule->mbvardefs->vardefs['fields'], true);
         $loadedFields = array();
         if (file_exists($this->mbModule->path . '/language/' . $current_language . '.lang.php')) {
             include $this->mbModule->path . '/language/' . $current_language . '.lang.php';
             $this->mbModule->setModStrings($current_language, $mod_strings);
         } elseif (file_exists($this->mbModule->path . '/language/en_us.lang.php')) {
             include $this->mbModule->path . '/language/en_us.lang.php';
             $this->mbModule->setModStrings('en_us', $mod_strings);
         }
         foreach ($this->mbModule->mbvardefs->vardefs['fields'] as $k => $v) {
             if ($k != $this->mbModule->name) {
                 foreach ($v as $field => $def) {
                     if (in_array($field, array_keys($this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name]))) {
                         $this->mbModule->mbvardefs->vardefs['fields'][$k][$field] = $this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name][$field];
                         unset($this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name][$field]);
                     }
                 }
             }
         }
         foreach ($this->mbModule->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->mbModule->mbvardefs->vardefs['fields'][$k][$field]);
                 } else {
                     $this->mbModule->mbvardefs->vardefs['fields'][$k][$field]['label'] = isset($def['vname']) && isset($this->mbModule->mblanguage->strings[$current_language . '.lang.php'][$def['vname']]) ? $this->mbModule->mblanguage->strings[$current_language . '.lang.php'][$def['vname']] : $field;
                     // It's only custom if the module name is the same as the key AND not the same as the module type
                     $custom = $k == $this->mbModule->name && $this->mbModule->name != $moduleType;
                     $customFieldsData[$field] = $custom ? true : false;
                     $loadedFields[$field] = true;
                     $type = $this->mbModule->mbvardefs->vardefs['fields'][$k][$field]['type'];
                     $this->mbModule->mbvardefs->vardefs['fields'][$k][$field]['type'] = isset($fieldTypes[$type]) ? $fieldTypes[$type] : ucfirst($type);
                     if ($this->isValidStudioField($this->mbModule->mbvardefs->vardefs['fields'][$k][$field])) {
                         $fieldsData[] = $this->mbModule->mbvardefs->vardefs['fields'][$k][$field];
                     }
                 }
             }
         }
         $this->mbModule->mbvardefs->vardefs['fields'][$module_name] = $this->cullFields($this->mbModule->mbvardefs->vardefs['fields'][$module_name]);
         $smarty->assign('fieldsData', getJSONobj()->encode($fieldsData));
         $smarty->assign('customFieldsData', getJSONobj()->encode($customFieldsData));
         global $current_user;
         $sortPreferences = $current_user->getPreference('fieldsTableColumn', 'ModuleBuilder');
         $smarty->assign('sortPreferences', $sortPreferences);
         $smarty->assign('title', $titleLBL);
         $smarty->assign('package', $package);
         $smarty->assign('module', $this->mbModule);
         $smarty->assign('editLabelsMb', '1');
         $smarty->assign('studio', false);
         $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();
     }
 }
コード例 #30
-1
 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();
 }