Tags:
create new tag
, view all tags

Question

I'm trying to get the personal links from the AnthonyCalderonLeftBar to appear as a drop-down list. I'm trying to repurpose existing code:

%SEARCH{"LeftBar" web="Main" topic="%WIKINAME%LeftBar" nonoise="on" format=""}%
<select name="personalbar">%CALC{$LISTJOIN($sp, $LISTMAP(<option>$item</option> , $LISTSORT($GET(personallinks))))}%</select>

Unfortunately, this only produces the first link. Any assistance is greatly appreciated!

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS: Windows XP
Web Browser: Firefox 3
Categories: Forms

-- AnthonyCalderon - 15 Oct 2008

Answer

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.

You can perform the search using regex:

<select class="twikiSelect" name="personalbar">
%SEARCH{"^   *\s*.*$" web="Main" topic="%WIKINAME%LeftBar" type="regex" multiple="on" casesensitive="on" nonoise="on" format="<option>$pattern(.*   \*\s([^\n]*).*)</option>"}%
</select>

-- ArthurClemens - 15 Oct 2008

Thanks so much! Now I just have to figure out how to set the value of each option to the link. Since each link can take the form of WikiWord, [[WikiWord][Non-Wiki Word]], or <a href="www.twiki.org">Link</a>, I'm guessing this would require the SpreadSheet Plugin's IF functionality...

-- AnthonyCalderon - 15 Oct 2008

Can anyone help with the search string to pull the value of each option? Here's what I came up with:

<select name="personalbar"><option selected value="">My Links...</option>%SEARCH{"^   *\s*.*$" web="Main" topic="%WIKINAME%LeftBar" type="regex" multiple="on" casesensitive="on" nonoise="on" format="$percntCALC{\"$IF([\[][\[]([A-Z]+)([a-z]+)([A-Z]+)([^\]]+)|[\[][\[]([A-Za-z]+)\.([A-Za-z]+)([^\]]+),<option value="$percntSCRIPTURLPATH{\"view\"}$percnt/$percntWEB$percnt/WebHome?topic=$pattern(.*[\[][\[]([^\]]*).*)">$pattern(.*   \*\s([^\n]*).*)</option>,<option value="$pattern(.*[\[][\[]([^\]]*).*)">$pattern(.*   \*\s([^\n]*).*)</option>)\"}$percnt"}%</select>
I also tried using $SEARCH, but I'm not sure what string I should compare it to. Thanks!

-- AnthonyCalderon - 21 Oct 2008

Scratch that...found a better solution that ALMOST works:

<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%" name="LinksBar">
<select name="personalbar" onchange="this.form.topic.value=this.options[this.selectedIndex].value; this.form.submit()"><option selected value="">My Links...</option>%SEARCH{"^   *\s*.*$" web="Main" topic="%WIKINAME%LeftBar" type="regex" multiple="on" casesensitive="on" nonoise="on" format="<option value=\"$pattern(.*[\[][\[]([^\]]*).*)\">$pattern(.*   \*\s([^\n]*).*)</option>"}%<option value="%SCRIPTURL%/%MAINWEB%/%WIKINAME%LeftBar?t=%GMTIME{"$epoch"}%">&nbsp; edit this list</option></select><input type="hidden" name="topic"></form>

Can anyone help me figure out how to get it to open backlinks? And also what type of string I would use to pull links that don't fall in a double-bracket format?

-- AnthonyCalderon - 21 Oct 2008

Closing this after more than 30 days of inactivity. Please feel free to re-open if needed.

-- PeterThoeny - 10 Dec 2008

 
Change status to:
Topic revision: r7 - 2008-12-10 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, 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.