Yoshihisa Fukuhara
higef****@users*****
2006年 3月 30日 (木) 16:19:03 JST
Index: affelio/apps/diary/templates/uploader.tmpl
diff -u affelio/apps/diary/templates/uploader.tmpl:1.1 affelio/apps/diary/templates/uploader.tmpl:1.2
--- affelio/apps/diary/templates/uploader.tmpl:1.1 Wed Mar 1 14:40:36 2006
+++ affelio/apps/diary/templates/uploader.tmpl Thu Mar 30 16:19:03 2006
@@ -28,7 +28,6 @@
</TMPL_IF>
<FORM method="POST" action="upload.cgi" enctype="multipart/form-data">
<input type="file" name="upload" size="12" MAXLENGTH=256" />
-<br />
<input type="submit" name="submit" value="<AF_M text='Submit'>" />
<br />
ç»åã鏿ããéä¿¡ãã¿ã³ãæ¼ãã¦ãã ããã
Index: affelio/apps/diary/templates/write_diary_edit.tmpl
diff -u affelio/apps/diary/templates/write_diary_edit.tmpl:1.16 affelio/apps/diary/templates/write_diary_edit.tmpl:1.17
--- affelio/apps/diary/templates/write_diary_edit.tmpl:1.16 Fri Mar 3 21:03:48 2006
+++ affelio/apps/diary/templates/write_diary_edit.tmpl Thu Mar 30 16:19:03 2006
@@ -1,4 +1,4 @@
-<form onSubmit="return checkForm(this)" method="post" action="index.cgi" name="edit_form">
+<form onSubmit="return checkForm(this);" method="post" action="index.cgi" name="edit_form">
<div class="afPubContentHeading">
<table border="0" cellspacing="0">
@@ -86,7 +86,8 @@
<div class="afPubContentBlockTitle">
<AF_M text="Preview">
</div>
-<div class="afAppDiaryText" id="preview">
+<!--<div class="afAppDiaryText" id="preview">-->
+<div id="preview">
</div>
@@ -105,19 +106,42 @@
document.getElementById('preview').innerHTML=str2.replace(/<image="([A-Za-z0-9\-\_]*\.(jpg|png|gif|bmp|jpeg))">/gi, '<img src="show_image.cgi?id=0&filename=$1&size=s">');
}
-function checkForm(f) {
- if(f.title.value==""){
- alert("Please input a title.");
- f.name.focus();
- return false;
- }else if (f.contents.value==""){
- alert("Please write a content.");
- f.contetns.focus();
+
+function checkForm(f){
+ if (!checkNull(f.title, 'ã¿ã¤ãã«')) return false;
+ if (!checkNull(f.contents, 'å
容')) return false;
+ if (!checkNumber(f.year,1900,3000)) return false;
+ if (!checkNumber(f.mon,1,12)) return false;
+ if (!checkNumber(f.mday,1,31)) return false;
+ if (!checkNumber(f.hour,0,23)) return false;
+ if (!checkNumber(f.min,0,59)) return false;
+}
+
+function checkNull(obj, msg) {
+ if(obj.value==''){
+ alert(msg+'ãå
¥åãã¦ãã ããã');
+ obj.focus();
return false;
- }
+ }
return true;
}
+function checkNumber(obj,min,max){
+ for(var i=0;i<obj.value.length;i++){
+ if(isNaN(parseInt(obj.value.charAt(i),10))){
+ alert('æ¥æã¯åè§æ°åã§å
¥åãã¦ãã ããã');
+ obj.focus();
+ return 0;
+ }
+ }
+ if(parseInt(obj.value,10)<min || parseInt(obj.value,10)>max){
+ alert('æ¥æã¯æ£ããå
¥åãã¦ãã ããã');
+ obj.focus();
+ return 0;
+ }
+ return obj.value.length;
+}
+
function insertTag(tag) {
document.edit_form.contents.value = document.edit_form.contents.value+'<'+tag+'></'+tag+'>';
}