Difference between revisions of "Issuepedia:Code/lib/links"
< Issuepedia:Code | lib
Jump to navigation
Jump to search
m (limit 5->20 (debugging)) |
(→GetBrief(): updated syntax) |
||
(40 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | < | + | ===ShowLinkData()=== |
+ | This is a functionalized version of the code in [[Issuepedia:Code/show/link]]. Don't use that anymore; use this. | ||
+ | <func ShowLinkData> | ||
+ | <let name=wtDate>{{date|</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>}}{{datecat|</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>}}</let> | ||
+ | <if flag=$data[Author]> | ||
+ | <let name=wtAuth>[[</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>]] ([[</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>/writings|writings]]<sub>[[:category:</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>/writings|cat]]</sub>)</let> | ||
+ | |||
+ | <let name=wtAuthCat>[[category:</let> | ||
+ | <let name=wtAuthCat append copy=data[Author] /> | ||
+ | <let name=wtAuthCat append>/writings]]</let> | ||
+ | </if> | ||
+ | |||
+ | <if flag=$data[Authors]> | ||
+ | <let name=auths copy=data[Authors] /> | ||
+ | <let name=wtAuthCat null /> | ||
+ | <for xps=$auths let=author> | ||
+ | <let name=wtAuth append> [[</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>]] ([[</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>/writings|writings]]<sub>[[:category:</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>/writings|cat]]</sub>)</let> | ||
+ | |||
+ | <let name=wtAuthCat append>[[category:</let> | ||
+ | <let name=wtAuthCat append copy=author /> | ||
+ | <let name=wtAuthCat append>/writings]]</let> | ||
+ | </for> | ||
+ | </if> | ||
+ | <if flag=$data[Source]> | ||
+ | <let name=wtSource>[[</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>]] ([[</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles|articles]]<sub>[[:category:</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles|cat]]</sub>)</let> | ||
+ | </if> | ||
+ | |||
+ | <if flag=$docat> | ||
+ | <let name=wtDate append>[[category:</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>]]</let> | ||
+ | |||
+ | <let name=wtAuth append copy=wtAuthCat /> | ||
+ | |||
+ | <let name=wtSource append>[[category:</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles]]</let> | ||
+ | </if> | ||
+ | |||
+ | Store data in page properties: | ||
+ | <let name=data self save /> | ||
+ | |||
+ | <let name=wtTitle>__NOEDITSECTION__ | ||
+ | ==</let> | ||
+ | <let name=wtTitle append copy=data[Title] /> | ||
+ | <let name=wtTitle append>==</let> | ||
+ | <if flag=$data[TextShort]> | ||
+ | <let name=wtTitle append> | ||
+ | ===longer text===</let> | ||
+ | <let name=wtTextShort> | ||
+ | ===shorter text=== | ||
+ | </let> | ||
+ | <let name=wtTextShort append copy=data[TextShort] /> | ||
+ | </if><else> | ||
+ | <let name=wtTextShort /> | ||
+ | </else> | ||
+ | |||
+ | <if flag=$data[wpage]> | ||
+ | <let name=wtLink>[[</let> | ||
+ | <let name=wtLink append copy=data[wpage] /> | ||
+ | <let name=wtLink append>]]</let> | ||
+ | </if><else> | ||
+ | <let name=wtLink append copy=data[URL] /> | ||
+ | </else> | ||
+ | <let name=topics copy=data[Topics] /> | ||
+ | <for xps=$topics let=topic> | ||
+ | <let name=wtTopics append> [[</let> | ||
+ | <let name=wtTopics append copy=topic /> | ||
+ | <let name=wtTopics append>]]</let> | ||
+ | |||
+ | <let name=wtCatgs append> [[:category:</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>|</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>]]</let> | ||
+ | |||
+ | <if flag=$docat> | ||
+ | <let name=wtCatgs append> [[category:</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>]]</let> | ||
+ | </if> | ||
+ | </for> | ||
+ | |||
+ | |||
+ | <if flag=$data[TitlePlain]> | ||
+ | <let name=TitleSort copy=data[TitlePlain] /> | ||
+ | </if><else> | ||
+ | <let name=TitleSort copy=data[Title] /> | ||
+ | </else> | ||
+ | <if flag=$docat> | ||
+ | <let name=cattag>[[category:data/links|</let> | ||
+ | <let name=cattag append copy=TitleSort /> | ||
+ | <let name=cattag append>]]</let> | ||
+ | </if> | ||
+ | |||
+ | <let name=display> | ||
+ | {| | ||
+ | |- | ||
+ | | align=right | '''Date''': || <get name=wtDate /> | ||
+ | |- | ||
+ | | align=right | '''Link''': || <get name=wtLink /> | ||
+ | </let> | ||
+ | |||
+ | <if flag=$wtAuth> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Author''': || <get name=wtAuth /></let> | ||
+ | </if> | ||
+ | <if flag=$wtSource> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Source''': || <get name=wtSource /></let> | ||
+ | </if> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Topics''': || <get name=wtTopics /> | ||
+ | |- | ||
+ | | align=right | '''Categories''': || <get name=wtCatgs /> | ||
+ | |} | ||
+ | </let> | ||
+ | <echo> | ||
+ | {{#set:page type=link}} | ||
+ | {{#set:format version=2.1}} | ||
+ | __NOEDITSECTION__ | ||
+ | ==Specs== | ||
+ | <get name=display /> | ||
+ | <get name=wtTitle /> | ||
+ | <get name=data index=Text /><get name=wtTextShort /><get name=cattag /><hide> | ||
+ | <let name=wtDate null /> | ||
+ | <let name=wtAuth null /> | ||
+ | <let name=wtSource null /> | ||
+ | <let name=wtTopics null /> | ||
+ | <let name=wtCatgs null /> | ||
+ | </echo> | ||
+ | </func> | ||
+ | ===GetBrief()=== | ||
<func GetBrief> | <func GetBrief> | ||
<let name=links.out> | <let name=links.out> | ||
Line 11: | Line 168: | ||
<let name=links.out append>|talk]]: </let> | <let name=links.out append>|talk]]: </let> | ||
− | <if flag=data[wpage]> | + | <if flag=$data[wpage]> |
<let name=wtLink>[[</let> | <let name=wtLink>[[</let> | ||
<let name=wtLink append copy=data[wpage] /> | <let name=wtLink append copy=data[wpage] /> | ||
Line 17: | Line 174: | ||
<let name=wtLink append copy=data[Title] /> | <let name=wtLink append copy=data[Title] /> | ||
<let name=wtLink append>]]</let> | <let name=wtLink append>]]</let> | ||
+ | <let name=data[wpage] null /> | ||
</if><else> | </if><else> | ||
<let name=wtLink>[</let> | <let name=wtLink>[</let> | ||
Line 40: | Line 198: | ||
</func> | </func> | ||
+ | ===ShowRecent()=== | ||
+ | '''calls''': GetBrief() | ||
<func ShowRecent max> | <func ShowRecent max> | ||
<let name=idx /> | <let name=idx /> | ||
<let name=including val=1 /> | <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 | + | <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 | + | <let name=pg_title val="@row.page_title" /> |
<let name=idx inc /> | <let name=idx inc /> | ||
− | <load page=$pg_title /> | + | <if not flag=$noLoad> |
− | <if flag=data[Title]> | + | <load page=$pg_title nocat /> |
+ | </if> | ||
+ | <if flag=$data[Title]> | ||
<call GetBrief /> | <call GetBrief /> | ||
</if><else> | </if><else> | ||
Line 62: | Line 224: | ||
</func> | </func> | ||
− | <func | + | ===ShowTopic_old(iTopic,iMax)=== |
+ | <func ShowTopic_old iTopic iMax> | ||
<let name=idx /> | <let name=idx /> | ||
<let name=including val=1 /> | <let name=including val=1 /> | ||
Line 69: | Line 232: | ||
<let name=topic parse>{{PAGENAME}}</let> | <let name=topic parse>{{PAGENAME}}</let> | ||
</if> | </if> | ||
− | <let name=topic with="_"> </let> | + | <let name=topic self with="_"> </let> |
<let name=sqlWhere>(page_namespace=0) AND (cl_to='</let> | <let name=sqlWhere>(page_namespace=0) AND (cl_to='</let> | ||
<let name=sqlWhere append copy=topic /> | <let name=sqlWhere append copy=topic /> | ||
<let name=sqlWhere append>')</let> | <let name=sqlWhere append>')</let> | ||
− | <for table="qryW3_Titles_Catgs" where=$sqlWhere sort="page_title DESC" | + | |
− | <let name=pg_title val="@row | + | <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" /> | ||
<let name=idx inc /> | <let name=idx inc /> | ||
− | <load page=$pg_title /> | + | <if not flag=noLoad> |
− | <call GetBrief /> | + | <load page=$pg_title local nocat /> |
+ | </if> | ||
+ | <if flag=data[Title]> | ||
+ | <call GetBrief /> | ||
+ | </if><else> | ||
+ | <let name=links.out> | ||
+ | * [[</let> | ||
+ | <let name=links.out append copy=pg_title /> | ||
+ | <let name=links.out append>]]</let> | ||
+ | </else> | ||
+ | <let name=exclude val=0 /> | ||
+ | <let name=links.rtn append copy=links.out /> | ||
+ | <let name=data null /> | ||
+ | </for> | ||
+ | </func> | ||
+ | ===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="_"> </let> | ||
+ | |||
+ | <let name=sql>(cl_to='</let> | ||
+ | <let name=sql>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> | ||
+ | <let name=sql append copy=topic /> | ||
+ | <let name=sql append>') ORDER BY page_title DESC</let> | ||
+ | <if flag=max> | ||
+ | <let name=sql append> LIMIT </let> | ||
+ | <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>{{ns:</let> | ||
+ | <let name=pg_nspace_code append val=@row.page_namespace /> | ||
+ | <let name=pg_nspace_code append>}}</let> | ||
+ | <!-- let name=pg_nspace copy=pg_nspace_code parse local / --> | ||
+ | <let name=pg_title val="@row.page_title" /> | ||
+ | <let name=pg_name copy=pg_nspace /> | ||
+ | <let name=pg_name append>:</let> | ||
+ | <let name=pg_name append copy=pg_title /> | ||
+ | <let name=idx inc /> | ||
+ | <get name=data load page=$pg_title /> | ||
+ | <let name=data[Title] null /> | ||
+ | <!-- load page=$pg_name / --> | ||
<if flag=data[Title]> | <if flag=data[Title]> | ||
<call GetBrief /> | <call GetBrief /> | ||
</if><else> | </if><else> | ||
− | |||
<let name=links.out> | <let name=links.out> | ||
* [[</let> | * [[</let> | ||
Line 93: | Line 299: | ||
</for> | </for> | ||
</func> | </func> | ||
+ | ===ShowTopic(topic,max)=== | ||
+ | <func ShowTopic topic max> | ||
+ | <let name=topic self with="_"> </let> | ||
− | </ | + | <let name=sql>(cl_to='</let> |
+ | <let name=sql>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> | ||
+ | <let name=sql append copy=topic /> | ||
+ | <let name=sql append>') ORDER BY page_title DESC</let> | ||
+ | <if flag=max> | ||
+ | <let name=sql append> LIMIT </let> | ||
+ | <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>{{ns:</let> | ||
+ | <let name=pg_nspace_code append val=@row.page_namespace /> | ||
+ | <let name=pg_nspace_code append>}}</let> | ||
+ | <let name=pg_title val="@row.page_title" /> | ||
+ | <let name=pg_name copy=pg_nspace /> | ||
+ | <let name=pg_name append>:</let> | ||
+ | <let name=pg_name append copy=pg_title /> | ||
+ | <let name=data null /> | ||
+ | <let name=data load array page=$pg_title /> | ||
+ | <if flag=data[Title]> | ||
+ | <call GetBrief /> | ||
+ | </if><else> | ||
+ | <let name=links.out> | ||
+ | * [[</let> | ||
+ | <let name=links.out append copy=pg_title /> | ||
+ | <let name=links.out append>]]</let> | ||
+ | </else> | ||
+ | <let name=exclude val=0 /> | ||
+ | <let name=links.rtn append copy=links.out /> | ||
+ | </for> | ||
+ | </func> |
Latest revision as of 11:32, 13 September 2012
ShowLinkData()
This is a functionalized version of the code in Issuepedia:Code/show/link. Don't use that anymore; use this.
> function showlinkdata() <= ()
GetBrief()
> function getbrief() <= ()
ShowRecent()
calls: GetBrief()
> function showrecent() <= ()
ShowTopic_old(iTopic,iMax)
> function showtopic_old() <= ()
ShowTopic_old(topic,max)
This can be deleted if there are no problems with new ShowTopic().
> function showtopic_old() <= ()
ShowTopic(topic,max)
> function showtopic() <= ()