예제 #1
0
 /**
  * clearAll
  * Helper function to remove all .tpl files in the cache directory
  *
  */
 function clearAll()
 {
     global $beanList;
     foreach ($beanList as $module_dir => $object_name) {
         TemplateHandler::clearCache($module_dir);
     }
 }
예제 #2
0
 public function display()
 {
     global $current_user;
     $this->bean->custom_fields->retrieve();
     unset($this->dv->defs['templateMeta']['form']['buttons'][1]);
     unset($this->dv->defs['templateMeta']['form']['buttons'][2]);
     unset($this->dv->defs['templateMeta']['form']['buttons'][3]);
     unset($this->dv->defs['templateMeta']['form']['buttons'][4]);
     $th = new TemplateHandler();
     $th->clearCache($this->module);
     parent::display();
 }
 function deploy($defs)
 {
     if ($this->_sourceFilename == $this->getFileName($this->_view, $this->_moduleName, MB_HISTORYMETADATALOCATION)) {
         foreach (array(MB_WORKINGMETADATALOCATION, MB_CUSTOMMETADATALOCATION, MB_BASEMETADATALOCATION) as $type) {
             if (file_exists($this->getFileName($this->_view, $this->_moduleName, $type))) {
                 $this->_history->append($this->getFileName($this->_view, $this->_moduleName, $type));
                 break;
             }
         }
     } else {
         $this->_history->append($this->_sourceFilename);
     }
     // when we deploy get rid of the working file; we have the changes in the MB_CUSTOMMETADATALOCATION so no need for a redundant copy in MB_WORKINGMETADATALOCATION
     // this also simplifies manual editing of layouts. You can now switch back and forth between Studio and manual changes without having to keep these two locations in sync
     $workingFilename = $this->getFileName($this->_view, $this->_moduleName, MB_WORKINGMETADATALOCATION);
     if (file_exists($workingFilename)) {
         unlink($this->getFileName($this->_view, $this->_moduleName, MB_WORKINGMETADATALOCATION));
     }
     $filename = $this->getFileName($this->_view, $this->_moduleName, MB_CUSTOMMETADATALOCATION);
     $GLOBALS['log']->debug(get_class($this) . "->deploy(): writing to " . $filename);
     $this->_saveToFile($filename, $defs);
     // now clear the cache so that the results are immediately visible
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->_moduleName);
 }
예제 #4
0
 function handleSave()
 {
     $fields = $this->_loadLayoutFromRequest();
     $this->_writeToFile($this->customFile, 'ListView', $this->module_name, $fields, $this->_variables);
     $GLOBALS["listViewDefs"][$this->module_name] = $fields;
     // now clear the cache so that the results are immediately visible
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->module_name, "ListView.tpl");
     // not currently cached, but here for the future
 }
 function deploy($defs)
 {
     // first sort out the historical record...
     write_array_to_file(self::HISTORYVARIABLENAME, $this->_viewdefs, $this->historyPathname, 'w', '');
     $this->_history->append($this->historyPathname);
     $this->_viewdefs = $defs;
     require_once 'include/SubPanel/SubPanel.php';
     $subpanel = new SubPanel($this->_moduleName, 'fab4', $this->_subpanelName, $this->_aSubPanelObject);
     $subpanel->saveSubPanelDefOverride($this->_aSubPanelObject, 'list_fields', $defs);
     // now clear the cache so that the results are immediately visible
     MetaDataFiles::clearModuleClientCache($this->_aSubPanelObject->template_instance->module_name, 'view');
     MetaDataFiles::clearModuleClientCache($this->_moduleName, 'layout');
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->_moduleName);
 }
예제 #6
0
                                if (is_array($entry) && isset($entry['name'])) {
                                    $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
                                }
                            }
                        }
                    }
                } else {
                    //For basic_search and advanced_search views, just process the fields
                    foreach ($parser->_viewdefs as $entry_id => $entry) {
                        if (is_array($entry) && isset($entry['name'])) {
                            $parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
                        }
                    }
                }
                //Save the changes
                $parser->handleSave(false);
            }
            //foreach
            //Now clear the cache of the .tpl files
            TemplateHandler::clearCache($module);
        }
        //foreach
        echo '<br>' . $mod_strings['LBL_CLEAR_VARDEFS_DATA_CACHE_TITLE'];
        require_once 'modules/Administration/QuickRepairAndRebuild.php';
        $repair = new RepairAndClear();
        $repair->show_output = false;
        $repair->module_list = array($class_names);
        $repair->clearVardefs();
    }
    echo '<br>' . $mod_strings['LBL_DIAGNOSTIC_DONE'];
}
예제 #7
0
 function action_saveSugarField()
 {
     global $mod_strings;
     require_once 'modules/DynamicFields/FieldCases.php';
     $field = get_widget($_REQUEST['type']);
     $_REQUEST['name'] = trim($_POST['name']);
     $field->populateFromPost();
     require_once 'modules/ModuleBuilder/parsers/StandardField.php';
     $module = $_REQUEST['view_module'];
     // Need to map Employees -> Users
     if ($module == 'Employees') {
         $module = 'Users';
     }
     $df = new StandardField($module);
     $mod = BeanFactory::getBean($module);
     $class_name = $GLOBALS['beanList'][$module];
     $df->setup($mod);
     $field->module = $mod;
     $field->save($df);
     $this->action_SaveLabel();
     $MBmodStrings = $mod_strings;
     $GLOBALS['mod_strings'] = return_module_language('', 'Administration');
     include_once 'modules/Administration/QuickRepairAndRebuild.php';
     $GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules';
     $_REQUEST['execute_sql'] = true;
     require_once 'ModuleInstall/ModuleInstaller.php';
     $mi = new ModuleInstaller();
     $mi->silent = true;
     $mi->rebuild_extensions();
     $repair = new RepairAndClear();
     $repair->repairAndClearAll(array('clearVardefs', 'clearTpls'), array($class_name), true, false);
     //#28707 ,clear all the js files in cache
     $repair->module_list = array();
     $repair->clearJsFiles();
     // now clear the cache so that the results are immediately visible
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($module);
     if ($module == 'Users') {
         TemplateHandler::clearCache('Employees');
     }
     $GLOBALS['mod_strings'] = $MBmodStrings;
 }
예제 #8
0
 /**
  * Removes the metadata files for all known studio layouts.
  * 
  * @return html output record of the files deleted
  */
 function removeCustomLayouts()
 {
     $module = StudioModuleFactory::getStudioModule($this->module);
     $sources = $module->getViewMetadataSources();
     $out = "";
     foreach ($sources as $view) {
         $file = DeployedMetaDataImplementation::getFileName($view['type'], $this->module);
         if (file_exists($file)) {
             unlink($file);
             $out .= "Removed layout {$view['type']}.php<br/>";
         }
     }
     // now clear the cache
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->module);
     return $out;
 }
 function handleSave()
 {
     $this->_writeToFile($this->_customFile, $this->_view, $this->_module, $this->_viewdefs, $this->_variables);
     // now clear the cache so that the results are immediately visible
     include_once 'include/TemplateHandler/TemplateHandler.php';
     if (strtolower($this->_view) == 'quickcreate') {
         TemplateHandler::clearCache($this->_module, "form_SubPanelQuickCreate_{$this->_module}.tpl");
         TemplateHandler::clearCache($this->_module, "form_DCQuickCreate_{$this->_module}.tpl");
     } else {
         TemplateHandler::clearCache($this->_module, "{$this->_view}.tpl");
     }
 }
예제 #10
0
	var options;

	if ( document.getElementById("stickynotes_history_c").value != "" )
     	{ try {options = JSON.parse(\'{"notes":\' + document.getElementById("stickynotes_history_c").value + \'}\'); $("#notes").stickyNotes(options);}  catch(err){$("#notes").stickyNotes();}  }
	else { $("#notes").stickyNotes();}
});
</script>
';
global $mod_strings;
global $app_list_strings;
global $app_strings;
require_once 'include/DetailView/DetailView2.php';
require_once 'include/EditView/EditView2.php';
require_once 'custom/Modules/REG_Patient/RefillCommon.php';
TemplateHandler::clearCache('REG_Encounter', 'EditView.tpl');
//ADDED :--------> to prevent reg_encounter edit view from caching
$this->ss = new Sugar_Smarty();
$this->dv3 = new EditView();
$this->dv3->ss =& $this->ss;
$encounterMetadataFile = 'custom/modules/REG_Encounter/editviewdefs_inprescriptionrefill.php';
$this->bean3 = new REG_Encounter();
//----------------To add patient name
$this->bean3->reg_patient_reg_encounter_name = $this->bean->name;
$this->bean3->reg_patient_reg_encounterreg_patient_ida = $this->bean->id;
$flag3 = 0;
if (isset($_REQUEST['enc_id'])) {
    $enc_id = $_REQUEST['enc_id'];
    $this->bean3->retrieve($enc_id);
    $flag3 = 1;
}
예제 #11
0
 public function action_saveSugarField()
 {
     global $mod_strings;
     $field = get_widget($_REQUEST['type']);
     $_REQUEST['name'] = trim($_POST['name']);
     $field->populateFromPost();
     $module = $_REQUEST['view_module'];
     $df = new StandardField($module);
     $mod = BeanFactory::getBean($module);
     $obj = BeanFactory::getObjectName($module);
     $df->setup($mod);
     $field->module = $mod;
     $field->save($df);
     $this->action_SaveLabel();
     $MBmodStrings = $mod_strings;
     $GLOBALS['mod_strings'] = return_module_language('', 'Administration');
     include_once 'modules/Administration/QuickRepairAndRebuild.php';
     $GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules';
     $_REQUEST['execute_sql'] = true;
     $mi = new ModuleInstaller();
     $mi->silent = true;
     $mi->rebuild_extensions();
     $repair = new RepairAndClear();
     $repair->repairAndClearAll(array('clearVardefs', 'clearTpls', 'clearSearchCache'), array($module), true, false);
     //#28707 ,clear all the js files in cache
     $repair->module_list = array();
     $repair->clearJsFiles();
     //Ensure the vardefs are up to date for this module before we rebuild the cache now.
     VardefManager::loadVardef($module, $obj, true);
     //Make sure to clear the vardef for related modules as well
     $relatedMods = array();
     if (!empty($field->dependency)) {
         $relatedMods = array_merge($relatedMods, VardefManager::getLinkedModulesFromFormula($mod, $field->dependency));
     }
     if (!empty($field->formula)) {
         $relatedMods = array_merge($relatedMods, VardefManager::getLinkedModulesFromFormula($mod, $field->formula));
     }
     foreach ($relatedMods as $mName => $oName) {
         $repair->repairAndClearAll(array('clearVardefs', 'clearTpls'), array($mName), true, false);
         VardefManager::clearVardef($mName, $oName);
     }
     // now clear the cache so that the results are immediately visible
     TemplateHandler::clearCache($module);
     if ($module == 'Users') {
         TemplateHandler::clearCache('Employees');
     }
     // Bug 59210
     // Clear the metadata cache so this change can be reflected
     // immediately.
     $repair->module_list = array($module);
     // Sending false will only rebuild the $module section of the cache
     $repair->repairMetadataAPICache(false);
     $GLOBALS['mod_strings'] = $MBmodStrings;
 }
예제 #12
0
 /**
  * Removes the metadata files for all known studio layouts.
  *
  * @return html output record of the files deleted
  */
 function removeCustomLayouts()
 {
     $module = StudioModuleFactory::getStudioModule($this->module);
     $sources = $module->getViewMetadataSources();
     $out = "";
     // list of existing platforms including BWC
     $platforms = MetaDataManager::getPlatformList();
     array_unshift($platforms, '');
     // Flag to tell the autoloader whether to save itself or not when done
     $saveMap = false;
     foreach ($sources as $view) {
         foreach ($platforms as $platform) {
             $file = MetaDataFiles::getDeployedFileName($view['type'], $this->module, MB_CUSTOMMETADATALOCATION, $platform);
             // Ensure we are working on files that the autoloader knows about
             if (SugarAutoLoader::fileExists($file)) {
                 // Since we are in a loop inside of a loop do NOT send the
                 // save flag as true to unlink() but be sure to save the file
                 // map after the process is finished so that all changes to
                 // the map are saved.
                 SugarAutoLoader::unlink($file);
                 $out .= "Removed layout {$view['type']}.php<br/>";
                 // Tell the autoloader to save itself
                 $saveMap = true;
             }
         }
     }
     // now clear the cache
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->module);
     // If the file map needs saving, handle that now
     if ($saveMap) {
         SugarAutoLoader::saveMap();
     }
     return $out;
 }
 function deploy($defs)
 {
     $this->saveHistory();
     // when we deploy get rid of the working file; we have the changes in the MB_CUSTOMMETADATALOCATION so no need for a redundant copy in MB_WORKINGMETADATALOCATION
     // this also simplifies manual editing of layouts. You can now switch back and forth between Studio and manual changes without having to keep these two locations in sync
     $workingFilename = $this->getFileNameNoDefault($this->_view, $this->_moduleName, MB_WORKINGMETADATALOCATION);
     if (file_exists($workingFilename)) {
         SugarAutoLoader::unlink($workingFilename);
     }
     $filename = $this->getFileNameNoDefault($this->_view, $this->_moduleName, MB_CUSTOMMETADATALOCATION);
     $GLOBALS['log']->debug(get_class($this) . "->deploy(): writing to " . $filename);
     $this->_saveToFile($filename, $defs);
     // now clear the cache so that the results are immediately visible
     MetaDataFiles::clearModuleClientCache($this->_moduleName, 'view');
     MetaDataFiles::clearModuleClientCache($this->_moduleName, 'layout');
     include_once 'include/TemplateHandler/TemplateHandler.php';
     TemplateHandler::clearCache($this->_moduleName);
 }