Beispiel #1
2
 /**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page
  * @param String strTableName
  * @param Array options
  */
 static function &createListPage($strTableName, $options)
 {
     global $isGroupSecurity;
     $gSettings = new ProjectSettings($strTableName, $options['pageType']);
     $gQuery = $gSettings->getSQLQuery();
     $params = $options;
     $params['tName'] = $strTableName;
     $params['origTName'] = $gSettings->getOriginalTableName();
     $params['gPageSize'] = $gSettings->getInitialPageSize();
     $params['gOrderIndexes'] = $gSettings->getOrderIndexes();
     $params['gstrOrderBy'] = $gQuery->OrderByToSql();
     $params['gsqlHead'] = $gQuery->HeadToSql();
     $params['gsqlFrom'] = $gQuery->FromToSql();
     $params['gsqlWhereExpr'] = $gQuery->WhereToSql();
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery);
     $params['nSecOptions'] = $gSettings->getAdvancedSecurityType();
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = isMobile() ? 1 : $gSettings->getRecordsPerRowList();
     $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField();
     $params['exportTo'] = $gSettings->hasExportPage();
     $params['printFriendly'] = $gSettings->hasPrintPage();
     $params['deleteRecs'] = $gSettings->hasDelete();
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = $gSettings->getTableKeys();
     $params["isUseInlineAdd"] = $gSettings->hasInlineAdd();
     $params["isUseInlineEdit"] = $gSettings->hasInlineEdit();
     $params["panelSearchFields"] = $gSettings->getPanelSearchFields();
     $params['listGridLayout'] = $gSettings->getListGridLayout();
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage();
     $params['totalsFields'] = $gSettings->getTotalsFields();
     $params['listAjax'] = $gSettings->ajaxBasedListPage();
     $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray();
     $params['isScrollGridBody'] = $gSettings->getScrollGridBody();
     $params['viewPDF'] = $gSettings->isViewPagePDF() || $gSettings->isPrinterPagePDF();
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = $gSettings->getListFields();
     foreach ($allfields as $f) {
         if (!$gSettings->appearOnListPage($f)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS || $params["mode"] == LIST_DASHDETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         } else {
                             if ($params["mode"] == LIST_DASHBOARD) {
                                 $pageObject = new ListPage_Dashboard($params);
                             }
                         }
                     }
                 }
             }
         }
     }
     $pageObject->init();
     return $pageObject;
 }
 /**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page 
  */
 function &createListPage($table, $options)
 {
     global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity;
     $gQuery = GetTableData($table, ".sqlquery", null);
     $params = array();
     $params = $options;
     $params['origTName'] = GetTableData($table, ".OriginalTable", '');
     $params['sessionPrefix'] = $strTableName;
     $params['tName'] = $table;
     $params['conn'] =& $conn;
     $params['gPageSize'] = GetTableData($table, ".pageSize", 0);
     $params['gOrderIndexes'] = GetTableData($table, ".orderindexes", array());
     $params['gstrOrderBy'] = GetTableData($table, ".strOrderBy", '');
     $params['gsqlHead'] = GetTableData($table, ".sqlHead", '');
     $params['gsqlFrom'] = GetTableData($table, ".sqlFrom", '');
     $params['gsqlWhereExpr'] = GetTableData($table, ".sqlWhereExpr", '');
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $oHaving = $gQuery->Having();
     $params['gsqlHaving'] = $oHaving->toSql($gQuery);
     $params['locale_info'] =& $locale_info;
     $params["subQueriesSupp"] = $bSubqueriesSupported;
     $params['nSecOptions'] = GetTableData($table, ".nSecOptions", 0);
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = GetTableData($table, ".recsPerRowList", 0);
     $params['tableGroupBy'] = GetTableData($table, ".tableGroupBy", '');
     $params['dbType'] = GetGlobalData("dbType", 0);
     $params['mainTableOwnerID'] = GetTableData($table, ".mainTableOwnerID", '');
     $params['moveNext'] = GetTableData($table, ".moveNext", 0);
     $params['exportTo'] = GetTableData($table, ".exportTo", false);
     $params['printFriendly'] = GetTableData($table, ".printFriendly", false);
     $params['deleteRecs'] = GetTableData($table, ".delete", false);
     $params['rowHighlite'] = GetTableData($table, ".rowHighlite", false);
     $params["delFile"] = GetGlobalData("delFile", false);
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = GetTableData($table, ".arrKeyFields", array());
     $params["useIbox"] = GetTableData($table, ".useIbox", false);
     $params["isUseInlineAdd"] = GetTableData($table, ".isUseInlineAdd", false);
     $params["isUseInlineEdit"] = GetTableData($table, ".isUseInlineEdit", false);
     $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"];
     $params["globSearchFields"] = GetTableData($table, ".globSearchFields", array());
     $params["panelSearchFields"] = GetTableData($table, ".panelSearchFields", array());
     $params['isVerLayout'] = GetTableData($table, ".isVerLayout", false);
     $params['isDisplayLoading'] = GetTableData($table, ".isDisplayLoading", false);
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['subQueriesSupAccess'] = GetTableData($table, ".subQueriesSupAccess", false);
     $params['noRecordsFirstPage'] = GetTableData($table, ".noRecordsFirstPage", false);
     $params['totalsFields'] = GetTableData($table, ".totalsFields", array());
     $params['listIcons'] = GetTableData($table, ".listIcons", false);
     $params['edit'] = GetTableData($table, ".edit", false);
     $params['inlineEdit'] = GetTableData($table, ".inlineEdit", false);
     $params['iCopy'] = GetTableData($table, ".copy", false);
     $params['iView'] = GetTableData($table, ".view", false);
     $params['listAjax'] = GetTableData($table, ".listAjax", false);
     $params['arrRecsPerPage'] = GetTableData($table, ".arrRecsPerPage", array());
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = GetFieldsList($table);
     foreach ($allfields as $f) {
         if (!AppearOnListPage($f, $table)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => GetFieldData($table, $f, "ViewFormat", ""), "editFormat" => GetFieldData($table, $f, "EditFormat", ""));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         }
                     }
                 }
             }
         }
     }
     return $pageObject;
 }
 function RunnerPage(&$params)
 {
     global $locale_info, $cCharset, $menuTables, $page_layouts;
     // copy properties to object
     RunnerApply($this, $params);
     $this->googleMapCfg = array('markerAsLinkToView' => true, 'isUseMainMaps' => false, 'isUseFieldsMaps' => false, 'isUseGoogleMap' => false, 'APIcode' => GetGlobalData("apiGoogleMapsCode", ""), 'mainMapIds' => array(), 'fieldMapsIds' => array(), 'mapsData' => array());
     $this->debugJSMode = false;
     if ($this->flyId < $this->id + 1) {
         $this->flyId = $this->id + 1;
     }
     // get permissions
     if ($this->tName) {
         $this->permis[$this->tName] = $this->getPermissions();
         $this->eventsObject =& getEventObject($this->tName);
     }
     $this->menuTables = $menuTables;
     // get perm for menu tables
     for ($i = 0; $i < count($this->menuTables); $i++) {
         $this->permis[$this->menuTables[$i]["tName"]] = $this->getPermissions($this->menuTables[$i]["tName"]);
     }
     if (!$this->sessionPrefix) {
         $this->sessionPrefix = $this->tName;
     }
     $this->setSessionVariables();
     //	get locking object
     $this->lockingObj = GetLockingObject($this->tName);
     $this->is508 = isEnableSection508();
     //	get details keys by master table
     $this->detailKeysByM = GetDetailKeysByMasterTable($this->masterTable, $this->tName);
     $this->isDynamicPerm = GetGlobalData("isDynamicPerm", false);
     $this->isAddWebRep = GetGlobalData("isAddWebRep", false);
     $this->allDetailsTablesArr = GetDetailTablesArr($this->tName);
     $this->strCaption = GetTableCaption(GoodFieldName($this->tName));
     $this->isTableType = GetTableData($this->tName, ".isTableType", "");
     $this->isUseVideo = GetTableData($this->tName, ".isUseVideo", false);
     $this->isUseAudio = GetTableData($this->tName, ".isUseAudio", false);
     $this->showAddInPopup = GetTableData($this->tName, ".showAddInPopup", false);
     $this->showEditInPopup = GetTableData($this->tName, ".showEditInPopup", false);
     $this->showViewInPopup = GetTableData($this->tName, ".showViewInPopup", false);
     $this->isResizeColumns = GetTableData($this->tName, ".isResizeColumns", false);
     $this->isUseAjaxSuggest = GetTableData($this->tName, ".isUseAjaxSuggest", false);
     $this->useDetailsPreview = GetTableData($this->tName, ".useDetailsPreview", false);
     $this->isShowDetailTables = displayDetailsOn($this->tName, $this->pageType);
     $this->shortTableName = GetTableData($this->tName, ".shortTableName", '');
     //init jsSettings
     $this->jsSettings["tableSettings"][$this->tName] = array();
     $this->jsSettings["tableSettings"][$this->tName]['fieldSettings'] = array();
     $this->settingsMap["globalSettings"] = array();
     $this->settingsMap["globalSettings"]["ext"] = "php";
     $this->settingsMap["globalSettings"]["charSet"] = $cCharset;
     $this->settingsMap["globalSettings"]["debugMode"] = $this->debugJSMode;
     $this->settingsMap["globalSettings"]["googleMapsApiCode"] = $this->googleMapCfg['APIcode'];
     $this->settingsMap["globalSettings"]["shortTNames"][$this->tName] = $this->shortTableName;
     //isMobile
     $this->settingsMap["globalSettings"]["isMobile"] = isMobile();
     // s508 must be in global settings
     $this->settingsMap['globalSettings']['s508'] = $this->is508;
     $this->settingsMap["globalSettings"]["locale"]["dateFormat"] = $locale_info["LOCALE_IDATE"];
     $this->settingsMap["globalSettings"]["locale"]["startWeekDay"] = $locale_info["LOCALE_IFIRSTDAYOFWEEK"];
     $this->settingsMap["globalSettings"]["locale"]["dateDelimiter"] = $locale_info["LOCALE_SDATE"];
     $this->settingsMap["tableSettings"] = array();
     $this->settingsMap["tableSettings"]["isUseToolTips"] = array("default" => false, "jsName" => "isUseToolTips");
     $this->settingsMap["tableSettings"]["useIbox"] = array("default" => false, "jsName" => "isUseIbox");
     $this->settingsMap["tableSettings"]["listIcons"] = array("default" => false, "jsName" => "listIcons");
     $this->settingsMap["tableSettings"]["strCaption"] = array("default" => "", "jsName" => "strCaption");
     $this->settingsMap["tableSettings"]["isUseAudio"] = array("default" => false, "jsName" => "isUseAudio");
     $this->settingsMap["tableSettings"]["isUseVideo"] = array("default" => false, "jsName" => "isUseVideo");
     $this->settingsMap["tableSettings"]["rowHighlite"] = array("default" => false, "jsName" => "isUseHighlite");
     $this->settingsMap["tableSettings"]["showAddInPopup"] = array("default" => false, "jsName" => "showAddInPopup");
     $this->settingsMap["tableSettings"]["showEditInPopup"] = array("default" => false, "jsName" => "showEditInPopup");
     $this->settingsMap["tableSettings"]["showViewInPopup"] = array("default" => false, "jsName" => "showViewInPopup");
     $this->settingsMap["tableSettings"]["isResizeColumns"] = array("default" => false, "jsName" => "isUseResize");
     $this->settingsMap["tableSettings"]["isUseAjaxSuggest"] = array("default" => true, "jsName" => "ajaxSuggest");
     $this->settingsMap["tableSettings"]["useDetailsPreview"] = array("default" => false, "jsName" => "isUseDP");
     $this->settingsMap['tableSettings']['isUsebuttonHandlers'] = array("default" => false, "jsName" => "isUseButtons");
     $this->settingsMap['tableSettings']['isVerLayout'] = array("default" => false, "jsName" => "isVertLayout");
     $this->settingsMap['tableSettings']['recsPerRowList'] = array("default" => 1, "jsName" => "recsPerRowList");
     $this->settingsMap['tableSettings']['hasEvents'] = array("default" => false, "jsName" => "hasEvents");
     $layout = GetPageLayout($this->shortTableName, $this->pageType);
     if ($layout) {
         $rtl = $this->xt->getReadingOrder() == 'RTL' ? 'RTL' : '';
         $this->jsSettings['tableSettings'][$this->tName]['pageCSS'] = "styles/" . $layout->style . '/style' . $rtl;
         $this->jsSettings['tableSettings'][$this->tName]['pageLayout'] = "pagestyles/" . $layout->name . $rtl;
         $this->jsSettings['tableSettings'][$this->tName]['pageSkinStyle'] = $layout->style . " page-" . $layout->name;
     }
     $this->settingsMap["fieldSettings"]["UseTimestamp"] = array("default" => false, "jsName" => "isUseTimeStamp");
     $this->settingsMap["fieldSettings"]["strName"] = array("default" => "", "jsName" => "strName");
     $this->settingsMap["fieldSettings"]["ShowTime"] = array("default" => false, "jsName" => "showTime");
     $this->settingsMap["fieldSettings"]["EditFormat"] = array("default" => "", "jsName" => "editFormat");
     $this->settingsMap["fieldSettings"]["DateEditType"] = array("default" => EDIT_DATE_SIMPLE, "jsName" => "dateEditType");
     $this->settingsMap["fieldSettings"]["RTEType"] = array("default" => "", "jsName" => "RTEType");
     $this->settingsMap["fieldSettings"]["ViewFormat"] = array("default" => "", "jsName" => "viewFormat");
     $this->settingsMap["fieldSettings"]["validateAs"] = array("default" => null, "jsName" => "validation");
     $this->settingsMap["fieldSettings"]["LastYearFactor"] = array("default" => 10, "jsName" => "lastYear");
     $this->settingsMap["fieldSettings"]["InitialYearFactor"] = array("default" => 100, "jsName" => "initialYear");
     $this->jsSettings["tableSettings"][$this->tName]["strCaption"] = $this->strCaption;
     $this->jsSettings["tableSettings"][$this->tName]["pageMode"] = $this->mode;
     if ($this->listAjax) {
         $this->jsSettings['tableSettings'][$this->tName]['pageMode'] = LIST_AJAX;
     }
     if ($this->lockingObj) {
         $this->jsSettings['tableSettings'][$this->tName]['locking'] = true;
     }
     //If current table has detail tables
     if (count($this->allDetailsTablesArr)) {
         if ($this->pageType == PAGE_LIST) {
             $this->jsSettings['tableSettings'][$this->tName]['detailTables'] = array();
         }
         $this->jsSettings['tableSettings'][$this->tName]['isShowDetails'] = $this->isShowDetailTables;
         for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) {
             $this->settingsMap["globalSettings"]['shortTNames'][$this->allDetailsTablesArr[$i]['dDataSourceTable']] = $this->allDetailsTablesArr[$i]['dShortTable'];
             if ($this->pageType == PAGE_LIST) {
                 $this->jsSettings['tableSettings'][$this->tName]['detailTables'][$this->allDetailsTablesArr[$i]['dDataSourceTable']] = array('dispChildCount' => $this->allDetailsTablesArr[$i]['dispChildCount'], 'hideChild' => $this->allDetailsTablesArr[$i]['hideChild'], 'listShowType' => $this->allDetailsTablesArr[$i]['previewOnList'], 'addShowType' => $this->allDetailsTablesArr[$i]['previewOnAdd'], 'editShowType' => $this->allDetailsTablesArr[$i]['previewOnEdit'], 'viewShowType' => $this->allDetailsTablesArr[$i]['previewOnView']);
                 if ($this->allDetailsTablesArr[$i]['previewOnList'] == DP_POPUP) {
                     $this->jsSettings['tableSettings'][$this->tName]['isUsePopUp'] = true;
                 }
                 // field names of master keys of current table for passed details table name
                 $this->masterKeysByD[$i] = GetMasterKeysByDetailTable($this->allDetailsTablesArr[$i]['dDataSourceTable'], $this->tName);
             }
         }
         if (($this->pageType == PAGE_ADD || $this->pageType == PAGE_EDIT) && $this->isShowDetailTables) {
             $this->controlsMap["dControlsMap"] = array();
         }
     }
     $this->controlsMap["video"] = array();
     $this->controlsMap['toolTips'] = array();
     $this->addLookupSettings();
     if ($this->mode != LIST_DETAILS) {
         $this->controlsMap["controls"] = array();
         if (!$this->pageAddLikeInline && !$this->pageEditLikeInline) {
             $this->controlsMap["search"] = array();
             $this->controlsMap["search"]["searchBlocks"] = array();
             $this->controlsMap["search"]["panelSearchFields"] = GetTableData($this->tName, ".panelSearchFields", array());
             $this->controlsMap["search"]["allSearchFields"] = GetTableData($this->tName, '.allSearchFields', array());
             if ($this->pageType != PAGE_SEARCH) {
                 $this->controlsMap["search"]["submitPageType"] = $this->pageType;
             } else {
                 if (postvalue("rname")) {
                     $this->controlsMap["search"]["submitPageType"] = "dreport";
                     $this->controlsMap["search"]["baseParams"]["rname"] = postvalue("rname");
                     if ($_SESSION["crossLink"]) {
                         if (substr($_SESSION["crossLink"], 0, 1) == "&") {
                             $_SESSION["crossLink"] = substr($_SESSION["crossLink"], 1);
                         }
                         $alink = explode("&", $_SESSION["crossLink"]);
                         foreach ($alink as $param) {
                             $arrtmp = explode("=", $param);
                             $this->controlsMap["search"]["baseParams"][$arrtmp[0]] = $arrtmp[1];
                         }
                     }
                 } elseif (postvalue("cname")) {
                     $this->controlsMap["search"]["submitPageType"] = "dchart";
                     $this->controlsMap["search"]["baseParams"]["cname"] = postvalue("cname");
                 } else {
                     $this->controlsMap["search"]["submitPageType"] = $this->isTableType;
                 }
             }
         }
     }
     $this->calendar = $this->calendar || GetTableData($this->tName, ".isUseCalendarForSearch", false);
     $this->timepicker = $this->timepicker || GetTableData($this->tName, ".isUseTimeForSearch", false);
     $this->isUseToolTips = $this->isUseToolTips || GetTableData($this->tName, ".isUseToolTips", false);
     $this->googleMapCfg["APIcode"] = "";
     if ($this->xt) {
         $this->xt->assign("pagetitle", $this->getPageTitle());
     }
 }
 function initLookupParams()
 {
     global $cman;
     $this->parId = postvalue("parId");
     $this->firstTime = postvalue("firsttime");
     $this->mainField = postvalue("field");
     $this->lookupControl = postvalue("control");
     $this->lookupCategory = postvalue("category");
     $this->mainTable = postvalue("table");
     // convert into an array as parent ctrl can have multiple values
     if (!is_array($this->lookupCategory)) {
         $this->lookupCategory = strlen($this->lookupCategory) != 0 ? splitvalues($this->lookupCategory) : array();
     }
     $arrCategory = array();
     foreach ($this->lookupCategory as $categValue) {
         $arrCategory[] = "category[]=" . $categValue;
     }
     $lookCategory = implode("&", $arrCategory);
     if ($lookCategory) {
         $lookCategory = "&" . $lookCategory;
     }
     $this->lookupParams = "mode=lookup&id=" . $this->id . "&parId=" . $this->parId . "&field=" . rawurlencode($this->mainField) . "&control=" . rawurlencode($this->lookupControl) . $lookCategory . "&table=" . rawurlencode($this->mainTable) . "&editMode=" . postvalue('editMode');
     $pageType = postvalue("pageType");
     if ($pageType != PAGE_ADD && $pageType != PAGE_EDIT) {
         $pageType = PAGE_SEARCH;
     }
     $this->mainPSet = new ProjectSettings($this->mainTable, $pageType);
     $this->linkField = $this->mainPSet->getLinkField($this->mainField);
     $this->dispField = $this->mainPSet->getDisplayField($this->mainField);
     if ($this->mainPSet->getCustomDisplay($this->mainField)) {
         $this->dispFieldAlias = GetGlobalData("dispFieldAlias", "rrdf1");
         $this->pSet->getSQLQuery()->AddCustomExpression($this->mainPSet->getDisplayField($this->mainField), $this->pSet, $this->mainTable, $this->mainField, $this->dispFieldAlias);
         $this->customField = $this->linkField;
     }
     $this->outputFieldValue($this->linkField, 2);
     $this->outputFieldValue($this->dispField, 2);
     if ($this->mainPSet->useCategory($this->mainField)) {
         $this->categoryField = $this->mainPSet->getCategoryFilter($this->mainField);
     }
     $this->strLookupWhere = GetLWWhere($this->mainField, $pageType, $this->mainTable);
     if ($this->dispFieldAlias && $this->pSet->appearOnListPage($this->dispField)) {
         $this->lookupSelectField = $this->dispField;
     } elseif ($this->pSet->appearOnListPage($this->dispField)) {
         $this->lookupSelectField = $this->dispField;
     } else {
         $this->lookupSelectField = $this->listFields[0]['fName'];
     }
     if (!$this->categoryField) {
         $this->lookupCategory = array();
     }
     $orderByField = $this->mainPSet->getLookupOrderBy($this->mainField);
     if (strlen($orderByField)) {
         // adjust the ORDER BY clause according to the main lookup settings
         $this->gstrOrderBy = " ORDER BY " . $this->connection->addTableWrappers($this->tName) . "." . $this->connection->addFieldWrappers($orderByField);
         if ($this->mainPSet->isLookupDesc($this->mainField)) {
             $this->gstrOrderBy .= ' DESC';
         }
     }
 }
Beispiel #5
1
 function getNextPrevRecordKeys(&$data, $securityMode, &$next, &$prev)
 {
     global $conn;
     $next = array();
     $prev = array();
     if (@$_SESSION[$this->sessionPrefix . "_noNextPrev"]) {
         return;
     }
     $prevExpr = "";
     $nextExpr = "";
     $where_next = "";
     $where_prev = "";
     $order_next = "";
     $order_prev = "";
     require_once getabspath('classes/orderclause.php');
     $orderClause = new OrderClause($this);
     $orderClause->init();
     $query = $this->pSet->GetQueryObject();
     $where = $_SESSION[$this->sessionPrefix . "_where"];
     if (!strlen($where)) {
         $where = SecuritySQL($securityMode);
     }
     $having = $_SESSION[$this->sessionPrefix . "_having"];
     $tKeys = $this->pSet->getTableKeys();
     if (!count($orderClause->fieldsList)) {
         $_SESSION[$this->sessionPrefix . "_noNextPrev"] = 1;
         return;
     }
     //	make  next & prev ORDER BY strings
     for ($i = 0; $i < count($orderClause->fieldsList); $i++) {
         $field = $orderClause->fieldsList[$i];
         if (!$this->pSet->GetFieldByIndex($field->fieldIndex)) {
             continue;
         }
         if ($order_next == "") {
             $order_next = " ORDER BY ";
             $order_prev = " ORDER BY ";
         } else {
             $order_next .= ",";
             $order_prev .= ",";
         }
         $order_next .= $field->fieldIndex . " " . $field->orderDirection;
         $order_prev .= $field->fieldIndex . " " . ($field->orderDirection == "DESC" ? "ASC" : "DESC");
     }
     // make next & prev where expressions
     $tail = "";
     for ($i = 0; $i < count($orderClause->fieldsList); $i++) {
         $field = $orderClause->fieldsList[$i];
         $fieldName = $this->pSet->GetFieldByIndex($field->fieldIndex);
         if (!$fieldName) {
             continue;
         }
         if (!$query->HasGroupBy()) {
             $fullName = GetFullFieldName($fieldName, $this->tName, false);
         } else {
             $fullName = AddFieldWrappers($fieldName);
         }
         $asc = $field->orderDirection == "ASC";
         if (!is_null($data[$fieldName])) {
             //	current field value is not null
             $value = $this->cipherer->MakeDBValue($fieldName, $data[$fieldName], "", "", true);
             $nextop = $asc ? ">" : "<";
             $prevop = $asc ? "<" : ">";
             $nextExpr = $fullName . $nextop . $value;
             $prevExpr = $fullName . $prevop . $value;
             if ($nextop == "<") {
                 $nextExpr .= " or " . $fullName . " IS NULL";
             } else {
                 $prevExpr .= " or " . $fullName . " IS NULL";
             }
             if ($i < count($orderClause->fieldsList) - 1) {
                 $nextExpr .= " or " . $fullName . "=" . $value;
                 $prevExpr .= " or " . $fullName . "=" . $value;
             }
         } else {
             $nextExpr = "";
             $prevExpr = "";
             //	current field value is null
             if ($asc) {
                 $nextExpr = $fullName . " IS NOT NULL";
             } else {
                 $prevExpr = $fullName . " IS NOT NULL";
             }
             if ($i < count($orderClause->fieldsList) - 1) {
                 if ($nextExpr != "") {
                     $nextExpr .= " or ";
                 }
                 $nextExpr .= $fullName . " IS NULL";
                 if ($prevExpr != "") {
                     $prevExpr .= " or ";
                 }
                 $prevExpr .= $fullName . " IS NULL";
             }
         }
         if ($nextExpr == "") {
             $nextExpr = " 1=0 ";
         }
         if ($prevExpr == "") {
             $prevExpr = " 1=0 ";
         }
         // append expression to where clause
         if ($i > 0) {
             $where_next .= " AND ";
             $where_prev .= " AND ";
         }
         $where_next .= "(" . $nextExpr;
         $where_prev .= "(" . $prevExpr;
         $tail .= ")";
     }
     $where_next = $where_next . $tail;
     $where_prev = $where_prev . $tail;
     if ($where_next == "" or $order_next == "" or $where_prev == "" or $order_prev == "") {
         $_SESSION[$this->sessionPrefix . "_noNextPrev"] = 1;
         return;
     }
     //		make the resulting query
     if ($query === null) {
         return;
     }
     if (!$query->HasGroupBy()) {
         $oWhere = $query->Where();
         $where = whereAdd($where, $oWhere->toSql($query));
         $where_next = whereAdd($where_next, $where);
         $where_prev = whereAdd($where_prev, $where);
         $query->ReplaceFieldsWithDummies($this->pSet->getBinaryFieldsIndices());
         $sql_next = $query->toSql($where_next, $order_next);
         $sql_prev = $query->toSql($where_prev, $order_prev);
     } else {
         $oWhere = $query->Where();
         $oHaving = $query->Having();
         $where = whereAdd($where, $oWhere->toSql($query));
         $having = whereAdd($having, $oHaving->toSql($query));
         $query->ReplaceFieldsWithDummies($this->pSet->getBinaryFieldsIndices());
         $sql = "select * from (" . $query->toSql($where, "", $having) . ") prevnextquery";
         $sql_next = $sql . " WHERE " . $where_next . $order_next;
         $sql_prev = $sql . " WHERE " . $where_prev . $order_prev;
     }
     if (GetGlobalData("returnToActualListPage", false)) {
         if ($prevExpr == " 1=0 ") {
             $_SESSION[$this->sessionPrefix . "_pagenumber"] = 1;
         } else {
             $pageSQL = "select count(*) from (" . $sql_prev . ") tcount";
             $pageRes = db_query($pageSQL, $conn);
             $pageRow = db_fetch_numarray($pageRes);
             $currentRow = $pageRow[0];
             if ($this->pageSize > 0) {
                 $pageSize = $this->pageSize;
             } else {
                 $pageSize = $this->pSet->getInitialPageSize();
             }
             $this->myPage = floor($currentRow / $pageSize) + 1;
             $_SESSION[$this->sessionPrefix . "_pagenumber"] = $this->myPage;
         }
     }
     //	add record count options
     $sql_next .= " limit 1";
     $sql_prev .= " limit 1";
     $res_next = db_query($sql_next, $conn);
     if ($res_next) {
         if ($row_next = $this->cipherer->DecryptFetchedArray($res_next)) {
             foreach ($tKeys as $i => $k) {
                 $next[$i] = $row_next[$k];
             }
         }
         db_closequery($res_next);
     }
     $res_prev = db_query($sql_prev, $conn);
     if ($row_prev = $this->cipherer->DecryptFetchedArray($res_prev)) {
         foreach ($tKeys as $i => $k) {
             $prev[$i] = $row_prev[$k];
         }
     }
     db_closequery($res_prev);
 }
Beispiel #6
1
 protected function preparePdfControls()
 {
     if (!$this->viewPdfEnabled) {
         return;
     }
     if ($this->pdfMode) {
         return;
     }
     if (!GetGlobalData("openPDFFileDirectly", true)) {
         $this->AddJSFile("include/pdf.js");
     } else {
         $this->AddJSFile("include/pdfinitlink.js");
     }
     if ($this->mode == VIEW_SIMPLE) {
         $this->xt->assign("pdflink_block", true);
     }
 }
	function RunnerCipherer($strTableName, $pSet = null){
		$this->key = GetGlobalData("encryptionKey", 'emptykey');
		$this->strTableName = $strTableName;
		if($pSet != null)
			$this->pSet = $pSet;
		else 
			$this->pSet = new ProjectSettings($strTableName);
	}
 function RegisterPage(&$params = "")
 {
     parent::RunnerPage($params);
     // fill global password settings
     $this->pwdStrong = GetGlobalData("pwdStrong", false);
     if ($this->pwdStrong) {
         $this->settingsMap["globalSettings"]["pwdLen"] = GetGlobalData("pwdLen", 0);
         $this->settingsMap["globalSettings"]["pwdUnique"] = GetGlobalData("pwdUnique", 0);
         $this->settingsMap["globalSettings"]["pwdDigits"] = GetGlobalData("pwdDigits", 0);
         $this->settingsMap["globalSettings"]["pwdStrong"] = true;
         $this->settingsMap["globalSettings"]["pwdUpperLower"] = GetGlobalData("pwdUpperLower", false);
     }
     $this->formBricks["header"] = "regheader";
     $this->formBricks["footer"] = "regbuttons";
     $this->assignFormFooterAndHeaderBricks(true);
 }
 function ChangePasswordPage(&$params = "")
 {
     parent::RunnerPage($params);
     $this->pSet = new ProjectSettings("DashboardUsers", $this->pageType);
     $this->pSetEdit = $this->pSet;
     // fill global password settings
     $this->pwdStrong = GetGlobalData("pwdStrong", false);
     if ($this->pwdStrong) {
         $this->settingsMap["globalSettings"]["pwdLen"] = GetGlobalData("pwdLen", 0);
         $this->settingsMap["globalSettings"]["pwdUnique"] = GetGlobalData("pwdUnique", 0);
         $this->settingsMap["globalSettings"]["pwdDigits"] = GetGlobalData("pwdDigits", 0);
         $this->settingsMap["globalSettings"]["pwdStrong"] = true;
         $this->settingsMap["globalSettings"]["pwdUpperLower"] = GetGlobalData("pwdUpperLower", false);
     }
     $this->formBricks["header"] = "changeheader";
     $this->formBricks["footer"] = "changebuttons";
     $this->assignFormFooterAndHeaderBricks(true);
 }
Beispiel #10
0
function isSingleSign()
{
    if (GetGlobalData("ADSingleSign", 0) && $_SERVER["REMOTE_USER"]) {
        return false;
    }
    return true;
}
 function getCookieName()
 {
     return "fbsr_" . GetGlobalData("FBappId", "");
 }
Beispiel #12
0
 /**
  * Show page method
  *
  */
 function showPage($returnJson = true)
 {
     global $page_layouts;
     $layout =& $page_layouts[$this->shortTableName . '_' . $this->pageType];
     $pageSkinStyle = $layout->style . " page-" . $layout->name;
     $this->BeforeShowList();
     //set bricks, which	must be shown on details preview page
     $bricksExcept = array("grid", "pagination");
     if ($this->masterPageType == PAGE_LIST) {
         $bricksExcept[] = "details_found";
         $bricksExcept[] = "page_of";
         if ($this->deleteMessage != '') {
             $bricksExcept[] = "message";
         }
     }
     if ($this->masterPageType == PAGE_EDIT || $this->masterPageType == PAGE_ADD || $this->masterPageType == PAGE_LIST && $this->mainMasterPageType != PAGE_VIEW) {
         if ($this->pSet->hasInlineEdit() || $this->pSet->hasDelete() && $this->masterPageType != PAGE_ADD) {
             if ($this->permis[$this->tName]['edit'] || $this->permis[$this->tName]['delete']) {
                 $bricksExcept[] = "recordcontrol";
             }
         }
         if ($this->pSet->hasInlineAdd() && $this->permis[$this->tName]['add']) {
             $bricksExcept[] = "recordcontrols_new";
         }
     }
     // if we use details inline. We don't need show the header/footer.
     $this->xt->unassign('header');
     $this->xt->unassign('footer');
     $this->xt->hideAllBricksExcept($bricksExcept);
     $this->xt->prepare_template($this->templatefile);
     $contents = $this->displayAfterLoadTempl();
     if (!$returnJson) {
         if (GetGlobalData("printDetailTableName", true)) {
             echo '<br><div id="dpShowHide' . $this->id . '" class="dpDiv">';
             if (postvalue("pdf") != 1) {
                 echo '<img id="dpMinus' . $this->id . '" class="dpImg" border="0" src="images/minus.gif" valign="middle" alt="*" />';
             }
             echo '<a name="dt' . $this->id . '" class="dt">' . $this->strCaption . '</a></div>';
         }
         echo '<div id="detailPreview' . $this->id . '" class="' . $pageSkinStyle . ' runner-pagewrapper dpStyle">' . $contents . '</div>';
         return;
     }
     //add for details preview page skin and style
     $respArr = array();
     // add cMap, sett
     $this->addControlsJSAndCSS();
     $this->fillSetCntrlMaps();
     $respArr['controlsMap'] = $this->controlsHTMLMap;
     $respArr['viewControlsMap'] = $this->viewControlsHTMLMap;
     $respArr['settings'] = $this->jsSettings;
     $respArr['html'] = $contents;
     $respArr['success'] = true;
     $respArr['id'] = $this->id;
     $respArr['idStartFrom'] = $this->flyId;
     $respArr['delRecs'] = $this->recordsDeleted;
     if ($this->deleteMessage != '') {
         $respArr['delMess'] = true;
     }
     $respArr["additionalJS"] = $this->grabAllJsFiles();
     $respArr["additionalCSS"] = $this->grabAllCSSFiles();
     echo '<textarea>' . htmlspecialchars(my_json_encode($respArr)) . '</textarea>';
 }
 /**
  * Show a detail preview page
  * @param Array params - asp compatibility issue
  */
 public function showPageDp($params = "")
 {
     global $page_layouts;
     $this->BeforeShowList();
     $this->prepareTemplate();
     $contents = $this->xt->fetch_loaded("body");
     //add for details preview page skin and style
     $layout =& $page_layouts[$this->shortTableName . '_' . $this->pageType];
     $pageSkinStyle = $layout->style . " page-" . $layout->name;
     $this->xt->assign("dpShowHide", true);
     $this->xt->assign("dpMinus", true);
     $this->xt->assign("dpShowHide_attrs", 'id="dpShowHide' . $this->id . '"');
     $this->xt->assign("dpMinus_attrs", 'id="dpMinus' . $this->id . '"');
     $this->xt->assign("dt_attrs", 'name="dt' . $this->id . '"');
     if (GetGlobalData("printDetailTableName", false)) {
         $this->xt->assign("dpShowHide", false);
         $this->xt->assign("dpMinus", false);
     }
     if (postvalue("pdf") == 1) {
         $this->xt->assign("dpMinus", false);
     }
     echo '<div id="detailPreview' . $this->id . '" class="' . $pageSkinStyle . ' rnr-pagewrapper dpStyle">' . $contents . '</div>';
 }
Beispiel #14
0
 /**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page 
  */
 function &createListPage($table, $options)
 {
     global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity;
     $gSettings = new ProjectSettings($strTableName, $options['pageType']);
     $gQuery = $gSettings->getSQLQuery();
     $params = array();
     $params = $options;
     $params['origTName'] = $gSettings->getOriginalTableName();
     $params['sessionPrefix'] = $strTableName;
     $params['tName'] = $table;
     $params['conn'] =& $conn;
     $params['gPageSize'] = $gSettings->getInitialPageSize();
     $params['gOrderIndexes'] = $gSettings->getOrderIndexes();
     $params['gstrOrderBy'] = $gQuery->OrderByToSql();
     $params['gsqlHead'] = $gQuery->HeadToSql();
     $params['gsqlFrom'] = $gQuery->FromToSql();
     $params['gsqlWhereExpr'] = $gQuery->WhereToSql();
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery);
     $params['locale_info'] =& $locale_info;
     $params["subQueriesSupp"] = $bSubqueriesSupported;
     $params['nSecOptions'] = $gSettings->getAdvancedSecurityType();
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = $gSettings->getRecordsPerRowList();
     $params['dbType'] = GetGlobalData("dbType", 0);
     $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField();
     $params['moveNext'] = $gSettings->useMoveNext();
     $params['exportTo'] = $gSettings->hasExportPage();
     $params['printFriendly'] = $gSettings->hasPrintPage();
     $params['deleteRecs'] = $gSettings->hasDelete();
     $params['rowHighlite'] = $gSettings->highlightRows();
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = $gSettings->getTableKeys();
     $params["isUseInlineAdd"] = $gSettings->hasInlineAdd();
     $params["isUseInlineEdit"] = $gSettings->hasInlineEdit();
     $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"];
     $params["panelSearchFields"] = $gSettings->getPanelSearchFields();
     $params['isVerLayout'] = $gSettings->isVerticalLayoutList();
     $params['isDisplayLoading'] = $gSettings->displayLoading();
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['subQueriesSupAccess'] = $gSettings->tableSupportsSubqueries();
     $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage();
     $params['totalsFields'] = $gSettings->getTotalsFields();
     $params['listIcons'] = $gSettings->iconsOnList();
     $params['edit'] = $gSettings->hasEditPage();
     $params['inlineEdit'] = $gSettings->hasInlineEdit();
     $params['iCopy'] = $gSettings->hasCopyPage();
     $params['iView'] = $gSettings->hasViewPage();
     $params['listAjax'] = $gSettings->ajaxBasedListPage();
     $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray();
     $params['isScrollGridBody'] = $gSettings->getScrollGridBody();
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = $gSettings->getListFields();
     foreach ($allfields as $f) {
         if (!$gSettings->appearOnListPage($f)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         }
                     }
                 }
             }
         }
     }
     return $pageObject;
 }
function isEnableSection508()
{
    return GetGlobalData("isSection508", false);
}
	function cutHTMLSuggestValue($value, $searchFor, $dots = true)
	{
		$SuggestStringSize = GetGlobalData("suggestStringSize", 40);

		if( $SuggestStringSize <= runner_strlen($searchFor) )
			return $searchFor;
		
		if( $SuggestStringSize < runner_strlen($value) )
		{
			$startPos = 0;
			$valueLength = 0;
			$value = $this->cutStr($value, $searchFor, $SuggestStringSize, $startPos, $valueLength);
            
			if ($dots)
			{
				if( $startPos > 0 )
					$value = "...".$value;
				
				if( $startPos + $SuggestStringSize != $valueLength )
					$value.= "...";
			}
		}
		
		return $value;
	}
Beispiel #17
0
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     $viewFormat = $this->pageObject->pSetEdit->getViewFormat($this->field);
     if ($viewFormat == FORMAT_NUMBER) {
         $value = str_format_number($value, $this->pageObject->pSetEdit->isDecimalDigits($this->field));
         $dotPosition = strpos($value, '.');
         if ($dotPosition !== FALSE) {
             for ($i = strlen($value) - 1; $i > $dotPosition; $i--) {
                 if (substr($value, $i, 1) != '0') {
                     if ($i < strlen($value) - 1) {
                         $value = substr($value, 0, $i + 1);
                     }
                     break;
                 } else {
                     if ($i == $dotPosition + 1 && $dotPosition > 0) {
                         $value = substr($value, 0, $dotPosition);
                         break;
                     }
                 }
             }
         }
     }
     $searchStringSize = GetGlobalData("suggestStringSize", 40);
     if ($searchStringSize <= strlen($searchFor)) {
         $response[$searchFor . ""] = $searchFor . "";
     } else {
         $realValue = $value;
         if ($searchStringSize < strlen($value)) {
             $diff = $searchStringSize - strlen($searchFor);
             $lDiff = floor($diff / 2);
             $rDiff = $diff - $lDiff;
             if ($this->pageObject->pSetEdit->getNCSearch()) {
                 $startPos = stripos($value, $searchFor);
             } else {
                 $startPos = strpos($value, $searchFor);
             }
             $searchStartPos = $startPos;
             $valueLength = strlen($value);
             if ($startPos - $lDiff < 0) {
                 $rDiff -= $startPos - $lDiff;
                 $startPos = 0;
             } else {
                 $startPos -= $lDiff;
             }
             if ($startPos > 0) {
                 $found = false;
                 for ($i = $startPos - 1; $i >= $startPos - 5 && $i >= 0; $i--) {
                     if ($i == 0 || $this->isStopSimbol(substr($value, $i, 1))) {
                         if ($i == 0) {
                             $startPos = 0;
                         } else {
                             $startPos = $i + 1;
                         }
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     for ($i = $startPos; $i <= $startPos + 5 && $i < $searchStartPos; $i++) {
                         if ($this->isStopSimbol(substr($value, $i, 1))) {
                             $startPos = $i + 1;
                             break;
                         }
                     }
                 }
                 $brakePos = strrpos($value, "\n", $searchStartPos - $valueLength);
                 if ($brakePos !== FALSE && $brakePos > $startPos) {
                     $startPos = $brakePos + 1;
                 }
                 $brakePos = strrpos($value, "\r", $searchStartPos - $valueLength);
                 if ($brakePos !== FALSE && $brakePos > $startPos) {
                     $startPos = $brakePos + 1;
                 }
             }
             if ($startPos + $searchStringSize > $valueLength) {
                 $searchStringSize = $valueLength - $startPos;
             }
             if ($startPos + $searchStringSize < $valueLength) {
                 $found = false;
                 $tempStartPos = $startPos + $searchStringSize;
                 for ($i = $tempStartPos + 1; $i <= $tempStartPos + 5 && $i < $valueLength; $i++) {
                     if ($i == $valueLength - 1 || $this->isStopSimbol(substr($value, $i, 1))) {
                         if ($i == $valueLength - 1) {
                             $searchStringSize = $i - $startPos + 1;
                         } else {
                             $searchStringSize = $i - $startPos;
                         }
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     for ($i = $tempStartPos; $i >= $tempStartPos - 5; $i--) {
                         if ($this->isStopSimbol(substr($value, $i, 1))) {
                             $searchStringSize = $i - $startPos;
                             break;
                         }
                     }
                 }
                 $brakePos = strpos($value, "\n", $searchStartPos + strlen($searchFor));
                 if ($brakePos !== FALSE && $brakePos < $startPos + $searchStringSize) {
                     $searchStringSize = $brakePos - $startPos - 1;
                 }
                 $brakePos = strpos($value, "\r", $searchStartPos + strlen($searchFor));
                 if ($brakePos !== FALSE && $brakePos < $startPos + $searchStringSize) {
                     $searchStringSize = $brakePos - $startPos - 1;
                 }
             }
             $value = substr($value, $startPos, $searchStringSize);
             $realValue = $value;
             if ($startPos > 0) {
                 $value = "..." . $value;
             }
             if ($startPos + $substrLength != $valueLength) {
                 $value .= "...";
             }
         }
         $response[$value . ""] = $realValue . "";
     }
 }
Beispiel #18
0
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     if (!GetGlobalData("handleSearchSuggestInLookup", true)) {
         parent::suggestValue($value, $searchFor, $response, $row);
         return;
     }
     global $conn;
     $lookupSQL = buildLookupSQL($this->lookupPageType, $this->field, $this->pageObject->tName, "", $value, false, true, false, true, true, true);
     $this->fillLookupFieldsIndexes();
     $rs_lookup = db_query($lookupSQL, $conn);
     if ($data = db_fetch_numarray($rs_lookup)) {
         if ($this->isDisplayFieldEncrypted) {
             $lookup_value = $this->ciphererDisplay->DecryptField($this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field, $data[$this->displayFieldIndex]);
         } else {
             $lookup_value = $data[$this->displayFieldIndex];
         }
         parent::suggestValue($lookup_value, $searchFor, $response, $row);
     }
 }
Beispiel #19
0
 /**
  * Fill the response array with the suggest values
  *
  * @param String value	
  *		Note: value is preceeded with "_" 
  * @param String searchFor
  * @param &Array response
  * @param &Array row
  */
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     if (!GetGlobalData("handleSearchSuggestInLookup", true) || $this->lookupType == LT_LISTOFVALUES || $this->isSearchByDispalyedFieldAllowed()) {
         parent::suggestValue($value, $searchFor, $response, $row);
         return;
     }
     // "_" is added to convert number type to string in lookupsuggest.php ($value)
     $lookupSQL = $this->getLookupSQL("", substr($value, 1), false, true, false, true, true);
     $this->fillLookupFieldsIndexes();
     $qResult = $this->lookupConnection->query($lookupSQL);
     if ($data = $qResult->fetchNumeric()) {
         // "_" is added to convert number type to string
         if ($this->isDisplayFieldEncrypted) {
             $displayFieldName = $this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field;
             $lookup_value = $this->ciphererDisplay->DecryptField($displayFieldName, "_" . $data[$this->displayFieldIndex]);
         } else {
             $lookup_value = "_" . $data[$this->displayFieldIndex];
         }
         parent::suggestValue($lookup_value, $searchFor, $response, $row);
     }
 }
Beispiel #20
0
 /**
  * Add additional fields to field settings
  * Use only for: 
  * 		register page,
  * 		changepwd page,	
  * 		admin members page with Active Directory
  * @intellisense
  */
 function addExtraFieldsToFieldSettings($isCaptcha = false)
 {
     $extraParams = array('fields' => array());
     if ($isCaptcha) {
         $extraParams['fields'] = array('captcha');
         $extraParams['format'] = 'Text Field';
     } else {
         if ($this->pageType == PAGE_REGISTER) {
             $extraParams['fields'] = array('confirm');
             $extraParams['format'] = 'Password';
         } else {
             if ($this->pageType == PAGE_CHANGEPASS) {
                 $extraParams['fields'] = array('oldpass', 'newpass', 'confirm');
                 $extraParams['format'] = 'Password';
             } else {
                 if (GetGlobalData("nLoginMethod", 0) == SECURITY_AD && $this->mode == MEMBERS_PAGE) {
                     $extraParams['fields'] = array('displayname', 'name', 'category');
                     $extraParams['format'] = 'Text Field';
                 }
             }
         }
     }
     foreach ($extraParams['fields'] as $fName) {
         $arrSetVals = array();
         $arrSetVals['strName'] = $fName;
         $arrSetVals['EditFormat'] = $extraParams['format'];
         $arrSetVals['validation']['validationArr'][] = 'IsRequired';
         $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType] = $arrSetVals;
     }
 }
    exit(0);
}
require_once "include/" . $table . "_variables.php";
$searchFor = postvalue('searchFor');
// if nothing to search
if ($searchFor == '') {
    echo printJSON(array('success' => true, 'result' => ''));
    return;
}
$_connection = $cman->byTable($strTableName);
// array of vals
$response = array();
$searchOpt = postvalue("start") ? "Starts with" : "Contains";
$searchField = GoodFieldName(postvalue('searchField'));
$strSecuritySql = SecuritySQL("Search", $strTableName);
$numberOfSuggests = GetGlobalData("searchSuggestsNumber", 10);
$pSet = new ProjectSettings($strTableName, PAGE_SEARCH);
if ($searchField == "") {
    $allSearchFields = $pSet->getGoogleLikeFields();
} else {
    // array of fields which were added in wizard for search
    $allSearchFields = $pSet->getAllSearchFields();
}
require_once getabspath('classes/controls/EditControlsContainer.php');
$detailKeys = array();
$masterWhere = "";
$cipherer = new RunnerCipherer($strTableName);
$controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer);
if (@$_SESSION[$strTableName . "_mastertable"] != "") {
    $masterTablesInfoArr = $pSet->getMasterTablesArr($strTableName);
    for ($i = 0; $i < count($masterTablesInfoArr); $i++) {
Beispiel #22
0
             $fmt = str_replace("%%", "" . $pwdLen, $fmt);
             $msg .= "<br>" . $fmt;
         }
         $pwdUnique = GetGlobalData("pwdUnique", 0);
         if ($pwdUnique) {
             $fmt = "Password must contain %% unique characters.";
             $fmt = str_replace("%%", "" . $pwdUnique, $fmt);
             $msg .= "<br>" . $fmt;
         }
         $pwdDigits = GetGlobalData("pwdDigits", 0);
         if ($pwdDigits) {
             $fmt = "Password must contain %% digits or symbols.";
             $fmt = str_replace("%%", "" . $pwdDigits, $fmt);
             $msg .= "<br>" . $fmt;
         }
         if (GetGlobalData("pwdUpperLower", false)) {
             $fmt = "Password must contain letters in upper and lower case.";
             $msg .= "<br>" . $fmt;
         }
         if ($msg) {
             $msg = substr($msg, 4);
         }
         $pageObject->jsSettings['tableSettings'][$strTableName]['msg_passwordError'] = $msg;
         $allow_registration = false;
     }
 }
 $retval = true;
 if ($allow_registration) {
     if ($globalEvents->exists("BeforeRegister")) {
         $retval = $globalEvents->BeforeRegister($values, $strMessage, $pageObject);
     }
Beispiel #23
0
 function initLookupParams()
 {
     $this->parId = postvalue("parId");
     $this->firstTime = postvalue("firsttime");
     $this->mainField = postvalue("field");
     $this->lookupControl = postvalue("control");
     $this->lookupCategory = postvalue("category");
     $this->mainTable = postvalue("table");
     global $tables_data;
     include_once getabspath('include/' . GetTableURL($this->mainTable) . '_settings.php');
     $this->pSet = new ProjectSettings($this->tName, PAGE_SEARCH);
     $this->lookupParams = "mode=lookup&id=" . $this->id . "&parId=" . $this->parId . "&field=" . rawurlencode($this->mainField) . "&control=" . rawurlencode($this->lookupControl) . "&category=" . rawurlencode($this->lookupCategory) . "&table=" . rawurlencode($this->mainTable) . "&editMode=" . postvalue('editMode');
     $this->sessionPrefix = $this->tName . "_lookup_" . $this->mainTable . '_' . $this->mainField;
     $pageType = postvalue("pageType");
     if ($pageType != PAGE_ADD && $pageType != PAGE_EDIT) {
         $pageType = PAGE_SEARCH;
     }
     $lookupPSet = new ProjectSettings($this->mainTable, $pageType);
     $this->linkField = $lookupPSet->getLWLinkField($this->mainField, false);
     $this->dispField = $lookupPSet->getLWDisplayField($this->mainField, false);
     if ($lookupPSet->getCustomDisplay($this->mainField)) {
         $this->dispFieldAlias = GetGlobalData("dispFieldAlias", "rrdf1");
         $this->pSet->getSQLQuery()->AddCustomExpression($lookupPSet->getDisplayField($this->mainField), $this->pSet, $this->mainTable, $this->mainField, $this->dispFieldAlias);
         $this->customField = $this->linkField;
     }
     $this->outputFieldValue($this->linkField, 2);
     $this->outputFieldValue($this->dispField, 2);
     if ($lookupPSet->useCategory($this->mainField)) {
         $this->categoryField = $lookupPSet->getCategoryFilter($this->mainField);
     }
     $this->strLookupWhere = GetLWWhere($this->mainField, $this->pageType, $this->mainTable);
     if ($this->dispFieldAlias && $this->pSet->appearOnListPage($this->dispField)) {
         $this->lookupSelectField = $this->dispField;
     } elseif ($this->pSet->appearOnListPage($this->dispField)) {
         $this->lookupSelectField = $this->dispField;
     } else {
         $this->lookupSelectField = $this->listFields[0]['fName'];
     }
     if ($this->categoryField) {
         if (!strlen(GetFullFieldName($this->categoryField))) {
             $this->categoryField = "";
         }
     }
     if (!$this->categoryField) {
         $this->lookupCategory = "";
     }
 }
Beispiel #24
-1
 /**
  * Fill the response array with the suggest values
  *
  * @param String value	
  *		Note: value is preceeded with "_" 
  * @param String searchFor
  * @param &Array response
  * @param &Array row
  */
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     $SuggestStringSize = GetGlobalData("suggestStringSize", 40);
     if ($SuggestStringSize <= runner_strlen($searchFor)) {
         $response["_" . $searchFor] = $searchFor;
         return;
     }
     $viewFormat = $this->pageObject->pSetEdit->getViewFormat($this->field);
     if ($viewFormat == FORMAT_NUMBER) {
         $dotPosition = strpos($value, '.');
         if ($dotPosition !== FALSE) {
             for ($i = strlen($value) - 1; $i > $dotPosition; $i--) {
                 if (substr($value, $i, 1) != '0') {
                     if ($i < strlen($value) - 1) {
                         $value = substr($value, 0, $i + 1);
                     }
                     break;
                 }
                 if ($i == $dotPosition + 1 && $dotPosition > 0) {
                     $value = substr($value, 0, $dotPosition);
                     break;
                 }
             }
         }
     }
     $realValue = $value;
     if ($viewFormat == FORMAT_HTML) {
         // declarate patterns for regex
         $html_tags = '/<.*?>/i' . ($useUTF8 ? 'u' : '');
         $get_text = '/(.*<.*>|^.*?)([.]*' . preg_quote($searchFor, "/") . '.*?)(<.*>|$)/i' . ($useUTF8 ? 'u' : '');
         // decode html entity and delete all html tags from value
         $value = preg_replace($html_tags, '', runner_html_entity_decode($value));
         // if not searchFor in value return
         if (stristr($value, $searchFor) === false) {
             return;
         }
         // get realValue (string between html tags)
         if (preg_match($get_text, $realValue, $match)) {
             $realValue = $match[2];
         } else {
             $realValue = $value;
         }
     }
     // if large string cut value and add dots
     if ($SuggestStringSize < runner_strlen($value)) {
         $startPos = 0;
         $valueLength = 0;
         $value = $this->cutStr($value, $searchFor, $SuggestStringSize, $startPos, $valueLength);
         if ($viewFormat !== FORMAT_HTML) {
             // because realValue and value different (according to algorithm)
             $realValue = $value;
         }
         if ($startPos > 0) {
             $value = "..." . $value;
         }
         if ($startPos + $SuggestStringSize != $valueLength) {
             $value .= "...";
         }
     }
     $response[$value] = $realValue;
 }