Do some basic javascript sniffing to disable dimp if not available
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Mar 2009 12:37:11 +0000 (06:37 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Mar 2009 12:50:27 +0000 (06:50 -0600)
imp/js/src/login.js
imp/login.php
imp/templates/index/index-dimp.inc
imp/templates/login/login.html
imp/themes/screen-dimp.css

index 84e2912..b86abc9 100644 (file)
@@ -7,7 +7,7 @@
 
 var ImpLogin = {
     // The following variables are defined in login.php:
-    //  autologin_url, imp_auth, lang_url, show_list
+    //  autologin_url, dimp_sel, imp_auth, lang_url, show_list
 
     _reload: function()
     {
@@ -68,6 +68,12 @@ var ImpLogin = {
             }
         }
 
+        /* Activate dynamic view. */
+        var o = $('select_view').down('option[value=dimp]').show();
+        if (this.dimp_sel) {
+            o.writeAttribute('selected', 'selected');
+        }
+
         document.observe('change', this._changeHandler.bindAsEventListener(this));
         document.observe('click', this._clickHandler.bindAsEventListener(this));
 
index 27fca73..19b7a87 100644 (file)
@@ -199,9 +199,9 @@ if (!empty($conf['user']['select_view'])) {
             'name' => _("Traditional")
         ),
         array(
-            'sel' => $view_cookie == 'dimp',
             'val' => 'dimp',
-            'name' => _("Dynamic")
+            'name' => _("Dynamic"),
+            'hide' => true
         ),
         array(
             'sel' => $view_cookie == 'mimp',
@@ -209,6 +209,9 @@ if (!empty($conf['user']['select_view'])) {
             'name' => _("Minimalist")
         )
     );
+
+    /* Dimp selection is handled by javascript. */
+    $dimp_sel = ($view_cookie == 'dimp');
 }
 
 /* Mobile login page. */
@@ -336,6 +339,7 @@ IMP::addInlineScript(array(
     'ImpLogin.nomenu = ' . intval(empty($conf['menu']['always'])),
     'ImpLogin.reloadmenu = ' . intval($logout_reason && $imp_auth && $conf['menu']['always']),
     'ImpLogin.show_list = ' . intval($show_list),
+    'ImpLogin.dimp_sel = ' . intval($dimp_sel),
 ));
 
 echo $t->fetch(IMP_TEMPLATES . '/login/login.html');
index 0498ba4..f4e432f 100644 (file)
@@ -43,7 +43,12 @@ function _simpleButton($id, $text, $image, $imagedir = null)
         . Horde::highlightAccessKey($text, $ak) . '</a></li>';
 }
 ?>
-<div id="dimpLoading"><?php echo $loading_text ?></div>
+<div id="dimpLoading">
+ <?php echo $loading_text ?>
+ <noscript>
+  <div class="nojserror"><?php echo _("Error! This application requires javascript to be available and enabled in your browser.") ?></div>
+ </noscript>
+</div>
 <div id="dimpPage" style="display:none">
  <div id="header"></div>
  <div id="pageContainer">
index 7565623..6ae3231 100644 (file)
@@ -88,7 +88,7 @@
      <td class="light leftAlign">
       <select tabindex="<tag:view_tabindex />" id="select_view" name="select_view">
 <loop:views>
-       <option value="<tag:views.val />" <if:views.sel>selected="selected"</if:views.sel>><tag:views.name /></option>
+       <option value="<tag:views.val />"<if:views.hide> style="display:none"<else:views.hide><if:views.sel> selected="selected"</if:views.sel></else:views.hide></if:views.hide>><tag:views.name /></option>
 </loop:views>
       </select>
      </td>
index 6e53421..26db4d5 100644 (file)
@@ -781,7 +781,7 @@ span.attachName {
     text-decoration: underline;
     cursor: pointer;
 }
-span.attachName:hover {
+span.attachName:hover, .nojserror {
     color: red;
 }