Index: branches/5.2.x/core/admin_templates/agents/agent_edit.tpl
===================================================================
diff -u -r14244 -r14605
--- branches/5.2.x/core/admin_templates/agents/agent_edit.tpl (.../agent_edit.tpl) (revision 14244)
+++ branches/5.2.x/core/admin_templates/agents/agent_edit.tpl (.../agent_edit.tpl) (revision 14605)
@@ -67,22 +67,24 @@
-
-
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
Index: branches/5.2.x/core/kernel/kbase.php
===================================================================
diff -u -r14599 -r14605
--- branches/5.2.x/core/kernel/kbase.php (.../kbase.php) (revision 14599)
+++ branches/5.2.x/core/kernel/kbase.php (.../kbase.php) (revision 14605)
@@ -1,6 +1,6 @@
GetFieldOptions($field, $is_virtual);
- if ( !$field_options ) {
+ if ( !$field_options && strpos($field, '#') === false ) {
+ // we use "#FIELD_NAME#" as field for InputName tag in JavaScript, so ignore it
$form_name = $this->getFormName();
trigger_error('Field "' . $field . '" is not defined' . ($form_name ? ' on "' . $this->getFormName() . '" form' : '') . ' in "' . $this->Prefix . '" unit config', E_USER_WARNING);
@@ -803,7 +804,7 @@
$formatter =& $this->Application->recallObject($formatter_class);
/* @var $formatter kFormatter */
-
+
return $formatter->Format($value, $name, $this, $format);
}
@@ -853,7 +854,7 @@
if ( isset($this->Fields[$field]['formatter']) ) {
$formatter =& $this->Application->recallObject($this->Fields[$field]['formatter']);
/* @var $formatter kFormatter */
-
+
$formatter->UpdateSubFields($field, $this->GetDBField($field), $this->Fields[$field], $this);
}
}
Index: branches/5.2.x/core/kernel/managers/agent_manager.php
===================================================================
diff -u -r14585 -r14605
--- branches/5.2.x/core/kernel/managers/agent_manager.php (.../agent_manager.php) (revision 14585)
+++ branches/5.2.x/core/kernel/managers/agent_manager.php (.../agent_manager.php) (revision 14605)
@@ -1,6 +1,6 @@
(int)$agent_data['LastRunOn'],
'NextRunOn' => (int)$agent_data['NextRunOn'],
'Status' => $agent_data['Status'],
+ 'SiteDomainLimitation' => $agent_data['SiteDomainLimitation'],
);
}
}
@@ -159,7 +160,21 @@
$user_id = $this->Application->RecallVar('user_id');
$this->Application->StoreVar('user_id', USER_ROOT, true); // to prevent permission checking inside events, true for optional storage
+ $site_helper =& $this->Application->recallObject('SiteHelper');
+ /* @var $site_helper SiteHelper */
+
+ $site_domain_id = $site_helper->getDomainByName('DomainName', DOMAIN);
+
foreach ($events_source as $short_name => $event_data) {
+ if ( $site_domain_id && $event_data['SiteDomainLimitation'] != '' ) {
+ $site_domains = explode('|', substr($event_data['SiteDomainLimitation'], 1, -1));
+
+ if ( !in_array($site_domain_id, $site_domains) ) {
+ // agent isn't allowed on this site domain
+ continue;
+ }
+ }
+
$next_run = $event_data['NextRunOn'];
if ($next_run && ($next_run > adodb_mktime())) {
Index: branches/5.2.x/core/install/install_schema.sql
===================================================================
diff -u -r14585 -r14605
--- branches/5.2.x/core/install/install_schema.sql (.../install_schema.sql) (revision 14585)
+++ branches/5.2.x/core/install/install_schema.sql (.../install_schema.sql) (revision 14605)
@@ -668,6 +668,7 @@
LastRunStatus tinyint(3) unsigned NOT NULL default '1',
NextRunOn int(11) default NULL,
RunTime int(10) unsigned NOT NULL default '0',
+ SiteDomainLimitation varchar(255) NOT NULL,
PRIMARY KEY (AgentId),
KEY Status (Status),
KEY RunInterval (RunInterval),
@@ -676,7 +677,8 @@
KEY LastRunOn (LastRunOn),
KEY LastRunStatus (LastRunStatus),
KEY RunTime (RunTime),
- KEY NextRunOn (NextRunOn)
+ KEY NextRunOn (NextRunOn),
+ KEY SiteDomainLimitation (SiteDomainLimitation)
);
CREATE TABLE SpellingDictionary (
Index: branches/5.2.x/core/install/upgrades.sql
===================================================================
diff -u -r14601 -r14605
--- branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14601)
+++ branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14605)
@@ -2107,4 +2107,8 @@
SET DirectLinkAuthKey = SUBSTRING( MD5( CONCAT(CategoryId, ':', ParentId, ':', l<%PRIMARY_LANGUAGE%>_Name, ':b38') ), 1, 20)
WHERE DirectLinkAuthKey = '';
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ExcludeTemplateSectionsFromSearch', '0', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_ExcludeTemplateSectionsFromSearch', 'checkbox', '', '', 10.15, 0, 0, NULL);
\ No newline at end of file
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ExcludeTemplateSectionsFromSearch', '0', 'In-Portal', 'in-portal:configure_categories', 'la_title_General', 'la_config_ExcludeTemplateSectionsFromSearch', 'checkbox', '', '', 10.15, 0, 0, NULL);
+
+ALTER TABLE Agents
+ ADD SiteDomainLimitation VARCHAR(255) NOT NULL,
+ ADD INDEX (SiteDomainLimitation);
Index: branches/5.2.x/core/units/agents/agents_config.php
===================================================================
diff -u -r14585 -r14605
--- branches/5.2.x/core/units/agents/agents_config.php (.../agents_config.php) (revision 14585)
+++ branches/5.2.x/core/units/agents/agents_config.php (.../agents_config.php) (revision 14605)
@@ -1,6 +1,6 @@
Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
'RunTime' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'SiteDomainLimitation' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'SiteDomains ORDER BY DomainName ASC', 'option_key_field' => 'DomainId', 'option_title_field' => 'DomainName', 'multiple' => 1,
+ 'not_null' => 1, 'default' => ''
+ ),
),
'Grids' => Array (
@@ -153,6 +158,7 @@
'LastRunStatus' => Array ('filter_block' => 'grid_options_filter', 'width' => 120, ),
'NextRunOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 65, ),
+ 'SiteDomainLimitation' => Array ('data_block' => 'grid_picker_td', 'filter_block' => 'grid_multioptions_filter', 'separator' => ', ', 'width' => 145),
),
),
),
Index: branches/5.2.x/core/install/english.lang
===================================================================
diff -u -r14601 -r14605
--- branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14601)
+++ branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14605)
@@ -550,6 +550,7 @@
U2Vzc2lvbiBMb2cgSUQ=
U2hvcnQgSVNPIENvZGU=
U2ltcGxlIFNlYXJjaA==
+ U2l0ZSBEb21haW4gTGltaXRhdGlvbg==
TmFtZQ==
U2tpcCBGaXJzdCBSb3c=
U29ydCBWYWx1ZXM=