diff --git a/conlite/classes/cApi/class.nav.main.php b/conlite/classes/cApi/class.nav.main.php index 5d10255..b1863b5 100644 --- a/conlite/classes/cApi/class.nav.main.php +++ b/conlite/classes/cApi/class.nav.main.php @@ -1,4 +1,5 @@ _setItemClass("cApiNavMain"); } + + public function create($sName, $sLocation, $iId = NULL) { + $oItem = $this->createNewItem($iId); + if ($oItem->isLoaded()) { + $oItem->set('name', $name); + $oItem->set('location', $location); + $oItem->store(); + return $oItem; + } + } + } class cApiNavMain extends Item { + public function __construct($mId = false) { global $cfg; parent::__construct(cRegistry::getConfigValue('tab', 'nav_main'), 'idnavm'); @@ -28,4 +41,5 @@ class cApiNavMain extends Item { $this->loadByPrimaryKey($mId); } } -} \ No newline at end of file + +} diff --git a/conlite/classes/class.genericdb.php b/conlite/classes/class.genericdb.php index d9788c8..1a2d387 100644 --- a/conlite/classes/class.genericdb.php +++ b/conlite/classes/class.genericdb.php @@ -1153,7 +1153,14 @@ abstract class ItemCollection extends cItemBaseAbstract public function createNewItem($aData = NULL) { /* @var $oDb DB_ConLite */ $oDb = $this->_getSecondDBInstance(); - $iNextId = $oDb->nextid($this->table); + if(is_null($aData) || empty($aData)) { + $iNextId = $oDb->nextid($this->table); + } else if(is_array($aData) && key_exists($this->primaryKey, $aData)) { + $iNextId = (int) $aData[$this->primaryKey]; + } else { + $iNextId = (int) $aData; + } + $sql = 'INSERT INTO `%s` (%s) VALUES (%d)'; $oDb->query($sql, $this->table, $this->primaryKey, $iNextId); return $this->loadItem($iNextId); diff --git a/conlite/classes/class.navigation.php b/conlite/classes/class.navigation.php index eedb3b6..42bafd4 100644 --- a/conlite/classes/class.navigation.php +++ b/conlite/classes/class.navigation.php @@ -1,4 +1,5 @@ plugxml->valueOf($xpath); - } else { $caption = $this->xml->valueOf($location); } @@ -137,20 +133,19 @@ class Contenido_Navigation { return $caption; } - - /** - * Reads and fills the navigation structure data - * - * @return void - */ + /** + * Reads and fills the navigation structure data + * + * @return void + */ function _buildHeaderData() { global $cfg, $perm, $belang; - $db = new DB_ConLite(); + $db = new DB_ConLite(); $db2 = new DB_ConLite(); # Load main items - $sql = "SELECT idnavm, location FROM ".$cfg['tab']['nav_main']." ORDER BY idnavm"; + $sql = "SELECT idnavm, location FROM " . $cfg['tab']['nav_main'] . " ORDER BY idnavm"; $db->query($sql); @@ -166,9 +161,9 @@ class Contenido_Navigation { $sql = "SELECT a.location AS location, b.name AS area, b.relevant FROM - ".$cfg['tab']['nav_sub']." AS a, ".$cfg['tab']['area']." AS b + " . $cfg['tab']['nav_sub'] . " AS a, " . $cfg['tab']['area'] . " AS b WHERE - a.idnavm = '".$db->f('idnavm')."' AND + a.idnavm = '" . $db->f('idnavm') . "' AND a.level = '0' AND b.idarea = a.idarea AND a.online = '1' AND @@ -180,13 +175,12 @@ class Contenido_Navigation { while ($db2->next_record()) { $area = $db2->f('area'); - if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0){ + if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0) { # Extract names from the XML document. $name = $this->getName($db2->f('location')); $this->data[$db->f('idnavm')][] = array($name, $area); } } - } # debugging information @@ -195,7 +189,6 @@ class Contenido_Navigation { } } - /** * Function to build the Contenido header document for backend * @@ -208,7 +201,7 @@ class Contenido_Navigation { $this->_buildHeaderData(); $main = new Template(); - $sub = new Template(); + $sub = new Template(); $cnt = 0; $t_sub = ''; @@ -224,7 +217,7 @@ class Contenido_Navigation { foreach ($item as $key => $value) { if (is_array($value)) { - $sub->set('s', 'SUBID', 'sub_'.$id); + $sub->set('s', 'SUBID', 'sub_' . $id); // create sub menu link $link = new cHTMLLink(); @@ -236,7 +229,7 @@ class Contenido_Navigation { $link->setContent($value[0]); if ($cfg['help'] == true) { - $sJsEvents .= "\n\t" . '$("#sub_' . $value[1] . '").click(function(){ $("#help").attr("data", "'.$value[1].'"); });'; + $sJsEvents .= "\n\t" . '$("#sub_' . $value[1] . '").click(function(){ $("#help").attr("data", "' . $value[1] . '"); });'; } $sub->set('d', 'CAPTION', $link->render()); @@ -257,7 +250,6 @@ class Contenido_Navigation { $main->next(); $numSubMenus++; - } else { # first entry in array is a main menu item } @@ -266,7 +258,7 @@ class Contenido_Navigation { $t_sub .= $sub->generate($cfg['path']['templates'] . $cfg['templates']['submenu'], true); $cnt ++; } - + if ($cfg['help'] == true) { $sJsEvents .= "\n\t" . 'help.setArea("mycontenido");'; } @@ -284,8 +276,8 @@ class Contenido_Navigation { $oMyConLink->setTargetFrame('content'); $oMyConLink->attachEventDefinition('help_mycontenido', 'onclick', 'help.setArea("mycontenido")'); $oMyConLink->setLink($sess->url("frameset.php?area=mycontenido&frame=4")); - $oMyConLink->setContent('MyContenido'); - $main->set('s', 'MYCONTENIDO', $oMyConLink->render()); + $oMyConLink->setContent('MyConLite'); + $main->set('s', 'MYCONLITE', $oMyConLink->render()); // info link $oInfoLink = new cHTMLLink(); @@ -293,7 +285,7 @@ class Contenido_Navigation { $oInfoLink->setTargetFrame('content'); $oInfoLink->attachEventDefinition('help_info', 'onclick', 'help.setArea("info")'); $oInfoLink->setLink($sess->url('frameset.php?area=info&frame=4')); - $oInfoLink->setContent('Info'); + $oInfoLink->setContent('Info'); $main->set('s', 'INFO', $oInfoLink->render()); $main->set('s', 'LOGOUT', $sess->url('logout.php')); @@ -305,7 +297,7 @@ class Contenido_Navigation { $oHelpLink->setClass('main'); $oHelpLink->setLink('javascript://'); $oHelpLink->setEvent('click', 'callHelp($(\'#help\').attr(\'data\'));'); - $oHelpLink->setContent('Hilfe'); + $oHelpLink->setContent('Hilfe'); $main->set('s', 'HELP', $oHelpLink->render()); } else { $main->set('s', 'HELP', ''); @@ -321,9 +313,9 @@ class Contenido_Navigation { } else { // set delay menu $mouseOver = getEffectiveSetting('system', 'delaymenu_mouseover', 300); - $mouseOot = getEffectiveSetting('system', 'delaymenu_mouseout', 1000); + $mouseOot = getEffectiveSetting('system', 'delaymenu_mouseout', 1000); $main->set('s', 'HEADER_MENU_OBJ', 'HeaderDelayMenu'); - $main->set('s', 'HEADER_MENU_OPTIONS', '{menuId: "main_0", subMenuId: "sub_0", mouseOverDelay: '.$mouseOver.', mouseOutDelay: '.$mouseOot.'}'); + $main->set('s', 'HEADER_MENU_OPTIONS', '{menuId: "main_0", subMenuId: "sub_0", mouseOverDelay: ' . $mouseOver . ', mouseOutDelay: ' . $mouseOot . '}'); } $main->set('s', 'ACTION', $sess->url('index.php')); @@ -334,30 +326,30 @@ class Contenido_Navigation { if (strlen($sClientName) > 25) { $sClientName = capiStrTrimHard($sClientName, 25); } - - $client = Contenido_Security::toInteger($client); - if ( $client == 0 ) { - $sClientNameTemplate = '' . i18n("Client") . ': %s'; - $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientName)); - } else { - $sClientNameTemplate = '' . i18n("Client") . ': %s'; - - $sClientName = $classclient->getClientName($client).' ('.$client.')'; - $sClientUrl = $cfgClient[$client]["path"]["htmlpath"]; - if ($clientImage !== false && $clientImage != "" && file_exists($cfgClient[$client]['path']['frontend'].$clientImage)) { - $sClientImageTemplate = '%s'; - - $sThumbnailPath = capiImgScale($cfgClient[$client]['path']['frontend'].$clientImage, 80, 25, 0, 1); - $sClientImageTag = sprintf($sClientImageTemplate, $sThumbnailPath, $sClientName, $sClientName); - - $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientImageTag)); - } else { - $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientName)); - } - } - - $main->set('s', 'CHOSENUSER', "".i18n("User").": ".$classuser->getRealname($auth->auth["uid"], true)); + $client = Contenido_Security::toInteger($client); + if ($client == 0) { + $sClientNameTemplate = '' . i18n("Client") . ': %s'; + $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientName)); + } else { + $sClientNameTemplate = '' . i18n("Client") . ': %s'; + + $sClientName = $classclient->getClientName($client) . ' (' . $client . ')'; + $sClientUrl = $cfgClient[$client]["path"]["htmlpath"]; + + if ($clientImage !== false && $clientImage != "" && file_exists($cfgClient[$client]['path']['frontend'] . $clientImage)) { + $sClientImageTemplate = '%s'; + + $sThumbnailPath = capiImgScale($cfgClient[$client]['path']['frontend'] . $clientImage, 80, 25, 0, 1); + $sClientImageTag = sprintf($sClientImageTemplate, $sThumbnailPath, $sClientName, $sClientName); + + $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientImageTag)); + } else { + $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientName)); + } + } + + $main->set('s', 'CHOSENUSER', "" . i18n("User") . ": " . $classuser->getRealname($auth->auth["uid"], true)); $main->set('s', 'SID', $sess->id); $main->set('s', 'MAINLOGINLINK', $sess->url("frameset.php?area=mycontenido&frame=4")); @@ -371,7 +363,6 @@ class Contenido_Navigation { $main->generate($cfg['path']['templates'] . $cfg['templates']['header']); } - /** * Renders the language select box * @@ -379,8 +370,7 @@ class Contenido_Navigation { * * @return string */ - function _renderLanguageSelect() - { + function _renderLanguageSelect() { global $cfg, $client, $lang; $tpl = new Template(); @@ -402,13 +392,13 @@ class Contenido_Navigation { if ($availableLanguages->count() > 0) { while ($myLang = $availableLanguages->nextAccessible()) { - $key = $myLang->get('idlang'); + $key = $myLang->get('idlang'); $value = $myLang->get('name'); // I want to get rid of such silly constructs very soon :) - $sql = "SELECT idclient FROM ".$cfg['tab']['clients_lang']." WHERE - idlang = '".Contenido_Security::toInteger($key)."'"; + $sql = "SELECT idclient FROM " . $cfg['tab']['clients_lang'] . " WHERE + idlang = '" . Contenido_Security::toInteger($key) . "'"; $db->query($sql); @@ -425,7 +415,7 @@ class Contenido_Navigation { } $tpl->set('d', 'VALUE', $key); - $tpl->set('d', 'CAPTION', $value.' ('.$key.')'); + $tpl->set('d', 'CAPTION', $value . ' (' . $key . ')'); $tpl->next(); } } @@ -438,4 +428,5 @@ class Contenido_Navigation { return $tpl->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); } + } diff --git a/conlite/plugins/mod_rewrite/classes/class.modrewrite.php b/conlite/plugins/mod_rewrite/classes/class.modrewrite.php index 260715f..03a8777 100644 --- a/conlite/plugins/mod_rewrite/classes/class.modrewrite.php +++ b/conlite/plugins/mod_rewrite/classes/class.modrewrite.php @@ -53,7 +53,6 @@ class ModRewrite extends ModRewriteBase { */ public static function initialize($clientId) { mr_loadConfiguration($clientId, true); - parent::initialize(); self::$_db = new DB_Contenido(); self::$_lookupTable = array(); } diff --git a/conlite/scripts/contextMenu.js b/conlite/scripts/contextMenu.js deleted file mode 100644 index 2a44f75..0000000 --- a/conlite/scripts/contextMenu.js +++ /dev/null @@ -1,112 +0,0 @@ -var display_url; - -function createMenu (menuname, items, links) -{ - document.writeln('
'); - document.writeln('
Context Menu
'); - for (var i=0;i'); - } else { - document.writeln(''); - } - } - - document.writeln('
'); - - document.getElementById(menuname).style.display=''; -} - -var ie5=document.all&&document.getElementById -var ns6=document.getElementById&&!document.all -if (ie5||ns6) -//var menuobj=document.getElementById("ie5menu") - -function showmenuie5(e){ - -if (ie5) -{ - menuobj = document.getElementById(window.event.srcElement.getAttribute("helpid")); -} else -{ - menuobj = document.getElementById(e.target.getAttribute("helpid")); -} - - -//Find out how close the mouse is to the corner of the window -var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX -var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY - -//if the horizontal distance isn't enough to accomodate the width of the context menu -if (rightedge'); + document.writeln('
Context Menu
'); + for (var i = 0; i < items.length; i++) + { + if (items[i] == "--") + { + document.writeln('
'); + } else { + document.writeln(''); + } + } + + document.writeln(''); + document.getElementById(menuname).style.display = ''; + } + +var ie5 = document.all && document.getElementById + var ns6 = document.getElementById && !document.all + if (ie5 || ns6) +//var menuobj=document.getElementById("ie5menu") + + function showmenuie5(e){ + + if (ie5) + { + menuobj = document.getElementById(window.event.srcElement.getAttribute("helpid")); + } else + { + menuobj = document.getElementById(e.target.getAttribute("helpid")); + } + + +//Find out how close the mouse is to the corner of the window + var rightedge = ie5? document.body.clientWidth - event.clientX : window.innerWidth - e.clientX + var bottomedge = ie5? document.body.clientHeight - event.clientY : window.innerHeight - e.clientY + +//if the horizontal distance isn't enough to accomodate the width of the context menu + if (rightedge < menuobj.offsetWidth) +//move the horizontal position of the menu to the left by it's width + menuobj.style.left = ie5? document.body.scrollLeft + event.clientX - menuobj.offsetWidth : window.pageXOffset + e.clientX - menuobj.offsetWidth + else +//position the horizontal position of the menu where the mouse was clicked + menuobj.style.left = ie5? document.body.scrollLeft + event.clientX : window.pageXOffset + e.clientX + +//same concept with the vertical position + if (bottomedge < menuobj.offsetHeight) + menuobj.style.top = ie5? document.body.scrollTop + event.clientY - menuobj.offsetHeight : window.pageYOffset + e.clientY - menuobj.offsetHeight + else + menuobj.style.top = ie5? document.body.scrollTop + event.clientY : window.pageYOffset + e.clientY + + menuobj.style.visibility = "visible" + + + return false; + + } + +function hidemenuie5(e){ +if (typeof menuobj == "object") +{ +menuobj.style.visibility = "hidden" +} +} + +function highlightie5(e){ +var firingobj = ie5? event.srcElement : e.target + if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ +if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode //up one node + firingobj.style.backgroundColor = "#F4F8BD" + firingobj.style.color = "black" + firingobj.style.cursor = "pointer" + if (display_url == 1) + window.status = event.srcElement.url +} +} + +function lowlightie5(e){ +var firingobj = ie5? event.srcElement : e.target + if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ +if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode //up one node + firingobj.style.backgroundColor = "" + firingobj.style.color = "black" + window.status = '' +} +} + +function jumptoie5(e){ +var firingobj = ie5? event.srcElement : e.target + if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ +if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode + if (firingobj.getAttribute("target")) + window.open(firingobj.getAttribute("url"), firingobj.getAttribute("target")) + else + window.location = firingobj.getAttribute("url") +} +} + +var menuobj; + if (ie5 || ns6){ +//menuobj.style.display='' +document.oncontextmenu = showmenuie5 + document.onclick = hidemenuie5 +} \ No newline at end of file diff --git a/conlite/templates/standard/header.html b/conlite/templates/standard/header.html index 47c75ba..372ef9c 100644 --- a/conlite/templates/standard/header.html +++ b/conlite/templates/standard/header.html @@ -40,7 +40,7 @@
{LANG} - {MYCONTENIDO} + {MYCONLITE} {INFO} {HELP} @@ -67,7 +67,7 @@ {HEADER_MENU_OBJ}.initialize({HEADER_MENU_OPTIONS}); ContenidoRegistry.set("headerMenu", {HEADER_MENU_OBJ}); - $(["#head_logo", "#imgMyContenido", "#imgInfo"]).click(function(){ + $(["#head_logo", "#imgMyContenidoontenido", "#imgInfo"]).click(function(){ resetHeaderMenu(); }); });