Merge pull request #1787 from maelzx/patch-1

Update apps/files_versions/js/versions.js
This commit is contained in:
Frank Karlitschek 2013-02-20 08:32:36 -08:00
commit 57fbfaf86a
1 changed files with 9 additions and 1 deletions

View File

@ -41,6 +41,10 @@ $(document).ready(function(){
} }
}); });
function goToVersionPage(url){
window.location(url);
}
function createVersionsDropdown(filename, files) { function createVersionsDropdown(filename, files) {
var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename ); var historyUrl = OC.linkTo('files_versions', 'history.php') + '?path='+encodeURIComponent( $( '#dir' ).val() ).replace( /%2F/g, '/' )+'/'+encodeURIComponent( filename );
@ -51,7 +55,7 @@ function createVersionsDropdown(filename, files) {
html += '<option value=""></option>'; html += '<option value=""></option>';
html += '</select>'; html += '</select>';
html += '</div>'; html += '</div>';
html += '<input type="button" value="All versions..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />'; html += '<input type="button" value="All versions..." name="makelink" id="makelink" />';
html += '<input id="link" style="display:none; width:90%;" />'; html += '<input id="link" style="display:none; width:90%;" />';
if (filename) { if (filename) {
@ -61,6 +65,10 @@ function createVersionsDropdown(filename, files) {
$(html).appendTo($('thead .share')); $(html).appendTo($('thead .share'));
} }
$("#makelink").click(function() {
goToVersionPage(historyUrl);
});
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: OC.filePath('files_versions', 'ajax', 'getVersions.php'), url: OC.filePath('files_versions', 'ajax', 'getVersions.php'),