wirewolf
|
 |
« on: November 30, 2006, 02:49:29 am » |
|
I created a plugin that will add a menu link for a Gallery Directory (with out a lot of thumbnails to be displayed). The user can select from a Drop Down List of a Gallery's Categories. The resulting page displays a bulleted list of the Albums within that Category, and all of the files within each Album. The script will only show public albums and approved files. Also, if any file does not have a title, the script will substitute the filename on the list. See Directory as an example. Works with v1.4.10, classic theme. Should work with other themes. It has only the english.php file, but easy for those who wish to provide translations, there are only 8 lines in the language file. I have mod_rewrite on my site, but the script is written for the normal php paths'. (ie, Directory as written in the script) Now, I only have two Categories on my site for now, but this could be useful for those with a lot of Categories. This plugin was inspired by the Photo Summary plugin by Frantz, Displaying an file index page. If the devs like. I'll post the plugin. Also, before I post the plugin, if the devs would like to check my coding of the plugin's main script, cat_directory.php wirewolf Zip file for download below
|
|
|
|
« Last Edit: January 01, 2007, 02:34:31 pm by wirewolf »
|
Logged
|
|
|
|
|
Joachim Müller
|
 |
« Reply #1 on: November 30, 2006, 04:15:05 am » |
|
If the devs like. I'll post the plugin. Also, before I post the plugin, if the devs would like to check my coding of the plugin's main script, cat_directory.php
Looks interessting, please go ahead - looking forward to it. Joachim
|
|
|
|
|
Logged
|
|
|
|
François Keller
Dev Team member
   
Gender:
 France
Posts: 7369
aka Frantz
|
 |
« Reply #2 on: November 30, 2006, 06:16:56 am » |
|
hey very interesting. Please share your code 
|
|
|
|
|
Logged
|
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ? Did you read the DOC ? the FAQ ? and search the board before posting ? Mon Blog
|
|
|
Pascal YAP
Dev Team member
   
Gender:
 Armenia
Posts: 3791
He's me, and She's Moon
|
 |
« Reply #3 on: November 30, 2006, 08:46:46 am » |
|
Mornin', Nothing to add.... We're waiting for you  Thanx by advance. PYA
|
|
|
|
|
Logged
|
! Pas de PM please ! No PM s'il vous plait !
|
|
|
Hein Traag
Dev Team member
   
Gender:
 Netherlands
Posts: 2153
A, B, Cpg
|
 |
« Reply #4 on: November 30, 2006, 09:07:07 am » |
|
Looks nice wirewolf. Good job! Looking forward to testing it on my CPG  Hein
|
|
|
|
|
Logged
|
|
|
|
wirewolf
|
 |
« Reply #5 on: November 30, 2006, 10:53:30 am » |
|
Hi, sorry for the delay. I'm here in New York and I just got up. Anyway, here's the code for cat_directory.php. The script works, but would the devs check the code to see if there are any potential problems. If ok, I'll upload the plugin later. cat_directory.php: <?php /************************* Coppermine Photo Gallery ************************ Copyright (c) 2003-2006 Coppermine Dev Team v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. /************************* Gallery Directory plugin v1.0 by wirewolf for Coppermine 1.4.10 **************************/
require('include/init.inc.php'); require ('plugins/cat_directory/include/init.inc.php'); if (isset($_POST['submit'])) { $category = $_POST['category']; $values = explode(",", $category); $valtwo = $values[1]; $page = $valtwo; } else { $page = $lang_plugin_cat_directory['name']; } pageheader($page); starttable("100%", $page, 1); $category = ''; $albcount = ''; $imagecount = ''; $form_action = "index.php?file=cat_directory/cat_directory"; echo "<tr>\n"; echo "<td class=\"tableb\">\n"; echo "<tr>\n"; echo "<td class=\"tableb\">\n"; echo "<form action=\"$form_action\" method=\"post\" style=\"margin: 0\">\n"; echo "{$lang_plugin_cat_directory['directory_select']} \n"; echo "<select name=\"category\">\n"; $query = cpg_db_query("SELECT cid, name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid != 1 ORDER BY name ASC "); if (!mysql_num_rows($query)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); while ($row = mysql_fetch_array($query)){ echo "<option value=\"$row[cid],{$lang_plugin_cat_directory['menu_link']} - $row[name]\">$row[name]</option>\n"; } echo "</select>\n"; echo "<input title=\"{$lang_plugin_cat_directory['directory_select']}\" class=\"button\" type=\"submit\" name=\"submit\" value=\"Go!\" />\n"; echo "</form>\n"; echo "</td>\n"; echo "</tr>\n"; mysql_free_result($query);
if (isset($_POST['submit'])) { $category = $_POST['category']; $values = explode(",", $category); $valone = $values[0]; echo "<tr>\n"; echo "<td class=\"tableb\">\n"; echo "<ul>\n"; $catquery = cpg_db_query("SELECT cid, name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = $valone "); if (!mysql_num_rows($catquery)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); while ($catrow = mysql_fetch_array($catquery)){ $albquery = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = '$catrow[cid]' AND visibility = 0 ORDER BY title ASC "); if (!mysql_num_rows($albquery)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); $albcount = mysql_num_rows($albquery); echo "<li>{$lang_plugin_cat_directory['category']} - <a title=\"{$lang_plugin_cat_directory['category']} - $catrow[name]\" href=\"index.php?cat=$catrow[cid]\">$catrow[name]</a> <span class=\"footer\">(<strong>$albcount</strong> {$lang_plugin_cat_directory['albums']})</span></li>\n"; echo "<ul>\n"; while ($albrow = mysql_fetch_array($albquery)){ $imgquery = cpg_db_query("SELECT pid, title, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '$albrow[aid]' AND approved = 'yes' ORDER BY title ASC "); $imagecount = mysql_num_rows($imgquery); if ($imagecount >= 1) { echo "<li>{$lang_plugin_cat_directory['album']} - <a title=\"{$lang_plugin_cat_directory['album']} - $albrow[title]\" href=\"thumbnails.php?album=$albrow[aid]\">$albrow[title]</a> <span class=\"footer\">(<strong>$imagecount</strong> {$lang_plugin_cat_directory['files']})</span></li>\n"; while ($picrow = mysql_fetch_array($imgquery)) { if (!$picrow['title']){ $picrow['title'] = $picrow['filename']; } echo "<ul>\n"; echo "<li><a title=\"{$lang_plugin_cat_directory['file']} - $picrow[title]\" href=\"displayimage.php?pos=-$picrow[pid]\">$picrow[title]</a></li>\n"; echo "</ul>\n"; } } } echo "</ul>\n"; } echo "</ul>\n"; echo "</td>\n"; echo "</tr>\n"; mysql_free_result($imgquery); mysql_free_result($albquery); mysql_free_result($catquery); } echo "</td>\n"; echo "</tr>\n"; endtable(); pagefooter(); ob_end_flush();
?> Thanks, wirewolf
|
|
|
|
|
Logged
|
|
|
|
Sami
Dev Team member
   
Gender:
 Iran, Islamic Republic of
Posts: 3689
BMossavari
|
 |
« Reply #6 on: November 30, 2006, 01:02:23 pm » |
|
It would be better if you put the whole plugin package for test  BTW you can remove this (around line 55~57) $category = $_POST['category']; $values = explode(",", $category);
You've set those variables on first if (isset($_POST['submit'])) statment
|
|
|
|
|
Logged
|
I don't answer to PM with support question Please post your issue to related board
|
|
|
wirewolf
|
 |
« Reply #7 on: November 30, 2006, 11:44:51 pm » |
|
Ok, here's the zip file with the plugin. I did some slight modifications. After selecting a directory from the drop down menu, the resulting page will only show the directory selected. Added a link at the bottom of this page to return to the drop down. See - Directory. I have mod_rewrite, so the file and the directory listings will show a html extension. The plugin is written with the normal php paths and will work with the normal Coppermine script. The zip file includes all the files and a README with instructions. If the devs like, please post accordingly. Thanks, wirewolf PS, Thank you Frantz for the inspiration. Add-on, I've included Frantz's and Hein's French and Dutch laguage files in the zip file Jan 1st, 2007 - Made some changes to the cat_directory.php file (made it a list of links for the categories and for mark-up validation). New zip file included (only file change is cat_directory.php, all others are the same) wirewolf
|
|
|
« Last Edit: January 01, 2007, 02:23:46 pm by wirewolf »
|
Logged
|
|
|
|
François Keller
Dev Team member
   
Gender:
 France
Posts: 7369
aka Frantz
|
 |
« Reply #8 on: December 01, 2006, 06:43:54 am » |
|
Hey Wirewolf, Good work, attached, french language file.  Thank you Frantz for the inspiration. Thank's, but my plugin was inspired by fotofreek's MOD 
|
|
|
« Last Edit: December 01, 2006, 12:28:54 pm by Frantz »
|
Logged
|
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ? Did you read the DOC ? the FAQ ? and search the board before posting ? Mon Blog
|
|
|
Hein Traag
Dev Team member
   
Gender:
 Netherlands
Posts: 2153
A, B, Cpg
|
 |
« Reply #9 on: December 01, 2006, 10:53:19 am » |
|
Dutch language file. Good work wirewolf  Hein
|
|
|
|
Logged
|
|
|
|
wirewolf
|
 |
« Reply #10 on: December 01, 2006, 09:02:33 pm » |
|
Thanks Frantz and Hein for the translations. Anyone else that would like to contribute a translation file, just post it right here. For those wanting to download the plugin, I added the French and Dutch language files to the zip - http://forum.coppermine-gallery.net/index.php?topic=38927.msg184460#msg184460 , or if you have already installed the plugin, just download the language files and upload to the plugins' lang folder. Anyone whos' installed the plugin, post a link to your site. I'd like to see it in action on other than my own site, Cheers, wirewolf
|
|
|
|
|
Logged
|
|
|
|
|
hotkee
Coppermine newbie
Posts: 3
|
 |
« Reply #11 on: January 01, 2007, 01:03:39 pm » |
|
Hi wirewolf
I have installed the plugin but have a problem understanding how to get it display the menu. Do I need to modify the theme? And if so what should be added?
Anyone help please.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
cocostaff
Coppermine newbie
Posts: 19
|
 |
« Reply #13 on: March 02, 2007, 10:00:56 am » |
|
Hi wirewolf
I have installed the plugin, but it seems conflicting with the bridge of joomla. When i click on the directory menu i get : Critical error - There was an error while processing a database query.
i have many plugins installed (download image/ keyword tags/ Orderable Category List) and a modified theme (suppressed head and title). I've tried the elevate the plugin hierarchy to the highest rank to avoid conflicting with Orderable Category List but it still display the error message above.
Any ideas ?
|
|
|
|
|
Logged
|
|
|
|
wirewolf
|
 |
« Reply #14 on: March 04, 2007, 02:51:56 am » |
|
Hi cocostaff, have you enabled 'debug mode'? Might give you a better idea of the problem. I'm not familiar with joomla, so I don't know what possible conflict, if any, there would be with the category plugin. Also, do you have a link to the cat directory?
|
|
|
|
|
Logged
|
|
|
|
|
cocostaff
Coppermine newbie
Posts: 19
|
 |
« Reply #15 on: March 04, 2007, 10:04:09 pm » |
|
Hi cocostaff, have you enabled 'debug mode'? Might give you a better idea of the problem. I'm not familiar with joomla, so I don't know what possible conflict, if any, there would be with the category plugin. Also, do you have a link to the cat directory?
Here is the debug message i obtain, on cpg_folder/include/functions.inc.php - Line: 249 USER: ------------------ Array ( [ID] => 0252f5e65dc5d9b41ec6ac12c8d3cd23 [am] => 1 [lang] => french [liv] => Array ( [0] => 295 [1] => 294 [2] => 4740 [3] => 1968 [4] => 1965 )
[sort] => td [search] => Array ( [search] => michelange [album] => search [plugin_search_album] => true [title] => on [newer_than] => [caption] => on [older_than] => [keywords] => on [type] => AND [album_title] => on [album_description] => on [params] => Array ( [title] => on [caption] => on [keywords] => on )
)
[lap] => 7 )
========================== USER DATA: ------------------ Array ( [user_id] => 62 [user_name] => admin [groups] => Array ( [0] => 1 )
[disk_max] => 0 [disk_min] => 0 [can_rate_pictures] => 1 [can_send_ecards] => 1 [ufc_max] => 3 [ufc_min] => 3 [custom_user_upload] => 0 [num_file_upload] => 10 [num_URI_upload] => 3 [can_post_comments] => 1 [can_upload_pictures] => 1 [can_create_albums] => 1 [has_admin_access] => 1 [pub_upl_need_approval] => 0 [priv_upl_need_approval] => 0 [group_name] => Administrators [upload_form_config] => 3 [group_quota] => 0 [can_see_all_albums] => 1 [group_id] => 1 )
========================== Queries: ------------------ Array ( [0] => SELECT extension, mime, content, player FROM cp_filetypes; (0.006s) [1] => select * from cp_plugins order by priority asc; (0s) [2] => SELECT * FROM cp_bridge (0.002s) [3] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as priv_upl_need_approval FROM cp_usergroups WHERE group_id in (1) (0s) [4] => SELECT group_name FROM cp_usergroups WHERE group_id= 1 (0s) [5] => SELECT user_favpics FROM cp_favpics WHERE user_id = 62 (0.003s) [6] => SELECT * FROM cp_final_extract_config (0.003s) [7] => DELETE FROM cp_banned WHERE expiry < '2007-03-04 22:00:26' (0.001s) [8] => SELECT * FROM cp_banned WHERE (ip_addr='84.97.212.186' OR ip_addr='84.97.212.186' OR user_id=62) AND brute_force=0 (0.004s) [9] => SELECT cid, name FROM cp_categories WHERE cid != 1 AND visible = 0 ORDER BY name ASC (0s) )
========================== GET : ------------------ Array ( [file] => cat_directory/cat_directory )
========================== POST : ------------------ Array ( )
========================== VERSION INFO : ------------------ PHP version: 4.3.11 - OK ------------------ mySQL version: 4.0.27-max-log ------------------ Coppermine version: 1.4.10(stable) ========================== Module: GD ------------------ GD Version: bundled (2.0.28 compatible) FreeType Support: 1 FreeType Linkage: with freetype T1Lib Support: GIF Read Support: 1 GIF Create Support: 1 JPG Support: 1 PNG Support: 1 WBMP Support: 1 XBM Support: 1 JIS-mapped Japanese Font Support:
========================== Module: mysql ------------------ MySQL Supportenabled Active Persistent Links 0 Active Links 2 Client API version 5.0.18 MYSQL_MODULE_TYPE external MYSQL_SOCKET /usr/local/mysql-5.0/data/mysql.sock MYSQL_INCLUDE -I/usr/local/mysql-5.0/include/mysql MYSQL_LIBS -L/usr/local/mysql-5.0/lib/mysql -lmysqlclient ========================== Module: zlib ------------------ ZLib Support enabled Compiled Version 1.1.4 Linked Version 1.2.3 ========================== Server restrictions (safe mode)? ------------------ Directive | Local Value | Master Value safe_mode | Off | Off safe_mode_exec_dir | /usr/local/php/bin | /usr/local/php/bin safe_mode_gid | Off | Off safe_mode_include_dir | no value | no value safe_mode_exec_dir | /usr/local/php/bin | /usr/local/php/bin sql.safe_mode | Off | Off disable_functions | no value | no value file_uploads | On | On include_path | .:/usr/local/lib/php | .:/usr/local/lib/php open_basedir | no value | no value ========================== email ------------------ Directive | Local Value | Master Value sendmail_from | no value | no value sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i SMTP | relay-hosting.secureserver.net | relay-hosting.secureserver.net smtp_port | 25 | 25 ========================== Size and Time ------------------ Directive | Local Value | Master Value max_execution_time | 30 | 30 max_input_time | 60 | 60 upload_max_filesize | 2M | 2M post_max_size | 8M | 8M ========================== Page generated in 1.02 seconds - 10 queries in 0.019 seconds - Album set : ; Meta set: ;
|
|
|
|
|
Logged
|
|
|
|
|