This commit has been accessed 706 times via Git panel.
commit faf9e1c2041223ad0971336e6948889fa5f08991
tree 96c60ff753a108f6cd0c9ef400b03700e3252ae6
parent db309c89db6f5408a565dc236a612141c9b741f5
author Engels Antonio <engels@kartero.org> 1363287634 +0800
committer Engels Antonio <engels@kartero.org> 1363287634 +0800
Add localStorage compose auto-save
diff --git a/conf.php b/conf.php
index 57708b8..6eb922a 100644
--- a/conf.php
+++ b/conf.php
@@ -12,4 +12,4 @@ $imap_host = "{127.0.0.1:143/imap/notls/norsh}";
$mail_root = "/kartero/mail";
$mail_home = "/kartero/home";
-?>
+?>
\ No newline at end of file
diff --git a/core.php b/core.php
index 5dab22e..92fa1bc 100644
--- a/core.php
+++ b/core.php
@@ -529,4 +529,17 @@ function kartero_resize_image($image,$max_height=70) {
}
}
+function kartero_local_storage($element,$storage,$destroy=0) {
+
+ $storage = $element . $storage;
+ $storage = md5($storage);
+
+ if ($destroy != 0) {
+ echo "\n<script>localStorage.removeItem(\"$storage\");</script>\n";
+ }
+ else {
+ echo "\n<script>var n=document.getElementById(\"$element\");var s=function(){localStorage.setItem(\"$storage\",n.value)};if(window.localStorage){n.value=localStorage.getItem(\"$storage\")}n.onchange=s();setInterval(s,500);window.onunload=s();</script>\n";
+ }
+}
+
?>
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..df03b8b
Binary files /dev/null and b/favicon.ico differ
diff --git a/index.php b/index.php
index 8dcf80d..cef0d9c 100644
--- a/index.php
+++ b/index.php
@@ -1193,6 +1193,8 @@ if (isset($_SESSION['logged_uid'])) {
mail($reply_to, $reply_subj, $reply_body, $reply_headers, "-f {$reply_fenv[0]}");
}
+ kartero_local_storage("reply_body",$_SESSION['logged_uid'],1);
+
if ($_POST['ack'] == 1) {
imap_setflag_full($mbox, $_POST['msg'], '\\Answered',ST_UID);
}
@@ -1687,7 +1689,7 @@ echo "</tr>";
/*
if ((count($_POST) == 0) or ((count($_POST) == 3) and array_key_exists('x',$_POST) and array_key_exists('y',$_POST) and ($_POST['box'] == "INBOX"))) {
echo "<script src=\"jquery-1.9.1.min.js\" async></script>";
- echo "<script">setInterval(\"$('#main').load('inbox.php');\", 60000);</script>";
+ echo "<script>setInterval(\"$('#main').load('inbox.php');\", 60000);</script>";
}
*/
}
diff --git a/pass2.php b/pass2.php
index 746ce36..753629a 100644
--- a/pass2.php
+++ b/pass2.php
@@ -61,4 +61,4 @@ function pass2_process($mbox, $msgno, $path) {
pass2_process($mbox, $msgno, $filePath);
-?>
+?>
\ No newline at end of file
diff --git a/post.php b/post.php
index 0f0bd74..d2e947c 100644
--- a/post.php
+++ b/post.php
@@ -47,10 +47,12 @@ if (isset($_POST['new']) and !empty($_POST['new']) and is_numeric($_POST['new'])
echo "<tr><td><b>Bcc:</b></td><td colspan=\"2\"><input class=\"input\" type=\"text\" name=\"reply_bcc\"></td></tr>";
echo "<tr><td><b>Subject:</b></td><td colspan=\"2\"><input required class=\"input\" type=\"text\" name=\"reply_subj\"></td></tr>";
- echo "<tr><td></td><td colspan=\"2\"><textarea required class=\"input\" name=\"reply_body\" rows=\"10\">";
+ echo "<tr><td></td><td colspan=\"2\"><textarea required class=\"input\" name=\"reply_body\" id=\"reply_body\" rows=\"10\">";
echo "</textarea></td></tr>";
+ kartero_local_storage("reply_body",$_SESSION['logged_uid']);
+
echo "<input type=\"hidden\" name=\"filedrop_box\" value=\"$filedrop_box\">";
echo "<tr><td></td><td>";
tree 96c60ff753a108f6cd0c9ef400b03700e3252ae6
parent db309c89db6f5408a565dc236a612141c9b741f5
author Engels Antonio <engels@kartero.org> 1363287634 +0800
committer Engels Antonio <engels@kartero.org> 1363287634 +0800
Add localStorage compose auto-save
diff --git a/conf.php b/conf.php
index 57708b8..6eb922a 100644
--- a/conf.php
+++ b/conf.php
@@ -12,4 +12,4 @@ $imap_host = "{127.0.0.1:143/imap/notls/norsh}";
$mail_root = "/kartero/mail";
$mail_home = "/kartero/home";
-?>
+?>
\ No newline at end of file
diff --git a/core.php b/core.php
index 5dab22e..92fa1bc 100644
--- a/core.php
+++ b/core.php
@@ -529,4 +529,17 @@ function kartero_resize_image($image,$max_height=70) {
}
}
+function kartero_local_storage($element,$storage,$destroy=0) {
+
+ $storage = $element . $storage;
+ $storage = md5($storage);
+
+ if ($destroy != 0) {
+ echo "\n<script>localStorage.removeItem(\"$storage\");</script>\n";
+ }
+ else {
+ echo "\n<script>var n=document.getElementById(\"$element\");var s=function(){localStorage.setItem(\"$storage\",n.value)};if(window.localStorage){n.value=localStorage.getItem(\"$storage\")}n.onchange=s();setInterval(s,500);window.onunload=s();</script>\n";
+ }
+}
+
?>
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 0000000..df03b8b
Binary files /dev/null and b/favicon.ico differ
diff --git a/index.php b/index.php
index 8dcf80d..cef0d9c 100644
--- a/index.php
+++ b/index.php
@@ -1193,6 +1193,8 @@ if (isset($_SESSION['logged_uid'])) {
mail($reply_to, $reply_subj, $reply_body, $reply_headers, "-f {$reply_fenv[0]}");
}
+ kartero_local_storage("reply_body",$_SESSION['logged_uid'],1);
+
if ($_POST['ack'] == 1) {
imap_setflag_full($mbox, $_POST['msg'], '\\Answered',ST_UID);
}
@@ -1687,7 +1689,7 @@ echo "</tr>";
/*
if ((count($_POST) == 0) or ((count($_POST) == 3) and array_key_exists('x',$_POST) and array_key_exists('y',$_POST) and ($_POST['box'] == "INBOX"))) {
echo "<script src=\"jquery-1.9.1.min.js\" async></script>";
- echo "<script">setInterval(\"$('#main').load('inbox.php');\", 60000);</script>";
+ echo "<script>setInterval(\"$('#main').load('inbox.php');\", 60000);</script>";
}
*/
}
diff --git a/pass2.php b/pass2.php
index 746ce36..753629a 100644
--- a/pass2.php
+++ b/pass2.php
@@ -61,4 +61,4 @@ function pass2_process($mbox, $msgno, $path) {
pass2_process($mbox, $msgno, $filePath);
-?>
+?>
\ No newline at end of file
diff --git a/post.php b/post.php
index 0f0bd74..d2e947c 100644
--- a/post.php
+++ b/post.php
@@ -47,10 +47,12 @@ if (isset($_POST['new']) and !empty($_POST['new']) and is_numeric($_POST['new'])
echo "<tr><td><b>Bcc:</b></td><td colspan=\"2\"><input class=\"input\" type=\"text\" name=\"reply_bcc\"></td></tr>";
echo "<tr><td><b>Subject:</b></td><td colspan=\"2\"><input required class=\"input\" type=\"text\" name=\"reply_subj\"></td></tr>";
- echo "<tr><td></td><td colspan=\"2\"><textarea required class=\"input\" name=\"reply_body\" rows=\"10\">";
+ echo "<tr><td></td><td colspan=\"2\"><textarea required class=\"input\" name=\"reply_body\" id=\"reply_body\" rows=\"10\">";
echo "</textarea></td></tr>";
+ kartero_local_storage("reply_body",$_SESSION['logged_uid']);
+
echo "<input type=\"hidden\" name=\"filedrop_box\" value=\"$filedrop_box\">";
echo "<tr><td></td><td>";