source: sandbox/expresso-solr/solr/example/work/jetty-0.0.0.0-8983-solr.war-_solr-any-/webapp/js/scripts/file.js @ 7588

Revision 7588, 1.8 KB checked in by adir, 11 years ago (diff)

Ticket #000 - Adicionando a integracao de buscas com Solr na base a ser isnerida na comunidade

Line 
1/*
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements.  See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License.  You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16*/
17
18// #/:core/schema, #/:core/config
19sammy.get
20(
21  /^#\/([\w\d-]+)\/(schema|config)$/,
22  function( context )
23  {
24    var core_basepath = this.active_core.attr( 'data-basepath' );
25        var filetype = context.params.splat[1]; // either schema or config     
26        var filename = this.active_core.attr( filetype );
27
28    $.ajax
29    (
30      {
31        url : core_basepath + "/admin/file?file=" + filename + "&contentType=text/xml;charset=utf-8",
32        dataType : 'xml',
33        context : $( '#content' ),
34        beforeSend : function( xhr, settings )
35        {
36          this
37          .html( '<div class="loader">Loading ...</div>' );
38        },
39        complete : function( xhr, text_status )
40        {
41          var code = $(
42            '<pre class="syntax language-xml"><code>' +
43            xhr.responseText.esc() +
44            '</code></pre>'
45          );
46          this.html( code );
47
48          if( 'success' === text_status )
49          {
50            hljs.highlightBlock( code.get(0) );
51          }
52        }
53      }
54    );
55  }
56);
Note: See TracBrowser for help on using the repository browser.