Index: branches/RC/system/images/noimage.gif =================================================================== diff -u -N Binary files differ Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r11724 -r11742 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11724) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11742) @@ -210,13 +210,13 @@ // 1. get id from post (used in admin) $ret = $this->Application->GetVar($event->getPrefixSpecial(true).'_id'); - if ($ret) { + if (($ret !== false) && ($ret != '')) { return $ret; } // 2. get id from env (used in front) $ret = $this->Application->GetVar($event->getPrefixSpecial().'_id'); - if ($ret) { + if (($ret !== false) && ($ret != '')) { return $ret; } @@ -232,6 +232,7 @@ $this->StoreSelectedIDs($event); return $this->Application->GetVar($event->getPrefixSpecial(true).'_id'); // StoreSelectedIDs sets this variable } + return $ret; } @@ -1180,7 +1181,14 @@ $object->Clear(0); $this->Application->SetVar($event->Prefix_Special.'_SaveEvent', 'OnCreate'); - $table_info = $object->getLinkedInfo(); + if ($event->getEventParam('top_prefix') != $event->Prefix) { + // this is subitem prefix, so use main item special + $table_info = $object->getLinkedInfo( $this->getMainSpecial($event) ); + } + else { + $table_info = $object->getLinkedInfo(); + } + $object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']); $event->redirect = false; @@ -1254,10 +1262,16 @@ */ function setTempWindowID(&$event) { - $mode = $this->Application->GetVar($event->Prefix.'_mode'); - if ($mode == 't') { - $wid = $this->Application->GetVar('m_wid'); - $this->Application->SetVar($event->Prefix.'_mode', 't'.$wid); + $prefixes = Array ($event->Prefix, $event->getPrefixSpecial(true)); + + foreach ($prefixes as $prefix) { + $mode = $this->Application->GetVar($prefix . '_mode'); + + if ($mode == 't') { + $wid = $this->Application->GetVar('m_wid'); + $this->Application->SetVar(str_replace('_', '.', $prefix) . '_mode', 't' . $wid); + break; + } } } Index: branches/RC/core/kernel/event_manager.php =================================================================== diff -u -N -r11682 -r11742 --- branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 11682) +++ branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 11742) @@ -355,9 +355,18 @@ // 3. store all prefixes passed before event processing, because they are used by GetTopmostPrefix $all_passed = explode(',', $this->Application->GetVar('passed')); foreach ($events as $prefix_special => $event_name) { - if (!$event_name) continue; - $prefix_special = explode('.',$prefix_special); - array_push($all_passed, $prefix_special[0]); + if (!$event_name) { + continue; + } + + if ($this->Application->IsAdmin()) { + array_push($all_passed, $prefix_special); + } + else { + // don't add special on front-end because of category item list special is autogenerated + $prefix_special = explode('.', $prefix_special); + array_push($all_passed, $prefix_special[0]); + } } $this->Application->SetVar('all_passed', implode(',', $all_passed)); Index: branches/RC/core/kernel/utility/http_query.php =================================================================== diff -u -N -r11296 -r11742 --- branches/RC/core/kernel/utility/http_query.php (.../http_query.php) (revision 11296) +++ branches/RC/core/kernel/utility/http_query.php (.../http_query.php) (revision 11742) @@ -147,6 +147,7 @@ case 'P': $this->Post = $this->AddVars($_POST); $this->convertPostEvents(); + $this->_processPostEnvVariables(); break; case 'C': @@ -170,6 +171,37 @@ // $this->AfterInit(); } + + /** + * Allow POST variables, that names were transformed by PHP ("." replaced with "_") to + * override variables, that were virtually created through enviroment variable parsing + * + */ + function _processPostEnvVariables() + { + $passed = $this->Get('passed'); + if (!$passed) { + return ; + } + + $passed = explode(',', $passed); + foreach ($passed as $prefix_special) { + if (strpos($prefix_special, '.') === false) { + continue; + } + + list ($prefix, $special) = explode('.', $prefix_special); + $query_map = $this->Application->EventManager->getQueryMap($prefix); + $post_prefix_special = $prefix . '_' . $special; + + foreach ($query_map as $index => $var_name) { + if (array_key_exists($post_prefix_special . '_' . $var_name, $this->Post)) { + $this->Set($prefix_special . '_' . $var_name, $this->Post[$post_prefix_special . '_' . $var_name]); + } + } + } + } + function AfterInit() { // $vars = $this->processQueryString($this->Get(ENV_VAR_NAME)); Index: branches/RC/core/kernel/kbase.php =================================================================== diff -u -N -r11661 -r11742 --- branches/RC/core/kernel/kbase.php (.../kbase.php) (revision 11661) +++ branches/RC/core/kernel/kbase.php (.../kbase.php) (revision 11742) @@ -669,19 +669,20 @@ function getLinkedInfo($special = '', $guess_special = false) { $parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix'); - if($parent_prefix) - { + if ($parent_prefix) { // if this is linked table, then set id from main table - $table_info = Array( + $table_info = Array ( 'TableName' => $this->Application->getUnitOption($this->Prefix,'TableName'), 'IdField' => $this->Application->getUnitOption($this->Prefix,'IDField'), 'ForeignKey' => $this->Application->getUnitOption($this->Prefix,'ForeignKey'), 'ParentTableKey' => $this->Application->getUnitOption($this->Prefix,'ParentTableKey'), 'ParentPrefix' => $parent_prefix ); + if (is_array($table_info['ForeignKey'])) { $table_info['ForeignKey'] = getArrayValue($table_info, 'ForeignKey', $parent_prefix); } + if (is_array($table_info['ParentTableKey'])) { $table_info['ParentTableKey'] = getArrayValue($table_info, 'ParentTableKey', $parent_prefix); } @@ -692,8 +693,10 @@ if (!$main_object->isLoaded() && $guess_special) { $main_object =& $this->Application->recallObject($parent_prefix); } + return array_merge($table_info, Array('ParentId'=> $main_object->GetDBField( $table_info['ParentTableKey'] ) ) ); } + return false; } Index: branches/RC/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r11724 -r11742 --- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11724) +++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11742) @@ -2449,6 +2449,11 @@ $fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields'); } + if (!array_key_exists($check_field, $fields)) { + $params['field'] = 'Password'; + return $check_field == 'VerifyPassword' ? $this->FieldVisible($params) : true; + } + $show_mode = array_key_exists('show_mode', $fields[$check_field]) ? $fields[$check_field]['show_mode'] : true; if ($show_mode === smDEBUG) {