You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by it...@apache.org on 2010/01/09 13:39:31 UTC
svn commit: r897435 - in
/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager:
./ src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/
src/main/resour...
Author: ito
Date: Sat Jan 9 12:39:30 2010
New Revision: 897435
URL: http://svn.apache.org/viewvc?rev=897435&view=rev
Log:
scriptmanager using GlobalMenuItemProvider, js improved
Added:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-execution-uri.js
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-overview.js
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/pom.xml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/ScriptManager.java
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-execution-uri-overview.xhtml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-install.xhtml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-list.xhtml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-overview.xhtml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager.js
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/pom.xml?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/pom.xml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/pom.xml Sat Jan 9 12:39:30 2010
@@ -46,6 +46,10 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.platform.typerendering.scalaserverpages</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.platform.graphprovider.content</artifactId>
</dependency>
<dependency>
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/ScriptManager.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/ScriptManager.java?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/ScriptManager.java (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/java/org/apache/clerezza/platform/scripting/scriptmanager/ScriptManager.java Sat Jan 9 12:39:30 2010
@@ -52,7 +52,8 @@
import org.apache.clerezza.jaxrs.utils.form.FormFile;
import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
import org.apache.clerezza.platform.content.DiscobitsHandler;
-import org.apache.clerezza.platform.dashboard.DashBoard;
+import org.apache.clerezza.platform.dashboard.GlobalMenuItem;
+import org.apache.clerezza.platform.dashboard.GlobalMenuItemsProvider;
import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
import org.apache.clerezza.platform.scripting.NoEngineException;
import org.apache.clerezza.platform.scripting.ScriptExecution;
@@ -60,6 +61,7 @@
import org.apache.clerezza.platform.scripting.scriptmanager.ontology.SCRIPTMANAGER;
import org.apache.clerezza.platform.typerendering.RenderletManager;
import org.apache.clerezza.platform.typerendering.seedsnipe.SeedsnipeRenderlet;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
import org.apache.clerezza.rdf.core.BNode;
import org.apache.clerezza.rdf.core.LiteralFactory;
import org.apache.clerezza.rdf.core.MGraph;
@@ -70,6 +72,7 @@
import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
import org.apache.clerezza.rdf.core.impl.TripleImpl;
import org.apache.clerezza.rdf.ontologies.DCTERMS;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
import org.apache.clerezza.rdf.ontologies.RDF;
import org.apache.clerezza.rdf.ontologies.SCRIPT;
import org.apache.clerezza.rdf.utils.GraphNode;
@@ -77,6 +80,11 @@
import org.apache.clerezza.rdf.utils.UnionMGraph;
import org.apache.clerezza.web.fileserver.BundlePathNode;
import org.apache.clerezza.web.fileserver.FileServer;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.scr.annotations.Services;
import org.wymiwyg.commons.util.dirbrowser.PathNode;
/**
@@ -87,46 +95,32 @@
*
* Also enables creating and deleting of execution URIs for scripts.
*
- * @scr.component
- * @scr.service interface="java.lang.Object"
- * @scr.property name="javax.ws.rs" type="Boolean" value="true"
- * @scr.property name="org.apache.clerezza.platform.dashboard.visible" type="Boolean"
- * value="true"
- * @scr.property name="dashboardLabel" type="String" value="Script Manager"
- * description="Specifies the label of the button."
- * @scr.property name="dashBoardMenuOrder" type="Integer" value="1"
- * description="Specifies the order"
- * @scr.property name="dashBoardGroupLabel" type="String" value="Developer-Modules"
- * description="Specifies the the group label"
- * @scr.reference name="cgProvider" cardinality="1..1" policy="static"
- * interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider"
- * @scr.reference name="contentHandler" cardinality="1..1" policy="static"
- * interface="org.apache.clerezza.platform.content.DiscobitsHandler"
- *
* @author daniel, marc
*/
+@Component
+@Services({
+ @Service(value=Object.class),
+ @Service(value=GlobalMenuItemsProvider.class)
+})
+@Property(name="javax.ws.rs", boolValue=true)
@Path("/admin/script-manager")
-public class ScriptManager {
+public class ScriptManager implements GlobalMenuItemsProvider{
private final Logger logger = LoggerFactory.getLogger(getClass());
- /**
- * @scr.reference
- */
- private DashBoard dashBoard;
-
- /**
- * @scr.reference
- */
+ @Reference
private RenderletManager renderletManager;
+
+ @Reference
private ContentGraphProvider cgProvider;
- private FileServer fileServer;
+
+ @Reference
private DiscobitsHandler contentHandler;
- /**
- * @scr.reference
- */
+ @Reference
private ScriptExecution scriptExecution;
+
+ private FileServer fileServer;
/**
* Called when bundle is activated.
@@ -149,25 +143,25 @@
fileServer = new FileServer(pathNode);
URL renderlet = getClass().getResource("scriptmanager-script-overview.xhtml");
- renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+ renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
new UriRef(renderlet.toURI().toString()),
SCRIPTMANAGER.ScriptManagerOverviewPage,
- null, MediaType.APPLICATION_XHTML_XML_TYPE, true);
+ "naked", MediaType.APPLICATION_XHTML_XML_TYPE, true);
renderlet = getClass().getResource("scriptmanager-script-list.xhtml");
renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
new UriRef(renderlet.toURI().toString()),
SCRIPTMANAGER.ScriptList,
"naked" , MediaType.APPLICATION_XHTML_XML_TYPE, true);
renderlet = getClass().getResource("scriptmanager-script-install.xhtml");
- renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+ renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
new UriRef(renderlet.toURI().toString()),
SCRIPTMANAGER.ScriptManagerInstallPage,
- null , MediaType.APPLICATION_XHTML_XML_TYPE, true);
+ "naked" , MediaType.APPLICATION_XHTML_XML_TYPE, true);
renderlet = getClass().getResource("scriptmanager-execution-uri-overview.xhtml");
- renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
+ renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
new UriRef(renderlet.toURI().toString()),
SCRIPTMANAGER.ExecutionUriOverviewPage,
- null , MediaType.APPLICATION_XHTML_XML_TYPE, true);
+ "naked" , MediaType.APPLICATION_XHTML_XML_TYPE, true);
renderlet = getClass().getResource("scriptmanager-execution-uri-list.xhtml");
renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
new UriRef(renderlet.toURI().toString()),
@@ -219,7 +213,9 @@
SCRIPTMANAGER.script,
scriptNode.getNode()));
}
-
+ resultGraph.add(new TripleImpl(resultResource,
+ RDF.type,
+ PLATFORM.HeadedPage));
resultGraph.add(new TripleImpl(resultResource,
RDF.type,
SCRIPTMANAGER.ScriptManagerOverviewPage));
@@ -234,8 +230,7 @@
contentGraph);
}
- return dashBoard.createGraphNodeWithDashBoardMenu(
- resultResource, unionGraph);
+ return new GraphNode(resultResource, unionGraph);
}
/**
@@ -329,6 +324,8 @@
resultGraph.add(new TripleImpl(resultResource,
RDF.type,
SCRIPTMANAGER.ScriptManagerInstallPage));
+ resultGraph.add(new TripleImpl(resultResource,
+ RDF.type, PLATFORM.HeadedPage));
GraphNode languageList = getScriptLanguageList(resultResource);
@@ -337,8 +334,7 @@
UnionMGraph unionGraph = new UnionMGraph(resultGraph,
scriptList.getGraph(), languageList.getGraph(), contentGraph);
- return dashBoard.createGraphNodeWithDashBoardMenu(
- resultResource, unionGraph);
+ return new GraphNode(resultResource, unionGraph);
}
private GraphNode getScriptLanguageList(NonLiteral resource){
@@ -653,6 +649,9 @@
MGraph contentGraph = cgProvider.getContentGraph();
BNode resultResource = new BNode();
MGraph resultGraph = new SimpleMGraph();
+ resultGraph.add(new TripleImpl(resultResource,
+ RDF.type,
+ PLATFORM.HeadedPage));
resultGraph.add(new TripleImpl(resultResource,
RDF.type,
SCRIPTMANAGER.ExecutionUriOverviewPage));
@@ -660,8 +659,7 @@
UnionMGraph unionGraph = new UnionMGraph(resultGraph,
scriptList.getGraph(), contentGraph);
- return dashBoard.createGraphNodeWithDashBoardMenu(
- resultResource, unionGraph);
+ return new GraphNode(resultResource, unionGraph);
}
/**
@@ -815,38 +813,12 @@
return node;
}
- /**
- * Binds the content graph provider.
- *
- * @param cgProvider the {@link ContentGraphProvider}.
- */
- protected void bindCgProvider(ContentGraphProvider cgProvider) {
- this.cgProvider = cgProvider;
- }
- /**
- * Unbinds the content graph provider.
- *
- * @param cgProvider the {@link ContentGraphProvider}.
- */
- protected void unbindCgProvider(ContentGraphProvider cgProvider) {
- this.cgProvider = null;
- }
-
- /**
- * Binds the discobits handler.
- *
- * @param contentHandler the {@link DiscobitsHandler}.
- */
- protected void bindContentHandler(DiscobitsHandler contentHandler) {
- this.contentHandler = contentHandler;
- }
-
- /**
- * Unbinds the discobits handler.
- *
- * @param contentHandler the {@link DiscobitsHandler}.
- */
- protected void unbindContentHandler(DiscobitsHandler contentHandler) {
- this.contentHandler = null;
+ @Override
+ public Set<GlobalMenuItem> getMenuItems() {
+ Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
+
+ items.add(new GlobalMenuItem("/admin/script-manager/", "SCM", "Script Manager", 1,
+ "Dev-Modules"));
+ return items;
}
}
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-execution-uri-overview.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-execution-uri-overview.xhtml?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-execution-uri-overview.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-execution-uri-overview.xhtml Sat Jan 9 12:39:30 2010
@@ -1,71 +1,33 @@
-<?xml version="1.0" encoding="UTF-8"?>
+def sma(s: Any) = new UriRef("http://clerezza.org/2009/07/scriptmanager#"+s)
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("js/scriptmanager.js");
+resultDocModifier.addScriptReference("js/scriptmanager-execution-uri.js");
+resultDocModifier.setTitle("Script Manager");
+resultDocModifier.addNodes2Elem("tx-module", <h1>Script Manager</h1>);
+
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="script-overview">Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="script-install">Install Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Execution URIs</a></li>);
+
+resultDocModifier.addNodes2Elem("tx-module-options", <div id="addExecutionUriForm" style="display:none; float:right;"></div>);
+
+<div id="tx-content">
+ <div class="tx-panel" id="tx-panel">
+ <a href="#" class="tx-panel-open-close tx-icon-left-inverse" id="tx-panel-open-close">open/close</a>
+ <h3>Scripts</h3>
+ <div class="tx-panel-window">
+ <div class="tx-tab"> </div>
+ <div class="tx-panel-detail">
+ <div id="tx-result" class="tx-result">
-<html xmlns="http://www.w3.org/1999/xhtml" id="tx-html">
- <head>
- <title>Script Manager</title>
-
- <link href="/style/style.css" media="screen" rel="stylesheet" type="text/css" />
- ${ns:dhb=http://clerezza.org/2009/06/dashboard#}
- ${ns:sma=http://clerezza.org/2009/07/scriptmanager#}
- <script src="/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="/jquery/jquery.menu.js" type="text/javascript"></script>
- <script src="/jquery/jquery.panel.js" type="text/javascript"></script>
- <script src="js/scriptmanager.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function () {
-
- $('.link').bind("click",function() {
- showInformation($(this).attr('id'));
- });
-
- });
- </script>
-
- </head>
- <body id="tx-body">
- <div id="tx-header">
- <div id="tx-system">
- ${render(dhb:includeDashBoardMenu, "naked")}
- </div>
- <div id="tx-module">
- <h1>Script Manager</h1>
- </div>
-
-
- <div id="tx-module-tabs" class="clearfix">
- <ol id="tx-tabs">
- <li><a href="script-overview">Scripts</a></li>
- <li><a href="script-install">Install Script</a></li>
- <li class="tx-active"><a href="execution-uri-overview">Execution URIs</a></li>
- </ol>
+ {render(res/sma("scriptList") , "naked")}
- <div id="tx-contextual-buttons">
</div>
</div>
- <div id="tx-module-options"><div id="addExecutionUriForm" style="display:none; float:right;"></div>
-
- </div>
</div>
- <div id="tx-content">
- <div class="tx-panel" id="tx-panel">
- <a href="#" class="tx-panel-open-close tx-icon-left-inverse" id="tx-panel-open-close">open/close</a>
- <h3>Scripts</h3>
- <div class="tx-panel-window">
- <div class="tx-tab"> </div>
- <div class="tx-panel-detail">
- <div id="tx-result" class="tx-result">
+ </div>
- ${render(./sma:scriptList , "naked")}
-
- </div>
- </div>
- </div>
- </div>
-
- <div id="tx-list" class="tx-edit tx-show-panel">
- </div>
- </div>
- </body>
-</html>
+ <div id="tx-list" class="tx-edit tx-show-panel">
+ </div>
+</div>
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-install.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-install.xhtml?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-install.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-install.xhtml Sat Jan 9 12:39:30 2010
@@ -1,129 +1,78 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * 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.
- */
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" id="tx-html">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>Script Manager</title>
-
- <link href="/style/style.css" media="screen" rel="stylesheet" type="text/css" />
- ${ns:script=http://clerezza.org/2009/07/script#}
- ${ns:dhb=http://clerezza.org/2009/06/dashboard#}
- ${ns:sma=http://clerezza.org/2009/07/scriptmanager#}
- <script src="/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="/jquery/jquery.menu.js" type="text/javascript"></script>
- <script src="js/scriptmanager.js" type="text/javascript"></script>
-
-
- </head>
- <body id="tx-body">
- <div id="tx-header">
- <div id="tx-system">
- ${render(dhb:includeDashBoardMenu, "naked")}
- </div>
- <div id="tx-module">
- <h1>Script Manager</h1>
-
- </div>
-
- <div id="tx-module-tabs" class="clearfix">
- <ol id="tx-tabs">
- <li><a href="script-overview">Scripts</a></li>
- <li class="tx-active"><a href="script-install">Install Script</a></li>
- <li><a href="execution-uri-overview">Execution URIs</a></li>
- </ol>
+def sma(s: Any) = new UriRef("http://clerezza.org/2009/07/scriptmanager#"+s)
+def script(s: Any) = new UriRef("http://clerezza.org/2009/07/script#"+s)
+
+resultDocModifier.addScriptReference("js/scriptmanager.js");
+resultDocModifier.setTitle("Script Manager");
+resultDocModifier.addNodes2Elem("tx-module", <h1>Script Manager</h1>);
- <div id="tx-contextual-buttons">
- <ol>
- <li><a href="script-overview" class="tx-button tx-button-remove">Cancel</a></li>
- <li><a href="javascript:installScript();" class="tx-button tx-button-create">Install</a></li>
- </ol>
- </div>
- </div >
- <div id="tx-module-options"></div>
- </div>
- <div id="tx-content">
- <div class="tx-panel" id="tx-panel">
- </div>
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="script-overview">Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Install Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="execution-uri-overview">Execution URIs</a></li>);
+
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="cancelButton" class="tx-button tx-button-modify" href="script-overview">Cancel</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-create" href="javascript:installScript();">Install</a></li>);
+
+<div id="tx-content">
+<div class="tx-panel" id="tx-panel">
+</div>
- <div class="tx-list" id ="tx-list">
- <form method="post" id="installform" action="install-script" enctype="multipart/form-data">
- <table>
- <tr>
- <td>
- <label for="scriptLanguage">Script Language:</label>
- </td>
- <td>
- <select name="scriptLanguage" size="1">
- ${loop}
- <option>${./sma:scriptLanguageDescription/script:scriptLanguage} (${./sma:scriptLanguageDescription/script:scriptLanguageVersion})</option>
- ${/loop}
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2" id="choiceCell">
- <input type="radio" name="fileChoice" id="fileButton" value="file" checked="checked" onclick="fileChoiceSelected()" /> Upload a File
- <input type="radio" name="fileChoice" id="textButton" value="text" onclick="fileChoiceSelected()"/> Enter Script<br/>
- </td>
- </tr>
- <tr id="fileRow">
- <td id="fileCellLabel">
- <label for="scriptFile">Script File:</label>
- </td>
- <td id="fileCell">
- <input type="file" name="scriptFile" />
- </td>
- </tr>
- <tr>
- <td>
- <label for="mediaType">Media Type (of the script file):</label>
- </td>
- <td>
- <input type="text" name="mediaType" />
- (optional: Use to enforce a specific media type)
- </td>
- </tr>
- <tr>
- <td>
- <label for="producedType">Media Type of the script output:</label>
- </td>
- <td>
- <input type="text" name="producedType" />
- (optional: ignored if return value is a GraphNode, default: text/plain)
- </td>
- </tr>
- <tr>
- <td>
- <label for="scriptExecutionUri">Execution URI:</label>
- </td>
- <td>
- <input type="text" name="scriptExecutionUri" />
- (optional)
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </body>
-</html>
\ No newline at end of file
+<div class="tx-list" id ="tx-list">
+<form method="post" id="installform" action="install-script" enctype="multipart/form-data">
+ <table>
+ <tr>
+ <td>
+ <label for="scriptLanguage">Script Language:</label>
+ </td>
+ <td>
+ <select name="scriptLanguage" size="1">
+ {for (desc <- (res/sma("scriptLanguageDescription"))) yield {
+ <option>{(desc/script("scriptLanguage")*)} {"(" + (desc/script("scriptLanguageVersion")*) + ")"}</option>
+ }}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" id="choiceCell">
+ <input type="radio" name="fileChoice" id="fileButton" value="file" checked="checked" onclick="fileChoiceSelected()" /> Upload a File
+ <input type="radio" name="fileChoice" id="textButton" value="text" onclick="fileChoiceSelected()"/> Enter Script<br/>
+ </td>
+ </tr>
+ <tr id="fileRow">
+ <td id="fileCellLabel">
+ <label for="scriptFile">Script File:</label>
+ </td>
+ <td id="fileCell">
+ <input type="file" name="scriptFile" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="mediaType">Media Type (of the script file):</label>
+ </td>
+ <td>
+ <input type="text" name="mediaType" />
+ (optional: Use to enforce a specific media type)
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="producedType">Media Type of the script output:</label>
+ </td>
+ <td>
+ <input type="text" name="producedType" />
+ (optional: ignored if return value is a GraphNode, default: text/plain)
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="scriptExecutionUri">Execution URI:</label>
+ </td>
+ <td>
+ <input type="text" name="scriptExecutionUri" />
+ (optional)
+ </td>
+ </tr>
+ </table>
+</form>
+</div>
+</div>
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-list.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-list.xhtml?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-list.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-list.xhtml Sat Jan 9 12:39:30 2010
@@ -3,7 +3,7 @@
<li class="tx-open" id="scripts"><a href="#">Available Scripts</a>
<ol>
${loop}
- <li><a href="#" id="${contains}" class="link">${contains/dct:title}</a></li>
+ <li><a href="#" id="${contains}" class="link">${contains/dct:title}</a></li>
${/loop}
</ol>
</li>
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-overview.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-overview.xhtml?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-overview.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/scriptmanager-script-overview.xhtml Sat Jan 9 12:39:30 2010
@@ -1,86 +1,21 @@
-<!--
-/*
- * 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 id="tx-html" lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
- <head>
- <title>Script Manager</title>
-
- <link href="/style/style.css" media="screen" rel="stylesheet" type="text/css" />
- ${ns:dhb=http://clerezza.org/2009/06/dashboard#}
- ${ns:sma=http://clerezza.org/2009/07/scriptmanager#}
- <script src="/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="/jquery/jquery.menu.js" type="text/javascript"></script>
-
- <script src="/jquery/jquery.panel.js" type="text/javascript"></script>
-
- <script src="js/scriptmanager.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(document).ready(function () {
-
- $('.link').bind("click",function() {
- showInformation($(this).attr('id'));
- });
- ${if sma:script}
- $('.tx-button tx-button-remove').bind("click",function() {
- deleteScript();
- });
- $('.tx-button tx-button-create').bind("click",function() {
- updateScript();
- });
- $('.tx-button tx-button-modify').bind("click",function() {
- executeScript();
- });
- ${/if}
+def sma(s: Any) = new UriRef("http://clerezza.org/2009/07/scriptmanager#"+s)
+
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("js/scriptmanager.js");
+resultDocModifier.addScriptReference("js/scriptmanager-overview.js");
+resultDocModifier.setTitle("Script Manager");
+resultDocModifier.addNodes2Elem("tx-module", <h1>Script Manager</h1>);
+
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="script-install">Install Scripts</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class=""><a href="execution-uri-overview">Execution URIs</a></li>);
+
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove" href="#">Delete</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-create" href="#">Save</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-modify" href="#">Execute</a></li>);
- });
- </script>
- </head>
- <body id="tx-body">
- <div id="tx-header">
- <div id="tx-system">
- ${render(dhb:includeDashBoardMenu, "naked")}
- </div>
- <div id="tx-module">
- <h1>Script Manager</h1>
- </div>
-
- <div id="tx-module-tabs" class="clearfix">
- <ol id="tx-tabs">
- <li class="tx-active"><a href="#">Scripts</a></li>
- <li><a href="script-install">Install Script</a></li>
- <li><a href="execution-uri-overview">Execution URIs</a></li>
- </ol>
-
- <div id="tx-contextual-buttons">
- ${if sma:script}
- <ol>
- <li><a href="#" class="tx-button tx-button-remove">Delete</a></li>
- <li><a href="#" class="tx-button tx-button-create">Save</a></li>
- <li><a href="#" class="tx-button tx-button-modify">Execute</a></li>
- </ol>
- ${/if}
- </div>
- </div>
- <div id="tx-module-options"></div>
- </div>
<div id="tx-content">
+
<div class="tx-panel" id="tx-panel">
<a href="#" class="tx-panel-open-close tx-icon-left-inverse" id="tx-panel-open-close">open/close</a>
<h3>Scripts</h3>
@@ -89,18 +24,18 @@
<div class="tx-panel-detail">
<div id="tx-result" class="tx-result">
- ${render(sma:scriptList , "naked")}
+ {render(res/sma("scriptList") , "naked")}
</div>
</div>
</div>
</div>
<div class="tx-edit tx-show-panel" id="tx-list">
- ${if sma:script}
- ${render(sma:script, "naked")}
- ${/if}
+ {if (!((res/sma("script")*).equals(""))) {
+ render(res/sma("script"), "naked")
+ } else {
+ <div></div>
+ }}
</div>
</div>
- </body>
-</html>
Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-execution-uri.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-execution-uri.js?rev=897435&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-execution-uri.js (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-execution-uri.js Sat Jan 9 12:39:30 2010
@@ -0,0 +1,6 @@
+$(document).ready(function () {
+ $('.link').live("click",function() {
+ showInformation($(this).attr('id'));
+ });
+
+});
Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-overview.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-overview.js?rev=897435&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-overview.js (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager-overview.js Sat Jan 9 12:39:30 2010
@@ -0,0 +1,24 @@
+$(document).ready(function () {
+ getQueryParam("script");
+
+ $('.link').live("click",function() {
+ showInformation($(this).attr('id'));
+
+ });
+
+ $('#deleteButton').bind("click",function() {
+ if(ACTUALSCRIPT != null) {
+ deleteScript();
+ }
+ });
+ $('#editButton').bind("click",function() {
+ if(ACTUALSCRIPT != null) {
+ updateScript();
+ }
+ });
+ $('#addButton').bind("click",function() {
+ if(ACTUALSCRIPT != null) {
+ executeScript();
+ }
+ });
+});
Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager.js?rev=897435&r1=897434&r2=897435&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager.js (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.scripting.scriptmanager/src/main/resources/org/apache/clerezza/platform/scripting/scriptmanager/staticweb/js/scriptmanager.js Sat Jan 9 12:39:30 2010
@@ -4,15 +4,16 @@
setActualScript(script);
var url = document.location.href;
if(url.indexOf("execution-uri-overview") != -1){
+ statusMessage.add("load-execution-uri", "loading execution uri");
$("#tx-list").load("./get-execution-uri?script="+script+"&mode=naked", function(){
+ statusMessage.remove("load-execution-uri");
showExecutionUriTabActions();
});
} else if(url.indexOf("script-overview") != -1){
- $("#tx-list").load("./get-script?script="+script+"&mode=naked");
- $('#tx-contextual-buttons').empty();
- $('#tx-contextual-buttons').append('<ol><li><a href="javascript:deleteScript();" class="tx-button tx-button-remove">Delete</a></li>'+
- '<li><a href="javascript:updateScript();" class="tx-button tx-button-create">Save</a></li>'+
- '<li><a href="javascript:executeScript();" class="tx-button tx-button-modify">Execute</a></li></ol>');
+ statusMessage.add("get-scripts", "loading scripts");
+ $("#tx-list").load("./get-script?script="+script+"&mode=naked", function() {
+ statusMessage.remove("get-scripts");
+ });
}
}
@@ -40,21 +41,35 @@
ACTUALSCRIPT = script;
}
+function getQueryParam(name) {
+
+ var query = window.location.search.substring(1);
+ var parms = query.split('&');
+ for (var i=0; i<parms.length; i++) {
+ var pos = parms[i].indexOf('=');
+ if (pos > 0) {
+ var key = parms[i].substring(0,pos);
+ if(key == name) {
+ setActualScript(parms[i].substring(pos+1));
+ break;
+ }
+ }
+ }
+}
+
function updateScript(){
$("#updateform").submit();
}
function deleteScript(){
- $.ajax({
- type: "POST",
- url: "./delete",
- data: "script="+$('#scriptUri').val(),
- success: function(msg){
- $("#tx-list").empty();
- $('#tx-contextual-buttons').empty();
- $("#tx-result").load("./script-list?mode=naked");
- }
- });
+ var options = new AjaxOptions("delete-script", "deleting script", function(obj) {
+ $("#tx-list").empty();
+ $("#tx-result").load("./script-list?mode=naked");
+ });
+ options.type = "POST"
+ options.url = "delete";
+ options.data = "script=" + encodeURIComponent(ACTUALSCRIPT);
+ $.ajax(options);
}
function installScript(){
@@ -62,17 +77,15 @@
}
function executeScript(){
- $.ajax({
- type: "GET",
- url: "./execute",
- data: "script="+$('#scriptUri').val(),
- success: function(e) {
- $('#scriptConsole').empty();
- $('#scriptConsole').append('<h4>Script Output</h4><pre>'
- +e+'</pre>');
- $('#scriptConsole').slideDown('slow');
- }
- });
+ var options = new AjaxOptions("execute-script", "executing script", function(obj) {
+ $('#scriptConsole').empty();
+ $('#scriptConsole').append('<h4>Script Output</h4><pre>'
+ +obj+'</pre>');
+ $('#scriptConsole').slideDown('slow');
+ });
+ options.url = "execute";
+ options.data = "script=" + encodeURIComponent(ACTUALSCRIPT);
+ $.ajax(options);
}
function showAddExecutionUriForm(){
@@ -86,33 +99,31 @@
function deleteExecutionUris(){
$(':checked').each(
function() {
- $.ajax({
- type: "POST",
- url: "./delete-executionUri",
- data: "executionUri="+$(this).val()+"&scriptUri="+ACTUALSCRIPT,
- success: function(e) {
- $("#tx-list").load("./get-execution-uri?script="+ACTUALSCRIPT+"&mode=naked", function(){
+ var options = new AjaxOptions("delete-execution-uri", "deleting execution uri", function(obj) {
+ $("#tx-list").load("./get-execution-uri?script="+ACTUALSCRIPT+"&mode=naked", function(){
showExecutionUriTabActions();
});
- }
- });
+ });
+ options.type = "POST"
+ options.url = "delete-executionUri";
+ options.data = "executionUri="+$(this).val()+"&scriptUri="+encodeURIComponent(ACTUALSCRIPT);
+ $.ajax(options);
}
);
}
function addExecutionUri(){
var serialized = $('#addExecutionUri').serialize();
- $.ajax({
- type: "POST",
- url: "./add-execution-uri",
- data: serialized,
- success: function(msg) {
- $('#addExecutionUriForm').slideUp('slow');
- $("#tx-list").load("./get-execution-uri?script="+$('#scriptUri').val()+"&mode=naked", function(){
- showExecutionUriTabActions();
+ var options = new AjaxOptions("add-execution-uri", "saving execution uri", function(obj) {
+ $('#addExecutionUriForm').slideUp('slow');
+ $("#tx-list").load("./get-execution-uri?script="+$('#scriptUri').val()+"&mode=naked", function(){
+ showExecutionUriTabActions();
+ });
});
- }
- });
+ options.type = "POST"
+ options.url = "add-execution-uri";
+ options.data = serialized;
+ $.ajax(options);
}
function fileChoiceSelected() {