Index: trunk/kernel/include/config.php =================================================================== diff -u -N -r8009 -r8061 --- trunk/kernel/include/config.php (.../config.php) (revision 8009) +++ trunk/kernel/include/config.php (.../config.php) (revision 8061) @@ -314,6 +314,18 @@ } $o .= ''; break; + + case 'multiselect': + $o .= ''; + break; } return $o; } Index: trunk/core/kernel/db/dbitem.php =================================================================== diff -u -N -r7855 -r8061 --- trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 7855) +++ trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 8061) @@ -72,11 +72,17 @@ /** * Set's default values for all fields * + * @param bool $populate_ml_fields create all ml fields from db in config or not + * * @access public */ - function SetDefaultValues() + function SetDefaultValues($populate_ml_fields = false) { - parent::SetDefaultValues(); + parent::SetDefaultValues($populate_ml_fields); + if ($populate_ml_fields) { + $this->PopulateMultiLangFields(); + } + foreach ($this->Fields as $field => $params) { if ( isset($params['default']) ) { $this->SetDBField($field, $params['default']); @@ -747,6 +753,25 @@ return $ret; } + function PopulateMultiLangFields() + { + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + $lang_count = $ml_helper->getLanguageCount(); + foreach ($this->Fields as $field => $options) + { + if (isset($options['formatter']) && $options['formatter'] == 'kMultiLanguage' && isset($options['master_field'])) { + if (preg_match('/^l([0-9]+)_(.*)/', $field, $regs)) { + $l = $regs[1]; + $name = $regs[2]; + for ($i=1; $i<=$lang_count; $i++) { + if ($i == $l) continue; + $this->Fields['l'.$i.'_'.$name] = $options; + } + } + } + } + } + /** * Sets new name for item in case if it is beeing copied * in same table Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r7867 -r8061 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 7867) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 8061) @@ -1549,6 +1549,7 @@ UGFzc3dvcmQgZmllbGQ= UmFkaW8gYnV0dG9ucw== RHJvcCBkb3duIGZpZWxk + TXVsdGlwbGUgU2VsZWN0 Q2hlY2tib3g= VGV4dCBmaWVsZA== VGV4dCBhcmVh Index: trunk/kernel/include/parse.php =================================================================== diff -u -N -r4567 -r8061 --- trunk/kernel/include/parse.php (.../parse.php) (revision 4567) +++ trunk/kernel/include/parse.php (.../parse.php) (revision 8061) @@ -673,7 +673,8 @@ foreach($mods as $m) { - if ($t == $var_list['t']) continue; // && !strlen($tpath[$m]) // don't skip in-portal ifself + if ($t == $var_list['t'] || $m == 'Core') continue; // && !strlen($tpath[$m]) // don't skip in-portal ifself + $el->attributes = $tag->attributes; $el->attributes["_template"] = $tpath[$m].$t; $el->attributes["_module"] = $m; Index: trunk/core/admin_templates/incs/custom_blocks.tpl =================================================================== diff -u -N -r6669 -r8061 --- trunk/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 6669) +++ trunk/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 8061) @@ -18,6 +18,13 @@ + + + "/> + + "> " type="checkbox" id="_cb_" name="_cb_" onclick="update_checkbox(this, document.getElementById(''))"> Index: trunk/kernel/admin_templates/incs/custom_blocks.tpl =================================================================== diff -u -N -r6669 -r8061 --- trunk/kernel/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 6669) +++ trunk/kernel/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 8061) @@ -18,6 +18,13 @@ + + + "/> + + "> " type="checkbox" id="_cb_" name="_cb_" onclick="update_checkbox(this, document.getElementById(''))"> Index: trunk/kernel/include/item.php =================================================================== diff -u -N -r8009 -r8061 --- trunk/kernel/include/item.php (.../item.php) (revision 8009) +++ trunk/kernel/include/item.php (.../item.php) (revision 8061) @@ -1167,32 +1167,33 @@ $name = $this->StripDisallowed($name); if ( $name != $this->Get('Filename') ) $this->Set('Filename', $name); + + // update filename in category items + $filename = $this->Get('Filename'); + $db =& GetADODBConnection(); + $sql = 'UPDATE '.TABLE_PREFIX.'CategoryItems + SET Filename = '.$db->qstr($filename).' + WHERE ItemResourceId = '.$this->Get('ResourceId'); + $db->Query($sql); } function Update($UpdatedBy = null) - { - $ret = parent::Update($UpdatedBy); + { + // make Filename field virtual + unset($this->m_dirtyFieldsMap['Filename']); - $this->GenerateFilename(); - $db =& GetADODBConnection(); - if ($ret) { - $filename = $this->Get('Filename'); - $sql = 'UPDATE '.TABLE_PREFIX.'CategoryItems - SET Filename = '.$db->qstr($filename).' - WHERE ItemResourceId = '.$this->Get('ResourceId'); - $db->Query($sql); - } + $ret = parent::Update($UpdatedBy); + if ($ret) { + $this->GenerateFilename(); + } + } -// parent::Update($UpdatedBy); - - } - function Create() { - parent::Create(); - - $this->GenerateFilename(); - parent::Update(); + $ret = parent::Create(); + if ($ret) { + $this->GenerateFilename(); + } } } Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -N -r7391 -r8061 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 7391) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 8061) @@ -237,6 +237,7 @@ } $object =& $this->Application->recallObject($prefix.'.'.$special, $prefix, Array('skip_autoload' => true)); + $object->PopulateMultiLangFields(); foreach ($ids as $id) { $mode = 'create'; Index: trunk/core/admin_templates/js/script.js =================================================================== diff -u -N -r7855 -r8061 --- trunk/core/admin_templates/js/script.js (.../script.js) (revision 7855) +++ trunk/core/admin_templates/js/script.js (.../script.js) (revision 8061) @@ -798,10 +798,20 @@ document.getElementById($hidden_id).value = $tmp.replace(/,$/, ''); } +function update_multiple_options($hidden_id) { + var $select = document.getElementById($hidden_id + '_select'); + var $result = ''; + + for (var $i = 0; $i < $select.options.length; $i++) { + if ($select.options[$i].selected) { + $result += $select.options[$i].value + '|'; + } + } + document.getElementById($hidden_id).value = $result ? '|' + $result : ''; +} + // related to lists operations (moving) - - function move_selected($from_list, $to_list) { if (typeof($from_list) != 'object') $from_list = document.getElementById($from_list); Index: trunk/core/units/custom_fields/custom_fields_config.php =================================================================== diff -u -N -r8036 -r8061 --- trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 8036) +++ trunk/core/units/custom_fields/custom_fields_config.php (.../custom_fields_config.php) (revision 8061) @@ -79,7 +79,7 @@ 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => null), 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => null), 'Prompt' => Array('type' => 'string','default' => null), - 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', /*'multiselect' => 'la_type_multiselect',*/ 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')), + 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'multiselect' => 'la_type_multiselect', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')), 'ValueList' => Array('type' => 'string','default' => null), 'DisplayOrder' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), 'OnGeneralTab' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r7855 -r8061 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7855) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8061) @@ -334,7 +334,7 @@ */ function dbBuild(&$object, &$event) { - $object->Configure(); + $object->Configure( $event->getEventParam('populate_ml_fields') ); $this->PrepareObject($object, $event); // force live table if specified or is original item @@ -1831,6 +1831,7 @@ break; case 'select': + case 'multiselect': case 'radio': if ($custom_params['ValueList']) { $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); Index: trunk/admin/include/mainscript.php =================================================================== diff -u -N -r7391 -r8061 --- trunk/admin/include/mainscript.php (.../mainscript.php) (revision 7391) +++ trunk/admin/include/mainscript.php (.../mainscript.php) (revision 8061) @@ -569,6 +569,18 @@ var env = '$env2'; var SubmitFunc = false; +function update_multiple_options(\$hidden_id) { + var \$select = document.getElementById(\$hidden_id + '_select'); + var \$result = ''; + + for (var \$i = 0; \$i < \$select.options.length; \$i++) { + if (\$select.options[\$i].selected) { + \$result += \$select.options[\$i].value + '|'; + } + } + document.getElementById(\$hidden_id).value = \$result ? '|' + \$result : ''; +} + END; Index: trunk/core/admin_templates/incs/config_blocks.tpl =================================================================== diff -u -N -r6703 -r8061 --- trunk/core/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 6703) +++ trunk/core/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 8061) @@ -18,6 +18,13 @@ + + + " name="" value=""/> + + " name="" value=""> " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))"> Index: trunk/kernel/include/category.php =================================================================== diff -u -N -r7867 -r8061 --- trunk/kernel/include/category.php (.../category.php) (revision 7867) +++ trunk/kernel/include/category.php (.../category.php) (revision 8061) @@ -2110,7 +2110,7 @@ foreach ($fields_hash as $field_name => $field_value) { $d->Set($field_name, $field_value); } - + $d->Create(); if (!$from_import) { Index: trunk/kernel/admin_templates/incs/config_blocks.tpl =================================================================== diff -u -N -r6428 -r8061 --- trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 6428) +++ trunk/kernel/admin_templates/incs/config_blocks.tpl (.../config_blocks.tpl) (revision 8061) @@ -18,6 +18,13 @@ + + + " name="" value=""/> + + " name="" value=""> " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))"> Index: trunk/core/kernel/kbase.php =================================================================== diff -u -N -r7635 -r8061 --- trunk/core/kernel/kbase.php (.../kbase.php) (revision 7635) +++ trunk/core/kernel/kbase.php (.../kbase.php) (revision 8061) @@ -362,7 +362,12 @@ $this->IDField = $field_name; } - function Configure() + /** + * Performs initial object configuration + * + * @param bool $populate_ml_fields create all ml fields from db in config or not + */ + function Configure($populate_ml_fields = false) { $this->setTableName( $this->Application->getUnitOption($this->Prefix, 'TableName') ); $this->setIDField( $this->Application->getUnitOption($this->Prefix, 'IDField') ); @@ -371,7 +376,8 @@ $this->ApplyFieldModifiers(); // should be called only after all fields definitions been set $this->prepareConfigOptions(); // this should go last, but before setDefaultValues, order is significant! - $this->SetDefaultValues(); + + $this->SetDefaultValues($populate_ml_fields); } /** @@ -464,7 +470,7 @@ } } - function SetDefaultValues() + function SetDefaultValues($populate_ml_fields = false) { foreach($this->Fields as $field => $options) {