Issuepedia:Code/lib/links

ShowLinkData
This is a functionalized version of the code in Issuepedia:Code/show/link. Don't use that anymore; use this. 

        (writings cat )

[[category:    /writings]] 

    <let name=wtAuth append>     <let name=wtAuth append copy=author />    <let name=wtAuth append> (writings cat )

<let name=wtAuthCat append>[[category:    <let name=wtAuthCat append copy=author />    <let name=wtAuthCat append>/writings]] </if>  <let name=wtSource>  <let name=wtSource append copy=data[Source] />  <let name=wtSource append> (articles cat ) </if>

 <let name=wtDate append>[[category:  <let name=wtDate append copy=data[Date] />  <let name=wtDate append>]]

<let name=wtAuth append copy=wtAuthCat />

<let name=wtSource append>[[category:  <let name=wtSource append copy=data[Source] />  <let name=wtSource append>/articles]] </if>

Store data in page properties: <let name=data self save />

<let name=wtTitle> == <let name=wtTitle append copy=data[Title] /> <let name=wtTitle append>==  <let name=wtTitle append>

longer text
<let name=wtTextShort>

shorter text
<let name=wtTextShort append copy=data[TextShort] /> </if> <let name=wtTextShort />

 <let name=wtLink>  <let name=wtLink append copy=data[wpage] />  <let name=wtLink append> </if> <let name=wtLink append copy=data[URL] /> <let name=topics copy=data[Topics] /> <for xps=$topics let=topic> <let name=wtTopics append>   <let name=wtTopics append copy=topic />  <let name=wtTopics append>

<let name=wtCatgs append>   <let name=wtCatgs append copy=topic />  <let name=wtCatgs append>

 <let name=wtCatgs append> [[category:    <let name=wtCatgs append copy=topic />    <let name=wtCatgs append>]] </if>

 <let name=TitleSort copy=data[TitlePlain] /> </if> <let name=TitleSort copy=data[Title] />  [[category:data/links|  <let name=cattag append copy=TitleSort />  ]] </if>

Specs
<get name=wtTitle /> <get name=data index=Text /><get name=wtTextShort /> <let name=wtDate null /> <let name=wtAuth null /> <let name=wtSource null /> <let name=wtTopics null /> <let name=wtCatgs null />

GetBrief
<func GetBrief> <let name=links.out> <let name=links.out append copy=data[Date] /> <let name=links.out append>''' :more:talk:

 <let name=wtLink>      <let name=wtLink append copy=data[Title] />      <let name=wtLink append> <let name=data[wpage] null /> </if> <let name=wtLink>[ <let name=wtLink append copy=data[URL] /> <let name=wtLink append> <let name=wtLink append copy=data[Title] /> <let name=wtLink append>]

<let name=links.out append copy=wtLink /> <let name=links.out append> &sect;

<let name=text copy=data[TextShort] /> </if> <let name=text copy=data[Text] len=200 />

<let name=links.out append copy=text trim /> <let name=links.out append> more...

ShowRecent
calls: GetBrief <func ShowRecent max> <let name=including val=1 /> <for table="qryW3_Titles_Catgs" where="(cl_to='Data/links') AND (page_namespace=0)" sort="page_title DESC" limit=$max hide> <let name=pg_title val="@row.page_title" />  <load page=$pg_title nocat /> </if>  <call GetBrief /> </if>

<let name=links.out> <let name=links.out append copy=pg_title /> <let name=links.out append>]] <let name=links.rtn append copy=links.out /> <let name=links.out />

ShowTopic_old(iTopic,iMax)
<func ShowTopic_old iTopic iMax> <let name=including val=1 /> <let name=topic farg=iTopic /> </if> <let name=topic self with="_">

<let name=sqlWhere>(page_namespace=0) AND (cl_to='  <let name=sqlWhere append copy=topic />  <let name=sqlWhere append>')

<for table="qryW3_Titles_Catgs" where=$sqlWhere sort="page_title DESC" empty="no items yet" limit=$iMax hide> <let name=pg_title val="@row.page_title" />  <load page=$pg_title local nocat /> </if>  <call GetBrief /> </if> <let name=links.out> <let name=links.out append copy=pg_title /> <let name=links.out append>]] <let name=links.rtn append copy=links.out />

ShowTopic_old(topic,max)
This can be deleted if there are no problems with new ShowTopic. <func ShowTopic_old topic max> <let name=topic self with="_">

(cl_to='  SELECT q1.* FROM qryW3_Titles_Catgs AS q1 LEFT JOIN qryW3_Titles_Catgs AS q2 ON q1.cl_from=q2.cl_from WHERE (q1.cl_to='Data/links') AND (q2.cl_to=' <let name=sql append copy=topic /> ') ORDER BY page_title DESC    LIMIT     <let name=sql append copy=max />  </if>  <let name=sql append copy=max />

<let name=links.rtn null /> <for sql=$sql> <let name=pg_nspace_code> <let name=pg_title val="@row.page_title" /> <let name=pg_name copy=pg_nspace /> <let name=pg_name append>: <let name=pg_name append copy=pg_title /> <get name=data load page=$pg_title /> <let name=data[Title] null />  <call GetBrief /> </if> <let name=links.out> <let name=links.out append copy=pg_title /> <let name=links.out append>]] <let name=links.rtn append copy=links.out />

ShowTopic(topic,max)
<func ShowTopic topic max> <let name=topic self with="_">

(cl_to='  SELECT q1.* FROM qryW3_Titles_Catgs AS q1 LEFT JOIN qryW3_Titles_Catgs AS q2 ON q1.cl_from=q2.cl_from WHERE (q1.cl_to='Data/links') AND (q2.cl_to=' <let name=sql append copy=topic /> ') ORDER BY page_title DESC    LIMIT     <let name=sql append copy=max />  </if>  <let name=sql append copy=max />

<let name=links.rtn null /> <for sql=$sql> <let name=pg_nspace_code> <let name=pg_title val="@row.page_title" /> <let name=pg_name copy=pg_nspace /> <let name=pg_name append>: <let name=pg_name append copy=pg_title /> <let name=data load array page=$pg_title />  <call GetBrief /> </if> <let name=links.out> <let name=links.out append copy=pg_title /> <let name=links.out append>]] <let name=links.rtn append copy=links.out />