OSDN Git Service

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