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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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


2 Posts   1514 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);");
}

Avatar
Andante

Community Member, 231 Posts

9 July 2007 at 12:52pm

Good spotting, thanks! :)