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

