View Issue Details

IDProjectCategoryView StatusLast Update
0000257XMB1New Featurespublic2009-02-28 11:29
Reportermiqrogroove Assigned Tomiqrogroove  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Target Version1.9.11Fixed in Version1.9.11 
Summary0000257: Context Sensitive Quick Jump
DescriptionIt would be nice if the forum Quick Jump menu had the current forum preselected.
TagsNo tags attached.
MySQL Version
PHP Version
Web Server
Browser
Flags
Original Reporter
SVN Revision1716

Relationships

related to 0000270 closedmiqrogroove ROOT Should Not Appear in forumJump() 

Activities

Jonathon

2009-02-13 23:17

reporter   ~0000140

I have come up with a mod/fix for this. I'll post about it over in the forums.

The mod can be found here:

http://forums.xmbforum.com/viewthread.php?tid=774034

Should I attach the file here too? Or just leave it posted only on the frums?

miqrogroove

2009-02-13 23:38

administrator   ~0000141

Hi Jonathon, thanks for this nice work. I will look at it closely tomorrow. I can offer two points of feedback at the moment.

The final product needs to be either a .diff file or full functions.inc.php based on the trunk version. Definitely attach one of those if you already made one for testing.

$_REQUEST['fid'] should always be written as getInt('fid', 'r') for XMB.

Jonathon

2009-02-14 08:32

reporter   ~0000142

Well, don't know anything about the .diff files; but I figured I would do it as a mod instead - that way if it wasn't included as part of the actual release people could add it in themselves.

But, I'll do a re-release of the 1.9.11 version that uses the " getInt('fid', 'r') ". Does that also go for 1.9.10 as well?

miqrogroove

2009-02-14 09:11

administrator   ~0000143

> that way if it wasn't included as part of the actual release people could add it in themselves.

I think part of the reason this feature wasn't written before now is that the 'fid' input is only available to the forumdisplay script. For other areas such as viewthread, the global $fid value would need to be used. This is a catch 22 where forumJump() is called by header.php but the $fid value is set later by individual scripts.

To make this a full feature for 1.9.11, I think the $fid value needs to be an argument to function forumJump(), which could be re-called by the scripts before evaluating any templates.

> " getInt('fid', 'r') ". Does that also go for 1.9.10 as well?

Absolutely, yes.

miqrogroove

2009-02-14 09:18

administrator   ~0000144

Actually, we do have $fid being set in header.php under the comment // Get themes, [fid, [tid]]

Perhaps it would work out to check the global $fid value when getInt('fid', 'r') == 0?

2009-02-14 17:20

 

Issue #257 Draft 2.diff (4,346 bytes)   
Index: header.php
===================================================================
--- header.php	(revision 1710)
+++ header.php	(working copy)
@@ -457,13 +457,15 @@
 }
 
 // Get themes, [fid, [tid]]
-if (isset($tid) && is_numeric($tid) && $action != 'templates') {
+$fid = getInt('fid', 'r');
+$tid = getInt('tid', 'r');
+if ($tid > 0 && $action != 'templates') {
     $query = $db->query("SELECT f.fid, f.theme FROM ".X_PREFIX."forums f RIGHT JOIN ".X_PREFIX."threads t USING (fid) WHERE t.tid=$tid");
     $locate = $db->fetch_array($query);
     $db->free_result($query);
     $fid = $locate['fid'];
     $forumtheme = $locate['theme'];
-} else if (isset($fid) && is_numeric($fid)) {
+} else if ($fid > 0) {
     $forum = getForum($fid);
     if (($forum['type'] != 'forum' && $forum['type'] != 'sub') || $forum['status'] != 'on') {
         $forumtheme = 0;
Index: include/functions.inc.php
===================================================================
--- include/functions.inc.php	(revision 1711)
+++ include/functions.inc.php	(working copy)
@@ -1878,35 +1878,41 @@
 }
 
 function forumJump() {
-    global $lang;
+    global $fid, $lang, $selHTML;
 
     // Initialize $forumselect
     $forumselect = array();
+    $checkid = max($fid, getInt('gid', 'r'));
 
     $forumselect[] = "<select onchange=\"if (this.options[this.selectedIndex].value) {window.location=(''+this.options[this.selectedIndex].value)}\">";
-    $forumselect[] = '<option value="0" selected="selected">'.$lang['forumjumpselect'].'</option>';
+    $forumselect[] = '<option value="">'.$lang['forumjumpselect'].'</option>';
 
     // Populate $forumselect
     $permitted = getStructuredForums(TRUE);
 
     foreach($permitted['forum']['0'] as $forum) {
-        $forumselect[] = '<option value="forumdisplay.php?fid='.intval($forum['fid']).'"> &nbsp; &raquo; '.fnameOut($forum['name']).'</option>';
+        $dropselc1 = ( $checkid == $forum['fid'] ) ? $selHTML : '';
+        $forumselect[] = '<option value="forumdisplay.php?fid='.intval($forum['fid']).'" '.$dropselc1.'> &nbsp; &raquo; '.fnameOut($forum['name']).'</option>';
         if (isset($permitted['sub'][$forum['fid']])) {
             foreach($permitted['sub'][$forum['fid']] as $sub) {
-                $forumselect[] = '<option value="forumdisplay.php?fid='.intval($sub['fid']).'">&nbsp; &nbsp; &raquo; '.fnameOut($sub['name']).'</option>';
+                $dropselc2 = ( $checkid == $sub['fid'] ) ? $selHTML : '';
+                $forumselect[] = '<option value="forumdisplay.php?fid='.intval($sub['fid']).'" '.$dropselc2.'>&nbsp; &nbsp; &raquo; '.fnameOut($sub['name']).'</option>';
             }
         }
     }
 
     foreach($permitted['group']['0'] as $group) {
         if (isset($permitted['forum'][$group['fid']])) {
-            $forumselect[] = '<option value="0"></option>';
-            $forumselect[] = '<option value="index.php?gid='.intval($group['fid']).'">'.fnameOut($group['name']).'</option>';
+            $dropselc3 = ( $checkid == $group['fid'] ) ? $selHTML : '';
+            $forumselect[] = '<option value=""></option>';
+            $forumselect[] = '<option value="index.php?gid='.intval($group['fid']).'" '.$dropselc3.'>'.fnameOut($group['name']).'</option>';
             foreach($permitted['forum'][$group['fid']] as $forum) {
-                $forumselect[] = '<option value="forumdisplay.php?fid='.intval($forum['fid']).'"> &nbsp; &raquo; '.fnameOut($forum['name']).'</option>';
+                $dropselc4 = ( $checkid == $forum['fid'] ) ? $selHTML : '';
+                $forumselect[] = '<option value="forumdisplay.php?fid='.intval($forum['fid']).'" '.$dropselc4.'> &nbsp; &raquo; '.fnameOut($forum['name']).'</option>';
                 if (isset($permitted['sub'][$forum['fid']])) {
                     foreach($permitted['sub'][$forum['fid']] as $sub) {
-                        $forumselect[] = '<option value="forumdisplay.php?fid='.intval($sub['fid']).'">&nbsp; &nbsp; &raquo; '.fnameOut($sub['name']).'</option>';
+                        $dropselc5 = ( $checkid == $sub['fid'] ) ? $selHTML : '';
+                        $forumselect[] = '<option value="forumdisplay.php?fid='.intval($sub['fid']).'" '.$dropselc5.'>&nbsp; &nbsp; &raquo; '.fnameOut($sub['name']).'</option>';
                     }
                 }
             }
Issue #257 Draft 2.diff (4,346 bytes)   

miqrogroove

2009-02-14 17:22

administrator   ~0000148

The attached code has been applied to test.xmbforum.com. Does that look good to you?

Jonathon

2009-02-15 01:14

reporter   ~0000151

Looks good and also a little more integrated.

Plus it also keep the forum selected in the drop-down when within a post -- which mine didn't.

I'll update my coding soon for the 1.9.10 mod version. Will this be added into the current release (when ti goes live)? Or should I still release it as a mod/addon?

miqrogroove

2009-02-15 01:23

administrator   ~0000152

Good to hear. I have committed the diff to trunk now and it will be included with XMB 1.9.11.

Issue History

Date Modified Username Field Change
2009-01-14 17:54 miqrogroove New Issue
2009-02-13 23:17 Jonathon Note Added: 0000140
2009-02-13 23:38 miqrogroove Note Added: 0000141
2009-02-13 23:38 miqrogroove Status new => acknowledged
2009-02-14 08:32 Jonathon Note Added: 0000142
2009-02-14 09:03 miqrogroove Relationship added related to 0000270
2009-02-14 09:11 miqrogroove Note Added: 0000143
2009-02-14 09:18 miqrogroove Note Added: 0000144
2009-02-14 17:20 miqrogroove File Added: Issue #257 Draft 2.diff
2009-02-14 17:22 miqrogroove Note Added: 0000148
2009-02-14 17:22 miqrogroove Assigned To => miqrogroove
2009-02-14 17:22 miqrogroove Status acknowledged => assigned
2009-02-14 17:22 miqrogroove Projection none => minor fix
2009-02-14 17:22 miqrogroove Target Version => 1.9.11
2009-02-15 01:14 Jonathon Note Added: 0000151
2009-02-15 01:23 miqrogroove SVN Revision => 1716
2009-02-15 01:23 miqrogroove Note Added: 0000152
2009-02-15 01:23 miqrogroove Status assigned => resolved
2009-02-15 01:23 miqrogroove Fixed in Version => 1.9.11
2009-02-15 01:23 miqrogroove Resolution open => fixed
2009-02-28 11:29 miqrogroove Status resolved => closed