You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by bu...@apache.org on 2015/02/13 19:12:20 UTC

svn commit: r940067 [3/3] - in /websites/staging/vcl/trunk/content: ./ docs/xmlrpcWrappers_8php.html docs/xmlrpc__example_8php-example.html docs/xmlrpcdocs.css

Added: websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html
==============================================================================
--- websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html (added)
+++ websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html Fri Feb 13 18:12:20 2015
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+<title>VCL XML RPC: xmlrpc_example.php</title>
+<link href="xmlrpcdocs.css" rel="stylesheet" type="text/css" />
+</head><body>
+<!-- Generated by Doxygen 1.5.5 -->
+<div class="contents">
+<h1>xmlrpc_example.php</h1><div class="fragment"><pre class="fragment">&lt;?php
+<span class="comment">/*</span>
+<span class="comment">  Licensed to the Apache Software Foundation (ASF) under one or more</span>
+<span class="comment">  contributor license agreements.  See the NOTICE file distributed with</span>
+<span class="comment">  this work for additional information regarding copyright ownership.</span>
+<span class="comment">  The ASF licenses this file to You under the Apache License, Version 2.0</span>
+<span class="comment">  (the "License"); you may not use this file except in compliance with</span>
+<span class="comment">  the License.  You may obtain a copy of the License at</span>
+<span class="comment"></span>
+<span class="comment">      http://www.apache.org/licenses/LICENSE-2.0</span>
+<span class="comment"></span>
+<span class="comment">  Unless required by applicable law or agreed to in writing, software</span>
+<span class="comment">  distributed under the License is distributed on an "AS IS" BASIS,</span>
+<span class="comment">  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
+<span class="comment">  See the License for the specific language governing permissions and</span>
+<span class="comment">  limitations under the License.</span>
+<span class="comment">*/</span>
+
+session_start();
+
+$url = <span class="stringliteral">"http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=test\"&gt;Test&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=listimages\"&gt;List Available Images&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=addrequest\"&gt;Add request for Maple 10&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=requeststatus\"&gt;Get status of request&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=connectdata\"&gt;Get connection data&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=endrequest\"&gt;End request&lt;/a&gt;&lt;br&gt;\n"</span>;
+
+print <span class="stringliteral">"&lt;pre&gt;\n"</span>;
+
+<span class="comment">// test</span>
+<span class="keywordflow">if</span>($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'test'</span>) {
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCtest'</span>, array(<span class="stringliteral">'foo'</span>));
+        print_r($rc);
+}
+<span class="comment">// list images</span>
+elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'listimages'</span>) {
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetImages'</span>, array());
+        print_r($rc);
+}
+<span class="comment">// add request</span>
+elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'addrequest'</span>) {
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCaddRequest'</span>, array(98, <span class="stringliteral">'now'</span>, 60));
+        <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'success'</span>) {
+                print <span class="stringliteral">"request id is {$rc['requestid']}&lt;br&gt;\n"</span>;
+                $_SESSION[<span class="stringliteral">'requestid'</span>] = $rc[<span class="stringliteral">'requestid'</span>];
+        }
+        <span class="keywordflow">else</span> {
+                print_r($rc);
+        }
+}
+<span class="comment">// get request status</span>
+elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'requeststatus'</span>) {
+        <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) {
+                print <span class="stringliteral">"no request created&lt;br&gt;\n"</span>;
+                exit;
+        }
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetRequestStatus'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>]));
+        print <span class="stringliteral">"current status of request {$_SESSION['requestid']} is {$rc['status']}"</span>;
+}
+<span class="comment">// get connection data</span>
+elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'connectdata'</span>) {
+        <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) {
+                print <span class="stringliteral">"no request created&lt;br&gt;\n"</span>;
+                exit;
+        }
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetRequestConnectData'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>], $_SERVER[<span class="stringliteral">"REMOTE_ADDR"</span>]));
+        <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'ready'</span>)
+                print_r($rc);
+        <span class="keywordflow">else</span>
+                print <span class="stringliteral">"status of request is {$rc['status']}"</span>;
+}
+<span class="comment">// end request</span>
+elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'endrequest'</span>) {
+        <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) {
+                print <span class="stringliteral">"no request created&lt;br&gt;\n"</span>;
+                exit;
+        }
+        $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCendRequest'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>]));
+        <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'error'</span>)
+                print_r($rc);
+        <span class="keywordflow">else</span> {
+                print <span class="stringliteral">"request ended&lt;br&gt;\n"</span>;
+                unset($_SESSION[<span class="stringliteral">'requestid'</span>]);
+        }
+}
+print <span class="stringliteral">"&lt;/pre&gt;\n"</span>;
+
+function remoteVCLCall($method, $args) {
+        $request = xmlrpc_encode_request($method, $args);
+        $header  = <span class="stringliteral">"Content-Type: text/xml\r\n"</span>;
+        $header .= <span class="stringliteral">"X-User: userid\r\n"</span>;    <span class="comment">// user your userid here</span>
+        $header .= <span class="stringliteral">"X-Pass: password\r\n"</span>;  <span class="comment">// user your password here</span>
+        $header .= <span class="stringliteral">"X-APIVERSION: 1"</span>;       <span class="comment">// this is to allow for future changes to the api</span>
+        $context = stream_context_create(
+                array(
+                        <span class="stringliteral">'http'</span> =&gt; array(
+                                <span class="stringliteral">'method'</span> =&gt; <span class="stringliteral">"POST"</span>,
+                                <span class="stringliteral">'header'</span> =&gt; $header,
+                                <span class="stringliteral">'content'</span> =&gt; $request
+                        )
+                )
+        );
+        $file = file_get_contents(<span class="stringliteral">"https://vcl.ncsu.edu/scheduling/index.php?mode=xmlrpccall"</span>, <span class="keyword">false</span>, $context);
+        $response = xmlrpc_decode($file);
+        <span class="keywordflow">if</span>(xmlrpc_is_fault($response)) {
+                trigger_error(<span class="stringliteral">"xmlrpc: {$response['faultString']} ({$response['faultCode']})"</span>);
+                exit;
+        }
+        <span class="keywordflow">return</span> $response;
+}
+?&gt;
+</pre></div> </div>
+<hr size="1"><address style="text-align: right;"><small>Generated on Wed May 20 10:32:08 2009 for VCL XML RPC by&nbsp;
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
+</body>
+</html>

Added: websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css
==============================================================================
--- websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css (added)
+++ websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css Fri Feb 13 18:12:20 2015
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+body {
+	font-family: Tahoma, Geneva, sans-serif;
+	font-size: 1.1em;
+}
+
+a {
+	text-decoration: none;
+	color: #3d3d82;
+}
+
+h2 {
+	color: #3d3d82;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+#projectname {
+	font-size: 3em;
+	font-weight: bold;
+}
+
+.summary {
+	padding-top: 3px;
+	float: right;
+}
+
+.title {
+	border-top: 1px solid;
+	font-size: 2em;
+	font-weight: bold;
+	padding: 5px 0 0 10px;
+}
+
+.groupheader {
+	color: #3d3d82;
+	font-size: 1.6em;
+	font-weight: normal;
+	border-bottom: 1px solid;
+}
+
+.memberdecls {
+	border-collapse: separate;
+	border-spacing: 0 0;
+}
+
+.memItemLeft,
+.mdescLeft {
+	padding-left: 15px;
+	background-color: #f8f8f8;
+}
+
+.memItemRight {
+	background-color: #f8f8f8;
+}
+
+.memItemRight a {
+	font-weight: bold;
+}
+
+.mdescRight {
+	line-height: 160%;
+	background-color: #f8f8f8;
+}
+
+.memSeparator {
+	font-size: 5px;
+	background-color: #f8f8f8;
+	border-bottom: 1px solid #ccc;
+}
+
+.memitem {
+	border: 1px solid #3d3d82;
+	border-radius: 5px;
+	margin-bottom: 10px;
+}
+
+.memproto {
+	background-color: #d1d7f6;
+	padding: 5px 5px 0 5px;
+	border-radius: 5px 5px 0 0;
+}
+
+.memdoc {
+	padding: 0 5px 5px 5px;
+}
+
+td.memname {
+	font-weight: bold;
+	color: #3d3d82;
+}
+
+dt {
+	font-weight: bold;
+}
+
+.paramname {
+	color: #6c2b32;
+	font-weight: bold;
+}
+
+div.fragment {
+	border: 1px solid #b5baff;
+	border-radius: 8px;
+	padding: 8px;
+	background-color: #f8f8f8;
+}
+
+.comment {
+	color: blue;
+}
+
+.stringliteral {
+	color: #95181a;
+}
+
+.keywordflow {
+	color: #dc821b;
+}