Annotation of /mambo/branches/4.5.4/includes/mamboHTML.php
Parent Directory
|
Revision Log
Revision 83 - (view) (download)
| 1 : | counterpoi | 83 | t <?php |
| 2 : | t | ||
| 3 : | t /** | ||
| 4 : | t * Utility class for all HTML drawing classes | ||
| 5 : | t * @package Mambo | ||
| 6 : | t */ | ||
| 7 : | t | ||
| 8 : | t class mosHTML { | ||
| 9 : | t | ||
| 10 : | t function makeOption( $value, $text='' ) { | ||
| 11 : | t $obj = new stdClass; | ||
| 12 : | t $obj->value = $value; | ||
| 13 : | t $obj->text = trim( $text ) ? $text : $value; | ||
| 14 : | t return $obj; | ||
| 15 : | t } | ||
| 16 : | t | ||
| 17 : | t function writableCell( $folder ) { | ||
| 18 : | t echo '<tr>'; | ||
| 19 : | t echo '<td class="item">' . $folder . '/</td>'; | ||
| 20 : | t echo '<td align="left">'; | ||
| 21 : | t echo is_writable( "../$folder" ) ? '<b><font color="green">Writeable</font></b>' : '<b><font color="red">Unwriteable</font></b>' . '</td>'; | ||
| 22 : | t echo '</tr>'; | ||
| 23 : | t } | ||
| 24 : | t | ||
| 25 : | t /** | ||
| 26 : | t * Generates an HTML select list | ||
| 27 : | t * @param array An array of objects | ||
| 28 : | t * @param string The value of the HTML name attribute | ||
| 29 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 30 : | t * @param string The name of the object variable for the option value | ||
| 31 : | t * @param string The name of the object variable for the option text | ||
| 32 : | t * @param mixed The key that is selected | ||
| 33 : | t * @returns string HTML for the select list | ||
| 34 : | t */ | ||
| 35 : | t function selectList ( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL ) { | ||
| 36 : | t reset( $arr ); | ||
| 37 : | t $html = "\n<select name=\"$tag_name\" $tag_attribs>"; | ||
| 38 : | t for ($i=0, $n=count( $arr ); $i < $n; $i++ ) { | ||
| 39 : | t $k = $arr[$i]->$key; | ||
| 40 : | t $t = $arr[$i]->$text; | ||
| 41 : | t $id = @$arr[$i]->id; | ||
| 42 : | t | ||
| 43 : | t $extra = ''; | ||
| 44 : | t $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : ''; | ||
| 45 : | t if (is_array( $selected )) { | ||
| 46 : | t foreach ($selected as $obj) { | ||
| 47 : | t $k2 = $obj->$key; | ||
| 48 : | t if ($k == $k2) { | ||
| 49 : | t $extra .= " selected=\"selected\""; | ||
| 50 : | t break; | ||
| 51 : | t } | ||
| 52 : | t } | ||
| 53 : | t } else { | ||
| 54 : | t $extra .= ($k == $selected ? " selected=\"selected\"" : ''); | ||
| 55 : | t } | ||
| 56 : | t $html .= "\n\t<option value=\"".$k."\"$extra>" . $t . "</option>"; | ||
| 57 : | t } | ||
| 58 : | t $html .= "\n</select>\n"; | ||
| 59 : | t return $html; | ||
| 60 : | t } | ||
| 61 : | t | ||
| 62 : | t /** | ||
| 63 : | t * Writes a select list of integers | ||
| 64 : | t * @param int The start integer | ||
| 65 : | t * @param int The end integer | ||
| 66 : | t * @param int The increment | ||
| 67 : | t * @param string The value of the HTML name attribute | ||
| 68 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 69 : | t * @param mixed The key that is selected | ||
| 70 : | t * @param string The printf format to be applied to the number | ||
| 71 : | t * @returns string HTML for the select list | ||
| 72 : | t */ | ||
| 73 : | t function integerSelectList( $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="" ) { | ||
| 74 : | t $start = intval( $start ); | ||
| 75 : | t $end = intval( $end ); | ||
| 76 : | t $inc = intval( $inc ); | ||
| 77 : | t $arr = array(); | ||
| 78 : | t for ($i=$start; $i <= $end; $i+=$inc) { | ||
| 79 : | t $fi = $format ? sprintf( "$format", $i ) : "$i"; | ||
| 80 : | t $arr[] = mosHTML::makeOption( $fi, $fi ); | ||
| 81 : | t } | ||
| 82 : | t | ||
| 83 : | t return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); | ||
| 84 : | t } | ||
| 85 : | t | ||
| 86 : | t /** | ||
| 87 : | t * Writes a select list of month names based on Language settings | ||
| 88 : | t * @param string The value of the HTML name attribute | ||
| 89 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 90 : | t * @param mixed The key that is selected | ||
| 91 : | t * @returns string HTML for the select list values | ||
| 92 : | t */ | ||
| 93 : | t function monthSelectList( $tag_name, $tag_attribs, $selected ) { | ||
| 94 : | t $arr = array( | ||
| 95 : | t mosHTML::makeOption( '01', _JAN ), | ||
| 96 : | t mosHTML::makeOption( '02', _FEB ), | ||
| 97 : | t mosHTML::makeOption( '03', _MAR ), | ||
| 98 : | t mosHTML::makeOption( '04', _APR ), | ||
| 99 : | t mosHTML::makeOption( '05', _MAY ), | ||
| 100 : | t mosHTML::makeOption( '06', _JUN ), | ||
| 101 : | t mosHTML::makeOption( '07', _JUL ), | ||
| 102 : | t mosHTML::makeOption( '08', _AUG ), | ||
| 103 : | t mosHTML::makeOption( '09', _SEP ), | ||
| 104 : | t mosHTML::makeOption( '10', _OCT ), | ||
| 105 : | t mosHTML::makeOption( '11', _NOV ), | ||
| 106 : | t mosHTML::makeOption( '12', _DEC ) | ||
| 107 : | t ); | ||
| 108 : | t | ||
| 109 : | t return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); | ||
| 110 : | t } | ||
| 111 : | t | ||
| 112 : | t /** | ||
| 113 : | t * Writes a yes/no select list | ||
| 114 : | t * @param string The value of the HTML name attribute | ||
| 115 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 116 : | t * @param mixed The key that is selected | ||
| 117 : | t * @returns string HTML for the select list values | ||
| 118 : | t */ | ||
| 119 : | t function yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes=_CMN_YES, $no=_CMN_NO ) { | ||
| 120 : | t $arr = array( | ||
| 121 : | t mosHTML::makeOption( '0', $no ), | ||
| 122 : | t mosHTML::makeOption( '1', $yes ), | ||
| 123 : | t ); | ||
| 124 : | t | ||
| 125 : | t return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); | ||
| 126 : | t } | ||
| 127 : | t | ||
| 128 : | t /** | ||
| 129 : | t * Generates an HTML radio list | ||
| 130 : | t * @param array An array of objects | ||
| 131 : | t * @param string The value of the HTML name attribute | ||
| 132 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 133 : | t * @param mixed The key that is selected | ||
| 134 : | t * @param string The name of the object variable for the option value | ||
| 135 : | t * @param string The name of the object variable for the option text | ||
| 136 : | t * @returns string HTML for the select list | ||
| 137 : | t */ | ||
| 138 : | t function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text' ) { | ||
| 139 : | t reset( $arr ); | ||
| 140 : | t $html = ""; | ||
| 141 : | t for ($i=0, $n=count( $arr ); $i < $n; $i++ ) { | ||
| 142 : | t $k = $arr[$i]->$key; | ||
| 143 : | t $t = $arr[$i]->$text; | ||
| 144 : | t $id = @$arr[$i]->id; | ||
| 145 : | t | ||
| 146 : | t $extra = ''; | ||
| 147 : | t $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : ''; | ||
| 148 : | t if (is_array( $selected )) { | ||
| 149 : | t foreach ($selected as $obj) { | ||
| 150 : | t $k2 = $obj->$key; | ||
| 151 : | t if ($k == $k2) { | ||
| 152 : | t $extra .= " selected=\"selected\""; | ||
| 153 : | t break; | ||
| 154 : | t } | ||
| 155 : | t } | ||
| 156 : | t } else { | ||
| 157 : | t $extra .= ($k == $selected ? " checked=\"checked\"" : ''); | ||
| 158 : | t } | ||
| 159 : | t $html .= "\n\t<input type=\"radio\" name=\"$tag_name\" value=\"".$k."\"$extra $tag_attribs />" . $t; | ||
| 160 : | t } | ||
| 161 : | t $html .= "\n"; | ||
| 162 : | t return $html; | ||
| 163 : | t } | ||
| 164 : | t | ||
| 165 : | t /** | ||
| 166 : | t * Writes a yes/no radio list | ||
| 167 : | t * @param string The value of the HTML name attribute | ||
| 168 : | t * @param string Additional HTML attributes for the <select> tag | ||
| 169 : | t * @param mixed The key that is selected | ||
| 170 : | t * @returns string HTML for the radio list | ||
| 171 : | t */ | ||
| 172 : | t function yesnoRadioList( $tag_name, $tag_attribs, $selected, $yes=_CMN_YES, $no=_CMN_NO ) { | ||
| 173 : | t $arr = array( | ||
| 174 : | t mosHTML::makeOption( '0', $no, true ), | ||
| 175 : | t mosHTML::makeOption( '1', $yes, true ) | ||
| 176 : | t ); | ||
| 177 : | t return mosHTML::radioList( $arr, $tag_name, $tag_attribs, $selected ); | ||
| 178 : | t } | ||
| 179 : | t | ||
| 180 : | t /** | ||
| 181 : | t * @param int The row index | ||
| 182 : | t * @param int The record id | ||
| 183 : | t * @param boolean | ||
| 184 : | t * @param string The name of the form element | ||
| 185 : | t * @return string | ||
| 186 : | t */ | ||
| 187 : | t function idBox( $rowNum, $recId, $checkedOut=false, $name='cid' ) { | ||
| 188 : | t if ( $checkedOut ) { | ||
| 189 : | t return ''; | ||
| 190 : | t } else { | ||
| 191 : | t return '<input type="checkbox" id="cb'.$rowNum.'" name="'.$name.'[]" value="'.$recId.'" onclick="isChecked(this.checked);" />'; | ||
| 192 : | t } | ||
| 193 : | t } | ||
| 194 : | t | ||
| 195 : | t function sortIcon( $base_href, $field, $state='none' ) { | ||
| 196 : | t global $mosConfig_live_site; | ||
| 197 : | t | ||
| 198 : | t $alts = array( | ||
| 199 : | t 'none' => _CMN_SORT_NONE, | ||
| 200 : | t 'asc' => _CMN_SORT_ASC, | ||
| 201 : | t 'desc' => _CMN_SORT_DESC, | ||
| 202 : | t ); | ||
| 203 : | t $next_state = 'asc'; | ||
| 204 : | t if ($state == 'asc') { | ||
| 205 : | t $next_state = 'desc'; | ||
| 206 : | t } else if ($state == 'desc') { | ||
| 207 : | t $next_state = 'none'; | ||
| 208 : | t } | ||
| 209 : | t | ||
| 210 : | t $html = "<a href=\"$base_href&field=$field&order=$next_state\">" | ||
| 211 : | t . "<img src=\"$mosConfig_live_site/images/M_images/sort_$state.png\" width=\"12\" height=\"12\" border=\"0\" alt=\"{$alts[$next_state]}\" />" | ||
| 212 : | t . "</a>"; | ||
| 213 : | t return $html; | ||
| 214 : | t } | ||
| 215 : | t | ||
| 216 : | t /** | ||
| 217 : | t * Writes Close Button | ||
| 218 : | t */ | ||
| 219 : | t function CloseButton ( &$params, $hide_js=NULL ) { | ||
| 220 : | t // displays close button in Pop-up window | ||
| 221 : | t if ( $params->get( 'popup' ) && !$hide_js ) { | ||
| 222 : | t ?> | ||
| 223 : | t <div align="center" style="margin-top: 30px; margin-bottom: 30px;"> | ||
| 224 : | t <a href='javascript:window.close();'> | ||
| 225 : | t <span class="small"> | ||
| 226 : | t <?php echo _PROMPT_CLOSE;?> | ||
| 227 : | t </span> | ||
| 228 : | t </a> | ||
| 229 : | t </div> | ||
| 230 : | t <?php | ||
| 231 : | t } | ||
| 232 : | t } | ||
| 233 : | t | ||
| 234 : | t /** | ||
| 235 : | t * Writes Back Button | ||
| 236 : | t */ | ||
| 237 : | t function BackButton ( &$params, $hide_js=NULL ) { | ||
| 238 : | t // Back Button | ||
| 239 : | t if ( $params->get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) { | ||
| 240 : | t ?> | ||
| 241 : | t <div class="back_button"> | ||
| 242 : | t <a href='javascript:history.go(-1)'> | ||
| 243 : | t <?php echo _BACK; ?> | ||
| 244 : | t </a> | ||
| 245 : | t </div> | ||
| 246 : | t <?php | ||
| 247 : | t } | ||
| 248 : | t } | ||
| 249 : | t | ||
| 250 : | t /** | ||
| 251 : | t * Cleans text of all formating and scripting code | ||
| 252 : | t */ | ||
| 253 : | t function cleanText ( &$text ) { | ||
| 254 : | t $text = preg_replace( "'<script[^>]*>.*?</script>'si", '', $text ); | ||
| 255 : | t $text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text ); | ||
| 256 : | t $text = preg_replace( '/<!--.+?-->/', '', $text ); | ||
| 257 : | t $text = preg_replace( '/{.+?}/', '', $text ); | ||
| 258 : | t $text = preg_replace( '/ /', ' ', $text ); | ||
| 259 : | t $text = preg_replace( '/&/', ' ', $text ); | ||
| 260 : | t $text = preg_replace( '/"/', ' ', $text ); | ||
| 261 : | t $text = strip_tags( $text ); | ||
| 262 : | t $text = htmlspecialchars( $text ); | ||
| 263 : | t return $text; | ||
| 264 : | t } | ||
| 265 : | t | ||
| 266 : | t /** | ||
| 267 : | t * Writes Print icon | ||
| 268 : | t */ | ||
| 269 : | t function PrintIcon( &$row, &$params, $hide_js, $link, $status=NULL ) { | ||
| 270 : | t global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template, $Itemid; | ||
| 271 : | t if ( $params->get( 'print' ) && !$hide_js ) { | ||
| 272 : | t // use default settings if none declared | ||
| 273 : | t if ( !$status ) { | ||
| 274 : | t $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; | ||
| 275 : | t } | ||
| 276 : | t | ||
| 277 : | t // checks template image directory for image, if non found default are loaded | ||
| 278 : | t if ( $params->get( 'icons' ) ) { | ||
| 279 : | t $mainframe = mosMainFrame::getInstance(); | ||
| 280 : | t $image = $mainframe->ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, _CMN_PRINT ); | ||
| 281 : | t } else { | ||
| 282 : | t $image = _ICON_SEP .' '. _CMN_PRINT. ' '. _ICON_SEP; | ||
| 283 : | t } | ||
| 284 : | t | ||
| 285 : | t if ( $params->get( 'popup' ) && !$hide_js ) { | ||
| 286 : | t // Print Preview button - used when viewing page | ||
| 287 : | t ?> | ||
| 288 : | t <td align="right" width="100%" class="buttonheading"> | ||
| 289 : | t <a href="#" onclick="javascript:window.print(); return false" title="<?php echo _CMN_PRINT;?>"> | ||
| 290 : | t <?php echo $image;?> | ||
| 291 : | t </a> | ||
| 292 : | t </td> | ||
| 293 : | t <?php | ||
| 294 : | t } else { | ||
| 295 : | t // Print Button - used in pop-up window | ||
| 296 : | t ?> | ||
| 297 : | t <td align="right" width="100%" class="buttonheading"> | ||
| 298 : | t <a href="javascript:void window.open('<?php echo $link; ?>', 'win2', '<?php echo $status; ?>');" title="<?php echo _CMN_PRINT;?>"> | ||
| 299 : | t <?php echo $image;?> | ||
| 300 : | t </a> | ||
| 301 : | t </td> | ||
| 302 : | t <?php | ||
| 303 : | t } | ||
| 304 : | t } | ||
| 305 : | t } | ||
| 306 : | t | ||
| 307 : | t /** | ||
| 308 : | t * simple Javascript Cloaking | ||
| 309 : | t * email cloacking | ||
| 310 : | t * by default replaces an email with a mailto link with email cloacked | ||
| 311 : | t */ | ||
| 312 : | t function emailCloaking( $mail, $mailto=1, $text='', $email=1 ) { | ||
| 313 : | t // convert text | ||
| 314 : | t $mail = mosHTML::encoding_converter( $mail ); | ||
| 315 : | t // split email by @ symbol | ||
| 316 : | t $mail = explode( '@', $mail ); | ||
| 317 : | t $mail_parts = explode( '.', $mail[1] ); | ||
| 318 : | t // random number | ||
| 319 : | t $rand = rand( 1, 100000 ); | ||
| 320 : | t | ||
| 321 : | t $replacement = "\n<script language='JavaScript' type='text/javascript'> \n"; | ||
| 322 : | t $replacement .= "<!-- \n"; | ||
| 323 : | t $replacement .= "var prefix = 'ma' + 'il' + 'to'; \n"; | ||
| 324 : | t $replacement .= "var path = 'hr' + 'ef' + '='; \n"; | ||
| 325 : | t $replacement .= "var addy". $rand ." = '". @$mail[0] ."' + '@' + '". implode( "' + '.' + '", $mail_parts ) ."'; \n"; | ||
| 326 : | t if ( $mailto ) { | ||
| 327 : | t // special handling when mail text is different from mail addy | ||
| 328 : | t if ( $text ) { | ||
| 329 : | t if ( $email ) { | ||
| 330 : | t // convert text | ||
| 331 : | t $text = mosHTML::encoding_converter( $text ); | ||
| 332 : | t // split email by @ symbol | ||
| 333 : | t $text = explode( '@', $text ); | ||
| 334 : | t $text_parts = explode( '.', $text[1] ); | ||
| 335 : | t $replacement .= "var addy_text". $rand ." = '". @$text[0] ."' + '@' + '". implode( "' + '.' + '", @$text_parts ) ."'; \n"; | ||
| 336 : | t } else { | ||
| 337 : | t $text = mosHTML::encoding_converter( $text ); | ||
| 338 : | t $replacement .= "var addy_text". $rand ." = '". $text ."';\n"; | ||
| 339 : | t } | ||
| 340 : | t $replacement .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n"; | ||
| 341 : | t $replacement .= "document.write( addy_text". $rand ." ); \n"; | ||
| 342 : | t $replacement .= "document.write( '<\/a>' ); \n"; | ||
| 343 : | t } else { | ||
| 344 : | t $replacement .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n"; | ||
| 345 : | t $replacement .= "document.write( addy". $rand ." ); \n"; | ||
| 346 : | t $replacement .= "document.write( '<\/a>' ); \n"; | ||
| 347 : | t } | ||
| 348 : | t } else { | ||
| 349 : | t $replacement .= "document.write( addy". $rand ." ); \n"; | ||
| 350 : | t } | ||
| 351 : | t $replacement .= "//--> \n"; | ||
| 352 : | t $replacement .= "</script> \n"; | ||
| 353 : | t $replacement .= "<noscript> \n"; | ||
| 354 : | t $replacement .= _CLOAKING; | ||
| 355 : | t $replacement .= "\n</noscript> \n"; | ||
| 356 : | t | ||
| 357 : | t return $replacement; | ||
| 358 : | t } | ||
| 359 : | t | ||
| 360 : | t function encoding_converter( $text ) { | ||
| 361 : | t // replace vowels with character encoding | ||
| 362 : | t $text = str_replace( 'a', 'a', $text ); | ||
| 363 : | t $text = str_replace( 'e', 'e', $text ); | ||
| 364 : | t $text = str_replace( 'i', 'i', $text ); | ||
| 365 : | t $text = str_replace( 'o', 'o', $text ); | ||
| 366 : | t $text = str_replace( 'u', 'u', $text ); | ||
| 367 : | t | ||
| 368 : | t return $text; | ||
| 369 : | t } | ||
| 370 : | t } | ||
| 371 : | t | ||
| 372 : | t class mosCommonHTML { | ||
| 373 : | t | ||
| 374 : | t function ContentLegend( ) { | ||
| 375 : | t ?> | ||
| 376 : | t <table cellspacing="0" cellpadding="4" border="0" align="center"> | ||
| 377 : | t <tr align="center"> | ||
| 378 : | t <td> | ||
| 379 : | t <img src="images/publish_y.png" width="12" height="12" border="0" alt="Pending" /> | ||
| 380 : | t </td> | ||
| 381 : | t <td> | ||
| 382 : | t Published, but is <u>Pending</u> | | ||
| 383 : | t </td> | ||
| 384 : | t <td> | ||
| 385 : | t <img src="images/publish_g.png" width="12" height="12" border="0" alt="Visible" /> | ||
| 386 : | t </td> | ||
| 387 : | t <td> | ||
| 388 : | t Published and is <u>Current</u> | | ||
| 389 : | t </td> | ||
| 390 : | t <td> | ||
| 391 : | t <img src="images/publish_r.png" width="12" height="12" border="0" alt="Finished" /> | ||
| 392 : | t </td> | ||
| 393 : | t <td> | ||
| 394 : | t Published, but has <u>Expired</u> | | ||
| 395 : | t </td> | ||
| 396 : | t <td> | ||
| 397 : | t <img src="images/publish_x.png" width="12" height="12" border="0" alt="Finished" /> | ||
| 398 : | t </td> | ||
| 399 : | t <td> | ||
| 400 : | t Not Published | ||
| 401 : | t </td> | ||
| 402 : | t </tr> | ||
| 403 : | t <tr> | ||
| 404 : | t <td colspan="8" align="center"> | ||
| 405 : | t Click on icon to toggle state. | ||
| 406 : | t </td> | ||
| 407 : | t </tr> | ||
| 408 : | t </table> | ||
| 409 : | t <?php | ||
| 410 : | t } | ||
| 411 : | t | ||
| 412 : | t function menuLinksContent( &$menus ) { | ||
| 413 : | t ?> | ||
| 414 : | t <script language="javascript" type="text/javascript"> | ||
| 415 : | t function go2( pressbutton, menu, id ) { | ||
| 416 : | t var form = document.adminForm; | ||
| 417 : | t | ||
| 418 : | t if (pressbutton == 'go2menu') { | ||
| 419 : | t form.menu.value = menu; | ||
| 420 : | t submitform( pressbutton ); | ||
| 421 : | t return; | ||
| 422 : | t } | ||
| 423 : | t | ||
| 424 : | t if (pressbutton == 'go2menuitem') { | ||
| 425 : | t form.menu.value = menu; | ||
| 426 : | t form.menuid.value = id; | ||
| 427 : | t submitform( pressbutton ); | ||
| 428 : | t return; | ||
| 429 : | t } | ||
| 430 : | t } | ||
| 431 : | t </script> | ||
| 432 : | t <?php | ||
| 433 : | t foreach( $menus as $menu ) { | ||
| 434 : | t ?> | ||
| 435 : | t <tr> | ||
| 436 : | t <td colspan="2"> | ||
| 437 : | t <hr /> | ||
| 438 : | t </td> | ||
| 439 : | t </tr> | ||
| 440 : | t <tr> | ||
| 441 : | t <td width="90px" valign="top"> | ||
| 442 : | t Menu | ||
| 443 : | t </td> | ||
| 444 : | t <td> | ||
| 445 : | t <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="Go to Menu"> | ||
| 446 : | t <?php echo $menu->menutype; ?> | ||
| 447 : | t </a> | ||
| 448 : | t </td> | ||
| 449 : | t </tr> | ||
| 450 : | t <tr> | ||
| 451 : | t <td width="90px" valign="top"> | ||
| 452 : | t Link Name | ||
| 453 : | t </td> | ||
| 454 : | t <td> | ||
| 455 : | t <strong> | ||
| 456 : | t <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="Go to Menu Item"> | ||
| 457 : | t <?php echo $menu->name; ?> | ||
| 458 : | t </a> | ||
| 459 : | t </strong> | ||
| 460 : | t </td> | ||
| 461 : | t </tr> | ||
| 462 : | t <tr> | ||
| 463 : | t <td width="90px" valign="top"> | ||
| 464 : | t State | ||
| 465 : | t </td> | ||
| 466 : | t <td> | ||
| 467 : | t <?php | ||
| 468 : | t switch ( $menu->published ) { | ||
| 469 : | t case -2: | ||
| 470 : | t echo '<font color="red">Trashed</font>'; | ||
| 471 : | t break; | ||
| 472 : | t case 0: | ||
| 473 : | t echo 'UnPublished'; | ||
| 474 : | t break; | ||
| 475 : | t case 1: | ||
| 476 : | t default: | ||
| 477 : | t echo '<font color="green">Published</font>'; | ||
| 478 : | t break; | ||
| 479 : | t } | ||
| 480 : | t ?> | ||
| 481 : | t </td> | ||
| 482 : | t </tr> | ||
| 483 : | t <?php | ||
| 484 : | t } | ||
| 485 : | t ?> | ||
| 486 : | t <input type="hidden" name="menu" value="" /> | ||
| 487 : | t <input type="hidden" name="menuid" value="" /> | ||
| 488 : | t <?php | ||
| 489 : | t } | ||
| 490 : | t | ||
| 491 : | t function menuLinksSecCat( &$menus ) { | ||
| 492 : | t ?> | ||
| 493 : | t <script language="javascript" type="text/javascript"> | ||
| 494 : | t function go2( pressbutton, menu, id ) { | ||
| 495 : | t var form = document.adminForm; | ||
| 496 : | t | ||
| 497 : | t if (pressbutton == 'go2menu') { | ||
| 498 : | t form.menu.value = menu; | ||
| 499 : | t submitform( pressbutton ); | ||
| 500 : | t return; | ||
| 501 : | t } | ||
| 502 : | t | ||
| 503 : | t if (pressbutton == 'go2menuitem') { | ||
| 504 : | t form.menu.value = menu; | ||
| 505 : | t form.menuid.value = id; | ||
| 506 : | t submitform( pressbutton ); | ||
| 507 : | t return; | ||
| 508 : | t } | ||
| 509 : | t } | ||
| 510 : | t </script> | ||
| 511 : | t <?php | ||
| 512 : | t foreach( $menus as $menu ) { | ||
| 513 : | t ?> | ||
| 514 : | t <tr> | ||
| 515 : | t <td colspan="2"> | ||
| 516 : | t <hr/> | ||
| 517 : | t </td> | ||
| 518 : | t </tr> | ||
| 519 : | t <tr> | ||
| 520 : | t <td width="90px" valign="top"> | ||
| 521 : | t Menu | ||
| 522 : | t </td> | ||
| 523 : | t <td> | ||
| 524 : | t <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="Go to Menu"> | ||
| 525 : | t <?php echo $menu->menutype; ?> | ||
| 526 : | t </a> | ||
| 527 : | t </td> | ||
| 528 : | t </tr> | ||
| 529 : | t <tr> | ||
| 530 : | t <td width="90px" valign="top"> | ||
| 531 : | t Type | ||
| 532 : | t </td> | ||
| 533 : | t <td> | ||
| 534 : | t <?php echo $menu->type; ?> | ||
| 535 : | t </td> | ||
| 536 : | t </tr> | ||
| 537 : | t <tr> | ||
| 538 : | t <td width="90px" valign="top"> | ||
| 539 : | t Item Name | ||
| 540 : | t </td> | ||
| 541 : | t <td> | ||
| 542 : | t <strong> | ||
| 543 : | t <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="Go to Menu Item"> | ||
| 544 : | t <?php echo $menu->name; ?> | ||
| 545 : | t </a> | ||
| 546 : | t </strong> | ||
| 547 : | t </td> | ||
| 548 : | t </tr> | ||
| 549 : | t <tr> | ||
| 550 : | t <td width="90px" valign="top"> | ||
| 551 : | t State | ||
| 552 : | t </td> | ||
| 553 : | t <td> | ||
| 554 : | t <?php | ||
| 555 : | t switch ( $menu->published ) { | ||
| 556 : | t case -2: | ||
| 557 : | t echo '<font color="red">Trashed</font>'; | ||
| 558 : | t break; | ||
| 559 : | t case 0: | ||
| 560 : | t echo 'UnPublished'; | ||
| 561 : | t break; | ||
| 562 : | t case 1: | ||
| 563 : | t default: | ||
| 564 : | t echo '<font color="green">Published</font>'; | ||
| 565 : | t break; | ||
| 566 : | t } | ||
| 567 : | t ?> | ||
| 568 : | t </td> | ||
| 569 : | t </tr> | ||
| 570 : | t <?php | ||
| 571 : | t } | ||
| 572 : | t ?> | ||
| 573 : | t <input type="hidden" name="menu" value="" /> | ||
| 574 : | t <input type="hidden" name="menuid" value="" /> | ||
| 575 : | t <?php | ||
| 576 : | t } | ||
| 577 : | t | ||
| 578 : | t function checkedOut( &$row, $overlib=1 ) { | ||
| 579 : | t $hover = ''; | ||
| 580 : | t if ( $overlib ) { | ||
| 581 : | t $date = mosFormatDate( $row->checked_out_time, '%A, %d %B %Y' ); | ||
| 582 : | t $time = mosFormatDate( $row->checked_out_time, '%H:%M' ); | ||
| 583 : | t $checked_out_text = '<table>'; | ||
| 584 : | t $checked_out_text .= '<tr><td>'. $row->editor .'</td></tr>'; | ||
| 585 : | t $checked_out_text .= '<tr><td>'. $date .'</td></tr>'; | ||
| 586 : | t $checked_out_text .= '<tr><td>'. $time .'</td></tr>'; | ||
| 587 : | t $checked_out_text .= '</table>'; | ||
| 588 : | t $hover = 'onMouseOver="return overlib(\''. $checked_out_text .'\', CAPTION, \'Checked Out\', BELOW, RIGHT);" onMouseOut="return nd();"'; | ||
| 589 : | t } | ||
| 590 : | t $checked = '<img src="images/checked_out.png" '. $hover .'/>'; | ||
| 591 : | t | ||
| 592 : | t return $checked; | ||
| 593 : | t } | ||
| 594 : | t | ||
| 595 : | t /* | ||
| 596 : | t * Loads all necessary files for JS Overlib tooltips | ||
| 597 : | t */ | ||
| 598 : | t function loadOverlib() { | ||
| 599 : | t global $mosConfig_live_site; | ||
| 600 : | t ?> | ||
| 601 : | t <script language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script> | ||
| 602 : | t <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> | ||
| 603 : | t <?php | ||
| 604 : | t } | ||
| 605 : | t | ||
| 606 : | t | ||
| 607 : | t /* | ||
| 608 : | t * Loads all necessary files for JS Calendar | ||
| 609 : | t */ | ||
| 610 : | t function loadCalendar() { | ||
| 611 : | t global $mosConfig_live_site; | ||
| 612 : | t ?> | ||
| 613 : | t <link rel="stylesheet" type="text/css" media="all" href="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar-mos.css" title="green" /> | ||
| 614 : | t <!-- import the calendar script --> | ||
| 615 : | t <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar.js"></script> | ||
| 616 : | t <!-- import the language module --> | ||
| 617 : | t <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/lang/calendar-en.js"></script> | ||
| 618 : | t <?php | ||
| 619 : | t } | ||
| 620 : | t | ||
| 621 : | t function AccessProcessing( &$row, $i ) { | ||
| 622 : | t if ( !$row->access ) { | ||
| 623 : | t $color_access = 'style="color: green;"'; | ||
| 624 : | t $task_access = 'accessregistered'; | ||
| 625 : | t } else if ( $row->access == 1 ) { | ||
| 626 : | t $color_access = 'style="color: red;"'; | ||
| 627 : | t $task_access = 'accessspecial'; | ||
| 628 : | t } else { | ||
| 629 : | t $color_access = 'style="color: black;"'; | ||
| 630 : | t $task_access = 'accesspublic'; | ||
| 631 : | t } | ||
| 632 : | t | ||
| 633 : | t $href = ' | ||
| 634 : | t <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task_access .'\')" '. $color_access .'> | ||
| 635 : | t '. $row->groupname .' | ||
| 636 : | t </a>' | ||
| 637 : | t ; | ||
| 638 : | t | ||
| 639 : | t return $href; | ||
| 640 : | t } | ||
| 641 : | t | ||
| 642 : | t function CheckedOutProcessing( &$row, $i ) { | ||
| 643 : | t global $my; | ||
| 644 : | t | ||
| 645 : | t if ( $row->checked_out ) { | ||
| 646 : | t $checked = mosCommonHTML::checkedOut( $row ); | ||
| 647 : | t } else { | ||
| 648 : | t $checked = mosHTML::idBox( $i, $row->id, ($row->checked_out && $row->checked_out != $my->id ) ); | ||
| 649 : | t } | ||
| 650 : | t | ||
| 651 : | t return $checked; | ||
| 652 : | t } | ||
| 653 : | t | ||
| 654 : | t function PublishedProcessing( &$row, $i ) { | ||
| 655 : | t $img = $row->published ? 'publish_g.png' : 'publish_x.png'; | ||
| 656 : | t $task = $row->published ? 'unpublish' : 'publish'; | ||
| 657 : | t $alt = $row->published ? 'Published' : 'Unpublished'; | ||
| 658 : | t $action = $row->published ? 'Unpublish Item' : 'Publish item'; | ||
| 659 : | t | ||
| 660 : | t $href = ' | ||
| 661 : | t <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task .'\')" title="'. $action .'"> | ||
| 662 : | t <img src="images/'. $img .'" border="0" alt="'. $alt .'" /> | ||
| 663 : | t </a>' | ||
| 664 : | t ; | ||
| 665 : | t | ||
| 666 : | t return $href; | ||
| 667 : | t } | ||
| 668 : | t } | ||
| 669 : | t | ||
| 670 : | t ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

