$(document).ready(function(){
if (typeof FileActions !== 'undefined') {
// Add history button to files/index.php
- FileActions.register('file','History', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history');},function(filename){
-
- if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
-
- var file = $('#dir').val()+'/'+filename;
- // Check if drop down is already visible for a different file
- if (($('#dropdown').length > 0)) {
- if (file != $('#dropdown').data('file')) {
- $('#dropdown').hide('blind', function() {
- $('#dropdown').remove();
- $('tr').removeClass('mouseOver');
- createVersionsDropdown(filename, file);
- });
+ FileActions.register(
+ 'file'
+ ,'History'
+ , OC.PERMISSION_UPDATE
+ , function() {
+ // Specify icon for hitory button
+ return OC.imagePath('core','actions/history');
+ }
+ ,function(filename){
+ // Action to perform when clicked
+ if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
+
+ var file = $('#dir').val()+'/'+filename;
+ // Check if drop down is already visible for a different file
+ if (($('#dropdown').length > 0)) {
+ if (file != $('#dropdown').data('file')) {
+ $('#dropdown').hide('blind', function() {
+ $('#dropdown').remove();
+ $('tr').removeClass('mouseOver');
+ createVersionsDropdown(filename, file);
+ });
+ }
+ } else {
+ createVersionsDropdown(filename, file);
}
- } else {
- createVersionsDropdown(filename, file);
}
- });
+ );
}
});
html += '<option value=""></option>';
html += '</select>';
html += '</div>';
- //html += '<input type="button" value="Revert file" onclick="revertFile()" />';
html += '<input type="button" value="All versions..." onclick="window.location=\''+historyUrl+'\'" name="makelink" id="makelink" />';
html += '<input id="link" style="display:none; width:90%;" />';
data: { source: files },
async: false,
success: function( versions ) {
-
- //alert("helo "+OC.linkTo('files_versions', 'ajax/getVersions.php'));
-
+
if (versions) {
$.each( versions, function(index, row ) {
addVersion( row );
}
- function addVersion(revision ) {
+ function addVersion( revision ) {
name=formatDate(revision.version*1000);
var version=$('<option/>');
version.attr('value',revision.version);
version.appendTo('#found_versions');
}
-
+
+ $('tr').filterAttr('data-file',filename).addClass('mouseOver');
$('#dropdown').show('blind');
}
+
+$(this).click(
+ function(event) {
+
+ if ($('#dropdown').has(event.target).length === 0) {
+ $('#dropdown').hide('blind', function() {
+ $('#dropdown').remove();
+ $('tr').removeClass('mouseOver');
+ });
+ }
+
+
+ }
+);
\ No newline at end of file