sub getListOfWebs {
my ($this, $filter, $web, $depth) = @_;
...
if (! defined($depth)) {$depth = -1;}
...
my @webList = _getSubWebs( $this, $web, $depth );
...
}
sub _getSubWebs {
my ($this, $web, $depth) = @_;
my @webList;
if ($depth == -1 || $depth > 0) {
if ($depth = -1) {$depth -= 1;}
@webList = $handler->getWebNames();
...
push(@subWebList, _getSubWebs($this, $subWeb, $depth));
}
}
return @webList;
}
/lib/TWiki.pm
sub WEBLIST {
...
my $depth = $params->{depth} || -1;
...
push( @list, $this->{store}->getListOfWebs( 'user,public,allowed', $showWeb, $depth ) );
...
push( @list, $this->{store}->getListOfWebs( 'template,allowed', $showWeb, $depth ));
...
}
NOSEARCHALL = on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
%WEBLIST{"format" ...}%
| Parameter: | Description: | Default: |
|---|---|---|
"format" | Format of one line, may include $name (the name of the web), $qname (the name of the web in double quotes), $indentedname (the name of the web with parent web names replaced by indents, for use in indented lists), and $marker (which expands to marker for the item matching selection only) | "$name" |
format="format" | (Alternative to above) | "$name" |
separator=", " | Line separator | "$n" (new line) |
web="" | if you specify $web in format, it will be replaced with this | "" |
webs="public" | Comma separated list of webs, public expands to all non-hidden.NOTE: Administrators will see all webs, not just the public ones | "public" |
marker="selected" | Text for $marker if the item matches selection | "selected" |
selection="%WEB%" | Current value to be selected in list | selection="%WEB%" |
subwebs="Sandbox" | show webs that are a sub-web of this one (recursivly) | "" |
depth="2" | Limits the display of sub-webs to a maximum depth. -1 or 0 = No limit, 1 = Only top level webs, 2 = Top webs and 1st level children only etc. | "-1" |
%WEBLIST{" * [[$name.WebHome]]"}% - creates a bullet list of all webs.
<form><select name="web"> %WEBLIST{"<option $marker value=$qname>$name</option>" webs="Trash, public" selection="%WEB%" separator=" "}% </select></form> - creates a dropdown of all public webs + Trash web, with the current web highlighted.
depth is aligned with parameter names of existing variables, if any.
-- PeterThoeny - 22 May 2008
Ping. Small and useful feature proposal, with code. Any owner?
-- PeterThoeny - 2009-11-24
how to use it in??
%WEBLIST{" * <span style=\"white-space:nowrap\"><a href=\"%SCRIPTURLPATH{"view"}%/$name/%HOMETOPIC%\"><img src=\"%ICONURL{web-bg}%\" border=\"0\" alt=\"\" width=\"16\" height=\"16\" style=\"background-color:%$markerVAR{\"WEBBGCOLOR\" web=$qname}$marker%\" /> <nop>$indentedname</a></span>"}%
please help
-- LukaszRutkowski - 2012-03-27
Lukasz, please ask support questions in the Support web.
-- PeterThoeny - 2012-03-27
Actually, this is a proposed feature. It has not been implemented. TWiki is open source software. I invite you to get involved, fix/enhance part of TWiki, and contribute it back to the community.
-- PeterThoeny - 2012-03-27
| ChangeProposalForm | |
|---|---|
| TopicClassification | FeatureRequest |
| TopicSummary | The WEBLIST feature could be improved with a depth limit |
| CurrentState | UnderInvestigation |
| CommittedDeveloper | |
| ReasonForDecision | None |
| DateOfCommitment | |
| ConcernRaisedBy | |
| BugTracking | |
| OutstandingIssues | |
| RelatedTopics | |
| InterestedParties | |
| ProposedFor | |
| TWikiContributors | |