Changeset 1089:049be1a46863 for inc
- Timestamp:
- 12/19/12 11:57:54 (13 years ago)
- Branch:
- twig
- Location:
- inc/admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.admincontext.php
r1088 r1089 33 33 # Globals not editable via context 34 34 $this->protected_globals = array( 35 'page_messages_static' => array(), 36 'page_messages_lists' => array(), 37 'page_message' => '', 38 'page_errors' => array(), 39 'page_title' => '', 35 'messages' => array( 36 'static' => array(), 37 'lists' => array(), 38 'alert' => '', 39 'errors' => array() 40 ), 41 42 'page_title' => array(), 43 'page_global' => false, 40 44 41 45 'admin_url' => DC_ADMIN_URL, … … 73 77 Add a global variable 74 78 75 76 79 @param string $name Name of the variable 80 @param mixed $value Value of the variable 77 81 */ 78 82 public function __set($name,$value) … … 94 98 95 99 @param string $name Name of the variable 96 100 @return mixed Value of the variable or null 97 101 */ 98 102 public function __get($name) … … 101 105 } 102 106 103 104 105 107 /** 108 Returns a list of filters to add to the existing list. 109 106 110 @return array An array of filters 107 111 */ 108 112 public function getFilters() 109 113 { … … 113 117 } 114 118 115 116 117 118 119 119 /** 120 Returns a list of functions to add to the existing list. 121 122 @return array An array of functions 123 */ 120 124 public function getFunctions() 121 125 { … … 127 131 } 128 132 129 130 133 /** 134 Returns a list of global variables to add to the existing list. 131 135 132 136 This merges overloaded variables with defined variables. 133 134 135 137 138 @return array An array of global variables 139 */ 136 140 public function getGlobals() 137 141 { … … 157 161 } 158 162 159 160 *Returns the name of the extension.161 * 162 *@return string The extension name163 163 /** 164 Returns the name of the extension. 165 166 @return string The extension name 167 */ 164 168 public function getName() 165 169 { … … 188 192 public function addMessageStatic($message) 189 193 { 190 $this->protected_globals[' page_messages_static'][] = $message;194 $this->protected_globals['messages']['static'][] = $message; 191 195 return $this; 192 196 } … … 201 205 public function addMessagesList($title,$messages) 202 206 { 203 $this->protected_globals[' page_messages_lists'][$title] = $messages;207 $this->protected_globals['messages']['lists'][$title] = $messages; 204 208 return $this; 205 209 } … … 211 215 @return object self 212 216 */ 213 public function set Message($message)214 { 215 $this->protected_globals[' page_message'] = $message;216 return $this; 217 } 218 217 public function setAlert($message) 218 { 219 $this->protected_globals['messages']['alert'] = $message; 220 return $this; 221 } 222 219 223 /** 220 224 Add an error message … … 225 229 public function addError($error) 226 230 { 227 $this->protected_globals[' page_errors'][] = $error;231 $this->protected_globals['messages']['errors'][] = $error; 228 232 return $this; 229 233 } … … 236 240 public function hasError() 237 241 { 238 return !empty($this->protected_globals['page_errors']); 239 } 240 241 /** 242 Add page title 243 */ 244 public function setPageTitle($title) 245 { 246 $this->protected_globals['page_title'] = $title; 242 return !empty($this->protected_globals['messages']['errors']); 243 } 244 245 /** 246 Fill the page title 247 248 $title can be: 249 a string for page title part or 250 TRUE to add blog name at the begining of title or 251 NULL to empty/reset title 252 253 @param mixed $title A title part 254 @param boolean $url Link of the title part 255 @return object self 256 */ 257 public function fillPageTitle($title,$url='') 258 { 259 if (is_bool($title)) { 260 $this->protected_globals['page_global'] = $title; 261 } 262 elseif (null === $title) { 263 $this->protected_globals['page_global'] = false; 264 $this->protected_globals['page_title'] = array(); 265 } 266 else { 267 $this->protected_globals['page_title'][] = array( 268 'title' => $title, 269 'link' => $url 270 ); 271 } 272 return $this; 247 273 } 248 274 … … 256 282 257 283 /** 258 *Get list of blogs259 284 Get list of blogs 285 */ 260 286 protected function getBlogs() 261 287 { … … 293 319 294 320 /** 295 *Get current blog information296 321 Get current blog information 322 */ 297 323 protected function getCurrentBlog() 298 324 { … … 318 344 319 345 /** 320 *Get current user information321 346 Get current user information 347 */ 322 348 protected function getCurrentUser() 323 349 { … … 366 392 } 367 393 394 /** 395 Get sidebar menus 396 */ 368 397 protected function getMenus() 369 398 { -
inc/admin/default-templates/auth.html.twig
r1059 r1089 21 21 <div id="login-screen"> 22 22 <h1>{{vendor_name}}</h1> 23 {% if page_messageis not empty %}24 <p class="message">{{ page_message}}</p>23 {% if messages.alert is not empty %} 24 <p class="message">{{ messages.alert }}</p> 25 25 {% endif %} 26 {% if page_errors is not empty %}26 {% if messages.errors is not empty %} 27 27 <div class="error"> 28 28 <p><strong>Errors :</strong></p> 29 29 <ul> 30 {% for error in page_errors %}31 <li>{{ error}}</li>30 {% for error in messages.errors %} 31 <li>{{ error }}</li> 32 32 {% endfor %} 33 33 </ul> -
inc/admin/default-templates/layout.html.twig
r1087 r1089 5 5 {% block header %} 6 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 7 <title>{% block title %}{ {page_title}} -{% if current_blog.name is not empty %}{{current_blog.name}} - {% endif %}{{vendor_name}} - {{version}}{% endblock %}</title>7 <title>{% block title %}{% for part in page_title %}{{ part.title }} - {% endfor %}{% 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" /> … … 53 53 </div> 54 54 {% endif %} 55 <h2>{{current_blog.name}} › <span class="page-title">{{page_title}}</span></h2> 56 {% if page_messages_static is not empty %} 57 {% for message in page_messages_static %} 55 <h2> 56 {%- if not page_global %}{{current_blog.name}} › {% endif %} 57 {%- for part in page_title %} 58 {%- if loop.last %}<span class="page-title">{% endif %} 59 {%- if part.link is not empty %}<a href="{{ part.link }}">{{ part.title }}</a>{% else %}{{ part.title }}{% endif %} 60 {%- if loop.last %}</span>{% else %} › {% endif %} 61 {%- endfor -%} 62 </h2> 63 {% if messages.static is not empty %} 64 {% for message in messages.static %} 58 65 <p class="static-msg">{{ message }}</p> 59 66 {% endfor %} 60 67 {% endif %} 61 {% if page_messages_lists is not empty %}62 {% for title,messages in page_messages_lists %}68 {% if messages.lists is not empty %} 69 {% for title,messages in messages.lists %} 63 70 <div class="static-msg">{{ title }}<ul> 64 71 {% for message in messages %} … … 68 75 {% endfor %} 69 76 {% endif %} 70 {% if page_messageis not empty %}71 <p class="message">{{ page_message}}</p>77 {% if messages.alert is not empty %} 78 <p class="message">{{ messages.alert }}</p> 72 79 {% endif %} 73 {% if page_errors is not empty %}80 {% if messages.errors is not empty %} 74 81 <div class="error"> 75 82 <p><strong>Errors :</strong></p> 76 83 <ul> 77 {% for error in page_errors %}78 <li>{{ error}}</li>84 {% for error in messages.errors %} 85 <li>{{ error }}</li> 79 86 {% endfor %} 80 87 </ul> -
inc/admin/default-templates/popup.html.twig
r1074 r1089 24 24 {% block content %} 25 25 <h2>{{current_blog.name}} › <span class="page-title">{{page_title}}</span></h2> 26 {% if page_messageis not empty %}27 <p class="message">{{ page_message}}</p>26 {% if messages.alert is not empty %} 27 <p class="message">{{ messages.alert }}</p> 28 28 {% endif %} 29 {% if page_errors is not empty %}29 {% if messages.errors is not empty %} 30 30 <div class="error"> 31 31 <p><strong>Errors :</strong></p> 32 32 <ul> 33 {% for error in page_errors %}34 <li>{{ error}}</li>33 {% for error in messages.errors %} 34 <li>{{ error }}</li> 35 35 {% endfor %} 36 36 </ul> -
inc/admin/lib.dc.page.php
r1085 r1089 55 55 $_ctx->popup = (boolean) $popup; 56 56 $_ctx->page_header = $head; 57 $_ctx-> setPageTitle($title);57 $_ctx->fillPageTitle($title); 58 58 59 59 ob_start();
Note: See TracChangeset
for help on using the changeset viewer.