[TEP-COMMIT] [CVS admin] wrap elements around div blocks for the javascript magic to work

anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:07:10 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in admin/admin/includes/classes on MAIN

box.php +23 -23 1.7 -> 1.8

wrap elements around div blocks for the javascript magic to work

----------

admin /admin /includes /classes

box.php 1.7 -> 1.8

diff -u -r1.7 -r1.8
--- box.php 2003/06/20 16:23:08 1.7
+++ box.php 2004/07/22 23:07:09 1.8
@@ -5,22 +5,9 @@

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

- Copyright (c) 2003 osCommerce

+ Copyright (c) 2004 osCommerce

Released under the GNU General Public License

-
- Example usage:
-
- $heading = array();
- $heading[] = array('params' => 'class="menuBoxHeading"',
- 'text' => BOX_HEADING_TOOLS,
- 'link' => tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('selected_box')) . 'selected_box=tools'));
-
- $contents = array();
- $contents[] = array('text' => SOME_TEXT);
-
- $box = new box;
- echo $box->infoBox($heading, $contents);

*/

class box extends tableBlock {

@@ -29,29 +16,42 @@

$this->contents = array();
}

- function infoBox($heading, $contents) {
- $this->table_row_parameters = 'class="infoBoxHeading"';
- $this->table_data_parameters = 'class="infoBoxHeading"';

+ function infoBox($heading, $contents, $id = '', $visible = '') {
+ $this->table_parameters = 'class="infoBoxHeading"';

$this->heading = $this->tableBlock($heading);

- $this->table_row_parameters = '';
- $this->table_data_parameters = 'class="infoBoxContent"';

+ $this->table_parameters = 'class="infoBoxContent"';

$this->contents = $this->tableBlock($contents);

+
+ $infobox = $this->heading . $this->contents;

- return $this->heading . $this->contents;

+ if (!empty($id)) {
+ $infobox = '<div id="' . $id . '"' . (($visible == 'hidden') ? ' style="display: none;"' : '') . '>' . $infobox . '</div>';
+ }
+
+ return $infobox;

}

- function menuBox($heading, $contents) {

+ function menuBox($heading, $contents, $toggleBlock = '') {
+ global $selected_box;
+

$this->table_data_parameters = 'class="menuBoxHeading"';
if (isset($heading[0]['link'])) {

- $this->table_data_parameters .= ' onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . $heading[0]['link'] . '\'"';

$heading[0]['text'] = '&nbsp;<a href="' . $heading[0]['link'] . '" class="menuBoxHeadingLink">' . $heading[0]['text'] . '</a>&nbsp;';
} else {
$heading[0]['text'] = '&nbsp;' . $heading[0]['text'] . '&nbsp;';
}
$this->heading = $this->tableBlock($heading);

- $this->table_data_parameters = 'class="menuBoxContent"';

+ $this->table_parameters = 'class="menuBoxContent"';
+ if (!empty($toggleBlock)) {
+ $this->table_parameters .= ' id="' . $toggleBlock . '"';
+
+ if ($toggleBlock != $selected_box) {
+ $this->table_parameters .= ' style="display: none;"';
+ }
+ }
+ $this->table_data_parameters = '';

$this->contents = $this->tableBlock($contents);

return $this->heading . $this->contents;

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click