Date:  04/10/2012 01:40:30 PM Msg ID:  004450
From:  Ali Koumaiha Thread:  004449
Subject:  Re: Wooohoo.. Free forum written in FoxWeb
Update:
Moved the forum biz object code into a prg class.
Create reply page
fixed the view count and reply count.

need to finish:
- main page (index.fwx), to have the SQL query get the forums and join the right tables to get the total topics and total replies.

- Create registration page

- Won't allow user to reply/post unless they are registered (checks the auth.userid)

cosmetics:
Add logo
Make font consistents
Have the button (reply, post, forum home) as nice button.

but, its working ok so far.

Anyone would like to collaborate?

Here is the PRG Class.




DEFINE CLASS
FoxWebForum as Custom       nForumID    = 0      cErrorMsg   = ""      nTopicID    = 0      cDataPath  = '\FoxWeb\Portal\forum\data\'      cSubject    = ''      cMessage    = ''                  PROCEDURE init()             this.OpenData()      ENDPROC             PROCEDURE OpenData()            lcDataPath = this.cDataPath            TRY                   if not used("FoxWebforum")                        use (lcDataPath) + "FoxWebforum" in 0                  endif                   if not used("FoxWebforumDetails")                        use (lcDataPath) + "FoxWebforumDetails" in 0                  endif                   if not used("FoxWebforumTopics")                        use (lcDataPath) + "FoxWebforumTopics" in 0                  endif             CATCH TO loexp                  response.write(loExp.message)            ENDTRY       ENDPROC       PROCEDURE GetForumDetail()                  LOCAL lnForum, lcCursor                   lcCursor = SYS(2015)                                    lnForum = this.nForumID                  IF lnForum = 0                        this.cErrorMsg = "Invalid forum ID selected"                        RETURN ""                  ENDIF                                     select FoxWebforum                  set order to iid                  if not seek(lnForum)                        this.cErrorMsg = "Forum ID was not found."                        RETURN ""                  endif                                                 select FoxWebforumDetails                  set order to fk_forum                  if seek(lnforum)                        replace Viewcount with Viewcount + 1                  endif                   select FoxWebForumDetails.*,;                        FoxWebForum.Forumtitle ;                        from FoxWebForumDetails ;                        left outer join FoxWebForum ;                        on FoxWebForumDetails.fk_forum = FoxWebForum.IID ;                        where fk_forum = lnforum ;                        order by FoxWebForumDetails.LastPost desc ;                        into cursor (lcCursor)                   RETURN (lcCursor)             ENDPROC       PROCEDURE Gettopic()            LOCAL lnTopic, lcCursor            lnTopic = this.nTopicID            lcCursor = SYS(2015)                        SELECT FoxWebForumDetails            SET ORDER TO IID            IF SEEK(lnTopic)                  REPLACE ViewCount WITH ViewCount + 1            ENDIF                                     select FoxWebForumtopics.*,;                  FoxWebForum.Forumtitle, ;                  foxWebforum.IID as Forum,;                  foxWebForumDetails.Topic ;                  from ;                        FoxWebForumTopics ;                  Left outer join FoxWebForumDetails ;                        on FoxWebForumtopics.fk_topic = FoxWebForumDetails.IID ;                  left outer join FoxWebForum ;                        on FoxWebForumDetails.fk_forum = FoxWebForum.IID ;                  where fk_topic = lntopic ;                  order by FoxWebForumTopics.PostDate ;                  into cursor (lcCursor)                        RETURN (lcCursor)       ENDPROC       PROCEDURE AddNewPost()            LOCAL lnForum, lcMessage, lcSubject, lnTopicIID                         lnForum = this.nForumID            lcMessage = this.cMessage            lcSubject = this.cSubject                        select FoxWebforumdetails            append blank             replace fk_forum with lnforum,;                  topic with lcSubject,;                  Adduser with auth.userid,;                  LastPost with datetime(),;                  LastPostBy with auth.userid,;                  AddDate with datetime()                         lntopiciid = FoxWebForumDetails.iid                         select FoxWebForumTopics            append blank            repl fk_topic with lntopiciid,;                  postdate with datetime(),;                  PostUser with auth.userid,;                  Message with lcMessage                  RETURN             ENDPROC       PROCEDURE AddNewReply()            LOCAL lnForum, lcMessage, lcSubject, lnTopicIID                         lnTopic     = this.nTopicID            lcMessage = this.cMessage                                    SELECT FoxWebForumDetails            SET ORDER TO IID            IF SEEK(lnTopic)                  REPLACE ReplyCount WITH ReplyCount + 1            ENDIF                         select FoxWebForumTopics            append blank            repl fk_topic with lntopic,;                  postdate with datetime(),;                  PostUser with auth.userid,;                  Message with lcMessage                  RETURN             ENDPROC      

ENDDEFINE  

Sent by Ali Koumaiha on 04/09/2012 06:07:34 PM:
A user forum completely written in FoxWeb (along with some javascripts and css) Cool

-uses free tables (but, if you want you can do sql tables i guess.. i just didn't want that)
-5 pages or so (for now) (view forums, view topics, post new topic)
-the way i have it on my server is protected (auth.authenticate)
-uses WYSIWYG editor from tiny_mce

if anyone intrested it, i will zip all the files with instructions.  probably will take you 5 minutes to change some path (to the data folder etc..)

you can do whatever you want with it. free

i know alot of people ask if anyone has a forum for foxweb to be used.. well, here it is..
give it a test drive and let me know what you think.

http://www.ezcellpos.com/forum/index.fwx

username: ali
password: ali

PS:
I DIDN'T CREATE THE REPLY PAGE YET (WORKING ON IT)

Sorry, didn't create a register page
No fancy graphics yet
but, you can do what you want with it if you want the source codes
Might get an error or two (again, i just slapped it arround today)


Everything else should be working.




Sent by Ali Koumaiha on 04/09/2012 06:07:34 PM:
A user forum completely written in FoxWeb (along with some javascripts and css) Cool

-uses free tables (but, if you want you can do sql tables i guess.. i just didn't want that)
-5 pages or so (for now) (view forums, view topics, post new topic)
-the way i have it on my server is protected (auth.authenticate)
-uses WYSIWYG editor from tiny_mce

if anyone intrested it, i will zip all the files with instructions.  probably will take you 5 minutes to change some path (to the data folder etc..)

you can do whatever you want with it. free

i know alot of people ask if anyone has a forum for foxweb to be used.. well, here it is..
give it a test drive and let me know what you think.

http://www.ezcellpos.com/forum/index.fwx

username: ali
password: ali

PS:
I DIDN'T CREATE THE REPLY PAGE YET (WORKING ON IT)

Sorry, didn't create a register page
No fancy graphics yet
but, you can do what you want with it if you want the source codes
Might get an error or two (again, i just slapped it arround today)


Everything else should be working.