• R/O
  • SSH
  • HTTPS

webserver: Commit


Commit MetaInfo

Revision57 (tree)
Time2010-10-25 00:51:39
Authorhoritaku

Log Message

edit

Change Summary

Incremental Difference

--- branch/Basic 0.2x/import_lib/lib/string/JSonUtil.java (revision 56)
+++ branch/Basic 0.2x/import_lib/lib/string/JSonUtil.java (revision 57)
@@ -10,7 +10,9 @@
1010 for(HashMap<String,String> map:list) {
1111 ArrayList<String> setList = new ArrayList<String>();
1212 for(String key:map.keySet()) {
13- String set = "'" + key + "':'" + map.get(key) + "'";
13+ String value = map.get(key);
14+ value = value.replaceAll("\\'", "&#39;");
15+ String set = "'" + key + "':'" + value + "'";
1416 setList.add(set);
1517 }
1618 String[] ary = new String[setList.size()];
@@ -24,7 +26,11 @@
2426 public static String mapToJSON(HashMap<String,String> map) {
2527 ArrayList<String> setList = new ArrayList<String>();
2628 for(String key:map.keySet()) {
27- String set = "'" + key + "':'" + map.get(key) + "'";
29+ String value = map.get(key);
30+ value = value.replaceAll("\\'", "&#39;");
31+ value = value.replaceAll("\\r", "\\\\r");
32+ value = value.replaceAll("\\n", "\\\\n");
33+ String set = "'" + key + "':'" + value + "'";
2834 setList.add(set);
2935 }
3036 String[] ary = new String[setList.size()];
--- branch/Basic 0.2x/docRoot/contents.html (revision 56)
+++ branch/Basic 0.2x/docRoot/contents.html (revision 57)
@@ -47,7 +47,7 @@
4747
4848 <body>
4949 <p>コンテンツ一覧</p>
50-<div id="content_area"></div>
50+<div id="content_area">データを読み込み中です....</div>
5151 <div><a href="brandnew_text.html">新規作成</a></div>
5252 </body>
5353 </html>
--- branch/Basic 0.2x/docRoot/brandnew_text.html (revision 56)
+++ branch/Basic 0.2x/docRoot/brandnew_text.html (revision 57)
@@ -11,7 +11,18 @@
1111 <script type="text/javascript" src="js/jquery.js"></script>
1212
1313 <title>新規作成</title>
14-
14+<style>
15+<!--
16+#text_body{
17+ width:500px;
18+ height:350px;
19+ font-size:13px;
20+}
21+#text_title{
22+ width:500px;
23+}
24+ -->
25+</style>
1526 <script>
1627 <!--
1728 window.onload = function myload() {
@@ -19,17 +30,28 @@
1930
2031 }
2132 function dataload() {
22- var text = clipboardData.getData('Text');
23- if(text) {
24- $('#content_area').text(text);
33+
34+}
35+function regist(){
36+ var title = $('#text_title').val();
37+ var body = $('#text_body').val();
38+ if(!body){
39+ alert("文章がありません");
40+ return;
2541 }
26-/*
27- $.ajax({url : "/ContentsList.do?type=getall",
28- type : "get",
42+ if(!title) {
43+ title = body.substring(0, 10);
44+ }
45+ body = encodeURIComponent(body);
46+ title = encodeURIComponent(title);
47+ var data = "title=" + title;
48+ data += "&body=" + body;
49+ $.ajax({url : "/ContentData.do",
50+ type : "post",
2951 success : success,
30- error : errorMsg
52+ error : errorMsg,
53+ data : data
3154 });
32- */
3355 }
3456 function errorMsg(xmlObj) {
3557 alert("エラー発生 :" + xmlObj.status + "\n" + xmlObj.responseText);
@@ -37,13 +59,8 @@
3759 }
3860 function success(data, status) {
3961 if(status == "success"){
40- var records = eval(data);
41- var recHtml = "";
42- for(var i = 0;i < records.length;i++){
43- var line = records[i];
44- recHtml += "<p><a href='content_show.html?idx=" + line['text_index'] + "'>" + line['title'] + "</a></p>";
45- }
46- $('#content_area').html(recHtml);
62+ alert("登録完了しました。");
63+ window.location = "./" + data;
4764 }
4865 }
4966 -->
@@ -54,7 +71,9 @@
5471 <body>
5572 <div>
5673 <form>
57- <textarea id="textbox" ></textarea>
74+ <input type="text" id="text_title" /><br/>
75+ <textarea id="text_body" ></textarea><br />
76+ <input type="button" onclick="regist();" value="登録"/>
5877 </form>
5978 </div>
6079 </body>
--- branch/Basic 0.2x/docRoot/content_show.html (revision 56)
+++ branch/Basic 0.2x/docRoot/content_show.html (revision 57)
@@ -47,6 +47,6 @@
4747
4848 <body>
4949 <p>コンテンツ一覧</p>
50-<div id="content_area"></div>
50+<div id="content_area">データを読み込み中です....</div>
5151 </body>
5252 </html>
Show on old repository browser