Index: branches/5.1.x/core/install/upgrades.php
===================================================================
diff -u -N -r13545 -r13635
--- branches/5.1.x/core/install/upgrades.php (.../upgrades.php) (revision 13545)
+++ branches/5.1.x/core/install/upgrades.php (.../upgrades.php) (revision 13635)
@@ -1,6 +1,6 @@
-1, // root
+ 'CreatedById' => USER_ROOT,
'CreatedOn' => time(),
'ResourceId' => $this->Application->NextResourceId(),
);
@@ -1517,78 +1517,156 @@
$this->Conn->Query('DROP TABLE IF EXISTS ' . TABLE_PREFIX . 'Phrase');
$this->Conn->Query('RENAME TABLE ' . $temp_table . ' TO ' . TABLE_PREFIX . 'Phrase');
- // refactor StdDestinations table
- $sql = 'RENAME TABLE ' . TABLE_PREFIX . 'StdDestinations TO ' . TABLE_PREFIX . 'CountryStates';
- $this->Conn->Query($sql);
+ $this->_updateCountryStatesTable();
+ $this->_replaceConfigurationValueSeparator();
- $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'CountryStates
- CHANGE DestId CountryStateId INT(11) NOT NULL AUTO_INCREMENT,
- CHANGE DestType Type INT(11) NOT NULL DEFAULT \'1\',
- CHANGE DestParentId StateCountryId INT(11) NULL DEFAULT NULL,
- CHANGE DestAbbr IsoCode CHAR(3) NOT NULL DEFAULT \'\',
- CHANGE DestAbbr2 ShortIsoCode CHAR(2) NULL DEFAULT NULL,
- DROP INDEX DestType,
- DROP INDEX DestParentId,
- ADD INDEX (`Type`),
- ADD INDEX (StateCountryId)';
- $this->Conn->Query($sql);
+ // save "config.php" in php format, not ini format as before
+ $this->_toolkit->SaveConfig();
+ }
- // move country/state translations from Phrase to CountryStates table
- $ml_helper->createFields('country-state');
+ if ($mode == 'after') {
+ $this->_transformEmailRecipients();
+ }
+ }
- for ($language_id = 1; $language_id <= $ml_helper->languageCount; $language_id++) {
- if (!$ml_helper->LanguageFound($language_id)) {
- continue;
- }
+ /**
+ * Move country/state translations from Phrase to CountryStates table
+ *
+ */
+ function _updateCountryStatesTable()
+ {
+ // refactor StdDestinations table
+ $sql = 'RENAME TABLE ' . TABLE_PREFIX . 'StdDestinations TO ' . TABLE_PREFIX . 'CountryStates';
+ $this->Conn->Query($sql);
- $sub_select = ' SELECT l' . $language_id . '_Translation
- FROM ' . TABLE_PREFIX . 'Phrase
- WHERE Phrase = DestName';
+ $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'CountryStates
+ CHANGE DestId CountryStateId INT(11) NOT NULL AUTO_INCREMENT,
+ CHANGE DestType Type INT(11) NOT NULL DEFAULT \'1\',
+ CHANGE DestParentId StateCountryId INT(11) NULL DEFAULT NULL,
+ CHANGE DestAbbr IsoCode CHAR(3) NOT NULL DEFAULT \'\',
+ CHANGE DestAbbr2 ShortIsoCode CHAR(2) NULL DEFAULT NULL,
+ DROP INDEX DestType,
+ DROP INDEX DestParentId,
+ ADD INDEX (`Type`),
+ ADD INDEX (StateCountryId)';
+ $this->Conn->Query($sql);
- $sql = 'UPDATE ' . TABLE_PREFIX . 'CountryStates
- SET l' . $language_id . '_Name = (' . $sub_select . ')';
- $this->Conn->Query($sql);
+ $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
+ /* @var $ml_helper kMultiLanguageHelper */
+
+ $ml_helper->createFields('country-state');
+
+ for ($language_id = 1; $language_id <= $ml_helper->languageCount; $language_id++) {
+ if (!$ml_helper->LanguageFound($language_id)) {
+ continue;
}
- $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'CountryStates
- DROP DestName';
- $this->Conn->Query($sql);
+ $sub_select = ' SELECT l' . $language_id . '_Translation
+ FROM ' . TABLE_PREFIX . 'Phrase
+ WHERE Phrase = DestName';
- $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Phrase
- WHERE Phrase LIKE ' . $this->Conn->qstr('la_country_%') . ' OR Phrase LIKE ' . $this->Conn->qstr('la_state_%');
+ $sql = 'UPDATE ' . TABLE_PREFIX . 'CountryStates
+ SET l' . $language_id . '_Name = (' . $sub_select . ')';
$this->Conn->Query($sql);
+ }
- // makes configuration values dropdowns use "||" as separator
- $custom_field_helper =& $this->Application->recallObject('InpCustomFieldsHelper');
- /* @var $custom_field_helper InpCustomFieldsHelper */
+ $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'CountryStates
+ DROP DestName';
+ $this->Conn->Query($sql);
- $sql = 'SELECT ValueList, VariableName
- FROM ' . TABLE_PREFIX . 'ConfigurationAdmin
- WHERE ValueList LIKE "%,%"';
- $variables = $this->Conn->GetCol($sql, 'VariableName');
+ $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Phrase
+ WHERE Phrase LIKE ' . $this->Conn->qstr('la_country_%') . ' OR Phrase LIKE ' . $this->Conn->qstr('la_state_%');
+ $this->Conn->Query($sql);
+ }
- foreach ($variables as $variable_name => $value_list) {
- $ret = Array ();
- $options = $custom_field_helper->GetValuesHash($value_list, ',', false);
+ /**
+ * Makes configuration values dropdowns use "||" as separator
+ *
+ */
+ function _replaceConfigurationValueSeparator()
+ {
+ $custom_field_helper =& $this->Application->recallObject('InpCustomFieldsHelper');
+ /* @var $custom_field_helper InpCustomFieldsHelper */
- foreach ($options as $option_key => $option_title) {
- if (substr($option_key, 0, 3) == 'SQL') {
- $ret[] = $option_title;
- }
- else {
- $ret[] = $option_key . '=' . $option_title;
- }
+ $sql = 'SELECT ValueList, VariableName
+ FROM ' . TABLE_PREFIX . 'ConfigurationAdmin
+ WHERE ValueList LIKE "%,%"';
+ $variables = $this->Conn->GetCol($sql, 'VariableName');
+
+ foreach ($variables as $variable_name => $value_list) {
+ $ret = Array ();
+ $options = $custom_field_helper->GetValuesHash($value_list, ',', false);
+
+ foreach ($options as $option_key => $option_title) {
+ if (substr($option_key, 0, 3) == 'SQL') {
+ $ret[] = $option_title;
}
+ else {
+ $ret[] = $option_key . '=' . $option_title;
+ }
+ }
+ $fields_hash = Array (
+ 'ValueList' => implode(VALUE_LIST_SEPARATOR, $ret),
+ );
+
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'ConfigurationAdmin', 'VariableName = ' . $this->Conn->qstr($variable_name));
+ }
+ }
+
+ /**
+ * Transforms "FromUserId" into Sender* and Recipients columns
+ *
+ */
+ function _transformEmailRecipients()
+ {
+ $sql = 'SELECT FromUserId, Type, EventId
+ FROM ' . TABLE_PREFIX . 'Events
+ WHERE FromUserId IS NOT NULL AND (FromUserId <> ' . USER_ROOT . ')';
+ $events = $this->Conn->Query($sql, 'EventId');
+
+ $minput_helper =& $this->Application->recallObject('MInputHelper');
+ /* @var $minput_helper MInputHelper */
+
+ foreach ($events as $event_id => $event_data) {
+ $sql = 'SELECT Login
+ FROM ' . TABLE_PREFIX . 'PortalUser
+ WHERE PortalUserId = ' . $event_data['FromUserId'];
+ $username = $this->Conn->GetOne($sql);
+
+ if (!$username) {
+ continue;
+ }
+
+ if ($event_data['Type'] == EVENT_TYPE_FRONTEND) {
+ // from user
$fields_hash = Array (
- 'ValueList' => implode(VALUE_LIST_SEPARATOR, $ret),
+ 'CustomSender' => 1,
+ 'SenderAddressType' => ADDRESS_TYPE_USER,
+ 'SenderAddress' => $username
);
+ }
- $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'ConfigurationAdmin', 'VariableName = ' . $this->Conn->qstr($variable_name));
+ if ($event_data['Type'] == EVENT_TYPE_ADMIN) {
+ // to user
+ $records = Array (
+ Array (
+ 'RecipientType' => RECIPIENT_TYPE_TO,
+ 'RecipientName' => '',
+ 'RecipientAddressType' => ADDRESS_TYPE_USER,
+ 'RecipientAddress' => $username
+ )
+ );
+
+ $fields_hash = Array (
+ 'CustomRecipient' => 1,
+ 'Recipients' => $minput_helper->prepareMInputXML($records, array_keys( reset($records) ))
+ );
}
- // save "config.php" in php format, not ini format as before
- $this->_toolkit->SaveConfig();
+ $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'Events', 'EventId = ' . $event_id);
}
+
+ $this->Conn->Query('ALTER TABLE ' . TABLE_PREFIX . 'Events DROP FromUserId');
}
}
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/incs/style_template.css
===================================================================
diff -u -N -r13401 -r13635
--- branches/5.1.x/core/admin_templates/incs/style_template.css (.../style_template.css) (revision 13401)
+++ branches/5.1.x/core/admin_templates/incs/style_template.css (.../style_template.css) (revision 13635)
@@ -663,4 +663,21 @@
.tree tr td a.debug-only-item {
color: grey;
+}
+
+/* Ajax Dropdown */
+.suggest-box {
+ border: 1px solid #999;
+ background-color: #fff;
+}
+
+.suggest-item, .suggest-item-over {
+ padding: 1px 2px 0px 2px;
+ font-family: arial,verdana;
+ font-size: 12px;
+}
+
+.suggest-item-over {
+ background-color: #3366CC;
+ color: #fff;
}
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/languages/email_message_list.tpl
===================================================================
diff -u -N -r13140 -r13635
--- branches/5.1.x/core/admin_templates/languages/email_message_list.tpl (.../email_message_list.tpl) (revision 13140)
+++ branches/5.1.x/core/admin_templates/languages/email_message_list.tpl (.../email_message_list.tpl) (revision 13635)
@@ -1,6 +1,6 @@
-
+