All A's of This B

These INCLUDEs are used by individual edge, node, or view pages. They provide information on, and navigation to, pages of a particular type that are related to the current page.

Edges of a Node (edges_of_node)

Screenshot:

gm_edges_of_node.png

Description:

Used in Node pages (N_ prefix); for examples, see NodeIndex.

  1. Search across all Edge pages (E_ prefix)
  2. If page lists this Node in its Role# form fields,
    print the result as
    • link to topic, using the Edge title as the link text
    • Precis (inside Twisty)
    • list of all Views that include this Edge (inside Twisty)

Code:

%STARTSECTION{"edges_of_node"}%

%~~ CALC{ $SET(SR,
~~~   $percntSEARCH{search="META:FIELD.*name=\"Role[1-5]\".*value=\".*
*~~     %FORMFIELD{"NodeName" topic="%the_topic%"}%.*\"" topic="E_*"
~~~     type="regex" nonoise="on" separator=", " format="$topic" }$percnt ) }%

<!--
T: edges_of_node:<br>
T: &nbsp;&nbsp; Formfield:      'FORMFIELD{"NodeName" topic="%the_topic%"}'<br>
T: &nbsp;&nbsp; NodeName:       '%FORMFIELD{"NodeName" topic="%the_topic%"}%<'br>
T: &nbsp;&nbsp; INCLUDINGTOPIC: '%INCLUDINGTOPIC%'<br>
T: &nbsp;&nbsp; the_topic:      '%the_topic%'<br>
T: &nbsp;&nbsp; SR:             '%CALC{$GET(SR)}%'<br>
-->

%IFDEFINEDTHEN{"%CALC{$GET(SR)}%"}% 

%~~ SEARCH{
~~~ search="
*~~   META:FIELD.*name=\"Role[1-5]\".*value=\".*%FORMFIELD{"NodeName" topic="%the_topic%"}%
*~~ "
~~~ topic="E_.*" type="regex" zeroresults="on" nosearch="on"  nototal="off"
~~~ order="formfield(NodeTitle)"
~~~ format="
~~~ [[$topic][$formfield(EdgeTitle)]] &nbsp;&nbsp;$n
~~~ $percntTWISTY{
~~~     showlink=\" \"
~~~     hidelink=\" \"
~~~     suffix=\"&nbsp;&nbsp;$formfield(EdgeSummary)\"
~~~     showimgright=\"%ICONURLPATH{toggleopen-small}%\" 
~~~     hideimgright=\"%ICONURLPATH{toggleclose-small}%\"
~~~     start=\"hide\"
~~~  }$percnt $n
~~~   <ul><p>$formfield(EdgePrecis)
~~~   <p><b>Included in:</b>
~~~   <ul>
~~~     $percntFORMFIELD{\"ViewNames\" topic=\"$topic\"}$percnt
~~~   </ul></ul> $n 
~~~ $percntENDTWISTY$percnt
~~~ $n $n
~~~ "
~~~ }%

%ELSEDEFINED% 
  %RED% Egad! %ENDCOLOR%
  No Edge pages reference the Node `%FORMFIELD{"NodeName" topic="%the_topic%"}%'.
  (This can't be good.)<p>
%FIDEFINED%

%ENDSECTION{"edges_of_node"}%

Edges of a View (edges_of_view)

Screenshot:

gm_edges_of_view.png

Description:

Used in View pages (V_ prefix); for examples, see ViewIndex.

  1. Search across all Edge pages (E_ prefix)
  2. If page lists this View in its ViewNames form field,
    print the result as
    • link to topic, using the Edge title as the link text
    • Precis (inside Twisty)
    • list of all Views that include this Edge (inside Twisty)

Code:

%STARTSECTION{"edges_of_view"}%

%~~ CALC{ $SET(SR,
~~~   $percntSEARCH{"META:FIELD.*name=.ViewNames.*value=.*
*~~     %FORMFIELD{"ViewName" topic="%the_topic%"}%" topic="E_*"
~~~     type="regex" nonoise="on" separator=", " format="$topic" }$percnt ) }%

<!--
T: edges_of_view:<br>
T: &nbsp;&nbsp; INCLUDINGTOPIC: '%INCLUDINGTOPIC%'<br>
T: &nbsp;&nbsp; the_topic:      '%the_topic%'<br>
T: &nbsp;&nbsp; SR:             '%CALC{$GET(SR)}%'<br>
-->

%IFDEFINEDTHEN{"%CALC{$GET(SR)}%"}% 

%~~ SEARCH{
~~~ search="
*~~   META:FIELD.*name=.ViewNames.*value=.*%FORMFIELD{"ViewName" topic="%the_topic%"}%
*~~ "
~~~ topic="E_.*" type="regex" zeroresults="on" nosearch="on"  nototal="off"
~~~ order="formfield(ViewTitle)"
~~~ format="
~~~ [[$topic][$formfield(EdgeTitle)]] &nbsp;&nbsp;$n
~~~ $percntTWISTY{
~~~     showlink=\" \"
~~~     hidelink=\" \"
~~~     suffix=\"&nbsp;&nbsp;$formfield(EdgeSummary)\"
~~~     showimgright=\"%ICONURLPATH{toggleopen-small}%\" 
~~~     hideimgright=\"%ICONURLPATH{toggleclose-small}%\"
~~~     start=\"hide\"
~~~  }$percnt $n 
~~~ <ul>
~~~   <p>$formfield(EdgePrecis)
~~~   <p><b>Included in:</b>
~~~   <ul>
~~~     $percntFORMFIELD{\"ViewNames\" topic=\"$topic\"}$percnt
~~~   </ul>
~~~ </ul> $n 
~~~ $percntENDTWISTY$percnt
~~~ $n $n
~~~ "
~~~ }%

%ELSEDEFINED% 
  %RED% Egad! %ENDCOLOR%
  No Edge pages reference the View `%FORMFIELD{"ViewName" topic="%the_topic%"}%'.
  (This can't be good.)<p>
%FIDEFINED%

%ENDSECTION{"edges_of_view"}%

Nodes of an Edge (nodes_of_edge)

Screenshot:

gm_nodes_of_edge.png

Description:

Used in Edge pages (E_ prefix); for examples, see EdgeIndex.

For each name in an Edge's Role# form fields:
  1. Convert from Node name to TWiki topic (look up the page that describes that Node)
  2. Set variable RESULTS to that topic (for convenience)
  3. Show a link to that page, using the page title as the link text
  4. Set a twisty
    • twisty follows the link
    • summary form field of Node topic is used as Twisty "suffix"
    • precis form field from the page goes inside the Twisty (indented)

Code:

%STARTSECTION{"nodes_of_edge"}%

%FOREACH{"name" in="%FORMFIELD{"Role1" topic="%the_topic%"}%,
                    %FORMFIELD{"Role2" topic="%the_topic%"}%,
                    %FORMFIELD{"Role3" topic="%the_topic%"}%,
                    %FORMFIELD{"Role4" topic="%the_topic%"}%,
                    %FORMFIELD{"Role5" topic="%the_topic%"}%"}%

   %CALC{ $SET(RESULTS,
~~~  $percntSEARCH{"META:FIELD.*name=\"NodeName\".*value=\"$name\""
~~~  topic="N_*" type="regex" nonoise="on" separator=", " format="$topic" }$percnt ) }%

<!--
T: nodes_of_edge:<br>
T: &nbsp;&nbsp; INCLUDINGTOPIC: '%INCLUDINGTOPIC%'<br>
T: &nbsp;&nbsp; the_topic:      '%the_topic%'<br>
T: &nbsp;&nbsp; name:           '$name'<br>
T: &nbsp;&nbsp; RESULTS:        '%CALC{$GET(RESULTS)}%'<br>
-->

$percntIFDEFINEDTHEN{"%CALC{$GET(RESULTS)}%"}% 
 
    [[%CALC{$GET(RESULTS)}%]
*~~  [$name]]
    &nbsp;&nbsp;
    $percntTWISTY{
       showlink=" "
       hidelink=" "
       suffix="&nbsp;&nbsp; $percntFORMFIELD{"NodeSummary" topic="%CALC{$GET(RESULTS)}%" }% "
       showimgright="%ICONURLPATH{toggleopen-small}%"
       hideimgright="%ICONURLPATH{toggleclose-small}%"
    }% 
    <ul>
    <p>
    $percntFORMFIELD{"NodePrecis" topic="%CALC{$GET(RESULTS)}%"}% 
    </ul> $percntENDTWISTY%
    <p>

$percntFIDEFINED%

%NEXT{"name"}%

%ENDSECTION{"nodes_of_edge"}%

Nodes of a View (nodes_of_view)

Screenshot:

gm_nodes_of_view.png

Description:

Used in View pages (V_ prefix); for examples, see ViewIndex.

  1. Search across all Node pages (N_ prefix)
  2. If page lists this View in its ViewNames form field,
    print the result as
    • link to topic, using the Node title as the link text
    • Precis (inside Twisty)
    • list of all Views that include this Node (inside Twisty)

Code:

%STARTSECTION{"nodes_of_view"}%

%~~ CALC{ $SET(SR,
~~~   $percntSEARCH{"META:FIELD.*name=.ViewNames.*value=.*
*~~     %FORMFIELD{"ViewName" topic="%the_topic%"}%" topic="N_*"
~~~     type="regex" nonoise="on" separator=", " format="$topic" }$percnt ) }%

%IFDEFINEDTHEN{"%CALC{$GET(SR)}%"}% 

%~~ SEARCH{
~~~ search="
*~~   META:FIELD.*name=.ViewNames.*value=.*%FORMFIELD{"ViewName" topic="%the_topic%"}%
*~~ "
~~~ topic="N_.*" type="regex" zeroresults="on" nosearch="on"  nototal="off"
~~~ order="formfield(NodeTitle)"
~~~ format="
~~~ [[$topic][$formfield(NodeTitle)]] &nbsp;&nbsp;$n
~~~ $percntTWISTY{
~~~     showlink=\" \"
~~~     hidelink=\" \"
~~~     suffix=\"&nbsp;&nbsp;$formfield(NodeSummary)\"
~~~     showimgright=\"%ICONURLPATH{toggleopen-small}%\" 
~~~     hideimgright=\"%ICONURLPATH{toggleclose-small}%\"
~~~     start=\"hide\"
~~~  }$percnt $n 
~~~ <ul>
~~~   <p>$formfield(NodePrecis)
~~~   <p><b>Included in:</b>
~~~   <ul>
~~~     $percntFORMFIELD{\"ViewNames\" topic=\"$topic\"}$percnt
~~~   </ul>
~~~ </ul> $n 
~~~ $percntENDTWISTY$percnt
~~~ $n $n
~~~ "
~~~ }%

%ELSEDEFINED% 
  %RED% Egad! %ENDCOLOR%
  No Node pages reference the View `%FORMFIELD{"ViewName" topic="%the_topic%"}%'.
  (This can't be good.)<p>
%FIDEFINED%

%ENDSECTION{"nodes_of_view"}%

Views of an Edge (views_of_edge)

Screenshot:

gm_views_of_edge.png

Description:

Used in Edge pages (E_ prefix); for examples, see EdgeIndex.

For each name in an Edge's ViewNames form field:
  1. Convert from View name to TWiki topic (look up the page that describes that view)
  2. Set variable THE_PAGE to that topic (for convenience)
  3. Show a link to that page, using the page title as the link text
  4. Set a twisty
    • twisty follows the link
    • summary form field of View topic is used as Twisty "suffix"
    • precis form field from the page goes inside the Twisty (indented)

Code:

%STARTSECTION{"views_of_edge"}%

%FOREACH{"name" in="%FORMFIELD{"ViewNames" topic="%the_topic%"}%"}%

   $percntCALC{ $SET(THE_PAGE,
~~~  $percntSEARCH{"META:FIELD.*ViewName.*value=.$name\""
~~~    topic="V_*" type="regex" nonoise="on" format="$topic" }% ) }%

$percntIFDEFINEDTHEN{"$percntCALC{$GET(THE_PAGE)}%"}% 
 
    [[$percntCALC{$GET(THE_PAGE)}%]
*~~  [$percntFORMFIELD{"ViewTitle" topic="$percntCALC{$GET(THE_PAGE)}%" }%]]
    &nbsp;&nbsp;
    $percntTWISTY{
       showlink=" "
       hidelink=" "
       suffix="&nbsp;&nbsp; $percntFORMFIELD{"ViewSummary" topic="$percntCALC{$GET(THE_PAGE)}%" }% "
       showimgright="%ICONURLPATH{toggleopen-small}%"
       hideimgright="%ICONURLPATH{toggleclose-small}%"
    }% 
    <ul>
    <p>
    $percntFORMFIELD{"ViewPrecis" topic="$percntCALC{$GET(THE_PAGE)}%"}% 
    </ul> $percntENDTWISTY%
    <p>

$percntELSEDEFINED% 
  %RED% Egad! %ENDCOLOR%
  No View pages reference the Edge `$name'.
  (This can't be good.)<p>
$percntFIDEFINED%

%NEXT{"name"}%

%ENDSECTION{"views_of_edge"}%

Views of a Node (views_of_node)

Screenshot:

gm_views_of_node.png

Description:

Used in Node pages (N_ prefix); for examples, see NodeIndex.

For each name in a Node's ViewNames form field:
  1. Convert from View name to TWiki topic (look up the page that describes that View)
  2. Set variable THE_PAGE to that topic (for convenience)
  3. Show a link to that page, using the page title as the link text
  4. Set a twisty
    • twisty follows the link
    • "exec summary" of View topic is used as Twisty "suffix"
    • precis info from the page goes inside the Twisty (indented)

Code:

%STARTSECTION{"views_of_node"}%
%FOREACH{"name" in="%FORMFIELD{"ViewNames" topic="%the_topic%"}%"}%

   $percntCALC{ $SET(THE_PAGE,
~~~  $percntSEARCH{"META:FIELD.*ViewName.*value=.$name\""
~~~    topic="V_*" type="regex" nonoise="on" format="$topic" }% ) }%

$percntIFDEFINEDTHEN{"$percntCALC{$GET(THE_PAGE)}%"}% 
 
    [[$percntCALC{$GET(THE_PAGE)}%]
*~~  [$percntFORMFIELD{"ViewTitle" topic="$percntCALC{$GET(THE_PAGE)}%" }%]]
    &nbsp;&nbsp;
    $percntTWISTY{
       showlink=" "
       hidelink=" "
       suffix="&nbsp;&nbsp; $percntFORMFIELD{"ViewSummary" topic="$percntCALC{$GET(THE_PAGE)}%" }% "
       showimgright="%ICONURLPATH{toggleopen-small}%"
       hideimgright="%ICONURLPATH{toggleclose-small}%"
    }% 
    <ul>
    <p>
    $percntFORMFIELD{"ViewPrecis" topic="$percntCALC{$GET(THE_PAGE)}%"}% 
    </ul> $percntENDTWISTY%
    <p>

$percntELSEDEFINED% 
  %RED% Egad! %ENDCOLOR%
  No View pages reference the Node `$name'.
  (This can't be good.)<p>
$percntFIDEFINED%

%NEXT{"name"}%
%ENDSECTION{"views_of_node"}%


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r5 - 19 Aug 2008, RichMorin

Available Webs


This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email