* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
* @since file available since contenido release <= 4.6
*
* {@internal
* created 2003-03-27
* modified 2008-06-27, Dominik Ziegler, add security fix
* modified 2010-05-20, Murat Purc, removed request check during processing ticket [#CON-307]
* modified 2010-08-18, Munkh-Ulzii Balidar, added functionality to show the used information
*
* $Id$:
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$sql = "SELECT
*
FROM
".$cfg["tab"]["tpl"]."
WHERE
idclient = '".Contenido_Security::toInteger($client)."'
ORDER BY
name";
$db->query($sql);
$tpl->reset();
$tpl->set('s', 'SID', $sess->id);
while ( $db->next_record() ) {
if ( $perm->have_perm_item($area, $db->f("idtpl")) ||
$perm->have_perm_area_action("tpl" , "tpl_delete") ||
$perm->have_perm_area_action("tpl" , "tpl_duplicate") ||
$perm->have_perm_area_action("tpl_edit" , "tpl_edit") ||
$perm->have_perm_area_action("tpl_edit" , "tpl_new") ||
$perm->have_perm_area_action("tpl_visual" , "tpl_visedit")
) {
$name = $db->f('name');
$descr = $db->f('description');
$idtpl = $db->f("idtpl");
$bgcolor = ( is_int($tpl->dyn_cnt / 2) ) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
$tpl->set('d', 'BGCOLOR', $bgcolor);
# create javascript multilink
$tmp_mstr = '%s';
if ($db->f("defaulttemplate") == 1)
{
$mstr = sprintf($tmp_mstr, clHtmlSpecialChars($descr), 'right_top',
$sess->url("main.php?area=tpl&frame=3&idtpl=$idtpl"),
'right_bottom',
$sess->url("main.php?area=tpl_edit&frame=4&idtpl=$idtpl"),
"".$name."");
} else {
$mstr = sprintf($tmp_mstr, clHtmlSpecialChars($descr), 'right_top',
$sess->url("main.php?area=tpl&frame=3&idtpl=$idtpl"),
'right_bottom',
$sess->url("main.php?area=tpl_edit&frame=4&idtpl=$idtpl"),
$name);
}
if ($perm->have_perm_area_action_item("tpl_edit","tpl_edit",$db->f("idtpl"))) {
$tpl->set('d', 'NAME', $mstr);
} else {
$tpl->set('d', 'NAME', $name);
}
/* Check if template is in use */
$inUse = tplIsTemplateInUse($idtpl);
$inUseString = i18n("Click for more information about usage");
if (!$inUse && ($perm->have_perm_area_action_item("tpl","tpl_delete",$db->f("idtpl")))) {
$delTitle = i18n("Delete template");
$delDescr = sprintf(i18n("Do you really want to delete the following template:
%s
"),clHtmlSpecialChars($name));
$tpl->set('d', 'DELETE', '');
$tpl->set('d', 'INUSE', '');
} else {
$delDescription = i18n("Template in use, cannot delete");
$tpl->set('d', 'DELETE','');
$tpl->set('d', 'INUSE', '');
}
if ($perm->have_perm_area_action_item("tpl","tpl_dup", $db->f("idtpl"))) {
$copybutton = '';
} else {
$copybutton = '';
}
$tpl->set('d', 'COPY', $copybutton);
$tpl->set('d', 'ID', 'tpl'.$tpl->dyn_cnt);
$tpl->next();
}
}
//datas for show of used info per ajax
$tpl->set('s', 'AREA', $area);
$tpl->set('s', 'SESSION', $contenido);
$tpl->set('s', 'AJAXURL', $cfg['path']['contenido_fullhtml'].'ajaxmain.php');
$tpl->set('s', 'BOX_TITLE', i18n("The template '%s' is used for following categories and articles") . ":");
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tpl_overview']);
?>