• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item4918: checkpoint-save ignores EDIT_TEMPATE

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   minor 4.2.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

If a topic makes use of an EDIT_TEMPLATE preference, and this edit template hides the textarea using a TMPL:INCLUDE{editform}, a checkpoint-save will lose the edit tempate settings. It falls back to the default edit. The standard editform tempalte sets a hidden formfiled editaction to form, which is to be used on a checkpoint roundtrip. However, Edit.pm will happily read the EDIT_TEMPLATE settings and then append form to it for the next edit cycle. For example given EDIT_TEMPLATE=FormEdit it will try to read the template FormEditform after a checkpoint-save. As this does not exist, it will fall back to read the edit template.

That's an error in all TWiki-4.x versions.

Here's the responsible code from Edit.pm

1    # Get edit template, standard or a different skin
2    my $template = $query->param( 'template' ) ||
3   $session->{prefs}->getPreferencesValue('EDIT_TEMPLATE') ||
4        $templateName;
5
6    $tmpl =
7      $session->templates->readTemplate( $template.$editaction, $skin );
8
9    if( !$tmpl && $template ne $templateName ) {
10        $tmpl = $session->templates->readTemplate( $templateName, $skin );
11   }
12
13    if( !$tmpl ) {
14        throw TWiki::OopsException(

Ok, so what happens here? First, the name of the template to be used for editting is read in lines 2-4. This will find the EDIT_TEMPLATE settings in the topic. However in line 6-7 it will append the $editaction. This is the empty string the first time the topic is editted, and form during the checkpoint-save. So the first time the correct edit template is found in lines 6-7. Not so the second time. The second time, it will fall back to read the 'edit' template ($templateName = 'edit' in general). At this point nor the template specified via urlparam, nor the EDIT_TEMAPLTE settings will be used anymore.

So what exactly is line 9 telling me? Why is there a $template ne $templateName check? I'd remove it and replace lines 9+10 with

    if( !$tmpl ) {
        $tmpl = $session->templates->readTemplate( $template, $skin );
    }

-- TWiki:Main/MichaelDaum - 31 Oct 2007

Changed to BeingWorkedOn pending Micha's checkin

CC

Done

MD

ItemTemplate
Summary checkpoint-save ignores EDIT_TEMPATE
ReportedBy TWiki:Main.MichaelDaum
Codebase 4.1.2, 4.2.0, ~twiki4
SVN Range TWiki-4.3.0, Fri, 12 Oct 2007, build 15261
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:15543 TWikirev:15544
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r9 - 2008-01-22 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback