Changeset 1060:84da1bab9dca for inc
- Timestamp:
- 12/10/12 05:32:40 (13 years ago)
- Branch:
- twig
- Location:
- inc/admin
- Files:
-
- 3 edited
-
class.dc.admincontext.php (modified) (3 diffs)
-
default-templates/layout.html.twig (modified) (4 diffs)
-
default-templates/style/default.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.admincontext.php
r1056 r1060 41 41 42 42 'version' => DC_VERSION, 43 'vendor_name' => DC_VENDOR_NAME, 44 45 # Blogs list (not available yet) 46 'blogs' => array(), 47 48 # Current blog (not available yet and never available in auth.php) 49 'blog' => array( 50 'id' => '', 51 'host' => '', 52 'url' => '', 53 'name' => '' 54 ) 43 'vendor_name' => DC_VENDOR_NAME 55 44 ); 56 45 } … … 140 129 public function getGlobals() 141 130 { 142 # Blogs list 143 if ($this->core->auth->blog_count > 1 && $this->core->auth->blog_count < 20) { 144 $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); 145 while ($rs_blogs->fetch()) { 146 $this->protected_globals['blogs'][html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; 147 } 148 } 149 # Current blog 150 if ($this->core->auth->blog_count) { 151 $this->protected_globals['blog'] = array( 152 'id' => $this->core->blog->id, 153 'host' => $this->core->blog->host, 154 'url' => $this->core->blog->url, 155 'name' => $this->core->blog->name 156 ); 157 } 131 $this->getBlogs(); 132 $this->getCurrentBlog(); 133 $this->getCurrentUser(); 134 135 # Additional globals 136 $p = path::info($_SERVER['REQUEST_URI']); 137 $this->protected_globals['current_page'] = $p['base']; 138 $this->protected_globals['blog_count'] = $this->core->auth->blog_count; 139 158 140 # Keep protected globals safe 159 141 return array_merge($this->globals,$this->protected_globals); … … 222 204 } 223 205 } 206 207 /** 208 * Get list of blogs 209 */ 210 protected function getBlogs() 211 { 212 # Blogs list 213 $blogs = array(); 214 if ($this->core->auth->blog_count > 1 && $this->core->auth->blog_count < 20) { 215 $rs_blogs = $this->core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); 216 while ($rs_blogs->fetch()) { 217 $blogs[$rs_blogs->blog_id] = $rs_blogs->blog_name.' - '.$rs_blogs->blog_url; 218 $this->protected_globals['blogs'][$rs_blogs->blog_id] = array( 219 'id' => $rs_blogs->blog_id, 220 'name' => $rs_blogs->blog_name, 221 'desc' => $rs_blogs->blog_desc, 222 'url' => $rs_blogs->blog_url, 223 'creadt' => $rs_blogs->blog_creadt, 224 'upddt' => $rs_blogs->blog_upddt 225 ); 226 } 227 } 228 229 # Switch blog form 230 $form = new dcForm($this->core,'switchblog_menu','index.php'); 231 $form 232 ->addField( 233 new dcFieldCombo('switchblog',$this->core->blog->id,$blogs,array( 234 'label' => __('Blogs:')))) 235 ->addField( 236 new dcFieldSubmit('switchblog_submit',__('ok'),array( 237 'action' => 'switchblog'))) 238 ->setup(); 239 } 240 241 /** 242 * Get current blog information 243 */ 244 protected function getCurrentBlog() 245 { 246 $this->protected_globals['current_blog'] = $this->core->auth->blog_count ? 247 array( 248 'id' => $this->core->blog->id, 249 'name' => $this->core->blog->name, 250 'desc' => $this->core->blog->desc, 251 'url' => $this->core->blog->url, 252 'host' => $this->core->blog->host, 253 'creadt' => $this->core->blog->creadt, 254 'upddt' => $this->core->blog->upddt 255 ) : array( 256 'id' => '', 257 'name' => '', 258 'desc' => '', 259 'url' => '', 260 'host' => '', 261 'creadt' => '', 262 'upddt' => '' 263 ); 264 } 265 266 /** 267 * Get current user information 268 */ 269 protected function getCurrentUser() 270 { 271 $this->protected_globals['current_user'] = $this->core->auth->userID() ? 272 array( 273 'id' => $this->core->auth->userID(), 274 'admin' => $this->core->auth->getInfo('user_admin'), 275 'name' => $this->core->auth->getInfo('user_name'), 276 'firstname' => $this->core->auth->getInfo('user_firstname'), 277 'displayname' => $this->core->auth->getInfo('user_displayname'), 278 'url' => $this->core->auth->getInfo('user_url'), 279 'blog' => $this->core->auth->getInfo('user_default_blog'), 280 'lang' => $this->core->auth->getInfo('user_lang'), 281 'tz' => $this->core->auth->getInfo('user_tz'), 282 'creadt' => $this->core->auth->getInfo('user_creadt'), 283 'cn' => $this->core->auth->getInfo('user_cn') 284 ) : 285 array( 286 'id' => '', 287 'admin' => '', 288 'name' => '', 289 'firstname' => '', 290 'displayname' => '', 291 'url' => '', 292 'blog' => '', 293 'lang' => 'en', 294 'tz' => '', 295 'creadt' => '', 296 'cn' => '', 297 ); 298 } 224 299 } 225 300 ?> -
inc/admin/default-templates/layout.html.twig
r1056 r1060 1 1 {% import "js_helpers.html.twig" as js %} 2 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang=" en" lang="en">3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{current_user.lang}}" lang="{{current_user.lang}}"> 4 4 <head> 5 5 {% block header %} 6 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 7 <title>{% block title %}{{page_title}} - {% if blog.name is not empty %}{{blog.name}} - {% endif %}{{vendor_name}} - {{version}}{% endblock %}</title>7 <title>{% block title %}{{page_title}} - {% if current_blog.name is not empty %}{{current_blog.name}} - {% endif %}{{vendor_name}} - {{version}}{% endblock %}</title> 8 8 <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" /> 9 9 <meta name="GOOGLEBOT" content="NOSNIPPET" /> … … 18 18 </head> 19 19 20 21 20 <body id="dotclear-admin"> 22 21 <div id="header"> … … 28 27 <div id="info-boxes"> 29 28 <div id="info-box1"> 30 <form action="index.php" method="post"> 31 Blog : <strong title="http://localhost/dc23/index.php?">Mon premier blog</strong> 32 <a href="http://localhost/dc23/index.php?" onclick="window.open(this.href);return false;" 33 title="{{ __('Go to site') }} ({{__('new window')}})">{{__('Go to site')}}<img src="images/outgoing.png" alt="" /></a> 34 </form> 29 {% form switchblog_menu %} 30 {% if blog_count > 1 and blog_count < 20 %} 31 {{ form_field('switchblog') }} 32 <noscript><div>{{ form_field('switchblog_submit') }}</div></noscript> 33 {% else %} 34 {{__('Blog:')}} <strong title="{{current_blog.url}}">{{current_blog.name}}</strong> 35 {% if blogs is not empty %} - <a href="blogs.php">{{__('Change blog')}}</a>{% endif %} 36 {% endif %} 37 <a href="{{current_blog.url}}" onclick="window.open(this.href);return false;" title="{{__('Go to site')}} ({{__('new window')}})">{{__('Go to site')}} <img src="{{theme_url}}images/outgoing.png" alt="" /></a> 38 {% endform %} 35 39 </div> 36 40 <div id="info-box2"> 37 <a class="active"href="index.php">{{__('My dashboard')}}</a><span> | </span>38 <a href="preferences.php">{{__('My preferences')}}</a><span> | </span>39 <a href="index.php?logout=1" class="logout"> Déconnecter dsls<img src="images/logout.png" alt="" /></a>41 <a {%if current_page == 'index' %}class="active" {% endif %}href="index.php">{{__('My dashboard')}}</a><span> | </span> 42 <a {%if current_page == 'preferences' %}class="active" {% endif %}href="preferences.php">{{__('My preferences')}}</a><span> | </span> 43 <a href="index.php?logout=1" class="logout">{{__('Logout %s')|format(current_user.id)}} <img src="images/logout.png" alt="" /></a> 40 44 </div> 41 45 </div> … … 45 49 <div id="content"> 46 50 {% block content %} 47 <h2>{{ blog.name}} › <span class="page-title">{{page_title}}</span></h2>51 <h2>{{current_blog.name}} › <span class="page-title">{{page_title}}</span></h2> 48 52 {% if page_message is not empty %} 49 53 <p class="message">{{page_message}}</p> -
inc/admin/default-templates/style/default.css
r1056 r1060 150 150 #info-box1 select { 151 151 width: 15em; 152 } 153 #info-box1 label { 154 margin-right: .3em; 155 display: inline; 152 156 } 153 157 #info-box1 a img, #info-box2 a img {
Note: See TracChangeset
for help on using the changeset viewer.
