Commits

christiansalazar committed 388cbaa

readme, release #1

Comments (0)

Files changed (1)

 YII CHAT
---------
-
-A chat for Yii based applications.
+========
 
+The most simple jQuery based chat in the world for Yii based applicationsi.
 
+Not dependent on any data model, it is an abstract chat component, it will 
+connects to a class who implements a required interface. You can provide your 
+own class or mechanism to provide real data to this chat.
+ 
 autor: Christian Salazar. <christiansalazarh@gmail.com>
 
+#Instalation:
+
+1. Install the extension in the directory:
+
+~~~
+	'protected/extensions'
+~~~
+2. In config/main, in your imports, add: 
+	
+~~~
+	'imports'=>array(
+		..bla..
+		'application.extensions.yiichat.*',
+	),
+~~~
+3. Edit your file: 'protected/controllers/siteController.php' 
+and add the following the array at actions():
+~~~
+	'yiichat'=>array('class'=>'YiiChatAction'),
+~~~
+4. In any view in were you decide to insert this chat 
+(views/site/index.php, as an example), please configure the widget in this way: 
+~~~
+<h1>Yii Chat Demo</h1>
+<div id='chat'></div>
+<?php 
+	$this->widget('YiiChatWidget',array(
+		'chat_id'=>'123',					// a chat identificator
+		'identity'=>Yii::app()->user->id,	// who is using the chat
+		'selector'=>'#chat',				// were it will be inserted
+		'minPostLen'=>2,					// min and
+		'maxPostLen'=>10,					// max string size for post
+		'model'=>new MyYiiChatHandler(),	// the class handler.
+											// MyYiiChatHandler is a demo
+											// you must create your own class 
+											// and implements IYiiChat interfac
+
+		// success and error handlers, both optionals.
+		'onSuccess'=>new CJavaScriptExpression(
+			"function(code, text, post_id){   }"),
+		'onError'=>new CJavaScriptExpression(
+			"function(errorcode, info){ alert(errorcode+': '+info);  }"),
+	));
+?>
+~~~
+#How it works.
+
+The chat depends on a interface (IYiiChat), any class who implements this
+interface can serve a YiiChat Application.  For demo pruposes i provide a class
+named 'MyYiiChatHandler', this chat handler provides a functionality based on
+random messages, you are responsible for connect this class to a real database.
+
+All actions (internals in YiiChat) are invoked via ajax requests automatically 
+by the automatic action provided in site/controller (see step 3).
+
+#Simple
 
+Due to business requirements i provide this chat as-is, it can be modeled to 
+fit any business rules, because it does not depends on any database or similar
+structure. The demo class provides the most simple case to implements a 
+functional chat widget. It is your responsability to connect it to a real 
+database.
 
-Example usage:
+enjoy it. hope it will be usefull for you.  Issues and comments are welcome.
 
-1. Install the extension in your 'protected/extensions' directory.
-2.