* @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 unknown
* modified 2008-06-26, Dominik Ziegler, add security fix
*
* $Id: include.client_artspec.php 2 2011-07-20 12:00:48Z oldperl $:
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
if ($action == "client_artspec_save")
{
if(!$perm->have_perm_area_action($area, $action))
{
$notification->displayNotification("error", i18n("Permission denied"));
} else {
addArtspec($_POST['artspectext'], $online);
}
}
if ($action == "client_artspec_delete")
{
if(!$perm->have_perm_area_action($area, $action))
{
$notification->displayNotification("error", i18n("Permission denied"));
} else {
deleteArtspec($_GET['idartspec']);
}
}
if ($action == "client_artspec_online")
{
if(!$perm->have_perm_area_action($area, "client_artspec_save"))
{
$notification->displayNotification("error", i18n("Permission denied"));
} else {
setArtspecOnline($_GET['idartspec'], $online);
}
}
if ($action == "client_artspec_default")
{
if(!$perm->have_perm_area_action($area, "client_artspec_save"))
{
$notification->displayNotification("error", i18n("Permission denied"));
} else {
setArtspecDefault($_GET['idartspec'], $online);
}
}
$page = new UI_Page;
$list = new UI_List;
$list->setCell(1,1, i18n("Article specification"));
$list->setCell(1,2, i18n("Options"));
$list->setBgColor(1,$cfg['color']['table_header']);
$list->setBorder(1);
$list->setWidth ("250px");
$count = 2;
$link = new Link;
$link->setCLink($area, $frame, "client_artspec_edit");
$link->setContent('');
$dlink = new Link;
$dlink->setCLink($area, $frame, "client_artspec_delete");
$dlink->setContent('');
$olink = new Link;
$olink->setCLink($area, $frame, "client_artspec_online");
$defLink = new Link;
$defLink->setCLink($area, $frame, "client_artspec_default");
$artspec = getArtspec();
if (is_array($artspec))
{
foreach ($artspec as $id => $tmp_artspec)
{
$link->setCustom("idartspec", $id);
$link->updateAttributes(array ('style' => 'padding:3'));
$dlink->setCustom("idartspec", $id);
$dlink->updateAttributes(array ('style' => 'padding:3'));
$olink->setCustom("idartspec", $id);
$olink->updateAttributes(array ('style' => 'padding:3'));
$defLink->setCustom("idartspec", $id);
$defLink->updateAttributes(array ('style' => 'padding:3'));
if (($action == "client_artspec_edit") && ($idartspec == $id))
{
$form = new UI_Form("artspec");
$form->setVar("area",$area);
$form->setVar("frame", $frame);
$form->setVar("idartspec", $id);
$form->setVar("action", "client_artspec_save");
$form->setVar("online", $artspec[$id]['online']);
$inputbox = new cHTMLTextbox ("artspectext", urldecode($artspec[$id]['artspec']));
$inputbox->setStyle("border:1px;border-style:solid;border-color:black;");
$form->add("name",$inputbox->render());
$form->add("submit", '');
$list->setCell($count,1, $form->render(true));
} else {
$list->setCell($count,1, urldecode($artspec[$id]['artspec']));
}
if ($artspec[$id]['online'] == 0)
{ //it is offline (std!)
$olink->setContent('');
$olink->setCustom("online", 1);
} else
{
$olink->setContent('');
$olink->setCustom("online", 0);
}
if ($artspec[$id]['default'] == 0)
{
$defLink->setContent('');
$list->setCell($count,2, $link->render().$dlink->render().$olink->render().$defLink->render());
} else
{
$defLinkText = '';
$list->setCell($count,2, $link->render().$dlink->render().$olink->render().$defLinkText);
}
$count++;
}
} else
{
$list->setCell($count,1, i18n("No article specifications found!"));
$list->setCell($count,2, '');
}
unset($form);
$form = new UI_Table_Form("artspec");
$form->setVar("area",$area);
$form->setVar("frame", $frame);
$form->setVar("action", "client_artspec_save");
$form->addHeader(i18n("Create new article specification"));
$inputbox = new cHTMLTextbox ("artspectext");
$inputbox->setStyle("border:1px;border-style:solid;border-color:black;");
$form->add(i18n("Specification name"),$inputbox->render());
$page->setContent($list->render()."
".$form->render());
$page->render();
?>