00001 <?php
00029 function show_popup($id, $text, $popup_id = NULL, $css_class = 'popup', $wstatus = '') {
00030 global $Footnotes;
00031 $Footnotes[] =
00032 "\n"
00033 .'<script type="text/javascript">new Tip($("'.$id.'"), "'
00034 .str_replace(array("\n","\r",'"'),array('','',"'"),$text)
00035 .'", { className: "'.$css_class.'" });</script>';
00036 return ' id="'.$id.'"';
00037 }
00038
00039
00040
00041
00042
00043
00044
00045 function show_help($link, $text, $url = '', $extras = '') {
00046 if ($url)
00047 $url = " href=\"$url\" ";
00048 if (!$_SESSION['show help']) {
00049 if ($url || $extras)
00050 echo "<a $url$extras>$link</a>";
00051 else
00052 echo $link;
00053 return;
00054 }
00055 static $help_count;
00056 $help_count++;
00057 echo '<a'.show_popup('helplink_'.$help_count, $text, NULL, 'help').'>'.$link.'</a>';
00058 }
00059
00060
00061
00062
00063
00064 function generate_popup_menu($id, $css_class, $items, $overload = 0) {
00065 if ($overload >= 50) return '';
00066 if (!count($items)) return '';
00067 if ($id && $overload == 0) {
00068 $text = "<script language=\"JavaScript\" type=\"text/javascript\">\n"
00069 ."<!--\n"
00070 ."register_menu('$id');\n"
00071 ."// -->\n"
00072 ."</script>\n"
00073 ."<ul id=\"$id\"";
00074 }
00075 else
00076 $text = '<ul';
00077 if ($css_class)
00078 $text .= " class=\"$css_class\"";
00079 $text .= ">\n";
00080 $sep = false;
00081 foreach ($items as $item) {
00082
00083 if (is_array($item) && isset($item['name'])) {
00084 $text .= str_repeat(' ', $overload+1) . '<li';
00085
00086 if ($sep) {
00087 $sep = false;
00088 $text .= ' class="sep"';
00089 }
00090
00091 if ($item['url'])
00092 $text .= "><a href=\"".$item['url'].'">'.$item['name'].'</a>';
00093 elseif ($item['click'])
00094 $text .= '><a onclick="'.$item['click'].'">'.$item['name'].'</a>';
00095 else
00096 $text .= '>'.$item['name'];
00097
00098 if ($item['children'])
00099 $text .= "\n".str_repeat(' ', $overload+2).generate_popup_menu('', '', $item['children'], $overload + 2)
00100 .str_repeat(' ', $overload+2);
00101
00102 $text .= "</li>\n";
00103 }
00104
00105 else
00106 $sep = true;
00107 }
00108 return $text.str_repeat(' ', $overload)."</ul>\n";
00109 }