Yii Framework Forum: [Extension] SForum - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] SForum An ajax driven forum module Rate Topic: ***** 1 Votes

#1 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 06 September 2012 - 12:04 AM

http://www.yiiframew...tension/sforum/

sql dump is in the module root folder, you could ofcourse use another type of database if you like,just create the necessary tables as shown in that file.

Attached is:
sforum.zip , the module itself
forum.zip , a demo app


Features:
Topics:
Add attachments by drag&drop or multi file upload thanks to XUpload extension
Image attachments (with the extensions you approve) is shown in lightbox style(using easybox)
A bbcode editor with preview functionality
Edit the topic, or title easily thrue ajax
Browse topics in a category and its latest threads etc
An ajax search function that searches in both title and content of all topics to get the results.
Neat slide-to-unlock(iphone/android style) captcha

Moderator functionality:
Move topic to a diffrent category (including trashbin category)
Delete topic
Make the topic sticky, or remove the sticky status


Comments:
Comment with the bbcode editor
Quote comment
Edit comment
Upvote/downvote comment
Moderator functionality:
Delete comment

Categories:
Browse topic per category
See latest treads and by who
Quick browse between the other categories while viewing one.
Moderator functionality:
Create, delete or rename categories in the admin panel
Decide the order in which the categories will be shown thrue a drag&drop sortable list in the admin panel


Other admin functionality:
View stats (currently only number of threads,comments and users) in a nice user friendly graph.
View trashbin, threads that instead of beeing deleted has been sent to the trashbin category so another moderator later on can study it and decide to delete it entirely or "approve" it, sending it back to a normal category that visitors and normal users can see.



To install:
Put the sforum folder in your protected/modules folder
in your config file make sure you have these things set:

'aliases' => array(
'xupload' => 'application.modules.sforum.components.xupload', //used for the attachment uploads
),
'modules'=>array(

....
'sforum'=>array(
'newTopicStatus'=>'visible', // or hidden. Description: What status should newly created topics get.
'userClass'=>'User', //set the name of your user model
'commentsPerPage'=>3, //number of comments per page
'uploadDir'=>'/uploads/',// where to upload attachments
'userUrl'=> "/user/view/id/{{userid}}", //the url to the user profiles in your project
'imageExt'=>"jpg,gif,png,jpeg",// what extensions for attachments should be treated as images and shown in a easybox window if clicked


),
.....

FAQ:
Question: What is the userUrl options and how do I modify it?
Answer: You should set the userUrl to the url that your app uses to show a users profile. In that url you should use {{userid}} at the place in the url where you use the userid. Sforum will automaticly swap this with the userid that has created a topic or comment.

Not good enough? Well just customize the userUrl method in SForumModule.php


Question: Why this instead of myBB or other feature rich forums?
Answer: This module was written to provide a basic forum experience that can easily be integrated in any yii project.
If you want an ultimate forum solution for big communities this wont suit you, since I'm a single developer doing this as a hobby and do not have the possibility to create a forum with ALL features. But many sites only needs something simple, and this module can easily be used with any user system.
This is also my attempt to make a forum as user friendly as possible using ajax more then the big forum solutions I've seen.

Question: How do I controll which ones are moderators? and who is allowed to comment or create topics?
Answer: Please look at SForumModule.php and look at these methods:

//moderator/admin method
//if this method returns true then the user will be able to delete comments,topics and move topics
//you can change the logic of the method if you want
public static function moderator()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}

//comment method
//if this method returns true then the user will be able to comment and reply to comments
//you can change the logic of the method if you want
public static function allowComment()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}
//topic method
//if this method returns true then the user will be able to create new topics
//you can change the logic of the method if you want
public static function allowTopic()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}

With this you can customize exactly who will be able to moderate the forum and who is allowed to comment. Currently this module does not support not logged in users to comment, since a userid will be needed for each comment and topic.

Question: Do I have to use bootstrap?
Answer: No, I have on purpose not used the bootstrap extension or any bootstrap javascript. Bootstrap is only used and included for the css.
You can remove this and modify the views to use any css you want. None of the functionality depends on bootstrap.


Question: Why is there javascript code in the views?
Answer: I've done the most I possibly can to move all jQuery code to the external sforum.js file. But some code has to be in the view to work properly.
If you find a way to decrease the amount of javascript code in the views, please provide your solutions and I will update this module.

Question: Why have you mixed CHTml::tag and html?
Answer: Originally I did all html code the old school way. But then I regretted that choice and started to convert as much as possible to CHtml code.
I'm alittle bit lazy and have not finished all of this yet, feel free to help and contribute your changes.

Attached File(s)


1

#2 User is offline   betelgeuse 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 99
  • Joined: 12-January 09

Posted 06 September 2012 - 08:01 AM

Hi Sampa, thanks for your time

I´m having some problems to make it work:

- tbl_user is not in sql dump, instead i´m using data/schema_mysql.sql (ok)

- create an user:admin/pass:admin (ok)

- login in as admin(ok)

- Forum Admin > Categories > New Category : showing a modal with no content.
a code snippet says more than a thousand words
0

#3 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 07 September 2012 - 02:12 AM

View PostFlavio, on 06 September 2012 - 08:01 AM, said:

Hi Sampa, thanks for your time

I´m having some problems to make it work:

- tbl_user is not in sql dump, instead i´m using data/schema_mysql.sql (ok)

- create an user:admin/pass:admin (ok)

- login in as admin(ok)

- Forum Admin > Categories > New Category : showing a modal with no content.


Ah yes, this is true. Because I imagined that if someone wants a forum they already have a user table, I did not want to do something that could conflict with the existing solution.

Could you provide some error message for new category? It works for me so I can't help unless I know what errors you get, what does it say in firebug or console?
0

#4 User is offline   hfvoip 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 16-November 10

Posted 12 September 2012 - 09:31 PM

I am lucky to find your forum extension ,thanks
0

#5 User is offline   moylua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 14-January 12

Posted 13 September 2012 - 06:13 PM

I am receiving the error of no index in the view of the topic :(
0

#6 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 14 September 2012 - 12:50 AM

View Postmoylua, on 13 September 2012 - 06:13 PM, said:

I am receiving the error of no index in the view of the topic :(

Can you explain further? Because that does not help me with what your problem is.
0

#7 User is offline   grandoom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-July 12

Posted 18 September 2012 - 09:53 AM

View PostSampa, on 14 September 2012 - 12:50 AM, said:

Can you explain further? Because that does not help me with what your problem is.


hi,
thx for this extension

it will help me !
i was search for this type of project. many many thx

i've made two small modifications for integrate in my Yii project :
1 - suppress the loading of bootstrap CSS in registerAssets() of SForumModule.php because Bootstrap was already used in my project..

2 - modify the createUrl code in the categories _view.php ligne 12 et 13 by

 <?= CHtml::link(CHtml::encode($data->name),
                array('category/view','id'=>$data->id,'name'=>$data->name)); ?>

to make it work


i'll continu to test this !!
because the creation of a topic show me a empty modal.
Posted Image
Posted Image
0

#8 User is offline   grandoom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-July 12

Posted 03 October 2012 - 05:40 AM

hi!

could you give us your config/main.php pls?

specially the URL Manager config.. thx

lol i should load the demo...
0

#9 User is offline   grandoom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-July 12

Posted 06 October 2012 - 01:49 PM

hi!

it's seems that your application will run correctly when she is located in the WebROot folder...


any tips for make it work in a sub-folder root whitout force ajaxcallbacks to a static adress?
http://localhots/forum/sforum/etc....?


thx per advance
a noob user of your script ;)
0

#10 User is offline   DrMabuse 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 08-March 12
  • Location:Stuttgart

Posted 08 October 2012 - 08:02 AM

Thx for Your work .

But plz Fix some Issues:
  • Set Your Urls with Yii::app()->baseUrl
  • dont name your tables tbl_comment rename it to tbl_sforum_comment or whatever
  • and fix the urls in your js scripts you comp only works with vhosts and .htacces not very usefull for some newbies


Ths DrMabuse
... und wenn man hier auf den Knopf drückt fallen die Kühe und die Häuser um das ist dann immer ein ganz großes Hallo .....
0

#11 User is offline   DrMabuse 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 08-March 12
  • Location:Stuttgart

Posted 08 October 2012 - 08:23 AM

Ok here some update Fix

add this to your views/forum.php

<?php $script = 'var baseUrl = "'.Yii::app()->baseUrl.'";alert(baseUrl)' ?>
<?php Yii::app()->clientScript->registerScript('sforum_baseUrl',$script,CClientScript::POS_HEAD) ?>


then change to your ajax functions
function changeVote(id,type){
    $.ajax({
        type: "POST",
        url: baseUrl+"/sforum/comment/changeVote",

... und wenn man hier auf den Knopf drückt fallen die Kühe und die Häuser um das ist dann immer ein ganz großes Hallo .....
1

#12 User is offline   grandoom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-July 12

Posted 11 October 2012 - 09:28 AM

finally installed (without the DocSnyder Fix because he don't totally work for me)
my fix consist in a manual Fix ... arrgg !!
and...here is some errors

1 - a category name with spaces cause a error on creating topic (empty form..)
2 - action 'changeCategory' for topic seems inactive (or not existing?)
3 - after delete topic still show the topic (u should redirect the page? or no?)
4 - change sticky still show no sticky (should refresh page? or no?)

hope help you for an update..
0

#13 User is offline   jairbatista81 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 05-November 12

Posted 09 November 2012 - 07:11 PM

The empty modal appears to me too, when the category name has one or more spaces. Do you know how to fix it?
Thanks,
Jair Batista
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users