OSDN Git Service

Add inline stylesheet for better resizing by browser, refering to http://japan.nucleu...
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / showlist.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2010 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * Functions to create lists of things inside the admin are
14  *
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-2010 The Nucleus Group
17  * @version $Id$
18  * @version $NucleusJP: showlist.php,v 1.7.2.3 2007/12/03 00:01:48 kmorimatsu Exp $
19  */
20
21
22 // can take either an array of objects, or an SQL query
23 function showlist($query, $type, $template) {
24
25         if (is_array($query)) {
26                 if (sizeof($query) == 0)
27                         return 0;
28
29                 call_user_func('listplug_' . $type, $template, 'HEAD');
30
31                 foreach ($query as $currentObj) {
32                         $template['current'] = $currentObj;
33                         call_user_func('listplug_' . $type, $template, 'BODY');
34                 }
35
36                 call_user_func('listplug_' . $type, $template, 'FOOT');
37
38                 return sizeof($query);
39
40         } else {
41                 $res = sql_query($query);
42
43                 // don't do anything if there are no results
44                 $numrows = sql_num_rows($res);
45                 if ($numrows == 0)
46                         return 0;
47
48                 call_user_func('listplug_' . $type, $template, 'HEAD');
49
50                 while($template['current'] = sql_fetch_object($res))
51                         call_user_func('listplug_' . $type, $template, 'BODY');
52
53                 call_user_func('listplug_' . $type, $template, 'FOOT');
54
55                 sql_free_result($res);
56
57                 // return amount of results
58                 return $numrows;
59         }
60 }
61
62 function listplug_select($template, $type) {
63         switch($type) {
64                 case 'HEAD':
65                         echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';
66
67                         // add extra row if needed
68                         if (ifset($template['extra'])) {
69                                 echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';
70                         }
71
72                         break;
73                 case 'BODY':
74                         $current = $template['current'];
75
76                         echo '<option value="' . htmlspecialchars($current->value) . '"';
77                         if ($template['selected'] == $current->value)
78                                 echo ' selected="selected" ';
79                         if (isset($template['shorten']) && $template['shorten'] > 0) {
80                                 echo ' title="'. htmlspecialchars($current->text).'"';
81                                 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
82                         }
83                         echo '>' . htmlspecialchars($current->text) . '</option>';
84                         break;
85                 case 'FOOT':
86                         echo '</select>';
87                         break;
88         }
89 }
90
91 function listplug_table($template, $type) {
92         switch($type) {
93                 case 'HEAD':
94                         echo "<table>";
95                         echo "<thead><tr>";
96                         // print head
97                         call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
98                         echo "</tr></thead><tbody>";
99                         break;
100                 case 'BODY':
101                         // print tabletype specific thingies
102                         echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
103                         call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');
104                         echo "</tr>";
105                         break;
106                 case 'FOOT':
107                         call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');
108                         echo "</tbody></table>";
109                         break;
110         }
111 }
112
113 function listplug_table_memberlist($template, $type) {
114         switch($type) {
115                 case 'HEAD':
116                         echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
117                         help('superadmin');
118                         echo "</th><th>" . _LIST_MEMBER_LOGIN;
119                         help('canlogin');
120                         echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
121                         break;
122                 case 'BODY':
123                         $current = $template['current'];
124
125                         echo '<td>';
126                         $id = listplug_nextBatchId();
127                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
128                         echo '<label for="batch',$id,'">';
129                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
130                         echo '</label>';
131                         echo '</td>';
132                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
133                         echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";
134                         echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
135                         echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
136                         echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
137                         echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
138                         break;
139         }
140 }
141
142 function listplug_table_teamlist($template, $type) {
143         global $manager;
144         switch($type) {
145                 case 'HEAD':
146                         echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
147                         help('teamadmin');
148                         echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
149                         break;
150                 case 'BODY':
151                         $current = $template['current'];
152
153                         echo '<td>';
154                         $id = listplug_nextBatchId();
155                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
156                         echo '<label for="batch',$id,'">';
157                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
158                         echo '</label>';
159                         echo '</td>';
160                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
161                         echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
162                         echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
163
164                         $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
165                         $url = $manager->addTicketToUrl($url);
166                         echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
167                         break;
168         }
169 }
170
171 function listplug_table_pluginlist($template, $type) {
172         global $manager;
173         switch($type) {
174                 case 'HEAD':
175                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
176                         echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
177                         break;
178                 case 'BODY':
179                         $current = $template['current'];
180
181                         $plug =& $manager->getPlugin($current->pfile);
182                         if ($plug) {
183                                 echo '<td>';
184                                         echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
185                                         echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
186                                         echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
187                                         if ($plug->getURL())
188                                         echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
189                                 echo '</td>';
190                                 echo '<td>';
191                                         echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
192                                         if (sizeof($plug->getEventList()) > 0) {
193                                                 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
194                                                 // check the database to see if it is up-to-date and notice the user if not
195                                         }
196                                         if (!$plug->subscribtionListIsUptodate()) {
197                                                 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
198                                         }
199                                         if (sizeof($plug->getPluginDep()) > 0) {
200                                                 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
201                                         }
202 // <add by shizuki>
203                                 // check dependency require
204                                 $req = array();
205                                 $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
206                                 while($o = sql_fetch_object($res)) {
207                                         $preq =& $manager->getPlugin($o->pfile);
208                                         if ($preq) {
209                                                 $depList = $preq->getPluginDep();
210                                                 foreach ($depList as $depName) {
211                                                         if ($current->pfile == $depName) {
212                                                                 $req[] = $o->pfile;
213                                                         }
214                                                 }
215                                         }
216                                 }
217                                 if (count($req) > 0) {
218                                         echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";
219                                         echo '<p class="plugin_dependreq_text">';
220                                         echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);
221                                         echo "</p>\n";
222                                 }
223 // </add by shizuki>
224                                 echo '</td>';
225                         } else {
226                                 echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';
227                         }
228                         echo '<td style="white-space:nowrap">';
229
230                                 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
231                                 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
232                                 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
233                                 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
234                                 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
235                                 echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
236                                 if ($plug && ($plug->hasAdminArea() > 0))
237                                         echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
238                                 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
239                                         echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
240                                 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
241                                         echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
242                         echo '</td>';
243                         break;
244         }
245 }
246
247 function listplug_table_plugoptionlist($template, $type) {
248         global $manager;
249         switch($type) {
250                 case 'HEAD':
251                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
252                         break;
253                 case 'BODY':
254                         $current = $template['current'];
255                         listplug_plugOptionRow($current);
256                         break;
257                 case 'FOOT':
258                         ?>
259                         <tr>
260                                 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
261                         </tr><tr>
262                                 <td><?php echo _PLUGS_SAVE?></td>
263                                 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
264                         </tr>
265                         <?php                   break;
266         }
267 }
268
269 function listplug_plugOptionRow($current) {
270         $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
271         // retreive the optionmeta
272         $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
273
274         // only if it is not a hidden option write the controls to the page
275         if ($meta['access'] != 'hidden') {
276                 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
277                 echo '<td>';
278                 switch($current['type']) {
279                         case 'yesno':
280                                 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
281                                 break;
282                         case 'password':
283                                 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
284                                 break;
285                         case 'select':
286                                 echo '<select name="'.htmlspecialchars($varname).'">';
287                                 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
288                                 $aOptions = explode('|', $aOptions);
289                                 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
290                                         echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
291                                         if ($aOptions[$i+1] == $current['value'])
292                                                 echo ' selected="selected"';
293                                         echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
294                                 }
295                                 echo '</select>';
296                                 break;
297                         case 'textarea':
298                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
299                                 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
300                                 if ($meta['access'] == 'readonly') {
301                                         echo ' readonly="readonly"';
302                                 }
303                                 echo '>',htmlspecialchars($current['value']),'</textarea>';
304                                 break;
305                         case 'text':
306                         default:
307                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
308
309                                 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
310                                 if ($meta['datatype'] == 'numerical') {
311                                         echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
312                                 }
313                                 if ($meta['access'] == 'readonly') {
314                                         echo ' readonly="readonly"';
315                                 }
316                                 echo ' />';
317                 }
318                 echo $current['extra'];
319                 echo '</td>';
320         }
321 }
322
323 function listplug_table_itemlist($template, $type) {
324         $cssclass = null;
325
326         switch($type) {
327                 case 'HEAD':
328                         echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
329                         break;
330                 case 'BODY':
331                         $current = $template['current'];
332                         $current->itime = strtotime($current->itime);   // string -> unix timestamp
333
334                         if ($current->idraft == 1)
335                                 $cssclass = "class='draft'";
336
337                         // (can't use offset time since offsets might vary between blogs)
338                         if ($current->itime > $template['now'])
339                                 $cssclass = "class='future'";
340                         
341                         $action = requestVar('action');
342                         
343                         echo '<td ' . $cssclass . ' style="white-space:nowrap;">';
344                         if ($action !== 'itemlist')
345                         echo _LIST_ITEM_BLOG . ' ', htmlspecialchars($current->bshortname) . '    <br />';
346                         echo _LIST_ITEM_CAT,' ', htmlspecialchars($current->cname) . '    <br />';
347                         if ($action !== 'browseownitems')
348                         echo _LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname) . '    <br />';
349                         echo date("Y-m-d",$current->itime) , " " . date("H:i",$current->itime);
350                         echo "</td>";
351                         echo "<td $cssclass>";
352
353                         $id = listplug_nextBatchId();
354
355                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
356                         echo '<label for="batch',$id,'">';
357                         echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
358                         echo '</label>';
359                         echo "<br />";
360
361
362                         $current->ibody = strip_tags($current->ibody);
363                         $current->ibody = htmlspecialchars(shorten($current->ibody,200,'...'));
364
365                         $COMMENTS = new COMMENTS($current->inumber);
366                         echo "$current->ibody</td>";
367                         echo "<td  style=\"white-space:nowrap\" $cssclass>";
368                         echo "<a href='index.php?action=itemedit&amp;itemid={$current->inumber}'>" . _LISTS_EDIT . "</a>";
369                         echo " / <a href='index.php?action=itemmove&amp;itemid={$current->inumber}'>" . _LISTS_MOVE . "</a>";
370                         echo " / <a href='index.php?action=itemdelete&amp;itemid={$current->inumber}'>" . _LISTS_DELETE . "</a><br />";
371                         // evaluate amount of comments for the item
372                         $camount = $COMMENTS->amountComments();
373                         if ($camount>0) {
374                                 echo "<a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>";
375                                 echo "( " . sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())." )</a>";
376                         }
377                         else {
378                                 echo _LIST_ITEM_NOCONTENT;
379                         }
380                         echo "</td>";
381                         break;
382         }
383 }
384
385 // for batch operations: generates the index numbers for checkboxes
386 function listplug_nextBatchId() {
387         static $id = 0;
388         return $id++;
389 }
390
391 function listplug_table_commentlist($template, $type) {
392         switch($type) {
393                 case 'HEAD':
394                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
395                         break;
396                 case 'BODY':
397                         $current = $template['current'];
398                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp
399
400                         echo '<td>';
401                         echo date("Y-m-d@H:i",$current->ctime);
402                         echo '<br />';
403                         if ($current->mname)
404                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
405                         else
406                                 echo htmlspecialchars($current->cuser);
407                         if ($current->cmail != '') {
408                                 echo '<br />';
409                                 echo htmlspecialchars($current->cmail);
410                         }
411                         if ($current->cemail != '') {
412                                 echo '<br />';
413                                 echo htmlspecialchars($current->cemail);
414                         }
415                         echo '</td>';
416
417                         $current->cbody = strip_tags($current->cbody);
418                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
419
420                         echo '<td>';
421                         $id = listplug_nextBatchId();
422                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
423                         echo '<label for="batch',$id,'">';
424                         echo $current->cbody;
425                         echo '</label>';
426                         echo '</td>';
427
428                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
429                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
430                         if ($template['canAddBan'])
431                                 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&amp;itemid=$current->citem&amp;ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";
432                         break;
433         }
434 }
435
436
437 function listplug_table_bloglist($template, $type) {
438         switch($type) {
439                 case 'HEAD':
440                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
441                         break;
442                 case 'BODY':
443                         $current = $template['current'];
444
445                         echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";
446                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
447                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
448                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
449                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
450
451                         if ($current->tadmin == 1) {
452                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
453                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
454                         }
455
456                         if ($template['superadmin']) {
457                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
458                         }
459
460
461
462                         break;
463         }
464 }
465
466 function listplug_table_shortblognames($template, $type) {
467         switch($type) {
468                 case 'HEAD':
469                         echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";
470                         break;
471                 case 'BODY':
472                         $current = $template['current'];
473
474                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
475                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';
476
477                         break;
478         }
479 }
480
481 function listplug_table_shortnames($template, $type) {
482         switch($type) {
483                 case 'HEAD':
484                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
485                         break;
486                 case 'BODY':
487                         $current = $template['current'];
488
489                         echo '<td>' , htmlspecialchars($current->name) , '</td>';
490                         echo '<td>' , htmlspecialchars($current->description) , '</td>';
491
492                         break;
493         }
494 }
495
496
497 function listplug_table_categorylist($template, $type) {
498         switch($type) {
499                 case 'HEAD':
500                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
501                         break;
502                 case 'BODY':
503                         $current = $template['current'];
504
505                         echo '<td>';
506                         $id = listplug_nextBatchId();
507                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
508                         echo '<label for="batch',$id,'">';
509                         echo htmlspecialchars($current->cname);
510                         echo '</label>';
511                         echo '</td>';
512
513                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';
514                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
515                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
516
517                         break;
518         }
519 }
520
521
522 function listplug_table_templatelist($template, $type) {
523         global $manager;
524         switch($type) {
525                 case 'HEAD':
526                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
527                         break;
528                 case 'BODY':
529                         $current = $template['current'];
530
531                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";
532                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
533                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
534
535                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
536                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
537                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
538
539                         break;
540         }
541 }
542
543 function listplug_table_skinlist($template, $type) {
544         global $CONF, $DIR_SKINS, $manager;
545         switch($type) {
546                 case 'HEAD':
547                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
548                         break;
549                 case 'BODY':
550                         $current = $template['current'];
551
552                         echo '<td>';
553
554                         // use a special style for the default skin
555                         if ($current->sdnumber == $CONF['BaseSkin']) {
556                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
557                         } else {
558                                 echo htmlspecialchars($current->sdname);
559                         }
560
561                         echo '<br /><br />';
562                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
563                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
564                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
565
566                         // add preview image when present
567                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
568                         {
569                                 echo '<br /><br />';
570
571                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
572                                 if ($hasEnlargement)
573                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
574
575                                 $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
576                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
577
578                                 if ($hasEnlargement)
579                                         echo '</a>';
580
581                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
582                                 {
583                                         $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
584                                         $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
585                                         echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
586                                 }
587
588
589                         }
590
591                         echo "</td>";
592
593
594                         echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
595                                 // show list of defined parts
596                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
597                                 $types = array();
598                                 while ($o = sql_fetch_object($r))
599                                         array_push($types,$o->stype);
600                                 if (sizeof($types) > 0) {
601                                         $friendlyNames = SKIN::getFriendlyNames();
602                                         for ($i=0;$i<sizeof($types);$i++) {
603                                                 $type = $types[$i];
604                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
605                                                         $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
606                                                 } else {
607                                                         $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
608                                                 }
609                                         }
610                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
611                                 }
612                         echo "</td>";
613                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
614
615                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
616                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
617                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
618
619                         break;
620         }
621 }
622
623 function listplug_table_draftlist($template, $type) {
624         switch($type) {
625                 case 'HEAD':
626                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
627                         break;
628                 case 'BODY':
629                         $current = $template['current'];
630
631                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
632                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
633                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
634                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
635
636                         break;
637         }
638 }
639
640
641 function listplug_table_actionlist($template, $type) {
642         switch($type) {
643                 case 'HEAD':
644                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
645                         break;
646                 case 'BODY':
647                         $current = $template['current'];
648
649                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
650                         echo '<td>' , htmlspecialchars($current->message), '</td>';
651
652                         break;
653         }
654 }
655
656 function listplug_table_banlist($template, $type) {
657         switch($type) {
658                 case 'HEAD':
659                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
660                         break;
661                 case 'BODY':
662                         $current = $template['current'];
663
664                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
665                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';
666                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
667                         break;
668         }
669 }
670
671 ?>