YAFLogo

cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-14T12:47:29Z
Hey guys,

In my time of developing apps, I love YAF and would love to see more development for it. So in helping out with the Forum, I wanted to contribute and I imagine I will be working on more controls later down the road for YAF.

In using these controls, I ask that you help out with YAF. Not just in downloading these controls, but building your own stuff!

To YAF/Control Developers: There are two problems with these controls. I am using LINQ as a segway with connecting to the database. So if you would like to do something different, please replace the "DataContexts" with something else for connecting to the database. Along with the Execute Query part needs to be replaced as well.

THE OTHER PROBLEM: YAF URL Re-directions STINK. They just don't work outside the forum. So if your posting any of this on a page other than the default page, the page needs to be replaced with the default page.

To All other control users: These controls can either be spit out as tables or Lists. Go to the code behind and comment out the Table, but by default it displays the list.

Attrributes:

1. PostCount: Default = 10, but can be set to anything.

2. BoardName: Default is no board name. Its just all boards, but can be set to any board name.

3. Class: This is the CSSClass.

4. Row class and alternating Class can be un-commented and implemented on each control.

Here are the controls.

Put these controls into the forum/controls folder and drag and drop them anywhere on the site.


At www.SpoiledTechie.com.
Sponsor
mddubs
  • mddubs
  • 100% (Exalted)
  • YAF Developer
2009-06-14T14:26:12Z
New stuff woohoo :)

Can you post a few screenshots?


UserPostedImage 

www.bunkerhollow.com  | www.careercomputing.com 

When I post fp:mddubs in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Mek 🙂, who stole this off Ederon 🙂 )

cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-14T16:36:17Z
Can't post screen shots yet, but will soon. I only have one post in the forum. The posts can be found at www.codingforcharity.com tho.

mddubs, I do ask that you look through the control via what I posted in the original.


At www.SpoiledTechie.com.
mddubs
  • mddubs
  • 100% (Exalted)
  • YAF Developer
2009-06-14T17:53:43Z
Very nice, I'll add them to source.

fp:mddubs


UserPostedImage 

www.bunkerhollow.com  | www.careercomputing.com 

When I post fp:mddubs in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Mek 🙂, who stole this off Ederon 🙂 )

cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-15T06:11:47Z
mddubs, you look through the source like I stated in the first post in this thread?
At www.SpoiledTechie.com.
mddubs
  • mddubs
  • 100% (Exalted)
  • YAF Developer
2009-06-15T07:14:16Z
No, I haven't looked through it yet. I just checked out the controls on your live site. Is there something you want to address about your code?
UserPostedImage 

www.bunkerhollow.com  | www.careercomputing.com 

When I post fp:mddubs in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Mek 🙂, who stole this off Ederon 🙂 )

cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-15T07:39:07Z
If would be nice if you can look at these two problems and clean them up... Maybe make a better URL redirection for YAF because of these controls.

To YAF/Control Developers: There are two problems with these controls. I am using LINQ as a segway with connecting to the database. So if you would like to do something different, please replace the "DataContexts" with something else for connecting to the database. Along with the Execute Query part needs to be replaced as well.

THE OTHER PROBLEM: YAF URL Re-directions STINK. They just don't work outside the forum. So if your posting any of this on a page other than the default page, the page needs to be replaced with the default page.


At www.SpoiledTechie.com.
Nightvision
2009-06-15T11:44:15Z
Wow, what a timely post in that I was looking to do this exact thing today.

Cheetahtech- I downloaded your latest posts control, thanks a lot for your work! I am, however getting an error when I try to compile this control. It seems you reference Boomers.Utilities.DatesTimes which was not distributed with your control. Rather than try to re-invent the wheel I thought I'd post here and see if that can be corrected.

Thanks again.

UPDATE - It was fairly simple to look at what you were trying to do and recreate it. I did this:

string shortDateTimeString = query[i].LastPost.ToShortDateString() + " " + query[i].LastPost.ToShortTimeString();

and then recoded the line that references ToShortDateTimeString() as such:

sb.Append("<span style=\"float:right;\">" + shortDateTimeString + "</span>");

And that solved the problem.

Nightvision
2009-06-15T17:11:40Z
I can see one glaring problem with these controls beyond the aforementioned URL rewriter issue. The control completely bypasses membership and roles, directly pulling data from the database using a SQL query.

On my website I have several private forum areas, for instance one for members of my guild and another for the guild officers. If I use this control as is anybody can see the topics in those private forums, of course they don't have access to the actual post, but seeing the topic still isn't acceptable.

Ultimately I think what I will end up doing is plagiarizing ForumActiveDiscussion.ascx, and making the necessary modifications to display what I desire in the format I'm looking for.

cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-16T05:48:42Z
NightVision, If you edit the control, can you post them here? I would like to see how you edited them.
At www.SpoiledTechie.com.
cheetahtech
  • cheetahtech
  • 62.6% (Friendly)
  • YAF Camper Topic Starter
2009-06-16T05:54:16Z
Nightvision wrote:

Wow, what a timely post in that I was looking to do this exact thing today.

Cheetahtech- I downloaded your latest posts control, thanks a lot for your work! I am, however getting an error when I try to compile this control. It seems you reference Boomers.Utilities.DatesTimes which was not distributed with your control. Rather than try to re-invent the wheel I thought I'd post here and see if that can be corrected.

Thanks again.

UPDATE - It was fairly simple to look at what you were trying to do and recreate it. I did this:

string shortDateTimeString = query[i].LastPost.ToShortDateString() + " " + query[i].LastPost.ToShortTimeString();

and then recoded the line that references ToShortDateTimeString() as such:

sb.Append("<span style=\"float:right;\">" + shortDateTimeString + "</span>");

And that solved the problem.

Sorry about that. I was using my own framework to make the date and time shown look a bit better than what they did.


At www.SpoiledTechie.com.
Nightvision
2009-06-16T09:55:12Z
cheetahtech wrote:

NightVision, If you edit the control, can you post them here? I would like to see how you edited them.

Gladly. At this point, I've only messed with the Active Discussion control, but here it is.

Instructions for use:

1. Unzip the file below into your /controls directory.

2. Add the following key to your app.config - making sure you replace the value with the name of your script file - if it's default.aspx this line is not necessary.

3. Define the css class "recentposts" in your stylesheet or inline if you want to control the look of the output.

4. Add this tag to your master page (or the page this control will reside on):

<YAF:Forum runat="server" ID="forum" Visible="false"></YAF:Forum>
5. In design mode drag and drop the control (ForumLatestDiscussion.ascx) wherever you want it.

That's all there is to it. For the record I did as I said above, I took the ForumActiveDiscussion.ascx and trimmed out the data I wasn't interested in. Also I reworked it to display as a list instead of a table, because that fit my own needs. I added only 3 lines of code to the source, that being the code that fixes the links to point to the appropriate forums script file vs. the page that you are currently viewing. I spent hours trying to find a YAF function that wrote url's based on the BaseScriptFile configuration setting, but I never found one. I ended up just doing a string.replace and calling it good. If somebody else is aware of a better way to accomplish this I'm all ears.