예제 #1
0
 protected function renderList()
 {
     if ($this->m_FormPrefix) {
         $formNameStr = str_replace(".", "_", $this->getFormObj()->m_Name) . "_";
     }
     $onchange_func = $this->getOnChangeFunction();
     $list = $this->getList();
     if ($this->m_BlankOption) {
         $entry = explode(",", $this->m_BlankOption);
         $text = $entry[0];
         $value = $entry[1] != "" ? $entry[1] : null;
         $entryList = array(array("val" => $value, "txt" => $text));
         $list = array_merge($entryList, $list);
     }
     $value = $this->m_Value ? $this->m_Value : $this->getText();
     $sHTML = "<div  class=\"dropdownlist\"  id=\"" . $formNameStr . $this->m_Name . "_scroll\" style=\"display:none;\">" . ($sHTML .= "<ul style=\"display:none;z-index:50\" id=\"" . $formNameStr . $this->m_Name . "_list\">");
     $theme = Resource::getCurrentTheme();
     $image_url = THEME_URL . "/" . $theme . "/images";
     foreach ($list as $item) {
         $val = $item['val'];
         $txt = $item['txt'];
         $pic = $item['pic'];
         if ($pic != "") {
             $str_pic = "<img src='" . $image_url . "/spacer.gif' style='background-color:#{$pic};width:12px;height:12px;padding-top:0px;margin-top:3px;' />";
         } else {
             $str_pic = "";
         }
         if (!preg_match("/</si", $txt)) {
             $display_value = $txt;
         } else {
             $display_value = $val;
         }
         if ($str_pic) {
             $li_option_value = $str_pic . "<span>" . $txt . "</span>";
         } else {
             $li_option_value = $txt;
         }
         if ($val == $value) {
             $option_item_style = " class='selected' ";
         } else {
             $option_item_style = " onmouseover=\"this.className='hover'\" onmouseout=\"this.className=''\" ";
         }
         $sHTML .= "<li {$option_item_style}\t\n\t\t\t\tonclick=\"\$('" . $formNameStr . $this->m_Name . "_list').hide();\n\t\t\t\t\t\t\t\$('" . $formNameStr . $this->m_Name . "_scroll').hide();\n\t\t\t\t\t\t\t\$('" . $formNameStr . $this->m_Name . "').setValue('" . addslashes($display_value) . "');\n\t\t\t\t\t\t\t\$('" . $formNameStr . $this->m_Name . "_hidden').setValue('" . addslashes($val) . "');\n\t\t\t\t\t\t\t\$('span_" . $formNameStr . $this->m_Name . "').innerHTML = this.innerHTML;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t{$onchange_func} ;\n\t\t\t\t\t\t\t\$('" . $formNameStr . $this->m_Name . "').className='" . $this->m_cssClass . "'\n\t\t\t\t\t\t\t\"\t\t\t\t\t\n\t\t\t\t>{$li_option_value}</li>";
         if ($val == $value) {
             $this->m_DefaultDisplayValue = "" . $str_pic . "<span>" . $txt . "</span>";
         }
     }
     $sHTML .= "</ul>";
     $sHTML .= "</div>";
     return $sHTML;
 }
예제 #2
0
 /**
  * Get openbiz template file path by searching modules/package, /templates
  *
  * @param string $className
  * @return string php library file path
  * */
 public static function getTplFileWithPath($templateFile, $packageName)
 {
     //for not changing a lot things, the best injection point is added theme support here.
     $theme = Resource::getCurrentTheme();
     $themePath = $theme;
     // BizSystem::configuration()->GetThemePath($theme);
     if ($themePath) {
         $templateRoot = THEME_PATH . "/" . $themePath . "/template";
     } else {
         $templateRoot = SMARTY_TPL_PATH;
     }
     $names = explode(".", $packageName);
     if (count($names) > 0) {
         $moduleName = $names[0];
     }
     $packagePath = str_replace('.', '/', $packageName);
     // check the leading char '@'
     $checkExtModule = true;
     if (strpos($packagePath, '@') === 0) {
         $packagePath = substr($packagePath, 1);
         $checkExtModule = false;
     }
     $searchTpls = array(MODULE_PATH . "/{$packagePath}/template/{$templateFile}", dirname(MODULE_PATH . "/{$packagePath}") . "/template/{$templateFile}", MODULE_PATH . "/{$moduleName}/template/{$templateFile}", $templateRoot . "/{$templateFile}");
     if ($checkExtModule && defined('MODULE_EX_PATH')) {
         array_unshift($searchTpls, MODULE_EX_PATH . "/{$packagePath}/template/{$templateFile}");
     }
     // device
     if (defined('CLIENT_DEVICE')) {
         array_unshift($searchTpls, MODULE_PATH . "/{$moduleName}/template/" . CLIENT_DEVICE . "/{$templateFile}");
     }
     foreach ($searchTpls as $tplFile) {
         if (file_exists($tplFile)) {
             return $tplFile;
         }
     }
     $errmsg = BizSystem::getMessage("UNABLE_TO_LOCATE_TEMPLATE_FILE", array($templateFile));
     trigger_error($errmsg, E_USER_ERROR);
     return null;
 }
예제 #3
0
 /**
  * Get output attributs as array
  *
  * @return array array of attributs
  * @todo rename to getOutputAttribute or getAttribute (2.5?)
  */
 public function outputAttrs()
 {
     $output['name'] = $this->m_Name;
     $output['dataService'] = $this->m_DataService;
     $output['queryString'] = $this->m_QueryString;
     $output['title'] = Expression::evaluateExpression($this->m_Title, $this);
     $output['icon'] = $this->m_Icon;
     $output['hasSubform'] = $this->m_SubForms ? 1 : 0;
     $output['currentPage'] = $this->m_CurrentPage;
     $output['currentRecordId'] = $this->m_RecordId;
     $output['totalPages'] = $this->m_TotalPages;
     $output['totalRecords'] = $this->m_TotalRecords;
     $output['description'] = str_replace('\\n', "<br />", Expression::evaluateExpression($this->m_Description, $this));
     $output['elementSets'] = $this->getElementSet();
     $output['tabSets'] = $this->getTabSet();
     $output['ActionElementSets'] = $this->getElementSet($this->m_ActionPanel);
     if ($output['icon']) {
         if (preg_match("/{.*}/si", $output['icon'])) {
             $output['icon'] = Expression::evaluateExpression($output['icon'], null);
         } else {
             $output['icon'] = THEME_URL . "/" . Resource::getCurrentTheme() . "/images/" . $output['icon'];
         }
     }
     return $output;
 }