Merge "Log when users manually refresh" into ub-gmail-ur14-dev
diff --git a/assets/script.js b/assets/script.js
index 497bffa..3834a77 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -734,6 +734,7 @@
msg = block.firstChild;
}
parent.removeChild(block);
+ disablePostForms();
measurePositions();
}
@@ -756,6 +757,7 @@
msgContentDiv.innerHTML = window.mail.getMessageBody(id);
processNewMessageBody(msgContentDiv);
}
+ disablePostForms();
measurePositions();
}
@@ -766,9 +768,29 @@
var body = msg.children[0]; // toss the outer div, it was just to render innerHTML into
document.body.insertBefore(body, document.getElementById("conversation-footer"));
processNewMessageBody(body.querySelector(".mail-message-content"));
+ disablePostForms();
measurePositions();
}
+function disablePostForms() {
+ var forms = document.getElementsByTagName('FORM');
+ var i;
+ var j;
+ var elements;
+
+ for (i = 0; i < forms.length; ++i) {
+ if (forms[i].method.toUpperCase() === 'POST') {
+ forms[i].onsubmit = function() {
+ alert(MSG_FORMS_ARE_DISABLED);
+ return false;
+ }
+ elements = form[i].elements;
+ for (j = 0; j < elements.length; ++j) {
+ elements[j].readOnly = true;
+ }
+ }
+ }
+}
// END Java->JavaScript handlers
// Do this first to ensure that the readiness signal comes through,
@@ -783,5 +805,5 @@
if (!RUNNING_KITKAT_OR_LATER) {
restoreScrollPosition();
}
+disablePostForms();
measurePositions();
-
diff --git a/res/raw/template_conversation_lower.html b/res/raw/template_conversation_lower.html
index d4b59fc..4e76f34 100644
--- a/res/raw/template_conversation_lower.html
+++ b/res/raw/template_conversation_lower.html
@@ -13,6 +13,7 @@
var ENABLE_MUNGE_TABLES = %s;
var ENABLE_MUNGE_IMAGES = %s;
var RUNNING_KITKAT_OR_LATER = %s;
+ var MSG_FORMS_ARE_DISABLED = '%s';
</script>
<script type="text/javascript" src="file:///android_asset/script.js"></script>
</html>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 26671e6..5870b22 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1137,4 +1137,6 @@
<!-- Text to go to the dialog to accept the security hold -->
<string name="update_security_text">update now</string>
+ <!-- Shown when user submits a form. [CHAR LIMIT=40] -->
+ <string name="forms_are_disabled">Forms are disabled in Gmail</string>
</resources>
diff --git a/src/com/android/mail/ui/HtmlConversationTemplates.java b/src/com/android/mail/ui/HtmlConversationTemplates.java
index 33aa505..124cb83 100644
--- a/src/com/android/mail/ui/HtmlConversationTemplates.java
+++ b/src/com/android/mail/ui/HtmlConversationTemplates.java
@@ -204,7 +204,8 @@
mContext.getString(R.string.hide_elided),
showElided, docBaseUri, conversationBaseUri, viewportWidth, webviewWidth,
enableContentReadySignal, normalizeMessageWidths,
- enableMungeTables, enableMungeImages, Utils.isRunningKitkatOrLater());
+ enableMungeTables, enableMungeImages, Utils.isRunningKitkatOrLater(),
+ mContext.getString(R.string.forms_are_disabled));
mInProgress = false;