Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Double page reading afterg the class change


Go to End


1667 Views

Avatar
xmedeko

Community Member, 94 Posts

4 July 2007 at 2:01pm

Edited: 04/07/2007 2:01pm

Hi,

when I change the class in the Behaviour tab and save the page, then there's twice:

FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");

in the response. So the page is read twice from the server. I have comented the first one in the LeftAndMain.php:

// Update the icon if the class has changed
if($originalClass != $record->ClassName) {
$record->setClassName( $record->ClassName );
$newClass = $record->ClassName;
$record = $record->newClassInstance( $newClass );

FormResponse::add("if(\$('sitetree').setNodeIcon) \$('sitetree').setNodeIcon($record->ID, '$originalClass', '$record->ClassName');");
// fixed double reading //FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
}

// HACK: This should be turned into somethign more general
if( ($record->class == 'VirtualPage' && $originalURLSegment != $record->URLSegment) ||
($originalClass != $record->ClassName) || self::$ForceReload == true) {
FormResponse::add("$('Form_EditForm').getPageFromServer($record->ID);");
}