YAFLogo

Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
13 years ago
Thank you Kamyar!

I'll look at integrating the code back into the main.
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
herman_herman wrote:

Hello Kamyar jan
Thanks for this excellent mod with such easy installation.Great job golpesar :wink:


Hi herman e aziz
You're very welcome. Hope everyone likes it. Kheili Mokhlesim! :wink:
P.S:
If you did the installation and didn't get the thanks feature, try to add these values in the DB:
1-open the database in the database manager (like SQL Management studio)
2-Open [dbo].[yaf_Registry] table.
3-Add these fields:

Name: userbox
value:

---

Name: userboxthanksfrom
value: {0}: {1:N0}
---
Name: userboxthanksto
value: {0}
If at first you don’t succeed, call it version 1.0
ablakov1
  • ablakov1
  • 54.2% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
I came here hopelessly to see if i have gotten any reply.Now i can't believe what i see.
I am really grateful of your contribution you definitely made my month :wink:
Thank you Mr. Kamyar.👍
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
You're welcome ablakov.
I finished modifying YAF 1.9.4 BETA2 for the Thanks feature.
You can download the BIN and SRC versions from the links provided below.
The installation steps are the same as the previous version.
YAF v1.9.3-RC2-BIN 
YAF v1.9.3-RC2-SRC 
YAF v1.9.4-BETA2-BIN 
YAF v1.9.4-BETA2-SRC 

Added features:
Shows a notification dialog ("Please wait") when the user clicks on the "Thank" or "Remove Thanks Note" buttons.
Note: If you want to change the Loading Panel text, go to /DisplayPost.ascx.cs. you'll find the text in line 112, column 129. The default text is: "Please wait..."

Moved the java scripts to YAF.Utilities.JavaScriptBlocks class and used YafContext.Current.PageElements.RegisterJsBlockStartup to register them. Cleaner code and more integrated with the website architecture.

fixed a problem in the userbox regarding to showing user's thanks statistics.
due to this fix, the Languages/english.xml is slightly changed from the 1.9.3RC2 version that I have posted.
The changes are:
In <Page=POSTS>
    <Resource tag="THANKSFROM">Thanks: {0} times</Resource>
    <Resource tag="THANKSTO">Was thanked: {0} time(s) in {1} post(s)</Resource>
In <Page=”DEFAULT">
    <Resource tag="ON">on {0}</Resource> 

I fixed the bug in 1.9.3RC2 version and uploaded it again for the users who prefer to use the 1.9.3 version.

The only problem in 1.9.4 is that when you click on the "Thank" or "Remove Thanks Note", you will not have a localized label until a full page postback applies.
So, if your forum's language is english, no need to worry. But if you use other languages, You'll have to download the source version, go to Yaf.Controls/ThankYou.cs and there you'll see that the captions are added manually in asynchronous calls. change the captions to your appropriate language.
To Jaben: It throws an exception: "Database is not initialized." The exception occurs in UserPageBase.cs->InitUserAndPage() method. I think it's because the YafContext.Current is null. I'll be very pleased if you show me the right way.😕

P.S.: Dear Ablakov, If you want to use YAF in other languages (Polish possibly) and you're not sure what to change,
Just let me know the XML tags in your language and I'll change them for you and upload the ready to go BIN version. to remind you, here are the xml tags which are added:

<page=BUTTON>
    <Resource tag="BUTTON_THANKS">Thank</Resource>
    <Resource tag="BUTTON_THANKS_TT">Thank the post sender</Resource>
    <Resource tag="BUTTON_THANKSDELETE">Remove Thank Note</Resource>
    <Resource tag="BUTTON_THANKSDELETE_TT">Remove your thank note from the post sender</Resource>
<Page=POSTS>
    <Resource tag="THANKSFROM">Thanks: {0} times</Resource>
    <Resource tag="THANKSTO">Was thanked: {0} time(s) in {1} post(s)</Resource>
    <Resource tag="THANKSINFO">{0} users thanked {1} for this useful post.</Resource>
    <Resource tag="THANKSINFOSINGLE">{0} user thanked {1} for this useful post.</Resource>

<Page=PROFILE>
   <Resource tag="THANKSFROM">Number of thanks</Resource>
    <Resource tag="THANKSTOTIMES">Number of times this user was thanked</Resource>
    <Resource tag="THANKSTOPOSTS">Number of posts for which this user was thanked</Resource>

<Page=”DEFAULT”>
    <Resource tag="ONDATE">on {0}</Resource>     
And sorry for the long message.
Cheers.



If at first you don’t succeed, call it version 1.0
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
One last thing. I forgot to set "debug" to "false" in web.config. If you don't want to run the site under "debug" mode, set it to false.
If at first you don’t succeed, call it version 1.0
bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
13 years ago
Kamyar wrote:

One last thing. I forgot to set "debug" to "false" in web.config. If you don't want to run the site under "debug" mode, set it to false.


Usually we made an svn patch in such cases. It's the shortest way for a code : devs don't have much time.
Thanks for your contribution 🙂
ablakov1
  • ablakov1
  • 54.2% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
Thank you very much dear Kamyar.
I managed to add those lines to polish language file.
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
Quote:

Usually we made an svn patch in such cases. It's the shortest way for a code : devs don't have much time.
Thanks for your contribution 🙂



Well actually, I have started web programming under the .Net platform about 8 months ago and I have never had any major programming experience in any platform before then. Just some old codes I wrote years ago in Delphi 5. So I guess you won't be surprised if I tell you that this is the first time I hear about svn. 😊 So I googled it and got some very amazing results. Thanks for letting me know the appropriate way to do this. I'm learning something new every day from your code.
If at first you don’t succeed, call it version 1.0
Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
13 years ago
Kamyar wrote:


To Jaben: It throws an exception: "Database is not initialized." The exception occurs in UserPageBase.cs->InitUserAndPage() method. I think it's because the YafContext.Current is null. I'll be very pleased if you show me the right way.😕


Make this call before the call to YafContext:

YafServices.InitializeDb.Run();

Then the DB will be initialized and all will be well!
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
Wow thanks Jaben. That was exactly what I was looking for.
I just edited the code and made it ready to be compatible with globalized captions. Thanks for your help.
Here's the modified ThankYou.cs file:
ThankYou.cs 
copy it in /Yaf.Controls And build the solution.
and Here's the Yaf.Controls.Dll for the BIN version. just copy it in your /Bin folder.
Yaf.Controls.Dll 

Sorry, I have not still started to learn the svn. So I couldn't apply the changes using svn.

If at first you don’t succeed, call it version 1.0
toanbily
  • toanbily
  • 57.8% (Neutral)
  • YAF Forumling
13 years ago
Hi Kamyar, I think, you should add code for deleted message in database

Pls modified "message_delete" method in DB.cs

static public void message_delete( object messageID, bool isModeratorChanged,
string deleteReason, int isDeleteAction, bool DeleteLinked, bool eraseMessage )
{
message_deleteRecursively( messageID, isModeratorChanged, deleteReason, isDeleteAction, DeleteLinked, false, eraseMessage );

//delete thanks
string qry = "DELETE FROM {databaseOwner}.{objectQualifier}Thanks WHERE MessageID = " + messageID;
using (SqlCommand cmd = DBAccess.GetCommand(qry,true,new YafDBConnManager().OpenDBConnection))
{
cmd.ExecuteNonQuery();
}
}
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
Thanks toanbily. I forgot to update Thanks table upon deletion of a message.
If at first you don’t succeed, call it version 1.0
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer
13 years ago
Ok floks,
Since I'm new to svn patches and as far as I know thing could go wrong if you don't know what you're doing with them, I decided to upload a document explaining the modifications I have made to add Thanks button.
My friend, herman_herman, did me a favor and proposed to make a svn patch for the feature.

Documentation - Microsoft Office Word Format 

Documentation - Adobe PDF Format 
If at first you don’t succeed, call it version 1.0
herman_herman
13 years ago
Kamyar wrote:

Ok floks,
Since I'm new to svn patches and as far as I know thing could go wrong if you don't know what you're doing with them, I decided to upload a document explaining the modifications I have made to add Thanks button.
My friend, herman_herman, did me a favor and proposed to make a svn patch for the feature.

Documentation - Microsoft Office Word Format 

Documentation - Adobe PDF Format 



Thanks kamyar jan
Will work on it ASAP.
hoaihaiduong
13 years ago
I canot Update SQL can you help me this SQl note

Msg 2760, Level 16, State 1, Line 5
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}message_addthanks, Line 18
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}message_getthanks, Line 6
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}message_isthankedbyuser, Line 10
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}message_removethanks, Line 11
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}message_thanksnumber, Line 6
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}user_getthanks_from, Line 6
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
Msg 2760, Level 16, State 1, Procedure {objectQualifier}user_getthanks_to, Line 9
The specified schema name "{databaseOwner}" either does not exist or you do not have permission to use it.
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button