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
--
AnthonyCalderon - 15 Oct 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is 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="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"}%"> 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