From ad4b95a353317bde4f4284fc66dc4b8ed5863e05 Mon Sep 17 00:00:00 2001 From: Stefan Matheis Date: Fri, 6 Dec 2013 09:53:03 +0000 Subject: [PATCH] SOLR-5539: Admin UI - Remove ability to create/modify files git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1548477 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 2 + solr/webapp/web/css/styles/files.css | 114 -------------------- solr/webapp/web/js/scripts/files.js | 156 +-------------------------- solr/webapp/web/tpl/files.html | 51 --------- 4 files changed, 4 insertions(+), 319 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index f5effc0c60b..7db6b5587ee 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -229,6 +229,8 @@ Other Changes * SOLR-5502: Added a test for tri-level compositeId routing with documents having a "/" in a document id. (Anshum Gupta via Mark Miller) +* SOLR-5539: Admin UI - Remove ability to create/modify files (steffkes) + ================== 4.6.0 ================== Versions of Major Components diff --git a/solr/webapp/web/css/styles/files.css b/solr/webapp/web/css/styles/files.css index 74e14bdfc8d..ba5991b8298 100644 --- a/solr/webapp/web/css/styles/files.css +++ b/solr/webapp/web/css/styles/files.css @@ -23,54 +23,11 @@ limitations under the License. width: 20%; } -#content #files #new-file-holder -{ - margin-top: 20px; - padding-bottom: 10px; -} - -#content #files #new-file-holder button span -{ - background-image: url( ../../img/ico/plus-button.png ); -} - -#content #files #new-file-holder form -{ - box-shadow: 5px 5px 10px #c0c0c0; - -moz-box-shadow: 5px 5px 10px #c0c0c0; - -webkit-box-shadow: 5px 5px 10px #c0c0c0; - display: none; - padding: 10px; -} - -#content #files #new-file-holder form input -{ - margin-bottom: 3px; - width: 98%; -} - -#content #files #new-file-holder .note -{ - color: #c0c0c0; - margin-bottom: 5px; -} - #content #files form .buttons button { float: right; } -#content #files .modify-file, -#content #files .modify-file .view-file -{ - display: none; -} - -#content #files .modify-file .modify-file -{ - display: block; -} - #content #files #file-content { display: none; @@ -80,84 +37,13 @@ limitations under the License. min-height: 100px } -#content #files .top #url -{ - float: left; - width: 80%; -} - -#content #files .top .buttons -{ - float: right; - width: 15%; -} - -#content #files .top .buttons button -{ - float: right; -} - -#content #files .top .buttons button.view-file span -{ - background-image: url( ../../img/ico/pencil.png ); -} - -#content #files .top .buttons button.modify-file span -{ - background-image: url( ../../img/ico/document-text.png ); -} - #content #files .show #file-content { display: block; } -#content #files #new-file-note -{ - background-color: #ffa662; - background-image: url( ../../img/ico/exclamation-button.png ); - background-position: 10px 50%; - display: none; - margin-bottom: 10px; - padding: 10px; - padding-left: 31px; -} - #content #files #file-content .response { border: 1px solid transparent; padding: 2px; -} - -#content #files #file-content textarea -{ - display: block; - font-family: monospace; - height: 500px; - margin-bottom: 10px; - width: 99%; -} - -#content #files #file-content form button span -{ - background-image: url( ../../img/ico/disk-black.png ); -} - -#content #files #file-content form.upload -{ - border-top: 1px solid #c0c0c0; - margin-top: 20px; - padding-top: 20px; - padding-bottom: 20px; -} - -#content #files #file-content .upload input -{ - border: 0; - float: left; -} - -#content #files #file-content .upload button span -{ - background-image: url( ../../img/ico/drive-upload.png ); } \ No newline at end of file diff --git a/solr/webapp/web/js/scripts/files.js b/solr/webapp/web/js/scripts/files.js index 401bb0484a1..5d939b8b90e 100644 --- a/solr/webapp/web/js/scripts/files.js +++ b/solr/webapp/web/js/scripts/files.js @@ -27,7 +27,6 @@ sammy.get var content_element = $( '#content' ); var file_endpoint = core_basepath + '/admin/file'; - var file_exists = null; var path = context.path.split( '?' ); var selected_file = null; @@ -144,34 +143,6 @@ sammy.get }; load_tree(); - var new_file_form = $( '#new-file-holder form' ); - - $( '#new-file-holder > button' ) - .on - ( - 'click', - function( event ) - { - new_file_form.toggle(); - return false; - } - ); - - new_file_form - .on - ( - 'submit', - function( event ) - { - $( 'body' ) - .animate( { scrollTop: 0 }, 500 ); - - window.location.href = '#/' + current_core + '/files?file=' + $( 'input', this ).val(); - - return false; - } - ); - if( selected_file ) { $( '#new-file-holder input' ) @@ -200,57 +171,6 @@ sammy.get .text( public_url ) .attr( 'href', public_url ); - var form = $( 'form.modify', frame_element ); - - form - .attr( 'action', file_endpoint + '?wt=json&op=write&file=' + selected_file ) - .ajaxForm - ( - { - context : form, - beforeSubmit: function( arr, form, options ) - { - $( 'button span', form ) - .addClass( 'loader' ); - }, - success : function( response, status, xhr ) - { - $( 'button span', this ) - .removeClass( 'loader' ); - - var button = $( 'button', this ); - - button - .addClass( 'success' ); - - load_file( !file_exists ); - - window.setTimeout - ( - function() - { - button - .removeClass( 'success' ); - }, - 1000 - ); - } - } - ); - - var change_button_label = function( form, label ) - { - $( 'span[data-' + label + ']', form ) - .each - ( - function( index, element ) - { - var self = $( this ); - self.text( self.data( label ) ); - } - ); - } - var load_file = function( load_tree ) { if( load_tree ) @@ -277,8 +197,6 @@ sammy.get }, success : function( response, text_status, xhr ) { - change_button_label( this, 'existing-title' ); - var content_type = xhr.getResponseHeader( 'Content-Type' ) || ''; var highlight = null; @@ -310,86 +228,16 @@ sammy.get }, error : function( xhr, text_status, error_thrown) { - change_button_label( this, 'new-title' ); + $( '.view-file .response', this ) + .text( 'No such file exists.' ); }, complete : function( xhr, text_status ) { - file_exists = 200 === xhr.status; - $( '#new-file-note' ) - .toggle( !file_exists ); } } ); } load_file(); - - $( '.top button', frame_element ) - .on - ( - 'click', - function( event ) - { - $( '#file-content', frame_element ) - .toggleClass( 'modify-file' ); - - return false; - } - ); - - $( 'form.upload', frame_element ) - .on - ( - 'submit', - function( event ) - { - $( 'form input', frame_element ) - .ajaxfileupload - ( - { - action: endpoint + '&op=write&wt=json', - validate_extensions: false, - upload_now: true, - onStart: function () - { - $( 'form.upload button span', frame_element ) - .addClass( 'loader' ); - }, - onCancel: function () - { - $( 'form.upload button span', frame_element ) - .removeClass( 'loader' ); - }, - onComplete: function( response ) - { - $( 'form.upload button span', frame_element ) - .removeClass( 'loader' ); - - var button = $( 'form.upload button', frame_element ); - - button - .addClass( 'success' ); - - load_file( !file_exists ); - - $( 'body' ) - .animate( { scrollTop: 0 }, 500 ); - - window.setTimeout - ( - function() - { - button - .removeClass( 'success' ); - }, - 1000 - ); - } - } - ); - - return false; - } - ); } } ); diff --git a/solr/webapp/web/tpl/files.html b/solr/webapp/web/tpl/files.html index 93ffca897ca..0a27f24a95e 100644 --- a/solr/webapp/web/tpl/files.html +++ b/solr/webapp/web/tpl/files.html @@ -22,24 +22,6 @@ limitations under the License.
#tree
-
- - - -
- -

Enter filename, on the next page you can input content or upload a file.

- - - -
- -
- -
- -
-
@@ -47,13 +29,6 @@ limitations under the License. -
- - - - -
-
@@ -62,32 +37,6 @@ limitations under the License.
-
- -

The requested file does (not yet) exist. Save file or Upload new file will create it.

- -
- - - -
- -
- -
- -
- - - -
- -
- -
- -
-