Example #1
0
 /**
  * add where clause with foreign keys of current table and it's master table master keys
  *
  * @return string
  */
 function addWhereWithMasterTable()
 {
     $where = "";
     if (count($this->detailKeysByM)) {
         for ($i = 0; $i < count($this->detailKeysByM); $i++) {
             if ($i != 0) {
                 $where .= " and ";
             }
             if ($this->cipherer && isEncryptionByPHPEnabled()) {
                 $mValue = $this->cipherer->MakeDBValue($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
             } else {
                 $mValue = make_db_value($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
             }
             if (!empty($mValue)) {
                 $where .= GetFullFieldName($this->detailKeysByM[$i], "", false) . "=" . $mValue;
             } else {
                 $where .= "1=0";
             }
         }
     }
     return $where;
 }
	/**
	 * Get the field name that is ready to use in an SQL query 
	 * @param String field
	 * @param Object cipherer
	 */
	function getFullFieldNameCiph($field, $cipherer = null)
	{
		$fname = $this->getFieldData($field, "FullName");
		if( $fname == "" )
			$fname = AddFieldWrappers($field);
		
		if( $cipherer && $this->hasEncryptedFields() && !isEncryptionByPHPEnabled()) 
			return $cipherer->GetFieldName($fname, $field);
		
		return $fname;
	}
Example #3
0
 function Chart(&$ch_array, $param)
 {
     global $field_labels;
     if ($this->webchart) {
         $this->chrt_array = Convert_Old_Chart($ch_array);
     } else {
         $this->chrt_array = $ch_array;
     }
     $this->setConnection();
     $this->pSet = new ProjectSettings($this->chrt_array['tables'][0]);
     $this->showDetails = $param['showDetails'];
     if ($this->showDetails) {
         $this->detailTablesData = $this->pSet->getDetailTablesArr();
     }
     $this->hasFlash = $param["hasFlash"];
     $this->pageId = $param["pageId"];
     $this->chrt_array["appearance"]["autoupdate"] = false;
     $this->numRecordsToShow = $this->chrt_array['appearance']['maxbarscroll'];
     if ($this->numRecordsToShow < 1) {
         $this->numRecordsToShow = 1;
     }
     $this->table_type = $this->chrt_array["table_type"];
     if (!$this->table_type) {
         $this->table_type = "project";
     }
     $this->webchart = $param["webchart"];
     $this->cname = $param["cname"];
     $this->chartPreview = $param["chartPreview"];
     $this->dashChart = $param["dashChart"];
     $this->sessionPrefix = $this->chrt_array['tables'][0];
     if ($this->dashChart) {
         $this->dashTName = $param["dashTName"];
         $this->dashElementName = $param["dashElementName"];
         $this->sessionPrefix = $this->dashTName . "_" . $this->sessionPrefix;
     }
     $this->gstrOrderBy = $param["gstrOrderBy"];
     $TableName = GoodFieldName($this->chrt_array['tables'][0]);
     // #10461, $this->setConnection(); needs to be called after value is assigned to $this->webchart
     $this->setConnection();
     if ($this->isProjectDB()) {
         $this->cipherer = new RunnerCipherer($this->chrt_array['tables'][0]);
     }
     $this->header = $this->chrt_array['appearance']['head'];
     $this->footer = $this->chrt_array['appearance']['foot'];
     $this->y_axis_label = $this->chrt_array['appearance']['y_axis_label'];
     for ($i = 0; $i < count($this->chrt_array['parameters']) - 1; $i++) {
         if (isset($this->chrt_array['parameters'][$i]['currencyFormat'])) {
             $this->arrFormatCurrency[] = $this->chrt_array['parameters'][$i]['currencyFormat'];
         } else {
             if ($this->chrt_array['appearance']['scur'] == "false") {
                 $this->arrFormatCurrency[] = "";
             } else {
                 $this->arrFormatCurrency[] = $this->chrt_array['appearance']['scur'];
             }
         }
         if (isset($this->chrt_array['parameters'][$i]['decimalFormat'])) {
             $this->arrFormatDecimal[] = $this->chrt_array['parameters'][$i]['decimalFormat'];
         } else {
             $this->arrFormatDecimal[] = $this->chrt_array['appearance']['dec'];
         }
         $this->arrFormatCustomer[] = $this->chrt_array['parameters'][$i]['customFormat'];
         $this->arrFormatCustomerStr[] = $this->chrt_array['parameters'][$i]['customFormatStr'];
         if ($this->chrt_array["chart_type"]["type"] == "ohlc" || $this->chrt_array["chart_type"]["type"] == "candlestick") {
             $this->arrOHLC_color[] = "#" . $this->chrt_array['parameters'][$i]['ohlcColor'];
             if ($this->table_type != "db") {
                 $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['ohlcOpen'];
                 $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['ohlcHigh'];
                 $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['ohlcLow'];
                 $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['ohlcClose'];
             } else {
                 if ($this->chrt_array['parameters'][$i]['agr_func']) {
                     $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen'];
                     $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh'];
                     $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow'];
                     $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose'];
                 } else {
                     $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen'];
                     $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh'];
                     $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow'];
                     $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose'];
                 }
             }
             if ($this->chrt_array["chart_type"]["type"] == "candlestick") {
                 $this->arrOHLC_candle[] = "#" . $this->chrt_array['parameters'][$i]['ohlcCandleColor'];
             }
         } elseif ($this->chrt_array['parameters'][$i]['name'] != "") {
             if ($this->table_type != "db") {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['name'];
                 if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                     $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['size'];
                 }
             } else {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'] : $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'];
                 if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                     $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['size'];
                 }
             }
             if (isset($this->chrt_array['appearance']['scolor' . ($i + 1) . '1'])) {
                 $this->arrDataColor[] = $this->chrt_array['appearance']['scolor' . ($i + 1) . '1'];
             } else {
                 $this->arrDataColor[] = $this->chrt_array['parameters'][$i]['series_color'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "gauge") {
                 for ($k = 0; is_array($this->chrt_array["parameters"][$i]["gaugeColorZone"]) && $k < count($this->chrt_array["parameters"][$i]["gaugeColorZone"]); $k++) {
                     $beginColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeBeginColor"];
                     $endColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeEndColor"];
                     $gColor = "#" . @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeColor"];
                     $this->arrGaugeColor[count($this->arrDataSeries) - 1][] = array($beginColor, $endColor, $gColor);
                 }
             }
         }
         if ($this->table_type == "project" && !$this->webchart) {
             if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") {
                 $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['name'])));
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['ohlcOpen'])));
             }
         } else {
             if (!$this->chart_xmlencode($this->chrt_array['parameters'][$i]['label'])) {
                 if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") {
                     $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['name']);
                 } else {
                     $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['ohlcOpen']);
                 }
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['label']);
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "gauge") {
         if ($this->table_type != "db") {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         } else {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] ? $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] : $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         }
         for ($j = 0; $j < count($this->chrt_array['fields']); $j++) {
             if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) {
                 if ($this->table_type == "project") {
                     $this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'])));
                 } else {
                     $this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']);
                 }
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") {
         foreach ($this->arrDataColor as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrDataColor[$ind];
             }
         }
     } else {
         foreach ($this->arrOHLC_color as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrOHLC_color[$ind];
             }
         }
     }
     // prepare search params
     $gQuery = $this->pSet->getSQLQuery();
     $masterWhere = "";
     if (!$this->dashChart) {
         $masterTable = $_SESSION[$this->sessionPrefix . "_mastertable"];
         $detailKeysByM = $this->pSet->getDetailKeysByMasterTable($masterTable);
         if (count($detailKeysByM)) {
             for ($i = 0; $i < count($detailKeysByM); $i++) {
                 if ($i != 0) {
                     $masterWhere .= " and ";
                 }
                 if ($this->cipherer && isEncryptionByPHPEnabled()) {
                     $mValue = $this->cipherer->MakeDBValue($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
                 } else {
                     $mValue = make_db_value($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
                 }
                 if (strlen($mValue) != 0) {
                     $masterWhere .= RunnerPage::_getFieldSQLDecrypt($detailKeysByM[$i], $this->connection, $this->pSet, $this->cipherer) . "=" . $mValue;
                 } else {
                     $masterWhere .= "1=0";
                 }
             }
         }
     }
     $strWhereClause = "";
     $searchHavingClause = "";
     $strSearchCriteria = "and";
     global $strTableName;
     // search where for basic charts
     if (!$this->webchart) {
         if (!$this->chartPreview && isset($_SESSION[$this->sessionPrefix . '_advsearch'])) {
             $searchClauseObj = SearchClause::UnserializeObject($_SESSION[$this->sessionPrefix . '_advsearch']);
             include_once getabspath('classes/controls/EditControlsContainer.php');
             $editControls = new EditControlsContainer(null, $this->pSet, PAGE_SEARCH, $this->cipherer);
             $whereComponents = RunnerPage::sGetWhereComponents($gQuery, $this->pSet, $searchClauseObj, $editControls, $this->connection);
             $strWhereClause = $whereComponents["searchWhere"];
             foreach ($whereComponents["filterWhere"] as $fWhere) {
                 $strWhereClause = whereAdd($strWhereClause, $fWhere);
             }
             $searchHavingClause = $whereComponents["searchHaving"];
             foreach ($whereComponents["filterHaving"] as $fHaving) {
                 $searchHavingClause = whereAdd($searchHavingClause, $fHaving);
             }
             $strSearchCriteria = $whereComponents["searchUnionRequired"] ? "or" : "and";
         }
     } else {
         if ($this->table_type != "project") {
             $strTableName = "webchart" . $this->cname;
         }
         $strWhereClause = CalcSearchParam($this->table_type != "project");
     }
     if ($strWhereClause) {
         $this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")";
     }
     if ($this->table_type == "project") {
         if (SecuritySQL("Search", $this->chrt_array['tables'][0])) {
             $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search", $strTableName));
         }
         $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
         $strOrderBy = $this->gstrOrderBy;
         $this->strSQL .= " " . $strOrderBy;
         if ($masterWhere) {
             $strWhereClause = whereAdd($strWhereClause, $masterWhere);
         }
         $strSQLbak = $this->strSQL;
         if (tableEventExists("BeforeQueryChart", $strTableName)) {
             $tstrSQL = $this->strSQL;
             $eventObj = getEventObject($strTableName);
             $eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy);
             $this->strSQL = $tstrSQL;
         }
         if ($strSQLbak == $this->strSQL) {
             $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
             $this->strSQL .= " " . $strOrderBy;
         }
     }
     if ($this->cname && $this->table_type == "db") {
         $this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by'];
     } elseif ($this->cname && $this->table_type == "custom") {
         if (!IsStoredProcedure($this->chrt_array['sql'])) {
             $sql_query = $this->chrt_array['sql'];
             if ($this->connection->dbType == nDATABASE_MSSQLServer) {
                 $pos = strrpos(strtoupper($sql_query), "ORDER BY");
                 if ($pos) {
                     $sql_query = substr($sql_query, 0, $pos);
                 }
             }
             if ($this->connection->dbType != nDATABASE_Oracle) {
                 $this->strSQL = "select * from (" . $sql_query . ") as " . $this->connection->addFieldWrappers("custom_query") . $this->chrt_array['where'];
             } else {
                 $this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where'];
             }
         } else {
             $this->strSQL = $this->chrt_array['sql'];
         }
     }
     if (tableEventExists("UpdateChartSettings", $strTableName)) {
         $eventObj = getEventObject($strTableName);
         $eventObj->UpdateChartSettings($this);
     }
 }
Example #4
0
function GetFullFieldName($field, $table = "", $addAs = true)
{
    if ($table == "") {
        global $strTableName;
        $table = $strTableName;
    }
    $pSet = new ProjectSettings($table);
    $fname = $pSet->getFullNameField($field);
    if ($pSet->hasEncryptedFields() && !isEncryptionByPHPEnabled()) {
        $cipherer = new RunnerCipherer($table);
        return $cipherer->GetFieldName($fname, $field) . ($cipherer->isFieldEncrypted($field) && $addAs ? " as " . AddFieldWrappers($field) : "");
    }
    return $fname;
}
Example #5
0
	function toSql($query, $addAlias = true)
	{
		$ret = '';
		if($this->m_expr)
		{
			if(is_string($this->m_expr))
			{
				$ret = $this->m_expr;
			}
			else
			{
				if(is_a($this->m_expr, 'SQLQuery'))
				{
					$ret = $this->m_sql;
				}
				else
				{
					$ret = $this->m_expr->toSql($query);
				}
				
			}
		}
		if($this->m_isEncrypted && !isEncryptionByPHPEnabled())
			$ret = $query->cipherer->GetEncryptedFieldName($ret);
		if($addAlias){
			if($this->m_alias != "")
			{
				$ret .= ' as ' . AddFieldWrappers($this->m_alias); // SmartAddAliasWrappers(m_alias)
			}
			elseif(is_object($this->m_expr))
			{
				if($this->m_expr->IsSQLField() && $query->cipherer != null && !isEncryptionByPHPEnabled())
				{
					if($query->cipherer->isFieldEncrypted($this->m_expr->m_strName)){
						$ret .= ' as ' . AddFieldWrappers($this->m_expr->m_strName); 
					}
				}
			}
		}
		return $ret;
	}
Example #6
0
 /**
  * returns where clause for active master-detail relationship
  *
  * @return string
  */
 function getMasterTableSQLClause()
 {
     $where = "";
     if (count($this->detailKeysByM)) {
         for ($i = 0; $i < count($this->detailKeysByM); $i++) {
             if ($i != 0) {
                 $where .= " and ";
             }
             if ($this->cipherer && isEncryptionByPHPEnabled()) {
                 $mValue = $this->cipherer->MakeDBValue($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
             } else {
                 $mValue = make_db_value($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)], "", "", $this->tName);
             }
             if (strlen($mValue) != 0) {
                 $where .= $this->getFieldSQLDecrypt($this->detailKeysByM[$i]) . "=" . $mValue;
             } else {
                 $where .= "1=0";
             }
         }
     }
     return $where;
 }
/**
 * DEPRECATED! Use RunnerPage::_getFieldSQLDecrypt instead
 * Return the full database field original name
 * 
 * @param string	$field
 * @param string	$table The datasource table name
 * @param boolean	$addAs OPTIONAL
 * 
 * @return String
 * @intellisense
 * @deprecated
 */
function GetFullFieldName($field, $table = "", $addAs = true, $connection = null)
{
    global $strTableName, $cman;
    if ($table == "") {
        $table = $strTableName;
    }
    if (!$connection) {
        $connection = $cman->byTable($table);
    }
    $pSet = new ProjectSettings($table);
    $fname = RunnerPage::_getFieldSQL($field, $connection, $pSet);
    if ($pSet->hasEncryptedFields() && !isEncryptionByPHPEnabled()) {
        $cipherer = new RunnerCipherer($table);
        return $cipherer->GetFieldName($fname, $field) . ($cipherer->isFieldEncrypted($field) && $addAs ? " as " . $connection->addFieldWrappers($field) : "");
    }
    return $fname;
}
Example #8
0
 /**
  * DecryptField
  * Determine if field encrypted and decrypt value if it so 
  * Please note, when changing this function you should make appropriate changes in wizard method (dynamic permissions --> add new user) #8923
  * @param {string} field name
  * @param {string} value
  * @return {string} decrypted or plain value
  */
 public function DecryptField($field, $value)
 {
     if ($this->isFieldEncrypted($field) && isEncryptionByPHPEnabled()) {
         if (is_null($this->DESFunctions)) {
             $this->DESFunctions = new RunnerCiphererDES($this->key);
         }
         return $this->DESFunctions->DESDecrypt($value);
     }
     return $value;
 }
Example #9
0
 function RunnerPage(&$params)
 {
     global $locale_info, $cCharset, $page_layouts;
     // copy properties to object
     RunnerApply($this, $params);
     $this->pSet = new ProjectSettings($this->tName, $this->pageType);
     $this->pSetEdit = $this->pSet;
     $this->cipherer = new RunnerCipherer($this->tName, $this->pSet);
     include_once getabspath("classes/controls/EditControlsContainer.php");
     $this->controls = new EditControlsContainer($this);
     include_once getabspath("classes/controls/ViewControlsContainer.php");
     $this->viewControls = new ViewControlsContainer($this->pSet, $this->pageType, $this);
     $this->gQuery = $this->pSet->getSQLQuery();
     //set google map configuration
     $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);
     }
     if (!$this->sessionPrefix) {
         $this->sessionPrefix = $this->tName;
     }
     $this->setSessionVariables();
     //	get locking object
     $this->lockingObj = GetLockingObject($this->tName);
     $this->is508 = isEnableSection508();
     $this->isEncryptionEnabled = isEncryptionEnabled();
     $this->isEncryptionByPHPEnabled = isEncryptionByPHPEnabled();
     $this->isUseVideo = $this->pSet->isUseVideo();
     $this->isUseAudio = $this->pSet->isUseAudio();
     $this->strCaption = GetTableCaption(GoodFieldName($this->tName));
     $this->isTableType = $this->pSet->isTableType();
     $this->isAddWebRep = GetGlobalData("isAddWebRep", false);
     //	get details keys by master table
     $this->detailKeysByM = $this->pSet->getDetailKeysByMasterTable($this->masterTable);
     $this->isDynamicPerm = GetGlobalData("isDynamicPerm", false);
     $this->shortTableName = $this->pSet->getShortTableName();
     $this->showAddInPopup = $this->pSet->isShowAddInPopup();
     $this->showEditInPopup = $this->pSet->isShowEditInPopup();
     $this->showViewInPopup = $this->pSet->isShowViewInPopup();
     $this->isResizeColumns = $this->pSet->isResizeColumns();
     $this->isUseAjaxSuggest = $this->pSet->isUseAjaxSuggest();
     $this->useDetailsPreview = $this->pSet->isUseDetailsPreview();
     $this->isShowDetailTables = displayDetailsOn($this->tName, $this->pageType);
     //	get all details table for current table
     $this->allDetailsTablesArr = $this->pSet->getDetailTablesArr();
     //	set template file
     $this->setTemplateFile();
     //	init jsSettings
     $this->jsSettings["tableSettings"][$this->tName] = array();
     $this->jsSettings["tableSettings"][$this->tName]["proxy"] = array("proxy" => "");
     $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']['hasEvents'] = array("default" => false, "jsName" => "hasEvents");
     $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']['isVerLayout'] = array("default" => false, "jsName" => "isVertLayout");
     $this->settingsMap["tableSettings"]["rowHighlite"] = array("default" => false, "jsName" => "isUseHighlite");
     $this->settingsMap["tableSettings"]["isUseToolTips"] = array("default" => false, "jsName" => "isUseToolTips");
     $this->settingsMap['tableSettings']['recsPerRowList'] = array("default" => 1, "jsName" => "recsPerRowList");
     $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");
     if ($this->pageType == PAGE_REGISTER || $this->pageType == PAGE_CHANGEPASS) {
         $layout = GetPageLayout('', $this->pageType);
     } else {
         $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 . ".css";
         $this->jsSettings['tableSettings'][$this->tName]['pageLayout'] = "pagestyles/" . $layout->name . $rtl . ".css";
         $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"]["strEditMask"] = array("default" => null, "jsName" => "mask");
     $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] = $this->pSet->getMasterKeysByDetailTable($this->allDetailsTablesArr[$i]['dDataSourceTable']);
             }
         }
         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();
     $this->addMultiUploadSettings();
     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"] = $this->pSet->GetPanelSearchFields();
             $this->controlsMap["search"]["allSearchFields"] = $this->pSet->getAllSearchFields();
             $this->controlsMap["search"]["googleLikeFields"] = $this->pSet->getGoogleLikeFields();
             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->timepicker = $this->timepicker || $this->pSet->isUseTimeForSearch();
     $this->isUseToolTips = $this->isUseToolTips || $this->pSet->isUseToolTips();
     $this->googleMapCfg["APIcode"] = "";
     if ($this->xt) {
         $this->xt->assign("pagetitle", $this->getPageTitle());
     }
 }