Difference between revisions of "HypertWiki:Code/lib/data"

From HypertWiki
Jump to navigation Jump to search
(adding categories to full blog entry display (to be tested))
(revised format for specs footer)
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
<hide>
==GetLinkBrief()==
<func GetLinkBrief>
<func GetLinkBrief>
     <let name=links.out>
     <let name=links.out>
Line 10: Line 10:
     <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] />
       <let name=wtLink append>|</let>
       <let name=wtLink append>|</let>
       <let name=wtLink append copy=data[Title] />
       <let name=wtLink append copy=data[Title] />
       <let name=wtLink append>]]</let>
       <let name=wtLink append>]] &sect; </let>
     </if><else>
     </if><else>
       <let name=wtLink>[</let>
       <let name=wtLink>[</let>
Line 28: Line 28:


     <let name=text copy=data[TextShort] />
     <let name=text copy=data[TextShort] />
     <if flag=text></if><else>
     <if flag=$text></if><else>
       <let name=text copy=data[Text] len=200 />
       <let name=text copy=data[Text] len=200 />
     </else>
     </else>
Line 38: Line 38:


</func>
</func>
 
==ShowRecentLinks(max)==
<func ShowRecentLinks max>
<func ShowRecentLinks 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 name=pg hide>
   <for table="qryW3_Titles_Catgs" where="(cl_to='Data/links') AND (page_namespace=0)" sort="page_title DESC" limit=$max name=pg hide>
     <let name=pg_title val="@row.pg.page_title" />
     <let name=pg_title val="@row.page_title" />
     <let name=idx inc />
     <let name=idx inc />
     <if not flag=noLoad>
     <if not flag=$noLoad>
       <load page=$pg_title nocat />
       <load page=$pg_title />
     </if>
     </if>
     <if flag=data[Title]>
     <if flag=$data[Title]>
       <call GetLinkBrief />
       <call GetLinkBrief />
     </if><else>
     </if><else>
Line 62: Line 62:
   </for>
   </for>
</func>
</func>
 
==ShowTopic(iTopic,iMax)==
-- this should eventually be able to show data in any format: news links, blog entries...
This should eventually be able to show data in any format: news links, blog entries...
 
<func ShowTopic iTopic iMax>
<func ShowTopic iTopic iMax>
   <let name=idx />
   <let name=idx />
   <let name=including val=1 />
   <let name=including val=1 />
   <let name=topic farg=iTopic />
   <let name=topic farg=iTopic />
   <if not flag=topic>
   <if not flag=$topic>
     <let name=topic parse>{{PAGENAME}}</let>
     <let name=topic parse>{{PAGENAME}}</let>
   </if>
   </if>
Line 79: Line 78:


   <for table="qryW3_Titles_Catgs" where=$sqlWhere sort="page_title DESC" name=pg empty="no items yet" limit=$iMax hide>
   <for table="qryW3_Titles_Catgs" where=$sqlWhere sort="page_title DESC" name=pg empty="no items yet" limit=$iMax hide>
     <let name=pg_title val="@row.pg.page_title" />
     <let name=pg_title val="@row.page_title" />
     <let name=idx inc />
     <let name=idx inc />
     <if not flag=noLoad>
     <if not flag=$noLoad>
       <load page=$pg_title local nocat />
       <load page=$pg_title local />
     </if>
     </if>
     <if flag=data[Title]>
     <if flag=$data[Title]>
       <call GetBrief />
       <call GetBrief />
     </if><else>
     </if><else>
Line 97: Line 96:
   </for>
   </for>
</func>
</func>
 
==GetBlogEntryBrief()==
=== BLOG ENTRIES ===
<func GetBlogEntryBrief>
<func GetBlogEntryBrief>
INPUT:
INPUT:
Line 104: Line 102:
   pg_name - full name of page being displayed (including namespace)
   pg_name - full name of page being displayed (including namespace)


     <if not flag=noLoad>
     <if not flag=$noLoad>
       <load page=$pg_name nocat />
       <load page=$pg_name />
     </if>
     </if>


Line 111: Line 109:
* '''</let>
* '''</let>
     <let name=e.out append copy=data[TimeStamp] />
     <let name=e.out append copy=data[TimeStamp] />
     <let name=e.out append>''' </let>
     <let name=e.out append>''' [[</let>
    <let name=e.out append copy=pg_name />
    <let name=e.out append>|</let>
    <let name=e.out append copy=data[Title] />
    <let name=e.out append>]] &sect; </let>


     <let name=text copy=data[TextAbove] />
     <let name=text copy=data[TextAbove] />
     <if flag=text></if><else>
     <if flag=$text></if><else>
       <let name=text copy=data[TextBelow] len=200 />
       <let name=text copy=data[TextBelow] len=200 />
     </else>
     </else>
Line 123: Line 125:
     <let name=e.out append>|more...]]''</let>
     <let name=e.out append>|more...]]''</let>
</func>
</func>
==GetBlogEntryBriefChrisFormat()==
<func GetBlogEntryBriefChrisFormat>
INPUT:
  data[*] - from blog entry page
  pg_name - full name of page being displayed (including namespace)
    <if not flag=$noLoad>
      <load page=$pg_name />
    </if>
    <let name=e.out></let>
    <let name=e.out append><big>[[</let>
    <let name=e.out append copy=pg_name />
    <let name=e.out append>|</let>
    <let name=e.out append copy=data[Title] />
    <let name=e.out append>]]</big>, ''</let>
    <let name=e.out append copy=data[TimeStamp] />
    <let name=e.out append>''
</let>
    <let name=text copy=data[TextAbove] />
    <if flag=$text></if><else>
      <let name=text copy=data[TextBelow] len=200 />
    </else>
    <let name=e.out append copy=text trim />
    <let name=e.out append> ''[[</let>
    <let name=e.out append copy=pg_name />
    <let name=e.out append>|more...]]''


</let>
</func>
==GetBlogEntryFull()==
<func GetBlogEntryFull>
<func GetBlogEntryFull>
INPUT:
INPUT:
Line 129: Line 164:
   pg_name - full name of page being displayed (including namespace)
   pg_name - full name of page being displayed (including namespace)


     <if not flag=noLoad>
     <if not flag=$noLoad>
       <load page=$pg_name nocat />
       <load page=$pg_name />
     </if>
     </if>


Line 145: Line 180:
     <let name=e.out append copy=BlogFoldDivider />
     <let name=e.out append copy=BlogFoldDivider />
     <let name=e.out append copy=data[TextBelow] />
     <let name=e.out append copy=data[TextBelow] />
-- category display
    <let name=e.out append copy=BlogFoldDivider />
    <let name=e.out append>
<small>'''Categories''' &ndash;</let>
    <let name=noCat val=1 />
     <call MakeBlogCatgs />
     <call MakeBlogCatgs />
 
    <if flag=$wtCatGlob>
      <let name=e.out append> general: </let>
      <let name=e.out append copy=wtCatGlob>
    </if>
    <if flag=$wtCatUser>
      <let name=e.out append> user: </let>
      <let name=e.out append copy=wtCatUser>
    </if>
    <let name=e.out append></small></let>
</small></let>
</func>
</func>
 
==ShowRecentBlogEntries(max,funcEntry)==
<func ShowRecentBlogEntries max>
<func ShowRecentBlogEntries max funcEntry>
   <let name=idx />
   <let name=idx />
  <if not flag=$funcEntry>
    <let name=funcEntry val="GetBlogEntryBrief" />
  </if>
   <let name=including val=1 />
   <let name=including val=1 />
   <for table="qryW3_Titles_Catgs" where="(cl_to='Data/blog/post')" sort="page_title DESC" limit=$max name=pg hide>
   <for table="qryW3_Titles_Catgs" where="(cl_to='Data/blog/post')" sort="page_title DESC" limit=$max name=pg hide>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code append val=@row.pg.page_namespace />
     <let name=pg_nspace_code append val=@row.page_namespace />
     <let name=pg_nspace_code append>}}</let>
     <let name=pg_nspace_code append>}}</let>
     <let name=pg_nspace copy=pg_nspace_code parse />
     <let name=pg_nspace copy=pg_nspace_code parse />
     <let name=pg_title val="@row.pg.page_title" />
     <let name=pg_title val="@row.page_title" />
     <let name=pg_name copy=pg_nspace />
     <let name=pg_name copy=pg_nspace />
     <let name=pg_name append>:</let>
     <let name=pg_name append>:</let>
     <let name=pg_name append copy=pg_title />
     <let name=pg_name append copy=pg_title />
     <let name=idx inc />
     <let name=idx inc />
     <call GetBlogEntryBrief />
     <call func=$funcEntry />
     <let name=e.rtn append copy=e.out />
     <let name=e.rtn append copy=e.out />
     <let name=data />
     <let name=data />
   </for>
   </for>
</func>
</func>
 
==ShowRecentBlogEntriesFull(max)==
<func ShowRecentBlogEntries_Full max>
<func ShowRecentBlogEntriesFull 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/blog/post')" sort="page_title DESC" limit=$max name=pg hide>
   <for table="qryW3_Titles_Catgs" where="(cl_to='Data/blog/post')" sort="page_title DESC" limit=$max name=pg hide>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code append val=@row.pg.page_namespace />
     <let name=pg_nspace_code append val=@row.page_namespace />
     <let name=pg_nspace_code append>}}</let>
     <let name=pg_nspace_code append>}}</let>
     <let name=pg_nspace copy=pg_nspace_code parse />
     <let name=pg_nspace copy=pg_nspace_code parse />
     <let name=pg_title val="@row.pg.page_title" />
     <let name=pg_title val="@row.page_title" />
     <let name=pg_name copy=pg_nspace />
     <let name=pg_name copy=pg_nspace />
     <let name=pg_name append>:</let>
     <let name=pg_name append>:</let>
     <let name=pg_name append copy=pg_title />
     <let name=pg_name append copy=pg_title />
     <let name=idx inc />
     <let name=idx inc />
    <call GetBlogEntryFull />
     <let name=e.rtn append copy=e.out />
     <let name=e.rtn append copy=e.out />
     <call GetBlogEntryFull />
     <let name=data />
    <let name=e.rtn append>
  </for>
<small>'''Categories''' &ndash;</let>
</func>
     <if flag=wtCatGlob>
==ShowRecentBlogEntriesByTopic(max,topic)==
      <let name=e.rtn append> general: </let>
<func ShowRecentBlogEntriesByTopic max topic>
       <let name=e.rtn append copy=wtCatGlob>
  <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/blog/post') AND (q2.cl_to='</let>
  <let name=sql append copy=topic />
  <let name=sql append>') ORDER BY page_title DESC LIMIT </let>
  <let name=sql append copy=max />
 
  <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 />
    <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 />
    <let name=data[Title] null />
    <load page=$pg_name />
    <if flag=$data[Title]>
      <call GetBlogEntryBrief />
       <let name=e.rtn append copy=e.out />
     </if>
     </if>
    <if flag=wtCatUser>
      <let name=e.rtn append> user: </let>
      <let name=e.rtn append copy=wtCatUser>
    </if>
    <let name=e.rtn append>
</small></let>
     <let name=data />
     <let name=data />
   </for>
   </for>
</func>
</func>
 
==MakeBlogCatgs()==
<func MakeBlogCatgs>
<func MakeBlogCatgs>
   <let name=catUser copy=data[TopicsUser] />
   <let name=catUser copy=data[TopicsUser] />
Line 218: Line 287:
     <let name=wtCatUser append>|c]]'''</sub></let>
     <let name=wtCatUser append>|c]]'''</sub></let>


     <let name=wtCatUser append> [[category:user/</let>
     <if not flag=$noCat>
    <let name=wtCatUser append copy=data[User] />
      <let name=wtCatUser append> [[category:user/</let>
    <let name=wtCatUser append>/</let>
      <let name=wtCatUser append copy=data[User] />
    <let name=wtCatUser append copy=topic />
      <let name=wtCatUser append>/</let>
    <let name=wtCatUser append>|</let>
      <let name=wtCatUser append copy=topic />
    <let name=wtCatUser append copy=topic />
      <let name=wtCatUser append>|</let>
    <let name=wtCatUser append>]]</let>
      <let name=wtCatUser append copy=topic />
      <let name=wtCatUser append>]]</let>
    </if>
   </xploop>
   </xploop>
   <let name=wtCatGlob null />
   <let name=wtCatGlob null />
Line 236: Line 307:
     <let name=wtCatGlob append>|c]]'''</sub></let>
     <let name=wtCatGlob append>|c]]'''</sub></let>


     <let name=wtCatGlob append>[[category:</let>
     <if not flag=$noCat>
    <let name=wtCatGlob append copy=topic />
      <let name=wtCatGlob append>[[category:</let>
    <let name=wtCatGlob append>]]</let>
      <let name=wtCatGlob append copy=topic />
      <let name=wtCatGlob append>]]</let>
    </if>


   </xploop>
   </xploop>
</func>
</func>
==ShowBlogPostPage()==
<func ShowBlogPostPage>
  <let name=PostDate copy=data[TimeStamp] len=10 />
  <let name=wtDate>[[</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>]] ([[:category:</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>|category]])</let>
  <let name=wtDate append>[[category:</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>]]</let>
  <let name=wtTitle>__NOEDITSECTION__
==</let>
  <let name=wtTitle append copy=data[Title] />
  <let name=wtTitle append>==</let>
  <if flag=$data[TextAbove]>
    <let name=wtTextBrief>
<span class=blog-post-section-hdr>In Brief</span>
</let>
    <let name=wtTextFull>
<hr>
<span class=blog-post-section-hdr>The Rest</span>
</let>
    <let name=wtTextBrief append copy=data[TextAbove] />
  </if><else>
    <let name=wtTextBrief null />
  </else>
  <let name=wtTextFull append copy=data[TextBelow] />
  <call MakeBlogCatgs />
General categories for blog posts:
-- the fact that it's a post:
  <let name=wtCatGlob append>[[category:data/blog/post]]</let>
-- date:
  <let name=wtCatGlob append>[[category:</let>
  <let name=wtCatGlob append copy=PostDate len=10 /> -- just the date for the category
  <let name=wtCatGlob append>|]]</let>
  <let name=wtCatGlob append copy=PostDate /> -- full timestamp for sorting
  <let name=wtCatGlob append>]]</let>
  <let name=user copy=data[User] />
  <if flag=$user>
    <let name=wtUser>[[user:</let>
    <let name=wtUser append copy=user />
    <let name=wtUser append>|</let>
    <let name=wtUser append copy=user />
    <let name=wtUser append>]]</let>
  </if><else>
    <let name=wtUser>''unknown''</let>
  </else>
  <echo>__NOEDITSECTION__
<get name=wtTitle />
<get name=data index=Text /><get name=wtTextBrief /><get name=wtTextFull />
<hr>
<div align=right style="font-size: 75%; line-height: 75%;">Posted by <get name=wtUser /> at <get name=PostDate />. <b>Topics</b>: <get name=wtCatUser /> <get name=wtCatGlob /></echo>
</func>
==ShowBlogPostPage_v2()==
<func ShowBlogPostPage_v2>
  <let name=PostDate copy=data[TimeStamp] len=10 />
  <let name=wtDate>[[</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>]] ([[:category:</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>|category]])</let>
  <let name=wtDate append>[[category:</let>
  <let name=wtDate append copy=PostDate />
  <let name=wtDate append>]]</let>


<func ShowBlogPostPage>
  <let name=wtTitle>__NOEDITSECTION__
==</let>
  <let name=wtTitle append copy=data[Title] />
  <let name=wtTitle append>==</let>
  <if flag=$data[TextAbove]>
    <let name=wtTextBrief>
<span class=blog-post-section-hdr>In Brief</span>
</let>
    <let name=wtTextFull>
<hr>
<span class=blog-post-section-hdr>The Rest</span>
</let>
    <let name=wtTextBrief append copy=data[TextAbove] />
  </if><else>
    <let name=wtTextBrief null />
  </else>
  <let name=wtTextFull append copy=data[TextBelow] />
 
  <call MakeBlogCatgs />
General categories for blog posts:
-- the fact that it's a post:
  <let name=wtCatGlob append>[[category:data/blog/post]]</let>
-- date:
  <let name=wtCatGlob append>[[category:</let>
  <let name=wtCatGlob append copy=PostDate len=10 /> -- just the date for the category
  <let name=wtCatGlob append>|]]</let>
  <let name=wtCatGlob append copy=PostDate /> -- full timestamp for sorting
  <let name=wtCatGlob append>]]</let>
 
  <let name=user copy=data[User] />
  <if flag=$user>
    <let name=wtUser>[[user:</let>
    <let name=wtUser append copy=user />
    <let name=wtUser append>|</let>
    <let name=wtUser append copy=user />
    <let name=wtUser append>]]</let>
  </if><else>
    <let name=wtUser>''unknown''</let>
  </else>
  <echo>__NOEDITSECTION__
<get name=wtTitle />
<get name=data index=Text /><get name=wtTextBrief /><get name=wtTextFull />
<hr>
{| style="font-size: 75%; line-height: 75%;"
|-
| colspan=2 |
==Specs==
 
|-
| align=right | '''Timestamp''': || <get name=PostDate />
|-
| align=right | '''Author''': || <get name=wtUser />
|-
| align=right | '''User topics''': || <get name=wtCatUser />
|-
| align=right | '''Global topics''': || <get name=wtCatGlob />
|}</echo>
</func>
==ShowBlogPostPage_v1()==
<func ShowBlogPostPage_v1>
   <let name=PostDate copy=data[TimeStamp] len=10 />
   <let name=PostDate copy=data[TimeStamp] len=10 />
   <let name=wtDate>[[</let>
   <let name=wtDate>[[</let>
Line 259: Line 461:
   <let name=wtTitle append copy=data[Title] />
   <let name=wtTitle append copy=data[Title] />
   <let name=wtTitle append>==</let>
   <let name=wtTitle append>==</let>
   <if flag=data[TextAbove]>
   <if flag=$data[TextAbove]>
     <let name=wtTextBrief>
     <let name=wtTextBrief>
===In Brief===
===In Brief===
Line 284: Line 486:


   <let name=user copy=data[User] />
   <let name=user copy=data[User] />
   <if flag=user>
   <if flag=$user>
     <let name=wtUser>[[user:</let>
     <let name=wtUser>[[user:</let>
     <let name=wtUser append copy=user />
     <let name=wtUser append copy=user />
Line 308: Line 510:
<get name=data index=Text /><get name=wtTextBrief /><get name=wtTextFull /></echo>
<get name=data index=Text /><get name=wtTextBrief /><get name=wtTextFull /></echo>
</func>
</func>
</hide>

Latest revision as of 19:44, 22 January 2013

GetLinkBrief()


> function getlinkbrief() <= ()

ShowRecentLinks(max)


> function showrecentlinks() <= ()

ShowTopic(iTopic,iMax)

This should eventually be able to show data in any format: news links, blog entries...
> function showtopic() <= ()

GetBlogEntryBrief()


> function getblogentrybrief() <= ()

GetBlogEntryBriefChrisFormat()


> function getblogentrybriefchrisformat() <= ()

GetBlogEntryFull()


> function getblogentryfull() <= ()

ShowRecentBlogEntries(max,funcEntry)


> function showrecentblogentries() <= ()

ShowRecentBlogEntriesFull(max)


> function showrecentblogentriesfull() <= ()

ShowRecentBlogEntriesByTopic(max,topic)


> function showrecentblogentriesbytopic() <= ()

MakeBlogCatgs()


> function makeblogcatgs() <= ()

ShowBlogPostPage()


> function showblogpostpage() <= ()

ShowBlogPostPage_v2()


> function showblogpostpage_v2() <= ()

ShowBlogPostPage_v1()


> function showblogpostpage_v1() <= ()