dodenantn
09.02.2008, 19:52:14
Hallo!
Ich würde gerne auf die Eltern-Klasse einer Funktion zugreifen. Gibt es da sowas wie "parent::" in PHP o.Ä?
Ich poste hier meinen Code, um das ganze ein bisschen zu erläutern ... (nur zur Info: ich verwende die "Prototype" JS-Bibliothek):
var comments = {
isFormOk: function()
{
progressIndicator('comment-sent', {status: 'load'});
var elementsFail = checkUserData(['title', 'desc', 'mail'], '');
elementsFail.each(function(element) {
$('l' + element).setStyle({color: 'rgb(255, 0, 0)'});
});
if (!elementsFail.length)
{
progressIndicator('comment-sent', {status: 'none'});
return true;
}
else
{
progressIndicator('comment-sent', {status: 'fail'});
return false;
}
},
sendComment: function()
{
if (this.isFormOk())
{
instance = this;
$('comment').request(
{
parameters: {title: $F('title'), desc: $F('desc'), mail: $F('mail'), name: $F('name')},
encoding: 'utf-8',
onSuccess: function(response)
{
this.isServerScriptOk(response); //hier würde ich gerne die Funtion isServerScriptOk() aufrufen, die allerdings eine Ebene höher (?) liegt...
},
onFailure: function()
{
progressIndicator('comment-sent', {status: 'fail'});
},
onCreate: function()
{
progressIndicator('comment-sent', {status: 'load'});
writeUserData(['name', 'mail']);
}
});
}
},
isServerScriptOk: function(response)
{
if(response.responseText)
{
progressIndicator('comment-sent', {status: 'ok'});
}
else
{
progressIndicator('comment-sent', {status: 'fail'});
}
},
toggleNewComment: function()
{
Effect.toggle('newcomment', 'slide', {beforeStart: function() {
insertUserData(readUserData(['name', 'mail']));
}});
}
}
Ich hoffe auf hilfreiche Antworten,
vielen Dank im Voraus!
Ich würde gerne auf die Eltern-Klasse einer Funktion zugreifen. Gibt es da sowas wie "parent::" in PHP o.Ä?
Ich poste hier meinen Code, um das ganze ein bisschen zu erläutern ... (nur zur Info: ich verwende die "Prototype" JS-Bibliothek):
var comments = {
isFormOk: function()
{
progressIndicator('comment-sent', {status: 'load'});
var elementsFail = checkUserData(['title', 'desc', 'mail'], '');
elementsFail.each(function(element) {
$('l' + element).setStyle({color: 'rgb(255, 0, 0)'});
});
if (!elementsFail.length)
{
progressIndicator('comment-sent', {status: 'none'});
return true;
}
else
{
progressIndicator('comment-sent', {status: 'fail'});
return false;
}
},
sendComment: function()
{
if (this.isFormOk())
{
instance = this;
$('comment').request(
{
parameters: {title: $F('title'), desc: $F('desc'), mail: $F('mail'), name: $F('name')},
encoding: 'utf-8',
onSuccess: function(response)
{
this.isServerScriptOk(response); //hier würde ich gerne die Funtion isServerScriptOk() aufrufen, die allerdings eine Ebene höher (?) liegt...
},
onFailure: function()
{
progressIndicator('comment-sent', {status: 'fail'});
},
onCreate: function()
{
progressIndicator('comment-sent', {status: 'load'});
writeUserData(['name', 'mail']);
}
});
}
},
isServerScriptOk: function(response)
{
if(response.responseText)
{
progressIndicator('comment-sent', {status: 'ok'});
}
else
{
progressIndicator('comment-sent', {status: 'fail'});
}
},
toggleNewComment: function()
{
Effect.toggle('newcomment', 'slide', {beforeStart: function() {
insertUserData(readUserData(['name', 'mail']));
}});
}
}
Ich hoffe auf hilfreiche Antworten,
vielen Dank im Voraus!