[Rt-commit] r15894 - in rt/branches/3.999-DANGEROUS: lib share/html/NoAuth/js

clkao at bestpractical.com clkao at bestpractical.com
Wed Sep 10 13:16:37 EDT 2008


Author: clkao
Date: Wed Sep 10 13:16:37 2008
New Revision: 15894

Modified:
   rt/branches/3.999-DANGEROUS/etc/config.yml
   rt/branches/3.999-DANGEROUS/lib/RT.pm
   rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/titlebox-state.js
   rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/util.js

Log:
- make the js files static.
- load i18n plugin for _() in js.


Modified: rt/branches/3.999-DANGEROUS/etc/config.yml
==============================================================================
--- rt/branches/3.999-DANGEROUS/etc/config.yml	(original)
+++ rt/branches/3.999-DANGEROUS/etc/config.yml	Wed Sep 10 13:16:37 2008
@@ -30,6 +30,8 @@
     - User: {}
     - Authentication::Password: {}
     - Prototypism: {}
+    - I18N:
+        js: 1
   PubSub: 
     Backend: Memcached
     Enable: ~

Modified: rt/branches/3.999-DANGEROUS/lib/RT.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT.pm	Wed Sep 10 13:16:37 2008
@@ -353,6 +353,17 @@
     Jifty->new;
 }
 
+Jifty::Web->add_trigger(
+    name      => 'after_include_javascript',
+    callback  => sub {
+        my $webpath = RT->config->get('WebPath') || '/';
+        Jifty->web->out(
+            qq{<script type="text/javascript">RT = {};RT.WebPath = '$webpath';</script>}
+        );
+    },
+);
+
+
 =head1 BUGS
 
 Please report them to rt-bugs at bestpractical.com, if you know what's

Modified: rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/titlebox-state.js
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/titlebox-state.js	(original)
+++ rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/titlebox-state.js	Wed Sep 10 13:16:37 2008
@@ -46,7 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 function createCookie(name,value,days) {
-    var path = "<%RT->config->get('WebPath')%>" ? "<%RT->config->get('WebPath')%>" : "/";
+    var path = RT.WebPath;
 
     if (days) {
         var date = new Date();

Modified: rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/util.js
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/util.js	(original)
+++ rt/branches/3.999-DANGEROUS/share/html/NoAuth/js/util.js	Wed Sep 10 13:16:37 2008
@@ -183,7 +183,7 @@
 /* calendar functions */
 
 function openCalWindow(field) {
-    var objWindow = window.open('<%RT->config->get('WebPath')%>/Helpers/CalPopup.html?field='+field, 
+    var objWindow = window.open(RT.WebPath+'/Helpers/CalPopup.html?field='+field, 
                                 'RT_Calendar', 
                                 'height=235,width=285,scrollbars=1');
     objWindow.focus();
@@ -197,7 +197,7 @@
         $(link).observe('click', function(ev) { openCalWindow(input); ev.stop(); });
         //link.setAttribute('onclick', "openCalWindow('"+input+"'); return false;");
 
-        var text = document.createTextNode('<% _("Calendar") %>');
+        var text = document.createTextNode(_("Calendar"));
         link.appendChild(text);
 
         var space = document.createTextNode(' ');


More information about the Rt-commit mailing list