Index: branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php =================================================================== diff -u -r7072 -r7368 --- branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php (.../dblist.php) (revision 7072) +++ branches/unlabeled/unlabeled-1.21.4/core/kernel/db/dblist.php (.../dblist.php) (revision 7368) @@ -639,7 +639,7 @@ function GetDBField($name) { $row =& $this->getCurrentRecord(); - + return $row[$name]; } @@ -653,7 +653,7 @@ { return $this->Queried ? $this->GetDBField($this->IDField) : null; } - + /** * Allows kDBTagProcessor.SectionTitle to detect if it's editing or new item creation * @@ -664,7 +664,7 @@ // no such thing as NewItem for lists :) return false; } - + function HasField($name) { $row =& $this->getCurrentRecord(); @@ -819,6 +819,8 @@ $parent_object =& $this->Application->recallObject($parent_prefix.'.'.$special); $parent_id = $parent_object->GetDBField($parent_table_key); + if (!$parent_id) return ; + $this->addFilter('parent_filter', '`'.$this->TableName.'`.`'.$foreign_key_field.'` = '.$parent_id); // only for list in this case } } Index: branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php =================================================================== diff -u -r7287 -r7368 --- branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 7287) +++ branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 7368) @@ -2112,11 +2112,12 @@ * OR prefix, that has been found in REQUEST and some how is parent of passed subtable prefix * * @param string $current_prefix + * @param string $real_top if set to true will return real topmost prefix, regardless of its id is passed or not * @return string * @access public * @author Kostja / Alex */ - function GetTopmostPrefix($current_prefix) + function GetTopmostPrefix($current_prefix, $real_top=false) { // 1. get genealogical tree of $current_prefix $prefixes = Array ($current_prefix); @@ -2125,6 +2126,8 @@ array_unshift($prefixes, $current_prefix); } + if ($real_top) return $current_prefix; + // 2. find what if parent is passed $passed = explode(',', $this->GetVar('passed')); foreach ($prefixes as $current_prefix) { Index: branches/unlabeled/unlabeled-1.26.16/core/kernel/utility/temp_handler.php =================================================================== diff -u -r6873 -r7368 --- branches/unlabeled/unlabeled-1.26.16/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 6873) +++ branches/unlabeled/unlabeled-1.26.16/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 7368) @@ -43,14 +43,14 @@ */ var $Conn; - + /** * Window ID of current window * * @var mixed */ var $WindowID = ''; - + function kTempTablesHandler() { parent::kBase(); @@ -125,7 +125,7 @@ function BuildTables($prefix, $ids) { $this->WindowID = $this->Application->GetVar('m_wid'); - + $this->TableIdCounter = 0; $tables = Array( 'TableName' => $this->Application->getUnitOption($prefix, 'TableName'), @@ -135,12 +135,12 @@ 'TableId' => $this->TableIdCounter++, ); - $parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix'); + /*$parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix'); if ($parent_prefix) { $tables['ForeignKey'] = $this->Application->getUnitOption($prefix, 'ForeignKey'); $tables['ParentPrefix'] = $parent_prefix; $tables['ParentTableKey'] = $this->Application->getUnitOption($prefix, 'ParentTableKey'); - } + }*/ $this->FinalRefs[ $tables['TableName'] ] = $tables['TableId']; // don't forget to add main table to FinalRefs too Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid_scroller.js =================================================================== diff -u -r7102 -r7368 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 7102) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/js/grid_scroller.js (.../grid_scroller.js) (revision 7368) @@ -319,15 +319,10 @@ GridScroller.prototype.UpdateColWidths = function() { pos = findPos(this.Dot) + this.TheGrid.style.left = (pos[0])+ 'px' this.TheGrid.style.top = (pos[1]) + 'px' - var data_cf = 1; - var count = 1; - - var header_cf = 0; - var footer_cf = 0.2; - // alert('MinWidths: '+this.MinWidths.length + ' vs Data ' + this.Header[0].length) if (this.MinWidths.length < this.Header[0].length) { var widths = new Array(); @@ -348,12 +343,6 @@ var data_widths = this.GetWidths('data_'+this.GridId); // print_pre(data_widths) - /*if (this.HasFooter()) { - var footer_widths = this.GetWidths('footer_'+this.GridId); - data_cf -= footer_cf; - count++; - }*/ - for (var i=0; iredirect = true; $event_handler =& $this->Application->recallObject($event->Prefix.'_EventHandler'); - $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix)); + $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); if (($this->Application->RecallVar('user_id') == -1) || $event_handler->CheckPermission($event)) { $this->HandleEvent($event); } Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/config/config_email.tpl =================================================================== diff -u -r7071 -r7368 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/config/config_email.tpl (.../config_email.tpl) (revision 7071) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/config/config_email.tpl (.../config_email.tpl) (revision 7368) @@ -2,7 +2,7 @@ - + Index: branches/unlabeled/unlabeled-1.2.52/core/units/email_messages/email_messages_config.php =================================================================== diff -u -r1571 -r7368 --- branches/unlabeled/unlabeled-1.2.52/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 1571) +++ branches/unlabeled/unlabeled-1.2.52/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 7368) @@ -7,43 +7,82 @@ 'EventHandlerClass' => Array('class'=>'EmailMessagesEventHandler','file'=>'email_messages_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 'AutoLoad' => true, - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', + 4 => 'mode', ), - + 'IDField' => 'EmailMessageId', 'TitleField' => 'Subject', - + 'TableName' => TABLE_PREFIX.'EmailMessage', - - 'ListSQLs' => Array( ''=>'SELECT * FROM %s'), - - 'ItemSQLs' => Array( ''=>'SELECT * FROM %s'), - + + 'ListSQLs' => Array( + ''=>' + SELECT %1$s.* %2$s + FROM %1$s + LEFT JOIN '.TABLE_PREFIX.'Events + ON '.TABLE_PREFIX.'Events.EventId = %1$s.EventId + ' + ), + + 'ItemSQLs' => Array( + ''=>' + SELECT %1$s.* %2$s + FROM %1$s + LEFT JOIN '.TABLE_PREFIX.'Events + ON '.TABLE_PREFIX.'Events.EventId = %1$s.EventId + ' + ), + 'ForeignKey' => 'LanguageId', 'ParentTableKey' => 'LanguageId', 'ParentPrefix' => 'lang', 'AutoDelete' => true, 'AutoClone' => true, - + + 'CalculatedFields' => array( + '' => array( + 'Description' => TABLE_PREFIX.'Events.Description', + 'Module' => TABLE_PREFIX.'Events.Module', + 'Type' => TABLE_PREFIX.'Events.Type', + ), + ), + 'Fields' => Array( - 'EmailMessageId' => Array(), - 'Template' => Array('type' => 'string','default' => ''), - 'MessageType' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array('text'=>'la_Text','html'=>'la_Html'), 'not_null' => '1','default' => 'text'), - 'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'), - 'EventId' => Array('type' => 'int','not_null' => '1','default' => '0'), - ), - + 'EmailMessageId' => Array(), + 'Template' => Array('type' => 'string','default' => ''), + 'MessageType' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array('text'=>'la_Text','html'=>'la_Html'), 'not_null' => '1','default' => 'text'), + 'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'EventId' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'Subject' => Array('type'=>'string'), + ), + 'VirtualFields' => Array( - 'Headers' => Array('type'=>'string'), - 'Subject' => Array('type'=>'string'), - 'Body' => Array('type'=>'string'), - ), - + 'Headers' => Array('type'=>'string'), + 'Body' => Array('type'=>'string'), + 'Description' => Array('type'=>'string', 'sql_filter_type'=>'having'), + 'Module' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Type' => Array('formatter'=>'kOptionsFormatter', 'options' => Array (1 => 'la_Text_Admin', 0 => 'la_Text_User'), 'use_phrases' => 1, 'default' => 0, 'not_null' => 1), + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif'), + 'Fields' => Array( + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td'), + 'Subject' => Array( 'title'=>'la_col_Subject'), + 'Type' => Array( 'title'=>'la_col_Type'), + ), + + ), + ), + + ); ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php =================================================================== diff -u -r7354 -r7368 --- branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7354) +++ branches/unlabeled/unlabeled-1.79.4/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 7368) @@ -113,8 +113,8 @@ 'OnMassMoveUp' => Array('self' => 'advanced:move_up|edit', 'subitem' => 'advanced:move_up|add|edit'), 'OnMassMoveDown' => Array('self' => 'advanced:move_down|edit', 'subitem' => 'advanced:move_down|add|edit'), - 'OnPreCreate' => Array('self' => 'add|add.pending'), - 'OnEdit' => Array('self' => 'edit|edit.pending'), + 'OnPreCreate' => Array('self' => 'add|add.pending', 'subitem' => 'edit|edit.pending'), + 'OnEdit' => Array('self' => 'edit|edit.pending', 'subitem' => 'edit|edit.pending'), 'OnExport' => Array('self' => 'view|advanced:export'), 'OnExportBegin' => Array('self' => 'view|advanced:export'), @@ -123,6 +123,7 @@ // theese event do not harm, but just in case check them too :) 'OnCancelEdit' => Array('self' => true, 'subitem' => true), 'OnCancel' => Array('self' => true, 'subitem' => true), + 'OnReset' => Array('self' => true, 'subitem' => true), 'OnSetSorting' => Array('self' => true, 'subitem' => true), 'OnSetSortingDirect' => Array('self' => true, 'subitem' => true), Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl =================================================================== diff -u -r7073 -r7368 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl (.../column_picker.tpl) (revision 7073) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl (.../column_picker.tpl) (revision 7368) @@ -24,7 +24,7 @@ } ) ); - a_toolbar.AddButton( new ToolBarButton('reset', '', function() { + a_toolbar.AddButton( new ToolBarButton('reset_edit', '', function() { reset_form('adm', 'OnReset', ''); } ) ); Index: branches/unlabeled/unlabeled-1.20.2/core/units/admin/admin_config.php =================================================================== diff -u -r7083 -r7368 --- branches/unlabeled/unlabeled-1.20.2/core/units/admin/admin_config.php (.../admin_config.php) (revision 7083) +++ branches/unlabeled/unlabeled-1.20.2/core/units/admin/admin_config.php (.../admin_config.php) (revision 7368) @@ -25,6 +25,8 @@ 'column_picker' => Array('format' => '!la_title_ColumnPicker!'), ), + + 'PermSection' => array('main' => 'in-portal:service'), 'Sections' => Array( 'in-portal:root' => Array( 'parent' => null, Index: branches/unlabeled/unlabeled-1.4.2/core/units/admin/admin_events_handler.php =================================================================== diff -u -r7073 -r7368 --- branches/unlabeled/unlabeled-1.4.2/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 7073) +++ branches/unlabeled/unlabeled-1.4.2/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 7368) @@ -2,6 +2,16 @@ class AdminEventsHandler extends kDBEventHandler { + function mapPermissions() + { + parent::mapPermissions(); + $permissions = Array( + 'OnSaveColumns' => array('self' => true), + 'OnClosePopup' => array('self' => true), + ); + $this->permMapping = array_merge($this->permMapping, $permissions); + } + function OnResetModRwCache(&$event) { $this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'Cache WHERE VarName LIKE "mod_rw%"'); Index: branches/unlabeled/unlabeled-1.6.2/core/units/email_events/email_events_config.php =================================================================== diff -u -r6709 -r7368 --- branches/unlabeled/unlabeled-1.6.2/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 6709) +++ branches/unlabeled/unlabeled-1.6.2/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 7368) @@ -85,18 +85,17 @@ 'EmailSettings' => Array( 'Icons' => Array('default'=>'icon16_custom.gif'), 'Fields' => Array( - 'Description' => Array('title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td' ), - 'Type' => Array('title'=>'la_col_Type'), - 'Enabled' => Array('title'=>'la_col_Status'), - 'FromUser' => Array('title'=>'la_col_FromToUser'), - ), - - ), + 'Description' => Array('title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td' ), + 'Type' => Array('title'=>'la_col_Type'), + 'Enabled' => Array('title'=>'la_col_Status'), + 'FromUser' => Array('title'=>'la_col_FromToUser'), + ), + ), ), ); if (defined('DEBUG_MODE') && DEBUG_MODE) { $config['Grids']['EmailSettings']['Fields']['EventId'] = Array('title' => 'la_col_Id'); } - + ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/users/admins_edit.tpl =================================================================== diff -u -r7090 -r7368 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/users/admins_edit.tpl (.../admins_edit.tpl) (revision 7090) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/users/admins_edit.tpl (.../admins_edit.tpl) (revision 7368) @@ -21,7 +21,7 @@ } ) ); - a_toolbar.AddButton( new ToolBarButton('reset', '', function() { + a_toolbar.AddButton( new ToolBarButton('reset_edit', '', function() { reset_form('u', 'OnReset', ''); } ) ); Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/regional/phrases_edit.tpl =================================================================== diff -u -r7071 -r7368 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 7071) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/regional/phrases_edit.tpl (.../phrases_edit.tpl) (revision 7368) @@ -17,10 +17,15 @@ } ) ); a_toolbar.AddButton( new ToolBarButton('cancel', '', function() { - submit_event('phrases','OnCancel'); + cancel_edit('phrases','OnCancelEdit','',''); } ) ); + a_toolbar.AddButton( new ToolBarButton('reset_edit', '', function() { + reset_form('phrases', 'OnReset', ''); + } + ) ); + a_toolbar.Render(); Index: branches/unlabeled/unlabeled-1.5.2/core/units/email_messages/email_messages_event_handler.php =================================================================== diff -u -r6789 -r7368 --- branches/unlabeled/unlabeled-1.5.2/core/units/email_messages/email_messages_event_handler.php (.../email_messages_event_handler.php) (revision 6789) +++ branches/unlabeled/unlabeled-1.5.2/core/units/email_messages/email_messages_event_handler.php (.../email_messages_event_handler.php) (revision 7368) @@ -10,6 +10,9 @@ */ function getPassedID(&$event) { + $parent = parent::getPassedID($event); + if ($parent) return $parent; + $email_event_id = (int)$this->getEmailEventId(); $object =& $event->getObject(); @@ -32,6 +35,22 @@ } /** + * Apply any custom changes to list's sql query + * + * @param kEvent $event + * @access protected + * @see OnListBuild + */ + function SetCustomQuery(&$event) + { + if ($event->Special == 'module') { + $object =& $event->getObject(); + $module = $this->Application->GetVar('module'); + $object->addFilter('module_filter', 'Module = '.$this->Conn->qstr($module)); + } + } + + /** * If loading empty item, then set parent id * * @param kEvent $event