Index: trunk/core/kernel/utility/temp_handler.php
===================================================================
diff -u -r2791 -r2792
--- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2791)
+++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 2792)
@@ -99,8 +99,9 @@
function CreateTempTable($table)
{
$query = sprintf("CREATE TABLE %s SELECT * FROM %s WHERE 0",
- $this->GetTempName($table),
- $table);
+ $this->GetTempName($table),
+ $table);
+
$this->Conn->Query($query);
}
@@ -139,20 +140,11 @@
$SubItems = $this->Application->getUnitOption($prefix,'SubItems');
$same_sub_counter = 1;
- if (is_array($SubItems)) {
- foreach ($SubItems as $prefix) {
- if (preg_match("/^SAME:(.*)/", $prefix, $regs)) {
- $same_sub = $tmp;
- $same_sub['Prefix'] = $tmp['Prefix'].'.'.$same_sub_counter;
- $same_sub['Constrain'] = $regs[1];
- $same_sub['ParentTableKey'] = $tmp['IdField'];
- $same_sub['ForeignKey'] = $this->Application->getUnitOption($tmp['Prefix'],'ForeignKey'.$same_sub_counter);
- $tmp['SubTables'][] = $same_sub;
- $same_sub_counter++;
- }
- else {
- $this->AddTables($prefix, $tmp);
- }
+ if( is_array($SubItems) )
+ {
+ foreach($SubItems as $prefix)
+ {
+ $this->AddTables($prefix, $tmp);
}
}
@@ -293,8 +285,10 @@
// the table will be first copied by first sub-table, then dropped and copied over by last ForeignKey in the array
// this should not do any problems :)
if ( !preg_match("/.*\.[0-9]+/", $master['Prefix']) ) {
- $this->DropTempTable($master['TableName']);
- $this->CreateTempTable($master['TableName']);
+ if( $this->DropTempTable($master['TableName']) )
+ {
+ $this->CreateTempTable($master['TableName']);
+ }
}
if (is_array($ids)) {
@@ -552,12 +546,14 @@
function DropTempTable($table)
{
- if (in_array($table, $this->DroppedTables)) return;
+ if( in_array($table, $this->DroppedTables) ) return false;
$query = sprintf("DROP TABLE IF EXISTS %s",
$this->GetTempName($table)
);
- $this->DroppedTables = array_unique(array_push($this->DroppedTables, $table));
+ array_push($this->DroppedTables, $table);
+ $this->DroppedTables = array_unique($this->DroppedTables);
$this->Conn->Query($query);
+ return true;
}
function PrepareEdit()
Index: trunk/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r2737 -r2792
--- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 2737)
+++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 2792)
@@ -142,7 +142,7 @@
$first_id = getArrayValue($ret,0);
if($first_id === false)
{
-// $GLOBALS['debugger']->appendTrace();
+// $this->Application->Debugger->appendTrace();
trigger_error('Requested ID for prefix '.$event->getPrefixSpecial().' not passed',E_USER_NOTICE);
}
$this->Application->SetVar($event->getPrefixSpecial(true).'_id', $first_id);
Index: trunk/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -r2613 -r2792
--- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 2613)
+++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 2792)
@@ -125,6 +125,12 @@
{
$clone_config['Prefix'] = $clone_prefix;
$this->configData[$clone_prefix] = array_merge_recursive2($this->configData[$prefix], $clone_config);
+
+ foreach($clone_config as $cloned_property => $cloned_value)
+ {
+ if(!$cloned_value) unset($this->configData[$clone_prefix][$cloned_property]);
+ }
+
$this->ParseConfigClones($clone_prefix);
}
}
Index: trunk/core/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r1654 -r2792
--- trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1654)
+++ trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 2792)
@@ -61,7 +61,7 @@
),
'TableName' => TABLE_PREFIX.'Stylesheets',
- 'SubItems' => Array('selectors'),
+ 'SubItems' => Array('selectorsbase', 'selectorsblock'),
'FilterMenu' => Array(
'Groups' => Array(
Index: trunk/core/units/selectors/selectors_config.php
===================================================================
diff -u -r2052 -r2792
--- trunk/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 2052)
+++ trunk/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 2792)
@@ -7,6 +7,23 @@
'EventHandlerClass' => Array('class'=>'SelectorsEventHandler','file'=>'selectors_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'SelectorsTagProcessor','file'=>'selectors_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
+
+ 'Clones' => Array(
+ 'selectorsbase' => Array(
+ 'Hooks' => Array(),
+ 'Constrain' => 'Type = 1',
+ 'SubItems' => Array('selectorsblock'),
+ ),
+
+ 'selectorsblock' => Array(
+ 'Hooks' => Array(),
+ 'Constrain' => 'Type = 2',
+ 'ForeignKey' => Array('css' => 'StylesheetId', 'selectorsbase' => 'ParentId'),
+ 'ParentTableKey' => Array('css' => 'StylesheetId', 'selectorsbase' => 'SelectorId'),
+ 'ParentPrefix' => 'selectorsbase',
+ ),
+ ),
+
'Hooks' => Array(
Array(
'Mode' => hAFTER,
@@ -58,10 +75,6 @@
'ParentPrefix' => 'css',
'AutoDelete' => true,
'AutoClone' => true,
-
- 'Constrain' => 'Type = 1',
- 'SubItems' => Array('SAME: Type=2'),
- 'ForeignKey1' => 'ParentId',
'ListSQLs' => Array( ''=>' SELECT %1$s.*
FROM %s',
Index: trunk/kernel/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r1654 -r2792
--- trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 1654)
+++ trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 2792)
@@ -61,7 +61,7 @@
),
'TableName' => TABLE_PREFIX.'Stylesheets',
- 'SubItems' => Array('selectors'),
+ 'SubItems' => Array('selectorsbase', 'selectorsblock'),
'FilterMenu' => Array(
'Groups' => Array(
Index: trunk/kernel/units/selectors/selectors_config.php
===================================================================
diff -u -r2052 -r2792
--- trunk/kernel/units/selectors/selectors_config.php (.../selectors_config.php) (revision 2052)
+++ trunk/kernel/units/selectors/selectors_config.php (.../selectors_config.php) (revision 2792)
@@ -7,6 +7,23 @@
'EventHandlerClass' => Array('class'=>'SelectorsEventHandler','file'=>'selectors_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'SelectorsTagProcessor','file'=>'selectors_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
+
+ 'Clones' => Array(
+ 'selectorsbase' => Array(
+ 'Hooks' => Array(),
+ 'Constrain' => 'Type = 1',
+ 'SubItems' => Array('selectorsblock'),
+ ),
+
+ 'selectorsblock' => Array(
+ 'Hooks' => Array(),
+ 'Constrain' => 'Type = 2',
+ 'ForeignKey' => Array('css' => 'StylesheetId', 'selectorsbase' => 'ParentId'),
+ 'ParentTableKey' => Array('css' => 'StylesheetId', 'selectorsbase' => 'SelectorId'),
+ 'ParentPrefix' => 'selectorsbase',
+ ),
+ ),
+
'Hooks' => Array(
Array(
'Mode' => hAFTER,
@@ -58,10 +75,6 @@
'ParentPrefix' => 'css',
'AutoDelete' => true,
'AutoClone' => true,
-
- 'Constrain' => 'Type = 1',
- 'SubItems' => Array('SAME: Type=2'),
- 'ForeignKey1' => 'ParentId',
'ListSQLs' => Array( ''=>' SELECT %1$s.*
FROM %s',