--- nfo/php/libs/com.newsblob.phphtmllib/widgets/TextCSSNav.inc 2003/01/30 03:29:44 1.1.1.1 +++ nfo/php/libs/com.newsblob.phphtmllib/widgets/TextCSSNav.inc 2004/05/06 16:27:42 1.5 @@ -3,7 +3,7 @@ /** * This contains the TextNav widget * - * $Id: TextCSSNav.inc,v 1.1.1.1 2003/01/30 03:29:44 jonen Exp $ + * $Id: TextCSSNav.inc,v 1.5 2004/05/06 16:27:42 jonen Exp $ * * @author Walter A. Boring IV * @package phpHtmlLib @@ -69,7 +69,7 @@ * @return string the raw html output. */ function render( $indent_level=1, $output_debug=0) { - $this->_selected = $_REQUEST[$this->_query_prefix."textcssnavselected"]; + $this->_selected = @$_REQUEST[$this->_query_prefix."textcssnavselected"]; $div = html_div("textnav", $this->_build_links()); return $div->render( $indent_level, $output_debug ); } @@ -103,7 +103,8 @@ function add($url, $text, $title="", $target="", $selected=FALSE) { array_push($this->data, array("type"=>"url", "url"=>$url, "text"=>$text, "title"=>$title, - "target"=>$target)); + "target"=>$target, + "selected"=> $selected)); } /** @@ -164,7 +165,7 @@ $container = container(); $container->set_collapse(); - $class = "first"; + $is_first = TRUE; $cnt = 1; foreach( $this->data as $nav ) { switch ($nav["type"]) { @@ -176,18 +177,17 @@ } $url .= "&".$this->_query_prefix."textcssnavselected=".$cnt; } - $obj = html_a($url, $nav["text"], "", $nav["target"], $nav["title"]); - if ($class != NULL) { - if ($this->_highlight_selected && $this->_selected == $cnt) { - $class = "selected".$class; - } + $obj = html_a(htmlentities($url), $nav["text"], "normal", $nav["target"], $nav["title"]); + + $is_selected = $this->_highlight_selected && ($this->_selected == $cnt || $nav["selected"]); + $class = $is_selected ? "selected" : ""; + if ($is_first) { + $class .= "first"; + } + if ($is_selected || $is_first) { $obj->set_class( $class ); - $class = NULL; - } else { - if ($this->_highlight_selected && $this->_selected == $cnt) { - $obj->set_class( "selected" ); - } } + $is_first = FALSE; $cnt++; break; case "blank": @@ -211,39 +211,66 @@ class TextCSSNavCSS extends CSSBuilder { function user_setup() { - $this->add_entry(".textnav", "div", - array("margin" => "0px 0px 0px 0px") ); + $this->add_entry(".textnav", "", + array( + "margin" => "0px 0px 0px 0px", + "padding" => "3px 0px 0px 0px", + "height" => "16px", + "color" => "#FFFFFF", + "font-famiy" => "sans-serif", + "font-size" => "11px", + "font-weight" => "bold", + ) ); - $this->add_entry(".textnav", "a", + $this->add_entry(".textnav", "a.normal,a.normal:visited,a.normal:active", array("font-family" => "sans-serif", - "font-size" => "8pt", - "font-weight" => "bold", - "text-decoration" => "none", + "text-decoration" => "none", "color" => "#FFFFFF", "background-color" => "#999999", - "padding" => "4px 4px 4px 4px", + "padding" => "2px 4px 2px 4px", "border-right" => "1px solid #828282", "border-top" => "1px solid #828282", - "border-bottom" => "1px solid #828282") ); - - $this->add_entry(".textnav", "a.first", - array("border-left" => "1px solid #828282") ); + "border-bottom" => "1px solid #828282" + ) ); - $this->add_entry(".textnav", "a.selected", - array("color" => "#828282", - "background-color" => "#EEEEEE") ); + $this->add_entry(".textnav", "a.first,a.first:visited", + array("font-family" => "sans-serif", + "text-decoration" => "none", + "color" => "#FFFFFF", + "background-color" => "#999999", + "padding" => "2px 4px 2px 4px", + "border-left" => "1px solid #828282", + "border-right" => "1px solid #828282", + "border-top" => "1px solid #828282", + "border-bottom" => "1px solid #828282") ); - $this->add_entry(".textnav", "a.selectedfirst", - array("color" => "#828282", + $this->add_entry(".textnav", "a.normal:hover,a.first:hover", + array("color" => "#000000", "background-color" => "#EEEEEE", - "border-left" => "1px solid #828282") ); - + "text-decoration" => "none")); - $this->add_entry(".textnav", "a:hover", - array("color" => "#000000", - "background-color" => "#EEEEEE")); + $this->add_entry(".textnav", "a.selected,a.selected:visited", + array("font-family" => "sans-serif", + "text-decoration" => "none", + "color" => "#828282", + "background-color" => "#EEEEEE", + "padding" => "2px 4px 2px 4px", + "border-right" => "1px solid #828282", + "border-top" => "1px solid #828282", + "border-bottom" => "1px solid #828282" + ) ); - + $this->add_entry(".textnav", "a.selectedfirst,a.selectedfirst:visited", + array("font-family" => "sans-serif", + //"font-size" => "12px", + "font-weight" => "bold", + "text-decoration" => "none", + "color" => "#828282", + "background-color" => "#EEEEEE", + "padding" => "2px 4px 2px 4px", + "border-left" => "1px solid #828282", + "border-top" => "1px solid #828282", + "border-bottom" => "1px solid #828282") ); } } ?>