• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revision8f18aee362c4538c55ad8727eb5e406f0d9ae493 (tree)
Time2014-12-16 14:54:03
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: tutorial for PIONE about Interaction API.
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

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE/Basic9/Annotation.pione
@@ -0,0 +1,3 @@
1+.@ PackageName :: "FileOperation"
2+.@ Editor :: "Kinoshita"
3+.@ Tag :: "v0.1.0"
--- /dev/null
+++ b/SampleCode/PIONE/Basic9/Interaction.pione
@@ -0,0 +1,13 @@
1+Rule Interaction
2+ output '*.*'.all
3+Action
4+ # build public directory for pione-interactive
5+ mkdir public
6+ cp etc/* public
7+ cp bin/* public
8+
9+ # start interactive operation
10+ pione-interactive browser --public public
11+
12+ cp public/* .
13+End
--- /dev/null
+++ b/SampleCode/PIONE/Basic9/Main.pione
@@ -0,0 +1,5 @@
1+Rule Main
2+ output '*.txt'.all
3+Flow
4+ rule Interaction
5+End
--- /dev/null
+++ b/SampleCode/PIONE/Basic9/bin/list.cgi
@@ -0,0 +1,39 @@
1+#!/usr/bin/env ruby
2+
3+require 'cgi'
4+
5+cgi = CGI.new
6+
7+strHTML = ""
8+
9+strHTML += <<'Block-HTML'
10+<!DOCTYPE html>
11+<html>
12+ <head>
13+ <meta charset="utf-8">
14+ <title>CGIページ</title>
15+ </head>
16+ <body>
17+ <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
18+ <div id="textDiv"></div>
19+ <script type="text/javascript">
20+ var div = document.getElementById("textDiv");
21+ div.textContent = "";
22+ $.getJSON("./", {"pione-action": "list"}, function(data){
23+ $.each(data, function(file) {
24+ div.textContent += this.name +"\n";
25+ });
26+ });
27+ </script>
28+ <a href="Index.html">戻る</a>
29+ <br>
30+ <br>
31+ <a href="?pione-action=finish">終了</a>
32+ </body>
33+</html>
34+Block-HTML
35+
36+# Output as html
37+cgi.out(type: "text/html") do
38+ strHTML
39+end
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic9/etc/Index.html
@@ -0,0 +1,30 @@
1+<!DOCTYPE html>
2+<html>
3+ <head>
4+ <meta charset="utf-8">
5+ <title>FileOperation</title>
6+ </head>
7+ <body>
8+ <form action="./AAA.txt" method="post" enctype="multipart/form-data">
9+ <input type="hidden" name="pione-action" value="create"/>
10+ <button type="submit">作成(ファイル)</button>
11+ <input type="file" name="pione-content" value=""/>
12+ </form>
13+ <form action="./AAA.txt" method="post" enctype="multipart/form-data">
14+ <input type="hidden" name="pione-action" value="create"/>
15+ <button type="submit">作成(テキスト)</button>
16+ <input type="text" name="pione-content" value=""/>
17+ </form>
18+ <form action="./AAA.txt" method="post" enctype="multipart/form-data">
19+ <input type="hidden" name="pione-action" value="delete"/>
20+ <button type="submit">削除</button>
21+ </form>
22+ <form action="./list.cgi" method="post" enctype="multipart/form-data">
23+ <input type="hidden" name="pione-action" value="get"/>
24+ <button type="submit">ファイル一覧の取得</button>
25+ </form>
26+ <br>
27+ <br>
28+ <a href="?pione-action=finish">終了</a>
29+ </body>
30+</html>
\ No newline at end of file
Show on old repository browser