public function testRelationshipName() { $mbModule = new MBModule('newname', $this->tmpDir, 'test', 'test'); $mbModule->renameMetaData($this->tmpDir, 'test_oldname'); $replacedContents = file_get_contents($this->tmpFile); $this->assertEquals('[\'test_newname\'] => ', $replacedContents, 'Module name replaced correctly in relationships metadata'); }
/** * @group bug38281 */ public function testRenameMetaData() { $mbModule = new MBModule('newname', $this->tmp_dir, 'test', 'test'); $mbModule->renameMetaData($this->tmp_dir, 'oldname'); $replacedContents = file_get_contents($this->tmp_file); $this->assertEquals('$dashletData[\'test_newnameDashlet\'][\'searchFields\']', $replacedContents, 'Module name replaced correctly in dashlet metadata'); }
function __construct($name, $path, $package, $package_key) { global $mod_strings; $this->config['templates'] = array('basic' => 1); $this->name = MBModule::getDBName($name); $this->key_name = $package_key . '_' . $name; $this->package = $package; $this->package_key = $package_key; $this->package_path = $path; $this->implementable = array('has_tab' => !empty($mod_strings['LBL_NAV_TAB']) ? $mod_strings['LBL_NAV_TAB'] : false); $this->path = $this->getModuleDir(); // $this->mbrelationship = new MBRelationship($this->name, $this->path, $this->key_name); $this->relationships = new UndeployedRelationships($this->path); $this->mbvardefs = new MBVardefs($this->name, $this->path, $this->key_name); $this->load(); }
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(); }