• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision28f5f8a30588b807f2dda23da0e6c8c1c7386242 (tree)
Time2006-10-03 21:19:35
Authorsatona <satona@1ca2...>
Commitersatona

Log Message

(none)

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@407 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/class.php
@@ -0,0 +1,293 @@
1+<?php
2+
3+/*
4+ Class for Plugin Admin Area
5+ Taka http://vivian.stripper.jp/ 2004-04-13
6+
7+ Copied / Arranged => nucleus/libs/ADMIN.php, TEMPLATE.php
8+ And a few was added...
9+*/
10+
11+ // class PULUG_ADMIN
12+ // class PLUG_TEMPLATE_MANAGER
13+
14+class PLUG_ADMIN {
15+
16+ function action($action) {
17+ $methodName = 'action_' . $action;
18+ if (method_exists($this, $methodName)) {
19+ call_user_func(array(&$this, $methodName));
20+ } else {
21+ $this->error(_BADACTION . " ($action)");
22+ }
23+ }
24+
25+ function disallow() {
26+ global $HTTP_SERVER_VARS;
27+
28+ ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . $HTTP_SERVER_VARS['REQUEST_URI']);
29+
30+ $this->error(_ERROR_DISALLOWED);
31+ }
32+
33+ function error($msg) {
34+ global $oPluginAdmin;
35+
36+ $oPluginAdmin->start();
37+ $dir=$oPluginAdmin->plugin->getAdminURL();
38+ ?>
39+ <h2>Error!</h2>
40+ <?php echo $msg;
41+ echo "<br />";
42+ echo "<a href='".$dir."index.php' onclick='history.back()'>"._BACK."</a>";
43+
44+ $oPluginAdmin->end();
45+ exit;
46+ }
47+
48+ function requestEx($name) {
49+ if(phpversion()<"4.1.0") {
50+ global $HTTP_POST_VARS, $HTTP_GET_VARS;
51+ $data = $HTTP_POST_VARS[$name] ? $HTTP_POST_VARS[$name] : $HTTP_GET_VARS[$name];
52+ } else {
53+ $data = $_REQUEST[$name];
54+ }
55+ if (is_array($data) && get_magic_quotes_gpc()) {
56+ return array_map("stripslashes",$data);
57+ } else {
58+ return get_magic_quotes_gpc() ? stripslashes($data) : $data;
59+ }
60+ }
61+
62+ function help($name) {
63+ echo $this->helpHtml($name);
64+ }
65+
66+ function helpHtml($name) {
67+ return $this->helplink($name) . '<img src="documentation/icon-help.gif" width="15" height="15" alt="'._HELP_TT.'" /></a>';
68+ }
69+
70+ function helplink($name) {
71+ global $oPluginAdmin;
72+
73+ $dir=$oPluginAdmin->plugin->getAdminURL();
74+ return '<a href="'.$dir.'help.html#'. $name . '" onclick="if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);">';
75+ }
76+
77+ function showRadioButton($name, $radio_array, $checked, $tabindex=0) {
78+ /*
79+ $name : The name of the radiobutton element.
80+ $radio_array :An associative array of option element data.
81+ [Format] $radio_array = array('radiobutton value' => 'radiobutton title')
82+ $checked : The value of the checked element.
83+ */
84+ foreach ($radio_array as $k => $v) {
85+ echo '<input type="radio" name="'.$name.'" id="'.$name.$k.'" value="'.$k.'"';
86+ if ($k == $checked) echo ' checked="checked"';
87+ echo ' tabindex="'.$tabindex.'" />';
88+ echo '<label for="'.$name.$k.'">'.$v.'</label>';
89+ }
90+ }
91+
92+ function showBlogCheckbox($name, $checked_array=array(), $tabindex=0) {
93+ /*
94+ $name : The name of the input(checkbox) element.
95+ !!! Checked blogID data is returned as array. !!!
96+ $checked_array : Array containing blogID which should be checked beforehand.
97+ */
98+
99+ $query = 'SELECT bnumber, bname FROM '.sql_table('blog').' ORDER BY bnumber';
100+ $res = sql_query($query);
101+
102+ while ($data = mysql_fetch_assoc($res)) {
103+ $data['bname'] = htmlspecialchars(shorten($data['bname'],16,'..'));
104+
105+ echo '<span style="white-space:nowrap"><input type="checkbox" name="'.$name.'[]" value="'.$data['bnumber'].'"';
106+
107+ if(in_array($data['bnumber'],$checked_array)) {
108+ echo ' checked="checked"';
109+ }
110+ echo ' tabindex="'.$tabindex.'" id="blog_checkbox'.$data['bnumber'].'" />';
111+ echo '<label for="blog_checkbox'.$data['bnumber'].'">';
112+ echo $data['bnumber'].":".$data['bname'].'</label></span>';
113+ }
114+ }
115+
116+ function showCategoryCheckbox($name, $blogid, $checked_array=array(), $tabindex=0) {
117+ /*
118+ $name : The name of the input(checkbox) element.
119+ !!! Checked catID data is returned as array. !!!
120+ $blogid : blogID to which a category belongs
121+ $checked_array : Array containing catID which should be checked beforehand.
122+ */
123+
124+ $query = 'SELECT catid, cname FROM '.sql_table('category').'WHERE cblog='.$blogid.' ORDER BY catid';
125+ $res = sql_query($query);
126+
127+ while ($data = mysql_fetch_assoc($res)) {
128+ $data['cname'] = htmlspecialchars(shorten($data['cname'],16,'..'));
129+
130+ echo '<span style="white-space:nowrap"><input type="checkbox" name="'.$name.'[]" value="'.$data['catid'].'"';
131+
132+ if(in_array($data['catid'],$checked_array)) {
133+ echo ' checked="checked"';
134+ }
135+ echo ' tabindex="'.$tabindex.'" id="category_checkbox'.$data['catid'].'" />';
136+ echo '<label for="category_checkbox'.$data['catid'].'">';
137+ echo $data['catid'].":".$data['cname'].'</label></span>';
138+ }
139+ }
140+
141+ function showSelectMenu($name, $option_array, $selected, $tabindex=0) {
142+ /*
143+ $name : The name of the select element.
144+ $option_array :An associative array of option element data.
145+ [Format] $option_array = array('option value' => 'option title')
146+ $selected : The value of the selected option element.
147+ */
148+
149+ echo '<select name="'.$name.'" tabindex="'.$tabindex.'">';
150+ foreach ($option_array as $k => $v) {
151+ echo '<option value="'.$k.'"';
152+ if ($k == $selected) echo ' selected="selected"';
153+ echo '>'.$v.'</option>';
154+ }
155+ echo '</select>';
156+ }
157+
158+ function showRankSelectMenu($name, $selected=20, $maxvalue=50, $tabindex=0) {
159+ echo '<select name="'.$name.'" tabindex="'.$tabindex.'">';
160+ for ($i=1; $i<=$maxvalue; $i++) {
161+ echo '<option value="'.$i.'"';
162+ if ($i == $selected) echo ' selected="selected"';
163+ echo '>'.$i.'</option>';
164+ }
165+ echo '</select>';
166+ }
167+
168+ function showAllCategorySelectMenu($name, $selected = '', $tabindex = 0) {
169+
170+ echo '<select name="',$name,'" tabindex="',$tabindex,'">';
171+ if (!$selected) {
172+ echo '<option value="" selected="selected"> --- </option>';
173+ }
174+
175+ // 1. select blogs (we'll create optiongroups)
176+ $queryBlogs = 'SELECT bnumber, bname FROM '.sql_table('blog').' ORDER BY bnumber';
177+ $blogs = sql_query($queryBlogs);
178+ if (mysql_num_rows($blogs) > 1) {
179+ $multipleBlogs = 1;
180+ }
181+
182+ while ($oBlog = mysql_fetch_object($blogs)) {
183+ if ($multipleBlogs) {
184+ echo '<optgroup label="',htmlspecialchars($oBlog->bname),'">';
185+ }
186+
187+ // 2. for each category in that blog
188+ $categories = sql_query('SELECT cname, catid FROM '.sql_table('category').' WHERE cblog=' . $oBlog->bnumber . ' ORDER BY cname ASC');
189+ while ($oCat = mysql_fetch_object($categories)) {
190+ if ($oCat->catid == $selected)
191+ $selectText = ' selected="selected" ';
192+ else
193+ $selectText = '';
194+ echo '<option value="',$oCat->catid,'" ', $selectText,'>',htmlspecialchars($oCat->cname),'</option>';
195+ }
196+
197+ if ($multipleBlogs) {
198+ echo '</optgroup>';
199+ }
200+
201+ }
202+ echo '</select>';
203+
204+ }
205+
206+ function templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
207+ /*
208+ $template : An associative array of current template.
209+ [Format] $template = array( 'template part name' => 'template part value')
210+ $description : Description of current template part.
211+ $name : The name of the current template part.
212+ */
213+ ?>
214+ </tr><tr>
215+ <td><?php echo $description ?> <?php if ($help) $this->help($help); ?></td>
216+ <td><textarea name="<?php echo $name?>" tabindex="<?php echo $tabindex?>" cols="50" rows="<?php echo $big ? '10' : '5'; ?>"><?php echo htmlspecialchars($template[$name]); ?></textarea></td>
217+ <?php
218+ }
219+
220+}
221+
222+
223+class PLUG_TEMPLATE_MANAGER {
224+
225+ function PLUG_TEMPLATE_MANAGER($table,$primarykey,$namecolumn) {
226+ $this->table = $table;
227+ $this->idkey = $primarykey;
228+ $this->namekey = $namecolumn;
229+ // !!! $this->idkey must be set as "auto_increment." !!!
230+ }
231+
232+ function getIdFromName($name) {
233+ return quickQuery('SELECT '.$this->idkey.' as result FROM '.$this->table.' WHERE '.$this->namekey.'="'.addslashes($name).'"');
234+ }
235+
236+ function getNameFromID($id) {
237+ return quickQuery('SELECT '.$this->namekey.' as result FROM '.$this->table.' WHERE '.$this->idkey.'='.intval($id));
238+ }
239+
240+ function getDataFromID($dataname,$id) {
241+ return quickQuery('SELECT '.$dataname.' as result FROM '.$this->table.' WHERE '.$this->idkey.'='.intval($id));
242+ }
243+
244+ function exists($name) {
245+ $res = sql_query('SELECT * FROM '.$this->table.' WHERE '.$this->namekey.'="'.addslashes($name).'"');
246+ return (mysql_num_rows($res) != 0);
247+ }
248+
249+ function existsID($id) {
250+ $res = sql_query('select * FROM '.$this->table.' WHERE '.$this->idkey.'='.intval($id));
251+ return (mysql_num_rows($res) != 0);
252+ }
253+
254+ function getNameList($w='') {
255+ $where = '';
256+ if ($w != '') $where = ' WHERE '.$w;
257+ $res = sql_query('SELECT '.$this->idkey.' as id, '.$this->namekey.' as name FROM '.$this->table. $where .' ORDER BY '.$this->namekey);
258+ while ($obj = mysql_fetch_object($res)) {
259+ $templates[intval($obj->id)] = $obj->name;
260+ }
261+ return $templates;
262+ }
263+
264+ function read($name) {
265+ $query = 'SELECT * FROM '.$this->table.' WHERE '.$this->namekey.'="'.addslashes($name).'"';
266+ $res = sql_query($query);
267+ return mysql_fetch_assoc($res);
268+ }
269+
270+ function createTemplate($name) {
271+ sql_query('INSERT INTO '.$this->table.' SET '.$this->namekey.'="'. addslashes($name) .'"');
272+ $newid = mysql_insert_id();
273+ return $newid;
274+ }
275+
276+ function updateTemplate($id, $template) {
277+ $query = 'UPDATE '.$this->table.' SET ';
278+ foreach ($template as $k => $v) {
279+ $query .= $k.'="'.addslashes($v).'",';
280+ }
281+ $query = substr($query,0,-1);
282+ $query .= ' WHERE '.$this->idkey.'='.$id;
283+ sql_query($query);
284+ }
285+
286+ function deleteTemplate($id) {
287+ sql_query('DELETE FROM '.$this->table.' WHERE '.$this->idkey.'=' . $id);
288+ }
289+
290+}
291+
292+
293+?>
\ No newline at end of file
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/bdelete.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/bedit.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/down.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/empty.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/folder.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/folder_open.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/folderopen.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/join.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/joinbottom.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/line.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/minus.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/minusbottom.gif differ
Binary files /dev/null and b/trunk/NP_MultipleCategories/multiplecategories/images/up.gif differ
--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/index.php
@@ -0,0 +1,882 @@
1+<?php
2+/**
3+ * NP_MultipleCategories Admin Page Script
4+ * Taka ( http://reverb.jp/vivian/) 2004-12-01
5+ * + nakahara21 ( http://nakahara21.com/) 2005-07-20
6+ * + sato(na) ( http://wa.otesei.com/) 2006-05-01
7+ */
8+
9+ // if your 'plugin' directory is not in the default location,
10+ // edit this variable to point to your site directory
11+ // (where config.php is)
12+ $strRel = '../../../';
13+
14+ include($strRel . 'config.php');
15+ if (!$member->isLoggedIn())
16+ doError('You\'re not logged in.');
17+
18+ include($DIR_LIBS . 'PLUGINADMIN.php');
19+
20+ // create the admin area page
21+ $oPluginAdmin = new PluginAdmin('MultipleCategories');
22+
23+// ------------------------------------------------------------------
24+
25+class NpMCategories_ADMIN {
26+
27+ function NpMCategories_ADMIN() {
28+ global $oPluginAdmin;
29+
30+ $this->plug =& $oPluginAdmin->plugin;
31+ $this->plugname = $this->plug->getName();
32+ $this->url = $this->plug->getAdminURL();
33+ $this->table = sql_table('plug_multiple_categories_sub');
34+
35+//modify start+++++++++
36+ $this->version = $this->plug->checkMSCVersion();
37+
38+ // include language file for this plugin
39+ $language = ereg_replace( '[\\|/]', '', getLanguageName());
40+ if (file_exists($this->plug->getDirectory().'language/'.$language.'.php'))
41+ include_once($this->plug->getDirectory().'language/'.$language.'.php');
42+ else
43+ include_once($this->plug->getDirectory().'language/'.'english.php');
44+//modify end+++++++++
45+
46+ }
47+
48+//-------------------
49+
50+ function action_overview($msg='') {
51+ global $member, $oPluginAdmin;
52+
53+ $member->isAdmin() or $this->disallow();
54+
55+ $oPluginAdmin->start();
56+
57+ echo '<p><a href="index.php?action=pluginlist">('._PLUGS_BACK.')</a></p>';
58+ echo '<h2>' .$this->plugname. '</h2>'."\n";
59+ if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
60+ echo '<p>[<a href="index.php?action=pluginoptions&amp;plugid='.$this->plug->getID().'">'._MC_EDIT_PLUGIN_OPTIONS.'</a>]</p>';
61+
62+//modify start+++++++++
63+ if($this->version == 2){
64+ echo '<blockquote style="color: red;border:1px solid red;padding:0.5em;"><b>Upgarde Information:</b><br />';
65+ echo _MC_SCAT_TABLE_UPDATE_INFO;
66+?>
67+ <form method="post" action="<?php echo $this->url ?>index.php"><div>
68+ <input type="hidden" name="action" value="tableUpgrade" />
69+ <input type="submit" tabindex="10" value="upgrade table" />
70+ </div></form>
71+<?php
72+ echo '</blockquote>';
73+ }
74+
75+ $res = sql_query('SELECT bnumber, bname FROM '.sql_table('blog'));
76+ while ($o = mysql_fetch_object($res)) {
77+?>
78+<?php
79+ echo '<h3 style="padding-left: 0px">' . htmlspecialchars($o->bname) . '</h3>';
80+?>
81+<table>
82+ <thead>
83+ <tr><th><?php echo _LISTS_NAME ?></th><th><?php echo _LISTS_DESC ?></th><th><?php echo _MC_SUB_CATEGORIES ?></th><th><?php echo _LISTS_ACTIONS ?></th></tr>
84+ </thead>
85+ <tbody>
86+<?php
87+ $cats = $this->plug->_getCategories($o->bnumber);
88+ foreach ($cats as $cat) {
89+ $snum = quickQuery("SELECT count(*) as result FROM ".$this->table." WHERE catid=".$cat['catid']);
90+ $snum = intval($snum);
91+?>
92+ <tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>
93+ <td>
94+ <?php echo htmlspecialchars($cat['name']) ?></td>
95+ <td><?php echo htmlspecialchars($cat['cdesc']) ?></td>
96+ <td><?php echo $snum ?></td>
97+ <td><a href="<?php echo $this->url ?>index.php?action=scatoverview&amp;catid=<?php echo $cat['catid'] ?>" tabindex="50"><?php echo _MC_EDIT_SUB_CATEGORIES ?></a></td>
98+ </tr>
99+<?php
100+ }
101+?>
102+ </tbody>
103+</table>
104+<?php
105+ }
106+
107+ $oPluginAdmin->end();
108+
109+ }
110+
111+//-----
112+
113+ function action_scatoverview($msg = '') {
114+ global $member, $oPluginAdmin;
115+
116+ $member->isAdmin() or $this->disallow();
117+
118+ $catid = intRequestVar('catid');
119+ $catname = $this->plug->_getCatNameFromID($catid);
120+
121+ $oPluginAdmin->start();
122+
123+?>
124+<p><a href="<?php echo $this->url ?>index.php?action=overview">(Go Back)</a></p>
125+
126+<h2><?php
127+ echo _MC_EDIT_SUB_CATEGORIES_OF." '".htmlspecialchars($catname)."'</h2>\n";
128+
129+ if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
130+
131+ $defines = $this->plug->_getDefinedScats($catid);
132+ if (count($defines) > 0) {
133+
134+//modify start+++++++++
135+ if($this->version > 2){
136+ echo $this->listupSubcategories($catid, $subcatid);
137+ echo $this->showOrderMenu($catid, $subcatid);
138+ }else{
139+//modify end+++++++++
140+
141+?>
142+
143+ <table>
144+ <thead>
145+ <tr><th><?php echo _LISTS_NAME ?></th><th><?php echo _LISTS_DESC ?></th><th colspan='2'><?php echo _LISTS_ACTIONS ?></th></tr>
146+ </thead>
147+ <tbody>
148+<?php
149+ foreach ($defines as $scat) {
150+?>
151+ <tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>
152+ <td><?php echo htmlspecialchars($scat['sname']) ?></td>
153+ <td><?php echo htmlspecialchars($scat['sdesc']) ?></td>
154+ <td><a href="<?php echo $this->url ?>index.php?action=scatedit&amp;catid=<?php echo $catid ?>&amp;scatid=<?php echo $scat['scatid'] ?>" tabindex="50"><?php echo _LISTS_EDIT ?></a></td>
155+ <td><a href="<?php echo $this->url ?>index.php?action=scatdelete&amp;catid=<?php echo $catid ?>&amp;scatid=<?php echo $scat['scatid'] ?>" tabindex="50"><?php echo _LISTS_DELETE ?></a></td>
156+ </tr>
157+<?php
158+ }
159+?>
160+ </tbody>
161+ </table>
162+<?php
163+//modify start+++++++++
164+ }
165+//modify end+++++++++
166+ } //end of if(count($defines) > 0)
167+
168+ echo "\n\n".'<h3>'._MC_CREATE_NEW_SUB_CATEGORY.'</h3>'."\n\n";
169+
170+?>
171+ <form method="post" action="<?php echo $this->url ?>index.php"><div>
172+
173+ <input name="action" value="scatnew" type="hidden" />
174+ <input name="catid" value="<?php echo $catid ?>" type="hidden" />
175+ <table><tr>
176+ <td><?php echo _MC_SCAT_NAME ?></td>
177+ <td><input name="sname" tabindex="10010" maxlength="20" size="20" /></td>
178+ </tr><tr>
179+ <td><?php echo _MC_SCAT_DESC ?></td>
180+ <td><input name="sdesc" tabindex="10020" size="60" maxlength="200" /></td>
181+ </tr><tr>
182+<?php
183+ if($this->version > 2){
184+?>
185+ <td><?php echo _MC_SCAT_PARENT_NAME ?></td>
186+ <td>
187+<?php
188+ $subcategoryList = $this->getCategoryList($catid);
189+ echo $this->printCategoryList($catid, $subcategoryList, 1, 0);
190+?>
191+ </td>
192+ </tr><tr>
193+<?php
194+ }
195+?>
196+ <td><?php echo _MC_SCAT_CREATE ?></td>
197+ <td><input type="submit" tabindex="10030" value="<?php echo _MC_SCAT_CREATE ?>" onclick="return checkSubmit();" /></td>
198+ </tr></table>
199+
200+ </div></form>
201+<?php
202+
203+ $oPluginAdmin->end();
204+
205+ }
206+
207+ function action_scatedit($msg = '') {//-----
208+ global $member, $oPluginAdmin;
209+
210+ $member->isAdmin() or $this->disallow();
211+
212+ $scatid = intRequestVar('scatid');
213+ $catid = intRequestVar('catid');
214+
215+ $res = sql_query("SELECT * FROM ".$this->table." WHERE scatid=$scatid and catid=$catid");
216+ if ($o = mysql_fetch_object($res)) {
217+
218+ $oPluginAdmin->start();
219+
220+?>
221+<p><a href="<?php echo $this->url ?>index.php?action=scatoverview&amp;catid=<?php echo $catid ?>">(Go Back to OVERVIEW)</a></p>
222+
223+<h2><?php
224+ echo _MC_SCAT_EDIT;
225+ echo " '".htmlspecialchars($o->sname)."'</h2>\n";
226+
227+ if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
228+
229+?>
230+<script language=javascript src=<?php echo $this->url ?>orderlist.js></script>
231+<form method="post" action="<?php echo $this->url ?>index.php?action=scatedit&catid=<?php echo $catid; ?>&scatid=<?php echo $scatid; ?>">
232+ <input type="hidden" name="action" value="scatupdate" />
233+ <input type="hidden" name="scatid" value="<?php echo $scatid; ?>" />
234+ <input type="hidden" name="catid" value="<?php echo $catid; ?>" />
235+
236+ <div>
237+
238+ <table><tr>
239+ <td><?php echo _MC_SCAT_NAME ?></td>
240+ <td><input name="sname" tabindex="10010" maxlength="20" size="20" value="<?php echo htmlspecialchars($o->sname) ?>" /></td>
241+ </tr><tr>
242+ <td><?php echo _MC_SCAT_DESC ?></td>
243+ <td><input name="sdesc" tabindex="10020" size="60" maxlength="200" value="<?php echo htmlspecialchars($o->sdesc) ?>" /></td>
244+ </tr><tr>
245+<?php
246+ if($this->version > 2){
247+?>
248+ <td><?php echo _MC_SCAT_PARENT_NAME . '<br />' . _MC_SCAT_PARENT_NAME_DESC ?></td><!-- <sato(na)0.402j /> -->
249+ <td>
250+<?php
251+ $pid = quickQuery('SELECT parentid as result FROM '.$this->table.' WHERE scatid='.$scatid);
252+ //<sato(na)0.402j>
253+ //$subcategoryList = $this->getCategoryList($catid, $pid);
254+ //echo $this->printCategoryList($catid, $subcategoryList, 1);
255+ echo $this->printCategoryListUD($catid, $pid);
256+ //</sato(na)0.402j>
257+?>
258+ </td>
259+ </tr><tr>
260+<?php
261+ }
262+?>
263+ <td><?php echo _MC_SCAT_UPDATE ?></td>
264+ <td><input type="submit" tabindex="10030" value="<?php echo _MC_SCAT_UPDATE ?>" onclick="return checkSubmit();" /></td>
265+ </tr></table>
266+
267+ </div>
268+</form>
269+<?php
270+ if($this->version > 2) echo $this->showOrderMenu($catid, $scatid);
271+
272+ $oPluginAdmin->end();
273+
274+ } else $this->error(_MC_SCAT_MISSING);
275+ }//-----
276+
277+ function action_scatnew() {
278+ global $member;
279+
280+ $member->isAdmin() or $this->disallow();
281+
282+ $sname = postVar('sname');
283+ if (!trim($sname)){
284+ $this->action_scatoverview(_MC_SCAT_ERROR_NAME);
285+ } else{
286+ $newid = $this->createSubcat($sname);
287+
288+ $array = array(
289+ 'catid'=>postVar('catid'),
290+ 'sdesc'=>postVar('sdesc')
291+ );
292+ if($this->version > 2)
293+ $array['parentid'] = postVar('parentid');
294+
295+ $this->updateSubcat($newid,$array);
296+
297+ $this->action_scatoverview();
298+ }
299+ }
300+
301+ function action_scatupdate() {
302+ global $member;
303+
304+ $scatid = intRequestVar('scatid');
305+
306+ $member->isAdmin() or $this->disallow();
307+
308+ $sname = postVar('sname');
309+ if (!trim($sname)) {
310+ $this->action_scatoverview("Error! Input a name.");
311+ } else {
312+
313+ $this->addToScat($scatid);
314+
315+ $this->action_scatedit(_MC_SCAT_DATA_UPDATE);
316+ }
317+
318+ }
319+
320+//modify start+++++++++
321+ function action_tableUpgrade() {
322+ if($this->version == 2){
323+ $q = "ALTER TABLE `".$this->table."` ADD `parentid` INT( 11 ) DEFAULT '0' NOT NULL AFTER `scatid` , ADD `ordid` INT( 11 ) DEFAULT '100' NOT NULL AFTER `parentid` ;";
324+ }elseif($this->version == 3){
325+ $q = "ALTER TABLE `".$this->table."` ADD `ordid` INT( 11 ) DEFAULT '100' NOT NULL AFTER `parentid` ;";
326+ }
327+ if($q) sql_query($q);
328+
329+ $this->version = 4;
330+
331+ $this->action_overview('<blockquote style="color: red;border:1px solid red;padding:0.5em;"><b>'._MC_SCAT_TABLE_UPDATE.'</b></blockquote>');
332+ }
333+
334+ function action_scatOrder() {
335+ global $member;
336+
337+ $scatid = intRequestVar('scatid');
338+
339+ $member->isAdmin() or $this->disallow();
340+
341+ $order = array();
342+ $order = explode(",", requestVar('orderList'));
343+
344+ $x=1;
345+ foreach($order as $o){
346+ $o = trim(rtrim($o));
347+ $query = 'UPDATE '.$this->table.' SET ordid='.$x.' WHERE scatid='.$o;
348+ sql_query($query);
349+ $x++;
350+ }
351+
352+ if(requestVar('redirect') == 'scatoverview'){
353+ $this->action_scatoverview(_MC_SCAT_ORDER_UPDATE);
354+ }else{
355+ $this->action_scatedit(_MC_SCAT_ORDER_UPDATE);
356+ }
357+
358+ }
359+//modify end+++++++++
360+
361+ function action_scatdelete() {
362+ global $member, $oPluginAdmin;
363+
364+ $member->isAdmin() or $this->disallow();
365+
366+ $scatid = intRequestVar('scatid');
367+ $catid = intRequestVar('catid');
368+//modify start+++++++++
369+ if($this->version > 2){
370+ $sname = $this->plug->_getScatNameFromID($scatid);
371+ $sdesc = $this->plug->_getScatDescFromID($scatid);
372+ if($sdesc) $sdesc = ' ('.$sdesc.')';
373+
374+
375+ $modChildren = $this->_getDefinedScatsFromScat($scatid);
376+ $pid = quickQuery('SELECT parentid as result FROM '.$this->table.' WHERE scatid='.$scatid);
377+ $pname = ($pid)?
378+ $this->plug->_getScatNameFromID($pid).' ('._MC_SUB_CATEGORIES.')':
379+ quickQuery('SELECT cname as result FROM '.sql_table('category').' WHERE catid='.intval($catid)).' (' . _EBLOG_CAT_TITLE . ')';
380+ }
381+//modify end+++++++++
382+
383+ $oPluginAdmin->start();
384+ ?>
385+ <h2><?php echo _DELETE_CONFIRM?></h2>
386+
387+ <p><?php echo _MC_CONFIRMTXT_SCAT ?><b><?php echo $sname.$sdesc ?></b></p>
388+
389+ <?php
390+ if($modChildren){
391+ $modList = $pid.'-';
392+ echo '<blockquote style="color: red;border:1px solid red;padding:1em;"><b>Note:</b><br />';
393+ echo _MC_SCAT_DELETE_NOTE_LIST;
394+ echo '<ul>';
395+ for($i=0;$i<count($modChildren);$i++){
396+ echo '<li>'.$modChildren[$i]['sname']."</li>\n";
397+ $modList .= $modChildren[$i]['scatid'].'/';
398+ }
399+ echo '</ul>';
400+ echo _MC_SCAT_DELETE_NOTE_PARENT.'<ul><li>'.$pname.'</li></ul>';
401+ echo '</blockquote>';
402+ $extraInput = '<input type="hidden" name="modlist" value="'.substr($modList, 0, -1).'" />'."\n";
403+ }
404+ ?>
405+
406+
407+ <form method="post" action="<?php echo $this->url ?>index.php"><div>
408+ <input type="hidden" name="action" value="scatdeleteconfirm" />
409+ <input type="hidden" name="scatid" value="<?php echo $scatid ?>" />
410+ <input type="hidden" name="catid" value="<?php echo $catid ?>" />
411+ <?php echo $extraInput ?>
412+ <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
413+ </div></form>
414+ <?php
415+
416+ $oPluginAdmin->end();
417+ }
418+
419+ function action_scatdeleteconfirm() {
420+ global $member, $manager;
421+
422+ $scatid = intRequestVar('scatid');
423+ $catid = intRequestVar('catid');
424+
425+ $member->isAdmin() or $this->disallow();
426+
427+//modify start+++++++++
428+ $modList = requestVar('modlist');
429+ if($modList){
430+ list($parent, $children) = explode("-", $modList);
431+ $children = explode("/", $children);
432+ for($i=0;$i<count($children);$i++){
433+ $c = trim(rtrim($children[$i]));
434+ $query = 'UPDATE '.$this->table.' SET parentid='.intval($parent).' WHERE scatid='.$c;
435+ sql_query($query);
436+ }
437+ }
438+//modify end+++++++++
439+
440+ $this->deleteSubcat($scatid);
441+
442+ $this->action_scatoverview("Sub category has been deleted.");
443+ }
444+
445+ function addToScat($nowid) {
446+ if($this->version >= 3)
447+ $datanames = array('catid','sname','sdesc','parentid');
448+ else
449+ $datanames = array('catid','sname','sdesc');
450+ foreach ($datanames as $val) {
451+ $scat[$val] = postVar($val);
452+ }
453+ $this->updateSubcat($nowid,$scat);
454+ }
455+
456+ function createSubcat($name) {
457+ sql_query('INSERT INTO '.$this->table.' SET sname="'. addslashes($name) .'"');
458+ $newid = mysql_insert_id();
459+ return $newid;
460+ }
461+
462+ //<sato(na)0.402j>
463+ //printCategoryList for update
464+ function printCategoryListUD($catid, $parentid) {
465+ $catName = quickQuery('SELECT cname as result FROM '.sql_table('category').' WHERE catid='.intval($catid));
466+ $text .= "<select size='10' name='parentid'>\n";
467+ $text .= "<option value='0'>&nbsp;$catName&nbsp;</option>\n";
468+ foreach ($this->plug->_setSubOrder() as $val) {
469+ $query = 'SELECT * FROM '.$this->table.' WHERE scatid=' . intval($val);
470+ $res = sql_query($query);
471+ $row = mysql_fetch_array($res);
472+ if ($row['catid'] == $catid){
473+ $levelstr = '';
474+ for ($i=0; $i<$this->getDepth($val, 0); $i++) $levelstr .= "&hellip;&hellip;";
475+ $selected = ($parentid == $val) ? " selected='selected'" : '';
476+ $text .= "<option value='".$val."'".$selected.">&nbsp;".$levelstr."&hellip;&nbsp;".
477+ $row['sname']." <sup>".$row['sdesc']."</sup>&nbsp;</option>\n";
478+ }
479+ }
480+ $text .= "</select>\n";
481+ return $text;
482+ }
483+ function getDepth($scatid, $level) {
484+ $parentid = quickQuery('SELECT parentid as result FROM '.$this->table.' WHERE scatid='.$scatid);
485+ return ($parentid == 0) ? $level : $this->getDepth($parentid, $level + 1);
486+ }
487+ function descendantCheck($parentid, $checkid){
488+ $res = sql_query("SELECT scatid FROM ".$this->table." WHERE parentid=".$parentid);
489+ while ($o = mysql_fetch_object($res)) {
490+ if ($o->scatid == $checkid) {
491+ return TRUE;
492+ } else {
493+ if ($this->descendantCheck($o->scatid, $checkid)) return TRUE;
494+ }
495+ }
496+ return FALSE;
497+ }
498+ //</sato(na)0.402j>
499+
500+ function updateSubcat($id, $scat) {
501+
502+ //<sato(na)0.402j>
503+ $old_parentid = quickQuery('SELECT parentid as result FROM '.$this->table.' WHERE scatid='.$id);
504+ if ($id == $scat['parentid']) $branch = 'Self'; else $branch = ($this->descendantCheck($id, $scat['parentid']) ? 'Descendant' : 'Other');
505+
506+ switch ($branch){
507+ case 'Self':
508+ //cancel
509+ $scat['parentid'] = $old_parentid;
510+ //echo '----------------------------------------Self';
511+ break;
512+ case 'Descendant':
513+ //Succession
514+ //echo '----------------------------------------Descendant';
515+ $query = 'UPDATE '.$this->table.' SET parentid='.$old_parentid.' WHERE parentid='.$id;
516+ sql_query($query);
517+ break;
518+ case 'Other':
519+ //Nothing is done.
520+ //echo '----------------------------------------Other';
521+ }
522+ //</sato(na)0.402j>
523+
524+ $query = 'UPDATE '.$this->table.' SET ';
525+ foreach ($scat as $k => $v) {
526+ $query .= $k.'="'.addslashes($v).'",';
527+ }
528+ $query = substr($query,0,-1);
529+ $query .= ' WHERE scatid='.$id;
530+ sql_query($query);
531+ }
532+
533+ function deleteSubcat($id) {
534+ sql_query('DELETE FROM '.$this->table.' WHERE scatid=' . $id);
535+
536+ $res = sql_query("SELECT categories, subcategories, item_id FROM ". sql_table("plug_multiple_categories") ." WHERE subcategories REGEXP '(^|,)$id(,|$)'");
537+ $dell = array();
538+ $up = array();
539+
540+ while ($o = mysql_fetch_object($res)) {
541+ $o->subcategories = preg_replace("/^(?:(.*),)?$catid(?:,(.*))?$/","$1,$2",$o->subcategories);
542+ if (!$o->categories && (!$o->subcategories || $o->subcategories == ',')) {
543+ $del[] = $o->item_id;
544+ } else {
545+ $o->subcategories = preg_replace("/(^,+|(?<=,),+|,+$)/","",$o->subcategories);
546+ $up[] = "UPDATE ". sql_table("plug_multiple_categories") ." SET categories='".addslashes($o->categories)."', subcategories='".addslashes($o->subcategories)."' WHERE item_id=".$o->item_id;
547+ }
548+ }
549+
550+ if (count($del) > 0) {
551+ sql_query("DELETE FROM ". sql_table("plug_multiple_categories") . " WHERE item_id in (".implode(",",$del).")");
552+ }
553+ if (count($up) > 0) {
554+ foreach ($up as $v) {
555+ sql_query($v);
556+ }
557+ }
558+ }
559+
560+
561+ function action($action) {
562+ $methodName = 'action_' . $action;
563+ if (method_exists($this, $methodName)) {
564+ call_user_func(array(&$this, $methodName));
565+ } else {
566+ $this->error(_BADACTION . " ($action)");
567+ }
568+ }
569+
570+ function disallow() {
571+ global $HTTP_SERVER_VARS;
572+
573+ ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . $HTTP_SERVER_VARS['REQUEST_URI']);
574+
575+ $this->error(_ERROR_DISALLOWED);
576+ }
577+
578+ function error($msg) {
579+ global $oPluginAdmin;
580+
581+ $oPluginAdmin->start();
582+ $dir=$oPluginAdmin->plugin->getAdminURL();
583+ ?>
584+ <h2>Error!</h2>
585+ <?php echo $msg;
586+ echo "<br />";
587+ echo "<a href='".$dir."index.php' onclick='history.back()'>"._BACK."</a>";
588+
589+ $oPluginAdmin->end();
590+ exit;
591+ }
592+
593+//modify start+++++++++
594+ /* START OF UNLIMITED DEPTH SUBCATEGORY HELPER FUNCTIONS */
595+
596+ function listupSubcategories($catid, $subcatid){
597+ $cat .= "<table style='width:auto;'><tr><td>\n";
598+ $cat .= "<table border='0' cellpadding='0' cellspacing='0' style='width:auto;'>\n";
599+
600+ $subcategoryList = $this->getCategoryList($catid);
601+// print_r($subcategoryList);
602+ $subcategories = $this->printCategoryList($catid, $subcategoryList, 2, 0);
603+ if ($subcategories == "") {
604+ $cat .= "No subcategories currently exist in this category.\n";
605+ } else {
606+ $cat .= $subcategories;
607+ }
608+ $cat .= "</table></td></tr></table>\n";
609+ $cat .= "<br />\n";
610+ return $cat;
611+
612+ }
613+
614+ function showOrderMenu($catid, $subcatid=0){//<sato(na)0.402j />
615+ $text = "<h3>"._MC_MODIFY_CHILDREN_ORDER."</h3>\n";
616+ if ($sorder = $this->subcatOrd($catid, $subcatid)){
617+ $text .= "<table style='width:auto;'>\n";
618+ $text .= "<script language=javascript src={$this->url}orderlist.js></script>\n";
619+ $text .= "<form method='post' name='ordform' onsubmit=\"submitCatOrder();\">\n";
620+ $text .= "<input type='hidden' name='action' value='scatOrder'>\n";
621+ $text .= "<input type='hidden' name='redirect' value='".getVar('action')."'>\n";
622+ $text .= "<input type=hidden name=orderList value=''>\n";
623+ //<sato(na)0.402j>
624+ global $CONF;
625+ $actionUrl = $CONF['ActionURL'].'?action=plugin&amp;name=MultipleCategories&amp;catid='.$catid.'&amp;subcatid='.$subcatid;
626+ echo '<script language="javascript" src="'.$actionUrl.'"></script>';
627+ $text .= '
628+<tr><td class="main" style="border:0px;padding:0px;">
629+<table style="width:auto; margin:0; padding:0;">
630+ <tr><td style="border:0px;padding:0px;" colspan="6">'._MC_SHOW_ORDER_MENU_KEY.'</td>
631+ <tr><td style="border:0px;padding:0px;">
632+ <table>
633+ <tr>
634+ <td style="border:0px; padding:0px 3px;">ID</td>
635+ <td style="border:0px; padding:0px 3px;">
636+ <img src=plugins/multiplecategories/images/up.gif alt="Move Up" onClick="orderKey(\'id\', \'ASC\')"><br />
637+ <img src=plugins/multiplecategories/images/down.gif alt="Move Down" onClick="orderKey(\'id\', \'DESC\')">
638+ </td>
639+ <td style="border:0px; padding:0px 3px;">[ '._MC_SHOW_ORDER_MENU_SNAME.' ]</td>
640+ <td style="border:0px; padding:0px 3px;">
641+ <img src=plugins/multiplecategories/images/up.gif alt="Move Up" onClick="orderKey(\'sname\', \'ASC\')"><br />
642+ <img src=plugins/multiplecategories/images/down.gif alt="Move Down" onClick="orderKey(\'sname\', \'DESC\')">
643+ </td>
644+ <td style="border:0px; padding:0px 3px;">'._MC_SHOW_ORDER_MENU_SDESC.'</td>
645+ <td style="border:0px; padding:0px 3px;">
646+ <img src=plugins/multiplecategories/images/up.gif alt="Move Up" onClick="orderKey(\'sdesc\', \'ASC\')"><br />
647+ <img src=plugins/multiplecategories/images/down.gif alt="Move Down" onClick="orderKey(\'sdesc\', \'DESC\')">
648+ </td>
649+ </tr>
650+ </table>
651+ </td></tr>
652+</table>
653+</td></tr>';
654+ //</sato(na)0.402j>
655+ $text .= $sorder;
656+ $text .= "<tr><td class='main' style='border:0px;padding:0px;'><input type='submit' value='"._MC_SUBMIT_CHILDREN_ORDER."'></td></form></tr>\n";
657+ $text .= "</table>\n";
658+ } else {
659+ $text .= _MC_NO_CHILDREN_ORDER;
660+ }
661+ return $text;
662+ }
663+ function getCategoryList($catid, $selected = 0) {//$selected : parentid
664+ /** Returns a list of the gallery categories **/
665+ $queryString = "SELECT * FROM ".$this->table;
666+ $queryString .= " WHERE catid=".$catid;
667+ $queryString .= ($this->version >= 4)? " ORDER BY parentid ASC, ordid ASC, scatid ASC" : " ORDER BY scatid ASC";
668+ $resultSet = sql_query($queryString);
669+
670+ $categoryArray = array();
671+ $flatList = array();
672+ if (!mysql_num_rows($resultSet)) return $categoryArray;
673+
674+ while ($row = mysql_fetch_array($resultSet)) {
675+ $isSelected = ($row["scatid"] == $selected)?1:0;
676+ $flatList[] = array(
677+ "id" => $row["scatid"],
678+ "title" => $row["sname"],
679+ "description" => $row["sdesc"],
680+ "children" => array(),
681+ "parent" => $row["parentid"],
682+ "selected" => $isSelected
683+ );
684+ }
685+
686+ while (count($flatList)) {
687+ // Check the first one in the list
688+ $temp = array_shift($flatList);
689+ // Is it a top level category?
690+ if ($temp["parent"] == 0 || $temp["id"] == $selected) {
691+ // No parent, so just push it to the end of the big array
692+ $categoryArray[] = $temp;
693+ } else {
694+ // Has a parent, so search for parent, and push it to the end of the parent's child array
695+ if (!$this->appendChildCategory($categoryArray, $temp)) {
696+ // Failed, so push category back onto the end of the array
697+ $flatList[] = $temp;
698+ }
699+ }
700+ }
701+ return $categoryArray;
702+ }
703+
704+ function appendChildCategory(&$categoryArray, $child) {
705+ if (empty($categoryArray)) return false;
706+
707+ for($i=0; $i<count($categoryArray); $i++) {
708+ $category =& $categoryArray[$i];
709+ if ($category["id"] == $child["parent"]) {
710+ // Found it, push to category's child list
711+ $category["children"][] = $child;
712+ return true;
713+ } else {
714+ if ($this->appendChildCategory($category["children"], $child)) {
715+ return true;
716+ }
717+ }
718+ }
719+ return false;
720+ }
721+
722+ function printCategoryList($catid, $categoryList, $type=1, $selectedCategory=0, $def='') {
723+ $text = "";
724+ $catName = quickQuery('SELECT cname as result FROM '.sql_table('category').' WHERE catid='.intval($catid));
725+ if ($type == 1) {
726+ // Select box
727+ $text .= "<select size='10' name='parentid'>\n";
728+ if ($def != 1){
729+ $selected = ($selectedCategory == 0) ? " selected='selected'" : '';
730+ $text .= "<option value='0'$selected>&nbsp;$catName&nbsp;</option>\n";
731+ }
732+ $text .= $this->walkCategoryList($categoryList, $catid, $type, $selectedCategory);
733+ $text .= "</select>\n";
734+ } elseif ($type == 2) {
735+ // Table: with action cell
736+ $text .= "<tr><td class='mainbold' style='border:0px;padding:0px;'><img src='./plugins/multiplecategories/images/folderopen.gif' alt='' /> $catName </td><td class='mainbold' style='border:0px;padding:0px;'>"._LISTS_ACTIONS."</td></tr>\n";
737+ $text .= $this->walkCategoryList($categoryList, $catid, $type, $selectedCategory);
738+ } elseif ($type == 3) {
739+ //
740+ $selected = ($selectedCategory == 0) ? " selected='selected'" : '';
741+ $text .= "<option value='0'$selected> $catName </option>\n";
742+ $text .= $this->walkCategoryList($categoryList, $catid, $type, $selectedCategory);
743+ }
744+ return $text;
745+ }
746+
747+ function walkCategoryList(&$categoryList, $catid, $type = 1, $selectedCategory = 0, $level = 0, $childrenLevel = array()) {
748+ $text = "";
749+ if ($type == 1) {
750+ // Select box
751+ foreach ($categoryList as $category) {
752+ if ($category["selected"] == 1) {
753+ $text .= "<option value='{$category['id']}' selected='selected'>&nbsp;\n";
754+ } else {
755+ $text .= "<option value='{$category['id']}'>&nbsp;\n";
756+ }
757+ for ($i=0;$i<$level;$i++) {
758+ $text .= "&hellip;&hellip;";
759+ }
760+ $text .= "&hellip;&nbsp;".$category["title"]." <sup>".$category["description"]."</sup>&nbsp;</option>\n";
761+ $text .= $this->walkCategoryList($category["children"], $catid, $type, $selectedCategory, $level+1);
762+ }
763+ } elseif ($type == 2) {
764+ // Table
765+ for ($j=0; $j < count($categoryList); $j++) {
766+ $category = $categoryList[$j];
767+ $hasSiblings = (($j < (count($categoryList)-1))?1:0); // are there more categories on the same level as this category?
768+ $childrenLevel[$level] = $hasSiblings;
769+ $children = $this->walkCategoryList($category["children"], $catid, $type, $selectedCategory, $level+1, $childrenLevel);
770+
771+ if ($selectedCategory == $category["id"]) {
772+ $text .= "<tr bgcolor=\"#B5C1DC\">\n";
773+ } else {
774+ $text .= "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);' style='border:0px;padding:0px;'>\n";
775+ }
776+ $text .= "<td class='hover' style='border:0px;padding:0px;'>\n";
777+ if ($level == 0) {
778+ if ($hasSiblings) {
779+ $text .= "<img src='./plugins/multiplecategories/images/minusbottom.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
780+ } else {
781+ $text .= "<img src='./plugins/multiplecategories/images/minus.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
782+ }
783+ } else {
784+ for ($i=0;$i<$level;$i++) {
785+ if ($childrenLevel[$i]) {
786+ $text .= "<img src='./plugins/multiplecategories/images/line.gif' alt='' /> \n";
787+ } else {
788+ $text .= "<img src='./plugins/multiplecategories/images/empty.gif' alt='' />";
789+ }
790+ }
791+ if ($hasSiblings) {
792+ if ($children != "") {
793+ $text .= "<img src='./plugins/multiplecategories/images/minusbottom.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
794+ } else {
795+ $text .= "<img src='./plugins/multiplecategories/images/joinbottom.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
796+ }
797+ } else {
798+ if ($children != "") {
799+ $text .= "<img src='./plugins/multiplecategories/images/minus.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
800+ } else {
801+ $text .= "<img src='./plugins/multiplecategories/images/join.gif' alt='' /><img src='./plugins/multiplecategories/images/folder.gif' alt='' /> \n";
802+ }
803+ }
804+ }
805+ if ($row[group] != 0){ $group = "(Private)"; }
806+ else { $group = ''; }
807+ if ($selectedCategory == $category["id"]) {
808+ $text .= "<strong>".$category["title"]." <sup>".$category["description"]."</sup>"."</strong> $group</td>\n";
809+ } else {
810+ $text .= $category["title"]." <sup>".$category["description"]."</sup>"." $group</td>\n";
811+ }
812+ $subcatid = $category["id"];
813+ if ($type == 2) {
814+ // ALL ACTIONS //
815+ $text .= "<td class='hover' align='center' style='border:0px;padding:0px 0px 0px 15px;'><a href={$this->url}index.php?action=scatedit&catid=$catid&amp;scatid=$subcatid><img src=plugins/multiplecategories/images/bedit.gif alt='"._LISTS_EDIT."' border=0></a> \n<a href={$this->url}index.php?action=scatdelete&catid=$catid&amp;scatid=$subcatid><img src=plugins/multiplecategories/images/bdelete.gif alt='"._LISTS_DELETE."' border=0></a></td>\n";
816+ }
817+ $text .= "</tr>\n";
818+ $text .= $children;
819+ }
820+ } elseif ($type == 3) {
821+ // Select box
822+ foreach ($categoryList as $category) {
823+ if ($category["id"] == $selectedCategory) {
824+ $text .= "<option value='{$category['id']}' selected='selected'>\n";
825+ } else {
826+ $text .= "<option value='{$category['id']}'>\n";
827+ }
828+ for ($i=0;$i<$level;$i++) {
829+ $text .= "&nbsp;&nbsp;";
830+ }
831+ $text .= $category["title"]."</option>\n";
832+ $text .= $this->walkCategoryList($category["children"], $catid, $type, $selectedCategory, $level+1);
833+ }
834+ }
835+ return $text;
836+ }
837+
838+
839+ function subcatOrd($catid, $subcatid=0){
840+ $q = "select scatid, sname, sdesc from ".$this->table." where parentid = '$subcatid' and catid=$catid";//<sato(na)0.402j />
841+ $q .= ($this->version >= 4) ? ' order by ordid, scatid ASC': ' order by scatid ASC';
842+ $result = sql_query($q);
843+ if(mysql_num_rows($result) < 2){
844+ return FALSE;
845+ }
846+ $text .= "<tr><td class=main style='border:0px;padding:0px;'><select name=order multiple size=15>";
847+ //<sato(na)0.402j>
848+ while($row = mysql_fetch_array($result)){
849+ $text .= "<option value=".$row['scatid'].">".$row['scatid']."&nbsp;[&nbsp;".$row['sname']."&nbsp;]&nbsp;".$row['sdesc']."</option>";
850+ }
851+ $text .= "</select>"._MC_SHOW_ORDER_MENU_INDIVIDUAL."&nbsp;";
852+ //</sato(na)0.402j>
853+ $text .= "<img src=plugins/multiplecategories/images/up.gif alt='Move Up' onClick=\"moveOptionUp(document.ordform.order)\">&nbsp;";
854+ $text .= "<img src=plugins/multiplecategories/images/down.gif alt='Move Down' onClick=\"moveOptionDown(document.ordform.order)\"></td></tr>";
855+ return $text;
856+ }
857+
858+ function _getDefinedScatsFromScat($id){
859+ $aResult = array();
860+ $query = 'SELECT * FROM '.sql_table('plug_multiple_categories_sub').' WHERE parentid=' . intval($id);
861+ $res = sql_query($query);
862+ while ($a = mysql_fetch_assoc($res)){
863+ array_push($aResult,$a);
864+ }
865+ return $aResult;
866+ }
867+//modify end+++++++++
868+
869+
870+} // NpMCategories_ADMIN end
871+
872+// ------------------------------------------------------------------
873+
874+$myAdmin = new NpMCategories_ADMIN();
875+if (requestVar('action')) {
876+ $myAdmin->action(requestVar('action'));
877+} else {
878+ $myAdmin->action('overview');
879+}
880+
881+?>
882+
--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/language/english.php
@@ -0,0 +1,33 @@
1+<?php
2+define('_MC_EDIT_PLUGIN_OPTIONS', 'Edit Plugin Options');
3+define('_MC_SUB_CATEGORIES', 'Sub Categories');
4+define('_MC_EDIT_SUB_CATEGORIES', 'Edit sub categories');
5+define('_MC_EDIT_SUB_CATEGORIES_OF', 'Edit sub categories of');
6+define('_MC_CREATE_NEW_SUB_CATEGORY', 'Create New Sub Category');
7+define('_MC_SCAT_NAME', 'Name');
8+define('_MC_SCAT_DESC', 'Description');
9+define('_MC_SCAT_CREATE', 'Create Sub Category');
10+define('_MC_SCAT_UPDATE', 'UPDATE Sub Category');
11+define('_MC_SCAT_EDIT', 'Edit');
12+define('_MC_SCAT_DATA_UPDATE', 'Sub category data has been saved.');
13+define('_MC_SCAT_MISSING', 'Sub category is missing...');
14+define('_MC_SCAT_ERROR_NAME', 'Error! Input a name.');
15+define('_MC_CONFIRMTXT_SCAT', 'The sub category you are going to delete is: ');
16+
17+define('_MC_SCAT_PARENT_NAME', 'Parent');
18+define('_MC_SCAT_ORDER_UPDATE', 'Sub category order has been updated.');
19+define('_MC_MODIFY_CHILDREN_ORDER', 'Modify Children Order');
20+define('_MC_SUBMIT_CHILDREN_ORDER', 'Submit Children Order');
21+define('_MC_NO_CHILDREN_ORDER', '( No child categories are here )');
22+define('_MC_SCAT_DELETE_NOTE_LIST', 'This subcategory you\'re going to delete has child(ren) listed below.');
23+define('_MC_SCAT_DELETE_NOTE_PARENT', 'If delete, these subcategoris will be automatically belong to');
24+define('_MC_SCAT_TABLE_UPDATE_INFO', 'If you want to use UNLIMITED DEPTH SUBCATEGORY, table upgrade is required.');
25+define('_MC_SCAT_TABLE_UPDATE', 'upgrade successed.');
26+
27+define('_MC_SCAT_PARENT_NAME_DESC', "(When oneself is specified, it doesn't change.)");
28+define('_MC_SHOW_ORDER_MENU_KEY', 'sort key');
29+define('_MC_SHOW_ORDER_MENU_SNAME', 'sname');
30+define('_MC_SHOW_ORDER_MENU_SDESC', 'sdesc');
31+define('_MC_SHOW_ORDER_MENU_INDIVIDUAL', 'individual');
32+
33+?>
\ No newline at end of file
--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/language/japanese-euc.php
@@ -0,0 +1,33 @@
1+<?php
2+define('_MC_EDIT_PLUGIN_OPTIONS', 'このプラグインのオプション編集画面へ');
3+define('_MC_SUB_CATEGORIES', 'サブカテゴリ');
4+define('_MC_EDIT_SUB_CATEGORIES', 'サブカテゴリの編集画面へ');
5+define('_MC_EDIT_SUB_CATEGORIES_OF', 'サブカテゴリの編集 - カテゴリ名');
6+define('_MC_CREATE_NEW_SUB_CATEGORY', 'サブカテゴリの新規作成');
7+define('_MC_SCAT_NAME', 'サブカテゴリ名');
8+define('_MC_SCAT_DESC', 'サブカテゴリの説明');
9+define('_MC_SCAT_CREATE', '新しいサブカテゴリを作成');
10+define('_MC_SCAT_UPDATE', 'サブカテゴリの更新');
11+define('_MC_SCAT_EDIT', 'サブカテゴリの編集 - サブカテゴリ名 ');
12+define('_MC_SCAT_DATA_UPDATE', 'サブカテゴリのデータを更新しました。');
13+define('_MC_SCAT_MISSING', 'サブカテゴリが見つかりません。');
14+define('_MC_SCAT_ERROR_NAME', 'エラーです。サブカテゴリ名を入力してください。');
15+define('_MC_CONFIRMTXT_SCAT', '以下のサブカテゴリを削除しようとしています: ');
16+
17+define('_MC_SCAT_PARENT_NAME', '親となる(サブ)カテゴリ');
18+define('_MC_SCAT_ORDER_UPDATE', 'サブカテゴリの並び順を更新しました。');
19+define('_MC_MODIFY_CHILDREN_ORDER', '子サブカテゴリの並び順の変更');
20+define('_MC_SUBMIT_CHILDREN_ORDER', '並び順を反映');
21+define('_MC_NO_CHILDREN_ORDER', '( 子となるサブカテゴリは複数ありません )');
22+define('_MC_SCAT_DELETE_NOTE_LIST', '削除しようとするサブカテゴリには、直下に以下の子サブカテゴリが存在します');
23+define('_MC_SCAT_DELETE_NOTE_PARENT', 'もし削除を実行した場合、子カテゴリは階層が繰り上がり次の(サブ)カテゴリに自動的に属します');
24+define('_MC_SCAT_TABLE_UPDATE_INFO', 'サブカテゴリを無限階層管理したい場合は、テーブルのアップグレードが必要です');
25+define('_MC_SCAT_TABLE_UPDATE', 'サブカテゴリ管理用テーブルのアップグレードは完了しました');
26+
27+define('_MC_SCAT_PARENT_NAME_DESC', '(自分自身を指定した場合、変更しません。)');
28+define('_MC_SHOW_ORDER_MENU_KEY', '並び替え基準');
29+define('_MC_SHOW_ORDER_MENU_SNAME', '名前');
30+define('_MC_SHOW_ORDER_MENU_SDESC', '説明');
31+define('_MC_SHOW_ORDER_MENU_INDIVIDUAL', '個別指定');
32+
33+?>
\ No newline at end of file
--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/language/japanese-utf8.php
@@ -0,0 +1,33 @@
1+<?php
2+define('_MC_EDIT_PLUGIN_OPTIONS', 'このプラグインのオプション編集画面へ');
3+define('_MC_SUB_CATEGORIES', 'サブカテゴリ');
4+define('_MC_EDIT_SUB_CATEGORIES', 'サブカテゴリの編集画面へ');
5+define('_MC_EDIT_SUB_CATEGORIES_OF', 'サブカテゴリの編集 - カテゴリ名');
6+define('_MC_CREATE_NEW_SUB_CATEGORY', 'サブカテゴリの新規作成');
7+define('_MC_SCAT_NAME', 'サブカテゴリ名');
8+define('_MC_SCAT_DESC', 'サブカテゴリの説明');
9+define('_MC_SCAT_CREATE', '新しいサブカテゴリを作成');
10+define('_MC_SCAT_UPDATE', 'サブカテゴリの更新');
11+define('_MC_SCAT_EDIT', 'サブカテゴリの編集 - サブカテゴリ名 ');
12+define('_MC_SCAT_DATA_UPDATE', 'サブカテゴリのデータを更新しました。');
13+define('_MC_SCAT_MISSING', 'サブカテゴリが見つかりません。');
14+define('_MC_SCAT_ERROR_NAME', 'エラーです。サブカテゴリ名を入力してください。');
15+define('_MC_CONFIRMTXT_SCAT', '以下のサブカテゴリを削除しようとしています: ');
16+
17+define('_MC_SCAT_PARENT_NAME', '親となる(サブ)カテゴリ');
18+define('_MC_SCAT_ORDER_UPDATE', 'サブカテゴリの並び順を更新しました。');
19+define('_MC_MODIFY_CHILDREN_ORDER', '子サブカテゴリの並び順の変更');
20+define('_MC_SUBMIT_CHILDREN_ORDER', '並び順を反映');
21+define('_MC_NO_CHILDREN_ORDER', '( 子となるサブカテゴリは複数ありません )');
22+define('_MC_SCAT_DELETE_NOTE_LIST', '削除しようとするサブカテゴリには、直下に以下の子サブカテゴリが存在します');
23+define('_MC_SCAT_DELETE_NOTE_PARENT', 'もし削除を実行した場合、子カテゴリは階層が繰り上がり次の(サブ)カテゴリに自動的に属します');
24+define('_MC_SCAT_TABLE_UPDATE_INFO', 'サブカテゴリを無限階層管理したい場合は、テーブルのアップグレードが必要です');
25+define('_MC_SCAT_TABLE_UPDATE', 'サブカテゴリ管理用テーブルのアップグレードは完了しました');
26+
27+define('_MC_SCAT_PARENT_NAME_DESC', '(自分自身を指定した場合、変更しません。)');
28+define('_MC_SHOW_ORDER_MENU_KEY', '並び替え基準');
29+define('_MC_SHOW_ORDER_MENU_SNAME', '名前');
30+define('_MC_SHOW_ORDER_MENU_SDESC', '説明');
31+define('_MC_SHOW_ORDER_MENU_INDIVIDUAL', '個別指定');
32+
33+?>
\ No newline at end of file
--- /dev/null
+++ b/trunk/NP_MultipleCategories/multiplecategories/orderlist.js
@@ -0,0 +1,116 @@
1+function getSelectedValues (select) {
2+ var r = new Array();
3+ for (var i = 0; i < select.options.length; i++)
4+ if (select.options[i].selected)
5+ r[r.length] = select.options[i].value;
6+ return r;
7+}
8+
9+
10+function submitCatOrder(){
11+ selectAllOptions(document.ordform.order);
12+ document.ordform.orderList.value = getSelectedValues(document.ordform.order);
13+ document.ordform.order.value = '';
14+
15+}
16+
17+
18+function selectAllOptions(obj) {
19+ for (var i=0; i<obj.options.length; i++) {
20+ obj.options[i].selected = true;
21+ }
22+ }
23+
24+function swapOptions(obj,i,j) {
25+ var o = obj.options;
26+ var i_selected = o[i].selected;
27+ var j_selected = o[j].selected;
28+ var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
29+ var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
30+ o[i] = temp2;
31+ o[j] = temp;
32+ o[i].selected = j_selected;
33+ o[j].selected = i_selected;
34+ }
35+
36+function moveOptionUp(obj) {
37+ // If > 1 option selected, do nothing
38+ var selectedCount=0;
39+ for (i=0; i<obj.options.length; i++) {
40+ if (obj.options[i].selected) {
41+ selectedCount++;
42+ }
43+ }
44+ if (selectedCount > 1) {
45+ return;
46+ }
47+ // If this is the first item in the list, do nothing
48+ var i = obj.selectedIndex;
49+ if (i == 0) {
50+ return;
51+ }
52+ swapOptions(obj,i,i-1);
53+ obj.options[i-1].selected = true;
54+ }
55+
56+function moveOptionDown(obj) {
57+ // If > 1 option selected, do nothing
58+ var selectedCount=0;
59+ for (i=0; i<obj.options.length; i++) {
60+ if (obj.options[i].selected) {
61+ selectedCount++;
62+ }
63+ }
64+ if (selectedCount > 1) {
65+ return;
66+ }
67+ // If this is the last item in the list, do nothing
68+ var i = obj.selectedIndex;
69+ if (i == (obj.options.length-1)) {
70+ return;
71+ }
72+ swapOptions(obj,i,i+1);
73+ obj.options[i+1].selected = true;
74+ }
75+
76+//<sato(na)0.402j>
77+function setScatDat(id, sname, sdesc) {
78+ this.id = id;
79+ this.sname = sname;
80+ this.sdesc = sdesc;
81+}
82+function scatListRefresh(scatDat){
83+ //del
84+ optionsLength = document.ordform.order.options.length;
85+ for (i=0; i<=optionsLength; i++) document.ordform.order.options[0] = null;
86+ //add
87+ for(var i = 0; i < scatDat.length; i++) {
88+ label = scatDat[i].id + " [ " + scatDat[i].sname + " ] " + scatDat[i].sdesc;
89+ document.ordform.order.options[i] = new Option(label, scatDat[i].id);
90+ }
91+}
92+function sortidASC(a, b) {
93+ if (b.id == a.id) return 0;
94+ return a.id - b.id;
95+}
96+function sortidDESC(a, b) {
97+ if (b.id == a.id) return 0;
98+ return b.id - a.id;
99+}
100+function sortsnameASC(a, b) {
101+ if (b.sname == a.sname) return 0;
102+ return (a.sname > b.sname) ? 1 : -1;
103+}
104+function sortsnameDESC(a, b) {
105+ if (b.sname == a.sname) return 0;
106+ return (b.sname > a.sname) ? 1 : -1;
107+}
108+function sortsdescASC(a, b) {
109+ if (b.sdesc == a.sdesc) return 0;
110+ return (a.sdesc > b.sdesc) ? 1 : -1;
111+}
112+function sortsdescDESC(a, b) {
113+ if (b.sdesc == a.sdesc) return 0;
114+ return (b.sdesc > a.sdesc) ? 1 : -1;
115+}
116+//</sato(na)0.402j>
\ No newline at end of file
Show on old repository browser