Author: tv
Date: Tue Jun 29 19:50:28 2010
New Revision: 959086
URL: http://svn.apache.org/viewvc?rev=959086&view=rev
Log:
Copied docs for copied services
Added:
turbine/core/trunk/xdocs/services/jsonrpc-service.xml (with props)
turbine/core/trunk/xdocs/services/ui-service.xml (with props)
Modified:
turbine/core/trunk/xdocs/navigation.xml
Modified: turbine/core/trunk/xdocs/navigation.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/xdocs/navigation.xml?rev=959086&r1=959085&r2=959086&view=diff
==============================================================================
--- turbine/core/trunk/xdocs/navigation.xml (original)
+++ turbine/core/trunk/xdocs/navigation.xml Tue Jun 29 19:50:28 2010
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?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
@@ -50,6 +50,7 @@
<item name="Factory Service"
href="/services/factory-service.html"/>
<item name="Intake Service" href="/services/intake-service.html"/>
<item name="JSP Service" href="/services/jsp-service.html"/>
+ <item name="JSON-RPC Service"
href="/services/jsonrpc-service.html"/>
<item name="Localization Service"
href="/services/localization-service.html"/>
<item name="Logging Service"
href="/services/logging-service.html"/>
<item name="MimeType Service"
href="/services/mimetype-service.html"/>
@@ -65,6 +66,7 @@
<item name="Template Service"
href="/services/template-service.html"/>
<item name="Torque Security Service"
href="/services/torque-security-service.html"/>
<item name="Torque Security Service Schema"
href="/services/torque-security-schema.html"/>
+ <item name="UI Service" href="/services/ui-service.html"/>
<item name="Unique ID Service"
href="/services/uniqueid-service.html"/>
<item name="Upload Service" href="/services/upload-service.html"/>
<item name="Velocity Service"
href="/services/velocity-service.html"/>
Added: turbine/core/trunk/xdocs/services/jsonrpc-service.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/xdocs/services/jsonrpc-service.xml?rev=959086&view=auto
==============================================================================
--- turbine/core/trunk/xdocs/services/jsonrpc-service.xml (added)
+++ turbine/core/trunk/xdocs/services/jsonrpc-service.xml Tue Jun 29 19:50:28
2010
@@ -0,0 +1,197 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<document>
+
+ <properties>
+ <title>Turbine Services - JSON-RPC Service</title>
+ <author email="[email protected]">Scott Eade</author>
+ </properties>
+
+<body>
+
+<section name="JSON-RPC Service">
+
+<p>
+The JSON-RPC Service supports JavaScript to Java AJAX communications using
+<a href="http://oss.metaparadigm.com/jsonrpc/">JSON-RPC-Java</a>.
+</p>
+
+</section>
+
+<section name="Configuration">
+
+<source><![CDATA[
+# -------------------------------------------------------------------
+#
+# S E R V I C E S
+#
+# -------------------------------------------------------------------
+...
+services.JsonRpcService.classname=org.apache.turbine.services.jsonrpc.TurbineJsonRpcService
+...
+]]></source>
+
+</section>
+
+<section name="Usage">
+
+<p>
+There are a number of things you need to do in order to add AJAX functionality
+to your webapp. First you implement the functions:
+</p>
+
+<source><![CDATA[
+public class MyJsonFunctions
+{
+ public String getHello(String clientParameter)
+ {
+ return "Hello " + clientParameter;
+ }
+ public String getGoodbye(String clientParameter)
+ {
+ return "Goodbye " + clientParameter;
+ }
+}
+]]></source>
+
+<p>
+Next you implement your Screen class to make your functions available:
+</p>
+
+<source><![CDATA[
+public class MyJsonScreen extends JSONScreen
+{
+ public void doOutput(RunData data) throws Exception
+ {
+ MyJsonFunctions myFunctions = new MyJsonFunctions();
+
+ // Session specific
+ TurbineJsonRpc.registerObject(data.getSession(), "myFunctions",
myFunctions);
+
+ // Global
+ //TurbineJsonRpc.registerObjectGlobal("testGlobal", testObject);
+
+ super.doOutput(data);
+ }
+}
+]]></source>
+
+<p>
+Now we shift focus to your template classes. Firstly, there are a few useful
+utility functions that you need to make sure are available to the pages that
+will include AJAX functionality:
+</p>
+
+<source><![CDATA[
+// Body onload utility (supports multiple onload functions)
+function SafeAddOnload(func) {
+ var oldonload = window.onload;
+ if (typeof window.onload != 'function') {
+ window.onload = func;
+ } else {
+ window.onload = function() {
+ oldonload();
+ func();
+ };
+ }
+}
+
+// Prepare for possible JSON-RPC requests.
+// jsonurl must be set before calling this function.
+function jsonOnLoad() {
+ try {
+ jsonrpc = new JSONRpcClient(jsonurl);
+ }
+ catch(e) {
+ if(e.message) {
+ alert(e.message);
+ }
+ else {
+ alert(e);
+ }
+ }
+}
+
+// Process a JSON-RPC request.
+function jsonEval(evalStr) {
+ try {
+ return eval(evalStr);
+ }
+ catch(e) {
+ if(e.javaStack) {
+ alert("Exception: \n\n" + e.javaStack);
+ }
+ else {
+ alert("Exception: \n\n" + e);
+ }
+ }
+ return null;
+}
+]]></source>
+
+<p>
+In these pages you also need to include the JavaScript necessary to process the
+JSON calls - this file is available as part of the JSON-RPC-Java distribution
+(it is included in the <code>webapps\jsonrpc</code> directory):
+</p>
+
+<source><![CDATA[
+$page.addScript($content.getURI('scripts/jsonrpc.js'))
+]]></source>
+
+<p>
+Then you need to set up the specific handler for the page:
+</p>
+
+<source><![CDATA[
+<script type="text/javascript">
+<!--
+ ## Set up the JSON-RPC handler.
+ var jsonurl = '$link.setScreen("MyJsonScreen")';
+ SafeAddOnload(jsonOnLoad);
+ ## myArg below would be provided when you call this function from your
+ ## web page (usually you would retrieve something via the DOM or your
+ ## favorite JavaScript DOM wrapper library).
+ function retrieveHello(myArg) {
+ ## This is a synchronous call.
+ var helloResult = jsonEval("jsonrpc.myFunctions.getHello(" + myArg + ")");
+ if(null == helloResult) {
+ alert('Something went wrong!');
+ return;
+ }
+ ## Here you would again use the DOM to include the result somewhere on your
+ ## page.
+ }
+//-->
+</script>
+]]></source>
+
+<p>
+The above code is executable by users that are not logged into your
application.
+Your Screen class can extend JSONSecureScreen to require that users be logged
in
+before allowing execution.
+</p>
+
+</section>
+
+</body>
+</document>
Propchange: turbine/core/trunk/xdocs/services/jsonrpc-service.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: turbine/core/trunk/xdocs/services/ui-service.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/xdocs/services/ui-service.xml?rev=959086&view=auto
==============================================================================
--- turbine/core/trunk/xdocs/services/ui-service.xml (added)
+++ turbine/core/trunk/xdocs/services/ui-service.xml Tue Jun 29 19:50:28 2010
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<document>
+
+ <properties>
+ <title>Turbine Services - UI Service</title>
+ <author email="[email protected]">Scott Eade</author>
+ </properties>
+
+<body>
+
+<section name="UI Service">
+
+<p>
+The UI (User Interface) Service allows your Turbine application to be skinned
+using simple properties files that are located in the
WEBAPP/resources/ui/skins/
+directory hierarchy.
+</p>
+
+<p>
+The service and its associated pull tool provide the following enhancements
over
+the old UIManager pull tool (which has been deprecated as od Turbine 2.3.3):
+</p>
+<ul>
+<li>Skin properties are shared between all users with lazy loading.</li>
+<li>Non-default skin files inherit properties from the default skin</li>
+<li>Access to skin properties from screen and action classes is now provided
for</li>
+<li>Access is provided to the list of available skins</li>
+</ul>
+
+</section>
+
+<section name="Configuration">
+
+<source><![CDATA[
+# -------------------------------------------------------------------
+#
+# S E R V I C E S
+#
+# -------------------------------------------------------------------
+...
+services.UIService.classname = org.apache.turbine.services.ui.TurbineUIService
+...
+
+# -------------------------------------------------------------------
+#
+# P U L L S E R V I C E
+#
+# -------------------------------------------------------------------
+...
+## session scope allows us to pul the name of the selected skin from user.Temp
+## If you wanted the same skin to apply for all users you could use global
scope.
+tool.session.ui = org.apache.turbine.services.pull.tools.UITool
+tool.ui.skin = default
+...
+]]></source>
+
+<p>
+Skin properties are defined in WEBAPP/resources/ui/skins/, the following might
+exist in a file WEBAPP/resources/ui/skins/default/skin.props:
+</p>
+
+<source><![CDATA[
+checkedImage = check.gif
+checkedImageAltText = Tick
+label_Introduction = Introduction
+l10n_label_introduction = introduction
+]]></source>
+
+<p>
+and the following might
+exist in a file WEBAPP/resources/ui/skins/custom_skin_1/skin.props:
+</p>
+
+<source><![CDATA[
+checkedImage = check-blue.gif
+checkedImageAltText = Blue tick
+label_Introduction = Summary
+l10n_label_introduction = summary
+]]></source>
+
+</section>
+
+<section name="Usage">
+
+<p>
+Retrieving a value from a skin is as simple as (where user.getSkin() returns
the
+name of the currently selected skin):
+</p>
+
+<source><![CDATA[
+TurbineUI.get(user.getSkin(), "label_Introduction")
+]]></source>
+
+<p>
+or in a template (the current skin is retrieved from user.Temp):
+</p>
+
+<source><![CDATA[
+$ui.label_Introduction
+]]></source>
+
+<p>
+Images, css and javascript files are stored under the skin directory also and
+can be accessed thus:
+</p>
+
+<source><![CDATA[
+#set($imageurl = $ui.image($imageName))
+## Filename is skin.css
+#set($cssurl = $ui.getStylecss())
+#set($jsurl = $ui.getScript($filename))
+]]></source>
+
+<p>
+You can retrieve an array containing the names of the available skins thus:
+</p>
+
+<source><![CDATA[
+ String[] availableSkins = TurbineUI.getSkinNames();
+]]></source>
+
+<p>
+or in a template:
+</p>
+
+<source><![CDATA[
+ #set($availablekins = $ui.SkinNames)
+]]></source>
+
+<p>
+You can combine skinning and <a
href="localization-service.html">localization</a>
+thus:
+</p>
+
+<source><![CDATA[
+## Retrieve the localized label_introduction or label_summary depending on the
+## selected skin
+$l10n.get("label_$ui.l10n_label_introduction")
+]]></source>
+
+<p>
+Please refer to the JavaDocs for the org.apache.turbine.services.ui package for
+further details.
+</p>
+
+</section>
+
+<section name="Properties">
+<p>
+You can configure the UI Service using the following properties:
+</p>
+
+<table>
+<tr>
+<th>Property</th>
+<th>Default</th>
+<th>Function</th>
+</tr>
+<tr>
+<td>tool.ui.dir.skin</td>
+<td>/ui/skins</td>
+<td>The name of the skin directory that is to be used for the web
application.</td>
+</tr>
+<tr>
+<td>tool.ui.skin</td>
+<td>default</td>
+<td>The name of the default skin that is to be used for the web
application.</td>
+</tr>
+<tr>
+<td>tool.ui.dir.image</td>
+<td>/images</td>
+<td>The name of the image directory inside the skin that is to be used for the
+ web application.</td>
+</tr>
+<tr>
+<td>tool.ui.css</td>
+<td>skin.css</td>
+<td>The name of the css file that is to be used for the web application.</td>
+</tr>
+
+<tr>
+<td>tool.ui.want.relative</td>
+<td>false</td>
+<td>You can configure the UI Service to return relative links for the web
+ application by setting this to <code>true</code>.</td>
+</tr>
+</table>
+
+<p>
+Note that the name of the file within the skin directory that actually contains
+the name/value pairs for the skin is fixed at <em>skin.props</em>.
+</p>
+
+</section>
+
+</body>
+</document>
Propchange: turbine/core/trunk/xdocs/services/ui-service.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain