OSDN Git Service

Add: tutorial for PIONE about Interaction API. v2.0.2p0076
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Tue, 16 Dec 2014 05:54:03 +0000 (14:54 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Tue, 16 Dec 2014 05:54:03 +0000 (14:54 +0900)
new file:   SampleCode/PIONE/Basic9/Annotation.pione
new file:   SampleCode/PIONE/Basic9/Interaction.pione
new file:   SampleCode/PIONE/Basic9/Main.pione
new file:   SampleCode/PIONE/Basic9/bin/list.cgi
new file:   SampleCode/PIONE/Basic9/etc/Index.html

SampleCode/PIONE/Basic9/Annotation.pione [new file with mode: 0644]
SampleCode/PIONE/Basic9/Interaction.pione [new file with mode: 0644]
SampleCode/PIONE/Basic9/Main.pione [new file with mode: 0644]
SampleCode/PIONE/Basic9/bin/list.cgi [new file with mode: 0644]
SampleCode/PIONE/Basic9/etc/Index.html [new file with mode: 0644]

diff --git a/SampleCode/PIONE/Basic9/Annotation.pione b/SampleCode/PIONE/Basic9/Annotation.pione
new file mode 100644 (file)
index 0000000..a42d720
--- /dev/null
@@ -0,0 +1,3 @@
+.@ PackageName :: "FileOperation"
+.@ Editor              :: "Kinoshita"
+.@ Tag                 :: "v0.1.0"
diff --git a/SampleCode/PIONE/Basic9/Interaction.pione b/SampleCode/PIONE/Basic9/Interaction.pione
new file mode 100644 (file)
index 0000000..965793b
--- /dev/null
@@ -0,0 +1,13 @@
+Rule Interaction
+       output '*.*'.all
+Action
+       # build public directory for pione-interactive
+       mkdir public
+       cp etc/* public
+       cp bin/* public
+
+       # start interactive operation
+       pione-interactive browser --public public
+
+       cp public/* .
+End
diff --git a/SampleCode/PIONE/Basic9/Main.pione b/SampleCode/PIONE/Basic9/Main.pione
new file mode 100644 (file)
index 0000000..aceb04f
--- /dev/null
@@ -0,0 +1,5 @@
+Rule Main
+       output '*.txt'.all
+Flow
+       rule Interaction
+End
diff --git a/SampleCode/PIONE/Basic9/bin/list.cgi b/SampleCode/PIONE/Basic9/bin/list.cgi
new file mode 100644 (file)
index 0000000..69b7a3a
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+strHTML = ""
+
+strHTML += <<'Block-HTML'
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>CGIページ</title>
+       </head>
+       <body>
+               <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
+               <div id="textDiv"></div>
+               <script type="text/javascript">
+                       var div = document.getElementById("textDiv");
+                       div.textContent = "";
+                       $.getJSON("./", {"pione-action": "list"}, function(data){
+                               $.each(data, function(file) {
+                                       div.textContent += this.name +"\n";
+                               });
+                       });
+               </script>
+               <a href="Index.html">戻る</a>
+               <br>
+               <br>
+               <a href="?pione-action=finish">終了</a>
+       </body>
+</html>
+Block-HTML
+
+# Output as html
+cgi.out(type: "text/html") do
+       strHTML
+end
\ No newline at end of file
diff --git a/SampleCode/PIONE/Basic9/etc/Index.html b/SampleCode/PIONE/Basic9/etc/Index.html
new file mode 100644 (file)
index 0000000..d780e80
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>FileOperation</title>
+       </head>
+       <body>
+               <form action="./AAA.txt" method="post" enctype="multipart/form-data">
+                       <input type="hidden" name="pione-action" value="create"/>
+                       <button type="submit">作成(ファイル)</button>
+                       <input type="file" name="pione-content" value=""/>
+               </form>
+               <form action="./AAA.txt" method="post" enctype="multipart/form-data">
+                       <input type="hidden" name="pione-action" value="create"/>
+                       <button type="submit">作成(テキスト)</button>
+                       <input type="text" name="pione-content" value=""/>
+               </form>
+               <form action="./AAA.txt" method="post" enctype="multipart/form-data">
+                       <input type="hidden" name="pione-action" value="delete"/>
+                       <button type="submit">削除</button>
+               </form>
+               <form action="./list.cgi" method="post" enctype="multipart/form-data">
+                       <input type="hidden" name="pione-action" value="get"/>
+                       <button type="submit">ファイル一覧の取得</button>
+               </form>
+               <br>
+               <br>
+               <a href="?pione-action=finish">終了</a>
+       </body>
+</html>
\ No newline at end of file