From e15e394fccf5dc0be8df9f6f2619214ca2326f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= <schiessle@owncloud.com>
Date: Mon, 10 Jun 2013 12:57:18 +0200
Subject: [PATCH] add ajax call to decrypt all files

Conflicts:
	apps/files_encryption/lib/crypt.php
---
 apps/files_encryption/lib/crypt.php |  4 ++++
 settings/js/personal.js             | 13 +++++++++++++
 settings/personal.php               |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 6543a0de5f..d8d1902909 100755
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -662,5 +662,9 @@ class Crypt {
 			return rtrim($result, "\0");
 		}
 	}
+	
+	public static function decryptAll() {
+		error_log("decrypt all");
+	}
 
 }
\ No newline at end of file
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 099c1426dc..97342e7653 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -110,6 +110,19 @@ $(document).ready(function(){
 		});
 		return false;
 	});
+
+	$('button:button[name="submitDecryptAll"]').click(function() {
+		console.log("click!");
+		$.post('ajax/decryptall.php', {}, function(data) {
+			/*
+			if (data.status === "error") {
+				OC.msg.finishedSaving('#encryption .msg', data);
+			} else {
+				OC.msg.finishedSaving('#encryption .msg', data);
+			}*/
+		}
+		);
+	});
 } );
 
 OC.msg={
diff --git a/settings/personal.php b/settings/personal.php
index 4961661e25..79ce8e4576 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -89,7 +89,7 @@ $tmpl->assign('activelanguage', $userLang);
 $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
 $tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
 $tmpl->assign('displayName', OC_User::getDisplayName());
-$tmpl->assign('enableDecryptAll' , true);
+$tmpl->assign('enableDecryptAll' , $enableDecryptAll);
 
 $forms=OC_App::getForms('personal');
 $tmpl->assign('forms', array());
-- 
GitLab