Problem & Lösung: Firefox und Dialogfelder (löschen usw.
Verfasst: Do 3. Jan 2008, 19:11
Hallo werte Contenido-User!
Beziehe mich auf dasselbe Problem, das hier beschrieben ist: http://forum.contenido.org/viewtopic.ph ... +l%F6schen
Ich kann das Problem nachvollziehen. Habe die zum jetzigen Zeitpunkt aktuellsten Versionen von Contenido (4.6.23) und Firefox (2.0.0.11).
Im Firefox alle Erweiterungen/Add-ons zu deaktivieren und für die Domain im Firefox auch sonst alles zu erlauben, brachte definitiv keine Abhilfe.
Folgendermaßen sieht der Dialog-Fehler aus und ein Drücken auf die Schaltflächen führt auch nicht zum Erfolg. JavaScript findet (hier) zwar im opener-Fenster die Funktion deleteLang, diese funktioniert aber nicht bzw. resultiert in einen 404 für die main.php.

Viele der Bestätigungs- und Abfragen-Dialoge (Popups) werden dynamisch per JavaScript generiert. Dabei wird ein neues Fenster ohne Dokument geöffnet und dieses dann mit dem HTML-Code beschrieben, den es darstellen/enthalten soll.
Hier kommt Firefox scheinbar aus dem Tritt - eventuell ist es aber auch ein Sicherheits-Feature und kein Bug. Firefox weist dem erstellten Fenster als Basis-Pfad das DocumentRoot des Servers zu, nicht aber das "contenido/"-Unterverzeichnis.
Deshalb werden die Grafiken nicht angezeigt. Desweiteren findet die Funktion des opener somit auch die main.php nicht.
Ich habe mir selbst Abhilfe damit geschaffen, folgende Ergänzungen (------> ) an der Datei contenido/scripts/messageBox.js.php vorzunehmen:
Beziehe mich auf dasselbe Problem, das hier beschrieben ist: http://forum.contenido.org/viewtopic.ph ... +l%F6schen
Ich kann das Problem nachvollziehen. Habe die zum jetzigen Zeitpunkt aktuellsten Versionen von Contenido (4.6.23) und Firefox (2.0.0.11).
Im Firefox alle Erweiterungen/Add-ons zu deaktivieren und für die Domain im Firefox auch sonst alles zu erlauben, brachte definitiv keine Abhilfe.
Folgendermaßen sieht der Dialog-Fehler aus und ein Drücken auf die Schaltflächen führt auch nicht zum Erfolg. JavaScript findet (hier) zwar im opener-Fenster die Funktion deleteLang, diese funktioniert aber nicht bzw. resultiert in einen 404 für die main.php.

Viele der Bestätigungs- und Abfragen-Dialoge (Popups) werden dynamisch per JavaScript generiert. Dabei wird ein neues Fenster ohne Dokument geöffnet und dieses dann mit dem HTML-Code beschrieben, den es darstellen/enthalten soll.
Hier kommt Firefox scheinbar aus dem Tritt - eventuell ist es aber auch ein Sicherheits-Feature und kein Bug. Firefox weist dem erstellten Fenster als Basis-Pfad das DocumentRoot des Servers zu, nicht aber das "contenido/"-Unterverzeichnis.
Deshalb werden die Grafiken nicht angezeigt. Desweiteren findet die Funktion des opener somit auch die main.php nicht.
Ich habe mir selbst Abhilfe damit geschaffen, folgende Ergänzungen (------> ) an der Datei contenido/scripts/messageBox.js.php vorzunehmen:
Code: Alles auswählen
<?php
/******************************************
* File : messageBox.js
* Project : Contenido
* Descr : Message Box for errors
* and / or confirms
*
* Author : Jan Lengowski
* Created : 08.05.2003
* Modified : 08.05.2003
*
* © four for business AG
******************************************/
include_once ('../includes/startup.php');
include_once ($cfg["path"]["contenido"].$cfg["path"]["includes"] . 'functions.i18n.php');
header("Content-Type: text/javascript");
page_open(array('sess' => 'Contenido_Session',
'auth' => 'Contenido_Challenge_Crypt_Auth',
'perm' => 'Contenido_Perm'));
i18nInit($cfg["path"]["contenido"].$cfg["path"]["locale"], $belang);
------> $basehref = $cfg['path']['contenido_fullhtml'];
page_close();
?>
function resizeDialogToContent()
{
// resize window so there are no scrollbars visible
var dw = window.innerWidth;
while (isNaN(dw))
{
dw = dw.substr(0,dw.length-1);
}
difw = dw - this.document.body.clientWidth;
window.dialogWidth = this.document.body.scrollWidth+difw+'px';
var dh = window.innerHeight;
while (isNaN(dh))
{
dh = dh.substr(0,dh.length-1);
}
difh = dh - this.document.body.clientHeight;
window.dialogHeight = this.document.body.scrollHeight+difh+'px';
}
try {
/**
* OK and CANCEL buttons
*/
button = new Array();
button['confirm'] = '<a href="javascript:msgConfirm()" title="<?php echo i18n("Confirm"); ?>"><img src="images/but_ok.gif" width="20" height="20" border="0"></a>';
button['cancel'] = '<a href="javascript:msgCancel()" title="<?php echo i18n("Cancel"); ?>"><img src="images/but_cancel.gif" width="20" height="20" border="0"></a>';
button['ok'] = '<a href="javascript:window.close()" title="<?php echo i18n("Close window"); ?>"><img src="images/but_ok.gif" width="20" height="20" border="0"></a>';
button['warn'] = '<img src="images/but_warn.gif">';
/**
* Default HTML Template for the
* messageBox class
*/
defaultTemplate = '';
defaultTemplate += '<html>';
defaultTemplate += ' <head>';
defaultTemplate += ' <title>Contenido</title>';
defaultTemplate += ' <style type="text/css">';
defaultTemplate += ' table { border: 2px solid #C54A33 }';
defaultTemplate += ' body { margin: 0px; background-color: #ffffff; }';
defaultTemplate += ' .head { font-family: verdana; font-weight: bold; font-size: 12px; color: #000000 }';
defaultTemplate += ' .text { font-family: verdana; font-size: 11px; color: #000000 }';
defaultTemplate += ' </style>';
defaultTemplate += ' <script type="text/javascript">';
defaultTemplate += ' window.onclose = msgCancel;';
defaultTemplate += ' function msgConfirm(){ {CALLBACK} window.close() }';
defaultTemplate += ' function msgCancel(){ window.close(); }';
defaultTemplate += ' </script>';
------> defaultTemplate += ' <base href="{BASEHREF}" />';
defaultTemplate += ' </head>';
defaultTemplate += '<body>';
defaultTemplate += ' <table height="{HEIGHT}" width="{WIDTH}" cellspacing="0" cellpadding="4" border="0">';
defaultTemplate += ' <tr valign="middle">';
defaultTemplate += ' <td>{IMAGE}</td>';
defaultTemplate += ' <td class="head">{HEADLINE}</td>';
defaultTemplate += ' </tr>';
defaultTemplate += ' <tr height="100%" valign="top">';
defaultTemplate += ' <td></td>';
defaultTemplate += ' <td class="text">{MESSAGE}</td>';
defaultTemplate += ' </tr>';
defaultTemplate += ' <tr>';
defaultTemplate += ' <td></td>';
defaultTemplate += ' <td align="right">{CANCEL} {CONFIRM}</td>';
defaultTemplate += ' </tr>';
defaultTemplate += ' </table>';
defaultTemplate += '</body>';
defaultTemplate += '</html>';
/**
* Class to display errors and notifications
*
* @param headline string The headline of the message
* @param message srint The message text
* @param htmlTemplate
*
*
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG <www.4fb.de>
* @version 0.9
*/
function messageBox(headline, message, htmlTemplate, width, height) {
/* The error message
headline */
this.headline = headline || "";
/* The error message /
notification */
this.message = message || "";
/* HTML Template for
the message */
this.html = htmlTemplate || defaultTemplate;
/* Width of the popup,
defaults to '350' */
this.width = width || 350;
/* Height of the popup,
defaults to '170' */
this.height = height || 170;
/* Status of the popup,
true => popup open
false => popup closed */
this.status = false;
/* Reference to the pop-up
window. */
this.winRef = false;
}
/**
* Displays a notification
*
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG <www.4fb.de>
*/
messageBox.prototype.notify = function(head, msg) {
/* Some required variables */
var template = this.html;
var msg = msg || this.message;
var head = head || this.headline;
/* X and Y position where the
pop-up is centered */
var x = parseInt( (screen.availWidth / 2) - (this.width / 2) );
var y = parseInt( (screen.availHeight / 2) - (this.height / 2) );
/* Replace placeholder with
the contents */
------> template = template.replace(/{BASEHREF}/, '<?php print $basehref; ?>');
template = template.replace(/{HEADLINE}/, head);
template = template.replace(/{MESSAGE}/, msg);
template = template.replace(/{IMAGE}/, button['warn']);
template = template.replace(/{CALLBACK}/, "");
template = template.replace(/{CANCEL}/, "");
template = template.replace(/{CONFIRM}/, button['ok']);
template = template.replace(/{WIDTH}/, this.width);
template = template.replace(/{HEIGHT}/, this.height);
/* Open a new pop-up
window */
this.winRef = window.open("", "", "left="+x+",top="+y+",width="+this.width+",height="+this.height+"\"");
this.winRef.moveTo(x, y);
/* Write template */
this.winRef.document.open();
this.winRef.document.write(template);
this.winRef.document.close();
/* Focus the pop-up */
this.winRef.focus();
}
/**
* Displays a confirmation pop-up.
*
* @param head string Headline for the message
* @param msg string The message
* @param callback string Name of the function executed on confirmation
*
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG <www.4fb.de>
*/
messageBox.prototype.confirm = function(head, msg, callback) {
/* Some required variables */
var template = this.html;
var msg = msg || this.message;
var head = head || this.headline;
/* X and Y position where the
pop-up is centered */
var x = parseInt( (screen.availWidth / 2) - (this.width / 2) );
var y = parseInt( (screen.availHeight / 2) - (this.height / 2) );
/* Replace placeholder with
the contents */
template = template.replace(/{HEADLINE}/, head);
template = template.replace(/{MESSAGE}/, msg);
template = template.replace(/{IMAGE}/, button['warn']);
var sCallback = "";
/* Check if the callback functions are passed as array */
if (typeof(callback) == "object")
{
for (var i=0; i < callback.length; i++)
{
sCallback += "window.opener." + callback[i] + ";";
}
} else {
sCallback = "window.opener." + callback + ";";
}
------> template = template.replace(/{BASEHREF}/, '<?php print $basehref; ?>');
template = template.replace(/{CALLBACK}/, sCallback);
template = template.replace(/{CANCEL}/, button['cancel']);
template = template.replace(/{CONFIRM}/, button['confirm']);
template = template.replace(/{WIDTH}/, this.width);
template = template.replace(/{HEIGHT}/, this.height);
/* Open a new pop-up window */
this.winRef = window.open("", "", "left="+x+",top="+y+",width="+this.width+",height="+this.height+"\"");
this.winRef.moveTo(x, y);
/* Write template */
this.winRef.document.open();
this.winRef.document.write(template);
this.winRef.document.close();
/* Focus the pop-up */
this.winRef.focus();
}
} catch(e) {
}
function performAction (area, action, frame, itemtype, itemid, sid)
{
url = 'main.php?area='+area;
url += '&action='+action;
url += '&frame='+frame;
url += '&' + itemtype + '=' + itemid;
url += '&contenido=' + sid;
if (frame == 1)
{
parent.parent.left.left_top.location.href = url;
}
if (frame == 2)
{
parent.parent.left.left_bottom.location.href = url;
}
if (frame == 3)
{
parent.parent.right.right_top.location.href = url;
}
if (frame == 4)
{
parent.parent.right.right_bottom.location.href = url;
}
}