Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/main.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/main.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/main.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/main.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,90 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title><decorator:title default="ServiceMix Console" /></title> + <style type="text/css" media="screen"> + @import url(<c:url value="/styles/style.css"/>); + @import url(<c:url value="/styles/sorttable.css"/>); + </style> + <c:if test="${!disableJavaScript}"> + <script type='text/javascript' src='<c:url value="/js/common.js"/>'/> + <script type='text/javascript' src='<c:url value="/js/css.js"/>'/> + <script type='text/javascript' src='<c:url value="/js/standardista-table-sorting.js"/>'/> + </c:if> + + <decorator:head /> +</head> + +<body> + +<div id="wrapper-menu-top"> + <div id="menu-top"> + </div> + <!--menu-top--> +</div> +<!--wrapper-menu-top--> + +<div id="wrapper-header"> + <div id="header"> + <div id="wrapper-header2"> + <div id="wrapper-header3"> + <div id="wrapper-header4"> + <div><div>ServiceMix Console</div></div> + </div> + </div> + </div> + </div> +</div> + +<div id="wrapper-content"> + <div id="wrapper-menu-page"> + <div id="menu-page"> + <ul> + <li><a href="<c:url value='/index.jsp'/>" title="Home<"><span>Home</span></a></li> + <li><a href="<c:url value='/services.jsp'/>" title="Services"><span>Services</span></a></li> + <li><a href="<c:url value='/components.jsp'/>" title="Components"><span>Components</span></a></li> + <li><a href="<c:url value='/shared-libraries.jsp'/>" title="Shared Libraries"><span>Shared Libraries</span></a></li> + <li><a href="<c:url value='/service-assemblies.jsp'/>" title="Service Assemblies"><span>Service Assemblies</span></a></li> + <li><a href="<c:url value='/service-units.jsp'/>" title="Service Units"><span>Service Units</span></a></li> + <li><a href="<c:url value='/endpoints.jsp'/>" title="Endpoints"><span>Endpoints</span></a></li> + <li><a href="<c:url value='/audit.jsp'/>" title="Audit"><span>Audit</span></a></li> + </ul> + <br/> + <br/> + <br/> + <small>© 2006 The Apache Software Foundation</small> + </div> + </div> + + <div id="content"> + <decorator:body/> + + </div> +</div> + +<div id="wrapper-footer"> + <div id="footer"> + </div> + +</div> + +</body> +</html> +
Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/panel.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/panel.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/panel.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/panel.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,31 @@ +<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<p> + <table border="0" cellpadding="0" cellspacing="0"> + <tr> + <th class="panelTitle"> + <decorator:title default="Unknown panel" /> + </th> + </tr> + <tr> + <td class="panelBody"> + <decorator:body /> + </td> + </tr> + </table> +</p> Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/printable.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/printable.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/printable.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/decorators/printable.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,31 @@ +<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> + +<html> + <head> + <title><decorator:title default="Welcome!" /></title> + <decorator:head /> + </head> + + <body onload="window.print();"> + Printed on <%=new java.util.Date()%>.<br/> + <hr noshade="noshade" size="1"/> + <br/> + <decorator:body /> + </body> +</html> Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoint.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoint.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoint.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoint.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,47 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<html> +<head> +<title>Endpoint ${requestContext.endpoint.name}</title> +</head> +<body> + +<h2>Endpoint ${requestContext.endpoint.name}</h2> + +<fieldset> + <legend>Endpoint detail</legend> + <table> + <tbody> + <tr> + <td>Name</td> + <td><div class="field">${requestContext.endpoint.name}</div></td> + </tr> + <tr> + <td>Type</td> + <td><div class="field">${requestContext.endpoint.type}</div></td> + </tr> + <tr> + <td>Component</td> + <td><div class="field"><a href="component.jsp?name=${requestContext.endpoint.component.name}">${requestContext.endpoint.component.name}</a></div></td> + </tr> + </tbody> + </table> +</fieldset> + +</body> +</html> + Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoints.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoints.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoints.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/endpoints.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,45 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<html> +<head> +<title>Endpoints</title> +</head> +<body> +<h2>Endpoints</h2> + +<table id="endpoints" class="sortable autostripe"> + <thead> + <tr> + <th>Name</th> + <th>Type</th> + <th>Component</th> + </tr> + </thead> + <tbody> + <c:forEach items="${requestContext.endpoints}" var="row"> + <tr> + <td><a href="endpoint.jsp?name=${row.name}">${row.name}</a></td> + <td>${row.type}</td> + <td><a href="component.jsp?name=${row.component.name}">${row.component.name}</a></td> + </tr> + </c:forEach> + </tbody> +</table> + +</body> +</html> + Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/error.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/error.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/error.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/error.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,37 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page isErrorPage="true" %> +<%@ taglib uri="WEB-INF/tags/sitemesh-page.tld" prefix="page" %> +<%@ page import="java.io.*" %> +<html> +<head> +<title>Error</title> +</head> +<body> +<page:applyDecorator name="main"> + <h3>Server error</h3> + <div id="error"><pre><% + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + exception.printStackTrace(pw); + pw.close(); + String str = sw.toString(); + out.write(str.replace("<", "<")); + %></pre></div> +</page:applyDecorator> +</body> +</html> Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/Thumbs.db URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/Thumbs.db?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/Thumbs.db ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-left.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-left.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-left.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-right.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-right.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-blue-right.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-left.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-left.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-left.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-right.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-right.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-right.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-left.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-left.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-left.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-right.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-right.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/bg02-white-right.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-bc.gif URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-bc.gif?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-bc.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-pojo.gif URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-pojo.gif?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-pojo.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-se.gif URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-se.gif?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/comp-type-se.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menu.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menu.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menu.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuleft.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuleft.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuleft.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuright.png URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuright.png?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/menuright.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/servicemix.jpg URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/servicemix.jpg?view=auto&rev=467601 ============================================================================== Binary file - no diff available. Propchange: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/images/servicemix.jpg ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/index.jsp URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/index.jsp?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/index.jsp (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/index.jsp Wed Oct 25 03:59:16 2006 @@ -0,0 +1,34 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<html> +<head> +<title>ServiceMix Console</title> +</head> +<body> + +<h2>Welcome!</h2> + +<p> +Welcome to the ServiceMix Console +</p> + +<p> +You can find more information about ServiceMix on the <a href="http://incubator.apache.org/servicemix/">Apache ServiceMix Site</a> +</p> +</body> +</html> + Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/common.js URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/common.js?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/common.js (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/common.js Wed Oct 25 03:59:16 2006 @@ -0,0 +1,108 @@ +/** + * This software is licensed under the Creative Commons Licence 2.5 + * http://creativecommons.org/licenses/by/2.5/ + * + * addEvent written by Dean Edwards, 2005 + * with input from Tino Zijdel + * + * http://dean.edwards.name/weblog/2005/10/add-event/ + **/ +function addEvent(element, type, handler) { + // assign each event handler a unique ID + if (!handler.$$guid) handler.$$guid = addEvent.guid++; + // create a hash table of event types for the element + if (!element.events) element.events = {}; + // create a hash table of event handlers for each element/event pair + var handlers = element.events[type]; + if (!handlers) { + handlers = element.events[type] = {}; + // store the existing event handler (if there is one) + if (element["on" + type]) { + handlers[0] = element["on" + type]; + } + } + // store the event handler in the hash table + handlers[handler.$$guid] = handler; + // assign a global event handler to do all the work + element["on" + type] = handleEvent; +}; +// a counter used to create unique IDs +addEvent.guid = 1; + +function removeEvent(element, type, handler) { + // delete the event handler from the hash table + if (element.events && element.events[type]) { + delete element.events[type][handler.$$guid]; + } +}; + +function handleEvent(event) { + var returnValue = true; + // grab the event object (IE uses a global event object) + event = event || fixEvent(window.event); + // get a reference to the hash table of event handlers + var handlers = this.events[event.type]; + // execute each event handler + for (var i in handlers) { + this.$$handleEvent = handlers[i]; + if (this.$$handleEvent(event) === false) { + returnValue = false; + } + } + return returnValue; +}; + +function fixEvent(event) { + // add W3C standard event methods + event.preventDefault = fixEvent.preventDefault; + event.stopPropagation = fixEvent.stopPropagation; + return event; +}; +fixEvent.preventDefault = function() { + this.returnValue = false; +}; +fixEvent.stopPropagation = function() { + this.cancelBubble = true; +}; + +// end from Dean Edwards + + +/** + * Creates an Element for insertion into the DOM tree. + * From http://simon.incutio.com/archive/2003/06/15/javascriptWithXML + * + * @param element the element type to be created. + * e.g. ul (no angle brackets) + **/ +function createElement(element) { + if (typeof document.createElementNS != 'undefined') { + return document.createElementNS('http://www.w3.org/1999/xhtml', element); + } + if (typeof document.createElement != 'undefined') { + return document.createElement(element); + } + return false; +} + +/** + * "targ" is the element which caused this function to be called + * from http://www.quirksmode.org/js/events_properties.html + **/ +function getEventTarget(e) { + var targ; + if (!e) { + e = window.event; + } + if (e.target) { + targ = e.target; + } else if (e.srcElement) { + targ = e.srcElement; + } + if (targ.nodeType == 3) { // defeat Safari bug + targ = targ.parentNode; + } + + return targ; +} + Added: incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/css.js URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/css.js?view=auto&rev=467601 ============================================================================== --- incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/css.js (added) +++ incubator/servicemix/trunk/servicemix-web-console/src/main/webapp/js/css.js Wed Oct 25 03:59:16 2006 @@ -0,0 +1,145 @@ +/** + * Written by Neil Crosby. + * http://www.workingwith.me.uk/ + * + * Use this wherever you want, but please keep this comment at the top of this file. + * + * Copyright (c) 2006 Neil Crosby + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * 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. + **/ +var css = { + /** + * Returns an array containing references to all elements + * of a given tag type within a certain node which have a given class + * + * @param node the node to start from + * (e.g. document, + * getElementById('whateverStartpointYouWant') + * ) + * @param searchClass the class we're wanting + * (e.g. 'some_class') + * @param tag the tag that the found elements are allowed to be + * (e.g. '*', 'div', 'li') + **/ + getElementsByClass : function(node, searchClass, tag) { + var classElements = new Array(); + var els = node.getElementsByTagName(tag); + var elsLen = els.length; + var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); + + + for (var i = 0, j = 0; i < elsLen; i++) { + if (this.elementHasClass(els[i], searchClass) ) { + classElements[j] = els[i]; + j++; + } + } + return classElements; + }, + + + /** + * PRIVATE. Returns an array containing all the classes applied to this + * element. + * + * Used internally by elementHasClass(), addClassToElement() and + * removeClassFromElement(). + **/ + privateGetClassArray: function(el) { + return el.className.split(' '); + }, + + /** + * PRIVATE. Creates a string from an array of class names which can be used + * by the className function. + * + * Used internally by addClassToElement(). + **/ + privateCreateClassString: function(classArray) { + return classArray.join(' '); + }, + + /** + * Returns true if the given element has been assigned the given class. + **/ + elementHasClass: function(el, classString) { + if (!el) { + return false; + } + + var regex = new RegExp('\\b'+classString+'\\b'); + if (el.className.match(regex)) { + return true; + } + + return false; + }, + + /** + * Adds classString to the classes assigned to the element with id equal to + * idString. + **/ + addClassToId: function(idString, classString) { + this.addClassToElement(document.getElementById(idString), classString); + }, + + /** + * Adds classString to the classes assigned to the given element. + * If the element already has the class which was to be added, then + * it is not added again. + **/ + addClassToElement: function(el, classString) { + var classArray = this.privateGetClassArray(el); + + if (this.elementHasClass(el, classString)) { + return; // already has element so don't need to add it + } + + classArray.push(classString); + + el.className = this.privateCreateClassString(classArray); + }, + + /** + * Removes the given classString from the list of classes assigned to the + * element with id equal to idString + **/ + removeClassFromId: function(idString, classString) { + this.removeClassFromElement(document.getElementById(idString), classString); + }, + + /** + * Removes the given classString from the list of classes assigned to the + * given element. If the element has the same class assigned to it twice, + * then only the first instance of that class is removed. + **/ + removeClassFromElement: function(el, classString) { + var classArray = this.privateGetClassArray(el); + + for (x in classArray) { + if (classString == classArray[x]) { + classArray[x] = ''; + break; + } + } + + el.className = this.privateCreateClassString(classArray); + } +} \ No newline at end of file
