diff options
author | Sam Tuke <sam@donttravelempty.com> | 2012-04-26 18:45:17 +0100 |
---|---|---|
committer | Sam Tuke <sam@donttravelempty.com> | 2012-04-26 18:45:17 +0100 |
commit | 18a024e251cbcdaafb0ef2893cd5cf8544b03f4d (patch) | |
tree | 9633209305aec012458c1a60e372b39f5e1230d8 /apps/files_versions/js | |
parent | c693ee2adb1b8b251d7905791eeca0946c31c68b (diff) | |
download | nextcloud-server-18a024e251cbcdaafb0ef2893cd5cf8544b03f4d.tar.gz nextcloud-server-18a024e251cbcdaafb0ef2893cd5cf8544b03f4d.zip |
started implementing ajax file rollback
Diffstat (limited to 'apps/files_versions/js')
-rw-r--r-- | apps/files_versions/js/versions.js | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/files_versions/js/versions.js b/apps/files_versions/js/versions.js index 5018b75f154..a9e60a0cfa6 100644 --- a/apps/files_versions/js/versions.js +++ b/apps/files_versions/js/versions.js @@ -17,17 +17,7 @@ $(document).ready(function(){ async: false, success: function(versions) { if (versions) { - - // icon = OC.imagePath('core', 'actions/shared'); - // $.each(users, function(index, row) { - // if (row.uid_shared_with == 'public') { - // icon = OC.imagePath('core', 'actions/public'); - // } - // }); - // } else { - // icon = OC.imagePath('core', 'actions/share'); } - shared_status[file]= { timestamp: new Date().getTime(), icon: icon }; } }); @@ -37,15 +27,15 @@ $(document).ready(function(){ function createVersionsDropdown(filename, files) { var historyUrl = '../apps/files_versions/history.php?path='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename); - //alert( historyUrl ); + var html = '<div id="dropdown" class="drop" data-file="'+files+'">'; html += '<div id="private">'; html += '<select data-placeholder="File Version" id="found_versions" class="chzen-select">'; html += '<option value="">Select version</option>'; html += '</select>'; html += '</div>'; - html += '<input type="button" name="makelink" id="makelink" value="Revert file" />'; - html += '<input type="button" onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" value="More..." />'; + html += '<input type="button" value="Revert file" onclick="revertFile()" />'; + html += '<input type="button" value="More..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />'; html += '<br />'; html += '<input id="link" style="display:none; width:90%;" />'; @@ -76,6 +66,22 @@ function createVersionsDropdown(filename, files) { }); + function revertFile() { + + $.ajax({ + type: 'GET', + url: OC.linkTo('files_versions', 'ajax/rollbackVersion.php'), + dataType: 'json', + data: {path: file, revision: 'revision'}, + async: false, + success: function(versions) { + if (versions) { + } + } + }); + + } + function addVersion( name ) { var version = '<option>'+name+'</option>'; |