Use Horde::addInlineJsVars()
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 3 Sep 2010 23:19:00 +0000 (17:19 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 6 Sep 2010 20:31:15 +0000 (14:31 -0600)
22 files changed:
framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php
framework/Core/lib/Horde/Core/Ui/JsCalendar.php
framework/Core/lib/Horde/Core/Ui/VarRenderer/Html.php
framework/Core/lib/Horde/Script/Files.php
framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php
horde/admin/activesync.php
horde/admin/user.php
horde/lib/Prefs/Ui.php
horde/login.php
horde/services/sidebar.php
imp/compose.php
imp/folders.php
imp/lib/Ajax/Imple/ContactAutoCompleter.php
imp/lib/Application.php
imp/lib/Prefs/Ui.php
imp/lib/Ui/Compose.php
imp/lib/Views/Compose.php
imp/message-dimp.php
imp/message.php
imp/search.php
kronolith/lib/Kronolith.php
turba/lib/Turba.php

index 1dc7305..f8f98c1 100644 (file)
@@ -82,8 +82,8 @@ class Horde_Core_Prefs_Ui_Widgets
                     'unselected' => $val[1]
                 );
             }
-            Horde::addInlineScript(array(
-                'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+            Horde::addInlineJsVars(array(
+                'HordeSourceSelectPrefs.source_list' => $js
             ));
         }
 
@@ -222,9 +222,9 @@ class Horde_Core_Prefs_Ui_Widgets
                 );
             }
 
-            Horde::addInlineScript(array(
-                'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
-                'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+            Horde::addInlineJsVars(array(
+                'HordeAddressbooksPrefs.fields' => $js,
+                'HordeAddressbooksPrefs.nonetext' => _("No address book selected.")
             ));
         }
 
@@ -282,8 +282,8 @@ class Horde_Core_Prefs_Ui_Widgets
     {
         $pref = $data['pref'];
 
-        Horde::addInlineScript(array(
-            'HordeAlarmPrefs.pref = ' . Horde_Serialize::serialize($pref, Horde_Serialize::JSON)
+        Horde::addInlineJsVars(array(
+            'HordeAlarmPrefs.pref' => $pref
         ));
 
         $alarm_pref = unserialize($GLOBALS['prefs']->getValue($pref));
index 2190055..46503b0 100644 (file)
@@ -64,20 +64,20 @@ class Horde_Core_Ui_JsCalendar
             }
         }
 
-        Horde::addScriptFile('calendar.js', 'horde');
-        Horde::addInlineScript(array(
-            'Horde_Calendar.click_month = ' . intval($params['click_month']),
-            'Horde_Calendar.click_week = ' . intval($params['click_week']),
-            'Horde_Calendar.click_year = ' . intval($params['click_year']),
-            'Horde_Calendar.firstDayOfWeek = ' . intval($GLOBALS['prefs']->getValue('first_week_day')),
-            'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
-            'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        $js = array(
+            '-Horde_Calendar.click_month' => intval($params['click_month']),
+            '-Horde_Calendar.click_week' => intval($params['click_week']),
+            '-Horde_Calendar.click_year' => intval($params['click_year']),
+            '-Horde_Calendar.firstDayOfWeek' => intval($GLOBALS['prefs']->getValue('first_week_day')),
+            'Horde_Calendar.months' => self::months(),
+            'Horde_Calendar.weekdays' => $weekdays
         ));
         if ($params['full_weekdays']) {
-            Horde::addInlineScript(array(
-                'Horde_Calendar.fullweekdays = ' . Horde_Serialize::serialize(self::fullWeekdays(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
-            ));
+            $js['Horde_Calendar.fullweekdays'] = self::fullWeekdays();
         }
+
+        Horde::addScriptFile('calendar.js', 'horde');
+        Horde::addInlineJsVars($js);
     }
 
     /**
index 89e7703..bcbc917 100644 (file)
@@ -310,8 +310,8 @@ class Horde_Core_Ui_VarRenderer_Html extends Horde_Core_Ui_VarRenderer
                     );
                 }
 
-                Horde::addInlineScript(array(
-                    'Horde_Html_Helper.iconlist = ' . Horde_Serialize::serialize($icon_list, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+                Horde::addInlineJsVars(array(
+                    'Horde_Html_Helper.iconlist' => $icon_list
                 ));
 
                 $html .= Horde::link('#', _("Emoticons"), '', '', 'Horde_Html_Helper.open(\'emoticons\', \'' . $var->getVarName() . '\'); return false;') . Horde::img('emoticons/smile.png', _("Emoticons"), 'id="' . $imgId . '"') . '</a>';
index 8b808da..e28968b 100644 (file)
@@ -109,7 +109,9 @@ class Horde_Script_Files
 
         // Add localized string for popup.js
         if (($file == 'popup.js') && ($app == 'horde')) {
-            Horde::addInlineScript('Horde.popup_block_text=' . Horde_Serialize::serialize(_("A popup window could not be opened. Your browser may be blocking popups."), Horde_Serialize::JSON), 'dom');
+            Horde::addInlineJsVars(array(
+                'Horde.popup_block_text' => _("A popup window could not be opened. Your browser may be blocking popups.")
+            ));
         }
 
         if ($file[0] == '/') {
index 3195826..856519b 100644 (file)
@@ -174,8 +174,8 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer
                     );
                 }
 
-                Horde::addInlineScript(array(
-                    'Horde_Html_Helper.iconlist = ' . Horde_Serialize::serialize($icon_list, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+                Horde::addInlineJsVars(array(
+                    'Horde_Html_Helper.iconlist' => $icon_list
                 ));
 
                 $html .= Horde::link('#', _("Emoticons"), '', '', 'Horde_Html_Helper.open(\'emoticons\', \'' . $var->getVarName() . '\'); return false;')
index be61651..befb786 100644 (file)
@@ -64,8 +64,8 @@ foreach ($devices as $key => $val) {
 }
 
 Horde::addScriptFile('activesyncadmin.js');
-Horde::addInlineScript(array(
-    'HordeActiveSyncAdmin.devices = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $registry->getCharset())
+Horde::addInlineJsVars(array(
+    'HordeActiveSyncAdmin.devices' => $js
 ));
 
 $title = _("ActiveSync Device Administration");
index c4a16a3..ef5f6b1 100644 (file)
@@ -216,8 +216,8 @@ case 'removequeued':
 Horde::addScriptFile('stripe.js', 'horde');
 if (isset($update_form) && $auth->hasCapability('list')) {
     Horde::addScriptFile('userupdate.js', 'horde');
-    Horde::addInlineScript(array(
-        'HordeAdminUserUpdate.pass_error = ' . Horde_Serialize::serialize(_("Passwords must match."), Horde_Serialize::JSON, $registry->getCharset())
+    Horde::addInlineJsVars(array(
+        'HordeAdminUserUpdate.pass_error' => _("Passwords must match.")
     ));
 }
 
index 1cb1f76..e54d8ce 100644 (file)
@@ -221,8 +221,8 @@ class Horde_Prefs_Ui
     {
         Horde::addScriptFile('categoryprefs.js', 'horde');
         Horde::addScriptFile('colorpicker.js', 'horde');
-        Horde::addInlineScript(array(
-            'HordeAlarmPrefs.category_text = ' . Horde_Serialize::serialize(_("Enter a name for the new category:"), Horde_Serialize::JSON)
+        Horde::addInlineJsVars(array(
+            'HordeAlarmPrefs.category_text' => _("Enter a name for the new category:")
         ));
 
         $cManager = new Horde_Prefs_CategoryManager();
@@ -312,9 +312,8 @@ class Horde_Prefs_Ui
             );
         }
 
-        Horde::addInlineScript(array(
-            'HordeRpcPrefs.servers = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON)
-
+        Horde::addInlineJsVars(array(
+            'HordeRpcPrefs.servers' => $js
         ));
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
@@ -392,8 +391,8 @@ class Horde_Prefs_Ui
         }
 
         Horde::addScriptFile('activesyncprefs.js', 'horde');
-        Horde::addInlineScript(array(
-            'HordeActiveSyncPrefs.devices = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        Horde::addInlineJsVars(array(
+            'HordeActiveSyncPrefs.devices' => $js
         ));
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
index 1afb7f6..bdba797 100644 (file)
@@ -83,8 +83,8 @@ $loginparams = array(
     )
 );
 $js_code = array(
-    'HordeLogin.user_error = ' . Horde_Serialize::serialize(_("Please enter a username."), Horde_Serialize::JSON),
-    'HordeLogin.pass_error = ' . Horde_Serialize::serialize(_("Please enter a password."), Horde_Serialize::JSON)
+    'HordeLogin.user_error' => _("Please enter a username."),
+    'HordeLogin.pass_error' => _("Please enter a password.")
 );
 $js_files = array(
     array('login.js', 'horde')
@@ -332,11 +332,8 @@ if (!empty($js_files)) {
     }
 }
 
+Horde::addInlineJsVars($js_code);
+
 require $registry->get('templates', 'horde') . '/common-header.inc';
 require $registry->get('templates', 'horde') . '/login/login.inc';
-
-if (!empty($js_code)) {
-    echo Horde::wrapInlineScript(array(implode(';', $js_code)));
-}
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 09ffc90..1a148f7 100644 (file)
@@ -36,12 +36,12 @@ if (!Horde_Util::getFormData('ajaxui') &&
     $show_sidebar = !isset($_COOKIE['horde_sidebar_expanded']) || $_COOKIE['horde_sidebar_expanded'];
     $width = intval($prefs->getValue('sidebar_width'));
 
-    Horde::addInlineScript(array(
-        'HordeSidebar.domain = ' . Horde_Serialize::serialize($conf['cookie']['domain'], Horde_Serialize::JSON, $charset),
-        'HordeSidebar.path = ' . Horde_Serialize::serialize($conf['cookie']['path'], Horde_Serialize::JSON, $charset),
-        'HordeSidebar.refresh = ' . intval($prefs->getValue('menu_refresh_time')),
-        'HordeSidebar.url = ' . Horde_Serialize::serialize(strval($ajax_url), Horde_Serialize::JSON, $charset),
-        'HordeSidebar.width = ' . $width
+    Horde::addInlineJsVars(array(
+        'HordeSidebar.domain' => $conf['cookie']['domain'],
+        'HordeSidebar.path' => $conf['cookie']['path'],
+        '-HordeSidebar.refresh' => intval($prefs->getValue('menu_refresh_time')),
+        'HordeSidebar.url' => strval($ajax_url),
+        '-HordeSidebar.width' => $width
     ));
 
     require $registry->get('templates', 'horde') . '/sidebar/sidebar.inc';
index 88ed766..93af2b8 100644 (file)
@@ -689,7 +689,7 @@ $js_code = array(
 
 /* Create javascript identities array. */
 if (!$redirect) {
-    $js_code[] = $imp_ui->identityJs();
+    $js_code = array_merge($js_code, $imp_ui->identityJs());
 }
 
 /* Set up the base template now. */
index 3ac41d3..95e8aec 100644 (file)
@@ -37,8 +37,8 @@ $vars = Horde_Variables::getDefaultVariables();
 $folders_url = Horde::selfUrl();
 
 /* This JS define is required by all folder pages. */
-Horde::addInlineScript(array(
-    'ImpFolders.folders_url = ' . Horde_Serialize::serialize(strval($folders_url), Horde_Serialize::JSON, $charset)
+Horde::addInlineJsVars(array(
+    'ImpFolders.folders_url' => strval($folders_url)
 ));
 
 /* Initialize the IMP_Folder object. */
@@ -425,11 +425,11 @@ if (!empty($imaptree->recent)) {
     IMP::newmailAlerts($imaptree->recent);
 }
 
-Horde::addInlineScript(array(
-    'ImpFolders.ajax = ' . Horde_Serialize::serialize(Horde::getServiceLink('ajax', 'imp')->url, Horde_Serialize::JSON, $charset),
-    'ImpFolders.displayNames = ' . Horde_Serialize::serialize($displayNames, Horde_Serialize::JSON, $charset),
-    'ImpFolders.fullNames = ' . Horde_Serialize::serialize($fullNames, Horde_Serialize::JSON, $charset),
-    'ImpFolders.mbox_expand = ' . intval($prefs->getValue('nav_expanded') == 2)
+Horde::addInlineJsVars(array(
+    'ImpFolders.ajax' => Horde::getServiceLink('ajax', 'imp')->url,
+    'ImpFolders.displayNames' => $displayNames,
+    'ImpFolders.fullNames' => $fullNames,
+    '-ImpFolders.mbox_expand' => intval($prefs->getValue('nav_expanded') == 2)
 ));
 
 $title = _("Folder Navigator");
index 5763af4..0acbecf 100644 (file)
@@ -66,7 +66,11 @@ class IMP_Ajax_Imple_ContactAutoCompleter extends Horde_Core_Ajax_Imple_AutoComp
                 if (!isset($addrlist)) {
                     $addrlist = IMP_Compose::getAddressList();
                 }
-                Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()));
+                Horde::addInlineScript(array_merge(array(
+                    'if (!window.IMP) window.IMP = {}'
+                ), Horde::addInlineJsVars(array(
+                    'IMP.ac_list' => $addrlist
+                ), true)));
                 self::$_listOutput = true;
             }
 
index b451b41..33c2686 100644 (file)
@@ -236,7 +236,7 @@ class IMP_Application extends Horde_Registry_Application
 
         /* Show selection of alternate views. */
         $js_code = array(
-            'ImpLogin.server_key_error=' . Horde_Serialize::serialize(_("Please choose a mail server."), Horde_Serialize::JSON)
+            'ImpLogin.server_key_error' => _("Please choose a mail server.")
         );
         if (!empty($GLOBALS['conf']['user']['select_view'])) {
             if (!($view_cookie = Horde_Util::getFormData('imp_select_view'))) {
@@ -245,7 +245,7 @@ class IMP_Application extends Horde_Registry_Application
                     : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp');
             }
 
-            $js_code[] = 'ImpLogin.dimp_sel=' . intval($view_cookie == 'dimp');
+            $js_code['-ImpLogin.dimp_sel'] = intval($view_cookie == 'dimp');
 
             $params['imp_select_view'] = array(
                 'label' => _("Mode"),
@@ -269,7 +269,7 @@ class IMP_Application extends Horde_Registry_Application
         }
 
         return array(
-            'js_code' => $js_code,
+            'js_code' => Horde::addInlineJsVars($js_code, true),
             'js_files' => array(
                 array('login.js', 'imp')
             ),
index 5cb44ec..6a6da5f 100644 (file)
@@ -258,8 +258,8 @@ class IMP_Prefs_Ui
 
             if (!empty($code)) {
                 Horde::addScriptFile('folderprefs.js', 'imp');
-                Horde::addInlineScript(array(
-                    'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+                Horde::addInlineJsVars(array(
+                    'ImpFolderPrefs.folders' => $code
                 ));
             }
             break;
@@ -590,8 +590,8 @@ class IMP_Prefs_Ui
     {
         $ui->nobuttons = true;
 
-        Horde::addInlineScript(array(
-            'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        Horde::addInlineHsVars(array(
+            'ImpAccountsPrefs.confirm_delete' => _("Are you sure you want to delete this account?")
         ));
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
@@ -927,9 +927,9 @@ class IMP_Prefs_Ui
      */
     protected function _flagManagement()
     {
-        Horde::addInlineScript(array(
-            'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
-            'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        Horde::addInlineJsVars(array(
+            'ImpFlagPrefs.new_prompt' => _("Please enter the label for the new flag:"),
+            'ImpFlagPrefs.confirm_delete' => _("Are you sure you want to delete this flag?")
         ));
 
         $msgflags_locked = $GLOBALS['prefs']->isLocked('msgflags');
@@ -1264,11 +1264,9 @@ class IMP_Prefs_Ui
             $js[$key] = $identity->getValue('sent_mail_folder', $key);
         };
 
-        Horde::addInlineScript(array(
-            'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize(array(
-                'sent_mail_folder' => _("Create a new sent-mail folder")
-            ), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
-            'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        Horde::addInlineJsVars(array(
+            'ImpFolderPrefs.folders' => array('sent_mail_folder' => _("Create a new sent-mail folder")),
+            'ImpFolderPrefs.sentmail' => $js
         ));
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
@@ -1485,8 +1483,8 @@ class IMP_Prefs_Ui
             $js[$key] = $identity->getValue('signature_html', $key);
         };
 
-        Horde::addInlineScript(array(
-            'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+        Horde::addInlineJsVars(array(
+            'ImpHtmlSignaturePrefs.sigs' => $js
         ));
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
index 98ccb67..d455015 100644 (file)
@@ -298,6 +298,7 @@ class IMP_Ui_Compose
     }
 
     /**
+     * @return array  See Horde::addInlineJsVars().
      */
     public function identityJs()
     {
@@ -325,7 +326,9 @@ class IMP_Ui_Compose
             );
         }
 
-        return 'IMP_Compose_Base.identities = ' . Horde_Serialize::serialize($identities, Horde_Serialize::JSON);
+        return Horde::addInlineJsVars(array(
+            'IMP_Compose_Base.identities' => $identities
+        ), true);
     }
 
     /**
index 308db69..701b9c4 100644 (file)
@@ -55,7 +55,7 @@ class IMP_Views_Compose
 
             /* Generate identities list. */
             $imp_ui = $GLOBALS['injector']->getInstance('IMP_Ui_Compose');
-            $result['js'][] = $imp_ui->identityJs();
+            $result['js'] = array_merge($result['js'], $imp_ui->identityJs());
 
             if ($composeCache &&
                 $imp_compose->numberOfAttachments()) {
@@ -110,10 +110,14 @@ class IMP_Views_Compose
                     }
                     $flist[] = $tmp;
                 }
-                $result['js'][] = 'DIMP.conf_compose.flist = ' . Horde_Serialize::serialize($flist, Horde_Serialize::JSON);
+                $result['js'] = array_merge($result['js'], Horde::addInlineJsVars(array(
+                    'DIMP.conf_compose.flist' => $flist
+                ), true));
             }
         } else {
-            $result['js'][] = 'DIMP.conf_compose.redirect = 1';
+            $result['js'] = array_merge($result['js'], Horde::addInlineJsVars(array(
+                '-DIMP.conf_compose.redirect' => 1
+            ), true));
             $redirect = true;
         }
 
index d485764..c88c7ea 100644 (file)
@@ -22,14 +22,14 @@ if (!$vars->uid || !$vars->folder) {
 }
 
 $imp_ui = new IMP_Ui_Message();
-$js_onload = $js_out = array();
+$js_onload = $js_vars = array();
 $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly($vars->folder);
 
 switch ($vars->actionID) {
 case 'strip_attachment':
     try {
         $indices = $injector->getInstance('IMP_Message')->stripPart(new IMP_Indices($vars->folder, $vars->uid), $vars->id);
-        $js_out[] = 'DimpFullmessage.strip = 1';
+        $js_vars['-DimpFullmessage.strip'] = 1;
         list(,$vars->uid) = $indices->getSingle();
         $notification->push(_("Attachment successfully stripped."), 'horde.success');
     } catch (IMP_Exception $e) {
@@ -64,9 +64,10 @@ $scripts = array(
 
 foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log', 'uid', 'mailbox') as $val) {
     if (!empty($show_msg_result[$val])) {
-        $js_out[] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON);
+        $js_vars['DimpFullmessage.' . $val] = $show_msg_result[$val];
     }
 }
+$js_out = Horde::addInlineJsVars($js_vars, true);
 
 /* Determine if compose mode is disabled. */
 $disable_compose = !IMP::canCompose();
index 06167a6..80990f8 100644 (file)
@@ -468,8 +468,8 @@ if (!$readonly) {
     } else {
         $a_template->set('delete', Horde::widget($self_link->copy()->add('actionID', 'delete_message'), _("Delete"), 'widget', '', '', _("_Delete"), true));
         if ($use_pop) {
-            Horde::addInlineScript(array(
-                'ImpMessage.pop3delete = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete these messages?"), Horde_Serialize::JSON, $registry->getCharset())
+            Horde::addInlineJsVars(array(
+                'ImpMessage.pop3delete' => _("Are you sure you want to PERMANENTLY delete these messages?")
             ));
         }
     }
@@ -618,8 +618,8 @@ if (count($inlineout['display_ids']) > 2) {
     $a_template->set('download_all', Horde::widget($imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all'), _("Download All Attachments (in .zip file)"), 'widget', '', '', _("Download All Attachments (in .zip file)"), true));
     if ($strip_atc) {
         $a_template->set('strip_all', Horde::widget(Horde::selfUrl(true)->remove(array('actionID'))->add(array('actionID' => 'strip_all', 'message_token' => $message_token)), _("Strip All Attachments"), 'widget stripAllAtc', '', '', _("Strip All Attachments"), true));
-        Horde::addInlineScript(array(
-            'ImpMessage.stripatc = ' . Horde_Serialize::serialize(_("Are you sure you want to PERMANENTLY delete all attachments?"), Horde_Serialize::JSON, $registry->getCharset())
+        Horde::addInlineJsVars(array(
+            'ImpMessage.stripatc' => _("Are you sure you want to PERMANENTLY delete all attachments?")
         ));
     }
 
index 26336ba..9a59f04 100644 (file)
@@ -44,6 +44,7 @@ $vars = Horde_Variables::getDefaultVariables();
 
 $charset = $registry->getCharset();
 $dimp_view = ($_SESSION['imp']['view'] == 'dimp');
+$js_load = array();
 $search_fields = $imp_search->searchFields();
 $search_mailbox = isset($vars->search_mailbox)
     ? $vars->search_mailbox
@@ -172,9 +173,9 @@ $js_data = array(
     'types' => $types
 );
 
-Horde::addInlineScript(array(
-    'ImpSearch.data = ' . Horde_Serialize::serialize($js_data, Horde_Serialize::JSON, $charset),
-    'ImpSearch.text = ' . Horde_Serialize::serialize($gettext_strings, Horde_Serialize::JSON, $charset)
+Horde::addInlineJsVars(array(
+    'ImpSearch.data' => $js_data,
+    'ImpSearch.text' => $gettext_strings,
 ));
 Horde::addInlineScript($js_load, 'dom');
 
index 7e9bc7a..79a0694 100644 (file)
@@ -2955,11 +2955,11 @@ class Kronolith
                 'full_weekdays' => true
             ));
             Horde::addScriptFile('goto.js', 'kronolith');
-            Horde::addInlineScript(array(
-                'KronolithGoto.dayurl = ' . Horde_Serialize::serialize(strval(Horde::url('day.php')), Horde_Serialize::JSON, $registry->getCharset()),
-                'KronolithGoto.monthurl = ' . Horde_Serialize::serialize(strval(Horde::url('month.php')), Horde_Serialize::JSON, $registry->getCharset()),
-                'KronolithGoto.weekurl = ' . Horde_Serialize::serialize(strval(Horde::url('week.php')), Horde_Serialize::JSON, $registry->getCharset()),
-                'KronolithGoto.yearurl = ' . Horde_Serialize::serialize(strval(Horde::url('year.php')), Horde_Serialize::JSON, $registry->getCharset()),
+            Horde::addInlineJsVars(array(
+                'KronolithGoto.dayurl' => strval(Horde::url('day.php')),
+                'KronolithGoto.monthurl' => strval(Horde::url('month.php')),
+                'KronolithGoto.weekurl' => strval(Horde::url('week.php')),
+                'KronolithGoto.yearurl' => strval(Horde::url('year.php'))
             ));
             $menu->add(new Horde_Url(''), _("_Goto"), 'goto.png', null, '', null, 'kgotomenu');
         }
index 65c20c9..9a46681 100644 (file)
@@ -638,22 +638,15 @@ class Turba {
      */
     public function addBrowseJs()
     {
-        $js = array();
-        $js_text = array(
-            'confirmdelete' => _("Are you sure that you want to delete %s?"),
-            'contact1' => _("You must select at least one contact first."),
-            'contact2' => ("You must select a target contact list."),
-            'contact3' => _("Please name the new contact list:"),
-            'copymove' => _("You must select a target address book."),
-            'submit' => _("Are you sure that you want to delete the selected contacts?"),
-        );
-
-        foreach ($js_text as $key => $val) {
-            $js[] = 'TurbaBrowse.' . $key . ' = ' . Horde_Serialize::serialize($val, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
-        }
-
         Horde::addScriptFile('browse.js', 'turba');
-        Horde::addInlineScript($js);
+        Horde::addInlineJsVars(array(
+            'TurbaBrowse.confirmdelete' => _("Are you sure that you want to delete %s?"),
+            'TurbaBrowse.contact1' => _("You must select at least one contact first."),
+            'TurbaBrowse.contact2' => ("You must select a target contact list."),
+            'TurbaBrowse.contact3' => _("Please name the new contact list:"),
+            'TurbaBrowse.copymove' => _("You must select a target address book."),
+            'TurbaBrowse.submit' => _("Are you sure that you want to delete the selected contacts?")
+        ));
     }
 
 }