From 25d474579acd4ead174a83b22f1a3d712e6b682a Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 22 Aug 2012 11:45:36 -0400 Subject: [PATCH] Removing most of files_sharing, the Share API implemented the majority of it --- apps/files_sharing/ajax/email.php | 18 - apps/files_sharing/ajax/getitem.php | 71 --- apps/files_sharing/ajax/getstatuses.php | 22 - apps/files_sharing/ajax/setpermissions.php | 12 - apps/files_sharing/ajax/share.php | 37 -- apps/files_sharing/ajax/toggleresharing.php | 9 - apps/files_sharing/ajax/unshare.php | 11 - apps/files_sharing/ajax/userautocomplete.php | 30 - apps/files_sharing/appinfo/app.php | 22 +- apps/files_sharing/js/list.js | 54 -- apps/files_sharing/js/settings.js | 9 - apps/files_sharing/js/share.js | 375 ------------- .../files_sharing/{ => lib}/sharedstorage.php | 0 apps/files_sharing/lib_share.php | 518 ------------------ apps/files_sharing/list.php | 35 -- apps/files_sharing/settings.php | 9 - apps/files_sharing/templates/list.php | 30 - apps/files_sharing/templates/settings.php | 6 - 18 files changed, 1 insertion(+), 1267 deletions(-) delete mode 100644 apps/files_sharing/ajax/email.php delete mode 100644 apps/files_sharing/ajax/getitem.php delete mode 100644 apps/files_sharing/ajax/getstatuses.php delete mode 100644 apps/files_sharing/ajax/setpermissions.php delete mode 100644 apps/files_sharing/ajax/share.php delete mode 100644 apps/files_sharing/ajax/toggleresharing.php delete mode 100644 apps/files_sharing/ajax/unshare.php delete mode 100644 apps/files_sharing/ajax/userautocomplete.php delete mode 100644 apps/files_sharing/js/list.js delete mode 100644 apps/files_sharing/js/settings.js delete mode 100644 apps/files_sharing/js/share.js rename apps/files_sharing/{ => lib}/sharedstorage.php (100%) delete mode 100644 apps/files_sharing/lib_share.php delete mode 100644 apps/files_sharing/list.php delete mode 100644 apps/files_sharing/settings.php delete mode 100644 apps/files_sharing/templates/list.php delete mode 100644 apps/files_sharing/templates/settings.php diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php deleted file mode 100644 index aba4f699fa..0000000000 --- a/apps/files_sharing/ajax/email.php +++ /dev/null @@ -1,18 +0,0 @@ - array('message' => $exception->getMessage()))); -} diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php deleted file mode 100644 index 06a80102de..0000000000 --- a/apps/files_sharing/ajax/getitem.php +++ /dev/null @@ -1,71 +0,0 @@ - $gid, 'permissions' => $rows[$i]['permissions'], 'users' => OC_Group::usersInGroup($gid), 'parentFolder' => false)); - } else { - $group = array(array('gid' => $gid, 'permissions' => $rows[$i]['permissions'], 'users' => OC_Group::usersInGroup($gid), 'parentFolder' => basename($path))); - } - if (!isset($item['groups'])) { - $item['groups'] = $group; - } else if (is_array($item['groups'])) { - $gidExists = false; - $currentGroups = $item['groups']; - // Check if the group is already included - foreach ($currentGroups as $g) { - if ($g['gid'] == $gid) { - $gidExists = true; - } - } - if (!$gidExists) { - $item['groups'] = array_merge($item['groups'], $group); - } - } - } else { - if ($path == $source) { - $user = array(array('uid' => $uid_shared_with, 'permissions' => $rows[$i]['permissions'], 'parentFolder' => false)); - } else { - $user = array(array('uid' => $uid_shared_with, 'permissions' => $rows[$i]['permissions'], 'parentFolder' => basename($path))); - } - if (!isset($item['users'])) { - $item['users'] = $user; - } else if (is_array($item['users'])) { - $item['users'] = array_merge($item['users'], $user); - } - } - } - } - } - $path = dirname($path); -} - -OCP\JSON::success(array('data' => $item)); diff --git a/apps/files_sharing/ajax/getstatuses.php b/apps/files_sharing/ajax/getstatuses.php deleted file mode 100644 index 1be4d9a0d9..0000000000 --- a/apps/files_sharing/ajax/getstatuses.php +++ /dev/null @@ -1,22 +0,0 @@ - $items)); diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php deleted file mode 100644 index 0a2cf78f76..0000000000 --- a/apps/files_sharing/ajax/setpermissions.php +++ /dev/null @@ -1,12 +0,0 @@ - $shared->getToken())); - } else { - OCP\JSON::success(); - } - } catch (Exception $exception) { - OCP\Util::writeLog('files_sharing', 'Unexpected Error : '.$exception->getMessage(), OCP\Util::ERROR); - OCP\JSON::error(array('data' => array('message' => $exception->getMessage()))); - } - } else { - if ($file['encrypted'] == true) { - OCP\JSON::error(array('data' => array('message' => 'Encrypted files cannot be shared'))); - } else { - OCP\Util::writeLog('files_sharing', 'File does not exist or is not readable :'.$source, OCP\Util::ERROR); - OCP\JSON::error(array('data' => array('message' => 'File does not exist or is not readable'))); - } - } -} diff --git a/apps/files_sharing/ajax/toggleresharing.php b/apps/files_sharing/ajax/toggleresharing.php deleted file mode 100644 index 7da4fdfeea..0000000000 --- a/apps/files_sharing/ajax/toggleresharing.php +++ /dev/null @@ -1,9 +0,0 @@ -"; -$groups[] = ""; -foreach ($userGroups as $group) { - $groupUsers = OC_Group::usersInGroup($group); - $userCount = 0; - foreach ($groupUsers as $user) { - if ($user != $self) { - $users[] = ""; - $userCount++; - } - } - // Don't include the group if only the current user is a member of it - if ($userCount > 0) { - $groups[] = ""; - } -} -$users = array_unique($users); -$users[] = ""; -$groups[] = ""; -$users = array_merge($users, $groups); -OCP\JSON::encodedPrint($users); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 7495a5bbe6..fcebacc19d 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -1,28 +1,8 @@ "; -// html+=""+path+""; -// var expire=($('#expire').val())?$('#expire').val():'Never' -// html+=""+expire+"" -// html+=""+$('#baseUrl').val()+"?token="+token+"" -// html+="" -// html+="" -// $(html).insertBefore($('#newlink_row')); -// $('#expire').val(''); -// $('#expire_time').val(''); -// $('#path').val(''); -// } -// } - }); - }); -}); \ No newline at end of file diff --git a/apps/files_sharing/js/settings.js b/apps/files_sharing/js/settings.js deleted file mode 100644 index bb7d79fecb..0000000000 --- a/apps/files_sharing/js/settings.js +++ /dev/null @@ -1,9 +0,0 @@ -$(document).ready(function() { - $('#allowResharing').bind('change', function() { - var checked = 1; - if (!this.checked) { - checked = 0; - } - $.post(OC.filePath('files_sharing','ajax','toggleresharing.php'), 'resharing='+checked); - }); -}); \ No newline at end of file diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js deleted file mode 100644 index 3cfa3583b1..0000000000 --- a/apps/files_sharing/js/share.js +++ /dev/null @@ -1,375 +0,0 @@ -OC.Share={ - icons:[], - itemUsers:[], - itemGroups:[], - itemPrivateLink:false, - usersAndGroups:[], - loadIcons:function() { - // Cache all icons for shared files - $.getJSON(OC.filePath('files_sharing', 'ajax', 'getstatuses.php'), function(result) { - if (result && result.status === 'success') { - $.each(result.data, function(item, hasPrivateLink) { - if (hasPrivateLink) { - OC.Share.icons[item] = OC.imagePath('core', 'actions/public'); - } else { - OC.Share.icons[item] = OC.imagePath('core', 'actions/shared'); - } - }); - } - }); - }, - loadItem:function(item) { - $.ajax({type: 'GET', url: OC.filePath('files_sharing', 'ajax', 'getitem.php'), data: { item: item }, async: false, success: function(result) { - if (result && result.status === 'success') { - var item = result.data; - OC.Share.itemUsers = item.users; - OC.Share.itemGroups = item.groups; - OC.Share.itemPrivateLink = item.privateLink; - } - }}); - }, - share:function(source, uid_shared_with, permissions, callback) { - $.post(OC.filePath('files_sharing', 'ajax', 'share.php'), { sources: source, uid_shared_with: uid_shared_with, permissions: permissions }, function(result) { - if (result && result.status === 'success') { - if (callback) { - callback(result.data); - } - } else { - OC.dialogs.alert(result.data.message, 'Error while sharing'); - } - }); - }, - unshare:function(source, uid_shared_with, callback) { - $.post(OC.filePath('files_sharing', 'ajax', 'unshare.php'), { source: source, uid_shared_with: uid_shared_with }, function(result) { - if (result && result.status === 'success') { - if (callback) { - callback(); - } - } else { - OC.dialogs.alert('Error', 'Error while unsharing'); - } - }); - }, - changePermissions:function(source, uid_shared_with, permissions) { - $.post(OC.filePath('files_sharing','ajax','setpermissions.php'), { source: source, uid_shared_with: uid_shared_with, permissions: permissions }, function(result) { - if (!result || result.status !== 'success') { - OC.dialogs.alert('Error', 'Error while changing permissions'); - } - }); - }, - showDropDown:function(item, appendTo) { - OC.Share.loadItem(item); - var html = '