Index: branches/RC/core/install/install_schema.sql =================================================================== diff -u -N -r10856 -r10887 --- branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 10856) +++ branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 10887) @@ -588,4 +588,27 @@ KEY TimeAvg (TimeAvg), KEY TimeMax (TimeMax), KEY QueryCrc (QueryCrc) +); + +CREATE TABLE Agents ( + AgentId int(11) NOT NULL auto_increment, + AgentName varchar(255) NOT NULL default '', + AgentType tinyint(3) unsigned NOT NULL default '1', + Status tinyint(3) unsigned NOT NULL default '1', + Event varchar(255) NOT NULL default '', + RunInterval int(10) unsigned NOT NULL default '0', + RunMode tinyint(3) unsigned NOT NULL default '2', + LastRunOn int(10) unsigned default NULL, + LastRunStatus tinyint(3) unsigned NOT NULL default '1', + NextRunOn int(11) default NULL, + RunTime int(10) unsigned NOT NULL default '0', + PRIMARY KEY (AgentId), + KEY Status (Status), + KEY RunInterval (RunInterval), + KEY RunMode (RunMode), + KEY AgentType (AgentType), + KEY LastRunOn (LastRunOn), + KEY LastRunStatus (LastRunStatus), + KEY RunTime (RunTime), + KEY NextRunOn (NextRunOn) ); \ No newline at end of file Index: branches/RC/core/units/agents/agent_eh.php =================================================================== diff -u -N --- branches/RC/core/units/agents/agent_eh.php (revision 0) +++ branches/RC/core/units/agents/agent_eh.php (revision 10887) @@ -0,0 +1,119 @@ + Array ('self' => 'add|edit'), + ); + + $this->permMapping = array_merge($this->permMapping, $permissions); + } + + /** + * Refreshes agents list in database based on cached data from unit configs + * + * @param kEvent $event + */ + function OnRefreshAgents(&$event) + { + $regular_events = $this->Application->EventManager->getRegularEvents(true); + + $object =& $event->getObject( Array ('skip_autoload' => true) ); + /* @var $object kDBItem */ + + $processed_ids = Array (); + foreach ($regular_events as $run_mode => $events) { + foreach ($events as $agent_name => $agent_params) { + $object->Load($agent_name, 'AgentName'); + + if (!$object->isLoaded()) { + $fields_hash = Array ( + 'Event' => $agent_params['EventName'], + 'AgentName' => $agent_name, + 'AgentType' => AGENT_TYPE_SYSTEM, + 'RunInterval' => $agent_params['RunInterval'], + 'RunMode' => $run_mode, + ); + + $object->SetDBFieldsFromHash($fields_hash); + $object->Create(); + } + + $processed_ids[] = $object->GetID(); + } + } + + // delete all non-processed agents (ones, that were deleted from unit configs) + $sql = 'SELECT ' . $object->IDField . ' + FROM ' . $object->TableName . ' + WHERE (AgentType = ' . AGENT_TYPE_SYSTEM . ') AND (' . $object->IDField . ' NOT IN (' . implode(',', $processed_ids) . '))'; + $delete_ids = $this->Conn->GetCol($sql); + + if ($delete_ids) { + $temp_handler =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); + /* @var $temp_handler kTempTablesHandler */ + + $temp_handler->DeleteItems($event->Prefix, $event->Special, $delete_ids); + } + + $this->Application->removeObject($event->getPrefixSpecial()); + } + + /** + * Don't allow to delete other user's messages + * + * @param kEvent $event + */ + function customProcessing(&$event, $type) + { + if ($event->Name == 'OnMassDelete' && $type == 'before') { + $ids = $event->getEventParam('ids'); + if ($ids) { + $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); + + $sql = 'SELECT ' . $id_field . ' + FROM ' . $table_name . ' + WHERE ' . $id_field . ' IN (' . implode(',', $ids) . ') AND AgentType <> ' . AGENT_TYPE_SYSTEM; + $allowed_ids = $this->Conn->GetCol($sql); + + $event->setEventParam('ids', $allowed_ids); + } + } + } + + /** + * Cancels agents, that are currenty running + * + * @param kEvent $event + */ + function OnMassCancel(&$event) + { + $ids = $this->StoreSelectedIDs($event); + + if ($ids) { + $object =& $event->getObject( Array ('skip_autoload' => true) ); + /* @var $object kDBItem */ + + foreach ($ids as $id) { + $object->Load($id); + + if ($object->GetDBField('LastRunStatus') == AGENT_LAST_RUN_RUNNING) { + // only changes status, doesn't affect currency running agents + $object->SetDBField('LastRunStatus', AGENT_LAST_RUN_FAILED); + $object->Update(); + } + } + } + + $this->clearSelectedIDs($event); + } + } \ No newline at end of file Index: branches/RC/core/install/upgrades.sql =================================================================== diff -u -N -r10863 -r10887 --- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 10863) +++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 10887) @@ -314,4 +314,32 @@ ADD DefaultValue VARCHAR(255) NOT NULL AFTER ValueList, ADD INDEX (DefaultValue); -UPDATE CustomField SET ValueList = REPLACE(ValueList, ',', '||'); \ No newline at end of file +UPDATE CustomField SET ValueList = REPLACE(ValueList, ',', '||'); + +CREATE TABLE Agents ( + AgentId int(11) NOT NULL auto_increment, + AgentName varchar(255) NOT NULL default '', + AgentType tinyint(3) unsigned NOT NULL default '1', + Status tinyint(3) unsigned NOT NULL default '1', + Event varchar(255) NOT NULL default '', + RunInterval int(10) unsigned NOT NULL default '0', + RunMode tinyint(3) unsigned NOT NULL default '2', + LastRunOn int(10) unsigned default NULL, + LastRunStatus tinyint(3) unsigned NOT NULL default '1', + NextRunOn int(11) default NULL, + RunTime int(10) unsigned NOT NULL default '0', + PRIMARY KEY (AgentId), + KEY Status (Status), + KEY RunInterval (RunInterval), + KEY RunMode (RunMode), + KEY AgentType (AgentType), + KEY LastRunOn (LastRunOn), + KEY LastRunStatus (LastRunStatus), + KEY RunTime (RunTime), + KEY NextRunOn (NextRunOn) +); + +INSERT INTO Permissions VALUES(DEFAULT, 'in-portal:agents.delete', 11, 1, 1, 0); +INSERT INTO Permissions VALUES(DEFAULT, 'in-portal:agents.edit', 11, 1, 1, 0); +INSERT INTO Permissions VALUES(DEFAULT, 'in-portal:agents.add', 11, 1, 1, 0); +INSERT INTO Permissions VALUES(DEFAULT, 'in-portal:agents.view', 11, 1, 1, 0); Index: branches/RC/core/units/agents/agents_config.php =================================================================== diff -u -N --- branches/RC/core/units/agents/agents_config.php (revision 0) +++ branches/RC/core/units/agents/agents_config.php (revision 10887) @@ -0,0 +1,134 @@ + 'agent', + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array ('class' => 'AgentEventHandler', 'file' => 'agent_eh.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'event', + 4 => 'mode', + ), + + 'Hooks' => Array ( + Array ( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'adm', + 'HookToSpecial' => '*', + 'HookToEvent' => Array ('OnAfterCacheRebuild'), + 'DoPrefix' => '', + 'DoSpecial' => '*', + 'DoEvent' => 'OnRefreshAgents', + ), + ), + + 'IDField' => 'AgentId', + + 'TableName' => TABLE_PREFIX . 'Agents', + + 'TitleField' => 'AgentName', + + 'StatusField' => Array ('Status'), + + 'TitlePresets' => Array ( + 'default' => Array ( + 'new_status_labels' => Array ('agent' => '!la_title_AddingAgent!'), + 'edit_status_labels' => Array ('agent' => '!la_title_EditingAgent!'), + 'new_titlefield' => Array ('agent' => '!la_title_NewAgent!'), + ), + + 'agent_list' => Array ('prefixes' => Array ('agent_List'), 'format' => "!la_title_Agents! (#agent_recordcount#)"), + 'agent_edit' => Array ('prefixes' => Array ('agent'), 'format' => "#agent_status# '#agent_titlefield#'"), + ), + + 'PermSection' => Array('main' => 'in-portal:agents'), + + 'Sections' => Array ( + 'in-portal:agents' => Array ( + 'parent' => 'in-portal:system', + 'icon' => 'custom', + 'label' => 'la_title_Agents', + 'url' => Array('t' => 'agents/agent_list', 'pass' => 'm'), + 'permissions' => Array('view', 'add', 'edit', 'delete'), + 'priority' => 6, + 'type' => stTREE, + ), + ), + + 'ListSQLs' => Array ( + '' => ' SELECT %1$s.* %2$s FROM %1$s', + ), + + 'ListSortings' => Array ( + '' => Array ( + 'Sorting' => Array ('AgentName' => 'asc'), + ) + ), + + 'Fields' => Array ( + 'AgentId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + + 'AgentName' => Array ( + 'type' => 'string', 'max_len' => 255, + 'unique' => Array (), + 'required' => 1, 'not_null' => 1, 'default' => '' + ), + + 'AgentType' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_User', 2 => 'la_opt_System'), 'use_phrases' => 1, + 'required' => 1, 'not_null' => 1, 'default' => 1 + ), + 'Status' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Active', 0 => 'la_opt_Disabled'), 'use_phrases' => 1, + 'required' => 1, 'not_null' => 1, 'default' => 1 + ), + 'Event' => Array ( + 'type' => 'string', 'max_len' => 255, + 'formatter' => 'kFormatter', 'regexp' => '/^[a-z-]*[.]{0,1}[a-z-]*:On[A-Za-z]*$/', + 'required' => 1, 'not_null' => 1, 'default' => '' + ), + 'RunInterval' => Array ('type' => 'int', 'required' => 1, 'not_null' => 1, 'default' => 0), + 'RunMode' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (reBEFORE => 'la_opt_Before', reAFTER => 'la_opt_After'), 'use_phrases' => 1, + 'required' => 1, 'not_null' => 1, 'default' => 2 + ), + 'LastRunOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL), + + 'LastRunStatus' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Success', 0 => 'la_opt_Failed', 2 => 'la_opt_Running'), 'use_phrases' => 1, + 'not_null' => 1, 'default' => 1 + ), + + 'NextRunOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'), + 'RunTime' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + ), + + 'Grids' => Array ( + 'Default' => Array ( + 'Icons' => Array ('default' => 'icon16_custom.gif'), + 'Fields' => Array ( + 'AgentId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', ), + 'AgentName' => Array ('title' => 'la_col_Name', 'filter_block' => 'grid_like_filter',), + 'AgentType' => Array ('title' => 'la_col_Type', 'filter_block' => 'grid_options_filter',), + 'Status' => Array ('title' => 'la_col_Status', 'filter_block' => 'grid_options_filter',), + 'Event' => Array ('title' => 'la_col_Event', 'filter_block' => 'grid_like_filter',), + 'RunInterval' => Array ('title' => 'la_col_RunInterval', 'filter_block' => 'grid_range_filter',), + 'RunMode' => Array ('title' => 'la_col_RunMode', 'filter_block' => 'grid_options_filter',), + 'LastRunOn' => Array ('title' => 'la_col_LastRunOn', 'filter_block' => 'grid_date_range_filter',), + 'LastRunStatus' => Array ('title' => 'la_col_LastRunStatus', 'filter_block' => 'grid_options_filter',), + 'NextRunOn' => Array ('title' => 'la_col_NextRunOn', 'filter_block' => 'grid_date_range_filter',), + ), + ), + ), + ); \ No newline at end of file Index: branches/RC/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r10780 -r10887 --- branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10780) +++ branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10887) @@ -1113,5 +1113,15 @@ list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } + + /** + * Occurs after unit config cache was successfully rebuilt + * + * @param kEvent $event + */ + function OnAfterCacheRebuild(&$event) + { + } + } \ No newline at end of file Index: branches/RC/core/kernel/event_manager.php =================================================================== diff -u -N -r10863 -r10887 --- branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 10863) +++ branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 10887) @@ -78,8 +78,53 @@ parent::kBase(); $this->Conn =& $this->Application->GetADODBConnection(); } + /** + * Returns information about registered regular events + * + * @param bool $from_cache + * + * @return Array + */ + function getRegularEvents($from_cache = false) + { + static $agents = null; + + if ($from_cache) { + return Array ( + reBEFORE => $this->beforeRegularEvents, + reAFTER => $this->afterRegularEvents, + ); + } + else { + if (!isset($agents)) { + $sql = 'SELECT * + FROM ' . $this->Application->getUnitOption('agent', 'TableName') . ' + WHERE Status = ' . STATUS_ACTIVE . ' AND LastRunStatus <> ' . AGENT_LAST_RUN_RUNNING; + $all_agents = $this->Conn->Query($sql); + + $agents = Array ( + reBEFORE => Array (), + reAFTER => Array (), + ); + + foreach ($all_agents as $agent_data) { + $agents[ $agent_data['RunMode'] ][ $agent_data['AgentName'] ] = Array ( + 'EventName' => $agent_data['Event'], + 'RunInterval' => (int)$agent_data['RunInterval'], + 'LastRunOn' => (int)$agent_data['LastRunOn'], + 'NextRunOn' => (int)$agent_data['NextRunOn'], + ); + } + } + + return $agents; + } + } + + + /** * Set's new enviroment parameter mappings * between their names as application vars * @@ -539,17 +584,82 @@ * * @param int $event_type */ + function RunRegularEvents($event_type = reBEFORE, $from_cron=false) { if (defined('IS_INSTALL')) return ; // if RegularEvents are set to run from cron if (!$from_cron && $this->Application->ConfigValue('UseCronForRegularEvent')) return ; + + $agents = $this->getRegularEvents(); + $events_source = $agents[$event_type]; + + $user_id = $this->Application->RecallVar('user_id'); + $this->Application->StoreVar('user_id', -1, true); // to prevent permission checking inside events, true for optional storage + + foreach ($events_source as $short_name => $event_data) { + $next_run = $event_data['NextRunOn']; + $last_run = $event_data['LastRunOn']; + + if ($next_run && ($next_run > adodb_mktime())) { + continue; + } + else { + $event = new kEvent($event_data['EventName']); + if (!$this->Application->prefixRegistred($event->Prefix)) { + // don't process agents, left from disabled modules + continue; + } + + $start_time = adodb_mktime(); + $fields_hash = Array ( + 'LastRunOn' => $start_time, + 'LastRunStatus' => AGENT_LAST_RUN_RUNNING, + 'NextRunOn' => $start_time + $event_data['RunInterval'], + ); + + $this->Conn->doUpdate( + $fields_hash, + $this->Application->getUnitOption('agent', 'TableName'), + 'AgentName = ' . $this->Conn->qstr($short_name) + ); + + $event->redirect = false; + $this->Application->HandleEvent($event); + + $now = adodb_mktime(); + $next_run = $event_data['RunInterval'] ? $start_time + $event_data['RunInterval'] : $now; + + while ($next_run < $now) { + // in case event execution took longer, then RunInterval (don't use <=, because RunInterval can be 0) + $next_run += $event_data['RunInterval']; + } + + $fields_hash = Array ( + 'NextRunOn' => $next_run, + 'RunTime' => round(($now - $start_time) / 60), + 'LastRunStatus' => $event->status == erSUCCESS ? AGENT_LAST_RUN_SUCCEDED : AGENT_LAST_RUN_FAILED, + ); + + $this->Conn->doUpdate( + $fields_hash, + $this->Application->getUnitOption('agent', 'TableName'), + 'AgentName = ' . $this->Conn->qstr($short_name) + ); + } + } + + $this->Application->StoreVar('user_id', $user_id, true); // true for optional + } + +/* + function RunRegularEvents($event_type = reBEFORE, $from_cron=false) + { + if (defined('IS_INSTALL')) return ; + // if RegularEvents are set to run from cron + if (!$from_cron && $this->Application->ConfigValue('UseCronForRegularEvent')) return ; $events_source = ($event_type == reBEFORE) ? $this->beforeRegularEvents : $this->afterRegularEvents; - /*if(rand(0, 100) < 90) - { - return; - }*/ $sql = 'SELECT Data FROM '.TABLE_PREFIX.'Cache @@ -581,7 +691,7 @@ ); $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'Cache', 'REPLACE'); } - +*/ /** * Allows to determine, that required event is beeing processed right now * Index: branches/RC/core/install/install_data.sql =================================================================== diff -u -N -r10715 -r10887 --- branches/RC/core/install/install_data.sql (.../install_data.sql) (revision 10715) +++ branches/RC/core/install/install_data.sql (.../install_data.sql) (revision 10887) @@ -626,6 +626,11 @@ INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:service.view', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:agents.delete', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:agents.edit', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:agents.add', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:agents.view', 11, 1, 1, 0); + INSERT INTO Skins VALUES (DEFAULT, 'Default', '/* General elements */\r\n\r\nhtml {\r\n height: 100%;\r\n}\r\n\r\nbody {\r\n font-family: verdana,arial,helvetica,sans-serif;\r\n font-size: 9pt;\r\n color: #000000;\r\n overflow-x: auto; overflow-y: auto;\r\n margin: 0px 0px 0px 0px;\r\n text-decoration: none;\r\n}\r\n\r\na {\r\n color: #006699;\r\n text-decoration: none;\r\n}\r\n\r\na:hover {\r\n color: #009ff0;\r\n text-decoration: none;\r\n}\r\n\r\nform {\r\n display: inline;\r\n}\r\n\r\nimg { border: 0px; }\r\n\r\nbody.height-100 {\r\n height: 100%;\r\n}\r\n\r\nbody.regular-body {\r\n margin: 0px 10px 5px 10px;\r\n color: #000000;\r\n background-color: @@SectionBgColor@@;\r\n}\r\n\r\nbody.edit-popup {\r\n margin: 0px 0px 0px 0px;\r\n}\r\n\r\ntable.collapsed {\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered, table.bordered, .bordered-no-bottom {\r\n border: 1px solid #000000;\r\n border-collapse: collapse;\r\n}\r\n\r\n.bordered-no-bottom {\r\n border-bottom: none;\r\n}\r\n\r\n.login-table td {\r\n padding: 1px;\r\n}\r\n\r\n.disabled {\r\n background-color: #ebebeb;\r\n}\r\n\r\n/* Head frame */\r\n.head-table tr td {\r\n background-color: @@HeadBgColor@@;\r\n color: @@HeadColor@@\r\n}\r\n\r\ntd.kx-block-header, .head-table tr td.kx-block-header{\r\n color: @@HeadBarColor@@;\r\n background-color: @@HeadBarBgColor@@;\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n}\r\n\r\na.kx-header-link {\r\n text-decoration: underline;\r\n color: #FFFFFF;\r\n}\r\n\r\na.kx-header-link:hover {\r\n color: #FFCB05;\r\n text-decoration: none;\r\n}\r\n\r\n.kx-secondary-foreground {\r\n color: @@HeadBarColor@@;\r\n background-color: @@HeadBarBgColor@@;\r\n}\r\n\r\n.kx-login-button {\r\n background-color: #2D79D6;\r\n color: #FFFFFF;\r\n}\r\n\r\n/* General form button (yellow) */\r\n.button {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #000000;\r\n background: url(@@base_url@@/proj-base/admin_templates/img/button_back.gif) #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Disabled (grayed-out) form button */\r\n.button-disabled {\r\n font-size: 12px;\r\n font-weight: normal;\r\n color: #676767;\r\n background: url(@@base_url@@/proj-base/admin_templates/img/button_back_disabled.gif) #f9eeae repeat-x;\r\n text-decoration: none;\r\n}\r\n\r\n/* Tabs bar */\r\n\r\n.tab, .tab-active {\r\n background-color: #F0F1EB;\r\n padding: 3px 7px 2px 7px;\r\n border-top: 1px solid black;\r\n border-left: 1px solid black;\r\n border-right: 1px solid black;\r\n}\r\n\r\n.tab-active {\r\n background-color: #2D79D6;\r\n border-bottom: 1px solid #2D79D6;\r\n}\r\n\r\n.tab a {\r\n color: #00659C;\r\n font-weight: bold;\r\n}\r\n\r\n.tab-active a {\r\n color: #fff;\r\n font-weight: bold;\r\n}\r\n\r\n\r\n/* Toolbar */\r\n\r\n.toolbar {\r\n font-size: 8pt;\r\n border: 1px solid #000000;\r\n border-width: 0px 1px 1px 1px;\r\n background-color: @@ToolbarBgColor@@;\r\n border-collapse: collapse;\r\n}\r\n\r\n.toolbar td {\r\n height: 100%;\r\n}\r\n\r\n.toolbar-button, .toolbar-button-disabled, .toolbar-button-over {\r\n float: left;\r\n text-align: center;\r\n font-size: 8pt;\r\n padding: 5px 5px 5px 5px;\r\n vertical-align: middle;\r\n color: #006F99;\r\n}\r\n\r\n.toolbar-button-over {\r\n color: #000;\r\n}\r\n\r\n.toolbar-button-disabled {\r\n color: #444;\r\n}\r\n\r\n/* Scrollable Grids */\r\n\r\n\r\n.layout-only-table td {\r\n border: none !important;\r\n}\r\n\r\n/* Main Grid class */\r\n.grid-scrollable {\r\n padding: 0px;\r\n border: 1px solid black !important;\r\n border-top: none !important;\r\n}\r\n\r\n/* Div generated by js, which contains all the scrollable grid elements, affects the style of scrollable area without data (if there are too few rows) */\r\n.grid-container {\r\n background-color: #fff;\r\n}\r\n\r\n.grid-container table {\r\n border-collapse: collapse;\r\n}\r\n\r\n/* Inner div generated in each data-cell */\r\n.grid-cell-div {\r\n overflow: hidden;\r\n height: auto;\r\n}\r\n\r\n/* Main row definition */\r\n.grid-data-row td, .grid-data-row-selected td, .grid-data-row-even-selected td, .grid-data-row-mouseover td, .table-color1, .table-color2 {\r\n font-weight: normal;\r\n color: @@OddColor@@;\r\n background-color: @@OddBgColor@@;\r\n padding: 3px 5px 3px 5px;\r\n overflow: hidden;\r\n border-right: 1px solid #c9c9c9;\r\n}\r\n.grid-data-row-even td, .table-color2 {\r\n background-color: @@EvenBgColor@@;\r\n color: @@EvenColor@@;\r\n}\r\n.grid-data-row td a, .grid-data-row-selected td a, .grid-data-row-mouseover td a {\r\n text-decoration: underline;\r\n}\r\n\r\n/* mouse-over rows */\r\n.grid-data-row-mouseover td, table tr.grid-data-row[_row_highlighted] td {\r\n background: #FFFDF4;\r\n}\r\n\r\n/* Selected row, applies to both checkbox and data areas */\r\n.grid-data-row-selected td, table tr.grid-data-row[_row_selected] td {\r\n background: #FEF2D6;\r\n}\r\n\r\n.grid-data-row-even-selected td, .grid-data-row-even[_row_selected] td {\r\n background: #FFF7E0;\r\n}\r\n\r\n/* General header cell definition */\r\n.grid-header-row td {\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n text-decoration: none;\r\n padding: 3px 5px 3px 5px;\r\n color: @@ColumnTitlesColor@@;\r\n border-right: none;\r\n text-align: left;\r\n vertical-align: middle !important;\r\n white-space: nowrap;\r\n border-right: 1px solid #777;\r\n}\r\n\r\n/* Filters row */\r\ntr.grid-header-row-0 td {\r\n background-color: @@FiltersBgColor@@;\r\n border-bottom: 1px solid black;\r\n}\r\n\r\n/* Grid Filters */\r\ntable.range-filter {\r\n width: 100%;\r\n}\r\n\r\n.range-filter td {\r\n padding: 0px 0px 2px 2px !important;\r\n border: none !important;\r\n font-size: 8pt !important;\r\n font-weight: normal !important;\r\n text-align: left;\r\n color: #000000 !important;\r\n}\r\n\r\ninput.filter, select.filter, input.filter-active, select.filter-active {\r\n margin-bottom: 0px;\r\n border: 1px solid #aaa;\r\n}\r\n\r\ninput.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\nselect.filter-active {\r\n background-color: #FFFF00;\r\n}\r\n\r\n/* Column titles row */\r\ntr.grid-header-row-1 td {\r\n height: 25px;\r\n font-weight: bold;\r\n background-color: @@ColumnTitlesBgColor@@;\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-1 td a {\r\n color: @@ColumnTitlesColor@@;\r\n}\r\n\r\ntr.grid-header-row-1 td a:hover {\r\n color: #FFCC00;\r\n}\r\n\r\n\r\n.grid-footer-row td {\r\n background-color: #D7D7D7;\r\n font-weight: bold;\r\n border-right: none;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\ntd.grid-header-last-cell, td.grid-data-last-cell, td.grid-footer-last-cell {\r\n border-right: none !important;\r\n}\r\n\r\ntd.grid-data-col-0, td.grid-data-col-0 div {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-0 td.grid-header-col-0 {\r\n text-align: center;\r\n vertical-align: middle !important;\r\n}\r\n\r\ntr.grid-header-row-0 td.grid-header-col-0 div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.grid-status-bar {\r\n border: 1px solid black;\r\n border-top: none;\r\n padding: 0px;\r\n width: 100%;\r\n border-collapse: collapse;\r\n height: 30px;\r\n}\r\n\r\n.grid-status-bar td {\r\n background-color: @@TitleBarBgColor@@;\r\n color: @@TitleBarColor@@;\r\n font-size: 11pt;\r\n font-weight: normal;\r\n padding: 2px 8px 2px 8px;\r\n}\r\n\r\n/* /Scrollable Grids */\r\n\r\n\r\n/* Forms */\r\ntable.edit-form {\r\n border: none;\r\n border-top-width: 0px;\r\n border-collapse: collapse;\r\n width: 100%;\r\n}\r\n\r\n.edit-form-odd, .edit-form-even {\r\n padding: 0px;\r\n}\r\n\r\n.subsectiontitle {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #4A92CE;\r\n color: #fff;\r\n height: 25px;\r\n border-top: 1px solid black;\r\n vertical-align: middle;\r\n}\r\n\r\n.subsectiontitle td {\r\n vertical-align: middle;\r\n padding: 3px 5px 3px 5px;\r\n}\r\n\r\n.label-cell {\r\n background: #DEE7F6 url(@@base_url@@/proj-base/admin_templates/img/bgr_input_name_line.gif) no-repeat right bottom;\r\n font: 12px arial, sans-serif;\r\n padding: 4px 20px;\r\n width: 150px;\r\n}\r\n\r\n.control-mid {\r\n width: 13px;\r\n border-left: 1px solid #7A95C2;\r\n background: #fff url(@@base_url@@/proj-base/admin_templates/img/bgr_mid.gif) repeat-x left bottom;\r\n}\r\n\r\n.control-cell {\r\n font: 11px arial, sans-serif;\r\n padding: 4px 10px 5px 5px;\r\n background: #fff url(@@base_url@@/proj-base/admin_templates/img/bgr_input_line.gif) no-repeat left bottom;\r\n width: auto;\r\n vertical-align: middle;\r\n}\r\n\r\n.label-cell-filler {\r\n background: #DEE7F6 none;\r\n}\r\n.control-mid-filler {\r\n background: #fff none;\r\n border-left: 1px solid #7A95C2;\r\n}\r\n.control-cell-filler {\r\n background: #fff none;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n.error-cell {\r\n color: red;\r\n}\r\n\r\n.field-required {\r\n color: red;\r\n}\r\n\r\n.form-warning {\r\n color: red;\r\n}\r\n\r\n.req-note {\r\n font-style: italic;\r\n color: #333;\r\n}\r\n\r\n#scroll_container table.tableborder {\r\n border-collapse: separate\r\n}\r\n\r\n\r\n/* Uploader */\r\n\r\n.uploader-main {\r\n position: absolute;\r\n display: none;\r\n z-index: 10;\r\n border: 1px solid #777;\r\n padding: 10px;\r\n width: 350px;\r\n height: 120px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n}\r\n\r\n.uploader-percent {\r\n width: 100%;\r\n padding-top: 3px;\r\n text-align: center;\r\n position: relative;\r\n z-index: 20;\r\n float: left;\r\n font-weight: bold;\r\n}\r\n\r\n.uploader-left {\r\n width: 100%;\r\n border: 1px solid black;\r\n height: 20px;\r\n background: #fff url(@@base_url@@/core/admin_templates/img/progress_left.gif);\r\n}\r\n\r\n.uploader-done {\r\n width: 0%;\r\n background-color: green;\r\n height: 20px;\r\n background: #4A92CE url(@@base_url@@/core/admin_templates/img/progress_done.gif);\r\n}\r\n\r\n\r\n/* To be sorted */\r\n\r\n\r\n/* Section title, right to the big icon */\r\n.admintitle {\r\n font-size: 16pt;\r\n font-weight: bold;\r\n color: @@SectionColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Left sid of bluebar */\r\n.header_left_bg {\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n padding-left: 5px;\r\n}\r\n\r\n/* Right side of bluebar */\r\n.tablenav, tablenav a {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n\r\n text-decoration: none;\r\n background-color: @@TitleBarBgColor@@;\r\n background-image: none;\r\n}\r\n\r\n/* Section title in the bluebar * -- why ''link''? :S */\r\n.tablenav_link {\r\n font-size: 11pt;\r\n font-weight: bold;\r\n color: @@TitleBarColor@@;\r\n text-decoration: none;\r\n}\r\n\r\n/* Active page in top and bottom bluebars pagination */\r\n.current_page {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n background-color: #fff;\r\n color: #2D79D6;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Other pages and arrows in pagination on blue */\r\n.nav_url {\r\n font-size: 10pt;\r\n font-weight: bold;\r\n color: #fff;\r\n padding: 3px 2px 3px 3px;\r\n}\r\n\r\n/* Tree */\r\n.tree-body {\r\n background-color: @@TreeBgColor@@;\r\n height: 100%\r\n}\r\n\r\n.tree_head.td, .tree_head, .tree_head:hover {\r\n font-weight: bold;\r\n font-size: 10px;\r\n color: #FFFFFF;\r\n font-family: Verdana, Arial;\r\n text-decoration: none;\r\n}\r\n\r\n.tree {\r\n padding: 0px;\r\n border: none;\r\n border-collapse: collapse;\r\n}\r\n\r\n.tree tr td {\r\n padding: 0px;\r\n margin: 0px;\r\n font-family: helvetica, arial, verdana,;\r\n font-size: 11px;\r\n white-space: nowrap;\r\n}\r\n\r\n.tree tr td a {\r\n font-size: 11px;\r\n color: @@TreeColor@@;\r\n font-family: Helvetica, Arial, Verdana;\r\n text-decoration: none;\r\n padding: 2px 0px 2px 2px;\r\n}\r\n\r\n.tree tr.highlighted td a {\r\n background-color: @@TreeHighBgColor@@;\r\n color: @@TreeHighColor@@;\r\n}\r\n\r\n.tree tr.highlighted td a:hover {\r\n color: #fff;\r\n}\r\n\r\n.tree tr td a:hover {\r\n color: #000000;\r\n}', 'just_logo_1.gif', 'a:20:{s:11:"HeadBgColor";a:2:{s:11:"Description";s:27:"Head frame background color";s:5:"Value";s:7:"#1961B8";}s:9:"HeadColor";a:2:{s:11:"Description";s:21:"Head frame text color";s:5:"Value";s:7:"#CCFF00";}s:14:"SectionBgColor";a:2:{s:11:"Description";s:28:"Section bar background color";s:5:"Value";s:7:"#FFFFFF";}s:12:"SectionColor";a:2:{s:11:"Description";s:22:"Section bar text color";s:5:"Value";s:7:"#2D79D6";}s:12:"HeadBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:14:"HeadBarBgColor";a:1:{s:5:"Value";s:7:"#1961B8";}s:13:"TitleBarColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TitleBarBgColor";a:1:{s:5:"Value";s:7:"#2D79D6";}s:14:"ToolbarBgColor";a:1:{s:5:"Value";s:7:"#F0F1EB";}s:14:"FiltersBgColor";a:1:{s:5:"Value";s:7:"#D7D7D7";}s:17:"ColumnTitlesColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:19:"ColumnTitlesBgColor";a:1:{s:5:"Value";s:7:"#999999";}s:8:"OddColor";a:1:{s:5:"Value";s:7:"#000000";}s:10:"OddBgColor";a:1:{s:5:"Value";s:7:"#F6F6F6";}s:9:"EvenColor";a:1:{s:5:"Value";s:7:"#000000";}s:11:"EvenBgColor";a:1:{s:5:"Value";s:7:"#EBEBEB";}s:9:"TreeColor";a:1:{s:5:"Value";s:7:"#006F99";}s:11:"TreeBgColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:13:"TreeHighColor";a:1:{s:5:"Value";s:7:"#FFFFFF";}s:15:"TreeHighBgColor";a:1:{s:5:"Value";s:7:"#4A92CE";}}', 1206520493, 1); Index: branches/RC/core/admin_templates/agents/agent_edit.tpl =================================================================== diff -u -N --- branches/RC/core/admin_templates/agents/agent_edit.tpl (revision 0) +++ branches/RC/core/admin_templates/agents/agent_edit.tpl (revision 10887) @@ -0,0 +1,90 @@ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + Index: branches/RC/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r10854 -r10887 --- branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 10854) +++ branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 10887) @@ -283,6 +283,9 @@ $this->ValidateConfig($prefix); } } + + $after_event = new kEvent('adm:OnAfterCacheRebuild'); + $this->Application->HandleEvent($after_event); } } Index: branches/RC/core/admin_templates/agents/agent_list.tpl =================================================================== diff -u -N --- branches/RC/core/admin_templates/agents/agent_list.tpl (revision 0) +++ branches/RC/core/admin_templates/agents/agent_list.tpl (revision 10887) @@ -0,0 +1,79 @@ + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file Index: branches/RC/core/kernel/constants.php =================================================================== diff -u -N -r10857 -r10887 --- branches/RC/core/kernel/constants.php (.../constants.php) (revision 10857) +++ branches/RC/core/kernel/constants.php (.../constants.php) (revision 10887) @@ -82,5 +82,26 @@ define('EDITING_MODE_CMS', 1); define('EDITING_MODE_LAYOUT', 2); define('EDITING_MODE_DESIGN', 3); + + // agent types + define('AGENT_TYPE_USER', 1); + define('AGENT_TYPE_SYSTEM', 2); + // agent last run statuses + define('AGENT_LAST_RUN_SUCCEDED', 1); + define('AGENT_LAST_RUN_FAILED', 0); + define('AGENT_LAST_RUN_RUNNING', 2); + + // link validation constants + define('LINK_VALIDATION_NOT_VALIDATED', 0); + define('LINK_VALIDATION_VALID', 1); + define('LINK_VALIDATION_INVALID', 2); + + /** + * Validate this much links on each progress bar step + * + */ + define('LINK_VALIDATION_PER_PAGE', 5); // in links + define('LINK_VALIDATION_TIMEOUT', 10); // in seconds + ?> \ No newline at end of file