Index: branches/unlabeled/unlabeled-1.3.4/core/admin_templates/incs/custom_blocks.tpl
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.3.4/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 2326)
+++ branches/unlabeled/unlabeled-1.3.4/core/admin_templates/incs/custom_blocks.tpl (.../custom_blocks.tpl) (revision 4367)
@@ -39,7 +39,7 @@
" id="" value="">
" id="" value="">
-
+
|
Index: branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_edit_block.tpl
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_edit_block.tpl (.../stylesheets_edit_block.tpl) (revision 2326)
+++ branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_edit_block.tpl (.../stylesheets_edit_block.tpl) (revision 4367)
@@ -15,30 +15,30 @@
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.4.2/core/units/selectors/selectors_event_handler.php
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.4.2/core/units/selectors/selectors_event_handler.php (.../selectors_event_handler.php) (revision 2326)
+++ branches/unlabeled/unlabeled-1.4.2/core/units/selectors/selectors_event_handler.php (.../selectors_event_handler.php) (revision 4367)
@@ -5,7 +5,55 @@
class SelectorsEventHandler extends InpDBEventHandler
{
+
/**
+ * Occures before an item has been cloned
+ * Id of newly created item is passed as event' 'id' param
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeClone(&$event)
+ {
+ $event->Init($event->Prefix, '-item');
+ $object =& $event->getObject();
+
+ $title_field = 'SelectorName';
+ $new_name = $object->GetDBField($title_field);
+ $original_checked = false;
+
+ $foreign_key = $event->getEventParam('foreign_key'); // in case if whole stylesheet is cloned
+ if($foreign_key === false) $foreign_key = $object->GetDBField('StylesheetId'); // in case if selector is copied ifself
+
+ do {
+ if ( preg_match('/(.*)-([\d]+)/', $new_name, $regs) ) {
+ $new_name = $regs[1].'-'.($regs[2]+1);
+ }
+ elseif ($original_checked) {
+ $new_name = $new_name.'-1';
+ }
+
+ // if we are cloning in temp table this will look for names in temp table,
+ // since object' TableName contains correct TableName (for temp also!)
+ // if we are cloning live - look in live
+ $query = ' SELECT '.$title_field.'
+ FROM '.$object->TableName.'
+ WHERE '.$title_field.' = '.$this->Conn->qstr($new_name).' AND StylesheetId = '.$foreign_key;
+
+ $res = $this->Conn->GetOne($query);
+
+ /*// if not found in live table, check in temp table if applicable
+ if ($res === false && $object->Special == 'temp') {
+ $query = 'SELECT '.$name_field.' FROM '.$this->GetTempName($master['TableName']).'
+ WHERE '.$name_field.' = '.$this->Conn->qstr($new_name);
+ $res = $this->Conn->GetOne($query);
+ }*/
+
+ $original_checked = true;
+ } while ($res !== false);
+ $object->SetDBField($title_field, $new_name);
+ }
+
+ /**
* Show base styles or block styles
*
* @param kEvent $event
@@ -205,8 +253,7 @@
$parent_info = $object->getLinkedInfo();
$title_field = $this->Application->getUnitOption($event->Prefix,'TitleField');
$sql = 'SELECT '.$title_field.', '.$object->IDField.' FROM '.$object->TableName.' WHERE Type = 1 AND StylesheetId = '.$parent_info['ParentId'].' ORDER BY '.$title_field;
- $object->Fields['ParentId']['options'] = array_merge_recursive2($object->Fields['ParentId']['options'],
- $this->Conn->GetCol($sql,$object->IDField) );
+ $object->Fields['ParentId']['options'] = $this->Conn->GetCol($sql,$object->IDField);
}
/**
Index: branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_list.tpl
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_list.tpl (.../stylesheets_list.tpl) (revision 2326)
+++ branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/stylesheets_list.tpl (.../stylesheets_list.tpl) (revision 4367)
@@ -19,39 +19,39 @@
}
var a_toolbar = new ToolBar();
- a_toolbar.AddButton( new ToolBarButton('new_style', '',
+ a_toolbar.AddButton( new ToolBarButton('new_style', '',
function() {
std_precreate_item('css', 'stylesheets/stylesheets_edit')
} ) );
- a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
- a_toolbar.AddButton( new ToolBarButton('delete', '',
+ a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '',
function() {
std_delete_items('css')
} ) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
- a_toolbar.AddButton( new ToolBarButton('approve', '', function() {
+ a_toolbar.AddButton( new ToolBarButton('approve', '', function() {
submit_event('css','OnMassApprove');
}
) );
- a_toolbar.AddButton( new ToolBarButton('decline', '', function() {
+ a_toolbar.AddButton( new ToolBarButton('decline', '', function() {
submit_event('css','OnMassDecline');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
- a_toolbar.AddButton( new ToolBarButton('clone', '', function() {
+ a_toolbar.AddButton( new ToolBarButton('clone', '', function() {
submit_event('css','OnMassClone');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep3') );
- a_toolbar.AddButton( new ToolBarButton('view', '', function() {
+ a_toolbar.AddButton( new ToolBarButton('view', '', function() {
show_viewmenu(a_toolbar,'view');
}
) );
Index: branches/unlabeled/unlabeled-1.3.4/core/units/config_search/config_search_event_handler.php
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.3.4/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 2326)
+++ branches/unlabeled/unlabeled-1.3.4/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4367)
@@ -81,7 +81,7 @@
$is_new = $event->MasterEvent->getEventParam('IsNew');
-
+ // TODO: direct access to private attributes of object is prohibited
$cf_search = array();
$cf_search['DisplayOrder'] = $cf_object->FieldValues['DisplayOrder'];
$cf_search['ElementType'] = $cf_object->FieldValues['ElementType'];
Index: branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/style_editor.tpl
===================================================================
diff -u -r2326 -r4367
--- branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/style_editor.tpl (.../style_editor.tpl) (revision 2326)
+++ branches/unlabeled/unlabeled-1.4.4/core/admin_templates/stylesheets/style_editor.tpl (.../style_editor.tpl) (revision 4367)
@@ -23,19 +23,19 @@
|
|