Tags:
create new tag
, view all tags

SID-00087: EditTable fails with Inversion of Control

Status: Answered Answered TWiki version: 4.2.3 Perl version: 5.008008
Category: EditTablePlugin Server OS: Ubuntu JeOS, kernel 2.6.24-21-virtual Last update: 2 years ago

I'm looking for a way to simplify / reduce the amount of repeated code in a large group of Topics that all contain many identical EditTables mixed in with lots instructions and legends that go with the EditTables - I got the idea to try this with a View Template. It doesn't quite work. Is this a bug? Has anyone tried this?

I would like to create many Topics (from a TopicTemplate) that each contain the same set of EditTables. Each topic would have it's own cell values after editing, but the tables formats would be identical.

  • TopicAlpha
    • EditTable1
    • EditTable2
    • EditTable3
  • TopicBeta
    • EditTable1
    • EditTable2
    • EditTable3
  • TopicGamma
    • EditTable1
    • EditTable2
    • EditTable3
Then I would like to create a ViewTemplate that specifies how the Topics are displayed. For one example I would put a legend above each table that describes how to change the cell contents.
  • Legend1
  • Include EditTable1
  • Legend2
  • Include EditTable2
  • Legend3
  • Include EditTable3
Then I would specify the ViewTemplate in each Topic with the %VIEW_TEMPLATE% variable

In other words instead of having the page flow contained in the Topics, only the data would be in the Topics. The page flow would be contained in the ViewTemplate that was specified in the Topic.

This works fine with regular tables, and it looks fine with EditTables, until I press the edit button. All of the tables open at once. Only the first EditTable is modified, even if you edited one of the other tables.

When I look at the raw html from Twiki I see that all of the tables have the the same two lines

  • <a name="edittable1"></a>
  • <form name="edittable1">
Usually, those lines are unique for each EditTable

NOTES:

-- BurtWelsh - 06 Feb 2009

Discussion and Answer

I have not looked into details, but here are some thoughts:

Consider sectional include or regular expression include to include only the table, without the edit table button. Manually add the equivalent of the edit button in the including topic, pointing to the right table in the included topic.

Edit tables are great for quickly implementing a workflow. Consider creating a TWikiForms based application. You have much more flexibility and control over your workflow.

-- PeterThoeny - 06 Feb 2009

Yes - I like the way TWikiForms isolate the formatting from the data, but my Topics have ~20 one row tables with 5 - 15 columns each and I'd like to double that. That would be a very long form. Also - some tables are conditionally displayed based on content of other tables. Another thing nice about tables is they're easy to build reports from with SEARCH & TAGME.

I wish I could have several TWikiForms per Topic and they were arranged horizontally smile

Have to admit - I don't know how to add the equivalent of the edit button. Would this be done with a javascript pgm?

-- BurtWelsh - 06 Feb 2009

On edit button equivalent, look at the HTML source of the page you include. For example, here is the HTML code that points to the second table of included page FooBar:

<form name="edittable2" action="%SCRIPTURL{viewauth}%/%WEB%/FooBar#edittable2" method="post">
<input type="hidden" name="ettablenr" value="2" />
<input type="hidden" name="etedit" value="on" />
<table cellspacing="0" id="table2" cellpadding="0" class="twikiTable" rules="rows" border="1">
<input type="hidden" name="etrows" value="1" />
<input class="editTableEditImageButton" type="image" src="%PUBURL%/%SYSTEMWEB%/EditTablePlugin/edittable.gif" alt="Edit this table" />
</form>

On TWiki form layout, there is a way to arrange the elements, see screenshots at Support/SID-00029.

-- PeterThoeny - 07 Feb 2009

On edit button equivalent - Tried a couple of things

  • CdtgView1Template / CdtgView1Test - don't think this is what you meant, it works , but the EDITTABLE definition and Header Row are in the topic instead of the template - Do you think there's a way to move the header row and table def to the template?
  • CdtgView2Template / CdtgView2Test - same idea,but tried to move the table definitions and column titles to the template only - the two tables open independently, but the data line always resets to defaults when opened, and you can see the table opened and closed at the same time.
  • I tried several things with html code copied from html source, but the edit button didn't open the table, the html source generated this way was lacking
<!--EDITTABLEPLUGIN--><style type="text/css" media="all">
@import url("http://twiki.org/p/pub/TWiki04x02/EditTablePlugin/edittable.css");
</style>

On the TWiki form layout - Do you think this is the best way to move all of the column headings and table definitions out of the Topic?

-- BurtWelsh - 12 Feb 2009

Change status to:

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
SupportForm
Status Answered
Title EditTable fails with Inversion of Control
SupportCategory EditTablePlugin
TWiki version 4.2.3
Server OS Ubuntu JeOS, kernel 2.6.24-21-virtual
Web server Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g
Perl version 5.008008
Topic revision: r5 - 2009-02-12 - BurtWelsh
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.