View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0008188 | mantisbt | other | public | 2007-07-23 15:37 | 2007-12-21 23:16 |
| Reporter | DGtlRift | Assigned To | DGtlRift | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.0.8 | ||||
| Target Version | 1.1.0 | Fixed in Version | 1.1.0rc1 | ||
| Summary | 0008188: Consistent use of collapse_api.php | ||||
| Description | There are a number of spots where collapse api could have been used but instead the code that is in this API simplifies was reproduced. By consistantly using the collapse_api - bug fixes and additional features will be inherited to the other pages. | ||||
| Tags | No tags attached. | ||||
| Attached Files | collapse.patch (13,668 bytes)
Index: billing_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/billing_inc.php,v
retrieving revision 1.12
diff -u -r1.12 billing_inc.php
--- billing_inc.php 11 Jul 2007 21:13:24 -0000 1.12
+++ billing_inc.php 12 Aug 2007 20:33:56 -0000
@@ -26,22 +26,21 @@
<a name="bugnotestats" id="bugnotestats" /><br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="bugnotestats_closed" style="display: none;">
+<?php
+ collapse_open( 'bugnotestats' );
+?>
+
<table class="width100" cellspacing="0">
<tr>
<td class="form-title" colspan="4">
- <a href="" onclick="ToggleDiv( 'bugnotestats', g_div_bugnotestats ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'time_tracking' ) ?>
+ <?php collapse_icon( 'bugnotestats' );
+ echo lang_get( 'time_tracking' ) ?>
</td>
</tr>
</table>
-</div>
-<?php } ?>
-
-<div id="bugnotestats_open">
<?php
+ collapse_closed( 'bugnotestats' );
+
$t_today = date( "d:m:Y" );
$t_date_submitted = isset( $t_bug ) ? date( "d:m:Y", $t_bug->date_submitted ) : $t_today;
@@ -81,10 +80,9 @@
<table border=0 class="width100" cellspacing="0">
<tr>
<td class="form-title" colspan="4">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'bugnotestats', g_div_bugnotestats ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
+<?php
+ collapse_icon( 'bugnotestats' );
+?>
<?php echo lang_get( 'time_tracking' ) ?>
</td>
</tr>
@@ -185,10 +183,6 @@
</tr>
</table>
<?php } # end if ?>
-</div>
-
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/JavaScript">
- SetDiv( "bugnotestats", g_div_bugnotestats );
-</script>
-<?php } ?>
+<?php
+ collapse_end( 'bugnotestats' );
+?>
Index: bug_file_upload_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_file_upload_inc.php,v
retrieving revision 1.38
diff -u -r1.38 bug_file_upload_inc.php
--- bug_file_upload_inc.php 15 Aug 2006 07:11:23 -0000 1.38
+++ bug_file_upload_inc.php 12 Aug 2007 20:33:56 -0000
@@ -25,30 +25,16 @@
?>
<br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="upload_form_closed" style="display: none;">
-<table class="width100" cellspacing="1">
-<tr>
- <td class="form-title" colspan="2">
- <a href="" onclick="ToggleDiv( 'upload_form', g_div_upload_form ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'upload_file' ) ?>
- </td>
-</tr>
-</table>
-</div>
-<?php } ?>
-
-<div id="upload_form_open">
+<?php
+ collapse_open( 'upload_form' );
+?>
<form method="post" enctype="multipart/form-data" action="bug_file_add.php">
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="2">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'upload_form', g_div_upload_form ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
- <?php echo lang_get( 'upload_file' ) ?>
+<?php
+ collapse_icon( 'upload_form' );
+ echo lang_get( 'upload_file' ) ?>
</td>
</tr>
<tr class="row-1">
@@ -65,12 +51,19 @@
</tr>
</table>
</form>
-</div>
+<?php
+ collapse_closed( 'upload_form' );
+?>
+<table class="width100" cellspacing="1">
+<tr>
+ <td class="form-title" colspan="2">
+ <?php
+ collapse_icon( 'upload_form' );
+ echo lang_get( 'upload_file' ) ?>
+ </td>
+</tr>
+</table>
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/javascript" language="JavaScript">
-<!--
- SetDiv( "upload_form", g_div_upload_form );
--->
-</script>
-<?php } ?>
+<?php
+ collapse_end( 'upload_form' );
+?>
Index: bug_monitor_list_view_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_monitor_list_view_inc.php,v
retrieving revision 1.15
diff -u -r1.15 bug_monitor_list_view_inc.php
--- bug_monitor_list_view_inc.php 15 Aug 2006 07:11:23 -0000 1.15
+++ bug_monitor_list_view_inc.php 12 Aug 2007 20:33:56 -0000
@@ -30,21 +30,9 @@
echo '<a name="monitors" id="monitors" /><br />';
?>
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="monitoring_closed" style="display: none;">
-<table class="width100" cellspacing="1">
-<tr>
- <td class="form-title" colspan="2">
- <a href="" onclick="ToggleDiv( 'monitoring', g_div_monitoring ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'users_monitoring_bug' ); ?>
- </td>
-</tr>
-</table>
-</div>
-<?php } ?>
-
-<div id="monitoring_open">
+<?php
+ collapse_open( 'monitoring' );
+?>
<table class="width100" cellspacing="1">
<?php if ( 0 == $num_users ) { ?>
<tr>
@@ -55,10 +43,9 @@
<?php } else { ?>
<tr>
<td class="form-title" colspan="2">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'monitoring', g_div_monitoring ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
+<?php
+ collapse_icon( 'monitoring' );
+ ?>
<?php echo lang_get( 'users_monitoring_bug' ); ?>
</td>
</tr>
@@ -78,14 +65,18 @@
</tr>
<?php } ?>
</table>
-</div>
-
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/javascript" language="JavaScript">
-<!--
- SetDiv( "monitoring", g_div_monitoring );
--->
-</script>
-<?php } ?>
+<?php
+ collapse_closed( 'monitoring' );
+?>
+<table class="width100" cellspacing="1">
+<tr>
+ <td class="form-title" colspan="2"><?php collapse_icon( 'monitoring' ); ?>
+ <?php echo lang_get( 'users_monitoring_bug' ); ?>
+ </td>
+</tr>
+</table>
+<?php
+ collapse_end( 'monitoring' );
+?>
<?php } # show monitor list ?>
Index: bugnote_add_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_add_inc.php,v
retrieving revision 1.33
diff -u -r1.33 bugnote_add_inc.php
--- bugnote_add_inc.php 13 Jul 2007 07:58:29 -0000 1.33
+++ bugnote_add_inc.php 12 Aug 2007 20:33:56 -0000
@@ -14,31 +14,17 @@
<?php # Bugnote Add Form BEGIN ?>
<a name="addbugnote"></a> <br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="bugnote_add_closed" style="display: none;">
-<table class="width100" cellspacing="1">
-<tr>
- <td class="form-title" colspan="2">
- <a href="" onclick="ToggleDiv( 'bugnote_add', g_div_bugnote_add ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'add_bugnote_title' ) ?>
- </td>
-</tr>
-</table>
-</div>
-<?php } ?>
-
-<div id="bugnote_add_open">
+<?php
+ collapse_open( 'bugnote_add' );
+?>
<form name="bugnoteadd" method="post" action="bugnote_add.php">
<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="2">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'bugnote_add', g_div_bugnote_add ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
- <?php echo lang_get( 'add_bugnote_title' ) ?>
-<?php } ?>
+<?php
+ collapse_icon( 'bugnote_add' );
+ echo lang_get( 'add_bugnote_title' ) ?>
</td>
</tr>
<tr class="row-2">
@@ -98,14 +84,20 @@
</table>
</form>
</div>
-
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/javascript" language="JavaScript">
-<!--
- SetDiv( "bugnote_add", g_div_bugnote_add );
-// -->
-</script>
-<?php } ?>
+<?php
+ collapse_closed( 'bugnote_add' );
+?>
+<table class="width100" cellspacing="1">
+<tr>
+ <td class="form-title" colspan="2">
+ <?php collapse_icon( 'bugnote_add' );
+ echo lang_get( 'add_bugnote_title' ) ?>
+ </td>
+</tr>
+</table>
+<?php
+ collapse_end( 'bugnote_add' );
+?>
<?php # Bugnote Add Form END ?>
<?php } ?>
Index: bugnote_stats_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_stats_inc.php,v
retrieving revision 1.10
diff -u -r1.10 bugnote_stats_inc.php
--- bugnote_stats_inc.php 6 Jul 2007 21:33:03 -0000 1.10
+++ bugnote_stats_inc.php 12 Aug 2007 20:33:56 -0000
@@ -25,21 +25,21 @@
<a name="bugnotestats" id="bugnotestats" /><br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="bugnotestats_closed" style="display: none;">
+<?php
+ collapse_open( 'bugnotestats' );
+?>
<table class="width100" cellspacing="0">
<tr>
<td class="form-title" colspan="4">
- <a href="" onclick="ToggleDiv( 'bugnotestats', g_div_bugnotestats ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'time_tracking' ) ?>
+ <?php
+ collapse_icon( 'bugnotestats' );
+ echo lang_get( 'time_tracking' ) ?>
</td>
</tr>
</table>
-</div>
-<?php } ?>
-
-<div id="bugnotestats_open">
+<?php
+ collapse_closed( 'bugnotestats' );
+?>
<?php
$t_bugnote_stats_from_def = date( "d:m:Y", $t_bug->date_submitted );
$t_bugnote_stats_from_def_ar = explode ( ":", $t_bugnote_stats_from_def );
@@ -68,11 +68,9 @@
<table border=0 class="width100" cellspacing="0">
<tr>
<td class="form-title" colspan="4">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'bugnotestats', g_div_bugnotestats ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
- <?php echo lang_get( 'time_tracking' ) ?>
+<?php
+ collapse_icon( 'bugnotestats' );
+ echo lang_get( 'time_tracking' ) ?>
</td>
</tr>
<tr class="row-2">
@@ -140,10 +138,6 @@
</tr>
</table>
<?php } # end if ?>
-</div>
-
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/JavaScript">
- SetDiv( "bugnotestats", g_div_bugnotestats );
-</script>
-<?php } ?>
+<?php
+ collapse_end( 'bugnotestats' );
+?>
Index: bugnote_view_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_view_inc.php,v
retrieving revision 1.42
diff -u -r1.42 bugnote_view_inc.php
--- bugnote_view_inc.php 13 Jul 2007 16:47:47 -0000 1.42
+++ bugnote_view_inc.php 12 Aug 2007 20:33:56 -0000
@@ -44,21 +44,9 @@
<?php # Bugnotes BEGIN ?>
<a name="bugnotes" id="bugnotes" /><br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="bugnotes_closed" style="display: none;">
-<table class="width100" cellspacing="1">
-<tr>
- <td class="form-title" colspan="2">
- <a href="" onclick="ToggleDiv( 'bugnotes', g_div_bugnotes ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'bug_notes_title' ) ?>
- </td>
-</tr>
-</table>
-</div>
-<?php } ?>
-
-<div id="bugnotes_open">
+<?php
+ collapse_open( 'bugnotes' );
+?>
<table class="width100" cellspacing="1">
<?php
# no bugnotes
@@ -72,10 +60,8 @@
<?php } else { # print bugnotes ?>
<tr>
<td class="form-title" colspan="2">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'bugnotes', g_div_bugnotes ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
+<?php
+ collapse_icon( 'bugnotes' ); ?>
<?php echo lang_get( 'bug_notes_title' ) ?>
</td>
</tr>
@@ -211,14 +197,21 @@
} # end else
?>
</table>
-</div>
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/javascript" language="JavaScript">
-<!--
- SetDiv( "bugnotes", g_div_bugnotes );
-// -->
-</script>
-<?php } ?>
+<?php
+ collapse_closed( 'bugnotes' );
+?>
+
+<table class="width100" cellspacing="1">
+<tr>
+ <td class="form-title" colspan="2">
+ <?php collapse_icon( 'bugnotes' ); ?>
+ <?php echo lang_get( 'bug_notes_title' ) ?>
+ </td>
+</tr>
+</table>
+<?php
+ collapse_end( 'bugnotes' );
+?>
<?php # Bugnotes END ?>
Index: history_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/history_inc.php,v
retrieving revision 1.31
diff -u -r1.31 history_inc.php
--- history_inc.php 4 Apr 2007 06:45:21 -0000 1.31
+++ history_inc.php 12 Aug 2007 20:33:57 -0000
@@ -29,32 +29,16 @@
<a name="history" id="history" /><br />
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<div id="history_closed" style="display: none;">
-<table class="width100" cellspacing="0">
-<tr>
- <td class="form-title" colspan="4">
- <a href="" onclick="ToggleDiv( 'history', g_div_history ); return false;"
- ><img border="0" src="images/plus.png" alt="+" /></a>
- <?php echo lang_get( 'bug_history' ) ?>
- </td>
-</tr>
-</table>
-</div>
-<?php } ?>
-
-<div id="history_open">
<?php
+ collapse_open( 'history' );
$t_history = history_get_events_array( $f_bug_id );
?>
<table class="width100" cellspacing="0">
<tr>
<td class="form-title" colspan="4">
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
- <a href="" onclick="ToggleDiv( 'history', g_div_history ); return false;"
- ><img border="0" src="images/minus.png" alt="-" /></a>
-<?php } ?>
- <?php echo lang_get( 'bug_history' ) ?>
+<?php
+ collapse_icon( 'history' );
+ echo lang_get( 'bug_history' ) ?>
</td>
</tr>
<tr class="row-category-history">
@@ -93,11 +77,18 @@
?>
</table>
</div>
+<?php
+ collapse_closed( 'history' );
+?>
+<table class="width100" cellspacing="0">
+<tr>
+ <td class="form-title" colspan="4">
+ <?php collapse_icon( 'history' );
+ echo lang_get( 'bug_history' ) ?>
+ </td>
+</tr>
+</table>
-<?php if ( ON == config_get( 'use_javascript' ) ) { ?>
-<script type="text/javascript" language="JavaScript">
-<!--
- SetDiv( "history", g_div_history );
-// -->
-</script>
-<?php } ?>
+<?php
+ collapse_end( 'history' );
+?>
| ||||
| child of | 0004181 | closed | Features in Mantis 1.1 release |
|
I have submitted a patch. This issue can be resolved when someone with CVS write access does a peer review and patch integration to the source trunk. |
|
|
I just applied the patch locally for some testing. In the first page I tried (view.php) all sections (Relationships, Notes, etc) are initially collapsed: is that normal? It seems they remember the status afterwards, so there should be a method to set them open even the first time. am I missing something? |
|
|
you probably inverted the opened/closed calls: I can see the (-) icon near the collapsable section when it is closed, while the (+) icon is shown when it is open |
|
|
Yes, I did a mechanical replacement of the areas that were doing the collapse inline and missed that the open/closed icons were inverted. Incidentally, the API requires that the order be _open, _icon, _closed, _icon, _end, and the most of the areas where the code was inlined they had the closed first. |
|
|
Revised patch looks fine. Commited in CVS |
|
|
MantisBT: master a170c289 2007-08-12 18:43 Details Diff |
Fix 8188: Consistent use of collapse_api.php git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4541 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0008188 |
|
| mod - billing_inc.php | Diff File | ||
| mod - bug_monitor_list_view_inc.php | Diff File | ||
| mod - bugnote_view_inc.php | Diff File | ||
| mod - bugnote_stats_inc.php | Diff File | ||
| mod - history_inc.php | Diff File | ||
| mod - bug_file_upload_inc.php | Diff File | ||
| mod - bugnote_add_inc.php | Diff File | ||