Changeset 11847
- Timestamp:
- 08/30/07 11:29:03 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/baseclasses/core/object.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/services/auth.php (modified) (3 diffs)
- trunk/midcom/midcom.core/midcom/services/uimessages.php (modified) (5 diffs)
- trunk/midcom/midcom.core/midcom/static/midcom.services.uimessages/simple.css (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/baseclasses/core/object.php
r3766 r11847 26 26 { 27 27 function midcom_baseclasses_core_object() {} 28 29 function get_class_magic_default_privileges() 30 { 31 return array 32 ( 33 'EVERYONE' => array(), 34 'ANONYMOUS' => array(), 35 'USERS' => array() 36 ); 37 } 28 38 } 29 39 trunk/midcom/midcom.core/midcom/services/auth.php
r11845 r11847 948 948 if ($tmp_object !== null) 949 949 { 950 if (!isset($tmp_object->__new_class_name__)) 951 { 952 $tmp_class_name = get_class($tmp_object); 953 } 954 else 955 { 956 $tmp_class_name = $tmp_object->__new_class_name__; 957 } 958 950 959 $default_magic_class_privileges = array_merge 951 960 ( 952 $this->_default_magic_class_privileges[$tmp_ object->__new_class_name__]['EVERYONE'],953 $this->_default_magic_class_privileges[$tmp_ object->__new_class_name__]['ANONYMOUS']961 $this->_default_magic_class_privileges[$tmp_class_name]['EVERYONE'], 962 $this->_default_magic_class_privileges[$tmp_class_name]['ANONYMOUS'] 954 963 ); 955 964 } … … 2386 2395 { 2387 2396 // Check if we have loaded these privileges already... 2388 if (array_key_exists($class->__new_class_name__, $this->_default_magic_class_privileges)) 2397 if (!isset($class->__new_class_name__)) 2398 { 2399 $loadable_class = get_class($class); 2400 } 2401 else 2402 { 2403 $loadable_class = $class->__new_class_name__; 2404 } 2405 2406 if (array_key_exists($loadable_class, $this->_default_magic_class_privileges)) 2389 2407 { 2390 2408 return; … … 2392 2410 2393 2411 $privs = $class->get_class_magic_default_privileges(); 2394 $this->_default_magic_class_privileges[$ class->__new_class_name__] = $privs;2412 $this->_default_magic_class_privileges[$loadable_class] = $privs; 2395 2413 2396 2414 return; trunk/midcom/midcom.core/midcom/services/uimessages.php
r3911 r11847 96 96 $this->_allowed_types[] = 'warning'; 97 97 $this->_allowed_types[] = 'error'; 98 99 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/Pearified/JavaScript/Prototype/prototype.js"); 100 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/Pearified/JavaScript/Scriptaculous/scriptaculous.js"); 101 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/midcom.services.uimessages/protoGrowl.js'); 102 103 $_MIDCOM->add_link_head( 104 array 105 ( 106 'rel' => 'stylesheet', 107 'type' => 'text/css', 108 'media' => 'screen', 109 'href' => MIDCOM_STATIC_URL . '/midcom.services.uimessages/protoGrowl.css', 110 ) 111 ); 98 $this->_allowed_types[] = 'debug'; 112 99 } 113 100 … … 118 105 function initialize() 119 106 { 107 if ($_MIDCOM->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) 108 { 109 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/Pearified/JavaScript/Prototype/prototype.js"); 110 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/Pearified/JavaScript/Scriptaculous/scriptaculous.js"); 111 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/midcom.services.uimessages/protoGrowl.js'); 112 113 $_MIDCOM->add_link_head( 114 array 115 ( 116 'rel' => 'stylesheet', 117 'type' => 'text/css', 118 'media' => 'screen', 119 'href' => MIDCOM_STATIC_URL . '/midcom.services.uimessages/protoGrowl.css', 120 ) 121 ); 122 } 123 else 124 { 125 $_MIDCOM->add_link_head( 126 array 127 ( 128 'rel' => 'stylesheet', 129 'type' => 'text/css', 130 'media' => 'screen', 131 'href' => MIDCOM_STATIC_URL . '/midcom.services.uimessages/simple.css', 132 ) 133 ); 134 } 135 120 136 if (!$_MIDGARD['user']) 121 137 { … … 143 159 } 144 160 } 161 } 162 163 function get_class_magic_default_privileges() 164 { 165 $privileges = parent::get_class_magic_default_privileges(); 166 //$privileges['EVERYONE']['midgard:read'] = MIDCOM_PRIVILEGE_DENY; 167 return $privileges; 145 168 } 146 169 … … 219 242 220 243 /** 221 * Show the message stack via javascript calls 244 * Show the message stack via javascript calls or simple html 222 245 */ 223 246 function show() … … 225 248 if (count($this->_message_stack) > 0) 226 249 { 227 echo "<script language=\"javascript\">\n"; 228 229 foreach ($this->_message_stack as $id => $message) 230 { 231 // TODO: Use our own JS call for this 232 echo " new protoGrowl({type: '{$message['type']}', title: '{$message['title']}', message: '{$message['message']}'});\n"; 233 //echo "ooDisplayMessage('{$message['title']}: {$message['message']}', '{$message['type']}');\n"; 250 if ($_MIDCOM->auth->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) 251 { 252 echo "<script type=\"text/javascript\">\n"; 253 254 foreach ($this->_message_stack as $id => $message) 255 { 256 // TODO: Use our own JS call for this 257 echo " new protoGrowl({type: '{$message['type']}', title: '{$message['title']}', message: '{$message['message']}'});\n"; 258 //echo "ooDisplayMessage('{$message['title']}: {$message['message']}', '{$message['type']}');\n"; 234 259 235 // Remove the message from stack 236 unset($this->_message_stack[$id]); 237 } 238 echo "</script>\n"; 239 } 240 } 260 // Remove the message from stack 261 unset($this->_message_stack[$id]); 262 } 263 echo "</script>\n"; 264 } 265 else 266 { 267 echo "<div class=\"midcom_services_uimessages_holder\">\n"; 268 269 foreach ($this->_message_stack as $id => $message) 270 { 271 $this->_render_simple_message($message); 272 273 // Remove the message from stack 274 unset($this->_message_stack[$id]); 275 } 276 277 echo "</div>\n"; 278 } 279 } 280 } 281 282 /** 283 * Render the message via simple html 284 */ 285 function _render_simple_message($message) 286 { 287 echo "<div class=\"midcom_services_uimessages_message {$message['type']}\">"; 288 289 echo "<div class=\"midcom_services_uimessages_message_title\">{$message['title']}</div>"; 290 echo "<div class=\"midcom_services_uimessages_message_msg\">{$message['message']}</div>"; 291 292 echo "</div>\n"; 293 } 294 241 295 } 242 296
