Tags:
create new tag
view all tags

Question

OMG, I have spent about 7 hours reading, trying and reading again, but still I have no idea how to find the solution.

First, what I'd like to do and what I have done:

Goal

  • Tool to gather employee's weekly report information
  • Needs:
    1. Form for employees to create/edit weekly reports done, works
      • The topics created look like WeeklyAndreBonhote2004x46
      • There is a form attached to them having fields like Projects (textarea), Personal (textarea), Mgmt_Action (option)
    2. Topic for the boss to review it
      • Table format, based on a search on the year and week
      • Depending on Mgmt_Action, set some table cell's background to red or green

Implemented like ...

<table border="1">
<tr bgcolor="#eeeeff""><th>Topic</th><th>Projects</th><th>Personal Issues</th><th>Action Required?</th></th>
%SEARCH{"Weekly.*%URLPARAM{year}x%URLPARAM{week}%" type="regex" scope="topic" nototal="on" nosearch="on" 
format="<tr valign=\"top\"><td>$topic</td><td valign=\"top\"><pre>$formfield(Projects)</pre></td>
<td><pre>$formfield(Personal)</pre></td><td>$formfield(Mgmt_Action)</td></tr>"}%
</table>

(the %SEARCH% thing on one line, of course)

Problems

Many ...

  • The thing above is ugly and not how it should be like
  • To change the above to work without <pre> tags inside wiki tables, I tried this:

%SEARCH{"Weekly.*2004x46" nosearch="on" type="regex" nototal="on" format="$percntCALC{| 
$SET(var,$formfield(Personal))$SUBSTITUTE($GET(var),[\n\r],<br />,,r) |}$percnt"}%

  • Somehow it doesn't find the newlines. As well, I tried to replace [\n\r] with something like $ or [$]

  • Now, I have this "solution", which works so far:

%SEARCH{"Weekly.*" scope="topic" nosearch="on" nototal="on" type="regex" format="$percntCALC{| $web.$topic | $formfield(Mgmt_Action) | 
$SET(var,$formfield(Mgmt_Action))$IF($EXACT($GET(var),No),<font color=\"green\">No</font>,Yes) |}$percnt"}%

  • Adding a textarea based formfield breaks (of course) the table ... having a normal html table around it and <td> and stuff doesn't work, because the SpreadSheetPlugin stuff doesn't get interpreted anymore.

What would help?

  1. A generic way to display multi-line form fields in a table (html or wiki table, I don't care)
  2. A way to substitute linebreaks in such form fields
  3. Any other hints, apart from rebooting the PC smile

Somehow I feel like I am contributing most of the questions here, but no answers. I have subscribed to this web, but until now I haven't received any e-mail. SF-net issues?

Thanks a million

André

Environment

TWiki version: TWikiBetaRelease2004x10x24 (or something else, but quite recent)
TWiki plugins: Many, irrelevant
Server OS: irrelevant
Web server: irrelevant
Perl version: irrelevant
Client OS: irrelevant
Web Browser: irrelevant
Categories: Forms, Search

-- AndreBonhote - 10 Nov 2004

Answer

Maybe RecursiveRenderPlugin can help here.

-- FranzJosefSilli - 10 Nov 2004

Hi Franz Josef. Sorry, it won't help .. how should I define the macro inside the ?

-- AndreBonhote - 11 Nov 2004

Guess then I haven't understood your problem yet. Sorry. I thought you have a problem with search result from formfield breaking your table due to line breaks, so I proposed using |<render> $formfield(someformfield) </render>| in format string of SEARCH, but I guess that won't work, will it?

-- FranzJosefSilli - 11 Nov 2004

Oh my, I didn't even see that one. Tried this, and it doesn't break the table anymore smile Thanks a lot. I'll try to substitute the newlines now using the render tags ... keep you updated!

Update: Didn't work (as I expected, it wouldn't have made sense). You know, I think I leave it like this and use the <pre> with a custom CSS style ... I give up. FYI: It should look like this:

This
is
an
example

But does look like that:

This is an example

As I said: substituting newlines with <br /> would do the job.

Thanks a lot!

-- AndreBonhote - 11 Nov 2004

Hm, did you have a look at FormattedSearchWithSubstitution or the latest FormattedSearchWithSummary, yet?

-- FranzJosefSilli - 11 Nov 2004

FJ, thanks for your response, and thanks for the plugin you mentioned (the RecursiveRenderPlugin). I copied it to SubstituteNewlinesPlugin and changed the code a bit (really, only a very tiny bit), now it's working - it's adding a <br /> to every end of line ($) inside some <substnl> tags.

thanks a lot! I'll put that "plugin" (don't call it like that) onto twiki.org soon, not today.

-- AndreBonhote - 11 Nov 2004

Andre, can you explain in more detail the changes you made in your "Plugins.SubstituteNewlinesPlugin "?

-- ThomasWeigert - 13 Feb 2005

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2005-02-13 - ThomasWeigert
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.