4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 28, 2016, 08:56:13 AM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD] Left Gallery QuickList
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 6 » »» Print
Current Topic Rating: *****
Author Topic: [MOD] Left Gallery QuickList  (Read 60785 times)
budduke
Hero Member
*****
Offline Offline

Posts: 506

Thank You
-Given: 10
-Receive: 124


View Profile WWW
« on: April 25, 2009, 10:31:46 PM »

[MOD] Left Gallery Quick List V1.03

I was asked by another person if this could be done or not so I gave it a try and it worked!
It is based on JQuery's Treeview script that can be found at
http://docs.jquery.com/Plugins/Treeview

Demo: http://www.budduke.com/gallery

Backup the following files before you begin...
includes/page_header.php
includes/functions.php
lang/english/main.php
your template folder/home.html
your template folder/categories.html
your template folder/header.html


Revisions:
1.0 first try at it
1.01 fixed page number problem with modifield jquery.treeview.js file
1.02 fixed session issue problems and location highlighting when page#rs involved.
  • replace the jquery.treeview.js file with the new one in the zip file attached
  • replace the insert in the header.html and the functions.php files to fix these issues
1.03 fixed the hide list till page load problem with the updated code.


Let's begin with the mod...


New files added in attached zip file (The Treeview script from jquery)
In your template folder create a folder and call it "quickscript" and copy all files from the zip folder to that directory along with a sub folder called images...
the finished path should look likt templates/your template directory/quickscript/images


in the includes/page_header.php file
look for
insert before
1
2
3
4
5
6
7
8
9
10
//-----------------------------------------------------
//--- MOD Left Quicklist -------------------------------
//-----------------------------------------------------
$left_quicklist = get_left_quicklist($cat_id);
$site_template->register_vars(array(
"left_quicklist"   => $left_quicklist,
"lang_left_quicklist" => $lang['left_quicklist']
));
unset($left_quicklist);
// END MOD Left quicklist

in the includes/functions.php file (updated for version 1.03)
look for
insert before
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//MOD Left QuickList
function get_left_quicklist_bits($cat_id, $cid = 0, $depth = 1) {
  global $site_db, $drop_down_cat_cache, $cat_cache, $site_sess;
//config area
$left_quick_length=24; //length of category name, 0-3 =off (if on, will shorten name to fit with ... after it)
$adjust_depth=1; // try to adjust for depth for right side to line up
$with_folder=0; // if you want a folder to be displayed then set this to 1 (I thought it took to much screenspace)
//end config
  if (!isset($drop_down_cat_cache[$cid])) {
    return "";
  }
  $category_list = "";
  foreach ($drop_down_cat_cache[$cid] as $key => $category_id) {
    if (check_permission("auth_viewcat", $category_id)) {
$quick_cat_name=format_text($cat_cache[$category_id]['cat_name'],2);
$left_quick_length_var= $left_quick_length;
$test=strlen($quick_cat_name);
if ($adjust_depth && ($depth >1)){
$left_quick_length_var = $left_quick_length -(($depth-1)*3) -(($depth-1)*$with_folder);
}
if (($left_quick_length_var > 3)  && (strlen($quick_cat_name)> $left_quick_length_var) ){
$quick_cat_name= substr($quick_cat_name, 0, ($left_quick_length_var - 3))."...";
}
if ($with_folder){
$category_list .= "<li><span class='folder'><a href='".$site_sess->url('categories.php?'.URL_CAT_ID.'='.$category_id)."'>".$quick_cat_name."</a></span>";
}
else {
      $category_list .= "<li><a href='".$site_sess->url('categories.php?'.URL_CAT_ID.'='.$category_id)."'>".$quick_cat_name."</a>";
      }
 $result= get_left_quicklist_bits($cat_id, $category_id, $depth + 1);
  if ($result){
$category_list .= "<ul>".$result."</ul></li>";
}
else {
$category_list .= "</li>";
}
   }
   }
  unset($drop_down_cat_cache[$cid]);
  return $category_list;
}

function get_left_quicklist($cat_id) {
  global $drop_down_cat_cache, $cat_parent_cache;
  $category = "<ul id='left_quicklist_nav' class='filetree' style='display: none'>";
  $drop_down_cat_cache = array();
  $drop_down_cat_cache = $cat_parent_cache;
  $result= get_left_quicklist_bits($cat_id);
  if ($result){
$category .= $result."</ul>";
   }  
  return $category;
}
//END MOD Left QuickList


in the lang/english/main.php file
look for
insert before
1
2
3
4
//-----------------------------------------------------
//--- Left Quick List -------------------------------------
//-----------------------------------------------------
$lang['left_quicklist'] = "Gallery Quick List";


in your template folder/header.html file (updated for version 1.03)
look for
insert before
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!-- MOD Left Quicklist -->
<link rel="stylesheet" href= "{template_url}/quickscript/jquery.treeview.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script src= "{template_url}/quickscript/jquery.treeview.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var urlSessName = "<?=SESSION_NAME;?>";
var urlPageName = "<?=URL_PAGE;?>";
$(document).ready(function(){

// first example
$("#left_quicklist_nav").treeview({
collapsed: true,
unique: true,
persist: "location"
});
});
onload=function() {
     document.getElementById('left_quicklist_nav').style.display ='block';
 }
</script>
<!-- END MOD Left Quicklist -->


in both your template folder/home.html and your template folder/categories.html files
Place this code where you would like to display the list on the left side
My example look for
1
{endif random_image}
insert after in both files...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 <!--MOD left Quicklist-->
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_left_quicklist}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td>
                        {left_quicklist}
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 <!-- END MOD Left Quicklist-->

In the includes/functions.php file you will see at the start of my functions some config settings that you can play with
If your sub categories go real real real deep you may want to place this somewhere else on your template to give it more room.

Inside the quickscript folder there is a jquery.treeview.css file that you can modify to fit into your template better.
The .treeview, .treeview ul and the .treeview ul both at the top of the css file were the best place I found to modify to get the background color to match your template.
There is also .treeview a.selected area that is the background color used for the category you are currently viewing

That is the end of modification, you should now have a quicklist on your site...






 

* screenshot.jpg (15.24 KB - downloaded 232 times.)
* quickscript.zip (15.06 KB - downloaded 176 times.)
« Last Edit: August 15, 2010, 08:53:59 PM by budduke » Logged

Buddy Duke
www.budduke.com
whosthis.ee
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #1 on: April 28, 2009, 01:34:51 PM »

great mod

works fine
Logged
mawenzi
Moderator
4images Guru
*****
Offline Offline

Posts: 4500

Thank You
-Given: 36
-Receive: 121


View Profile
« Reply #2 on: April 28, 2009, 01:46:22 PM »

... thanks for sharing ...  Very Happy
... moved to Mods & Plugins (Releases & Support) ...
Logged

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 24
-Receive: 51


View Profile
« Reply #3 on: April 28, 2009, 04:37:27 PM »

hi budduke,

nice mod...

thank you for sharing!
Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images | Facebook Covers
Signature stolen from mawenzi
whosthis.ee
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #4 on: April 28, 2009, 05:35:16 PM »

but its not opening the google friendly urls

how to fix this ??
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 562

mmm PHP...


View Profile WWW
« Reply #5 on: April 29, 2009, 01:45:37 AM »

In the new code in functions.php find:
1
   if (check_permission("auth_viewcat", $category_id)) {
insert below:
1
$category_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id);

Find:
1
$category_list .= "<li><span class='folder'><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a></span>";

Replace with:
1
$category_list .= "<li><span class='folder'><a href=".$category_url.">".$quick_cat_name."</a></span>";


Find next:
1
     $category_list .= "<li><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a>";

Replace with:
1
     $category_list .= "<li><a href=".$category_url.">".$quick_cat_name."</a>";



Find next:
1
  global $site_db, $drop_down_cat_cache, $cat_cache;

Replace with:
1
  global $site_db, $drop_down_cat_cache, $cat_cache, $site_sess;
« Last Edit: November 20, 2009, 02:09:03 AM by V@no » Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
4ella
Jr. Member
**
Offline Offline

Posts: 90

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #6 on: April 30, 2009, 01:49:02 PM »

Very nice , works perfect , thanks a lot budduke
Logged


http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux
4ella
Jr. Member
**
Offline Offline

Posts: 90

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #7 on: April 30, 2009, 02:42:15 PM »

Very nice , works perfect , thanks a lot budduke

Wanted to ask if somebody possibly know: When reload current page , left gallery quicklist due to my deep categories gallery spreads to the very wide (what doesnt look like very nice ) and after 2 seconds it arranges itself on exact place , Can I avoid it ? I saw budduke gallery , it makes the same , but only for a while (i know he has 300 categories , I have 1000 but maybe someone knows a trick how to do it ) I had the same problem with language flags , when reload it showed language names and after flags so I had to put the the lang flags to another place and had to shorten the language names , left gallery quicklist fits best on the left sidebar so i wouldn't like  to miss it there ,  thanks Daniel .
« Last Edit: April 30, 2009, 03:00:08 PM by 4ella » Logged


http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux
4ella
Jr. Member
**
Offline Offline

Posts: 90

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #8 on: April 30, 2009, 10:24:02 PM »

I had to remove it Sad , but very nice MOD anyway for everybody with not too many cats , will be happy if someone will explain how managed to get to put it in left sidebar when having many deep categories
Logged


http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux
Sumale.my
Addicted member
******
Offline Offline

Posts: 1765

Thank You
-Given: 165
-Receive: 78

Neverdie


View Profile
« Reply #9 on: April 30, 2009, 10:36:56 PM »

Ich finde der Fix von Vano sollte im ersten Post Editiert werden bzw. zugefügt werden!

@budukke,

very nice! THX
Logged
budduke
Hero Member
*****
Offline Offline

Posts: 506

Thank You
-Given: 10
-Receive: 124


View Profile WWW
« Reply #10 on: May 01, 2009, 10:52:16 PM »

Very nice , works perfect , thanks a lot budduke

Wanted to ask if somebody possibly know: When reload current page , left gallery quicklist due to my deep categories gallery spreads to the very wide (what doesnt look like very nice ) and after 2 seconds it arranges itself on exact place , Can I avoid it ? I saw budduke gallery , it makes the same , but only for a while (i know he has 300 categories , I have 1000 but maybe someone knows a trick how to do it ) I had the same problem with language flags , when reload it showed language names and after flags so I had to put the the lang flags to another place and had to shorten the language names , left gallery quicklist fits best on the left sidebar so i wouldn't like  to miss it there ,  thanks Daniel .

I saw that also when I ran the script the first time. It seems the different browsers handle it differently. I have very limited knowledge of javascript but I think the problem is the entire page had to be loaded before the javascript kicks in.
Since they have to be list items to work correctly, the browser loads it as a normal list of links until the javascript get to changing it. I saw no way to preload it in anyway before displaying.
I sometimes wonder if flash or regular java may handle this any better? Maybe look into it when I have a little play time.
Logged

Buddy Duke
www.budduke.com
whosthis.ee
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #11 on: May 02, 2009, 12:19:55 AM »

In the new code in functions.php find:
1
    if (check_permission("auth_viewcat", $category_id)) {
insert below:
1
$category_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id);

Find:
1
$category_list .= "<li><span class='folder'><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a></span>";

Replace with:
1
$category_list .= "<li><span class='folder'><a href=".$category_url.">".$quick_cat_name."</a></span>";


Find next:
1
      $category_list .= "<li><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a>";

Replace with:
1
      $category_list .= "<li><a href=".$category_url.">".$quick_cat_name."</a>";



Hi

i tried the same

but its not working for me
Logged
whosthis.ee
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: May 02, 2009, 12:25:26 AM »

how to display all the categories in the expand view
Logged
4ella
Jr. Member
**
Offline Offline

Posts: 90

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #13 on: May 02, 2009, 03:46:24 AM »

@budduke
Thanks a lot for your respond , this quicklist  is really very very nice and usefull , I had to remove it , but I really miss it now Sad  I will wait if you will happily find a solution, but I think that it is only my very poor designer ability , that I'm not able to make left sidebar firm like e.g Mawenzi's web where everything is always firm - fest
Logged


http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux
budduke
Hero Member
*****
Offline Offline

Posts: 506

Thank You
-Given: 10
-Receive: 124


View Profile WWW
« Reply #14 on: May 02, 2009, 02:39:31 PM »

how to display all the categories in the expand view
in your template folder...
look in the header.html file for the
1
2
3
4
5
$("#left_quicklist_nav").treeview({
collapsed: true,
unique: true,
persist: "location"
});
Collapsed=true for collapsed list or if you want to expand all categories collapsed= false
unique=true for only only branch being open at a time or unique = false if you want to open any at the same time
Persist variable is what highlights the location you are currently at in the gallery


Hope that help!
« Last Edit: May 04, 2009, 12:25:54 AM by budduke » Logged

Buddy Duke
www.budduke.com
Pages: [1] 2 3 4 5 6 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.33 seconds with 20 queries.