]> source.dussan.org Git - nextcloud-server.git/commitdiff
hide save button for read-only files
authorTom Needham <needham.thomas@gmail.com>
Mon, 9 Jan 2012 17:22:51 +0000 (17:22 +0000)
committerTom Needham <needham.thomas@gmail.com>
Mon, 9 Jan 2012 17:22:51 +0000 (17:22 +0000)
apps/files_texteditor/js/editor.js

index 3c1e1542806b144e8bf2b303e799a3173a71f4cb..664dd0f1e6e1dbbcc682aa74254fec55cc134782 100644 (file)
@@ -54,11 +54,14 @@ function setSyntaxMode(ext){
        }       
 }
 
-function showControls(filename){
+function showControls(filename,writeperms){
        // Loads the control bar at the top.
        $('.actions,#file_action_panel').fadeOut('slow').promise().done(function() {
                // Load the new toolbar.
-               var savebtnhtml = '<input type="button" id="editor_save" value="'+t('files_texteditor','Save')+'">';
+               var savebtnhtml;
+               if(writeperms=="true"){
+                       var savebtnhtml = '<input type="button" id="editor_save" value="'+t('files_texteditor','Save')+'">';
+               }
                var html = '<input type="button" id="editor_close" value="Close">';
                $('#controls').append(html);
                $('#editorbar').fadeIn('slow'); 
@@ -134,7 +137,7 @@ function showFileEditor(dir,filename){
                                                // Save mtime
                                                $('#editor').attr('data-mtime', result.data.mtime);
                                                // Initialise the editor
-                                               showControls(filename);
+                                               showControls(filename,result.data.write);
                                                $('table').fadeOut('slow', function() {
                                                        $('#editor').text(result.data.filecontents);
                                                        $('#editor').attr('data-dir', dir);