Fixed default page for web interface, since groups page doesn't work with authentication right now.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2385 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2008-10-23 23:28:09 +00:00
parent b46f7a12cf
commit 072d8a5aa0
28 changed files with 2660 additions and 2 deletions

View File

@ -12,7 +12,7 @@ if (isset($_COOKIE['currentpage'])) {
$m = $MENU[$keys[0]]; // this gets us to the menu choice for the top menu in the data structure
$url = $m['list'][$keys[1]]['url']; // get to the list of submenu choices, choose the proper one, and get its url
//echo "<p>url: $url, m[label]: " . $m['label'] . "</p>\n";
} else { $url = 'machines/groups.php'; }
} else { $url = 'config/db.php'; /*'machines/groups.php';*/ }
header("Location: $url");

33
xCAT-web/jq/jsTree/css.js Normal file
View File

@ -0,0 +1,33 @@
function get_css(rule_name, stylesheet, delete_flag) {
if (!document.styleSheets) return false;
rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
for (var i = stylesheet; i < document.styleSheets.length; i++) {
var styleSheet = document.styleSheets[i]; css_rules = document.styleSheets[i].cssRules || document.styleSheets[i].rules;
if(!css_rules) continue;
var j = 0;
do {
if(css_rules[j].selectorText.toLowerCase() == rule_name) {
if(delete_flag == true) {
if(document.styleSheets[i].removeRule) document.styleSheets[i].removeRule(j);
if(document.styleSheets[i].deleteRule) document.styleSheets[i].deleteRule(j);
return true;
}
else return css_rules[j];
}
}
while (css_rules[++j]);
}
return false;
}
function add_css(rule_name, stylesheet) {
if (!document.styleSheets || get_css(rule_name)) return false;
rule_name = rule_name.toLowerCase(); stylesheet = stylesheet || 0;
(document.styleSheets[stylesheet].addRule) ? document.styleSheets[stylesheet].addRule(rule_name, null, 0) : document.styleSheets[stylesheet].insertRule(rule_name+' { }', 0);
return get_css(rule_name);
}
function get_sheet_num (href_name) {
if (!document.styleSheets) return false;
for (var i = 0; i < document.styleSheets.length; i++) { if(document.styleSheets[i].href && document.styleSheets[i].href.toString().match(href_name)) return i; }
return false;
}
function remove_css(rule_name, stylesheet) { return get_css(rule_name, stylesheet, true); }

View File

@ -0,0 +1,70 @@
<?xml
version="1.0"
encoding="utf-8"
?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
method="html"
encoding="utf-8"
omit-xml-declaration="yes"
standalone="no"
indent="no"
media-type="text/xml"
/>
<xsl:template match="/">
<ul>
<xsl:for-each select="//item[not(@parent_id) or @parent_id=0]">
<xsl:call-template name="nodes">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="nodes">
<xsl:param name="node" />
<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />
<li>
<xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
<xsl:attribute name="rel"><xsl:value-of select="@type" /></xsl:attribute>
<xsl:attribute name="class">
<xsl:if test="position() = last()"> last </xsl:if>
<xsl:choose>
<xsl:when test="@state = 'open'"> open </xsl:when>
<xsl:when test="$children or @hasChildren"> closed </xsl:when>
<xsl:otherwise> leaf </xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@class" />
</xsl:attribute>
<xsl:for-each select="@*">
<xsl:if test="name() != 'id' and name() != 'class'">
<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="content/name">
<a href="#">
<xsl:attribute name="class"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="style">
<xsl:choose>
<xsl:when test="string-length(attribute::icon) > 0">background-image:url(<xsl:value-of select="@icon" />);</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute><xsl:value-of select="." /></a>
</xsl:for-each>
<xsl:if test="$children or @hasChildren">
<ul>
<xsl:for-each select="//item[@parent_id=$node/attribute::id]">
<xsl:call-template name="nodes">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

View File

@ -0,0 +1,96 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

32
xCAT-web/jq/jsTree/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
/**
* jQuery.Listen - Light and fast event handling, using event delegation.
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/7/2008
* http://flesler.blogspot.com/2007/10/jquerylisten.html
* @version 1.0.3
*/
;(function($){var a='indexer',h=$.event,j=h.special,k=$.listen=function(c,d,e,f){if(typeof d!='object'){f=e;e=d;d=document}o(c.split(/\s+/),function(a){a=k.fixes[a]||a;var b=m(d,a)||m(d,a,new n(a,d));b.append(e,f);b.start()})},m=function(b,c,d){return $.data(b,c+'.'+a,d)};$.fn[a]=function(a){return this[0]&&m(this[0],a)||null};$[a]=function(a){return m(document,a)};$.extend(k,{regex:/^((?:\w*?|\*))(?:([#.])([\w-]+))?$/,fixes:{focus:'focusin',blur:'focusout'},cache:function(a){this.caching=a}});$.each(k.fixes,function(a,b){j[b]={setup:function(){if($.browser.msie)return!1;this.addEventListener(a,j[b].handler,!0)},teardown:function(){if($.browser.msie)return!1;this.removeEventListener(a,j[b].handler,!0)},handler:function(e){arguments[0]=e=h.fix(e);e.type=b;return h.handle.apply(this,arguments)}}});$.fn.listen=function(a,b,c){return this.each(function(){k(a,this,b,c)})};function n(a,b){$.extend(this,{ids:{},tags:{},listener:b,event:a});this.id=n.instances.push(this)};n.instances=[];n.prototype={constructor:n,handle:function(e){var a=e.stopPropagation;e.stopPropagation=function(){e.stopped=1;a.apply(this,arguments)};m(this,e.type).parse(e);e.stopPropagation=a;a=e.data=null},on:0,bubbles:0,start:function(){var a=this;if(!a.on){h.add(a.listener,a.event,a.handle);a.on=1}},stop:function(){var a=this;if(a.on){h.remove(a.listener,a.event,a.handle);a.on=0}},cache:function(a,b){return $.data(a,'listenCache_'+this.id,b)},parse:function(e){var z=this,c=e.data||e.target,d=arguments,f;if(!k.caching||!(f=z.cache(c))){f=[];if(c.id&&z.ids[c.id])p(f,z.ids[c.id]);o([c.nodeName,'*'],function(a){var b=z.tags[a];if(b)o((c.className+' *').split(' '),function(a){if(a&&b[a])p(f,b[a])})});if(k.caching)z.cache(c,f)}if(f[0]){o(f,function(a){if(a.apply(c,d)===!1){e.preventDefault();e.stopPropagation()}})}if(!e.stopped&&(c=c.parentNode)&&(c.nodeName=='A'||z.bubbles&&c!=z.listener)){e.data=c;z.parse(e)}f=d=c=null},append:function(f,g){var z=this;o(f.split(/\s*,\s*/),function(a){var b=k.regex.exec(a);if(!b)throw'$.listen > "'+a+'" is not a supported selector.';var c=b[2]=='#'&&b[3],d=b[1].toUpperCase()||'*',e=b[3]||'*';if(c)(z.ids[c]||(z.ids[c]=[])).push(g);else if(d){d=z.tags[d]=z.tags[d]||{};(d[e]||(d[e]=[])).push(g)}})}};function o(a,b,c){for(var i=0,l=a.length;i<l;i++)b.call(c,a[i],i)};function p(a,b){a.push.apply(a,b);return a};$(window).unload(function(){if(typeof n=='function')o(n.instances,function(b){b.stop();$.removeData(b.listener,b.event+'.'+a);b.ids=b.names=b.listener=null})})})(jQuery);

View File

@ -0,0 +1,122 @@
/*
* Metadata - jQuery plugin for parsing metadata from elements
*
* Copyright (c) 2006 John Resig, Yehuda Katz, J<EFBFBD>örn Zaefferer, Paul McLanahan
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $
*
*/
/**
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
* in the JSON will become a property of the element itself.
*
* There are three supported types of metadata storage:
*
* attr: Inside an attribute. The name parameter indicates *which* attribute.
*
* class: Inside the class attribute, wrapped in curly braces: { }
*
* elem: Inside a child element (e.g. a script tag). The
* name parameter indicates *which* element.
*
* The metadata for an element is loaded the first time the element is accessed via jQuery.
*
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
*
* @name $.metadata.setType
*
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("class")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from the class attribute
*
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("attr", "data")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a "data" attribute
*
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
* @before $.metadata.setType("elem", "script")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a nested script element
*
* @param String type The encoding type
* @param String name The name of the attribute to be used to get metadata (optional)
* @cat Plugins/Metadata
* @descr Sets the type of encoding to be used when loading metadata for the first time
* @type undefined
* @see metadata()
*/
(function($) {
$.extend({
metadata : {
defaults : {
type: 'class',
name: 'metadata',
cre: /({.*})/,
single: 'metadata'
},
setType: function( type, name ){
this.defaults.type = type;
this.defaults.name = name;
},
get: function( elem, opts ){
var settings = $.extend({},this.defaults,opts);
// check for empty string in single property
if ( !settings.single.length ) settings.single = 'metadata';
var data = $.data(elem, settings.single);
// returned cached data if it already exists
if ( data ) return data;
data = "{}";
if ( settings.type == "class" ) {
var m = settings.cre.exec( elem.className );
if ( m )
data = m[1];
} else if ( settings.type == "elem" ) {
if( !elem.getElementsByTagName )
return undefined;
var e = elem.getElementsByTagName(settings.name);
if ( e.length )
data = $.trim(e[0].innerHTML);
} else if ( elem.getAttribute != undefined ) {
var attr = elem.getAttribute( settings.name );
if ( attr )
data = attr;
}
if ( data.indexOf( '{' ) <0 )
data = "{" + data + "}";
data = eval("(" + data + ")");
$.data( elem, settings.single, data );
return data;
}
}
});
/**
* Returns the metadata object for the first member of the jQuery object.
*
* @name metadata
* @descr Returns element's metadata object
* @param Object opts An object contianing settings to override the defaults
* @type jQuery
* @cat Plugins/Metadata
*/
$.fn.metadata = function( opts ){
return $.metadata.get( this[0], opts );
};
})(jQuery);

View File

@ -0,0 +1,350 @@
/**
* xslTransform
* Tools for XSLT transformations; jQuery wrapper for Sarissa <http://sarissa.sourceforge.net/>.
* See jQuery.fn.log below for documentation on $.log().
* See jQuery.fn.getTransform below for documention on the $.getTransform().
* See var DEBUG below for turning debugging/logging on and off.
*
* @version 20071203
* @since 2006-07-05
* @copyright Copyright (c) 2006 Glyphix Studio, Inc. http://www.glyphix.com
* @author Brad Brizendine <brizbane@gmail.com>, Matt Antone <antone@glyphix.com>
* @license MIT http://www.opensource.org/licenses/mit-license.php
* @requires >= jQuery 1.0.3 http://jquery.com/
* @requires jquery.debug.js http://jquery.glyphix.com/
* @requires >= sarissa.js 0.9.7.6 http://sarissa.sourceforge.net/
*
* @example
* var r = xslTransform.transform('path-to-xsl.xsl','path-to-xml.xml');
* @desc Perform a transformation and place the results in var r
*
* @example
* var r = xslTransform.transform('path-to-xsl.xsl','path-to-xml.xml');
* var str = xslTransform.serialize( r );
* @desc Perform a transformation, then turn the result into a string
*
* @example
* var doc = xslTransform.load('path-to-xml.xml');
* @desc Load an xml file and return a parsed xml object
*
* @example
* var xml = '<xmldoc><foo>bar</foo></xmldoc>';
* var doc = xslTransform.load(xml);
* @desc Load an xml string and return a parsed xml object
*/
var xslTransform = {
version: 20071203,
debug: false,
// init ... test for requirements
init: function(){
// check for v1.0.4 / v1.1 or later of jQuery
try{
parseFloat(jQuery.fn.jquery) >= 1;
}catch(e){
alert('xslTransform requires jQuery 1.0.4 or greater ... please load it prior to xslTransform');
}
// check for Sarissa
try{
Sarissa;
}catch(e){
alert('Missing Sarissa ... please load it prior to xslTransform');
}
// if no log function, create a blank one
if( !jQuery.log ){
jQuery.log = function(){};
jQuery.fn.debug = function(){};
}
// log the version
if(this.debug) jQuery.log( 'xslTransform:init(): version ' + xslTransform.version );
},
// initialize Sarissa's serializer
XMLSerializer: new XMLSerializer(),
/*
* serialize
* Turns the provided object into a string and returns it.
*
* @param data Mixed
* @returns String
*/
serialize: function( data ){
if(this.debug) jQuery.log( 'serialize(): received ' + typeof(data) );
// if it's already a string, no further processing required
if( typeof(data) == 'string' ){
return data;
}
return this.XMLSerializer.serializeToString( data );
},
/*
* load
* Attempts to load xml data by automatically sensing the type of the provided data.
*
* @param xml Mixed the xml data
* @returns Object
*/
load: function( xml ){
if(this.debug) jQuery.log( 'load(): received ' + typeof(xml) );
// the result
var r;
// if it's an object, assume it's already an XML object, so just return it
if( typeof(xml) == 'object' ){
return xml;
}
// if it's a string, determine if it's xml data or a path
// assume that the first character is an opening caret if it's XML data
if( xml.substring(0,1) == '<' ){
r = this.loadString( xml );
}else{
r = this.loadFile( xml );
}
if( r ){
// the following two lines are needed to get IE (msxml3) to run xpath ... set it on all xml data
r.setProperty( 'SelectionNamespaces', 'xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' );
r.setProperty( 'SelectionLanguage', 'XPath' );
return r;
}else{
if(this.debug) $.log( 'Unable to load ' + xml );
return false;
}
},
/*
* loadString
* Parses an XML string and returns the result.
*
* @param str String the xml string to turn into a parsed XML object
* @returns Object
*/
loadString: function( str ){
if(this.debug) jQuery.log( 'loadString(): ' + str + '::' + typeof(str) );
// use Sarissa to generate an XML doc
var p = new DOMParser();
var xml = p.parseFromString( str, 'text/xml' );
if( !xml ){
if(this.debug) jQuery.log( 'loadString(): parseFromString() failed' );
return false;
}
return xml;
},
/*
* loadFile
* Attempts to retrieve the requested path, specified by url.
* If url is an object, it's assumed it's already loaded, and just returns it.
*
* @param url Mixed
* @returns Object
*/
loadFile: function( url ){
if(this.debug) jQuery.log( 'loadFile(): ' + url + '::' + typeof(url) );
if( !url ){
if(this.debug) jQuery.log( 'ERROR: loadFile() missing url' );
return false;
}
// variable to hold ajax results
var doc;
// function to receive data on successful download ... semicolon after brace is necessary for packing
this.xhrsuccess = function(data,str){
if(this.debug) jQuery.log( 'loadFile() completed successfully (' + str + ')' );
doc = data;
return true;
};
// function to handle downloading error ... semicolon after brace is necessary for packing
this.xhrerror = function(xhr,err){
// set debugging to true in order to force the display of this error
window.DEBUG = true;
if(this.debug) jQuery.log( 'loadFile() failed to load the requested file: (' + err + ') - xml: ' + xhr.responseXML + ' - text: ' + xhr.responseText );
doc = null;
return false;
};
// make asynchronous ajax call and call functions defined above on success/error
$.ajax({
type: 'GET',
url: url,
async: false,
success: this.xhrsuccess,
error: this.xhrerror
});
// check for total failure
if( !doc ){
if(this.debug) jQuery.log( 'ERROR: document ' + url + ' not found (404), or unable to load' );
return false;
}
// check for success but no data
if( doc.length == 0 ){
if(this.debug) jQuery.log( 'ERROR: document ' + url + ' loaded in loadFile() has no data' );
return false;
}
return doc;
},
/*
* transform
* Central transformation function: takes an xml doc and an xsl doc.
*
* @param xsl Mixed the xsl transformation document
* @param xml Mixed the xml document to be transformed
* @param options Object various switches you can send to this function
* + params: an object of key/value pairs to be sent to xsl as parameters
* + xpath: defines the root node within the provided xml file
* @returns Object the results of the transformation
* + xsl: the raw xsl doc
* + doc: the raw results of the transform
* + string: the serialized doc
*/
transform: function( xsl, xml, options ){
var log = { 'xsl':xsl, 'xml':xml, 'options':options };
if(this.debug) jQuery.log( 'transform(): ' + xsl + '::' + xml + '::' + options.toString() );
// initialize options hash
options = options || {};
// initialize the xml object and store it in xml.doc
var xml = { 'request':xml, 'doc':this.load(xml) };
// if we have an xpath, replace xml.doc with the results of running it
// as of 2007-12-03, IE throws a "msxml6: the parameter is incorrect" error, so removing this
if( options.xpath && xml.doc && !jQuery.browser.msie ){
// run the xpath
xml.doc = xml.doc.selectSingleNode( options.xpath.toString() );
if(this.debug) $.log( 'transform(): xpath has been run...resulting doc: ' + (this.serialize(xml.doc)) );
}
// initialize the result object ... store the primary steps of the transform in result
var result = { 'xsl':this.load(xsl) };
result.json = false;
if( options.json && xml.doc ) {
result.json = xml.doc.selectSingleNode( options.json.toString() );
}
var processor = new XSLTProcessor();
// stylesheet must be imported before parameters can be added
processor.importStylesheet( result.xsl );
// add parameters to the processor
if( options.params && processor ){
if(this.debug) jQuery.log( 'transform(): received xsl params: ' + options.params.toString() );
for( key in options.params ){
// name and value must be strings
// first parameter is namespace
processor.setParameter( null, key.toString(), options.params[key].toString() );
}
}
// perform the transformation
result.doc = processor.transformToDocument( xml.doc );
// handle transform error
var errorTxt = Sarissa.getParseErrorText(result.doc);
if(this.debug) jQuery.log( 'transform(): Sarissa parse text: ' + errorTxt );
if( errorTxt != Sarissa.PARSED_OK ){
// return the error text as the string
result.string = Sarissa.getParseErrorText(result.doc) + ' :: using ' + xsl + ' => ' + xml.request;
if(this.debug) jQuery.log( 'transform(): error in transformation: ' + Sarissa.getParseErrorText(result.doc) );
return result;
}
// if we made it this far, the transformation was successful
result.string = this.serialize( result.doc );
// store reference to all scripts found in the doc (not result.string)
result.scripts = jQuery('script',result.doc).text();
return result;
}
};
// create the xslTransform object
// this creates a single object for the page, allowing re-use of the XSL processor
xslTransform.init();
/*
* JQuery XSLT transformation plugin.
* Replaces all matched elements with the results of an XSLT transformation.
* See xslTransform above for more documentation.
*
* @example
* @desc See the xslTransform-example/index.html
*
* @param xsl String the url to the xsl file
* @param xml String the url to the xml file
* @param options Object various switches you can send to this function
* + params: an object of key/value pairs to be sent to xsl as parameters
* + xpath: defines the root node within the provided xml file
* + eval: if true, will attempt to eval javascript found in the transformed result
* + callback: if a Function, evaluate it when transformation is complete
* @returns
*/
jQuery.fn.getTransform = function( xsl, xml, options ){
var settings = {
append: false,
params: {}, // object of key/value pairs ... parameters to send to the XSL stylesheet
xpath: '', // xpath, used to send only a portion of the XML file to the XSL stylesheet
eval: true, // evaluate <script> blocks found in the transformed result
callback: '', // callback function, to be run on completion of the transformation
json: false
};
// initialize options hash; override the defaults with supplied options
jQuery.extend( settings, options );
if(xslTransform.debug) jQuery.log( 'getTransform: ' + xsl + '::' + xml + '::' + settings.toString() );
// must have both xsl and xml
if( !xsl || !xml ){
if(xslTransform.debug) jQuery.log( 'getTransform: missing xsl or xml' );
return;
}
// run the jquery magic on all matched elements
return this.each( function(){
// perform the transformation
var trans = xslTransform.transform( xsl, xml, settings );
// ie can fail if there's an xml declaration line in the returned result
var re = trans.string.match(/<\?xml.*?\?>/);
if( re ){
trans.string = trans.string.replace( re, '' );
if(xslTransform.debug) jQuery.log( 'getTransform(): found an xml declaration and removed it' );
}
// place the result in the element
// 20070202: jquery 1.1.1 can get a "a.appendChild is not a function" error using html() sometimes ...
// no idea why yet, so adding a fallback to innerHTML
// ::warning:: ie6 has trouble with javascript events such as onclick assigned statically within the html when using innerHTML
try {
if(settings.append) $(this).append( trans.string );
else if(settings.repl) $(this).replaceWith( trans.string );
else $(this).html( trans.string );
} catch(e) {
if(xslTransform.debug) $.log( 'getTransform: error placing results of transform into element, falling back to innerHTML: ' + e.toString() );
$(this)[0].innerHTML = trans.string;
}
// there might not be a scripts property
if( settings.eval && trans.scripts ){
if( trans.scripts.length > 0 ){
if(xslTransform.debug) jQuery.log( 'Found text/javascript in transformed result' );
eval.call( window, trans.scripts );
}
}
// run the callback if it's a native function
if( settings.callback && jQuery.isFunction(settings.callback) ){
var json = false;
if(settings.json && trans.json) eval("json = " + trans.json.firstChild.data);
settings.callback.apply(window, [trans.string, json]);
}
});
};

View File

@ -0,0 +1,67 @@
<?xml
version="1.0"
encoding="utf-8"
?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
method="html"
encoding="utf-8"
omit-xml-declaration="yes"
standalone="no"
indent="no"
media-type="text/html"
/>
<xsl:template match="/">
<xsl:call-template name="nodes">
<xsl:with-param name="node" select="/root" />
</xsl:call-template>
</xsl:template>
<xsl:template name="nodes">
<xsl:param name="node" />
<ul>
<xsl:for-each select="$node/item">
<xsl:variable name="children" select="count(./item) &gt; 0" />
<li>
<xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
<xsl:attribute name="class">
<xsl:if test="position() = last()"> last </xsl:if>
<xsl:choose>
<xsl:when test="@state = 'open'"> open </xsl:when>
<xsl:when test="$children or @hasChildren"> closed </xsl:when>
<xsl:otherwise> leaf </xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@class" />
</xsl:attribute>
<xsl:for-each select="@*">
<xsl:if test="name() != 'id' and name() != 'class'">
<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="content/name">
<a href="#">
<xsl:attribute name="class"><xsl:value-of select="@lang" /></xsl:attribute>
<xsl:attribute name="style">
<xsl:choose>
<xsl:when test="string-length(attribute::icon) > 0">background-image:url(<xsl:value-of select="@icon" />);</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute><xsl:value-of select="current()" /></a>
</xsl:for-each>
<xsl:if test="$children or @hasChildren">
<xsl:call-template name="nodes">
<xsl:with-param name="node" select="current()" />
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,110 @@
/* * ====================================================================
* About: This a a compressed JS file from the Sarissa library.
* see http://dev.abiss.gr/sarissa
*
* Copyright: Manos Batsis, http://dev.abiss.gr
*
* Licence:
* Sarissa is free software distributed under the GNU GPL version 2
* or higher, GNU LGPL version 2.1 or higher and Apache Software
* License 2.0 or higher. The licenses are available online see:
* http://www.gnu.org
* http://www.apache.org
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================*/
function Sarissa(){}
Sarissa.VERSION="0.9.9.4";Sarissa.PARSED_OK="Document contains no parsing errors";Sarissa.PARSED_EMPTY="Document is empty";Sarissa.PARSED_UNKNOWN_ERROR="Not well-formed or other error";Sarissa.IS_ENABLED_TRANSFORM_NODE=false;Sarissa.REMOTE_CALL_FLAG="gr.abiss.sarissa.REMOTE_CALL_FLAG";Sarissa._lastUniqueSuffix=0;Sarissa._getUniqueSuffix=function(){return Sarissa._lastUniqueSuffix++;};Sarissa._SARISSA_IEPREFIX4XSLPARAM="";Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION=document.implementation&&true;Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.createDocument;Sarissa._SARISSA_HAS_DOM_FEATURE=Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION&&document.implementation.hasFeature;Sarissa._SARISSA_IS_MOZ=Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT&&Sarissa._SARISSA_HAS_DOM_FEATURE;Sarissa._SARISSA_IS_SAFARI=navigator.userAgent.toLowerCase().indexOf("safari")!=-1||navigator.userAgent.toLowerCase().indexOf("konqueror")!=-1;Sarissa._SARISSA_IS_SAFARI_OLD=Sarissa._SARISSA_IS_SAFARI&&(parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1],10)<420);Sarissa._SARISSA_IS_IE=document.all&&window.ActiveXObject&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1;Sarissa._SARISSA_IS_OPERA=navigator.userAgent.toLowerCase().indexOf("opera")!=-1;if(!window.Node||!Node.ELEMENT_NODE){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}
if(Sarissa._SARISSA_IS_SAFARI_OLD){HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;HTMLDocument=Document=document.constructor;var x=new DOMParser();XMLDocument=x.constructor;Element=x.parseFromString("<Single />","text/xml").documentElement.constructor;x=null;}
if(typeof XMLDocument=="undefined"&&typeof Document!="undefined"){XMLDocument=Document;}
if(Sarissa._SARISSA_IS_IE){Sarissa._SARISSA_IEPREFIX4XSLPARAM="xsl:";var _SARISSA_DOM_PROGID="";var _SARISSA_XMLHTTP_PROGID="";var _SARISSA_DOM_XMLWRITER="";Sarissa.pickRecentProgID=function(idList){var bFound=false,e;var o2Store;for(var i=0;i<idList.length&&!bFound;i++){try{var oDoc=new ActiveXObject(idList[i]);o2Store=idList[i];bFound=true;}catch(objException){e=objException;}}
if(!bFound){throw"Could not retrieve a valid progID of Class: "+idList[idList.length-1]+". (original exception: "+e+")";}
idList=null;return o2Store;};_SARISSA_DOM_PROGID=null;_SARISSA_THREADEDDOM_PROGID=null;_SARISSA_XSLTEMPLATE_PROGID=null;_SARISSA_XMLHTTP_PROGID=null;XMLHttpRequest=function(){if(!_SARISSA_XMLHTTP_PROGID){_SARISSA_XMLHTTP_PROGID=Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"]);}
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);};Sarissa.getDomDocument=function(sUri,sName){if(!_SARISSA_DOM_PROGID){_SARISSA_DOM_PROGID=Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"]);}
var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(sName){var prefix="";if(sUri){if(sName.indexOf(":")>1){prefix=sName.substring(0,sName.indexOf(":"));sName=sName.substring(sName.indexOf(":")+1);}else{prefix="a"+Sarissa._getUniqueSuffix();}}
if(sUri){oDoc.loadXML('<'+prefix+':'+sName+" xmlns:"+prefix+"=\""+sUri+"\""+" />");}else{oDoc.loadXML('<'+sName+" />");}}
return oDoc;};Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if(oDoc&&oDoc.parseError&&oDoc.parseError.errorCode&&oDoc.parseError.errorCode!=0){parseErrorText="XML Parsing Error: "+oDoc.parseError.reason+"\nLocation: "+oDoc.parseError.url+"\nLine Number "+oDoc.parseError.line+", Column "+
oDoc.parseError.linepos+":\n"+oDoc.parseError.srcText+"\n";for(var i=0;i<oDoc.parseError.linepos;i++){parseErrorText+="-";}
parseErrorText+="^\n";}
else if(oDoc.documentElement===null){parseErrorText=Sarissa.PARSED_EMPTY;}
return parseErrorText;};Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc.setProperty("SelectionLanguage","XPath");oDoc.setProperty("SelectionNamespaces",sNsSet);};XSLTProcessor=function(){if(!_SARISSA_XSLTEMPLATE_PROGID){_SARISSA_XSLTEMPLATE_PROGID=Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0","MSXML2.XSLTemplate.3.0"]);}
this.template=new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);this.processor=null;};XSLTProcessor.prototype.importStylesheet=function(xslDoc){if(!_SARISSA_THREADEDDOM_PROGID){_SARISSA_THREADEDDOM_PROGID=Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0","MSXML2.FreeThreadedDOMDocument.3.0"]);}
xslDoc.setProperty("SelectionLanguage","XPath");xslDoc.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var converted=new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);try{converted.resolveExternals=true;converted.setProperty("AllowDocumentFunction",true);}
catch(e){}
if(xslDoc.url&&xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']")!=null){converted.async=false;converted.load(xslDoc.url);}
else{converted.loadXML(xslDoc.xml);}
converted.setProperty("SelectionNamespaces","xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");var output=converted.selectSingleNode("//xsl:output");if(output){this.outputMethod=output.getAttribute("method");}
else{delete this.outputMethod;}
this.template.stylesheet=converted;this.processor=this.template.createProcessor();this.paramsSet=[];};XSLTProcessor.prototype.transformToDocument=function(sourceDoc){var outDoc;if(_SARISSA_THREADEDDOM_PROGID){this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);this.processor.output=outDoc;this.processor.transform();return outDoc;}
else{if(!_SARISSA_DOM_XMLWRITER){_SARISSA_DOM_XMLWRITER=Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0","Msxml2.MXXMLWriter.3.0","MSXML2.MXXMLWriter","MSXML.MXXMLWriter","Microsoft.XMLDOM"]);}
this.processor.input=sourceDoc;outDoc=new ActiveXObject(_SARISSA_DOM_XMLWRITER);this.processor.output=outDoc;this.processor.transform();var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);oDoc.loadXML(outDoc.output+"");return oDoc;}};XSLTProcessor.prototype.transformToFragment=function(sourceDoc,ownerDoc){this.processor.input=sourceDoc;this.processor.transform();var s=this.processor.output;var f=ownerDoc.createDocumentFragment();var container;if(this.outputMethod=='text'){f.appendChild(ownerDoc.createTextNode(s));}else if(ownerDoc.body&&ownerDoc.body.innerHTML){container=ownerDoc.createElement('div');container.innerHTML=s;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
else{var oDoc=new ActiveXObject(_SARISSA_DOM_PROGID);if(s.substring(0,5)=='<?xml'){s=s.substring(s.indexOf('?>')+2);}
var xml=''.concat('<my>',s,'</my>');oDoc.loadXML(xml);container=oDoc.documentElement;while(container.hasChildNodes()){f.appendChild(container.firstChild);}}
return f;};XSLTProcessor.prototype.setParameter=function(nsURI,name,value){value=value?value:"";if(nsURI){this.processor.addParameter(name,value,nsURI);}else{this.processor.addParameter(name,value);}
nsURI=""+(nsURI||"");if(!this.paramsSet[nsURI]){this.paramsSet[nsURI]=[];}
this.paramsSet[nsURI][name]=value;};XSLTProcessor.prototype.getParameter=function(nsURI,name){nsURI=""+(nsURI||"");if(this.paramsSet[nsURI]&&this.paramsSet[nsURI][name]){return this.paramsSet[nsURI][name];}else{return null;}};XSLTProcessor.prototype.clearParameters=function(){for(var nsURI in this.paramsSet){for(var name in this.paramsSet[nsURI]){if(nsURI!=""){this.processor.addParameter(name,"",nsURI);}else{this.processor.addParameter(name,"");}}}
this.paramsSet=[];};}else{if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT){Sarissa.__handleLoad__=function(oDoc){Sarissa.__setReadyState__(oDoc,4);};_sarissa_XMLDocument_onload=function(){Sarissa.__handleLoad__(this);};Sarissa.__setReadyState__=function(oDoc,iReadyState){oDoc.readyState=iReadyState;oDoc.readystate=iReadyState;if(oDoc.onreadystatechange!=null&&typeof oDoc.onreadystatechange=="function"){oDoc.onreadystatechange();}};Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(!oDoc.onreadystatechange){oDoc.onreadystatechange=null;}
if(!oDoc.readyState){oDoc.readyState=0;}
oDoc.addEventListener("load",_sarissa_XMLDocument_onload,false);return oDoc;};if(window.XMLDocument){}
else if(Sarissa._SARISSA_HAS_DOM_FEATURE&&window.Document&&!Document.prototype.load&&document.implementation.hasFeature('LS','3.0')){Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);return oDoc;};}
else{Sarissa.getDomDocument=function(sUri,sName){var oDoc=document.implementation.createDocument(sUri?sUri:null,sName?sName:null,null);if(oDoc&&(sUri||sName)&&!oDoc.documentElement){oDoc.appendChild(oDoc.createElementNS(sUri,sName));}
return oDoc;};}}}
if(!window.DOMParser){if(Sarissa._SARISSA_IS_SAFARI){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET","data:text/xml;charset=utf-8,"+encodeURIComponent(sXml),false);xmlhttp.send(null);return xmlhttp.responseXML;};}else if(Sarissa.getDomDocument&&Sarissa.getDomDocument()&&Sarissa.getDomDocument(null,"bar").xml){DOMParser=function(){};DOMParser.prototype.parseFromString=function(sXml,contentType){var doc=Sarissa.getDomDocument();doc.loadXML(sXml);return doc;};}}
if((typeof(document.importNode)=="undefined")&&Sarissa._SARISSA_IS_IE){try{document.importNode=function(oNode,bChildren){var tmp;if(oNode.nodeName=='#text'){return document.createTextNode(oNode.data);}
else{if(oNode.nodeName=="tbody"||oNode.nodeName=="tr"){tmp=document.createElement("table");}
else if(oNode.nodeName=="td"){tmp=document.createElement("tr");}
else if(oNode.nodeName=="option"){tmp=document.createElement("select");}
else{tmp=document.createElement("div");}
if(bChildren){tmp.innerHTML=oNode.xml?oNode.xml:oNode.outerHTML;}else{tmp.innerHTML=oNode.xml?oNode.cloneNode(false).xml:oNode.cloneNode(false).outerHTML;}
return tmp.getElementsByTagName("*")[0];}};}catch(e){}}
if(!Sarissa.getParseErrorText){Sarissa.getParseErrorText=function(oDoc){var parseErrorText=Sarissa.PARSED_OK;if((!oDoc)||(!oDoc.documentElement)){parseErrorText=Sarissa.PARSED_EMPTY;}else if(oDoc.documentElement.tagName=="parsererror"){parseErrorText=oDoc.documentElement.firstChild.data;parseErrorText+="\n"+oDoc.documentElement.firstChild.nextSibling.firstChild.data;}else if(oDoc.getElementsByTagName("parsererror").length>0){var parsererror=oDoc.getElementsByTagName("parsererror")[0];parseErrorText=Sarissa.getText(parsererror,true)+"\n";}else if(oDoc.parseError&&oDoc.parseError.errorCode!=0){parseErrorText=Sarissa.PARSED_UNKNOWN_ERROR;}
return parseErrorText;};}
Sarissa.getText=function(oNode,deep){var s="";var nodes=oNode.childNodes;for(var i=0;i<nodes.length;i++){var node=nodes[i];var nodeType=node.nodeType;if(nodeType==Node.TEXT_NODE||nodeType==Node.CDATA_SECTION_NODE){s+=node.data;}else if(deep===true&&(nodeType==Node.ELEMENT_NODE||nodeType==Node.DOCUMENT_NODE||nodeType==Node.DOCUMENT_FRAGMENT_NODE)){s+=Sarissa.getText(node,true);}}
return s;};if(!window.XMLSerializer&&Sarissa.getDomDocument&&Sarissa.getDomDocument("","foo",null).xml){XMLSerializer=function(){};XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;};}
Sarissa.stripTags=function(s){return s?s.replace(/<[^>]+>/g,""):s;};Sarissa.clearChildNodes=function(oNode){while(oNode.firstChild){oNode.removeChild(oNode.firstChild);}};Sarissa.copyChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if(Sarissa._SARISSA_IS_SAFARI&&nodeTo.nodeType==Node.DOCUMENT_NODE){nodeTo=nodeTo.documentElement;}
if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var nodes=nodeFrom.childNodes;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}};Sarissa.moveChildNodes=function(nodeFrom,nodeTo,bPreserveExisting){if((!nodeFrom)||(!nodeTo)){throw"Both source and destination nodes must be provided";}
if(!bPreserveExisting){Sarissa.clearChildNodes(nodeTo);}
var nodes=nodeFrom.childNodes;if(nodeFrom.ownerDocument==nodeTo.ownerDocument){while(nodeFrom.firstChild){nodeTo.appendChild(nodeFrom.firstChild);}}else{var ownerDoc=nodeTo.nodeType==Node.DOCUMENT_NODE?nodeTo:nodeTo.ownerDocument;var i;if(typeof(ownerDoc.importNode)!="undefined"){for(i=0;i<nodes.length;i++){nodeTo.appendChild(ownerDoc.importNode(nodes[i],true));}}else{for(i=0;i<nodes.length;i++){nodeTo.appendChild(nodes[i].cloneNode(true));}}
Sarissa.clearChildNodes(nodeFrom);}};Sarissa.xmlize=function(anyObject,objectName,indentSpace){indentSpace=indentSpace?indentSpace:'';var s=indentSpace+'<'+objectName+'>';var isLeaf=false;if(!(anyObject instanceof Object)||anyObject instanceof Number||anyObject instanceof String||anyObject instanceof Boolean||anyObject instanceof Date){s+=Sarissa.escape(""+anyObject);isLeaf=true;}else{s+="\n";var isArrayItem=anyObject instanceof Array;for(var name in anyObject){s+=Sarissa.xmlize(anyObject[name],(isArrayItem?"array-item key=\""+name+"\"":name),indentSpace+" ");}
s+=indentSpace;}
return(s+=(objectName.indexOf(' ')!=-1?"</array-item>\n":"</"+objectName+">\n"));};Sarissa.escape=function(sXml){return sXml.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");};Sarissa.unescape=function(sXml){return sXml.replace(/&apos;/g,"'").replace(/&quot;/g,"\"").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&");};Sarissa.updateCursor=function(oTargetElement,sValue){if(oTargetElement&&oTargetElement.style&&oTargetElement.style.cursor!=undefined){oTargetElement.style.cursor=sValue;}};Sarissa.updateContentFromURI=function(sFromUrl,oTargetElement,xsltproc,callback,skipCache){try{Sarissa.updateCursor(oTargetElement,"wait");var xmlhttp=new XMLHttpRequest();xmlhttp.open("GET",sFromUrl,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){try{var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(sFromUrl,oTargetElement);}}
else{throw Sarissa.getParseErrorText(oDomDoc);}}
catch(e){if(callback){callback(sFromUrl,oTargetElement,e);}
else{throw e;}}}};if(skipCache){var oldage="Sat, 1 Jan 2000 00:00:00 GMT";xmlhttp.setRequestHeader("If-Modified-Since",oldage);}
xmlhttp.send("");}
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(sFromUrl,oTargetElement,e);}
else{throw e;}}};Sarissa.updateContentFromNode=function(oNode,oTargetElement,xsltproc){try{Sarissa.updateCursor(oTargetElement,"wait");Sarissa.clearChildNodes(oTargetElement);var ownerDoc=oNode.nodeType==Node.DOCUMENT_NODE?oNode:oNode.ownerDocument;if(ownerDoc.parseError&&ownerDoc.parseError.errorCode!=0){var pre=document.createElement("pre");pre.appendChild(document.createTextNode(Sarissa.getParseErrorText(ownerDoc)));oTargetElement.appendChild(pre);}
else{if(xsltproc){oNode=xsltproc.transformToDocument(oNode);}
if(oTargetElement.tagName.toLowerCase()=="textarea"||oTargetElement.tagName.toLowerCase()=="input"){oTargetElement.value=new XMLSerializer().serializeToString(oNode);}
else{try{oTargetElement.appendChild(oTargetElement.ownerDocument.importNode(oNode,true));}
catch(e){oTargetElement.innerHTML=new XMLSerializer().serializeToString(oNode);}}}}
catch(e){throw e;}
finally{Sarissa.updateCursor(oTargetElement,"auto");}};Sarissa.formToQueryString=function(oForm){var qs="";for(var i=0;i<oForm.elements.length;i++){var oField=oForm.elements[i];var sFieldName=oField.getAttribute("name")?oField.getAttribute("name"):oField.getAttribute("id");if(sFieldName&&((!oField.disabled)||oField.type=="hidden")){switch(oField.type){case"hidden":case"text":case"textarea":case"password":qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";break;case"select-one":qs+=sFieldName+"="+encodeURIComponent(oField.options[oField.selectedIndex].value)+"&";break;case"select-multiple":for(var j=0;j<oField.length;j++){var optElem=oField.options[j];if(optElem.selected===true){qs+=sFieldName+"[]"+"="+encodeURIComponent(optElem.value)+"&";}}
break;case"checkbox":case"radio":if(oField.checked){qs+=sFieldName+"="+encodeURIComponent(oField.value)+"&";}
break;}}}
return qs.substr(0,qs.length-1);};Sarissa.updateContentFromForm=function(oForm,oTargetElement,xsltproc,callback){try{Sarissa.updateCursor(oTargetElement,"wait");var params=Sarissa.formToQueryString(oForm)+"&"+Sarissa.REMOTE_CALL_FLAG+"=true";var xmlhttp=new XMLHttpRequest();var bUseGet=oForm.getAttribute("method")&&oForm.getAttribute("method").toLowerCase()=="get";if(bUseGet){xmlhttp.open("GET",oForm.getAttribute("action")+"?"+params,true);}
else{xmlhttp.open('POST',oForm.getAttribute("action"),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");}
xmlhttp.onreadystatechange=function(){try{if(xmlhttp.readyState==4){var oDomDoc=xmlhttp.responseXML;if(oDomDoc&&Sarissa.getParseErrorText(oDomDoc)==Sarissa.PARSED_OK){Sarissa.updateContentFromNode(xmlhttp.responseXML,oTargetElement,xsltproc);if(callback){callback(oForm,oTargetElement);}}
else{throw Sarissa.getParseErrorText(oDomDoc);}}}
catch(e){if(callback){callback(oForm,oTargetElement,e);}
else{throw e;}}};xmlhttp.send(bUseGet?"":params);}
catch(e){Sarissa.updateCursor(oTargetElement,"auto");if(callback){callback(oForm,oTargetElement,e);}
else{throw e;}}
return false;};Sarissa.FUNCTION_NAME_REGEXP=new RegExp("");Sarissa.getFunctionName=function(oFunc,bForce){var name;if(!name){if(bForce){name="SarissaAnonymous"+Sarissa._getUniqueSuffix();window[name]=oFunc;}
else{name=null;}}
if(name){window[name]=oFunc;}
return name;};Sarissa.setRemoteJsonCallback=function(url,callback,callbackParam){if(!callbackParam){callbackParam="callback";}
var callbackFunctionName=Sarissa.getFunctionName(callback,true);var id="sarissa_json_script_id_"+Sarissa._getUniqueSuffix();var oHead=document.getElementsByTagName("head")[0];var scriptTag=document.createElement('script');scriptTag.type='text/javascript';scriptTag.id=id;scriptTag.onload=function(){};if(url.indexOf("?")!=-1){url+=("&"+callbackParam+"="+callbackFunctionName);}
else{url+=("?"+callbackParam+"="+callbackFunctionName);}
scriptTag.src=url;oHead.appendChild(scriptTag);return id;};

View File

@ -0,0 +1,34 @@
/* * ====================================================================
* About: This a a compressed JS file from the Sarissa library.
* see http://dev.abiss.gr/sarissa
*
* Copyright: Manos Batsis, http://dev.abiss.gr
*
* Licence:
* Sarissa is free software distributed under the GNU GPL version 2
* or higher, GNU LGPL version 2.1 or higher and Apache Software
* License 2.0 or higher. The licenses are available online see:
* http://www.gnu.org
* http://www.apache.org
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================*/
if(Sarissa._SARISSA_HAS_DOM_FEATURE&&document.implementation.hasFeature("XPath","3.0")){SarissaNodeList=function(i){this.length=i;};SarissaNodeList.prototype=[];SarissaNodeList.prototype.constructor=Array;SarissaNodeList.prototype.item=function(i){return(i<0||i>=this.length)?null:this[i];};SarissaNodeList.prototype.expr="";if(window.XMLDocument&&(!XMLDocument.prototype.setProperty)){XMLDocument.prototype.setProperty=function(x,y){};}
Sarissa.setXpathNamespaces=function(oDoc,sNsSet){oDoc._sarissa_useCustomResolver=true;var namespaces=sNsSet.indexOf(" ")>-1?sNsSet.split(" "):[sNsSet];oDoc._sarissa_xpathNamespaces=[];for(var i=0;i<namespaces.length;i++){var ns=namespaces[i];var colonPos=ns.indexOf(":");var assignPos=ns.indexOf("=");if(colonPos>0&&assignPos>colonPos+1){var prefix=ns.substring(colonPos+1,assignPos);var uri=ns.substring(assignPos+2,ns.length-1);oDoc._sarissa_xpathNamespaces[prefix]=uri;}else{throw"Bad format on namespace declaration(s) given";}}};XMLDocument.prototype._sarissa_useCustomResolver=false;XMLDocument.prototype._sarissa_xpathNamespaces=[];XMLDocument.prototype.selectNodes=function(sExpr,contextNode,returnSingle){var nsDoc=this;var nsresolver;if(this._sarissa_useCustomResolver){nsresolver=function(prefix){var s=nsDoc._sarissa_xpathNamespaces[prefix];if(s){return s;}
else{throw"No namespace URI found for prefix: '"+prefix+"'";}};}
else{nsresolver=this.createNSResolver(this.documentElement);}
var result=null;if(!returnSingle){var oResult=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var nodeList=new SarissaNodeList(oResult.snapshotLength);nodeList.expr=sExpr;for(var i=0;i<nodeList.length;i++){nodeList[i]=oResult.snapshotItem(i);}
result=nodeList;}
else{result=this.evaluate(sExpr,(contextNode?contextNode:this),nsresolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
return result;};Element.prototype.selectNodes=function(sExpr){var doc=this.ownerDocument;if(doc.selectNodes){return doc.selectNodes(sExpr,this);}
else{throw"Method selectNodes is only supported by XML Elements";}};XMLDocument.prototype.selectSingleNode=function(sExpr,contextNode){var ctx=contextNode?contextNode:null;return this.selectNodes(sExpr,ctx,true);};Element.prototype.selectSingleNode=function(sExpr){var doc=this.ownerDocument;if(doc.selectSingleNode){return doc.selectSingleNode(sExpr,this);}
else{throw"Method selectNodes is only supported by XML Elements";}};Sarissa.IS_ENABLED_SELECT_NODES=true;}

View File

@ -0,0 +1,224 @@
/* TREE LAYOUT */
.tree ul {
margin:0 0 0 5px;
padding:0;
list-style-type:none;
}
.tree li {
display:block;
min-height:18px;
line-height:18px;
padding:0 0 0 15px;
margin:0 0 0 0;
clear:both;
}
.tree li ul {
display:none;
clear:both;
}
.tree li a,
.tree li span {
display:inline;
float:left;
line-height:16px;
height:16px;
padding:1px 4px 1px 3px !important;
color:black;
white-space:nowrap;
text-decoration:none;
background-color:transparent;
background-repeat:no-repeat;
background-position:4px 1px;
-moz-border-radius:3px;
border:0;
margin:0;
}
.tree li a:hover,
.tree li a.hover {
background-color: #e7f4f9;
border:1px solid #d8f0fa;
padding:0px 3px 0px 2px !important;
background-position:3px 0px;
}
.tree li a.clicked,
.tree li a.clicked:hover,
.tree li span.clicked {
background-color: #beebff;
border:1px solid #99defd;
padding:0px 3px 0px 2px !important;
background-position:3px 0px;
}
.tree li span.clicked {
padding:0px 3px 0px 0px !important;
}
.tree li a input,
.tree li span input {
margin:0;
padding:0 0;
display:block;
height:12px;
border:1px solid white;
background:white;
font-size:10px;
font-family:Verdana;
}
.tree li a input:not([class="xxx"]),
.tree li span input:not([class="xxx"]) {
padding:1px 0;
}
.locked li a {
color:gray;
}
/* FOR DOTS */
.tree ul ul {
background:url("images/dot.gif") 6px 1px repeat-y;
}
.tree li {
background:url("images/li.gif") 7px center no-repeat;
}
.tree li.last {
background:url("images/lastli.gif") 5px top no-repeat;
background-color:white !important;
}
/* NO DOTS */
.no_dots ul ul {
background:transparent;
}
.no_dots li {
background:transparent;
}
.no_dots li.last {
background:transparent;
background-color:transparent !important;
}
/* OPEN OR CLOSE */
.tree li.open {
background:url("images/fminus.gif") 4px 6px no-repeat;
}
.tree li.open ul {
display:block;
clear:both;
}
.tree li.closed {
background:url("images/fplus.gif") 5px 5px no-repeat;
}
.tree li.closed ul {
display:none !important;
}
/* FOR DRAGGING */
.tree #dragged {
padding:0 3px;
margin:0;
background:white;
opacity: .85;
filter: alpha(opacity=85);
position:absolute;
top:-10px;
left:-10px;
}
.tree #dragged.last,
.tree #dragged:last-child {
background:white;
}
.tree #dragged li.open {
background:url("images/fplus.gif") 5px 5px no-repeat;
}
.tree #dragged ul ul {
display:none;
}
/* HACKY-HACKY */
/* EXPLORER 7 */
*:first-child+html .tree li {
margin-bottom:-2px;
}
*:first-child+html .tree li ul {
padding-bottom:2px;
}
/* EXPLORER 6 */
.tree li {
_width:50%;
_margin-bottom:-2px;
}
.tree li ul {
_padding-bottom:2px;
}
/*
* FF & OPERA FIXES
.tree li:not([class="xxx"]) {
margin-bottom:0px;
}
html:first-child .tree li {
margin-bottom:0px;
}
.tree li ul:not([class="xxx"]) {
padding-bottom:0;
}
html:first-child .tree ul {
padding-bottom:0;
}
*/
/* RTL modification */
.rtl * {
direction:rtl;
}
.rtl ul {
margin:0 5px 0 0;
}
.rtl li {
padding:0 15px 0 0;
}
.rtl li.last {
background:url("images/lastli_rtl.gif") right top no-repeat;
}
.rtl li.open {
background:url("images/fminus_rtl.gif") right 6px no-repeat;
}
.rtl li.closed {
background:url("images/fplus_rtl.gif") right 4px no-repeat;
}
.rtl li a,
.rtl li span {
float:right;
padding:1px 3px 1px 4px !important;
background-position:right 1px;
margin-right:1px;
}
.rtl li a:hover {
background-color: #e7f4f9;
border:1px solid #d8f0fa;
padding:0px 3px 0px 3px !important;
background-position:right 0px;
margin-right:0px;
}
.rtl li a.clicked,
.rtl li a.clicked:hover,
.rtl li span.clicked {
background-color: #beebff;
border:1px solid #99defd;
padding:0px 3px 0px 3px !important;
background-position:right 0px;
margin-right:0px;
}
.rtl li span.clicked {
padding:0px 1px 0px 3px !important;
}
.rtl ul ul {
background:url("images/dot.gif") right 1px repeat-y;
}
.rtl li {
background:url("images/li.gif") right center no-repeat;
}
.rtl #dragged li.open {
background-position: right 5px;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,232 @@
diff -urN jsTree/tree_component.css jsTree-custom/tree_component.css
--- jsTree/tree_component.css 2008-09-28 15:31:30.000000000 -0400
+++ jsTree-custom/tree_component.css 2008-10-13 09:50:29.000000000 -0400
@@ -22,7 +22,7 @@
float:left;
line-height:16px;
height:16px;
- padding:1px 4px 1px 23px !important;
+ padding:1px 4px 1px 3px !important;
color:black;
white-space:nowrap;
text-decoration:none;
@@ -37,7 +37,7 @@
.tree li a.hover {
background-color: #e7f4f9;
border:1px solid #d8f0fa;
- padding:0px 3px 0px 22px !important;
+ padding:0px 3px 0px 2px !important;
background-position:3px 0px;
}
.tree li a.clicked,
@@ -45,11 +45,11 @@
.tree li span.clicked {
background-color: #beebff;
border:1px solid #99defd;
- padding:0px 3px 0px 22px !important;
+ padding:0px 3px 0px 2px !important;
background-position:3px 0px;
}
.tree li span.clicked {
- padding:0px 3px 0px 20px !important;
+ padding:0px 3px 0px 0px !important;
}
.tree li a input,
@@ -190,14 +190,14 @@
.rtl li a,
.rtl li span {
float:right;
- padding:1px 23px 1px 4px !important;
+ padding:1px 3px 1px 4px !important;
background-position:right 1px;
margin-right:1px;
}
.rtl li a:hover {
background-color: #e7f4f9;
border:1px solid #d8f0fa;
- padding:0px 23px 0px 3px !important;
+ padding:0px 3px 0px 3px !important;
background-position:right 0px;
margin-right:0px;
}
@@ -206,12 +206,12 @@
.rtl li span.clicked {
background-color: #beebff;
border:1px solid #99defd;
- padding:0px 23px 0px 3px !important;
+ padding:0px 3px 0px 3px !important;
background-position:right 0px;
margin-right:0px;
}
.rtl li span.clicked {
- padding:0px 21px 0px 3px !important;
+ padding:0px 1px 0px 3px !important;
}
.rtl ul ul {
background:url("images/dot.gif") right 1px repeat-y;
@@ -221,4 +221,4 @@
}
.rtl #dragged li.open {
background-position: right 5px;
-}
\ No newline at end of file
+}
diff -urN jsTree/tree_component.js jsTree-custom/tree_component.js
--- jsTree/tree_component.js 2008-09-21 17:00:41.000000000 -0400
+++ jsTree-custom/tree_component.js 2008-10-13 09:51:48.000000000 -0400
@@ -136,6 +136,7 @@
this.container.addClass("tree").css({ position: "relative" });
if(this.settings.ui.rtl) this.container.addClass("rtl");
if(this.settings.rules.multiple) this.selected_arr = [];
+ this.recent_range = [];
this.offset = this.container.offset();
this.container.css({ position : "" });
if(this.settings.ui.dots == false) this.container.addClass("no_dots");
@@ -236,14 +237,14 @@
str += ">";
if(this.settings.languages.length) {
for(var i = 0; i < this.settings.languages.length; i++) {
- str += "<a href='#' class='" + this.settings.languages[i] + "' ";
+ str += "<a class='" + this.settings.languages[i] + "' ";
if(data.icons && data.icons[this.settings.languages[i]])
str += " style='background-image:url(\"" + data.icons[this.settings.languages[i]] + "\");' ";
str += ">" + data.data[this.settings.languages[i]] + "</a>";
}
}
else {
- str += "<a href='#' ";
+ str += "<a ";
if(data.icons)
str += " style='background-image:url(\"" + data.icons + "\");' ";
str += ">" + data.data + "</a>";
@@ -314,7 +315,7 @@
event.target.blur();
return _this.error("LOCKED");
}
- _this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on"]);
+ _this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on", event.shiftKey]);
if(_this.inp) { _this.inp.blur(); }
event.preventDefault();
event.target.blur();
@@ -704,10 +705,11 @@
if(off_t + 5 < beg_t) this.container.scrollTop(this.container.scrollTop() - (beg_t - off_t + 5) );
if(off_t + h_cor > end_t) this.container.scrollTop(this.container.scrollTop() + (off_t + h_cor - end_t) );
},
- select_branch : function (obj, multiple) {
+ select_branch : function (obj, multiple, ranged,rangechild) {
if(this.locked) return this.error("LOCKED");
if(!obj && this.hovered !== false) obj = this.hovered;
var _this = this;
+ var _obj = obj;
obj = _this.get_node(obj);
if(!obj.size()) return this.error("SELECT: NOT A VALID NODE");
obj.children("a").removeClass("hover");
@@ -716,12 +718,47 @@
if(_this.settings.callback.beforechange.call(null,obj.get(0),_this) === false) return this.error("SELECT: STOPPED BY USER");
// IF multiple AND obj IS ALREADY SELECTED - DESELECT IT
if(this.settings.rules.multiple != false && multiple && obj.children("a.clicked").size() > 0) {
+ if ($(obj).parent().children().index(obj) == $(obj).parent().children().index(this.shiftanchor)) {
+ this.shiftanchor=null;
+ }
return this.deselect_branch(obj);
}
- if(this.settings.rules.multiple != false && multiple) {
+ if(this.settings.rules.multiple != false && multiple) { //Add obj to selected items due to multiple
this.selected_arr.push(obj);
}
- if(this.settings.rules.multiple != false && !multiple) {
+ if (ranged && this.shiftanchor != null) {
+ for (var old_obj in this.recent_range) {
+ this.deselect_branch(this.recent_range[old_obj],1);
+ }
+ this.recent_range=[];
+ var curidx = $(obj).parent().children().index(obj);
+ var previdx = $(obj).parent().children().index(this.shiftanchor);
+ if (curidx >= 0 && previdx >=0) {
+ var firstidx=Math.min(curidx,previdx);
+ var lastidx=Math.max(curidx,previdx);
+ var siblings=$(obj).parent().children();
+ for (var idx = firstidx+1;idx < lastidx; idx++) {
+ if (this.get_node($(siblings[idx])).children("a.clicked").size() == 0) {
+ this.select_branch($(siblings[idx]),1,false,true);
+ }
+ this.recent_range.push(_this.get_node($(siblings[idx])));
+// $(siblings[idx]).children("A").addClass("clicked");
+ }
+ this.selected_arr.push(obj);
+ this.recent_range.push(obj);
+ } /* else { What to do when shift click tries to go somewhere totally different? too hard for now..
+ $("#rangedisplay").text(curidx);
+ } */
+ var sel = window.getSelection();
+ sel.removeAllRanges();
+ } else {
+ if (!rangechild) {
+ this.shiftanchor = obj;
+ this.recent_range=[];
+ this.selected_arr.push(obj);
+ }
+ }
+ if(this.settings.rules.multiple != false && !multiple && !ranged) { //click without ctrl or shift
for(i in this.selected_arr) {
this.selected_arr[i].children("A").removeClass("clicked");
}
@@ -767,11 +804,13 @@
this.selected = this.selected_arr[0];
this.set_cookie("selected");
}
+ this.settings.callback.onchange.call(null, this.selected.get(0), _this);
}
else {
if(this.settings.rules.multiple != false) this.selected_arr = [];
this.selected = false;
this.set_cookie("selected");
+ this.settings.callback.onchange.call(null, null, _this);
}
},
toggle_branch : function (obj) {
@@ -787,7 +826,7 @@
if(this.settings.data.async && obj.find("li").size() == 0) {
var _this = this;
- obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a style='background-image:url(" + _this.path + "images/throbber.gif)' href='#'>" + (_this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
+ obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a>" + (_this.settings.lang.loading || "Loading ...") + "<img src=\""+_this.path+"images/throbber.gif\"></a></li></ul>");
obj.removeClass("closed").addClass("open");
if(this.settings.data.type == "xml_flat" || this.settings.data.type == "xml_nested") {
var xsl = (this.settings.data.type == "xml_flat") ? "flat.xsl" : "nested.xsl";
@@ -857,9 +896,12 @@
}
if(this.selected && obj.children("ul:eq(0)").find("a.clicked").size() > 0) {
obj.find("li:has(a.clicked)").each(function() {
- _this.deselect_branch(this);
+ _this.deselect_branch(this); //Commenting this out could preserve selection on close
+ //I could see this as extremely useful, however it could be easy for someone to trip up
+ //with lack of visual cue... perhaps a semi-shaded style for collapsed if wanting to preserve selection
});
- if(obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
+ //I disagree with the following scheme, that an entire group would be selected just for collapsing a selected child..
+ //if(obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
}
this.settings.callback.onclose.call(null, obj.get(0), this);
},
@@ -939,10 +981,10 @@
if((typeof this.settings.lang.new_node).toLowerCase() != "string" && this.settings.lang.new_node[i]) val = this.settings.lang.new_node[i];
else val = this.settings.lang.new_node;
}
- $li.append("<a href='#' class='" + this.settings.languages[i] + "'>" + val + "</a>");
+ $li.append("<a class='" + this.settings.languages[i] + "'>" + val + "</a>");
}
}
- else { $li.append("<a href='#'>" + (this.settings.lang.new_node || "New folder") + "</a>"); }
+ else { $li.append("<a>" + (this.settings.lang.new_node || "New folder") + "</a>"); }
$li.addClass("leaf");
if(this.settings.rules.createat == "top" || this.selected.children("ul").size() == 0) {
this.moved($li,this.selected.children("a:eq(0)"),"inside", true);
@@ -1203,4 +1245,4 @@
}
}
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,30 @@
var noderange="";
function updatenoderange() {
myselection=nrtree.selected_arr;
noderange="";
for (node in myselection) {
noderange+=myselection[node][0].id;
}
noderange=noderange.substring(1);
}
$(document).ready(function() {
nrtree = new tree_component(); // -Tree begin
nrtree.init($("#nrtree"),{
rules: {
multiple: "Ctrl"
},
ui: {
animation: 250
},
callback : {
onchange : updatenoderange
},
data : {
type : "json",
async : "true",
url: "noderangesource.php"
}
}); //Tree finish
});

View File

@ -62,7 +62,7 @@ then
fi
# Update the apache config
echo "Updating $apachedaemon configuration for xCAT..."
#echo "Updating $apachedaemon configuration for xCAT..."
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-web.conf
/bin/ln -s %{prefix}/web/etc/apache2/conf.d/xcat-web.conf /etc/$apachedaemon/conf.d/xcat-web.conf
/etc/init.d/$apachedaemon reload
@ -82,6 +82,7 @@ then
#echo -e "y\ny\ny" | %{prefix}/share/xcat/scripts/setup-local-client.sh $apacheuser
#XCATROOT=%{prefix} %{prefix}/sbin/chtab priority=5 policy.name=$apacheuser policy.rule=allow
echo "To use xCAT-web, point your browser to http://"`hostname`"/xcat-web"
fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # initial install, or upgrade and this is the newer rpm