Exemple #1
0
 function generField($filterConf, &$list, $attr)
 {
     // Lokalis parameterek inicializalasa az osztalyvaltozok alapjan:
     foreach (array('width', 'filterText', 'resetOnClick', 'enable') as $a) {
         ${$a} = $this->{$a};
     }
     // A $filterConf-ban erkezo ertekek felulirhatjak a lokalis parametereket:
     if (is_array($filterConf)) {
         foreach (array('width', 'filterText', 'resetOnClick', 'enable') as $a) {
             if (isset($filterConf[$a])) {
                 ${$a} = $filterConf[$a];
             }
         }
         $type = $filterConf['type'];
     } else {
         $type = $filterConf;
     }
     if (!$enable) {
         return "";
     }
     if ($type == "text_filter") {
         $onclick = $resetOnClick ? "onclick=\"this.value='';Table.filter(this,this)\"" : "";
         $s = GenerWidget::generTextField($type, "filter", $filterText, $width, "", " onkeyup=\"Table.filter(this,this)\" {$onclick}");
     } elseif ($type == "select_filter") {
         $values = array_unique(array_map(create_function('$v', "return strip_tags(\$v->showListVal('{$attr}'));"), $list));
         $values[] = "";
         sort($values);
         $labels = $values;
         $labels[0] = "All";
         $s = GenerWidget::generSelectField("filter", $labels, $values, "", "All", 0, $width, "", "onchange=\"Table.filter(this,this)\"");
     }
     return $s;
 }
 function processContent(&$tpl)
 {
     global $lll, $upperTemplate;
     global $gorumroll, $jsInclude, $jsOnLoad, $scriptName;
     global $maxInputLength, $maxFieldLength, $noFileUpload, $onSubmit;
     $formAttrs = "";
     if (!isset($noFileUpload)) {
         $formAttrs = " enctype='multipart/form-data'";
     }
     if ($onSubmit) {
         $formAttrs .= " onsubmit='{$onSubmit}'";
     }
     $tpl->assign("formAttrs", $formAttrs);
     $tpl->assign("scriptName", $scriptName);
     $tpl->assign("listAndMethod", "{$gorumroll->list}-{$gorumroll->method}");
     $class = $gorumroll->getClass();
     $method = $gorumroll->method;
     // A kovetkezo method beallitasa:
     $ctrl =& new AppController(array("method" => str_replace("_form", "", $method)));
     $hiddens = $ctrl->generHiddenFields();
     foreach ($this->typ["attributes"] as $attr => $val) {
         if (in_array("{$gorumroll->method}: form hidden", $val)) {
             $hiddens .= GenerWidget::generHiddenField($attr, $this->base->{$attr});
         } elseif (in_array("form hidden", $val)) {
             $hiddens .= GenerWidget::generHiddenField($attr, $this->base->{$attr});
         }
     }
     $tpl->assign("hiddens", $hiddens);
     $lllGlobProp =& new LllGlobalProperties($this->base);
     $title = sprintf($lll["beforeDelete"], $lllGlobProp->getLabel());
     if ($sd = $lllGlobProp->getLabel("seriousDeleteQuestion", FALSE)) {
         if ($title) {
             $title .= "<br>";
         }
         $title .= $sd;
     }
     $tpl->assign("title", $title);
     if (isset($this->typ["delete_confirm"]) && isset($this->base->{$this->typ["delete_confirm"]}) && $this->base->{$this->typ["delete_confirm"]}) {
         $tpl->assign("confirm", $this->base->showListVal($this->typ["delete_confirm"]));
     }
     $submits = array();
     $submits[] = "<input type=submit value='{$lll['ok']}' name=gsubmit class='button'>\n";
     $submits[] = "<input type=submit value='{$lll['cancel']}' name=gsubmit class='button'>\n";
     $tpl->assign("submits", $submits);
     $tpl->assign("rows", array());
     //var_dump($tpl);die();
     return ok;
 }
Exemple #3
0
 function getValuesForRulesAjax()
 {
     global $gorumroll, $lll;
     $this->getValuesForRules($gorumroll->rollid, $labels, $values);
     echo GenerWidget::generSelectOptions($labels, $values);
     die;
 }
Exemple #4
0
 function generRedirectForm(&$base)
 {
     global $gorumroll, $scriptName;
     $ctrl =& new AppController(array("method" => str_replace("_form", "", $gorumroll->method)));
     $hiddens = $ctrl->generHiddenFields();
     $typ =& $base->getTypeInfo();
     $attributeList = array_keys($typ["attributes"]);
     for ($i = 0; $i < count($attributeList); $i++) {
         $attr = $attributeList[$i];
         if (!($val =& $typ["attributes"][$attr])) {
             continue;
         }
         $visibility = $base->getVisibility($val, $attr);
         if ($visibility == Form_hidden) {
             $hiddens .= GenerWidget::generHiddenField($attr, $base->{$attr});
         }
     }
     return "\n    <form action='{$scriptName}' method='post' name='frm'>\n        {$hiddens}\n    </form>\n    <script language='JavaScript'>\n        document.frm.submit();\n    </script>";
 }
Exemple #5
0
 function addPropagateOverlay($id, $what = "", $how = "")
 {
     global $lll;
     $class = $what == "_cat" ? "cat" : "itemfield";
     $ctrl =& new AppController("{$class}/propagate{$what}{$how}/{$id}");
     // Ajax target
     $url = $ctrl->makeUrl();
     $overlay =& new OverlayController(array("content" => GenerWidget::generConfirmation($lll["confirmation"], $lll["propagateConfirmationText{$what}{$how}"]), "id" => "overlay{$how}", "height" => 160, "expose" => TRUE, "close" => "div.close, input.confirmation_cancel, input.confirmation_continue", "onBeforeLoad" => "\$.noah.propagateOnBeforeLoad(this, " . G::js("processing", "continue", $url) . ");", "onClose" => "\$.noah.propagateOnClose(this, " . G::js("confirmation", "propagateConfirmationText{$what}{$how}", "cancel") . ");"));
     return " <a rel='#overlay{$how}' href='' title='" . $lll["propagateLabel{$what}{$how}"] . "'><img class='propagate{$how}' src='" . IMAGES_DIR . "/propagate{$how}.png' width='20' border=0></a>";
 }
Exemple #6
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");
 }
Exemple #7
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;
 }
Exemple #8
0
 function generImageAnchor($src, $alt, $width = "", $height = "", $cssClass = "", $absolute = FALSE, $target = "")
 {
     return GenerWidget::generImageAnchor($this->makeUrl($absolute), $src, $alt, $width, $height, $cssClass, $target);
 }
Exemple #9
0
 function showListVal($attr)
 {
     global $gorumroll;
     if ($gorumroll->rollid !== "alternative") {
         return parent::showListVal($attr);
     }
     if ($attr == "name") {
         $s = parent::showListVal($attr);
         if (isset($this->depth)) {
             return "<div style='padding-left: " . 20 * $this->depth . "px;'>{$s}</div>";
         }
         return $s;
     } elseif ($attr == "sortId") {
         return GenerWidget::generTextField("text", "sortId[{$this->id}]", $this->sortId, 6);
     } elseif ($attr == "up") {
         $s = GenerWidget::generTextField("text", "up[{$this->id}]", $this->up, 6);
         $s .= GenerWidget::generHiddenField("name[{$this->id}]", htmlspecialchars($this->name));
         $s .= GenerWidget::generHiddenField("oldUp[{$this->id}]", $this->up);
         return $s;
     } else {
         return parent::showListVal($attr);
     }
 }
Exemple #10
0
 function generImageAnchor($link, $src, $alt, $width = "", $height = "", $cssClass = "", $target = "", $rel = "")
 {
     $alt = htmlspecialchars($alt);
     $img = "<img src='{$src}' alt='{$alt}' border='0' title='{$alt}'";
     if ($width != "") {
         $img .= " width='{$width}'";
     }
     if ($height != "") {
         $img .= " height='{$height}'";
     }
     $img .= ">";
     return GenerWidget::generAnchor($link, $img, $cssClass, $target, FALSE, $rel);
 }