Antville Project

feature request: <% story.createtime as="link" %>

i want the date to hyperlink to the frontpage of that day when i turn on the option as shown in the title. pleeeaase?

oh, and i want to have customizable topic frontpages. i mean, one for every topic.

this means, i want to have a macro topic.description (or topic.meta or something) that inserts a snippet of html which i can define in my topic manager. for example, when the topic is foo, then topic.description returns "<span class="bar">these stories deal with the ancient art of foo. if you don't know what foo is, maybe you'd like to visit <a href="theancientartoffoo.com<">the ancient art of foo<a> first.</span>" or something. then i insert the macro into my "topic page" skin before the storylist macro and voilĂ ! there's my customized topic frontpage.

update: i just implemented the createtime-link myself. boy, this was easy! i mean, this was the first time i tinkered with the antville code, i hadn't even edited a .js file before, and all it took me was 10 minutes. the code has even the rarely seen 3-spaces-indents, just as i like it. guys, i love you.

maybe you'd like to have a look at my implementation and tell me what you think. i post it in a comment, this story already consumes enough space on the frontpage :-)

comment    

 
hns, September 10, 2002 at 1:44:09 PM CEST

Re: feature request: <% story.createtime as="link" %>

Have you tried implementing it? If not, why not?

link  

 
nex, September 10, 2002 at 1:59:46 PM CEST

Re: Re: feature request: <% story.createtime as="link" %>

oh, i know, i know... i should do it myself. i'm feeling guilty now.

why not? i'm still struggling with the installation of antville (see my message to the mailing list) and haven't started gettign acquainted with all those ecma-scripts yet. so i figured someone who's more into the subject could add that faster and more efficient.

however, i promise i'll do it myself and send you the code if you help me to get my antville running :-)

when it's about something like this, it only requires editing of a script, i don't have to check out the cvs and mess with any compiled code, right?

link  


... comment
 
nex, September 10, 2002 at 2:31:38 PM CEST

suggested implementation

in story/macros.js:

/**
 * macro rendering createtime of story
 */

function createtime_macro(param) {
   if (param.as == "editor") {
      if (this.createtime)
         param.value = formatTimestamp(
            this.createtime,
            "yyyy-MM-dd HH:mm");
      else
         param.value = formatTimestamp(new Date(),
            "yyyy-MM-dd HH:mm");
      param.name = "createtime";
      renderInputText(param);
   } else {
      if (!this.createtime)
         return;
      var dateStr = formatTimestamp(
         this.createtime,param.format);
      var dateLink = this.site.href() +
         formatTimestamp(this.createtime,
         "yyyyMMdd");
      if (param.as == "link") {
         res.write("<a href=\"" + dateLink + "\">");
      }
      res.write(dateStr);
      if (param.as == "link") {
         res.write("</a>");
      }
   }
}

the format of the link is hardcoded, maybe this is a bad thing and i should've called a function that gives me the format?

another thing that could use some improvement is the placement of the anchor tags -- they include the time portion of the date, which is technically incorrect, since we link to the whole day.

but i guess it's better than nothing, maybe you'd like to include it in your codebase?

link  

 
hns, September 10, 2002 at 2:41:12 PM CEST

Re: suggested implementation

Yes, Hop hacking is easy. Your patch looks pretty good, and I'm +1 on adopting it. Let's see what the others say.

link  

 
robert, December 8, 2002 at 7:00:44 PM CET

Re: suggested implementation

+1, i implemented it (cvs-diff).

link  


... comment


The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 8550 Days
last updated: 1/4/11, 10:22 AM
status
Youre not logged in ... Login
menu
November 2024
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
July
recent
zfuture's house here is zfuture's
house
by zfuture (7/31/03, 2:59 AM)
i understand your concerns however,
i hardly can think of a solution. certainly, if the...
by tobi (7/29/03, 9:47 AM)
Found several more similar sites
listed This is getting to be quite a concern to...
by cobalt123 (7/27/03, 7:56 PM)
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03, 7:14 PM)
well it's not easy to
find from here, anyway. think we should include a link,...
by tobi (7/24/03, 11:25 AM)
So finally I found
the helma Bugzilla - stupid me.
by mdornseif (7/24/03, 10:28 AM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03, 8:25 PM)
but blogosphere.us isn't can't really
be rated as spam can it?
by kohlehydrat (7/23/03, 8:08 PM)
More referrer spam www.webfrost.com
by Irene (7/23/03, 7:55 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03, 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher