Changeset 12995
- Timestamp:
- 10/22/07 19:55:16 (1 year ago)
- Files:
-
- trunk/midcom/fi.protie.navigation/config/manifest.inc (modified) (2 diffs)
- trunk/midcom/fi.protie.navigation/main.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/fi.protie.navigation/config/manifest.inc
r11082 r12995 1 1 'name' => 'fi.protie.navigation', 2 'version' => '1.1. 1beta1',2 'version' => '1.1.2beta1', 3 3 'state' => 'beta', 4 4 'purecode' => true, … … 27 27 'role' => 'lead', 28 28 ), 29 'w_i' => Array 30 ( 31 'name' => 'Jerry Jalava', 32 'email' => 'jerry.jalava@gmail.com', 33 'role' => 'developer', 34 ), 29 35 ), 30 36 'dependencies' => Array trunk/midcom/fi.protie.navigation/main.php
r11094 r12995 167 167 var $component_name_to_class = false; 168 168 169 /**169 /** 170 170 * Add first and last-class names to list item ul class name 171 171 * … … 246 246 */ 247 247 var $css_active = 'active'; 248 249 /** 250 * parameter listening enabled 251 * 252 * @access private 253 * @var boolean 254 */ 255 var $_listen_params = false; 256 257 /** 258 * Registered get -parameters for listening 259 * 260 * @access private 261 * @var array 262 */ 263 var $_get_params = array(); 264 265 /** 266 * Registered post -parameters for listening 267 * Not supported yet. 268 * 269 * @access private 270 * @var array 271 */ 272 var $_post_params = array(); 273 274 /** 275 * Cache for parameters to be listened 276 * 277 * @access private 278 * @var string 279 */ 280 var $_params_cache = false; 248 281 249 282 /** … … 262 295 $this->root_id = $id; 263 296 } 297 } 298 299 function listen_parameter($name, $value=false, $type='get') 300 { 301 if (empty($name)) 302 { 303 return; 304 } 305 306 $type = strtolower($type); 307 308 switch($type) 309 { 310 case 'post': 311 if ( isset($this->_post_params[$name]) 312 && $this->_post_params[$name] == $value) 313 { 314 return; 315 } 316 $this->_post_params[$name] = $value; 317 break; 318 case 'get': 319 default: 320 if ( isset($this->_get_params[$name]) 321 && $this->_get_params[$name] == $value) 322 { 323 return; 324 } 325 $this->_get_params[$name] = $value; 326 } 327 328 $this->_listen_params = true; 329 } 330 331 function _collect_parameters() 332 { 333 if (empty($this->_get_params)) 334 { 335 $this->_params_cache = ''; 336 return; 337 } 338 339 $_prefix = '?'; 340 $this->_params_cache = ''; 341 342 foreach ($this->_get_params as $key => $value) 343 { 344 if (isset($_GET[$key])) 345 { 346 if ($value) 347 { 348 if ($_GET[$key] == $value) 349 { 350 $this->_params_cache .= "{$_prefix}{$key}={$value}"; 351 $_prefix = '&'; 352 } 353 } 354 elseif (! $_GET[$key]) 355 { 356 $this->_params_cache .= "{$_prefix}{$key}"; 357 $_prefix = '&'; 358 } 359 } 360 } 361 } 362 363 function _get_parameter_string() 364 { 365 if (! $this->_params_cache) 366 { 367 $this->_collect_parameters(); 368 } 369 370 return $this->_params_cache; 264 371 } 265 372 … … 357 464 358 465 echo "{$indent}<ul class=\"{$this->css_list_style} node-{$id}\"{$element_id}>\n"; 359 466 360 467 $item_count = count($children); 361 468 $item_counter = 0; 362 469 363 470 // Draw each child element 364 471 foreach ($children as $child) … … 372 479 $first_last = ''; 373 480 $has_childs = ''; 374 481 375 482 if($item_counter == 1 && $item_counter == $item_count) 376 483 { … … 385 492 $first_last = $this->css_last; 386 493 } 387 494 388 495 $item = $this->_nap->get_node($child); 389 496 … … 495 602 continue; 496 603 } 497 604 498 605 $item = $this->_nap->get_node($child[MIDCOM_NAV_ID]); 499 606 … … 517 624 { 518 625 $item = $this->_nap->get_leaf($child[MIDCOM_NAV_ID]); 519 626 520 627 // Place the corresponding css class for the currently active leaf) 521 628 if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_leaf()) … … 539 646 $url_name_to_class = ereg_replace('\.|/', '', $item[MIDCOM_NAV_URL]); 540 647 } 541 542 648 543 649 $css_class = $selected; 544 650 545 651 // Check if the class is active 546 652 if ($active !== '') … … 561 667 } 562 668 563 // Check if the first or last is supposed to be drawn669 // Check if the first or last is supposed to be drawn 564 670 if ($this->first_and_last_to_class && $first_last !== '') 565 671 { … … 573 679 } 574 680 575 // Add information about the object's translation status576 if ( isset($item[MIDCOM_NAV_OBJECT]->lang)577 && $item[MIDCOM_NAV_OBJECT]->lang != $_MIDCOM->i18n->get_midgard_language())578 {579 $css_class .= ' untranslated';580 }581 582 681 $css_class = trim($css_class); 583 682 … … 592 691 } 593 692 693 $get_params = $this->_get_parameter_string(); 694 594 695 echo "{$indent} <li{$class}>\n"; 595 echo "{$indent} <a href=\"{$item[MIDCOM_NAV_FULLURL]} \">{$item[MIDCOM_NAV_NAME]}</a>\n";696 echo "{$indent} <a href=\"{$item[MIDCOM_NAV_FULLURL]}{$get_params}\">{$item[MIDCOM_NAV_NAME]}</a>\n"; 596 697 597 698 // If either of the follow nodes switches is on, follow all the nodes
