[gen] Bugfixes with IE8 and JS function 'getElementsByName'.

This commit is contained in:
Gaetan Delannay 2013-02-21 19:04:47 +01:00
parent c91f7477d9
commit 070e5042fd
3 changed files with 17 additions and 6 deletions

View file

@ -32,8 +32,19 @@ function setLoginVars() {
else emptyPassword.value = '0';
}
// AJAX machinery
var isIe = (navigator.appName == "Microsoft Internet Explorer");
function getElementsHavingName(name) {
if (!isIe) return document.getElementsByName(name);
var tables = document.getElementsByTagName('table');
var res = new Array();
for (var i=0; i<tables.length; i++) {
var nameAttr = tables[i].attributes['name'];
if (nameAttr && (nameAttr.value == name)) res.push(tables[i]);
}
return res;
}
// AJAX machinery
var xhrObjects = new Array(); // An array of XMLHttpRequest objects
function XhrObject() { // Wraps a XmlHttpRequest object
@ -279,7 +290,7 @@ function getMasterValues(master) {
function getSlaves(master) {
// Gets all the slaves of master.
allSlaves = document.getElementsByName('slave');
allSlaves = getElementsHavingName('slave');
res = [];
masterName = master.attributes['name'].value;
if (master.type == 'checkbox') {
@ -322,7 +333,7 @@ function updateSlaves(master, slave) {
function initSlaves() {
// When the current page is loaded, we must set the correct state for all
// slave fields.
slaves = document.getElementsByName('slave');
slaves = getElementsHavingName('slave');
i = slaves.length -1;
while (i >= 0) {
masterName = getSlaveInfo(slaves[i], 'masterName');
@ -425,7 +436,7 @@ function toggleCookie(cookieId) {
// Function that allows to generate a document from a pod template.
function generatePodDocument(contextUid, fieldName, podFormat, queryData) {
var theForm = document.getElementsByName("podTemplateForm")[0];
var theForm = document.getElementById("podTemplateForm");
theForm.objectUid.value = contextUid;
theForm.fieldName.value = fieldName;
theForm.podFormat.value = podFormat;

View file

@ -32,7 +32,7 @@
<input type="hidden" name="targetUid"/>
</form>
<tal:comment replace="nothing">Global form for generating a document from a pod template</tal:comment>
<form name="podTemplateForm" method="post"
<form id="podTemplateForm" name="podTemplateForm" method="post"
tal:attributes="action python: tool.absolute_url() + '/generateDocument'">
<input type="hidden" name="objectUid"/>
<input type="hidden" name="fieldName"/>

View file

@ -128,7 +128,7 @@
class="login">
<tr>
<td>
<!-- Go home -->
<!-- Go home -->
<a tal:attributes="href appUrl; title python: _('app_home')">
<img tal:attributes="src string: $appUrl/ui/home.gif" style="margin-right: 3px"/>
</a>