00001 <?php
00002
00003 abstract class aliroAdminTemplateBase extends aliroMainTemplateBase {
00004 protected $admin_site = '';
00005 protected $toolbar = '';
00006 protected $retrotoolbar = false;
00007
00008 public function __construct () {
00009 parent::__construct();
00010 $this->tpath = criticalInfo::getInstance()->admin_dir.'/templates/';
00011 $this->admin_site = $this->request->getCfg('admin_site');
00012
00013 T_('Administration [Aliro]');
00014 }
00015
00016 protected function preRender () {
00017 $this->showToolbar();
00018 if ($this->request->getParam($_REQUEST, 'hidemainmenu', 0)) $this->mainmenu = '';
00019 else $this->mainmenu = aliroAdminMenuHandler::getInstance()->makeMenu();
00020 $this->username = aliroUser::getInstance()->username;
00021 $this->versiontext = version::getInstance()->footer();
00022 }
00023
00024 protected function header ($login=false) {
00025 if (!method_exists($this, $this->doctype)) $doctype = 'xhtml_10_trans';
00026 else $doctype = $this->doctype;
00027 if ($login) {
00028 $initeditor = '';
00029 $css = $this->logincss;
00030 $adminscript = <<<ADMIN_SCRIPT
00031 <script type="text/javascript">
00032 function setFocus() {
00033 document.loginForm.usrname.select();
00034 document.loginForm.usrname.focus();
00035 }
00036 </script>
00037 ADMIN_SCRIPT;
00038
00039 }
00040 else {
00041 $initeditor = aliroEditor::getInstance()->initEditor();
00042 $css = $this->cssname;
00043 $adminscript = <<<ALIRO_JS
00044 <script src='$this->live_site/includes/js/alirojavascript.js' type='text/javascript'></script>
00045 ALIRO_JS;
00046
00047 }
00048 $iso = _ISO;
00049 return <<<HTML_HEADER
00050 {$this->$doctype()}
00051 <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
00052 <head>
00053 <meta http-equiv="Content-Type" content="text/html; $iso" />
00054 <title>$this->sitename - {$this->T_('Administration [Aliro]')}</title>
00055 $initeditor
00056 <link rel='stylesheet' href='$this->admin_site/templates/$this->tname/$css' type='text/css' />
00057 {$this->request->getCustomTags()}
00058 $adminscript
00059 </head>
00060
00061 HTML_HEADER;
00062
00063 }
00064
00065 protected function showToolbar () {
00066 $version = version::getInstance();
00067 $aliroVersion = $version->RELEASE.'/'.$version->DEV_STATUS.'/'.$version->DEV_LEVEL;
00068 if ($component = $this->request->getComponentObject()) {
00069 if ($class = $component->adminclass) {
00070 $controller = new $class($component, "Aliro", $aliroVersion);
00071 $controller->toolbar();
00072 }
00073 else {
00074 if ($path = mosMainFrame::getInstance()->getPath( 'toolbar', $this->request->getOption() ) AND file_exists($path)) {
00075 $this->request->invokeRetroCode($path);
00076 }
00077 }
00078 }
00079 }
00080
00081
00082 public function toolBarButton ($name, $requireSelect=false) {
00083 if ($requireSelect) {
00084 $message = sprintf(T_('Please make a selection from the list to %s'), $name);
00085 $script = "if (document.adminForm.boxchecked.value == 0){ alert('$message'); return false; } else";
00086 }
00087 else $script = '';
00088 $script .= "{return true}";
00089 $html = <<<BUTTON_HTML
00090
00091 <input type="submit" class='toolitem' value="$name" name="toolbarbutton" onclick="$script" />
00092
00093 BUTTON_HTML;
00094
00095 $this->toolbar = $html.$this->toolbar;
00096 }
00097
00098
00099 public function toolBarItemHTML ($task, $alt, $href, $icon, $iconOver, $linkIfJavaScript=true) {
00100 $this->retrotoolbar = true;
00101 if ($linkIfJavaScript AND $this->request->getStickyAliroParam($_POST, 'alironoscript')) $startlink = $endlink = '';
00102 else {
00103 $startlink = <<<LINK_START
00104 <a class="toolbar" href="$href" onmouseout='MM_swapImgRestore();' onmouseover="MM_swapImage('$task','','$iconOver',1);">
00105 LINK_START;
00106 $endlink = '</a>';
00107 }
00108 if ($icon AND $iconOver) {
00109 $html = <<<TOOL_ITEM
00110 <div class="toolitem">
00111 $startlink
00112 $icon
00113 <br />
00114 $alt
00115 $endlink
00116 <noscript><input type="radio" name="alironstask" value="$task" /></noscript>
00117 </div>
00118 TOOL_ITEM;
00119 }
00120 else $html = <<<SHORT_ITEM
00121 <div class="toolitem">
00122 <a class='toolbar' href='$href'><br />$atl</a>
00123 </div>
00124 SHORT_ITEM;
00125
00126 $this->toolbar = $html.$this->toolbar;
00127
00128 }
00129
00130
00131 public function makeJavaScript ($task, $extended, $listprompt='') {
00132 $script = '';
00133 if ($listprompt) $script .= "if (document.adminForm.boxchecked.value == 0){ alert('$listprompt'); } else";
00134 $script .= '{';
00135 if ($extended) $script .= 'hideMainMenu();';
00136 $script .= "submitbutton('$task')}";
00137 return $script;
00138 }
00139
00140
00141 public function divider($image) {
00142 $divider = <<<DIVIDER
00143 <div class="toolitem">
00144 $image
00145 </div>
00146 DIVIDER;
00147
00148 $this->toolbar = $divider.$this->toolbar;
00149 }
00150
00151
00152 protected function getToolbar () {
00153 if ($this->retrotoolbar) {
00154 $buttonlegend = T_('Perform action');
00155 $noscript = <<<NO_SCRIPT
00156
00157 <noscript>
00158 <div class="toolitem">
00159 <input type="submit" class="button" value="$buttonlegend" />
00160 </div>
00161 </noscript>
00162
00163 NO_SCRIPT;
00164
00165 }
00166 else $noscript = '';
00167 if ($this->toolbar) return <<<TOOLBAR_HTML
00168
00169 <div id='AliroAdminToolBar' align='right'>
00170 $noscript
00171 $this->toolbar
00172 </div>
00173
00174 TOOLBAR_HTML;
00175
00176 else return '';
00177 }
00178
00179 }