3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2009 The Nucleus Group
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)
13 * Functions to create lists of things inside the admin are
15 * @license http://nucleuscms.org/license.txt GNU General Public License
16 * @copyright Copyright (C) 2002-2009 The Nucleus Group
17 * @version $Id: showlist.php 1886 2012-06-17 08:27:27Z sakamocchi $
21 // can take either an array of objects, or an SQL query
22 function showlist($query, $type, $vars, $template_name = '')
27 if ( is_string($query) )
29 $resource = DB::getResult($query);
37 $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);
40 foreach ( $resource as $row )
42 $vars['current'] = $row;
43 $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);
47 $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);
49 /* close SQL resource */
50 if ( is_string($query) )
52 $resource->closeCursor();
58 function listplug_select($vars, $type, $template_name = '')
63 if ( !empty($template_name) )
65 $templates =& $manager->getTemplate($template_name);
71 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
73 $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"
74 . "<%extraoption%>\n";
78 $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
81 'name' => $vars['name'],
82 'tabindex' => $vars['tabindex'],
83 'javascript' => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],
84 'extraoption' => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"
88 $current = $vars['current'];
89 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )
91 $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";
95 $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];
98 'value' => Entity::hsc($current['value']),
99 'selected' => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',
101 if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )
103 $data['title'] = Entity::hsc($current['text']);
104 $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));
110 $data['option'] = Entity::hsc($current['text']);
113 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )
115 $template = "</select>\n";
119 $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
125 return Template::fill($template, $data);
128 function listplug_table($vars, $type, $template_name = '')
132 $templates = array();
133 if ( !empty($template_name) )
135 $templates =& $manager->getTemplate($template_name);
141 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
143 $template = "<table frame=\"box\" rules=\"all\" summary=\"{$vars['content']}\">\n"
153 $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
156 'summary' => $vars['content'],
157 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
161 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
163 $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"
169 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
171 // tabletype specific thingies
173 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
177 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
179 $template = "<%typefoot%>\n"
185 $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
187 // tabletype specific thingies
189 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
194 return Template::fill($template, $data);
197 function listplug_table_memberlist($vars, $type, $template_name = '')
201 $templates = array();
202 if ( !empty($template_name) )
204 $templates =& $manager->getTemplate($template_name);
210 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
212 $template = "<th><%colmembername%></th>\n"
213 . "<th><%colmemberrname%></th>\n"
214 . "<th><%colmemberurl%></th>\n"
215 . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
216 . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
217 . "<th colspan=\"2\"><%colactions%></th>\n";
221 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
224 'colmembername' => _LIST_MEMBER_NAME,
225 'colmemberrname' => _LIST_MEMBER_RNAME,
226 'colmemberurl' => _LIST_MEMBER_URL,
227 'colmemberadmin' => _LIST_MEMBER_ADMIN,
228 'colmemberlogin' => _LIST_MEMBER_LOGIN,
229 'colactions' => _LISTS_ACTIONS,
233 $current = $vars['current'];
234 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
237 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
238 . "<label for=\"batch<%id%>\">\n"
239 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
240 . "</label>\n</td>\n"
241 . "<td><%realname%></td>\n"
242 . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
243 . "<td><%admin%></td>\n"
244 . "<td><%login%></td>\n"
245 . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
246 . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
250 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
253 'id' => listplug_nextBatchId(),
254 'memberid' => $current['mnumber'],
255 'mailaddress' => Entity::hsc($current['memail']),
256 'tabindex' => $vars['tabindex'],
257 'name' => Entity::hsc($current['mname']),
258 'realname' => Entity::hsc($current['mrealname']),
259 'url' => Entity::hsc($current['murl']),
260 'admin' => $current['madmin'] ? _YES : _NO,
261 'login' => $current['mcanlogin'] ? _YES : _NO,
262 'editbtn' => _LISTS_EDIT,
263 'deletebtn' => _LISTS_DELETE,
267 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
273 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
278 return Template::fill($template, $data);
281 function listplug_table_teamlist($vars, $type, $template_name = '')
285 $templates = array();
286 if ( !empty($template_name) )
288 $templates =& $manager->getTemplate($template_name);
294 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
296 $template = "<th><%colmembername%></th>\n"
297 . "<th><%colmemberrname%></th>\n"
298 . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"
299 . "<th colspan=\"2\"><%colactions%></th>\n";
303 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
306 'colmembername' => _LIST_MEMBER_NAME,
307 'colmemberrname' => _LIST_MEMBER_RNAME,
308 'colteamadmin' => _LIST_TEAM_ADMIN,
309 'colactions' => _LISTS_ACTIONS,
313 $current = $vars['current'];
314 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
317 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
318 . "<label for=\"batch<%id%>\">\n"
319 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
320 . "</label>\n</td>\n"
321 . "<td><%realname%></td>\n"
322 . "<td><%admin%></td>\n"
323 . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"
324 . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";
328 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
330 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
331 $url = $manager->addTicketToUrl($url);
333 'id' => listplug_nextBatchId(),
334 'memberid' => $current['tmember'],
335 'mailaddress' => Entity::hsc($current['memail']),
336 'tabindex' => $vars['tabindex'],
337 'name' => Entity::hsc($current['mname']),
338 'realname' => Entity::hsc($current['mrealname']),
339 'admin' => ($current['tadmin'] ? _YES : _NO),
340 'blogid' => $current['tblog'],
341 'deletebtn' => '<%text(_LISTS_DELETE)%>',
342 'chadminurl' => Entity::hsc($url),
343 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'
347 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
353 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
358 return Template::fill($template, $data);
361 function listplug_table_pluginlist($vars, $type, $template_name = '')
363 static $plugins = array();
366 $templates = array();
367 if ( !empty($template_name) )
369 $templates =& $manager->getTemplate($template_name);
375 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
377 $template = "<th><%colinfo%></th>\n"
378 . "<th><%coldesc%></th>\n"
379 . "<th colspan=\"2\"><%colactions%></th>\n";
383 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
386 'colinfo' => _LISTS_INFO,
387 'coldesc' => _LISTS_DESC,
388 'colactions' => _LISTS_ACTIONS,
392 $current = $vars['current'];
394 $plug =& $manager->getPlugin($current['pfile']);
397 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
400 . "<strong><%plugname%></strong><br />\n"
401 . "<%autherlabel%> <%plugauther%><br />\n"
402 . "<%versionlabel%> <%plugversion%><br />\n"
403 . "<%pluggeturl%><br />\n"
406 . "<%desclabel%><br /><%plugdesc%>\n"
415 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
418 'plugname' => Entity::hsc($plug->getName()),
419 'autherlabel' => _LIST_PLUGS_AUTHOR,
420 'plugauther' => Entity::hsc($plug->getAuthor()),
421 'versionlabel' => _LIST_PLUGS_VER,
422 'plugversion' => Entity::hsc($plug->getVersion()),
423 'tabindex' => $vars['tabindex'],
424 'desclabel' => _LIST_PLUGS_DESC,
425 'plugdesc' => Entity::hen($plug->getDescription()),
427 if ( $plug->getURL() )
429 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
431 $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
435 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
438 'plugurl' => Entity::hsc($plug->getURL()),
439 'tabindex' => $vars['tabindex'],
440 'plugsite' => _LIST_PLUGS_SITE,
442 $data['pluggeturl'] = Template::fill($subTpl, $subData);
446 $data['pluggeturl'] = '';
448 if ( count($plug->getEventList()) > 0 )
450 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
452 $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
456 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
459 'evntlstlbl' => _LIST_PLUGS_SUBS,
460 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
462 $data['eventlist'] = Template::fill($subTpl, $subData);
466 $data['eventlist'] = '';
468 if ( !$plug->subscribtionListIsUptodate() )
470 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
472 $subTpl = "<br /><br /><strong><%updatealert%></strong>";
476 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
479 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
481 $data['needupdate'] = Template::fill($subTpl, $subData);
485 $data['needupdate'] = '';
487 if ( count($plug->getPluginDep() ) > 0)
489 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
491 $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
495 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
498 'deplistlbl' => _LIST_PLUGS_DEP,
499 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
501 $data['dependlist'] = Template::fill($subTpl, $subData);
505 $data['dependlist'] = '';
507 /* check dependency */
508 if ( empty($plugins) )
510 $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
513 foreach ( $plugins as $plugin )
515 $preq =& $manager->getPlugin($plugin['pfile']);
518 $depList = $preq->getPluginDep();
519 foreach ( $depList as $depName )
521 if ( $current['pfile'] == $depName )
523 $req[] = $plugin['pfile'];
529 if ( count($req) > 0 )
531 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
533 $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
537 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
540 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
541 'depreqlist' => Entity::hsc(implode(', ', $req)),
543 $data['depreqlist'] = Template::fill($subTpl, $subData);
547 $data['depreqlist'] = '';
552 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
554 $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
558 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
561 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
564 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
566 $template .= "<td>\n"
567 . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
568 . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
569 . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
570 . "<%plugadminurl%>\n"
571 . "<%plughelpurl%>\n"
572 . "<%plugoptsetting%>\n"
577 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
580 $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';
581 $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
582 $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
584 $data['actionuptxt'] = _LIST_PLUGS_UP;
585 $data['actionupurl'] = Entity::hsc($upUrl);
586 $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
587 $data['actiondownurl'] = Entity::hsc($downUrl);
588 $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
589 $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];
591 if ( $plug && ($plug->hasAdminArea() > 0) )
593 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
595 $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
599 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
602 'actadminurl' => Entity::hsc($plug->getAdminURL()),
603 'tabindex' => $vars['tabindex'],
604 'actadmintxt' => _LIST_PLUGS_ADMIN,
606 $data['plugadminurl'] = Template::fill($subTpl, $subData);
610 $data['plugadminurl'] = '';
612 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
614 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
616 $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
620 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
623 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],
624 'tabindex' => $vars['tabindex'],
625 'acthelptxt' => _LIST_PLUGS_HELP,
627 $data['plughelpurl'] = Template::fill($subTpl, $subData);
631 $data['plughelpurl'] = '';
633 $optQuery = 'SELECT '
634 . ' COUNT(*) AS result '
636 . sql_table('plugin_option_desc') . ' '
638 . ' ocontext = "global" '
640 $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
643 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
645 $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
649 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
652 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],
653 'tabindex' => $vars['tabindex'],
654 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
656 $data['plugoptsetting'] = Template::fill($subTpl, $subData);
660 $data['plugoptsetting'] = '';
664 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
670 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
675 return Template::fill($template, $data);
678 function listplug_table_plugoptionlist($vars, $type, $template_name = '')
682 $templates = array();
683 if ( !empty($template_name) )
685 $templates =& $manager->getTemplate($template_name);
691 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
693 $template = "<th><%colinfo%></th>\n"
694 . "<th><%colvalue%></th>\n";
698 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
701 'colinfo' => _LISTS_INFO,
702 'colvalue' => _LISTS_VALUE,
706 $current = $vars['current'];
707 $template = listplug_plugOptionRow($current, $template_name);
711 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
714 . "<th colspan=\"2\"><%savetext%></th>\n"
717 . "<td><%savetext%></td>\n"
718 . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"
723 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
726 'savetext' => _PLUGS_SAVE,
731 return Template::fill($template, $data);
734 function listplug_plugOptionRow($current, $template_name = '')
738 $templates = array();
739 if ( !empty($template_name) )
741 $templates =& $manager->getTemplate($template_name);
744 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
746 // retreive the optionmeta
747 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
749 // only if it is not a hidden option write the controls to the page
750 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
756 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
758 $template = "<td><%description%></td>\n"
763 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
768 switch($current['type'])
771 $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
774 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
776 $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
780 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
783 'varname' => Entity::hsc($varname),
784 'value' => Entity::hsc($current['value']),
788 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
790 $template .= "<select name=\"<%varname%>\">\n";
794 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
796 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
798 $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
802 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
804 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
805 $options = preg_split('#\|#', $options);
807 for ( $i=0; $i<(count($options)-1); $i+=2 )
809 $name = $options[$i];
810 $value = $options[$i+1];
811 if ( defined($name) )
813 $name = constant($name);
817 'optname' => Entity::hsc($name),
818 'value' => Entity::hsc($value)
820 if ($value != $current['value'])
822 $subData['selected'] = '';
826 $subData['selected'] = ' selected="selected"';
828 $template .= Template::fill($subTpl, $subData);
830 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
832 $template .= "</select>\n";
836 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
838 $data['varname'] = Entity::hsc($varname);
841 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
843 $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";
847 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
850 'varname' => Entity::hsc($varname),
851 'value' => Entity::hsc($current['value'])
853 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
855 $data['readonly'] = '';
859 $data['readonly'] = ' readonly="readonly"';
864 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
866 $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
870 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
873 'varname' => Entity::hsc($varname),
874 'value' => Entity::hsc($current['value'])
876 if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
878 $data['datatype'] = '';
882 $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
884 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
886 $data['readonly'] = '';
890 $data['readonly'] = ' readonly="readonly"';
894 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
896 $template .= "<%extra%></td>\n";
900 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
903 if ( !array_key_exists('extra', $current) )
909 $data['extra'] = Entity::hsc($current['extra']);
912 if ( !array_key_exists('description', $current) )
914 $data['description'] = Entity::hsc($current['name']);
916 else if ( !defined($current['description']) )
918 $data['description'] = Entity::hsc($current['description']);
922 $data['description'] = Entity::hsc(constant($current['description']));
925 return Template::fill($template, $data, 1);
929 * listplug_templateEditRow()
931 * @param array $content content of target template
932 * @param string $desc description of target template
933 * @param string $name name of target template
934 * @param string $help help text
935 * @param integer $tabindex a number for tab index
936 * @param boolean $big large or small textarea
937 * @param array $template_name name of template for filling
940 function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
949 $templates = array();
950 if ( $template_name )
952 $templates =& $manager->getTemplate($template_name);
956 'description' => $desc,
957 'help' => empty($help) ? '' : helpHtml('template' . $help),
960 'tabindex' => $tabindex,
961 'rows' => $big ? 10 : 5,
967 if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
970 . "<td><%description%><%help%></td>\n"
971 . "<td id=\"td<%count%>\">\n"
972 . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";
976 $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
978 $message .= TEMPLATE::fill($template, $data);
981 $message .= ENTITY::hsc($content);
984 if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
986 $template = "</textarea>\n"
992 $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
994 $message .= TEMPLATE::fill($template, $data);
999 function listplug_table_itemlist($vars, $type, $template_name = '')
1005 $templates = array();
1006 if ( !empty($template_name) )
1008 $templates =& $manager->getTemplate($template_name);
1014 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
1016 $template = "<th><%colinfo%></th>\n"
1017 . "<th><%colcontent%></th>\n"
1018 . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";
1022 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
1025 'colinfo' => _LIST_ITEM_INFO,
1026 'colcontent' => _LIST_ITEM_CONTENT,
1027 'colaction' => _LISTS_ACTIONS
1031 $current = $vars['current'];
1032 // string -> unix timestamp
1033 $current['itime'] = strtotime($current['itime']);
1034 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
1036 $template = "<td<%cssclass%>>\n"
1037 . "<%bshortlabel%> <%bshortnameval%><br />\n"
1038 . "<%categorylabel%> <%categorynameval%><br />\n"
1039 . "<%authorlabel%> <%authornameval%><br />\n"
1040 . "<%itemdatelabel%> <%itemdateval%><br />\n"
1041 . "<%itemtimelabel%> <%itemtimeval%>\n"
1043 . "<td<%cssclass%>>\n"
1044 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
1045 . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
1048 . "<td<%cssclass%>>\n"
1049 . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"
1050 . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"
1051 . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"
1057 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
1061 if ( $current['idraft'] == 1 )
1063 $cssclass = ' class="draft"';
1066 // (can't use offset time since offsets might vary between blogs)
1067 if ( $current['itime'] > $vars['now'] )
1069 $cssclass = ' class="future"';
1071 $body = strip_tags($current['ibody']);
1073 'cssclass' => $cssclass,
1074 'bshortlabel' => _LIST_ITEM_BLOG,
1075 'bshortnameval' => Entity::hsc($current['bshortname']),
1076 'categorylabel' => _LIST_ITEM_CAT,
1077 'categorynameval' => Entity::hsc($current['cname']),
1078 'authorlabel' => _LIST_ITEM_AUTHOR,
1079 'authornameval' => Entity::hsc($current['mname']),
1080 'itemdatelabel' => _LIST_ITEM_DATE,
1081 'itemdateval' => date("Y-m-d",$current['itime']),
1082 'itemdatelabel' => _LIST_ITEM_TIME,
1083 'itemdateval' => date("H:i",$current['itime']),
1084 'batchid' => listplug_nextBatchId(),
1085 'itemid' => $current['inumber'],
1086 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),
1087 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
1088 'editbtn' => _LISTS_EDIT,
1089 'movebtn' => _LISTS_MOVE,
1090 'delbtn' => _LISTS_DELETE,
1092 // evaluate amount of comments for the item
1093 $comment = new Comments($current['inumber']);
1094 $camount = $comment->amountComments();
1097 $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
1101 $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";
1105 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
1111 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
1116 return Template::fill($template, $data);
1119 // for batch operations: generates the index numbers for checkboxes
1120 function listplug_nextBatchId()
1126 function listplug_table_commentlist($vars, $type, $template_name = '')
1130 $templates = array();
1131 if ( !empty($template_name) )
1133 $templates =& $manager->getTemplate($template_name);
1139 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
1141 $template = "<th><%colinfo%></th>\n"
1142 . "<th><%colcontent%></th>\n"
1143 . "<th colspan=\"3\"><%colaction%></th>\n";
1147 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
1150 'colinfo' => _LISTS_INFO,
1151 'colcontent' => _LIST_COMMENT,
1152 'colaction' => _LISTS_ACTIONS
1156 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
1158 $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
1160 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
1161 . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"
1163 . "<td style=\"white-space:nowrap\">\n"
1164 . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"
1166 . "<td style=\"white-space:nowrap\">\n"
1167 . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"
1173 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
1175 $current = $vars['current'];
1176 $body = strip_tags($current['cbody']);
1178 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),
1179 'batchid' => listplug_nextBatchId(),
1180 'commentid' => $current['cnumber'],
1181 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
1182 'editbtn' => _LISTS_EDIT,
1183 'delbtn' => _LISTS_DELETE,
1185 if ( isset($current['mname']) )
1187 $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
1191 $data['commentator'] = Entity::hsc($current['cuser']);
1193 if ( isset($current['cmail']) && $current['cmail'] )
1195 $data['commentsite'] = Entity::hsc($current['cmail']);
1199 $data['commentsite'] = '';
1201 if ( isset($current['cemail']) && $current['cemail'] )
1203 $data['commentmail'] = Entity::hsc($current['cemail']);
1207 $data['commentmail'] = '';
1209 if ( $vars['canAddBan'] )
1211 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
1213 $subTpl = "<td style=\"white-space:nowrap\">"
1214 . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"
1219 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
1222 'itemid' => $current['citem'],
1223 'banip' => Entity::hsc($current['cip']),
1224 'banbtn' => _LIST_COMMENT_BANIP,
1226 $data['addbanlist'] = Template::fill($subTpl, $subData);
1230 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
1236 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
1241 return Template::fill($template, $data);
1244 function listplug_table_bloglist($vars, $type, $template_name = '')
1248 $templates = array();
1249 if ( !empty($template_name) )
1251 $templates =& $manager->getTemplate($template_name);
1257 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
1259 $template = "<th><%blognames%></th>\n"
1260 . "<th colspan=\"7\"><%actionshead%></th>\n";
1264 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
1267 'blognames' => _NAME,
1268 'actionshead' => _LISTS_ACTIONS,
1272 $current = $vars['current'];
1273 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
1275 $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
1276 . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
1277 . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
1278 . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
1279 . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
1280 . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
1284 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
1287 'blogid' => $current['bnumber'],
1288 'shortname' => Entity::hsc($current['bshortname']),
1289 'blogurl' => $current['burl'],
1290 'blogname' => Entity::hsc($current['bname']),
1291 'ttaddtext' => _BLOGLIST_TT_ADD,
1292 'addtext' => _BLOGLIST_ADD,
1293 'ttedittext' => _BLOGLIST_TT_EDIT,
1294 'edittext' => _BLOGLIST_EDIT,
1295 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
1296 'commenttext' => _BLOGLIST_COMMENTS,
1297 'ttbmlettext' => _BLOGLIST_TT_BMLET,
1298 'bmlettext' => _BLOGLIST_BMLET,
1300 if ( $current['tadmin'] == 1 )
1302 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
1304 $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
1305 . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
1309 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
1311 $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
1312 $data['settingtext'] = _BLOGLIST_SETTINGS;
1313 $data['ttbanstext'] = _BLOGLIST_TT_BANS;
1314 $data['banstext'] = _BLOGLIST_BANS;
1317 if ( $vars['superadmin'] )
1319 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
1321 $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";
1325 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
1327 $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
1328 $data['deletetext'] = _BLOGLIST_DELETE;
1332 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
1338 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
1343 return Template::fill($template, $data);
1346 function listplug_table_shortblognames($vars, $type, $template_name = '')
1350 $templates = array();
1351 if ( !empty($template_name) )
1353 $templates =& $manager->getTemplate($template_name);
1359 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
1361 $template = "<th><%colshortname%></th>\n"
1362 . "<th><%colblogname%></th>\n";
1366 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
1369 'colshortname' => _EBLOG_SHORTNAME,
1370 'colblogname' => _EBLOG_NAME,
1374 $current = $vars['current'];
1375 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
1377 $template = "<td><%bshortname%></td>\n"
1378 . "<td><%blogname%></td>\n";
1382 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
1385 'bshortname' => Entity::hsc($current['bshortname']),
1386 'blogname' => Entity::hsc($current['bname']),
1390 $current = $vars['current'];
1391 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
1397 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
1402 return Template::fill($template, $data);
1405 function listplug_table_shortnames($vars, $type, $template_name = '')
1409 $templates = array();
1410 if ( !empty($template_name) )
1412 $templates =& $manager->getTemplate($template_name);
1418 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
1420 $template = "<th><%colname%></th>\n"
1421 . "<th><%coldesc%></th>\n";
1425 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
1429 'coldesc' => _LISTS_DESC,
1433 $current = $vars['current'];
1434 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
1436 $template = "<td><%name%></td>\n"
1437 . "<td><%desc%></td>\n";
1441 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
1444 'name' => Entity::hsc($current['name']),
1445 'desc' => Entity::hsc($current['description']),
1449 $current = $vars['current'];
1450 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
1456 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
1461 return Template::fill($template, $data);
1464 function listplug_table_categorylist($vars, $type, $template_name = '')
1468 $templates = array();
1469 if ( !empty($template_name) )
1471 $templates =& $manager->getTemplate($template_name);
1477 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
1479 $template = "<th><%colname%></th>\n"
1480 . "<th><%coldesc%></th>\n"
1481 . "<th colspan=\"2\"><%colact%></th>\n";
1485 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
1488 'colname' => _LISTS_NAME,
1489 'coldesc' => _LISTS_DESC,
1490 'colact' => _LISTS_ACTIONS,
1494 $current = $vars['current'];
1495 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
1497 $template = "<td>\n"
1498 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
1499 . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
1501 . "<td><%catdesc%></td>\n"
1502 . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
1503 . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
1507 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
1511 'batchid' => listplug_nextBatchId(),
1512 'catid' => intval($current['catid']),
1513 'catname' => Entity::hsc($current['cname']),
1514 'catdesc' => Entity::hsc($current['cdesc']),
1515 'blogid' => intval($current['cblog']),
1516 'tabindex' => intval($vars['tabindex']),
1517 'editbtn' => _LISTS_EDIT,
1518 'delbtn' => _LISTS_DELETE,
1522 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
1528 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
1533 return Template::fill($template, $data);
1536 function listplug_table_templatelist($vars, $type, $template_name = '')
1538 global $manager, $CONF;
1540 $templates = array();
1541 if ( !empty($template_name) )
1543 $templates =& $manager->getTemplate($template_name);
1549 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
1551 $template = "<th><%colname%></th>\n"
1552 . "<th><%coldesc%></th>\n"
1553 . "<th colspan=\"3\"><%colact%></th>\n";
1557 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
1560 'colname' => _LISTS_NAME,
1561 'coldesc' => _LISTS_DESC,
1562 'colact' => _LISTS_ACTIONS,
1566 $current = $vars['current'];
1567 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
1569 $template = "<td><%templatename%></td>\n"
1570 . "<td><%templatedesc%></td>\n"
1571 . "<td style=\"white-space:nowrap\">"
1572 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
1574 . "<td style=\"white-space:nowrap\">\n"
1575 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
1577 . "<td style=\"white-space:nowrap\">\n"
1578 . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
1583 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
1587 'templatename' => Entity::hsc($current['tdname']),
1588 'templatedesc' => Entity::hsc($current['tddesc']),
1589 'templateid' => (integer) $current['tdnumber'],
1590 'tabindex' => (integer) $vars['tabindex'],
1592 'clonebtn' => _LISTS_CLONE,
1593 'cloneaction' => $vars['cloneaction'],
1594 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",
1596 'delbtn' => _LISTS_DELETE,
1597 'deleteaction' => $vars['deleteaction'],
1598 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",
1600 'editbtn' => _LISTS_EDIT,
1601 'editaction' => $vars['editaction'],
1602 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"
1606 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
1612 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
1617 return Template::fill($template, $data);
1620 function listplug_table_skinlist($vars, $type, $template_name = '')
1622 global $CONF, $DIR_SKINS, $manager;
1624 $templates = array();
1625 if ( !empty($template_name) )
1627 $templates =& $manager->getTemplate($template_name);
1633 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
1635 $template = "<th><%colname%></th>\n"
1636 . "<th><%coldesc%></th>\n"
1637 . "<th colspan=\"3\"><%colact%></th>\n";
1641 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
1644 'colname' => _LISTS_NAME,
1645 'coldesc' => _LISTS_DESC,
1646 'colact' => _LISTS_ACTIONS,
1650 $current = $vars['current'];
1651 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
1653 $template = "<td><%skinname%><br /><br />\n"
1654 . "<%skintypelabel%> <%skintype%><br />\n"
1655 . "<%incmodelabel%> <%incmode%><br />\n"
1656 . "<%incpreflabel%> <%incpref%><br />\n"
1658 . "<%readme%></td>\n"
1659 . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
1660 . "<td style=\"white-space:nowrap\">"
1661 . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"
1663 . "<td style=\"white-space:nowrap\">"
1664 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"
1666 . "<td style=\"white-space:nowrap\">"
1667 . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"
1672 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
1676 'tabindex' => $vars['tabindex']++,
1678 'skinid' => (integer) $current['sdnumber'],
1679 'skindesc' => Entity::hsc($current['sddesc']),
1681 'skintypelabel' => _LISTS_TYPE,
1682 'skintype' => Entity::hsc($current['sdtype']),
1684 'incmodelabel' => _LIST_SKINS_INCMODE,
1685 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
1687 'incpreflabel' => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',
1688 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
1690 'editbtn' => _LISTS_EDIT,
1691 'editaction' => $vars['editaction'],
1692 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
1694 'clonebtn' => _LISTS_CLONE,
1695 'cloneaction' => $vars['cloneaction'],
1696 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
1698 'delbtn' => _LISTS_DELETE,
1699 'deleteaction' => $vars['deleteaction'],
1700 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
1703 if ( $current['sdnumber'] != $vars['default'] )
1705 $data['skinname'] = Entity::hsc($current['sdname']);
1709 $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';
1712 // add preview image when present
1713 if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
1715 $data['skinthumb'] = "<p>\n";
1717 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
1718 $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
1719 if ( $has_enlargement )
1721 $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
1723 $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
1724 if ( $has_enlargement )
1726 $data['skinthumb'] .= "</a><br />\n";
1729 if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
1731 $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
1732 $title = sprintf(_LIST_SKIN_README, $current['sdname']);
1733 $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
1737 $data['readme'] ="";
1740 $data['skinthumb'] .= "</p>\n";
1743 $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);
1744 $available_types = $skin->getAvailableTypes();
1746 $data['skinparts'] = _LIST_SKINS_DEFINED
1748 foreach ( $available_types as $type => $label )
1750 if ( $label === FALSE )
1752 $label = ucfirst($type);
1753 $article = 'skinpartspecial';
1757 $article = "skinpart{$type}";
1759 $data['skinparts'] .= "<li>\n"
1760 . helpHtml($article) . "\n"
1761 . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
1762 . Entity::hsc($label)
1766 $data['skinparts'] .= "</ul>\n";
1769 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
1775 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
1780 return Template::fill($template, $data);
1783 function listplug_table_draftlist($vars, $type, $template_name = '')
1787 $templates = array();
1788 if ( !empty($template_name) )
1790 $templates =& $manager->getTemplate($template_name);
1795 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
1797 $template = "<th><%colblog%></th>\n"
1798 . "<th><%coldesc%></th>\n"
1799 . "<th colspan=\"2\"><%colact%></th>\n";
1803 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
1806 'colblog' => _LISTS_BLOG,
1807 'coldesc' => _LISTS_TITLE,
1808 'colact' => _LISTS_ACTIONS,
1812 $current = $vars['current'];
1813 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
1815 $template = "<td><%bshortname%></td>\n"
1816 . "<td><%ititle%></td>\n"
1817 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
1818 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
1822 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
1825 'bshortname' => Entity::hsc($current['bshortname']),
1826 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
1827 'itemid' => intval($current['inumber']),
1828 'editbtn' => _LISTS_EDIT,
1829 'delbtn' => _LISTS_DELETE,
1833 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
1839 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
1844 return Template::fill($template, $data);
1847 function listplug_table_otherdraftlist($vars, $type, $template_name = '')
1851 $templates = array();
1852 if ( !empty($template_name) )
1854 $templates =& $manager->getTemplate($template_name);
1860 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
1862 $template = "<th><%colblog%></th>\n"
1863 . "<th><%coldesc%></th>\n"
1864 . "<th><%colautr%></th>\n"
1865 . "<th colspan=\"2\"><%colact%></th>\n";
1869 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
1872 'colblog' => _LISTS_BLOG,
1873 'coldesc' => _LISTS_TITLE,
1874 'colautr' => _LISTS_AUTHOR,
1875 'colact' => _LISTS_ACTIONS,
1879 $current = $vars['current'];
1880 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
1882 $template = "<td><%bshortname%></td>\n"
1883 . "<td><%ititle%></td>\n"
1884 . "<td><%iauthor%></td>\n"
1885 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
1886 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
1890 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
1893 'bshortname' => Entity::hsc($current['bshortname']),
1894 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
1895 'iauthor' => Entity::hsc(strip_tags($current['mname'])),
1896 'itemid' => intval($current['inumber']),
1897 'editbtn' => _LISTS_EDIT,
1898 'delbtn' => _LISTS_DELETE,
1902 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
1908 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
1913 return Template::fill($template, $data);
1916 function listplug_table_actionlist($vars, $type, $template_name = '')
1920 $templates = array();
1921 if ( !empty($template_name) )
1923 $templates =& $manager->getTemplate($template_name);
1929 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
1931 $template = "<th><%coltime%></th>\n"
1932 . "<th><%colmesg%></th>\n";
1936 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
1939 'coltime' => _LISTS_TIME,
1940 'colmesg' => _LIST_ACTION_MSG,
1944 $current = $vars['current'];
1945 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
1947 $template = "<td><%timestamp%></td>\n"
1948 . "<td><%message%></td>\n";
1952 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
1955 'timestamp' => Entity::hsc($current['timestamp']),
1956 'message' => Entity::hsc($current['message']),
1960 $current = $vars['current'];
1961 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
1967 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
1972 return Template::fill($template, $data);
1975 function listplug_table_banlist($vars, $type, $template_name = '')
1979 $templates = array();
1980 if ( !empty($template_name) )
1982 $templates =& $manager->getTemplate($template_name);
1988 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
1990 $template = "<th><%iprange%></th>\n"
1991 . "<th><%reason%></th>\n"
1992 . "<th><%colact%></th>\n";
1996 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
1999 'iprange' => _LIST_BAN_IPRANGE,
2000 'reason' => _LIST_BAN_REASON,
2001 'colact' => _LISTS_ACTIONS,
2005 $current = $vars['current'];
2006 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
2008 $template = "<td><%iprange%></td>\n"
2009 . "<td><%reason%></td>\n"
2010 . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";
2014 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
2017 'iprange' => Entity::hsc($current['iprange']),
2018 'reason' => Entity::hsc($current['reason']),
2019 'blogid' => intval($current['blogid']),
2020 'delbtn' => _LISTS_DELETE,
2024 $current = $vars['current'];
2025 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
2031 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
2036 return Template::fill($template, $data);
2040 * listplug_list_normalskinlist()
2042 * @param array $vars array for variables
2043 * @param string $type HEAD/BODY/FOOT
2044 * @param string $template_name name of template
2045 * @return string marked-up string
2047 function listplug_list_normalskinlist($vars, $type, $template_name = '')
2049 global $manager, $CONF;
2051 /* available variables as a default */
2053 'skinid' => (integer) $vars['skinid'],
2054 'skinname' => Entity::hsc($vars['skinname']),
2057 $templates = array();
2058 if ( $template_name )
2060 $templates =& $manager->getTemplate($template_name);
2066 if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )
2068 $template = "<ul>\n";
2072 $template = $templates['NORMALSKINLIST_HEAD'];
2077 $current = $vars['current'];
2078 if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )
2081 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"
2087 $template = $templates['NORMALSKINLIST_BODY'];
2090 $data['tabindex'] = $vars['tabindex']++;
2091 $data['skintype'] = $current['skintype'];
2092 $data['skintypename'] = $current['skintypename'];
2093 $data['editaction'] = $vars['editaction'];
2094 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
2095 /* TODO: removeaction? */
2096 /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
2100 if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
2102 $template = "</ul>\n";
2106 $template = $templates['NORMALSKINLIST_FOOT'];
2112 return Template::fill($template, $data);
2116 * listplug_list_specialskinlist()
2118 * @param array $vars array for variables
2119 * @param string $type HEAD/BODY/FOOT
2120 * @param string $template_name name of template
2121 * @return string marked-up string
2123 function listplug_list_specialskinlist($vars, $type, $template_name = '')
2125 global $manager, $CONF;
2127 /* available variables as a default */
2129 'skinid' => (integer) $vars['skinid'],
2130 'skinname' => Entity::hsc($vars['skinname']),
2133 /* retrieve templates */
2134 $templates = array();
2135 if ( $template_name )
2137 $templates =& $manager->getTemplate($template_name);
2143 if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
2145 $template = "<ul>\n";
2149 $template = $templates['SPECIALSKINLIST_HEAD'];
2153 $current = $vars['current'];
2154 if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
2157 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"
2161 . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"
2162 . "<%text(_LISTS_DELETE)%>"
2169 $template = $templates['SPECIALSKINLIST_BODY'];
2172 $data['tabindex'] = (integer) $vars['tabindex']++;
2173 $data['skintype'] = Entity::hsc($current['skintype']);
2174 $data['skintypename'] = Entity::hsc($current['skintypename']);
2175 $data['editaction'] = $vars['editaction'];
2176 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
2177 $data['removeaction'] = $vars['editaction'];
2178 $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
2182 if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
2184 $template = "</ul>\n";
2188 $template = $templates['SPECIALSKINLIST_FOOT'];
2193 return Template::fill($template, $data);
2197 * listplug_input_yesno()
2199 * @param string $name name of input element with radio type attribute
2200 * @param string $checkedval value which should be checked
2201 * @param integer $tabindex tabindex number
2202 * @param string $value1 value of radio 1
2203 * @param string $value2 value of radio 2
2204 * @param string $yesval label for yes
2205 * @param string $noval label for no
2206 * @param boolean $isAdmin super admin or not
2207 * @param string $template_name name of template
2208 * @param boolean $showlist used in showlist or not
2209 * @return string marked-up string
2211 function listplug_input_yesno($name, $checkedval, $tabindex = 0,
2212 $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
2213 $isAdmin = 0, $template_name = '', $showlist = FALSE)
2217 $templates = array();
2218 if ( $template_name )
2220 $templates =& $manager->getTemplate($template_name);
2223 if ( $name == 'admin' )
2225 if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
2227 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
2228 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
2229 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
2230 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
2234 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
2239 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
2241 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
2243 else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
2245 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
2249 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
2250 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
2251 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
2252 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
2256 $id = preg_replace('#[|]#', '-', $name);
2257 $id1 = $id . $value1;
2258 $id2 = $id . $value2;
2260 'name' => Entity::hsc($name),
2261 'yesval' => Entity::hsc($value1),
2262 'noval' => Entity::hsc($value2),
2263 'yesid' => Entity::hsc($id1),
2264 'noid' => Entity::hsc($id2),
2265 'yesvaltext' => $yesval,
2266 'novaltext' => $noval,
2267 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
2268 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
2269 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
2272 return Template::fill($template, $dat);
2276 * listplug_batchlist()
2278 * @param string $attr item/member/team/category/comment
2279 * @param resource $query SQL resorce
2280 * @param string $type type for showlist()
2281 * @param array $vars array for variables
2283 function listplug_batchlist($attr, $query, $type, $vars, $template_name)
2288 $content = "<form method=\"post\" action=\"index.php\">\n";
2291 $content .= showlist($query, $type, $vars, $template_name);
2298 'delete' => _BATCH_ITEM_DELETE,
2299 'move' => _BATCH_ITEM_MOVE
2304 'delete' => _BATCH_MEMBER_DELETE,
2305 'setadmin' => _BATCH_MEMBER_SET_ADM,
2306 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
2311 'delete' => _BATCH_TEAM_DELETE,
2312 'setadmin' => _BATCH_TEAM_SET_ADM,
2313 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
2318 'delete' => _BATCH_CAT_DELETE,
2319 'move' => _BATCH_CAT_MOVE,
2324 'delete' => _BATCH_COMMENT_DELETE,
2332 $content .= "<p class=\"batchoperations\">\n"
2334 . "<select name=\"batchaction\">\n";
2336 foreach ( $options as $option => $label )
2338 $content .= "<option value=\"{$option}\">{$label}</option>\n";
2340 $content .= "</select>\n";
2342 if ( $attr == 'team' )
2344 $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';
2346 else if ( $attr == 'comment' )
2348 $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';
2351 $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'
2353 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"
2355 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"
2357 . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"
2358 . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"
2366 * listplug_navlist()
2368 * @param string $attr item/member/team/category/comment
2369 * @param resource $query SQL resorce
2370 * @param string $type type for showlist()
2371 * @param array $vars array for variables
2372 * @param string $template_name name of template
2373 * @return string contents
2375 function listplug_navlist($attribute, $query, $type, $vars, $template_name)
2379 $prev = $vars['start'] - $vars['amount'];
2380 if ( $prev < $vars['minamount'] )
2382 $prev = $vars['minamount'];
2385 $next = $vars['start'] + $vars['amount'];
2388 $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"
2391 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
2392 . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"
2393 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"
2394 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
2395 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
2396 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
2397 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
2401 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
2402 . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"
2404 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
2405 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"
2406 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
2407 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
2408 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
2409 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
2413 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
2414 . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"
2415 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
2416 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"
2417 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
2418 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
2419 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
2420 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
2424 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
2425 . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"
2426 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"
2427 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
2428 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
2429 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
2430 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
2440 $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);