Esempio n. 1
0
 function init()
 {
     global $gorumroll;
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.curvycorners.js");
     JavaScript::addInclude(THEME_DIR . "/javascripts/modern.js");
     if (($gorumroll->list == "item" || $gorumroll->list == "user") && $gorumroll->method == "showdetails") {
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.preload.js");
         JavaScript::addOnload("\n          \$('.smallpic img').preload({\n              find:'small',\n              replace:'large'\n          });\n          \$('.smallpic a').hover(function(){\n              var dim = \$(this).find('img').attr('rel').split('x');\n              var src = \$(this).find('img').attr('src');\n              \$('.mainpic img').attr({\n                  src: src.replace('small','large'),\n                  width: dim[0],\n                  height: dim[1]\n              });\n              \$('.mainpic a').attr('href', this.href);\n          },function(){});\n        ");
     }
 }
Esempio n. 2
0
 function createForm($elementName = "")
 {
     global $gorumroll, $lll;
     $_S =& new AppSettings();
     $this->cid = $gorumroll->rollid;
     $this->activateVariableFields();
     Object::createForm($elementName);
     JavaScript::addInclude(GORUM_JS_DIR . "/core.js");
     // a multipleSelectionManager miatt
     $_S->handleCategorySelect("itemsearch-create_form");
 }
Esempio n. 3
0
 function initializeSystemSettings()
 {
     global $dbHost, $dbUser, $dbUserPw, $dbName, $includeDumpJs;
     global $gorumroll, $speedStopWatch, $gorumview, $jQueryLib;
     $_GET = filterInput($_GET);
     $_COOKIE = filterInput($_COOKIE);
     $_SERVER = filterInput($_SERVER);
     $_FILES = filterInput($_FILES);
     if (class_exists("speedstat")) {
         $speedStopWatch = new Stopwatch();
         $speedStopWatch->start();
     }
     ini_set("session.use_cookies", 1);
     ini_set("session.use_only_cookies", 1);
     ini_set("session.use_trans_sid", 0);
     if (!session_id()) {
         session_start();
     }
     $this->kbfu = chr(103) . chr(111) . chr(114) . chr(117) . chr(109) . chr(117) . chr(115) . chr(101) . chr(114);
     $this->kbfk = chr(105) . chr(115) . chr(65) . chr(100) . chr(109);
     $this->kbfr = chr(103) . chr(111) . chr(114) . chr(117) . chr(109) . chr(114) . chr(101) . chr(99) . chr(111) . chr(103) . chr(110) . chr(105) . chr(115) . chr(101) . chr(100);
     // http://hu.php.net/manual/en/reserved.variables.session.php#85448:
     // azert, hogy az infoTextek ne ragadjanak be:
     if (ini_get('register_globals')) {
         foreach ($_SESSION as $key => $value) {
             if (isset($GLOBALS[$key])) {
                 unset($GLOBALS[$key]);
             }
         }
     }
     connectDb($dbHost, $dbUser, $dbUserPw, $dbName);
     authenticate();
     $gorumroll = new Roll();
     $gorumroll->isAction() ? include GORUM_DIR . "/gorum_action.php" : (include GORUM_DIR . "/gorum_view.php");
     $this->initializeUserSettings();
     if (class_exists("cronjob")) {
         executeCronJobs();
     }
     if (!$gorumroll->isAction()) {
         $gorumview = new View();
         $gorumview->addElement("contentTemplate");
         View::init();
     }
     if ($includeDumpJs && !$gorumroll->isAction()) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dump.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/dump.js");
     }
     $this->kbf();
 }
Esempio n. 4
0
 function init()
 {
     global $curvyCorners, $jQueryLib;
     if (!empty($curvyCorners)) {
         //JavaScript::addInclude(GORUM_DIR . "/js/niftycube.js");
         //JavaScript::addCss(GORUM_DIR . "/js/niftyCorners.css");
         //JavaScript::addOnload("
         //    Nifty('div.template','normal');
         //");
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.curvycorners.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.livequery.js");
         JavaScript::addOnload("\$.noah.addCurvyCornersToPresentationDivs();");
     }
 }
Esempio n. 5
0
 function createForm()
 {
     global $gorumroll, $jQueryLib, $fieldset_typ;
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dimensions.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/field.js");
     JavaScript::addInclude(JS_DIR . "/fieldset_form.js");
     $this->cid = $gorumroll->rollid;
     // A deleteAll es cloneToSubcats mezoket csak akkor tesszuk ki, ha van ertelmuk:
     getDbCount($subcatNum, array("SELECT COUNT(*) FROM @category WHERE up=#cid#", $this->cid));
     if (!$subcatNum || !$this->cid) {
         $fieldset_typ["attributes"]["cloneToSubcats"][] = "form invisible";
     }
     getDbCount($nonFixFieldNum, array("SELECT COUNT(*) FROM @customfield WHERE cid=#cid# AND columnIndex LIKE 'col_%'", $this->cid));
     if (!$nonFixFieldNum) {
         $fieldset_typ["attributes"]["deleteAll"][] = "form invisible";
     }
     parent::createForm();
 }
Esempio n. 6
0
 function ListPresentation(&$base, $typ = 0)
 {
     global $gorumroll, $jQueryLib;
     $this->Presentation($base, "list", $typ);
     $this->tableSort = G::getSetting($this->typ, "clientSideTableSort");
     $this->tableFilter = G::getSetting($this->typ, "clientSideTableFilter", "enable");
     $this->tableRowHighlight = G::getSetting($this->typ, "tableRowHighlight");
     $this->zebraList = G::getSetting($this->typ, "zebraList");
     if ($this->tableSort || $this->tableFilter || $this->tableRowHighlight) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     }
     if ($this->tableSort || $this->tableFilter) {
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/tablesort.js");
         if ($this->tableFilter) {
             require_once GORUM_DIR . "/presentation/filter.php";
             $this->tableFilter =& new Filter($this->typ);
         }
     }
     if ($this->tableRowHighlight) {
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/tablehover.js");
     }
 }
Esempio n. 7
0
 function applyCodeBlockSubstitution($s)
 {
     $s = preg_replace_callback('/(\\<code class="[^"]+"\\>)(.*)(\\<\\/code\\>)/isU', create_function('$m', 'return $m[1].htmlspecialchars($m[2]).$m[3];'), $s, -1, $count);
     if ($count) {
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/chili/jquery.chili-2.2.js");
         JavaScript::addScript('ChiliBook.recipeFolder = "' . GORUM_JS_DIR . '/jquery/chili/";');
         JavaScript::addCss(GORUM_JS_DIR . "/jquery/chili/chili.css");
     }
     return $s;
 }
Esempio n. 8
0
 function showSelector($what)
 {
     global $lll;
     $_S =& new AppSettings();
     if (!$_S->{"allowSelect{$what}"}) {
         return "";
     }
     $labels = array($lll["change{$what}"]);
     $values = array("0");
     $allowedItems = explode(",", $_S->{"allowed{$what}s"});
     foreach ($allowedItems as $item) {
         $values[$item] = $item;
         if (isset($lll["allowed{$what}s_{$item}"])) {
             $labels[$item] = $lll["allowed{$what}s_{$item}"];
         } else {
             $labels[$item] = str_replace("_", " ", $item);
         }
     }
     JavaScript::addInclude(GORUM_JS_DIR . "/cookie.js");
     $base = Controller::getBaseUrl();
     JavaScript::addOnload("\$.noah.themeSelectorWidget(" . G::js($what, $base) . ")");
     return GenerWidget::generSelectField("{$what}SelectorWidget", $labels, $values, "{$what}SelectorWidget", "0");
 }
Esempio n. 9
0
 function initClueTip()
 {
     global $jQueryLib;
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dimensions.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.hoverIntent.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.bgiframe.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/cluetip/jquery.cluetip.js");
 }
Esempio n. 10
0
 function setupCustomListAppearance($elementName)
 {
     global $lll, $item_typ, $jQueryLib, $curvyCorners, $gorumroll;
     // ha tobb item list is van egy oldalon, mindegyiknek teljesen kulonbozo typeinfo-ja lehet:
     include "item_typ.php";
     // resetting $item_typ
     CustomField::addCustomColumns("item");
     $lll["item_search_ttitle"] = htmlspecialchars($this->listTitle);
     $columns = $gorumroll->list == "export" ? $this->exportFields : $this->columns;
     G::load($columns, "SELECT * FROM @itemfield WHERE FIND_IN_SET(id, '{$columns}')!=0");
     $item = new Item();
     $item_typ["listOrder"] = array();
     foreach (explode(",", $this->columns) as $id) {
         for ($i = 0; $i < count($columns); $i++) {
             if ($columns[$i]->id == $id) {
                 $columns[$i]->showInList = 1;
                 if (!$columns[$i]->customListPlacement) {
                     $item_typ["listOrder"][] = $columns[$i]->columnIndex;
                 }
                 $item_typ["attributes"][$columns[$i]->columnIndex][] = "list";
                 if ($columns[$i]->customListPlacement) {
                     $item_typ["attributes"][$columns[$i]->columnIndex][] = "customListPlacement";
                 }
                 break;
             }
         }
     }
     $item->fields =& $columns;
     $item->cid = $this->cid;
     $item->activateVariableFields();
     $item->fields = 0;
     CustomList::getSortingSql($this->primarySort, $this->primaryDir, $this->primaryPersistent, $this->secondarySort, $this->secondaryDir, $this->secondaryPersistent);
     if ($specialSortAttrs = $item->getSpecialSortAttrs($this->cid ? 0 : 1, $this->cid)) {
         $this->query = str_replace("n.*", "n.* {$specialSortAttrs}", $this->query);
     }
     if ($this->limit) {
         $item_typ["limit"] = $this->limit;
     }
     if ($this->listStyle != customlist_scrollable && $gorumroll->list != "export") {
         $_S =& new AppSettings();
         if ($this->customAdListTemplate) {
             $item_typ["listTemplate"] = $this->customAdListTemplate;
         } elseif ($_S->customAdListTemplate) {
             $item_typ["listTemplate"] = $_S->customAdListTemplate;
         }
     }
     //var_dump($item_typ);
     if ($this->listStyle == customlist_scrollable && $gorumroll->list != "export") {
         // Neheny szajton, az orientattiont egyszeruen nem tudtam a typeInfoban atvinni a
         // item_scrollablepresentationbe - kenytelen voltan globalba tenni:
         global $scrollablePlacement, $orientation;
         if (!isset($item_typ["listTemplate"])) {
             $item_typ["listTemplate"] = "scrollable_widget.tpl.php";
         }
         $item_typ["listPresentationClassName"] = "ItemScrollablePresentation";
         $params = "";
         $scrollablePlacement = $elementName;
         if ($elementName == "customListLeft" || $elementName == "customListRight") {
             $item_typ["scrollableOrientation"] = $orientation = "vertical";
             $scrollableParams = "vertical: true";
         } else {
             $scrollableParams = "vertical: false";
             $item_typ["scrollableOrientation"] = $orientation = "horizontal";
         }
         if ($this->loop) {
             $scrollableParams .= ", loop: true";
         }
         include_once NOAH_APP . "/item_scrollablepresentation.php";
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dimensions.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.center.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.scrollable.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.em.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.jscrollpane.js");
         JavaScript::addInclude(JS_DIR . "/scrollable.js");
         JavaScript::addCss(CSS_DIR . "/scrollable.css");
         JavaScript::addCss(GORUM_JS_DIR . "/jquery/jscrollpane.css");
         JavaScript::addOnload("\$.noah.globalScrollableOnLoad();", "scrollable");
         JavaScript::addOnload("\$.noah.scrollableOnLoad(" . G::js($this->id, $elementName, $scrollableParams) . ");");
         if ($this->autoScroll) {
             JavaScript::addOnload("\$.noah.autoscrollOnLoad(" . G::js($this->id, $elementName, $this->autoScroll) . ");");
         }
     }
 }
Esempio n. 11
0
 function processContent(&$tpl)
 {
     global $lll, $gorumroll, $list2Colors, $jQueryLib;
     $tpl->assign("zebraDetails", $this->zebraDetails);
     $tpl->assign("listAndMethod", "{$gorumroll->list}-{$gorumroll->method}");
     $tpl->assign("detailsMethods", "");
     $class = $this->base->get_class();
     $attrs = $this->typ["attributes"];
     $this->base->hasGeneralRights($rights);
     $attributeList = isset($this->typ["order"]) ? $this->typ["order"] : array_keys($this->typ["attributes"]);
     $headerMethods = array();
     if ($s = $this->base->showModTool($rights)) {
         $headerMethods[] = $s;
     }
     if ($s = $this->base->showDelTool($rights)) {
         $headerMethods[] = $s;
     }
     $tpl->assign("headerMethods", $headerMethods);
     $tpl->assign("title", sprintf($lll["detail_info"], ucfirst($lll[$class])));
     $rows = $customCss = array();
     $pictures = array();
     $sideBarContent = array("fields" => array(), "top" => array(), "bottom" => array());
     $mainPicture = "";
     $picFieldExists = FALSE;
     foreach ($attributeList as $attr) {
         $val =& $this->typ["attributes"][$attr];
         $valTxt = "";
         $customPlacement = in_array("customDetailsPlacement", $val);
         if (in_array("details", $val)) {
             if (isset($val["customCss"])) {
                 $customCss[$attr] = $val["customCss"];
             }
             if (isset($val["sidebar"])) {
                 $valTxt = $this->base->showListVal($attr);
                 if (!$customPlacement) {
                     $sideBarContent["fields"][] = $attr;
                     $sideBarContent[$val["sidebar"]][] = $valTxt;
                 }
             }
             if (in_array("section", $val)) {
                 if (isset($lll[$attr])) {
                     $rows[$attr] = array("separator" => $lll[$attr]);
                 }
             } elseif (in_array("widecontent_details", $val)) {
                 if (!($valTxt = $this->base->showListVal($attr))) {
                     $valTxt = "&nbsp;";
                 }
                 if (!$customPlacement) {
                     $rows[$attr] = array("widecontent" => $valTxt);
                 }
             } elseif (in_array("notable", $val)) {
                 $valTxt = $this->base->showListVal($attr);
                 if (!$customPlacement) {
                     $rows[$attr] = array("notable" => $valTxt);
                 }
             } else {
                 if (!in_array("file", $val) || in_array("media", $val)) {
                     $lllProp =& new LllProperties($this->base, $attr);
                     $txt = $lllProp->getLabel();
                     if (($valTxt = $this->base->showListVal($attr)) === "") {
                         $valTxt = "&nbsp;";
                     }
                     if (!$customPlacement) {
                         $rows[$attr] = array("label" => $txt, "value" => $valTxt);
                     }
                 } else {
                     if (!$customPlacement) {
                         $picFieldExists = TRUE;
                     }
                     if (in_array("pictureTag", $val)) {
                         $valTxt = $this->base->showPicture($attr, "large");
                         if (!$customPlacement) {
                             $mainPicture = $valTxt;
                         }
                         $valTxt = $valTxt["tag"];
                     }
                     $pic = $this->base->showPicture($attr, "small");
                     if (!in_array("pictureTag", $val)) {
                         $valTxt = $pic["tag"];
                     }
                     if ($pic["tag"] && !$customPlacement) {
                         $pictures[] = $pic;
                     }
                 }
             }
         } elseif (!in_array("section", $val)) {
             $valTxt = $this->base->showListVal($attr);
         }
         if (!in_array("section", $val)) {
             if (!stristr($attr, "password") && ($cf = $this->base->getField($attr)) !== FALSE && $cf->name) {
                 $tpl->{$cf->name} = $valTxt;
             }
         }
     }
     if (!$picFieldExists) {
         $pictures = FALSE;
     }
     if (class_exists("rss")) {
         JavaScript::addCss(CSS_DIR . "/thickbox.css");
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/thickbox.js");
     }
     if ($picFieldExists && empty($mainPicture["tag"])) {
         if (count($pictures)) {
             $mainPicture = $pictures[0];
         } else {
             $mainPicture["tag"] = $this->base->showEmptyPicture();
         }
     }
     $tpl->assign("rows", $rows);
     $tpl->assign("customCss", $customCss);
     $tpl->assign("pictures", $pictures);
     $tpl->assign("sideBarContent", $sideBarContent);
     $tpl->assign("mainPicture", $mainPicture);
 }
Esempio n. 12
0
 function organizeFormAlternative()
 {
     global $gorumroll, $contentSeparator, $lll, $tA;
     $_S =& new AppSettings();
     $contentSeparator = "";
     $tA["appcategory-organize_form"] = $tA["appcategory-organize_form-alternative"];
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.alphanumeric.js");
     JavaScript::addOnload("\$('#appcategory-showhtmllist input:text').numeric();");
     JavaScript::addCss(CSS_DIR . "/checkconf.css");
     $lll["appcategory_ttitle"] = $lll["alwaysUseAlternativeOrganizer"];
     $lll["appcategory_ttitle"] .= GenerWidget::generBoolField("alternativeOrganizer", "", $_S->alternativeOrganizer);
     $ctrl =& new AppController("cat/list/alternative");
     $gorumroll->processMethod($ctrl, "categoryList");
 }
Esempio n. 13
0
 function handleCategorySelect($tableId)
 {
     global $gorumroll, $jQueryLib;
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(JS_DIR . "/categoryselect.js");
     if ($this->cascadingCategorySelectEnabled() && !$gorumroll->rollid && $gorumroll->list != "customlist") {
         $ctrl =& new AppController("cat/get_one_level_of_categories");
         // Ajax target
         $url = $ctrl->makeUrl();
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.livequery.js");
         JavaScript::addScript("\$JQ.noah.addNextSelectRow(" . G::js($url, "subCategory", $tableId) . ");");
         JavaScript::addOnload("\$.noah.cascadingSelectOnLoad('{$tableId}');");
     } elseif (!$this->cascadingCategorySelectEnabled() || $gorumroll->list == "customlist") {
         JavaScript::addOnload("\$.noah.simpleCategoryReload();");
     }
 }
Esempio n. 14
0
 function generMultipleSelection($name, &$listNames, &$listValues, $selected, $listSize, $width = 0, $showRelation = "", $anyfield = "", $asmSelect = 0, $asmSelectLabel = "")
 {
     global $lll, $jQueryLib;
     $selected = splitByCommas($selected);
     if ($asmSelect) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         if (preg_match("/sortable:\\s*true/", $asmSelect)) {
             JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.dimensions.js");
             JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.ui.js");
         }
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.asmselect.js");
         JavaScript::addCss(GORUM_JS_DIR . "/jquery/jquery.asmselect.css");
         $asmSelect = preg_replace_callback("/(removeLabel|modifyLabel|addButtonLabel|modifyButtonLabel): '([^']+)'/m", create_function('$matches', 'global $lll; return $matches[1].": \'".$lll[$matches[2]]."\'";'), $asmSelect);
         JavaScript::addOnload("\$('#{$name}').asmSelect({$asmSelect});");
         // hogy egy modify formban a kivalasztottak listajanak sorrendje ugyanaz legyen,
         // mint amit mar egyszer elmentettunk:
         if (count($selected) > 1) {
             $tempSelected = $selected;
             for ($i = 0, $helpArr = array(); $i < count($listValues); $i++) {
                 $helpArr[$listValues[$i]] = $listNames[$i];
             }
             for ($i = 0; $i < count($listValues); $i++) {
                 if (in_array($listValues[$i], $selected)) {
                     $listValues[$i] = array_shift($tempSelected);
                     $listNames[$i] = $helpArr[$listValues[$i]];
                 }
             }
         }
     }
     $s = "\n<select id='{$name}' name='{$name}" . "[]' size='{$listSize}' ";
     if ($width > 0) {
         $s .= "width='{$width}' style='width:{$width}px;' ";
     }
     if ($asmSelectLabel) {
         $s .= "title='" . addcslashes($lll[$asmSelectLabel], "'") . "' ";
     }
     $s .= "multiple>\n";
     $length = count($listValues);
     if ($length) {
         foreach ($listValues as $key => $value) {
             $s .= "<option value=\"" . $value . "\"";
             if ($showRelation) {
                 if (isset($showRelation[$value])) {
                     $s .= " show='{$showRelation[$value]}_rel'";
                 } else {
                     $s .= " show='none'";
                 }
             }
             if (in_array($value, $selected)) {
                 $s .= " selected";
             }
             if ($anyfield == $value) {
                 $s .= " src='any'";
             }
             $s .= ">" . $listNames[$key] . "</option>\n";
         }
     } else {
         $s .= "<option value='0'>" . $lll["emptyList"] . "</option>\n";
     }
     $s .= "</select>\n";
     return $s;
 }
Esempio n. 15
0
 function OverlayController($param = 0, $id = 0)
 {
     global $lll, $gorumroll;
     static $counter = 0;
     static $objects = array();
     if (!$param) {
         return;
     }
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.overlay.js");
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.livequery.js");
     JavaScript::addCss(CSS_DIR . "/overlay.css");
     // $ajaxTarget-be gyujtjul a load fuggveny parameteret:
     $text = $ajaxTarget = "";
     if (is_string($param)) {
         $this->id = $id ? $id : "overlay_" . $counter++;
         $this->triggerSelector = "[rel=#{$this->id}]";
         $text = isset($lll[$param]) ? $lll[$param] : $param;
     } elseif (is_object($param)) {
         $this->id = $id ? $id : "overlay_" . $counter++;
         $this->triggerSelector = "[rel=#{$this->id}]";
         $ajaxTarget = "'" . $param->makeUrl() . "'";
     } else {
         if (isset($param["id"])) {
             $this->id = $param["id"];
             if (array_key_exists($this->id, $objects)) {
                 foreach (get_object_vars($objects[$this->id]) as $attr => $value) {
                     $this->{$attr} =& $objects[$this->id]->{$attr};
                 }
                 return;
             }
         } else {
             $this->id = "overlay_" . $counter++;
         }
         if (isset($param["class"])) {
             $this->class = $param["class"];
         }
         if (isset($param["ajaxFromHref"])) {
             $this->ajaxFromHref = $param["ajaxFromHref"];
         }
         if (isset($param["ajaxFromContent"])) {
             $this->ajaxFromContent = $param["ajaxFromContent"];
         }
         if (isset($param["triggerSelector"])) {
             $this->triggerSelector = $param["triggerSelector"];
         } else {
             $this->triggerSelector = "[rel=#{$this->id}]";
         }
         if (isset($param["content"])) {
             if (is_string($param["content"])) {
                 if (substr($param["content"], 0, 6) == "http://") {
                     $ajaxTarget = "'{$param['content']}'";
                 } elseif ($this->ajaxFromContent) {
                     $ctrl =& new AppController($param["content"]);
                     $ajaxTarget = "'" . $ctrl->makeUrl() . "'";
                 } else {
                     $text = isset($lll[$param["content"]]) ? $lll[$param["content"]] : $param["content"];
                 }
             } elseif (is_array($param["content"])) {
                 $text = call_user_func($param["content"]);
             } elseif (is_object($param["content"])) {
                 if ($this->ajaxFromContent) {
                     $ajaxTarget = "'" . $param["content"]->makeUrl() . "'";
                 } else {
                     $gorumroll->processMethod($param["content"], $this->id);
                     $tpl =& View::getView($this->id);
                     $text = $tpl->__toString();
                 }
             }
         }
         if ($this->ajaxFromHref) {
             $ajaxTarget = "this.getTrigger().attr('href')";
         }
         if (isset($param["expose"])) {
             $this->expose = $param["expose"];
         }
         if (isset($param["closeOnClick"])) {
             $this->closeOnClick = $param["closeOnClick"];
         }
         $this->closeOnClick = $this->closeOnClick ? 'true' : 'false';
         if (isset($param["postponeOnloadAction"])) {
             $this->postponeOnloadAction = $param["postponeOnloadAction"];
         }
         if (isset($param["speed"])) {
             $this->speed = $param["speed"];
         }
         if (isset($param["top"])) {
             $this->top = $param["top"];
         }
         if (isset($param["height"])) {
             $this->height = $param["height"];
         }
         if (isset($param["close"])) {
             $this->close = $param["close"];
         }
         if ($this->expose) {
             JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.expose.js");
             $this->onBeforeLoad = "function() { \n                this.getBackgroundImage().expose({\n                    speed: {$this->speed}, \n                    color: '#fff',\n                    closeOnClick: {$this->closeOnClick}\n                }); \n                /*insertionPoint*/\n            }";
             $this->onClose = "function() { \n                \$.expose.close();\t\t\t\n                /*insertionPoint*/\n            }";
         }
     }
     if ($ajaxTarget) {
         $onBeforeLoadForAjax = "\n            this.getContent().find('.ajaxOverlayContent').load({$ajaxTarget}, '', function(){\n                \$(this).find('.submitfooter input').eq(1).click( function() { \n                    \$('{$this->triggerSelector}').overlay().close(); \n                    return false; \n                });\n            }); \n            /*insertionPoint*/\n        ";
         if ($this->onBeforeLoad != 'null') {
             $this->onBeforeLoad = str_replace("/*insertionPoint*/", $onBeforeLoadForAjax, $this->onBeforeLoad);
         } else {
             $this->onBeforeLoad = "function() { {$onBeforeLoadForAjax} }";
         }
         $ajaxOverlayContent = "<div class='ajaxOverlayContent'></div>";
     } else {
         $ajaxOverlayContent = "";
     }
     // ha parameterben erkeznek callback JS sorok, akkor azokat a fentebb definialt callback body-k utan szurjuk be az /*insertionPoint*/ helyere:
     foreach (array("onLoad", "onBeforeLoad", "onClose") as $callback) {
         if (is_array($param) && isset($param[$callback]) && $this->{$callback} != 'null') {
             $this->{$callback} = str_replace("/*insertionPoint*/", $param[$callback], $this->{$callback});
         } elseif (is_array($param) && isset($param[$callback])) {
             $this->{$callback} = $param[$callback];
         } elseif ($this->{$callback} != 'null') {
             $this->{$callback} = str_replace("/*insertionPoint*/", "", $this->{$callback});
         }
     }
     // ajaxFromHref eseten, ha content-ben atadunk valamit, azt be lehet szurni az Ajax tartalom ele:
     $this->content = "<div id='{$this->id}' class='{$this->class}' style='height: {$this->height}px;'> \\\n                         <div class='close'></div>" . preg_replace("/\n|\r/", "", addcslashes($text, '"')) . "{$ajaxOverlayContent} \\\n                     </div>";
     $this->prependAction = "\$('body').prepend(\"{$this->content}\");";
     //var_dump($this->closeOnClick);
     $this->overlayAction = "\n    \$('{$this->triggerSelector}').livequery(function(){ \$(this).overlay({\n            onLoad: {$this->onLoad}, \n            onBeforeLoad: {$this->onBeforeLoad}, \n            onClose: {$this->onClose},\n            closeOnClick: {$this->closeOnClick},\n            speed: {$this->speed},\n            close: '{$this->close}'\n            });});\n    ";
     if (!$this->postponeOnloadAction) {
         JavaScript::addOnload($this->prependAction, $this->id);
         JavaScript::addOnload($this->overlayAction, $this->triggerSelector);
     }
     if (!isset($objects[$this->id])) {
         $objects[$this->id] = $this;
     }
 }
Esempio n. 16
0
 function generTextField($attr, $val)
 {
     global $jQueryLib;
     $this->getTextFieldLengths($val, $inputLength, $fieldLength);
     if (isset($val["onkeypress"])) {
         JavaScript::addEvent('#' . $attr, "keypress", $val["onkeypress"]);
     }
     if (isset($val["onkeyup"])) {
         JavaScript::addEvent('#' . $attr, "keyup", $val["onkeyup"]);
     }
     if (isset($val["onchange"])) {
         JavaScript::addEvent('#' . $attr, "change", $val["onchange"]);
     }
     if (isset($val["onblur"])) {
         JavaScript::addEvent('#' . $attr, "blur", $val["onblur"]);
     }
     if (isset($val["default"]) && $val["default"] === "" && $this->base->{$attr} === "0") {
         $this->base->{$attr} = "";
     }
     if (isset($val["masked"])) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.maskedinput.js");
         JavaScript::addOnload("\n            \$('#{$attr}').mask('{$val['masked']}');\n        ");
     }
     if (isset($val["filterCharacters"])) {
         JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
         JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.alphanumeric.js");
         JavaScript::addOnload("\n            \$('#{$attr}').{$val['filterCharacters']};\n        ");
     }
     return GenerWidget::generTextField("text", $attr, $this->base->{$attr}, $inputLength, $fieldLength);
 }
Esempio n. 17
0
 function generDateTextField($name, $value, &$attrInfo, $size = "", $maxlength = "")
 {
     global $now;
     if ($value->isEmpty() && in_array("defaultnow", $attrInfo)) {
         $display = $now->getDbFormat();
     } else {
         $display = $value->getDbFormat();
     }
     $jsCalendar = in_array("jscalendar", $attrInfo);
     $s = GenerWidget::generTextField('text', $name, $display, $size, $maxlength);
     if ($jsCalendar) {
         JavaScript::addInclude(GORUM_JS_DIR . "/jscalendar/calendar.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jscalendar/lang/calendar-en.js");
         JavaScript::addInclude(GORUM_JS_DIR . "/jscalendar/calendar-setup.js");
         JavaScript::addCss(GORUM_JS_DIR . "/jscalendar/skins/aqua/theme.css");
         //$s.="<button type='reset' id='trigger'>...</button>";
         $s .= "<img src='" . GORUM_JS_DIR . "/jscalendar/img.gif' id='{$name}_trigger'\n             style='cursor: pointer; border: 1px solid red;'\n             title='Date selector'\n             onmouseover=\"this.style.background='red';\"\n             onmouseout=\"this.style.background=''\" >";
         $calendarDisplay = $display ? "'{$display}'" : "null";
         if (!isset($attrInfo["fromyear"])) {
             $fromyear = $now->getYear();
         } elseif ($attrInfo["fromyear"] == "now") {
             $fromyear = $now->getYear();
         } elseif (preg_match("{now-(\\d+)}", $attrInfo["fromyear"], $matches)) {
             $fromyear = $now->getYear() - intval($matches[1]);
         } else {
             $fromyear = $attrInfo["fromyear"];
         }
         if (!isset($attrInfo["toyear"])) {
             $toyear = $now->getYear();
         } elseif ($attrInfo["toyear"] == "now") {
             $toyear = $now->getYear();
         } elseif (preg_match("{now\\+(\\d+)}", $attrInfo["toyear"], $matches)) {
             $toyear = $now->getYear() + intval($matches[1]);
         } else {
             $toyear = $attrInfo["toyear"];
         }
         $format = preg_replace("/\\b\\w\\b/", "%\$0", $attrInfo["display_format"]);
         // minden betu ele beteszunk egy % jelet
         $format = str_replace("%i", "%M", $format);
         $showsTime = in_array("showstime", $attrInfo) ? "true" : "false";
         JavaScript::addOnload("\n          Calendar.setup(\n            {\n              inputField  : '{$name}',         // ID of the input field\n              ifFormat    : '{$format}',    // the date format\n              button      : '{$name}_trigger',       // ID of the button\n              date        : {$calendarDisplay},                 // initial date\n              range       : [{$fromyear}, {$toyear}],   // range of years\n              showsTime       : {$showsTime}\n            }\n          );\n        ");
     }
     return $s;
 }
Esempio n. 18
0
 function modifyForm()
 {
     global $gorumroll, $customfield_typ;
     $this->id = $gorumroll->rollid;
     if (!Roll::isPreviousFormSubmitInvalid()) {
         if ($this->load()) {
             handleErrorNotFound($this, __FILE__, __LINE__);
         }
     }
     $this->hasObjectRights($hasRight, "modify", TRUE);
     $this->initializeMultipleSelectionFieldsAndDefaults();
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/json.js");
     JavaScript::addInclude(JS_DIR . "/propagate.js");
     JavaScript::addOnload('$.noah.submitOptionValueModificationStack();');
     if ($this->isFixField()) {
         $customfield_typ["attributes"]["values"][] = "form invisible";
     }
     $this->generForm();
     if ($this->isFixField()) {
         Roll::setInfoText("customfield_fixInfoText");
     }
 }
Esempio n. 19
0
 function modifyForm()
 {
     global $itemfield_typ, $gorumroll, $lll, $jQueryLib;
     $this->id = $gorumroll->rollid;
     if (!Roll::isPreviousFormSubmitInvalid()) {
         $ret = $this->load();
     }
     // hogy ezek ne legyenek a formban, mikor egy global common field-et nezunk:
     if ($this->isCommon && !$this->cid) {
         $fieldsToLeaveOut = array("detailsProperties", "showInDetails", "formProperties", "expl", "default_text", "mandatory", "allowHtml");
         foreach ($fieldsToLeaveOut as $attr) {
             $itemfield_typ["attributes"][$attr][] = "form invisible";
         }
         // hogy a customfield.js-ben a feltetelek jol mukodjenek:
         $fieldsToMakeHidden = array("type", "subType");
         foreach ($fieldsToMakeHidden as $attr) {
             $itemfield_typ["attributes"][$attr][] = "form hidden";
         }
     }
     JavaScript::addInclude(GORUM_JS_DIR . $jQueryLib);
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.center.js");
     // to center the loading animation image
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/field.js");
     // to retrieve the form field values
     // Propagate into all other categories:
     $propagatePostfix = OverlayController::addPropagateOverlay($this->id);
     // Propagate into the subcategories only:
     if ($this->cid) {
         getDbCount($count, array("SELECT COUNT(*) FROM @category WHERE up=#cid#", $this->cid));
         if ($count) {
             $propagatePostfix .= " " . OverlayController::addPropagateOverlay($this->id, "", "_subcat");
         }
     }
     foreach (array_keys($itemfield_typ["attributes"]) as $attr) {
         if (!in_array($attr, array("name", "isCommon", "type", "userField"))) {
             if (isset($lll["itemfield_{$attr}"])) {
                 $lll["itemfield_{$attr}"] .= $propagatePostfix;
             } elseif (isset($lll["customfield_{$attr}"])) {
                 $lll["customfield_{$attr}"] .= $propagatePostfix;
             }
         }
     }
     parent::modifyForm();
 }