From 6d3afb3857f30f69fd883bb3f933568a9e2f4115 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jul 2012 13:49:39 +0200 Subject: [PATCH 1/5] Moved action buttons down to the add field menu. Fixes oc-1155. --- apps/contacts/css/contacts.css | 4 +-- apps/contacts/templates/part.contact.php | 34 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index 588a51a429..5b6ccb7638 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -15,10 +15,10 @@ #bottomcontrols img { margin-top: 0.35em; } #contacts_newcontact { float: left; margin: 0.2em 0 0 1em; } #chooseaddressbook { float: right; margin: 0.2em 1em 0 0; } -#actionbar { height: 30px; width: 60px; position: fixed; right: 0px; top: 4em; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; } +#actionbar { position: relative; clear: both; height: 30px;} #contacts_deletecard {position:relative; float:left; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; } #contacts_downloadcard {position:relative; float:left; background:url('%webroot%/core/img/actions/download.svg') no-repeat center; } -#contacts_propertymenu { clear: both; max-width: 15em; margin: 2em; } +#contacts_propertymenu { clear: left; float:left; max-width: 15em; margin: 2em; } #contacts_propertymenu_button { position:relative;top:0;left:0; margin: 0; } #contacts_propertymenu_dropdown { background-color: #fff; position:relative; right:0; overflow:hidden; text-overflow:ellipsis; border: thin solid #1d2d44; box-shadow: 0 3px 5px #bbb; /* -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; -moz-border-radius:0.5em; -webkit-border-radius:0.5em;*/ border-radius: 3px; } #contacts_propertymenu li { display: block; font-weight: bold; height: 20px; } diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php index bb574372e5..4233bffede 100644 --- a/apps/contacts/templates/part.contact.php +++ b/apps/contacts/templates/part.contact.php @@ -9,10 +9,6 @@ $id = isset($_['id']) ? $_['id'] : ''; -
- - -
@@ -108,19 +104,23 @@ $id = isset($_['id']) ? $_['id'] : '';
-
- - +
From 825d92d59c54a5274f94e7058c4458238f9586a3 Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Wed, 4 Jul 2012 14:28:08 +0100 Subject: [PATCH 2/5] Added undo functionality to delete user procedure on user settings page --- settings/js/users.js | 96 ++++++++++++++++++++++++++++++++---- settings/templates/users.php | 2 + 2 files changed, 89 insertions(+), 9 deletions(-) diff --git a/settings/js/users.js b/settings/js/users.js index c04df81d82..dfa28e4c4c 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -4,6 +4,72 @@ * See the COPYING-README file. */ +UserList={ + useUndo:true, + + /** + * @brief Initiate user deletion process in UI + * @param string uid the user ID to be deleted + * + * Does not actually delete the user; it sets them for + * deletion when the current page is unloaded, at which point + * finishDelete() completes the process. This allows for 'undo'. + */ + do_delete:function( uid ) { + + UserList.deleteUid = uid; + + // Set undo flag + UserList.deleteCanceled = false; + + // Hide user in table to reflect deletion + $(this).parent().parent().hide(); + $('tr').filterAttr( 'data-uid', UserList.deleteUid ).hide(); + + // Provide user with option to undo + $('#notification').text(t('files','undo delete user')); + $('#notification').data('deleteuser',true); + $('#notification').fadeIn(); + + }, + + /** + * @brief Delete a user via ajax + * @param bool ready whether to use ready() upon completion + * + * Executes deletion via ajax of user identified by property deleteUid + * if 'undo' has not been used. Completes the user deletion procedure + * and reflects success in UI. + */ + finishDelete:function( ready ){ + + // Check deletion has not been undone + if( !UserList.deleteCanceled && UserList.deleteUid ){ + + // Delete user via ajax + $.post( + OC.filePath('settings','ajax','removeuser.php'), + {username:UserList.deleteUid}, + function(result){ + + // Remove undo option, & remove user from table + boolOperationFinished( + data, function(){ + $('#notification').fadeOut(); + $('tr').filterAttr( 'data-uid', username ).remove(); + UserList.deleteCanceled=true; + UserList.deleteFiles=null; + if( ready ){ + ready(); + } + } + ); + } + ); + } + } +} + $(document).ready(function(){ function setQuota(uid,quota,ready){ $.post( @@ -61,15 +127,12 @@ $(document).ready(function(){ }); $('td.remove>img').live('click',function(event){ - var uid=$(this).parent().parent().data('uid'); - $.post( - OC.filePath('settings','ajax','removeuser.php'), - {username:uid}, - function(result){ - - } - ); - $(this).parent().parent().remove(); + + var uid = $(this).parent().parent().data('uid'); + + // Call function for handling delete/undo + UserList.do_delete( uid ); + }); $('td.password>img').live('click',function(event){ @@ -222,4 +285,19 @@ $(document).ready(function(){ } ); }); + // Handle undo notifications + $('#notification').hide(); + $('#notification').click(function(){ + if($('#notification').data('deleteuser')) + { + $( 'tr' ).filterAttr( 'data-uid', UserList.deleteUid ).show(); + UserList.deleteCanceled=true; + UserList.deleteFiles=null; + } + $('#notification').fadeOut(); + }); + UserList.useUndo=('onbeforeunload' in window) + $(window).bind('beforeunload', function (){ + UserList.finishDelete(null); + }); }); diff --git a/settings/templates/users.php b/settings/templates/users.php index c042f2664e..5511242456 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -52,6 +52,8 @@ foreach($_["groups"] as $group) { +
+ From b2eac08ad3a279ab81c508929c68d947bedbc9da Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jul 2012 16:54:00 +0200 Subject: [PATCH 3/5] Query contacts in batches of 20. Possible fix for oc-1126. --- apps/contacts/export.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/contacts/export.php b/apps/contacts/export.php index f84a10c138..ba7b06e40d 100644 --- a/apps/contacts/export.php +++ b/apps/contacts/export.php @@ -14,12 +14,16 @@ $contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL; $nl = "\n"; if(isset($bookid)){ $addressbook = OC_Contacts_App::getAddressbook($bookid); - $cardobjects = OC_Contacts_VCard::all($bookid); + //$cardobjects = OC_Contacts_VCard::all($bookid); header('Content-Type: text/directory'); header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf'); - foreach($cardobjects as $card) { - echo $card['carddata'] . $nl; + $start = 0; + while($cardobjects = OC_Contacts_VCard::all($bookid, $start, 20)){ + foreach($cardobjects as $card) { + echo $card['carddata'] . $nl; + } + $start += 20; } }elseif(isset($contactid)){ $data = OC_Contacts_App::getContactObject($contactid); From 5d61b85a1dace6ebb41025deaad019af8b3e5145 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 4 Jul 2012 17:16:02 +0200 Subject: [PATCH 4/5] allow users to upload ssl root certificates for the webdav client --- .../ajax/addRootCertificate.php | 12 +++++++++ .../ajax/removeRootCertificate.php | 9 +++++++ apps/files_external/js/settings.js | 10 +++++--- apps/files_external/lib/config.php | 15 +++++++++++ apps/files_external/personal.php | 1 + apps/files_external/templates/settings.php | 25 +++++++++++++++++-- 6 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 apps/files_external/ajax/addRootCertificate.php create mode 100644 apps/files_external/ajax/removeRootCertificate.php diff --git a/apps/files_external/ajax/addRootCertificate.php b/apps/files_external/ajax/addRootCertificate.php new file mode 100644 index 0000000000..33cd64d2c7 --- /dev/null +++ b/apps/files_external/ajax/addRootCertificate.php @@ -0,0 +1,12 @@ +getAbsolutePath("").$_FILES['rootcert_import']['name']; +move_uploaded_file($from, $to); + +header("Location: settings/personal.php"); +exit; +?> \ No newline at end of file diff --git a/apps/files_external/ajax/removeRootCertificate.php b/apps/files_external/ajax/removeRootCertificate.php new file mode 100644 index 0000000000..05f2fdef2d --- /dev/null +++ b/apps/files_external/ajax/removeRootCertificate.php @@ -0,0 +1,9 @@ +getAbsolutePath("").$cert; +unlink($file); +?> \ No newline at end of file diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 1c366a79c7..0d942e7845 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -1,4 +1,4 @@ -OC.MountConfig={ +OC.MountConfig={ saveStorage:function(tr) { var mountPoint = $(tr).find('.mountPoint input').val(); if (mountPoint == '') { @@ -68,7 +68,6 @@ OC.MountConfig={ } $(document).ready(function() { - $('.chzn-select').chosen(); $('#selectBackend').live('change', function() { @@ -116,8 +115,11 @@ $(document).ready(function() { $('td.remove>img').live('click', function() { var tr = $(this).parent().parent(); var mountPoint = $(tr).find('.mountPoint input').val(); - if (mountPoint == '') { - return false; + if (!mountPoint) { + var row=this.parentNode.parentNode; + $.post(OC.filePath('files_external', 'ajax', 'removeRootCertificate.php'), { cert: row.id }); + $(tr).remove(); + return true; } if ($('#externalStorage').data('admin') === true) { var isPersonal = false; diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 95f8beeb49..4e82e6b254 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -237,6 +237,21 @@ class OC_Mount_Config { $content .= ");\n?>"; @file_put_contents($file, $content); } + + /** + * Returns all user uploaded ssl root certificates + * @return array + */ + public static function getCertificates() { + $view = \OCP\Files::getStorage('files_external'); + $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath(""); + $result = array(); + $handle = opendir($path); + while (false !== ($file = readdir($handle))) { + if($file != '.' && $file != '..') $result[] = $file; + } + return $result; + } } diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index b758e7e7eb..dec501741b 100755 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -28,6 +28,7 @@ unset($backends['OC_Filestorage_Local']); $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', false, false); $tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints()); +$tmpl->assign('certs', OC_Mount_Config::getCertificates()); $tmpl->assign('backends', $backends); return $tmpl->fetchPage(); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index e651c4574d..be86033d20 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,4 +1,4 @@ -
+
t('External Storage'); ?>
'> @@ -79,6 +79,27 @@
+
+ + '> + + + + + + + + + + + + + + +
t('SSL root certificates'); ?> 
><?php echo $l->t('Delete'); ?>
+ + +
/> @@ -86,4 +107,4 @@ t('Allow users to mount their own external storage'); ?> - \ No newline at end of file + From e258da5c3c81a256c21e7423085089a7bd6a898d Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 4 Jul 2012 17:22:04 +0200 Subject: [PATCH 5/5] certificate should be only visible for users --- apps/files_external/templates/settings.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index be86033d20..dccc0913f2 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -81,6 +81,7 @@
+ '> @@ -99,6 +100,7 @@
+