| [ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #Modern Theme - A theme for CMS Made Simple 3 #(c)2005 by Alexander Endresen - alexander@endresen.org 4 # 5 #This program is free software; you can redistribute it and/or modify 6 #it under the terms of the GNU General Public License as published by 7 #the Free Software Foundation; either version 2 of the License, or 8 #(at your option) any later version. 9 # 10 #This program is distributed in the hope that it will be useful, 11 #but WITHOUT ANY WARRANTY; without even the implied warranty of 12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 #GNU General Public License for more details. 14 #You should have received a copy of the GNU General Public License 15 #along with this program; if not, write to the Free Software 16 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 18 class defaultTheme extends AdminTheme 19 { 20 function renderMenuSection($section, $depth, $maxdepth) 21 { 22 if ($maxdepth > 0 && $depth > $maxdepth) 23 { 24 return; 25 } 26 if (! $this->menuItems[$section]['show_in_menu']) 27 { 28 return; 29 } 30 if (strlen($this->menuItems[$section]['url']) < 1) 31 { 32 echo "<li>".$this->menuItems[$section]['title']."</li>"; 33 return; 34 } 35 echo "<li><a href=\""; 36 echo $this->menuItems[$section]['url']; 37 echo "\""; 38 if (array_key_exists('target', $this->menuItems[$section])) 39 { 40 echo ' rel="external"'; 41 } 42 $class = array(); 43 if ($this->menuItems[$section]['selected']) 44 { 45 $class[] = 'selected'; 46 } 47 if (isset($this->menuItems[$section]['firstmodule'])) 48 { 49 $class[] = 'first_module'; 50 } 51 else if (isset($this->menuItems[$section]['module'])) 52 { 53 $class[] = 'module'; 54 } 55 if (count($class) > 0) 56 { 57 echo ' class="'; 58 for($i=0;$i<count($class);$i++) 59 { 60 if ($i > 0) 61 { 62 echo " "; 63 } 64 echo $class[$i]; 65 } 66 echo '"'; 67 } 68 echo ">"; 69 echo $this->menuItems[$section]['title']; 70 echo "</a>"; 71 if ($this->HasDisplayableChildren($section)) 72 { 73 echo "<ul>"; 74 foreach ($this->menuItems[$section]['children'] as $child) 75 { 76 $this->renderMenuSection($child, $depth+1, $maxdepth); 77 } 78 echo "</ul>"; 79 } 80 echo "</li>"; 81 return; 82 } 83 84 85 function DisplayTopMenu() 86 { 87 echo '<div><p class="logocontainer"><img src="themes/default/images/logo.gif" alt="" /><span class="logotext">'.lang('adminpaneltitle').'</span></p></div>'; 88 echo "<div class=\"topmenucontainer\">\n\t<ul id=\"nav\">"; 89 foreach ($this->menuItems as $key=>$menuItem) { 90 if ($menuItem['parent'] == -1) { 91 echo "\n\t\t"; 92 $this->renderMenuSection($key, 0, -1); 93 } 94 } 95 echo "\n\t</ul>\n"; 96 echo "\t<div class=\"clearb\"></div>\n"; 97 echo "</div>\n"; 98 echo '<div class="breadcrumbs"><p class="breadcrumbs">'; 99 $counter = 0; 100 foreach ($this->breadcrumbs as $crumb) { 101 if ($counter > 0) { 102 echo " » "; 103 } 104 if (str_replace('&', '&', $crumb['url']) != basename($_SERVER['REQUEST_URI'])) 105 { 106 echo '<a class="breadcrumbs" href="'.$crumb['url']; 107 echo '">'.$crumb['title']; 108 echo '</a>'; 109 } 110 else 111 { 112 echo $crumb['title']; 113 } 114 $counter++; 115 } 116 117 echo '</p></div>'; 118 echo '<div class="hstippled"> </div>'; 119 } 120 121 function DisplayFooter() { 122 global $CMS_VERSION; 123 global $CMS_VERSION_NAME; 124 echo '<p class="footer"><a class="footer" href="http://www.cmsmadesimple.org">CMS Made Simple</a> '.$CMS_VERSION.' "' . $CMS_VERSION_NAME . '"<br /><a class="footer" href="http://www.cmsmadesimple.org">CMS Made Simple</a> is free software released under the General Public Licence.</p>'; 125 } 126 127 function OutputHeaderJavascript() { 128 echo '<script type="text/javascript" src="themes/default/includes/standard.js"></script>'; 129 echo '<script type="text/javascript" src="../lib/scriptaculous/prototype.js"></script>'; 130 echo '<script type="text/javascript" src="../lib/scriptaculous/scriptaculous.js"></script>'; 131 echo '<script type="text/javascript" src="../lib/scriptaculous/cmsext.js"></script>'; 132 } 133 134 function StartRighthandColumn() { 135 echo '<div class="navt_menu">'."\n"; 136 echo '<div id="navt_display" class="navt_show" onclick="change(\'navt_display\', \'navt_hide\', \'navt_show\'); change(\'navt_container\', \'invisible\', \'visible\');"></div>'."\n"; 137 echo '<div id="navt_container" class="invisible">'."\n"; 138 echo '<div id="navt_tabs">'."\n"; 139 if (get_preference($this->userid, 'bookmarks')) { 140 echo '<div id="navt_bookmarks">'.lang('bookmarks').'</div>'."\n"; 141 } 142 echo '</div>'."\n"; 143 echo '<div style="clear: both;"></div>'."\n"; 144 echo '<div id="navt_content">'."\n"; 145 } 146 147 function DisplayRecentPages() { 148 if (get_preference($this->userid, 'recent')) { 149 echo '<div id="navt_recent_pages_c">'."\n"; 150 $counter = 0; 151 foreach($this->recent as $pg) { 152 echo "<a href=\"". $pg->url."\">".++$counter.'. '.$pg->title."</a><br />"."\n"; 153 } 154 echo '</div>'."\n"; 155 } 156 } 157 158 function DisplayBookmarks($marks) { 159 if (get_preference($this->userid, 'bookmarks')) { 160 echo '<div id="navt_bookmarks_c">'."\n"; 161 $counter = 0; 162 foreach($marks as $mark) { 163 echo "<a href=\"". $mark->url."\">".++$counter.'. '.$mark->title."</a><br />"."\n"; 164 } 165 echo '</div>'."\n"; 166 } 167 } 168 169 function EndRighthandColumn() { 170 echo '</div>'."\n"; 171 echo '</div>'."\n"; 172 echo '<div style="clear: both;"></div>'."\n"; 173 echo '</div>'."\n"; 174 } 175 176 function DisplayDocType() { 177 178 # echo '<QUESTION_MARK xml version="1.0" encoding="'.get_encoding().'"QUESTION_MARK>'."\n"; 179 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'."\n"; 180 echo ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n"; 181 } 182 183 function DisplayHTMLStartTag() { 184 $tag = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"'; 185 if ($this->cms->nls['direction'] == 'rtl') 186 { 187 $tag .= ' dir="rtl"'; 188 } 189 $tag .= ">\n\n"; 190 echo $tag; 191 } 192 193 function DisplayDashboardCallout($file, $message = '') 194 { 195 if ($message == '') 196 $message = lang('installdirwarning'); 197 198 if (file_exists($file)) 199 { 200 echo "<div class=\"DashboardCallout\">\n"; 201 echo "<div class=\"pageerrorinstalldir\"><p class=\"pageerror\">".$message."</p></div>"; 202 echo "</div> <!-- end DashboardCallout -->\n"; 203 } 204 } 205 206 function DisplayAllSectionPages() 207 { 208 foreach ($this->menuItems as $thisSection=>$menuItem) 209 { 210 if ($menuItem['parent'] != -1) 211 { 212 continue; 213 } 214 if (! $menuItem['show_in_menu']) 215 { 216 continue; 217 } 218 if ($menuItem['url'] == 'index.php' || strlen($menuItem['url']) < 1) 219 { 220 continue; 221 } 222 223 echo "<div class=\"itemmenucontainer\">"; 224 echo '<div class="itemoverflow">'; 225 echo '<p class="itemicon">'; 226 $iconSpec = $thisSection; 227 if ($menuItem['url'] == '../index.php') 228 { 229 $iconSpec = 'viewsite'; 230 } 231 echo '<a href="'.$menuItem['url'].'">'; 232 echo $this->DisplayImage('icons/topfiles/'.$iconSpec.'.gif', $iconSpec, '', '', 'itemicon'); 233 echo '</a>'; 234 echo '</p>'; 235 echo '<p class="itemtext">'; 236 echo "<a class=\"itemlink\" href=\"".$menuItem['url']."\""; 237 if (array_key_exists('target', $menuItem)) 238 { 239 echo ' rel="external"'; 240 } 241 242 echo ">".$menuItem['title']."</a><br />\n"; 243 if (isset($menuItem['description']) && strlen($menuItem['description']) > 0) 244 { 245 echo $menuItem['description']."<br />"; 246 } 247 $this->ListSectionPages($thisSection); 248 echo '</p>'; 249 echo "</div>"; 250 echo '</div>'; 251 } 252 } 253 254 function DisplaySectionPages($section) 255 { 256 global $gCms; 257 if (count($this->menuItems) < 1) 258 { 259 // menu should be initialized before this gets called. 260 // TODO: try to do initialization. 261 // Problem: current page selection, url, etc? 262 return -1; 263 } 264 265 $firstmodule = true; 266 foreach ($this->menuItems[$section]['children'] as $thisChild) 267 { 268 $thisItem = $this->menuItems[$thisChild]; 269 if (! $thisItem['show_in_menu'] || strlen($thisItem['url']) < 1) 270 { 271 continue; 272 } 273 274 // separate system modules from the rest. 275 if( preg_match( '/module=([^&]+)/', $thisItem['url'], $tmp) ) 276 { 277 if( array_search( $tmp[1], $gCms->cmssystemmodules ) === FALSE && $firstmodule == true ) 278 { 279 echo "<hr width=\"90%\"/>"; 280 $firstmodule = false; 281 } 282 } 283 284 echo "<div class=\"itemmenucontainer\">\n"; 285 echo '<div class="itemoverflow">'; 286 echo '<p class="itemicon">'; 287 $moduleIcon = false; 288 $iconSpec = $thisChild; 289 290 // handle module icons 291 if (preg_match( '/module=([^&]+)/', $thisItem['url'], $tmp)) 292 { 293 if ($tmp[1] == 'News') 294 { 295 $iconSpec = 'newsmodule'; 296 } 297 else if ($tmp[1] == 'TinyMCE' || $tmp[1] == 'HTMLArea') 298 { 299 $iconSpec = 'wysiwyg'; 300 } 301 else 302 { 303 $imageSpec = dirname($this->cms->config['root_path'] . 304 '/modules/' . $tmp[1] . '/images/icon.gif') .'/icon.gif'; 305 if (file_exists($imageSpec)) 306 { 307 echo '<a href="'.$thisItem['url'].'"><img class="itemicon" src="'. 308 $this->cms->config['root_url'] . 309 '/modules/' . $tmp[1] . '/images/' . 310 '/icon.gif" alt="'.$thisItem['title'].'" /></a>'; 311 $moduleIcon = true; 312 } 313 else 314 { 315 $iconSpec=$this->TopParent($thisChild); 316 } 317 } 318 } 319 if (! $moduleIcon) 320 { 321 if ($thisItem['url'] == '../index.php') 322 { 323 $iconSpec = 'viewsite'; 324 } 325 echo '<a href="'.$thisItem['url'].'">'; 326 echo $this->DisplayImage('icons/topfiles/'.$iconSpec.'.gif', ''.$thisItem['title'].'', '', '', 'itemicon'); 327 echo '</a>'; 328 } 329 echo '</p>'; 330 echo '<p class="itemtext">'; 331 echo "<a class=\"itemlink\" href=\"".$thisItem['url']."\""; 332 if (array_key_exists('target', $thisItem)) 333 { 334 echo ' rel="external"'; 335 } 336 echo ">".$thisItem['title']."</a><br />\n"; 337 if (isset($thisItem['description']) && strlen($thisItem['description']) > 0) 338 { 339 echo $thisItem['description']."<br />"; 340 } 341 echo '</p>'; 342 echo "</div>"; 343 echo '</div>'; 344 } 345 346 } 347 348 function ListSectionPages($section) 349 { 350 if (! isset($this->menuItems[$section]['children']) || count($this->menuItems[$section]['children']) < 1) 351 { 352 return; 353 } 354 355 if ($this->HasDisplayableChildren($section)) 356 { 357 echo " ".lang('subitems').": "; 358 $count = 0; 359 foreach($this->menuItems[$section]['children'] as $thisChild) 360 { 361 $thisItem = $this->menuItems[$thisChild]; 362 if (! $thisItem['show_in_menu'] || strlen($thisItem['url']) < 1) 363 { 364 continue; 365 } 366 if ($count++ > 0) 367 { 368 echo ", "; 369 } 370 echo "<a class=\"itemsublink\" href=\"".$thisItem['url']; 371 echo "\">".$thisItem['title']."</a>"; 372 } 373 } 374 } 375 376 /* Functions that we want dont want the standard output from */ 377 function OutputFooterJavascript() {} 378 } 379 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |