From 19186bf37b131c76146b27f15c337c49e54d42cd Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Mon, 9 Jan 2012 17:22:51 +0000 Subject: [PATCH] hide save button for read-only files --- apps/files_texteditor/js/editor.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js index 3c1e1542806..664dd0f1e6e 100644 --- a/apps/files_texteditor/js/editor.js +++ b/apps/files_texteditor/js/editor.js @@ -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 = ''; + var savebtnhtml; + if(writeperms=="true"){ + var savebtnhtml = ''; + } var html = ''; $('#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); -- 2.39.5