• R/O
  • HTTP
  • SSH
  • HTTPS

openlab: Commit

一般公開のマテリアル保存のためのリポジトリ


Commit MetaInfo

Revision7c9ba52e28f5e85b21c1f5026615606f26de80f1 (tree)
Zeit2020-10-17 15:11:24
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Backup

Ändern Zusammenfassung

Diff

--- a/http/index.html
+++ b/http/index.html
@@ -25,9 +25,9 @@
2525 <h2>
2626 <ul>
2727 <li><a href="./hajimeni/index.html">はじめに</a></li></li>
28- <li><a href="./view.html">身の回りにある結晶を投稿してみよう</a></li>
29- <li><a href="./simulator/index.html">物性研の計算機でシミュレーションする</a></li>
28+ <li><a href="./submit/index.php">身の回りにある結晶を投稿してみよう</a></li>
3029 <li><a href="./fermi/index.html">フェルミ面図鑑</a></li>
30+ <li><a href="./simulator/index.html">物性研の計算機でシミュレーションする</a></li>
3131 <li><a href="./bbs/index.php">なんでも掲示板</a></li>
3232 </ul>
3333 </h2>
--- a/http/submit/index.php
+++ b/http/submit/index.php
@@ -11,7 +11,7 @@
1111 fwrite($rssxml, "<?xml version='1.0' encoding='UTF-8'?>\n");
1212 fwrite($rssxml, "<rss version='2.0'>\n");
1313 fwrite($rssxml, " <channel>\n");
14- fwrite($rssxml, " <title>結晶とシミュレーションなんでも掲示板</title>\n");
14+ fwrite($rssxml, " <title>身の回りにある結晶を投稿してみよう</title>\n");
1515 fwrite($rssxml, " <link>" . $thisurl . "</link>\n");
1616 fwrite($rssxml, " <description></description>\n");
1717 fwrite($rssxml, " <item>\n");
@@ -25,30 +25,7 @@
2525 fwrite($rssxml, "</rss>\n");
2626 fclose($rssxml);
2727
28- if ($_POST['submittype'] === 'text') {
29- fputcsv($fp, [$_POST['name'], $_POST['comment'], $_POST['submittype'], $submittime, $submitid]);
30- }
31- elseif ($_POST['submittype'] === 'image') {
32- fputcsv($fp, [$_POST['name'], $uploadfile, $_POST['submittype'], $submittime, $submitid, $_FILES['avatar']['tmp_name']]);
33- move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadfile);
34- chmod($uploadfile, 0777);
35- }
36- elseif ($_POST['submittype'] === 'file') {
37- fputcsv($fp, [$_POST['name'], $uploadfile, $_POST['submittype'], $submittime, $submitid, $_FILES['avatar']['tmp_name']]);
38- move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadfile);
39- chmod($uploadfile, 0777);
40- }
41- elseif ($_POST['submittype'] === 'freehand') {
42- $canvas = $_POST['comment'];
43- $canvas = base64_decode($canvas);
44- $image = imagecreatefromstring($canvas);
45- $uploadfile = date("U") . ".png";
46- imagesavealpha($image, TRUE);
47- imagepng($image , $uploadfile);
48-
49- fputcsv($fp, [$_POST['name'], $uploadfile, $_POST['submittype'], $submittime, $submitid]);
50- chmod($uploadfile, 0777);
51- }
28+ fputcsv($fp, [$_POST['name'], $uploadfile, $_POST['comment'], $submittime, $submitid]);
5229 rewind($fp);
5330 }
5431
@@ -84,14 +61,51 @@ $(function() {
8461 makePreview();
8562 });
8663 </script>
87- <title>なんでも掲示板</title>
64+<script type="text/javascript" src="../JSmol.min.js"></script>
65+<script type="text/javascript">
66+
67+// supersimple2.htm - illustrating the use of jQuery(document).ready to
68+// populate all spans and divs AFTER the page is loaded.
69+// This is good programming practice.
70+
71+$(document).ready(
72+
73+function() {
74+
75+Info = {
76+ width: 600,
77+ height: 600,
78+ debug: false,
79+ j2sPath: "../j2s",
80+ color: "0xC0C0C0",
81+ disableJ2SLoadMonitor: true,
82+ disableInitialConsole: true,
83+ addSelectionOptions: false,
84+ serverURL: "https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
85+ use: "HTML5",
86+ readyFunction: null
87+}
88+
89+$("#mydiv").html(Jmol.getAppletHtml("jmolApplet0",Info))
90+$("#btns").html(
91+ Jmol.jmolButton(jmolApplet0, "write frames {*} \"crystal.jpg\"","画像を保存")
92+ +Jmol.jmolButton(jmolApplet0, "stereo on","立体視オン")
93+ +Jmol.jmolButton(jmolApplet0, "stereo off","立体視オフ")
94+ )
95+}
96+
97+
98+);
99+</script>
100+ <title>身の回りにある結晶を投稿してみよう</title>
88101 </head>
89102 <body bgcolor="CCFFCC">
90- <h1>なんでも掲示板</h1>
103+ <h1>身の回りにある結晶を投稿してみよう</h1>
91104
92105 <h2>
93- <p>結晶のこと、物性のこと、コンピューターシミュレーションのことや研究室生活など、なんでも聞いてみましょう!</p>
94- <p>iPadなどのタッチパネルで絵を描くことも出来ます。</p>
106+ <p>身の回りにある結晶を投稿してみましょう!
107+ 下にある結晶構造を見ることができます。
108+ </p>
95109 </h2>
96110
97111 <h3>ホームページ製作(HTML)に詳しい人向けの情報</h3>
@@ -103,35 +117,71 @@ $(function() {
103117 <li><a href="./rss.xml">RSS</a></li>
104118 </ul>
105119
106- <h2>コメント</h2>
120+ <span id=mydiv></span>
121+ <span id=btns></span>
122+ URL: <input type="text" name="name" id="cifurl" value="">
123+ <input type="button" value="URLから開く" id="canvassubmit" onclick="opencifurl()">
124+ <br />
125+ <a href="javascript:opencif('../cif/1502689.cif')">アルミニウム</a>
126+ <a href="javascript:opencif('../cif/2101052.cif')">ルビーやサファイア</a>
127+ <a href="javascript:opencif('../cif/1532664.cif')">高温超伝導体</a>
128+ <a href="javascript:opencif('../cif/1010060.cif')">ドライアイス</a>
129+ <a href="javascript:opencif('../cif/9008564.cif')">ダイヤモンド</a>
130+ <a href="javascript:opencif('../cif/9006598.cif')">鉄</a>
131+ <a href="javascript:opencif('../cif/9008868.cif')">青色発光ダイオード</a>
132+ <a href="javascript:opencif('../cif/1200018.cif')">黒鉛</a>
133+ <a href="javascript:opencif('../cif/1011023.cif')">氷</a>
134+ <a href="javascript:opencif('../cif/4505482.cif')">リチウムイオン電池正極</a>
135+ <a href="javascript:opencif('../cif/1521011.cif')">下部マントル</a>
136+ <a href="javascript:opencif('../cif/1000041.cif')">しお(岩塩)</a>
137+ <a href="javascript:opencif('../cif/1008718.cif')">ネオジム磁石</a>
138+ <a href="javascript:opencif('../cif/9012600.cif')">水晶</a>
139+ <a href="javascript:opencif('../cif/3500015.cif')">砂糖(スクロース)</a>
140+ <a href="javascript:opencif('../cif/9011048.cif')">重曹</a>
141+ <a href="javascript:opencif('../cif/2100992.cif')">チョーク(炭酸カルシウム)</a>
142+ <a href="javascript:opencif('../cif/9008463.cif')">金</a>
143+ <a href="javascript:opencif('../cif/9008459.cif')">銀</a>
144+ <a href="javascript:opencif('../cif/9008468.cif')">銅</a>
145+
146+<script type="text/javascript">
147+function opencif(source) {
148+ var jmolscript = 'load '
149+ + source
150+ + ' {3,3,3};'
151+ + 'set perspectiveDepth ON; select; set defaultLabelXYZ \"%e\";'
152+ + 'set labelToggle;'
153+ + 'set labelAtom;'
154+ + 'set labelOffset 0 0;'
155+ + 'color labels black';
156+
157+ Jmol.script(jmolApplet0, jmolscript);
158+}
159+
160+ function opencifurl(){
161+ var name = document.getElementById('cifurl').value;
162+ opencif(name);
163+ }
164+ </script>
165+
166+ <h2>投稿した物質の写真や絵</h2>
107167
108168 <?php if (!empty($rows)): ?>
109169 <ul>
110170 <?php foreach ($rows as $row): ?>
111- <?php if ($row[2] == 'text'): ?>
112- <li><?=$row[1]?> (<?=$row[2]?> by <?=$row[0]?> at <?=$row[3]?>)</li>
113- <?php elseif ($row[2] == 'freehand'): ?>
114- <li><img src="<?=$row[1]?>" height="400" align="middle"> (<?=$row[2]?> by <?=$row[0]?> at <?=$row[3]?>)</li>
115- <?php elseif ($row[2] == 'image'): ?>
116- <li><img src="<?=$row[1]?>" height="400" align="middle"> (<?=$row[2]?> by <?=$row[0]?> at <?=$row[3]?>)</li>
117- <?php elseif ($row[2] == 'file'): ?>
118- <li><a href="<?=$row[1]?>"><?=$row[1]?></a> (<?=$row[2]?> by <?=$row[0]?> at <?=$row[3]?>)</li>
119- <?php endif; ?>
171+ <li>
172+ <img src="<?=$row[1]?>" height="400" align="middle">
173+ <?=$row[2]?>
174+ (by <?=$row[0]?> at <?=$row[3]?>)
175+ </li>
120176 <?php endforeach; ?>
121177 </ul>
122178 <?php else: ?>
123- <p>コメントはまだありません。</p>
179+ <p>投稿はまだありません。</p>
124180 <?php endif; ?>
125181
126- <h2>コメントする</h2>
182+ <h2>投稿する</h2>
127183
128184 <input type="button" value="投稿する" id="canvassubmit">
129- <form id="submittype">
130- <input type="radio" name="subtype" value="text" checked="checked">文章
131- <input type="radio" name="subtype" value="image">画像貼り付け
132- <input type="radio" name="subtype" value="file">ファイル貼り付け
133- <input type="radio" name="subtype" value="freehand">フリーハンド
134- </form>
135185 <form enctype="multipart/form-data" id="submitting" action="" method="post">
136186 名前(ニックネームなど): <input type="text" name="name" id="submitname" value="">
137187 </br>
@@ -143,25 +193,9 @@ $(function() {
143193 </br>
144194 <div id="preview"></div>
145195 </br>
146- ファイル: <input type="file" id="file" name="filename">
196+ 物質の写真や絵: <input type="file" id="file" name="filename">
147197 <br>
148198 </form>
149- フリーハンドお絵描き(タッチパネルなど):
150- <input type="button" value="キャンバスのクリア" onclick="clearCanvas();">
151- <br>
152- キャンバスの幅: <input type="text" id="width" value="600">
153- 高さ: <input type="text" id="height" value="600">
154- <input type="button" value="キャンバスサイズ変更" onclick="resizeCanvas();">
155- <br>
156- <form id="linecolor">
157- <input type="radio" name="color" value="black" checked="checked">黒
158- <input type="radio" name="color" value="white">白
159- <input type="radio" name="color" value="red">赤
160- <input type="radio" name="color" value="green">緑
161- <input type="radio" name="color" value="blue">青
162- </form>
163- <canvas id="canvas" width="600" height="600" style="border:solid black 1px;"></canvas>
164- <pre id="log" style="border: 1px solid #ccc;"></pre>
165199 <script type="text/javascript">
166200 function startup() {
167201 var el = document.getElementById("canvas");
@@ -174,97 +208,6 @@ function startup() {
174208 document.addEventListener("DOMContentLoaded", startup);
175209 var ongoingTouches = [];
176210
177-function handleStart(evt) {
178- evt.preventDefault();
179- var el = document.getElementById("canvas");
180- var ctx = el.getContext("2d");
181- var touches = evt.changedTouches;
182-
183- for (var i = 0; i < touches.length; i++) {
184- ongoingTouches.push(copyTouch(touches[i]));
185- }
186-}
187-
188-function handleMove(evt) {
189- evt.preventDefault();
190- var el = document.getElementById("canvas");
191- var ctx = el.getContext("2d");
192- var rect = el.getBoundingClientRect()
193- var touches = evt.changedTouches;
194- var linecolor = document.getElementById('linecolor').color.value;
195-
196- for (var i = 0; i < touches.length; i++) {
197- var idx = ongoingTouchIndexById(touches[i].identifier);
198-
199- if (idx == 0) {
200- ctx.beginPath();
201- ctx.moveTo(ongoingTouches[idx].clientX - rect.left, ongoingTouches[idx].clientY - rect.top);
202- ctx.lineTo(touches[i].clientX - rect.left, touches[i].clientY - rect.top);
203- ctx.lineWidth = 4;
204- ctx.strokeStyle = linecolor;
205- ctx.stroke();
206-
207- ongoingTouches.splice(idx, 1, copyTouch(touches[i])); // swap in the new touch record
208- }
209- }
210-}
211-function handleEnd(evt) {
212- evt.preventDefault();
213- var el = document.getElementById("canvas");
214- var ctx = el.getContext("2d");
215- var touches = evt.changedTouches;
216-
217- //log("touchend");
218- for (var i = 0; i < touches.length; i++) {
219- var idx = ongoingTouchIndexById(touches[i].identifier);
220-
221- if (idx >= 0) {
222- ongoingTouches.splice(idx, 1); // remove it; we're done
223- }
224- }
225-}
226-function handleCancel(evt) {
227- evt.preventDefault();
228- var touches = evt.changedTouches;
229-
230- for (var i = 0; i < touches.length; i++) {
231- var idx = ongoingTouchIndexById(touches[i].identifier);
232- ongoingTouches.splice(idx, 1); // remove it; we're done
233- }
234-}
235-function copyTouch({ identifier, clientX, clientY }) {
236- return { identifier, clientX, clientY };
237-}
238-
239-function ongoingTouchIndexById(idToFind) {
240- for (var i = 0; i < ongoingTouches.length; i++) {
241- var id = ongoingTouches[i].identifier;
242-
243- if (id == idToFind) {
244- return i;
245- }
246- }
247- return -1; // not found
248-}
249-function clearCanvas() {
250- var el = document.getElementById("canvas");
251- var ctx = el.getContext("2d");
252-
253- ctx.clearRect(0, 0, el.width, el.height);
254-}
255-function resizeCanvas() {
256- var el = document.getElementById("canvas");
257- var width = document.getElementById('width').value;
258- var height = document.getElementById('height').value;
259-
260- el.setAttribute("width", width);
261- el.setAttribute("height", height);
262-}
263-function log(msg) {
264- var p = document.getElementById('log');
265- p.innerHTML = msg + "\n" + p.innerHTML;
266-}
267-
268211 window.onload = function() {
269212 document.getElementById('canvassubmit').onclick = function() {
270213 post();
@@ -274,28 +217,12 @@ window.onload = function() {
274217 function post() {
275218 var fd = new FormData();
276219
277- var submittype = document.getElementById('submittype').subtype.value;
278- fd.append('submittype',submittype);
279-
280220 var name = document.getElementById('submitname').value;
281221 fd.append('name',name);
282-
283- if(submittype == "text"){
284- var comment = document.getElementById('comment').value;
285- fd.append('comment', comment);
286- }
287- else if(submittype == "image"){
288- const file = document.getElementById("file").files[0];
289- fd.append('avatar', file);
290- }
291- else if(submittype == "file"){
292- const file = document.getElementById("file").files[0];
293- fd.append('avatar', file);
294- }
295- else if(submittype == "freehand"){
296- img_url = canvas.toDataURL("image/png").replace(new RegExp("data:image/png;base64,"),"");
297- fd.append('comment',img_url);
298- }
222+ const file = document.getElementById("file").files[0];
223+ fd.append('avatar', file);
224+ var comment = document.getElementById('comment').value;
225+ fd.append('comment', comment);
299226
300227 const param = {
301228 method: "POST",
@@ -308,7 +235,5 @@ function post() {
308235 });
309236 }
310237 </script>
311- </hr>
312- This BBS operates with <a href="https://ja.osdn.net/projects/sciencebbs/">ScienceBBS</a>.
313238 </body>
314239 </html>
--- a/http/view.html
+++ /dev/null
@@ -1,93 +0,0 @@
1-<!DOCTYPE html>
2-<html>
3-<head>
4-<title>結晶と物性のせかい</title>
5-<meta charset="utf-8">
6-<script type="text/javascript" src="JSmol.min.js"></script>
7-<script type="text/javascript">
8-
9-// supersimple2.htm - illustrating the use of jQuery(document).ready to
10-// populate all spans and divs AFTER the page is loaded.
11-// This is good programming practice.
12-
13-$(document).ready(
14-
15-function() {
16-
17-Info = {
18- width: 600,
19- height: 600,
20- debug: false,
21- j2sPath: "j2s",
22- color: "0xC0C0C0",
23- disableJ2SLoadMonitor: true,
24- disableInitialConsole: true,
25- addSelectionOptions: false,
26- serverURL: "https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
27- use: "HTML5",
28- readyFunction: null
29-}
30-
31-$("#mydiv").html(Jmol.getAppletHtml("jmolApplet0",Info))
32-$("#btns").html(
33- Jmol.jmolButton(jmolApplet0, "write frames {*} \"crystal.jpg\"","画像を保存")
34- +Jmol.jmolButton(jmolApplet0, "stereo on","立体視オン")
35- +Jmol.jmolButton(jmolApplet0, "stereo off","立体視オフ")
36- )
37-}
38-
39-
40-);
41-
42-
43-
44-</script>
45-</head>
46-<body>
47- <span id=mydiv></span>
48- <span id=btns></span>
49- URL: <input type="text" name="name" id="cifurl" value="">
50- <input type="button" value="URLから開く" id="canvassubmit" onclick="opencifurl()">
51- <br />
52- <a href="javascript:opencif('cif/1502689.cif')">アルミニウム</a>
53- <a href="javascript:opencif('cif/2101052.cif')">ルビーやサファイア</a>
54- <a href="javascript:opencif('cif/1532664.cif')">高温超伝導体</a>
55- <a href="javascript:opencif('cif/1010060.cif')">ドライアイス</a>
56- <a href="javascript:opencif('cif/9008564.cif')">ダイヤモンド</a>
57- <a href="javascript:opencif('cif/9006598.cif')">鉄</a>
58- <a href="javascript:opencif('cif/9008868.cif')">青色発光ダイオード</a>
59- <a href="javascript:opencif('cif/1200018.cif')">黒鉛</a>
60- <a href="javascript:opencif('cif/1011023.cif')">氷</a>
61- <a href="javascript:opencif('cif/4505482.cif')">リチウムイオン電池正極</a>
62- <a href="javascript:opencif('cif/1521011.cif')">下部マントル</a>
63- <a href="javascript:opencif('cif/1000041.cif')">しお(岩塩)</a>
64- <a href="javascript:opencif('cif/1008718.cif')">ネオジム磁石</a>
65- <a href="javascript:opencif('cif/9012600.cif')">水晶</a>
66- <a href="javascript:opencif('cif/3500015.cif')">砂糖(スクロース)</a>
67- <a href="javascript:opencif('cif/9011048.cif')">重曹</a>
68- <a href="javascript:opencif('cif/2100992.cif')">チョーク(炭酸カルシウム)</a>
69- <a href="javascript:opencif('cif/9008463.cif')">金</a>
70- <a href="javascript:opencif('cif/9008459.cif')">銀</a>
71- <a href="javascript:opencif('cif/9008468.cif')">銅</a>
72-
73-<script type="text/javascript">
74-function opencif(source) {
75- var jmolscript = 'load '
76- + source
77- + ' {3,3,3};'
78- + 'set perspectiveDepth ON; select; set defaultLabelXYZ \"%e\";'
79- + 'set labelToggle;'
80- + 'set labelAtom;'
81- + 'set labelOffset 0 0;'
82- + 'color labels black';
83-
84- Jmol.script(jmolApplet0, jmolscript);
85-}
86-
87- function opencifurl(){
88- var name = document.getElementById('cifurl').value;
89- opencif(name);
90- }
91- </script>
92-</body>
93-</html >
--- a/openlab.vcxproj
+++ b/openlab.vcxproj
@@ -57,7 +57,6 @@
5757 <None Include="http\simulator\index.html" />
5858 <None Include="http\simulator\simulate.php" />
5959 <None Include="http\submit\index.php" />
60- <None Include="http\view.html" />
6160 <None Include="http\fermi\index.html" />
6261 </ItemGroup>
6362 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
--- a/openlab.vcxproj.filters
+++ b/openlab.vcxproj.filters
@@ -2,7 +2,6 @@
22 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33 <ItemGroup>
44 <None Include="http\index.html" />
5- <None Include="http\view.html" />
65 <None Include="http\bbs\index.php">
76 <Filter>bbs</Filter>
87 </None>
Show on old repository browser