Branch 'roundcubemail-plugins-kolab-3.1' - 2 commits - plugins/kolab_files

Aleksander Machniak machniak at kolabsys.com
Fri Oct 17 14:32:37 CEST 2014


 plugins/kolab_files/kolab_files.js                            |   10 ++--
 plugins/kolab_files/lib/kolab_files_engine.php                |   25 +++++++++-
 plugins/kolab_files/localization/en_US.inc                    |    3 +
 plugins/kolab_files/skins/larry/style.css                     |   16 ++++++
 plugins/kolab_files/skins/larry/templates/compose_plugin.html |    1 
 plugins/kolab_files/skins/larry/templates/files.html          |    1 
 plugins/kolab_files/skins/larry/templates/message_plugin.html |    1 
 7 files changed, 51 insertions(+), 6 deletions(-)

New commits:
commit 4a35201c6e4b5d734cfb8e2e154762ff3934187d
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri Oct 17 08:32:29 2014 -0400

    Add "remember password" option
    
    Conflicts:
    
    	plugins/kolab_files/localization/en_US.inc
    	plugins/kolab_files/skins/larry/templates/compose_plugin.html
    	plugins/kolab_files/skins/larry/templates/files.html
    	plugins/kolab_files/skins/larry/templates/message_plugin.html

diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js
index 1699c5f..1e72311 100644
--- a/plugins/kolab_files/kolab_files.js
+++ b/plugins/kolab_files/kolab_files.js
@@ -340,6 +340,10 @@ function kolab_files_folder_mount_dialog()
       }
     });
 
+    $('.auth-options input', dialog).each(function() {
+      args[this.name] = this.type == 'checkbox' && !this.checked ? '' : this.value;
+    });
+
     file_api.folder_mount(args);
     kolab_dialog_close(this);
   };
@@ -894,7 +898,7 @@ function kolab_files_ui()
 
     elem.html('').append(list);
 
-    this.env.folders = this.folder_list_parse(response.result ? response.result.list : []);
+    this.env.folders = this.folder_list_parse(response.result && response.result.list ? response.result.list : response.result);
 
     $.each(this.env.folders, function(i, f) {
       list.append(file_api.folder_list_row(i, f));
@@ -1698,13 +1702,13 @@ function kolab_files_ui()
       content = this.folder_list_auth_form(driver);
 
     dialog.find('table.propform').remove();
-    dialog.append(content);
+    $('.options', dialog).before(content);
 
     args.buttons[this.t('kolab_files.save')] = function() {
       var data = {folder: label, list: 1};
 
       $('input', dialog).each(function() {
-        data[this.name] = this.value;
+        data[this.name] = this.type == 'checkbox' && !this.checked ? '' : this.value;
       });
 
       file_api.open_dialog = this;
diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
index 81d0afc..b345207 100644
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -123,6 +123,7 @@ class kolab_files_engine
             $this->rc->output->add_handlers(array(
                 'folder-create-form' => array($this, 'folder_create_form'),
                 'folder-mount-form'  => array($this, 'folder_mount_form'),
+                'folder-auth-options'=> array($this, 'folder_auth_options'),
                 'file-search-form'   => array($this, 'file_search_form'),
                 'file-edit-form'     => array($this, 'file_edit_form'),
                 'filelist'           => array($this, 'file_list'),
@@ -243,7 +244,7 @@ class kolab_files_engine
             $table->add(array('id' => $id, 'colspan' => 2, 'class' => 'source'), $row);
         }
 
-        $out = $table->show();
+        $out = $table->show() . $this->folder_auth_options(array('suffix' => '-form'));
 
         // add form tag around text field
         if (empty($attrib['form'])) {
@@ -259,6 +260,23 @@ class kolab_files_engine
     }
 
     /**
+     * Template object for folder authentication options
+     */
+    public function folder_auth_options($attrib)
+    {
+        $checkbox = new html_checkbox(array(
+            'name'  => 'store_passwords',
+            'value' => '1',
+            'id'    => 'auth-pass-checkbox' . $attrib['suffix'],
+        ));
+
+        return html::div('auth-options', $checkbox->show(). ' '
+            . html::label('auth-pass-checkbox' . $attrib['suffix'], $this->plugin->gettext('storepasswords'))
+            . html::span('description', $this->plugin->gettext('storepasswordsdesc'))
+        );
+    }
+
+    /**
      * Template object for file_edit form
      */
     public function file_edit_form($attrib)
diff --git a/plugins/kolab_files/localization/en_US.inc b/plugins/kolab_files/localization/en_US.inc
index 364566f..53d42d4 100644
--- a/plugins/kolab_files/localization/en_US.inc
+++ b/plugins/kolab_files/localization/en_US.inc
@@ -72,4 +72,7 @@ $labels['fileoverwrite'] = 'Overwrite';
 $labels['fileoverwriteall'] = 'Overwrite all';
 $labels['filemoveconfirm'] = 'This action is going to overwrite the destination file: <b>$file</b>.';
 
+$labels['storepasswords'] = 'remember password';
+$labels['storepasswordsdesc'] = 'Stored passwords will be encrypted. Enable this if you do not want to be asked for the password on every login or you want this storage to be available via WebDAV.';
+
 ?>
diff --git a/plugins/kolab_files/skins/larry/style.css b/plugins/kolab_files/skins/larry/style.css
index ed6691b..800534c 100644
--- a/plugins/kolab_files/skins/larry/style.css
+++ b/plugins/kolab_files/skins/larry/style.css
@@ -346,7 +346,6 @@ ul.toolbarmenu li span.saveas {
   background: url(images/buttons.png) -5px -253px no-repeat;
 }
 
-
 table.propform td.source.selected {
   background-color: #c7e3ef;
 }
@@ -381,3 +380,18 @@ table.propform td.source table.propform td {
   padding: 2px 10px;
   background-color: inherit;
 }
+
+.auth-options {
+  margin-top: 5px;
+}
+
+.auth-options .description {
+  color: #666;
+  display: block;
+  margin: 3px 0 0 25px;
+}
+
+.auth-options input,
+.auth-options label {
+  vertical-align: middle;
+}
diff --git a/plugins/kolab_files/skins/larry/templates/compose_plugin.html b/plugins/kolab_files/skins/larry/templates/compose_plugin.html
index d0ec432..75bd7d5 100644
--- a/plugins/kolab_files/skins/larry/templates/compose_plugin.html
+++ b/plugins/kolab_files/skins/larry/templates/compose_plugin.html
@@ -21,4 +21,5 @@
 </div>
 
 <div id="files-folder-auth-dialog">
+    <roundcube:object name="folder-auth-options" />
 </div>
diff --git a/plugins/kolab_files/skins/larry/templates/files.html b/plugins/kolab_files/skins/larry/templates/files.html
index 24e84f8..7987260 100644
--- a/plugins/kolab_files/skins/larry/templates/files.html
+++ b/plugins/kolab_files/skins/larry/templates/files.html
@@ -69,6 +69,7 @@
     <roundcube:object name="file-edit-form" />
 </div>
 <div id="files-folder-auth-dialog">
+    <roundcube:object name="folder-auth-options" />
 </div>
 
 <div id="listoptions" class="propform popupdialog">
diff --git a/plugins/kolab_files/skins/larry/templates/message_plugin.html b/plugins/kolab_files/skins/larry/templates/message_plugin.html
index dc84034..c0dbefb 100644
--- a/plugins/kolab_files/skins/larry/templates/message_plugin.html
+++ b/plugins/kolab_files/skins/larry/templates/message_plugin.html
@@ -15,6 +15,7 @@
 </div>
 
 <div id="files-folder-auth-dialog">
+    <roundcube:object name="folder-auth-options" />
 </div>
 
 <script src="plugins/kolab_files/skins/larry/ui.js" type="text/javascript"></script>


commit bd666a86497606c2d018eced7aea29369f24e48c
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Oct 14 21:13:22 2014 -0400

    Set supported API version

diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
index 35df58c..81d0afc 100644
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -29,6 +29,9 @@ class kolab_files_engine
     private $timeout = 600;
     private $sort_cols = array('name', 'mtime', 'size');
 
+    const API_VERSION = 2;
+
+
     /**
      * Class constructor
      */
@@ -621,7 +624,7 @@ class kolab_files_engine
             }
 
             // Go with authenticate request
-            $url->setQueryVariables(array('method' => 'authenticate'));
+            $url->setQueryVariables(array('method' => 'authenticate', 'version' => self::API_VERSION));
             $request->setUrl($url);
             $request->setAuth($this->rc->user->get_username(), $this->rc->decrypt($_SESSION['password']));
             $response = $request->send();




More information about the commits mailing list