Index: branches/RC/kernel/include/config.php =================================================================== diff -u -N -r8929 -r10924 --- branches/RC/kernel/include/config.php (.../config.php) (revision 8929) +++ branches/RC/kernel/include/config.php (.../config.php) (revision 10924) @@ -26,7 +26,7 @@ function Load() { if(is_object($this->adodbConnection)) - { + { LogEntry("Config Load Start\n"); $sql = "select VariableName, VariableValue from ".GetTablePrefix()."ConfigurationValues"; $rs = $this->adodbConnection->Execute($sql); @@ -46,7 +46,7 @@ $rs->MoveNext(); $count++; } - LogEntry("Config Load End - $count Variables\n"); + LogEntry("Config Load End - $count Variables\n"); } unset($this->m_DirtyFields); $this->m_IsDirty=false; @@ -74,7 +74,7 @@ function Set($property, $value,$type=0,$force=FALSE) { if(is_array($this->config) && strlen($property)>0) - { + { if(array_key_exists($property,$this->config)) { $current = $this->config[$property]; @@ -89,7 +89,7 @@ $this->m_IsDirty = ($this->m_IsDirty or $changed or $force); if($changed || $force) { - $this->m_DirtyFields[$property] = $value; + $this->m_DirtyFields[$property] = $value; } $this->m_VarType[$property] = $type; } @@ -105,8 +105,8 @@ // $sql = sprintf("UPDATE ".GetTablePrefix()."ConfigurationValues SET VariableValue=%s WHERE VariableName=%s", $this->adodbConnection->qstr($value), $this->adodbConnection->qstr($field)); $sql = 'UPDATE '.GetTablePrefix().'ConfigurationValues SET VariableValue="'.addslashes($value).'" WHERE VariableName="'.addslashes($field).'"'; // echo $sql."
\n"; - - $rs = $this->adodbConnection->execute($sql); + + $rs = $this->adodbConnection->execute($sql); } } } @@ -123,12 +123,12 @@ function GetDirtySessionValues($VarType) { $result = array(); - + if(is_array($this->m_DirtyFields)) - { + { foreach($this->m_DirtyFields as $property=>$values) { - if($this->m_VarType[$property]==$VarType) + if($this->m_VarType[$property]==$VarType) $result[$property] = $values; } } @@ -147,35 +147,35 @@ $result[$config_var] = $var_value; } return $result; - } + } }/* clsConfig */ /* To create the configuration forms in the admin section, populate the table ConfigurationAdmin and ConfigurationValues. - - The tables are fairly straight-forward. The fields of concern in the ConfigurationValues table is -ModuleOwner and Section. ModuleOwner should either be the module name or In-Portal for kernel related stuff. + + The tables are fairly straight-forward. The fields of concern in the ConfigurationValues table is +ModuleOwner and Section. ModuleOwner should either be the module name or In-Portal for kernel related stuff. (Items which should appear under 'System Configuration'). - - The Section field determines the NavMenu section the value is associated with. For example, + + The Section field determines the NavMenu section the value is associated with. For example, in-portal:configure_general refers to items listed under System Configuration->General. - In the ConfigurationAdmin table, ensure the VariableName field is the same as the one in ConfigurationValues + In the ConfigurationAdmin table, ensure the VariableName field is the same as the one in ConfigurationValues (this is the field that creates the natural join.) The prompt field is the text displayed to the left of the form element in the table. This should contain LANGUAGE ELEMENT IDENTIFIERS that are plugged into the Language function. - The element_type field describes the type of form element is associated with this item. Possible values are: + The element_type field describes the type of form element is associated with this item. Possible values are: - text : textbox - checkbox : a simple checkbox - select : creates a dropdown box. In this case, the ValueList field should be populated with a comma-separated list in name=value,name=value format (each element is translated to: - + To add dynamic data to this list, enclose an SQL statement with tags for example: SELECT FieldLabel as OptionName, FieldName as OptionValue FROM CustomField WHERE .CustomFieldType=3> - - note the specific field labels OptionName and OptionValue. They are required by the parser. + + note the specific field labels OptionName and OptionValue. They are required by the parser. use the tag to insert the system's table prefix into the sql statement as appropriate */ @@ -185,27 +185,27 @@ var $heading; var $prompt; var $ElementType; - var $ValueList; /* comma-separated list in name=value pair format*/ + var $ValueList; /* comma-separated list in name=value pair format*/ var $ValidationRules; var $default_value; var $adodbConnection; var $NextItem=NULL; var $Section; - + var $DisplayOrder = null; - + var $TabIndex = 0; - + /** * Application instance * * @var kApplication */ var $Application = null; - + function clsConfigAdminItem($config_name=NULL) - { - $this->Application =& kApplication::Instance(); + { + $this->Application =& kApplication::Instance(); $this->adodbConnection = &GetADODBConnection(); if ($config_name) { $this->LoadSetting($config_name); @@ -223,7 +223,7 @@ $this->prompt = $rs->fields["prompt"]; $this->ElementType = $rs->fields["element_type"]; $this->ValidationRules=$rs->fields["validation"]; - $this->default_value = $rs->fields["VariableValue"]; + $this->default_value = $rs->fields["VariableValue"]; $this->ValueList=$rs->fields["ValueList"]; $this->Section = $rs->fields["Section"]; $this->DisplayOrder = $rs->fields['DisplayOrder']; @@ -234,14 +234,14 @@ { $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); /* @var $cf_helper InpCustomFieldsHelper */ - - return $cf_helper->GetValuesHash($string); + + return $cf_helper->GetValuesHash($string, ','); } function ItemFormElement($StartFrom=1) { - global $objConfig; - + global $objConfig; + if(!$this->TabIndex) $this->TabIndex = $StartFrom; $o = ''; @@ -251,32 +251,32 @@ } $this->default_value = inp_htmlize($this->default_value); $validation_rule = $this->ValidationRules ? ' ValidationType="'.$this->ValidationRules.'" ' : ''; - + switch($this->ElementType) { case 'text': $o .= 'default_value.'"'.$validation_rule.'>'; break; - + case 'checkbox': $o .= 'default_value ? ' checked>' : '>'; break; - + case 'password': /* To exclude config form from populating with Root (md5) password */ if( $this->Section == 'in-portal:configure_users' ) $this->default_value = ''; - + $o .= 'default_value.'">'; break; - + case 'textarea': $o .= ''; break; - - case 'label': + + case 'label': if ($this->default_value) { $tag_params = clsHtmlTag::ParseAttributes($this->ValueList); if (isset($tag_params['cut_first'])) { @@ -293,7 +293,7 @@ } } break; - + case 'radio': $radioname = $this->name; $this->TabIndex++; @@ -305,22 +305,22 @@ } $this->TabIndex++; break; - + case 'select': $o .= ''; break; - + case 'multiselect': $o .= '