| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: admin.modules.html.php 18162 2010-07-16 07:00:47Z ian $ 4 * @package Joomla 5 * @subpackage Modules 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // no direct access 16 defined( '_JEXEC' ) or die( 'Restricted access' ); 17 18 /** 19 * @package Joomla 20 * @subpackage Modules 21 */ 22 class HTML_modules 23 { 24 /** 25 * Writes a list of the defined modules 26 * @param array An array of category objects 27 */ 28 function view( &$rows, &$client, &$page, &$lists ) 29 { 30 $user =& JFactory::getUser(); 31 32 //Ordering allowed ? 33 $ordering = ($lists['order'] == 'm.ordering' || $lists['order'] == 'm.position'); 34 35 JHTML::_('behavior.tooltip'); 36 ?> 37 <form action="index.php?option=com_modules" method="post" name="adminForm"> 38 39 <table> 40 <tr> 41 <td align="left" width="100%"> 42 <?php echo JText::_( 'Filter' ); ?>: 43 <input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" /> 44 <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button> 45 <button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button> 46 </td> 47 <td nowrap="nowrap"> 48 <?php 49 echo $lists['assigned']; 50 echo $lists['position']; 51 echo $lists['type']; 52 echo $lists['state']; 53 ?> 54 </td> 55 </tr> 56 </table> 57 58 <table class="adminlist" cellspacing="1"> 59 <thead> 60 <tr> 61 <th width="20"> 62 <?php echo JText::_( 'NUM' ); ?> 63 </th> 64 <th width="20"> 65 <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" /> 66 </th> 67 <th class="title"> 68 <?php echo JHTML::_('grid.sort', 'Module Name', 'm.title', @$lists['order_Dir'], @$lists['order'] ); ?> 69 </th> 70 <th nowrap="nowrap" width="7%"> 71 <?php echo JHTML::_('grid.sort', 'Published', 'm.published', @$lists['order_Dir'], @$lists['order'] ); ?> 72 </th> 73 <th width="80" nowrap="nowrap"> 74 <?php echo JHTML::_('grid.sort', 'Order', 'm.ordering', @$lists['order_Dir'], @$lists['order'] ); ?> 75 </th> 76 <th width="1%"> 77 <?php if ($ordering) echo JHTML::_('grid.order', $rows ); ?> 78 </th> 79 <?php 80 if ( $client->id == 0 ) { 81 ?> 82 <th nowrap="nowrap" width="7%"> 83 <?php echo JHTML::_('grid.sort', 'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?> 84 </th> 85 <?php 86 } 87 ?> 88 <th nowrap="nowrap" width="7%"> 89 <?php echo JHTML::_('grid.sort', 'Position', 'm.position', @$lists['order_Dir'], @$lists['order'] ); ?> 90 </th> 91 <th nowrap="nowrap" width="5%"> 92 <?php echo JHTML::_('grid.sort', 'Pages', 'pages', @$lists['order_Dir'], @$lists['order'] ); ?> 93 </th> 94 <th nowrap="nowrap" width="10%" class="title"> 95 <?php echo JHTML::_('grid.sort', 'Type', 'm.module', @$lists['order_Dir'], @$lists['order'] ); ?> 96 </th> 97 <th nowrap="nowrap" width="1%"> 98 <?php echo JHTML::_('grid.sort', 'ID', 'm.id', @$lists['order_Dir'], @$lists['order'] ); ?> 99 </th> 100 </tr> 101 </thead> 102 <tfoot> 103 <tr> 104 <td colspan="12"> 105 <?php echo $page->getListFooter(); ?> 106 </td> 107 </tr> 108 </tfoot> 109 <tbody> 110 <?php 111 $k = 0; 112 for ($i=0, $n=count( $rows ); $i < $n; $i++) { 113 $row = &$rows[$i]; 114 115 $link = JRoute::_( 'index.php?option=com_modules&client='. $client->id .'&task=edit&cid[]='. $row->id ); 116 117 $access = JHTML::_('grid.access', $row, $i ); 118 $checked = JHTML::_('grid.checkedout', $row, $i ); 119 $published = JHTML::_('grid.published', $row, $i ); 120 ?> 121 <tr class="<?php echo "row$k"; ?>"> 122 <td align="right"> 123 <?php echo $page->getRowOffset( $i ); ?> 124 </td> 125 <td width="20"> 126 <?php echo $checked; ?> 127 </td> 128 <td> 129 <?php 130 if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out ) ) { 131 echo htmlspecialchars($row->title); 132 } else { 133 ?> 134 <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Module' );?>::<?php echo htmlspecialchars($row->title); ?>"> 135 <a href="<?php echo $link; ?>"> 136 <?php echo htmlspecialchars($row->title); ?></a> 137 </span> 138 <?php 139 } 140 ?> 141 </td> 142 <td align="center"> 143 <?php echo $published;?> 144 </td> 145 <td class="order" colspan="2"> 146 <span><?php echo $page->orderUpIcon( $i, ($row->position == @$rows[$i-1]->position), 'orderup', 'Move Up', $ordering ); ?></span> 147 <span><?php echo $page->orderDownIcon( $i, $n, ($row->position == @$rows[$i+1]->position),'orderdown', 'Move Down', $ordering ); ?></span> 148 <?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?> 149 <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" /> 150 </td> 151 <?php 152 if ( $client->id == 0 ) { 153 ?> 154 <td align="center"> 155 <?php echo $access;?> 156 </td> 157 <?php 158 } 159 ?> 160 <td align="center"> 161 <?php echo $row->position; ?> 162 </td> 163 <td align="center"> 164 <?php 165 if (is_null( $row->pages )) { 166 echo JText::_( 'None' ); 167 } else if ($row->pages > 0) { 168 echo JText::_( 'Varies' ); 169 } else { 170 echo JText::_( 'All' ); 171 } 172 ?> 173 </td> 174 <td> 175 <?php echo $row->module ? $row->module : JText::_( 'User' );?> 176 </td> 177 <td> 178 <?php echo $row->id;?> 179 </td> 180 </tr> 181 <?php 182 $k = 1 - $k; 183 } 184 ?> 185 </tbody> 186 </table> 187 188 <input type="hidden" name="option" value="com_modules" /> 189 <input type="hidden" name="client" value="<?php echo $client->id;?>" /> 190 <input type="hidden" name="task" value="" /> 191 <input type="hidden" name="boxchecked" value="0" /> 192 <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" /> 193 <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" /> 194 <?php echo JHTML::_( 'form.token' ); ?> 195 </form> 196 <?php 197 } 198 199 /** 200 * Writes the edit form for new and existing module 201 * 202 * A new record is defined when <var>$row</var> is passed with the <var>id</var> 203 * property set to 0. 204 * @param JTableCategory The category object 205 * @param array <p>The modules of the left side. The array elements are in the form 206 * <var>$leftorder[<i>order</i>] = <i>label</i></var> 207 * where <i>order</i> is the module order from the db table and <i>label</i> is a 208 * text label associciated with the order.</p> 209 * @param array See notes for leftorder 210 * @param array An array of select lists 211 * @param object Parameters 212 */ 213 function edit( &$model, &$row, &$orders2, &$lists, &$params, $client ) 214 { 215 JRequest::setVar( 'hidemainmenu', 1 ); 216 217 // clean item data 218 JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'content' ); 219 220 // Check for component metadata.xml file 221 //$path = JApplicationHelper::getPath( 'mod'.$client->id.'_xml', $row->module ); 222 //$params = new JParameter( $row->params, $path ); 223 $document =& JFactory::getDocument(); 224 225 JHTML::_('behavior.combobox'); 226 227 jimport('joomla.html.pane'); 228 // TODO: allowAllClose should default true in J!1.6, so remove the array when it does. 229 $pane = &JPane::getInstance('sliders', array('allowAllClose' => true)); 230 $editor =& JFactory::getEditor(); 231 232 JHTML::_('behavior.tooltip'); 233 ?> 234 <script language="javascript" type="text/javascript"> 235 function submitbutton(pressbutton) { 236 if ( ( pressbutton == 'save' || pressbutton == 'apply' ) && ( document.adminForm.title.value == "" ) ) { 237 alert("<?php echo JText::_( 'Module must have a title', true ); ?>"); 238 } else { 239 <?php 240 if ($row->module == '' || $row->module == 'mod_custom') { 241 echo $editor->save( 'content' ); 242 } 243 ?> 244 submitform(pressbutton); 245 } 246 } 247 <!-- 248 var originalOrder = '<?php echo $row->ordering;?>'; 249 var originalPos = '<?php echo $row->position;?>'; 250 var orders = new Array(); // array in the format [key,value,text] 251 <?php $i = 0; 252 foreach ($orders2 as $k=>$items) { 253 foreach ($items as $v) { 254 echo "\n orders[".$i++."] = new Array( \"$k\",\"$v->value\",\"$v->text\" );"; 255 } 256 } 257 ?> 258 //--> 259 </script> 260 <form action="index.php" method="post" name="adminForm"> 261 <div class="col width-50"> 262 <fieldset class="adminform"> 263 <legend><?php echo JText::_( 'Details' ); ?></legend> 264 265 <table class="admintable" cellspacing="1"> 266 <tr> 267 <td valign="top" class="key"> 268 <?php echo JText::_( 'Module Type' ); ?>: 269 </td> 270 <td> 271 <strong> 272 <?php echo JText::_($row->module); ?> 273 </strong> 274 </td> 275 </tr> 276 <tr> 277 <td class="key"> 278 <label for="title"> 279 <?php echo JText::_( 'Title' ); ?>: 280 </label> 281 </td> 282 <td> 283 <input class="text_area" type="text" name="title" id="title" size="35" value="<?php echo $row->title; ?>" /> 284 </td> 285 </tr> 286 <tr> 287 <td width="100" class="key"> 288 <?php echo JText::_( 'Show title' ); ?>: 289 </td> 290 <td> 291 <?php echo $lists['showtitle']; ?> 292 </td> 293 </tr> 294 <tr> 295 <td valign="top" class="key"> 296 <?php echo JText::_( 'Published' ); ?>: 297 </td> 298 <td> 299 <?php echo $lists['published']; ?> 300 </td> 301 </tr> 302 <tr> 303 <td valign="top" class="key"> 304 <label for="position" class="hasTip" title="<?php echo JText::_('MODULE_POSITION_TIP_TITLE', true); ?>::<?php echo JText::_('MODULE_POSITION_TIP_TEXT', true); ?>"> 305 <?php echo JText::_( 'Position' ); ?>: 306 </label> 307 </td> 308 <td> 309 <input type="text" id="position" class="combobox" name="position" value="<?php echo $row->position; ?>" /> 310 <ul id="combobox-position" style="display:none;"> 311 <?php 312 $positions = $model->getPositions(); 313 foreach ($positions as $position) { 314 echo '<li>'.$position.'</li>'; 315 } 316 ?></ul> 317 <script language="javascript" type="text/javascript"> 318 window.addEvent('domready', function() { 319 $('combobox-position-select').addEvent('change', function() { 320 changeDynaList('ordering', orders, document.adminForm.position.value, 0, 0); 321 }); 322 $('position').addEvent('change', function() { 323 changeDynaList('ordering', orders, document.adminForm.position.value, 0, 0); 324 }); 325 }); 326 </script> 327 </td> 328 </tr> 329 <tr> 330 <td valign="top" class="key"> 331 <label for="ordering"> 332 <?php echo JText::_( 'Order' ); ?>: 333 </label> 334 </td> 335 <td> 336 <script language="javascript" type="text/javascript"> 337 <!-- 338 writeDynaList( 'class="inputbox" name="ordering" id="ordering" size="1"', orders, originalPos, originalPos, originalOrder ); 339 //--> 340 </script> 341 </td> 342 </tr> 343 <tr> 344 <td valign="top" class="key"> 345 <label for="access"> 346 <?php echo JText::_( 'Access Level' ); ?>: 347 </label> 348 </td> 349 <td> 350 <?php echo $lists['access']; ?> 351 </td> 352 </tr> 353 <tr> 354 <td valign="top" class="key"> 355 <?php echo JText::_( 'ID' ); ?>: 356 </td> 357 <td> 358 <?php echo $row->id; ?> 359 </td> 360 </tr> 361 <tr> 362 <td valign="top" class="key"> 363 <?php echo JText::_( 'Description' ); ?>: 364 </td> 365 <td> 366 <?php echo JText::_($row->description); ?> 367 </td> 368 </tr> 369 </table> 370 </fieldset> 371 <fieldset class="adminform"> 372 <legend><?php echo JText::_( 'Menu Assignment' ); ?></legend> 373 <script type="text/javascript"> 374 function allselections() { 375 var e = document.getElementById('selections'); 376 e.disabled = true; 377 var i = 0; 378 var n = e.options.length; 379 for (i = 0; i < n; i++) { 380 e.options[i].disabled = true; 381 e.options[i].selected = true; 382 } 383 } 384 function disableselections() { 385 var e = document.getElementById('selections'); 386 e.disabled = true; 387 var i = 0; 388 var n = e.options.length; 389 for (i = 0; i < n; i++) { 390 e.options[i].disabled = true; 391 e.options[i].selected = false; 392 } 393 } 394 function enableselections() { 395 var e = document.getElementById('selections'); 396 e.disabled = false; 397 var i = 0; 398 var n = e.options.length; 399 for (i = 0; i < n; i++) { 400 e.options[i].disabled = false; 401 } 402 } 403 </script> 404 <table class="admintable" cellspacing="1"> 405 <tr> 406 <td valign="top" class="key"> 407 <?php echo JText::_( 'Menus' ); ?>: 408 </td> 409 <td> 410 <?php if ($row->client_id != 1) : ?> 411 <?php if ($row->pages == 'all') { ?> 412 <label for="menus-all"><input id="menus-all" type="radio" name="menus" value="all" onclick="allselections();" checked="checked" /><?php echo JText::_( 'All' ); ?></label> 413 <label for="menus-none"><input id="menus-none" type="radio" name="menus" value="none" onclick="disableselections();" /><?php echo JText::_( 'None' ); ?></label> 414 <label for="menus-select"><input id="menus-select" type="radio" name="menus" value="select" onclick="enableselections();" /><?php echo JText::_( 'Select From List' ); ?></label> 415 <?php } elseif ($row->pages == 'none') { ?> 416 <label for="menus-all"><input id="menus-all" type="radio" name="menus" value="all" onclick="allselections();" /><?php echo JText::_( 'All' ); ?></label> 417 <label for="menus-none"><input id="menus-none" type="radio" name="menus" value="none" onclick="disableselections();" checked="checked" /><?php echo JText::_( 'None' ); ?></label> 418 <label for="menus-select"><input id="menus-select" type="radio" name="menus" value="select" onclick="enableselections();" /><?php echo JText::_( 'Select From List' ); ?></label> 419 <?php } else { ?> 420 <label for="menus-all"><input id="menus-all" type="radio" name="menus" value="all" onclick="allselections();" /><?php echo JText::_( 'All' ); ?></label> 421 <label for="menus-none"><input id="menus-none" type="radio" name="menus" value="none" onclick="disableselections();" /><?php echo JText::_( 'None' ); ?></label> 422 <label for="menus-select"><input id="menus-select" type="radio" name="menus" value="select" onclick="enableselections();" checked="checked" /><?php echo JText::_( 'Select From List' ); ?></label> 423 <?php } ?> 424 <?php endif; ?> 425 </td> 426 </tr> 427 <tr> 428 <td valign="top" class="key"> 429 <?php echo JText::_( 'Menu Selection' ); ?>: 430 </td> 431 <td> 432 <?php echo $lists['selections']; ?> 433 </td> 434 </tr> 435 </table> 436 <?php if ($row->client_id != 1) : ?> 437 <?php if ($row->pages == 'all') { ?> 438 <script type="text/javascript">allselections();</script> 439 <?php } elseif ($row->pages == 'none') { ?> 440 <script type="text/javascript">disableselections();</script> 441 <?php } else { ?> 442 <?php } ?> 443 <?php endif; ?> 444 </fieldset> 445 </div> 446 447 <div class="col width-50"> 448 <fieldset class="adminform"> 449 <legend><?php echo JText::_( 'Parameters' ); ?></legend> 450 451 <?php 452 echo $pane->startPane("menu-pane"); 453 echo $pane->startPanel(JText :: _('Module Parameters'), "param-page"); 454 $p = $params; 455 if($params = $p->render('params')) : 456 echo $params; 457 else : 458 echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no parameters for this item')."</div>"; 459 endif; 460 echo $pane->endPanel(); 461 462 if ($p->getNumParams('advanced')) { 463 echo $pane->startPanel(JText :: _('Advanced Parameters'), "advanced-page"); 464 if($params = $p->render('params', 'advanced')) : 465 echo $params; 466 else : 467 echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no advanced parameters for this item')."</div>"; 468 endif; 469 echo $pane->endPanel(); 470 } 471 472 if ($p->getNumParams('legacy')) { 473 echo $pane->startPanel(JText :: _('Legacy Parameters'), "legacy-page"); 474 if($params = $p->render('params', 'legacy')) : 475 echo $params; 476 else : 477 echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no legacy parameters for this item')."</div>"; 478 endif; 479 echo $pane->endPanel(); 480 } 481 482 483 if ($p->getNumParams('other')) { 484 echo $pane->startPanel(JText :: _('Other Parameters'), "other-page"); 485 if($params = $p->render('params', 'other')) : 486 echo $params; 487 else : 488 echo "<div style=\"text-align: center; padding: 5px; \">".JText::_('There are no other parameters for this item')."</div>"; 489 endif; 490 echo $pane->endPanel(); 491 } 492 echo $pane->endPane(); 493 ?> 494 </fieldset> 495 </div> 496 <div class="clr"></div> 497 498 <?php 499 if ( !$row->module || $row->module == 'custom' || $row->module == 'mod_custom' ) { 500 ?> 501 <fieldset class="adminform"> 502 <legend><?php echo JText::_( 'Custom Output' ); ?></legend> 503 504 <?php 505 // parameters : areaname, content, width, height, cols, rows 506 echo $editor->display( 'content', $row->content, '100%', '400', '60', '20', array('pagebreak', 'readmore') ) ; 507 ?> 508 509 </fieldset> 510 <?php 511 } 512 ?> 513 514 <input type="hidden" name="option" value="com_modules" /> 515 <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 516 <input type="hidden" name="cid[]" value="<?php echo $row->id; ?>" /> 517 <input type="hidden" name="original" value="<?php echo $row->ordering; ?>" /> 518 <input type="hidden" name="module" value="<?php echo $row->module; ?>" /> 519 <input type="hidden" name="task" value="" /> 520 <input type="hidden" name="client" value="<?php echo $client->id ?>" /> 521 <?php echo JHTML::_( 'form.token' ); ?> 522 </form> 523 <?php 524 } 525 526 function preview() 527 { 528 $editor =& JFactory::getEditor(); 529 530 ?> 531 <script> 532 var form = window.top.document.adminForm 533 var title = form.title.value; 534 535 var alltext = window.top.<?php echo $editor->getContent('text') ?>; 536 </script> 537 538 <table align="center" width="90%" cellspacing="2" cellpadding="2" border="0"> 539 <tr> 540 <td class="contentheading" colspan="2"><script>document.write(title);</script></td> 541 </tr> 542 <tr> 543 <script>document.write("<td valign=\"top\" height=\"90%\" colspan=\"2\">" + alltext + "</td>");</script> 544 </tr> 545 </table> 546 <?php 547 } 548 549 /** 550 /** 551 * Displays a selection list for module types 552 */ 553 function add(&$modules, $client) 554 { 555 JHTML::_('behavior.tooltip'); 556 557 ?> 558 <form action="index.php" method="post" name="adminForm"> 559 560 <table class="adminlist" cellpadding="1" summary="Add Module"> 561 <thead> 562 <tr> 563 <th colspan="4"> 564 <?php echo JText::_('Modules'); ?> 565 </th> 566 </tr> 567 </thead> 568 <tfoot> 569 <tr> 570 <th colspan="4"> 571 </th> 572 </tr> 573 </tfoot> 574 <tbody> 575 <?php 576 $altRow = 0; 577 $count = count($modules); 578 // Variable-column ready, just pass $cols in. 579 $cols = 2; 580 $pct = floor(100 / $cols); 581 $rows = ceil($count / $cols); 582 $posn = 0; 583 do { 584 ?> 585 <tr class="<?php echo 'row' . $altRow; ?>" valign="top"> 586 <?php 587 $altRow = 1 - $altRow; 588 for ($col = 0; $col < $cols; ++$col) : 589 if (($mod = $posn + $col * $rows) >= $count) : 590 ?> 591 <td width="<?php echo $pct; ?>%"> </td> 592 <?php 593 continue; 594 endif; 595 $item = &$modules[$mod]; 596 $link = 'index.php?option=com_modules&task=edit&module=' 597 . $item->module . '&created=1&client=' . $client->id; 598 ?> 599 <td width="<?php echo $pct; ?>%"> 600 <span class="editlinktip hasTip" title="<?php 601 echo htmlspecialchars($item->name . ' :: ' 602 . JText::_(stripslashes($item->descrip)), ENT_QUOTES, 'UTF-8'); 603 ?>" name="module" value="<?php 604 echo $item->module; 605 ?>" onclick="isChecked(this.checked);"> 606 <input type="radio" name="module" value="<?php 607 echo $item->module; 608 ?>" id="cb<?php echo $mod; ?>"/><a href="<?php 609 echo $link; 610 ?>"><?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?></a></span> 611 </td> 612 <?php 613 endfor; 614 ++$posn; 615 ?> 616 </tr> 617 <?php 618 } while ($posn < $rows); 619 ?> 620 </tbody> 621 </table> 622 623 <input type="hidden" name="option" value="com_modules" /> 624 <input type="hidden" name="client" value="<?php echo $client->id; ?>" /> 625 <input type="hidden" name="created" value="1" /> 626 <input type="hidden" name="task" value="edit" /> 627 <input type="hidden" name="boxchecked" value="0" /> 628 <?php echo JHTML::_('form.token'); ?> 629 </form> 630 <?php 631 } 632 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |