Author: mykee
Date: Sun Aug 29 18:10:56 2010
New Revision: 990613

URL: http://svn.apache.org/viewvc?rev=990613&view=rev
Log:
SLING-1671 New features for jQuery JCR Explorer - step 1

Added:
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/jquery-ui.min.js
   (with props)
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/ui.datetimebox.js
   (with props)
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit/
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit/sling_redirect.esp
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp
Modified:
    sling/trunk/contrib/explorers/jquery/pom.xml
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
    
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp

Modified: sling/trunk/contrib/explorers/jquery/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/pom.xml?rev=990613&r1=990612&r2=990613&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/pom.xml (original)
+++ sling/trunk/contrib/explorers/jquery/pom.xml Sun Aug 29 18:10:56 2010
@@ -27,7 +27,7 @@
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.extensions.explorer.jquery
     </artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.0.2-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Resource Explorer using jQuery</name>
@@ -43,7 +43,7 @@
 
     <build>
         <plugins>
-            <plugin>
+                    <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-scr-plugin</artifactId>
             </plugin>
@@ -53,15 +53,10 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Sling-Bundle-Resources>
-                            /libs/sling/explorer,
-                            /libs/sling/servlet/default/explorer
-                            <!-- 
-                            /libs/sling/servlet/default/explorer_item.esp,
-                            
/libs/sling/servlet/default/explorer_properties.esp,
-                            /libs/sling/servlet/default/explorer.esp
-                            -->
-                        </Sling-Bundle-Resources>
+                                               <Sling-Bundle-Resources>
+                                                       /libs/sling/explorer,
+                                                       
/libs/sling/servlet/default/explorer
+                                               </Sling-Bundle-Resources>
                     </instructions>
                 </configuration>
             </plugin>

Modified: 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css?rev=990613&r1=990612&r2=990613&view=diff
==============================================================================
--- 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
 (original)
+++ 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
 Sun Aug 29 18:10:56 2010
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -15,104 +16,675 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
+ 
+ 
+
+/* ################################################################# */
+/* --- Main-Seperator ---  */
+/* ################################################################# */
+       
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Sub-Seperator  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+ 
  */
  
-html, body {
+*
+{
        margin: 0;
        padding: 0;
+       border: none;
 }
-body {
-       padding-bottom: 20px;
+
+html, body 
+{
+}
+
+html /* shows always scrollbar in Firefox*/
+{
+       overflow-y: scroll;
+}      
+       
+body
+{
+       font-size: 13px;
+       color: #545D66;
+       margin: 0;
+       padding: 0 0 20px 0;
        text-align: center;
-       font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Titles ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+h1, h2, h3, h4, h5, h6
+{
+       font-family: Arial, Helvetica, sans-serif;
+       color: #485573;
+       margin: 0 0 20px 0;
+       padding: 0px;
+}
+       
+h1
+{
+       font-size: 22px;
+       line-height: /**/;
+}
+
+h2
+{
+       font-size: 18px;
+       line-height: /**/;
+}
+
+h3
+{
+       font-size: 16px;
+       line-height: /**/;
+}
+
+h4, h5, h6
+{
+       font-size: 13px;
+       line-height: /**/;
+}
+
+b, strong, b *, strong *
+{
+       font-weight: bold;
+}
+
+i, em, i *, em *
+{
+       font-style: italic;
+}
+
+ul, ol
+{
+       margin: 10px 0 10px 35px;
+}
+
+ul
+{
+}
+
+ol
+{
+}
+
+li
+{
+       margin: 3px 0;
+}
+
+p
+{
+       line-height: 18px;
+       margin: 0 0 10px 0;
+}
+
+div.hr
+{
+       clear: both;
+       height: 1px;
+}
+
+hr
+{
+       height: 1px;
+       color: #333333;
+       background-color: inherit;
+}
+
+a, a:visited
+{
+       color: #527EA3;
+       text-decoration: underline;
+}
+
+a:hover
+{
+       color: #ABC8E2;
+       text-decoration: underline;
+}
+
+a:focus, input:focus, button:focus
+{
+       outline: none;
+}
+
+button, .button
+{
+       background-color: #eff4f9;
+       border: 1px solid #354F66;
+       padding: 2px 5px;
+       font-size: 10px;
+       color: #354F66;
+       font-weight: bold;
+       width: auto!important;
+}
+
+input.button
+{
+       padding: 1px 3px;
+}
+
+button:hover, .button:hover
+{
+       background-color: #BDD2E5;
+       border: 2px solid #354F66;
+       padding: 1px 4px;
+       cursor: pointer;
 }
-#expl_logo {
-        margin: 2px;
+
+input.button:hover
+{
+       padding: 0px 2px;
+}
+
+
+img, a img
+{
+       border: none;
 }
-#expl_container {
+
+/* <div class="clear"></div> or <br class="clear" /> in <p></p> */
+.clear
+{
+       clear:both;
+    height:0;
+    font-size: 1px;
+    line-height: 0px;
+       overflow: hidden;
+       white-space: nowrap;
+       margin: 0;
+       padding: 0;
+}
+
+/* ################################################################# */
+/* --- TABLE --- */
+/* ################################################################# */
+
+table
+{
+       font-size: inherit;
+       color: inherit;
+       border-collapse: collapse;
+       border-spacing: /**/;
+}
+       
+table caption, 
+table tr,
+table th, 
+table td
+{
+       text-align: left;
+       font-weight: normal;
+}
+
+table td
+{
+       padding: /**/;
+}
+
+               
+td.colLabel
+{
+       width: /**/;
+}
+
+td.colInput
+{
+       width: /**/;
+}
+
+td.colspan2
+{
+       width: /* FULL CONTENT WIDTH */;
+}
+
+/* ################################################################# */
+/* --- FORM --- */
+/* ################################################################# */
+
+form
+{
+}
+       
+fieldset
+{
+       border: none;
+       margin: 0;
+       padding: 0;
+}
+
+form fieldset p
+{
+       clear: both;
+       padding-bottom: 15px;
+}
+
+.required
+{
+       margin-left: /* width von label*/;
+}
+
+.submit
+{
+       margin: 0;
+}
+               
+label
+{
+       width: 200px;
+       float: left;
+       display: inline;
+}
+
+
+/* ################################################################# */
+/* --- INPUT / SELECT / TEXTAREA --- */
+/* ################################################################# */
+
+input, select, textarea
+{
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 13px;
+       color: #545D66;
+       background-color: #FFFFFF;
+       padding: 2px 4px;
+       line-height: 16px;
+       border: 1px solid #354F66;     
+       overflow: visible; /* Fix for IE */
+}
+
+input:focus, select:focus, textarea:focus
+{
+       border: 1px solid #527EA3;
+       background-color: #BDD2E5;
+}
+
+input[type=hidden], input.hidden
+{      
+       float: left;
+       display: inline;
+       border: none;
+       background-color: transparent;
+       height: 12px;
+       width: 12px;
+       padding: 0;
+       position: absolute;
+       top: -100px;
+}
+
+input.text
+{
+       display: inline;
+       width: 200px;
+}
+
+input.checkbox, input.radio
+{
+       float: none;
+       border: none;
+       background-color: transparent;
+       height: 12px;
+       width: 12px;
+       padding: 0;
+       position: absolute;
+}
+
+#newsletter input.checkbox
+{
+       position: relative;
+}
+
+input.radio
+{
+}
+
+input.checkbox 
+{
+}
+
+select
+{
+       display: inline;
+}
+
+textarea
+{
+       height: 100px;
+    width: 408px;
+}
+
+
+/* ################################################################# */
+/* --- Explorer --- */
+/* ################################################################# */
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Login Dialog  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#login-dialog
+{
+       background-color: #f6fbfe;
+       border-bottom: 2px solid #bdd2e5;
+}
+
+#menu_login
+{
+       text-align: center;
+}
+
+#show_login_dialog
+{
+       float: right;
+       display: block;
+       margin: -2px 12px 0 auto;
+       background: url(../img/login_bg.png);
+       background-repeat: no-repeat;
+       background-position: 0 -27px;
+       height: 19px;
+       width: 70px;
+       padding: 6px 10px 0 0;
+       font-size: 10px;
+       text-decoration: none;
+}
+
+#show_login_dialog.login_open
+{
+       background-position: 0 0;
+}
+
+form#login-form
+{
+       padding: 20px;
+}
+
+form#login-form fieldset label
+{
+       width: auto;
+       float: none;
+       display: inline;
+}
+
+form#login-form fieldset p
+{
+       padding-bottom: 0px;
+       margin: 0;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Logout Dialog  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#menu_logout
+{
+       float: right;
+       display: inline;
+       margin: 10px 20px;
+       font-size: 11px;
+       background-color: #f6fbfe;
+       border: 2px solid #bdd2e5;
+       -moz-border-radius: 5px;
+       border-radius: 5px;
+       padding: 5px 7px;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Query Dialog  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#query_container
+{
+       clear: both;
+       margin: 20px;
+       border: 2px solid #527EA3;
+       -moz-border-radius: 3px;
+       border-radius: 3px;
+       background-color: #F6FBFE;
+}
+
+#expl_search
+{
+       padding: 10px;
+       background-color: #F6FBFE;
+}
+
+#show_query_dialog
+{
+       background-color: transparent;
+       line-height: normal;
+       border: none;     
+       overflow: visible; /* Fix for IE */
+}
+
+button#show_query_dialog
+{
+       font-weight: normal;
+       text-decoration: underline;
+       width: 80px;
+       height: 25px;
+       margin: 0px 0px 0px 0px;
+       background: url(../img/query_bg.png);
+       background-repeat: no-repeat;
+       background-color: #F6FBFE;
+       background-position: 8px -24px;
+       height: 25px;
+       width: 100%;
+       display: block;
+       padding: 0px 0px 1px 18px;
+       font-size: 10px;
+       text-decoration: none;
+       text-align: left;
+}
+
+button#show_query_dialog.query_open
+{
+       background-position: 8px 1px;
+       border-bottom: 1px solid #BDD2E5;
+}
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Main Layout - Header / Logo / Content / Footer  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#expl_logo
+{
+       margin: 10px 20px;
+       float: left;
+       display: inline;
+}
+
+#expl_container
+{
        text-align: left;
        margin: 0 auto;
        width: auto;
 }
-#expl_header {
-       padding: 20px;
+
+#expl_header
+{
 }
-#expl_sidebar {
-       border: 1px solid #D0D0D0;
+
+#expl_content_container
+{
+       margin: 0 20px;
+}
+
+#expl_sidebar
+{
+       border: 2px solid #527EA3;
+       -moz-border-radius: 3px;
+       border-radius: 3px;
        width: 340px;
-       margin-left: 20px;
        float: left;
        display: inline;
-       font-size: 12px;
        padding-bottom: 20px;
        min-height: 600px;
+       background-color: #F6FBFE;
 }
-#expl_content {
-       margin-left: 382px;
-       margin-right: 20px;
-       border: 1px solid #D0D0D0;
+
+#expl_content
+{
+       margin: 0 0 0 354px;
+       border: 2px solid #527EA3;
+       -moz-border-radius: 3px;
+       border-radius: 3px;
        padding: 20px;
-       font-size: 12px;
+       background-color: #F6FBFE;
 }
-#expl_footer {
+
+#expl_footer
+{
        margin: 20px 20px 0 20px;
-       clear: left;
-    font-size: 12px;
-    color: gray;
+       clear: both;
+       font-size: 11px;
 }
 
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Sidebar Explorer  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
 
-/* SIDEBAR *****************/
-#expl_sidebar li p {
+#expl_sidebar li p
+{
        cursor: pointer;
 }
-#expl_sidebar  ul, #expl_sidebar li {
+
+#expl_sidebar ul, #expl_sidebar li
+{
        list-style: none;
        margin: 0;
        padding: 0;
 }
-#expl_sidebar ul {
+
+#expl_sidebar ul
+{
        padding-left: 1em;
 }
-#expl_sidebar li {
-       padding-left: 1em;
-       border: 1px dotted black;
+
+#expl_sidebar li
+{
+       padding-left: 10px;
+       border: 1px dotted #354F66;
        border-width: 0 0 1px 1px;
 }
-#expl_sidebar li.branch {
+
+#expl_sidebar li.branch
+{
        border-bottom: 0px;
 }
-#expl_sidebar li.empty {
+
+#expl_sidebar li.empty
+{
        font-style: italic;
        color: silver;
        border-color: silver;
 }
-#expl_sidebar li p {
+
+#expl_sidebar li p
+{
+       margin: 0;
+       padding: 0 10px 0 0;
+       position: relative;
+       top: 12px;
+       background-color: #F6FBFE;
+}
+
+#expl_sidebar li p a
+{
+       display: block;
+       padding: 2px 5px;
+       text-decoration: none;
+       border: 1px solid #F6FBFE;
+       -moz-border-radius: 3px;
+       border-radius: 3px;
+}
+
+#expl_sidebar li p a:hover
+{
+       border: 1px solid #BDD2E5;
+}
+
+#expl_sidebar li p.selected
+{
        margin: 0;
-       background: white;
        position: relative;
-       top: 0.5em;
+       top: 12px;
 }
-#expl_sidebar li ul {
+
+#expl_sidebar li p.selected a
+{
+       display: block;
+       padding: 2px 5px;
+       text-decoration: none;
+       border: 1px solid #354F66;
+       -moz-border-radius: 3px;
+       border-radius: 3px;
+       background-color: #527EA3;
+       color: #BDD2E5;
+}
+
+#expl_sidebar li p.selected a:hover
+{
+       color: #FFFFFF;
+}
+
+#expl_sidebar li ul
+{
        border-top: 1px dotted black;
        margin-left: -1em;
        padding-left: 2em;
 }
 
-/** CONTENT **************/
-#expl_content h3 {
-       border-top: 1px dotted black;
-       padding-top: 15px;
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Content  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.smallLabel
+{
+       color: #545D66;
+       font-size: 11px;
+}
+
+
+
+/* ################################################################# */
+/* --- Edit --- */
+/* ################################################################# */
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Properties  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.edit_properties_container
+{
+       border-top: 1px dotted #354F66;
+       margin: 30px 0 0 0;
+       padding: 10px 0;
+}
+
+.edit_properties_container form fieldset ul#multiyvalueproperty
+{
+       margin: 0 0 0 313px;
+       padding: 0;
 }
-#expl_content label {
-  float:left;
-  width:200px;
-}
-#expl_content h2 {
-  font-size: 18px;
-  background-color: #FFFFBB;
-}
-.smallLabel {
-  color:gray;
-  font-size:60%;
+
+.add_property
+{
+       margin: 0 10px 0 300px;
 }
+
+.property_element
+{
+       padding: 10px;
+       border: 1px solid #BDD2E5;
+       margin: 0 0 10px 0;
+}
\ No newline at end of file

Modified: 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js?rev=990613&r1=990612&r2=990613&view=diff
==============================================================================
--- 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
 (original)
+++ 
sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
 Sun Aug 29 18:10:56 2010
@@ -16,86 +16,152 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 /** load the initial tree on editor startup */
-init_load = function(path){
-  
-  // load root node
-  $.get("/.explorer.item.html", function(data){
-    $('#expl_sidebar').append(data);
-  });  
-
-  // load others
-  var paths = path.split("/");
-  paths.splice(0,1); // remove first slash
-  var rPath = "";
-  for (p in paths){
-    rPath += paths[p];
-    load_branch(rPath );    
-    rPath += "/";
-  }
-  
-  // load properties
-  load_props(path);  
-}
+init_load = function(path, resourceType) {
+
+       // load root node
 
+       $.get("/.explorer.item.html", function(data) {
+       //$.get(path+".explorer.item.html", function(data) {
+               $('#expl_sidebar').append(data);
+       });
+
+       // load others
+       var paths = path.split("/");
+       paths.splice(0, 1); // remove first slash
+       var rPath = "";
+       for (p in paths) {
+               rPath += paths[p];
+               load_branch(rPath);
+               rPath += "/";
+       }
+
+       // load properties
+       load_props(path, resourceType);
+}
 
 /** toggle a node in the menu */
-explorer_toggle = function(path){
-  var id= path.replace(/\//g, "_"); // replacing / with _
-  var is_open = $('p#'+id+'>a').hasClass('open');
-  
-  load_props("/" + path);
-  
-  if (is_open){
-    //remove children
-    $('p#'+id).parent().find('ul').each(function(){
-      $(this).empty();
-      this.parentNode.removeChild( this )
-    });
-    $('p#'+id+">a").removeClass('open');  // closed
-    $('p#'+id).parent().removeClass('branch'); // remove css class
-    
-  } else {
-    load_branch(path);
-  }
-}
-
-load_branch = function(path){
-  if (path != '')
-  {
-     var id= path.replace(/\//g, "_"); // replacing / with _
-        $('p#'+id+">a").removeAttr('href');  // remove onclick
-         
-         // fetch children
-         $.get("/"+path + ".explorer.item.html", function(data){
-               if (data.length > 0) {
-                 $('p#'+id).parent().addClass('branch'); // add css class
-                 $('p#'+id).after(data); // add data
-                 $('p#'+id+">a").attr('href', "#");  // reactivate onclick
-                 $('p#'+id+">a").addClass('open');  // open
-               } 
-         });
-  }
+explorer_toggle = function(path, resourceType) {
+       var id = path_2_id( path ); // replacing / with _
+       var is_open = $('p#' + id + '>a').hasClass('open');
+
+       load_props("/" + path, resourceType);
+
+       var subtree = $('ul', $('p#' + id).parent());
+       if (is_open) {
+               if (subtree.length != 0) // should always resolve to true...
+               {
+                       subtree.hide();
+               }
+               $('p#' + id + ">a").removeClass('open'); // closed
+               $('p#' + id).parent().removeClass('branch'); // remove css class
+       } else {
+               if (subtree.length === 0) {
+                       load_branch(path);
+               } else {
+                       $('p#' + id).parent().addClass('branch'); // add css 
class
+                       $('p#' + id + ">a").addClass('open'); // opened
+                       subtree.show();
+               }
+       }
+}
+
+/** load branch/subtree **/
+load_branch = function( path, callback ) {
+       if (path != '') {
+               var id = path_2_id( path ); // replacing / with _
+               $('p#' + id + ">a").removeAttr('href'); // remove onclick
+
+               // fetch children
+               $.get("/" + path + ".explorer.item.html", function(data) {
+                       if (data.length > 0) {
+                               $('p#' + id).parent().addClass('branch'); // 
add css class
+                               $('p#' + id).after(data); // add data
+                               $('p#' + id + ">a").attr('href', "#"); // 
reactivate onclick
+                               $('p#' + id + ">a").addClass('open'); // open
+                               $('p#' + id).addClass('loaded');
+                               if ( callback ) { callback() };
+                       }
+               });
+       }
 }
 
-load_props = function(path) {
-  $.get(path + ".explorer.properties.html", function(data){
-    if (data.length > 0) {
-      $('#expl_content').html(data);
-    } 
-  });
+load_props = function(path, resourceType) {
+       var id = path_2_id( path ); // replacing / with _
+       //id = id.replace(/^_/, ""); // remove trailing _
+       if ($('p#' + id))
+       {
+               $('p', $('#expl_sidebar')).removeClass('selected'); // deselect 
all
+               $('p[id="' + id + '"]').addClass('selected'); // select the 
current node
+       }
+       else
+       {
+               alert('p#' + id);
+       }
+       $.get(path + ".explorer.edit."+ (resourceType == null ? '' : 
(resourceType.replace(':','_') + '.') ) + "html", function(data) {
+               if (data.length > 0) {
+                       $('#expl_content').html(data);
+               }
+       });
 }
 
 add_prop = function(node) {
-  var name  = $('#expl_add_prop_name').attr('value');
-  var type  = $('#expl_add_prop_type').val();
-  var value = $('#expl_add_prop_value').attr('value');
-
-  var params = {};
-  params[name + '@TypeHint'] = type;
-  params[name] = value;
-  $.post(node, params, function(data){ 
-    window.location = node + '.explorer.html';
-  } );  
-}
\ No newline at end of file
+       var name = $('#expl_add_prop_name').attr('value');
+       var type = $('#expl_add_prop_type').val();
+       if ( $('#expl_add_prop_multi').is(':checked') )
+       {
+               type += '[]';
+       }
+       var value = $('#expl_add_prop_value').attr('value');
+
+       var params = {};
+       params[name + '@TypeHint'] = type;
+       params[name] = value;
+       $.post(node, params, function(data) {
+               window.location = node + '.explorer.html';
+       });
+}
+
+search = function(language, expression, page) {
+       // search and load search results
+       $.get("/.explorer.search.html", { "language" : language, "expression" : 
expression, "page" : page }, function(data) {
+               $('#sql_search_result').html(data);
+       });
+}
+
+skip_to = function(path, resourceType) {
+       expand_tree(path, function() { load_props(path, resourceType); } );
+}
+
+expand_tree = function( path, callback ) {
+       // expand tree and select corresponding node    
+       var pathParts = path.split('/');
+       var partialPath = '';
+       for (idx in pathParts)
+       {       
+               if (pathParts[idx] != '')
+               {
+                       partialPath += (((partialPath != '') ? '/' : '') + 
pathParts[idx]);
+                       var id = path_2_id( partialPath ); // replacing / with _
+                       if (($('p#' + id).length === 0) || !$('p#' + 
id).hasClass('loaded'))
+                       {
+                               // asynchronous recursion: expand_tree is 
re-called after ajax call has finished
+                               load_branch( partialPath, function() { 
expand_tree( path, callback ); } );
+                               return;
+                       }
+               }
+       }
+       callback();
+}
+
+path_2_id = function(path) {
+       // WARNING: have a look at item.esp - duplicate code!
+       var id = path.replace(/\//g, "_"); // replacing / with _
+       id = id.replace(/^_/, ""); // remove trailing _
+       id = id.replace(/\./g, '_');// due to the css selectors
+       id = id.replace(/:/g, '_');// due to the css selectors
+       id = id.replace(/\[/g, '_');// due to the css selectors
+       id = id.replace(/\]/g, '_');// due to the css selectors
+       return id;
+}


Reply via email to