* @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-26 * @modified 2008-06-27, Frederic Schneider, add security fix * @modified 2008-09-08, Ingo van Peeren, improved navigation tree in left bottom frame, expanding/ * collapsing of navigation tree without reloading (AJAX/ * javascript solution based on jquery) * @modified 2008-09-18, Ingo van Peeren, moved template-changing to jquery * @modified 2010-06-16, Timo Trautmann, Fixed a bug wit the Syncselection (there was no right userright check) * * $Id$: * }} * */ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } cInclude("includes", "functions.str.php"); cInclude("includes", "functions.tpl.php"); cInclude('includes', 'functions.lang.php'); if (!isset($oTpl) || !is_object($oTpl)) { $oTpl = new Template(); } $oTpl->reset(); global $sess, $frame, $area; $idcat = ( isset($_GET['idcat']) && is_numeric($_GET['idcat'])) ? $_GET['idcat'] : -1; //Get sync options if (isset($syncoptions)) { $syncfrom = (int) $syncoptions; $remakeCatTable = true; } if (!isset($syncfrom)) { $syncfrom = -1; } $syncoptions = $syncfrom; $oTpl->set('s', 'SYNC_LANG', $syncfrom); ########################################## # Delete a saved search ########################################## $bShowArticleSearch = false; if (isset($_GET['delsavedsearch'])) { if (isset($_GET['itemtype']) && sizeof($_GET['itemtype']) > 0 && isset($_GET['itemid']) && sizeof($_GET['itemid']) > 0) { $propertyCollection = new PropertyCollection; $propertyCollection->deleteProperties($_GET['itemtype'], $_GET['itemid']); $bShowArticleSearch = true; } } if (isset($_GET['save_search']) && $_GET['save_search'] == 'true') { $bShowArticleSearch = true; } ########################################## # ARTICLE SEARCH ########################################## # modified 20/04/2007 by H. Librenz for backend search $arrDays = array(); for ($i = 0; $i < 32; $i++) { if ($i == 0) { $arrDays[$i] = '--'; } else { $arrDays[$i] = $i; } } $arrMonths = array(); for ($i = 0; $i < 13; $i++) { if ($i == 0) { $arrMonths[$i] = '--'; } else { $arrMonths[$i] = $i; } } $arrYears = array(); $arrYears[0] = '-----'; $sActualYear = (int) date("Y"); for ($i = $sActualYear - 10; $i < $sActualYear + 30; $i++) { $arrYears[$i] = $i; } $arrUsers = array(); $query = "SELECT * FROM " . $cfg['tab']['phplib_auth_user_md5'] . " ORDER BY realname"; $arrUsers['n/a'] = '-'; $db->query($query); while ($db->next_record()) { $arrUsers[$db->f('username')] = $db->f('realname'); } $arrDateTypes = array(); $arrDateTypes['n/a'] = i18n('Ignore'); $arrDateTypes['created'] = i18n('Date created'); $arrDateTypes['lastmodified'] = i18n('Date modified'); $arrDateTypes['published'] = i18n('Date published'); $articleLink = "editarticle"; $oListOptionRow = new cFoldingRow("3498dbba-ed4a-4618-8e49-3a3635396e22", i18n("Article Search"), $articleLink, $bShowArticleSearch); $oTpl->set('s', 'ARTICLELINK', $articleLink); #Textfeld $oTextboxArtTitle = new cHTMLTextbox("bs_search_text", (isset($_REQUEST["bs_search_text"]) ? $_REQUEST["bs_search_text"] : ''), 10); $oTextboxArtTitle->setStyle('width:135px;'); #Artikel_ID-Feld $oTextboxArtID = new cHTMLTextbox("bs_search_id", (isset($_REQUEST["bs_search_id"]) ? $_REQUEST["bs_search_id"] : ''), 10); $oTextboxArtID->setStyle('width:135px;'); #Date type $oSelectArtDateType = new cHTMLSelectElement("bs_search_date_type", "bs_search_date_type"); $oSelectArtDateType->autoFill($arrDateTypes); $oSelectArtDateType->setStyle('width:135px;'); $oSelectArtDateType->setEvent("Change", "toggle_tr_visibility('tr_date_from');toggle_tr_visibility('tr_date_to');"); if (isset($_REQUEST["bs_search_date_type"]) && $_REQUEST["bs_search_date_type"] != '') { $oSelectArtDateType->setDefault($_REQUEST["bs_search_date_type"]); } else { $oSelectArtDateType->setDefault('n/a'); } #DateFrom $oSelectArtDateFromDay = new cHTMLSelectElement("bs_search_date_from_day"); $oSelectArtDateFromDay->setStyle('width:40px;'); $oSelectArtDateFromDay->autoFill($arrDays); $oSelectArtDateFromMonth = new cHTMLSelectElement("bs_search_date_from_month"); $oSelectArtDateFromMonth->setStyle('width:40px;'); $oSelectArtDateFromMonth->autoFill($arrMonths); $oSelectArtDateFromYear = new cHTMLSelectElement("bs_search_date_from_year"); $oSelectArtDateFromYear->setStyle('width:55px;'); $oSelectArtDateFromYear->autoFill($arrYears); if (isset($_REQUEST["bs_search_date_from_day"]) && $_REQUEST["bs_search_date_from_day"] > 0) { $oSelectArtDateFromDay->setDefault($_REQUEST["bs_search_date_from_day"]); } else { $oSelectArtDateFromDay->setDefault(0); } if (isset($_REQUEST["bs_search_date_from_month"]) && $_REQUEST["bs_search_date_from_month"] > 0) { $oSelectArtDateFromMonth->setDefault($_REQUEST["bs_search_date_from_month"]); } else { $oSelectArtDateFromMonth->setDefault(0); } if (isset($_REQUEST["bs_search_date_from_year"]) && $_REQUEST["bs_search_date_from_year"] > 0) { $oSelectArtDateFromYear->setDefault($_REQUEST["bs_search_date_from_year"]); } else { $oSelectArtDateFromYear->setDefault(0); } #DateTo $oSelectArtDateToDay = new cHTMLSelectElement("bs_search_date_to_day"); $oSelectArtDateToDay->setStyle('width:40px;'); $oSelectArtDateToDay->autoFill($arrDays); $oSelectArtDateToMonth = new cHTMLSelectElement("bs_search_date_to_month"); $oSelectArtDateToMonth->setStyle('width:40px;'); $oSelectArtDateToMonth->autoFill($arrMonths); $oSelectArtDateToYear = new cHTMLSelectElement("bs_search_date_to_year"); $oSelectArtDateToYear->setStyle('width:55px;'); $oSelectArtDateToYear->autoFill($arrYears); if (isset($_REQUEST["bs_search_date_to_day"]) && $_REQUEST["bs_search_date_to_day"] > 0) { $oSelectArtDateToDay->setDefault($_REQUEST["bs_search_date_to_day"]); } else { $oSelectArtDateToDay->setDefault(0); } if (isset($_REQUEST["bs_search_date_to_month"]) && $_REQUEST["bs_search_date_to_month"] > 0) { $oSelectArtDateToMonth->setDefault($_REQUEST["bs_search_date_to_month"]); } else { $oSelectArtDateToMonth->setDefault(0); } if (isset($_REQUEST["bs_search_date_to_year"]) && $_REQUEST["bs_search_date_to_year"] > 0) { $oSelectArtDateToYear->setDefault($_REQUEST["bs_search_date_to_year"]); } else { $oSelectArtDateToYear->setDefault(0); } #Author $oSelectArtAuthor = new cHTMLSelectElement("bs_search_author"); $oSelectArtAuthor->setStyle('width:135px;'); $oSelectArtAuthor->autoFill($arrUsers); if (isset($_REQUEST["bs_search_author"]) && $_REQUEST["bs_search_author"] != '') { $oSelectArtAuthor->setDefault($_REQUEST["bs_search_author"]); } else { $oSelectArtAuthor->setDefault('n/a'); } $oSubmit = new cHTMLButton("submit", i18n("Search")); $content = '
'; $content .= ''; /** * Saved searches */ $content .= ''; $content .= '
'; $oListOptionRow->setContentData($content); $sSelfLink = 'main.php?area=' . $area . '&frame=2&' . $sess->name . "=" . $sess->id; $oTpl->set('s', 'SELFLINK', $sSelfLink); $oTpl->set('s', 'SEARCH', $oListOptionRow->render()); ########################################## # Category ########################################## $sql = "SELECT idtpl, name FROM " . $cfg['tab']['tpl'] . " WHERE idclient = '" . Contenido_Security::toInteger($client) . "' ORDER BY name"; $db->query($sql); $oTpl->set('s', 'ID', 'oTplSel'); $oTpl->set('s', 'CLASS', 'text_medium'); $oTpl->set('s', 'OPTIONS', ''); $oTpl->set('s', 'SESSID', $sess->id); $oTpl->set('s', 'BELANG', $belang); $oTpl->set('d', 'VALUE', '0'); $oTpl->set('d', 'CAPTION', i18n("Choose template")); $oTpl->set('d', 'SELECTED', ''); $oTpl->next(); $oTpl->set('d', 'VALUE', '0'); $oTpl->set('d', 'CAPTION', '--- ' . i18n("none") . ' ---'); $oTpl->set('d', 'SELECTED', ''); $oTpl->next(); $categoryLink = "editcat"; $editCategory = new cFoldingRow("3498dbbb-ed4a-4618-8e49-3a3635396e22", i18n("Edit Category"), $categoryLink); while ($db->next_record()) { $oTplname = $db->f('name'); if (strlen($oTplname) > 18) { $oTplname = substr($oTplname, 0, 15) . "..."; } $oTpl->set('d', 'VALUE', $db->f('idtpl')); $oTpl->set('d', 'CAPTION', $oTplname); $oTpl->set('d', 'SELECTED', ''); $oTpl->next(); } // Template Dropdown $editCat = '
'; $editCat .= i18n("Template:") . "
"; $editCat .= '
'; $editCat .= $oTpl->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); $editCat .= '
'; $editCat .= '
'; // Category $editCat .= '
'; $oTpl->set('s', 'CAT_HREF', $sess->url("main.php?area=con_tplcfg&action=tplcfg_edit&frame=4&mode=art") . '&idcat='); $oTpl->set('s', 'IDCAT', $idcat); $editCat .= ''; // Online / Offline $editCat .= ''; // Lock / Unlock $editCat .= ''; $editCat .= '
'; $editCat .= '
'; $editCat .= '
'; $editCategory->setContentData($editCat); $oTpl->set('s', 'EDIT', $editCategory->render()); $oTpl->set('s', 'CATEGORYLINK', $categoryLink); ##################################### # Collapse / Expand / Config Category ##################################### $selflink = "main.php"; $expandlink = $sess->url($selflink . "?area=$area&frame=2&expand=all"); $collapselink = $sess->url($selflink . "?area=$area&frame=2&collapse=all"); $collapseimg = ' ' . i18n("close all") . ''; $expandimg = ' ' . i18n("open all") . ''; $oTpl->set('s', 'MINUS', $collapseimg); $oTpl->set('s', 'PLUS', $expandimg); /* * *********** */ /* SYNCSTUFF */ /* * *********** */ $languages = getLanguageNamesByClient($client); $sListId = ''; if (count($languages) > 1 && $perm->have_perm_area_action($area, "con_synccat")) { $sListId = 'sync'; $oListOptionRow = new cFoldingRow("4808dbba-ed4a-4618-8e49-3a3635396e22", i18n("Synchronize from"), $sListId); if (($syncoptions > 0) && ($syncoptions != $lang)) { $oListOptionRow->setExpanded(true); } #'dir="' . langGetTextDirection($lang) . '"'); $selectbox = new cHTMLSelectElement("syncoptions"); $option = new cHTMLOptionElement("--- " . i18n("None") . " ---", -1); $selectbox->addOptionElement(-1, $option); foreach ($languages as $languageid => $languagename) { if ($lang != $languageid && $perm->have_perm_client_lang($client, $languageid)) { $option = new cHTMLOptionElement($languagename . " (" . $languageid . ")", $languageid); $selectbox->addOptionElement($languageid, $option); } } $selectbox->setDefault($syncoptions); $form = new UI_Form("syncfrom"); $form->setVar("area", $area); $form->setVar("frame", $frame); $form->add("sel", $selectbox->render()); $link = $sess->url("main.php?area=" . $area . "&frame=2") . '&syncoptions='; $sJsLink = 'conMultiLink(\'left_bottom\', \'' . $link . '\'+document.getElementsByName(\'syncoptions\')[0].value+\'&refresh_syncoptions=true\');'; $oTpl->set('s', 'UPDATE_SYNC_REFRESH_FRAMES', $sJsLink); $form->add("submit", ''); $sSyncButton = ''; $sSyncButtonMultiple = ''; $content = '
' . $form->render() . '
' . $sSyncButton . $sSyncButtonMultiple . '
'; $oListOptionRow->setContentData($content); $oTpl->set('s', 'SYNCRONIZATION', $oListOptionRow->render()); $oTpl->set('s', 'SYNCLINK', $sListId); $sSyncLink = $sess->url($selflink . "?area=$area&frame=2&action=con_synccat"); $oTpl->set('s', 'SYNC_HREF', $sSyncLink); } else { $oTpl->set('s', 'SYNCRONIZATION', ''); $oTpl->set('s', 'SYNCLINK', $sListId); $oTpl->set('s', 'SYNC_HREF', ''); } /* * necessary for expanding/collapsing of navigation tree per javascript/AJAX (I. van Peeren) */ $oTpl->set('s', 'AREA', $area); $oTpl->set('s', 'SESSION', $contenido); $oTpl->set('s', 'AJAXURL', $cfg['path']['contenido_fullhtml'] . 'ajaxmain.php'); ########################################## # Help ########################################## $oTpl->set('s', 'HELPSCRIPT', setHelpContext("con")); $oTpl->generate($cfg['path']['templates'] . $cfg['templates']['con_left_top']);