Changes between Version 2 and Version 3 of RayIntegration
- Timestamp:
- 09/18/08 05:53:42 (1 year ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RayIntegration
v2 v3 5 5 6 6 7 First of all you need to customize some interface functions, collected in “'''ray/modules/global/inc/customFunctions.inc.php'''” (as at most these functions are used for generating XML replies “'''true'''” and “'''false'''”strings are defined as constants and used instead of Boolean values in some custom functions). All functions should consider to accept the defined number of arguments and return the defined answer (as in original functions):7 First of all you need to customize some interface functions, collected in "'''ray/modules/global/inc/customFunctions.inc.php'''" (as at most these functions are used for generating XML replies "'''true'''" and "'''false'''" strings are defined as constants and used instead of Boolean values in some custom functions). All functions should consider to accept the defined number of arguments and return the defined answer (as in original functions): 8 8 9 9 1. '''loginUser''' 23 23 24 24 {{{ 25 $sResult = loginUser( “1”, “12345”);25 $sResult = loginUser("1", "12345"); 26 26 echo $sResult; 27 $sResult = loginUser( “nick”, “12345”, true);27 $sResult = loginUser("nick", "12345", true); 28 28 echo $sResult; 29 29 ///////////////////// 47 47 48 48 {{{ 49 $sResult = loginAdmin( “admin”, “dolphin”);49 $sResult = loginAdmin("admin", "dolphin"); 50 50 echo $sResult; 51 51 ///////////////////// 67 67 68 68 {{{ 69 $aInfo = getUserInfo( “1”);69 $aInfo = getUserInfo("1"); 70 70 print_r($aInfo); 71 71 ///////////////////// 72 Array("nick" => “Macho”, "sex" => “Male”, "age" => 25, "desc" => “some description goes here”, "photo" => “http://[your_site]/[images_folder]/1.pg”, "profile" => “http://[your_site]/profile.php?ID=1”)72 Array("nick" => "Macho", "sex" => "Male", "age" => 25, "desc" => "some description goes here", "photo" => "http://[your_site]/[images_folder]/1.pg", "profile" => "http://[your_site]/profile.php?ID=1") 73 73 }}} 74 74 85 85 }}} 86 86 87 Searches user by $sField field ( “ID”by default) for $sValue value and returns user ID.88 89 {{{ 90 $sId = searchUser( “Macho”, “Nick”);87 Searches user by $sField field ("ID" by default) for $sValue value and returns user ID. 88 89 {{{ 90 $sId = searchUser("Macho", "Nick"); 91 91 echo $sId; 92 92 ///////////////////// 105 105 }}} 106 106 107 Retrieves user ’s friends by given user ID.108 109 {{{ 110 $aFriends = getFriends( “1”);107 Retrieves user's friends by given user ID. 108 109 {{{ 110 $aFriends = getFriends("1"); 111 111 print_r($aFriends); 112 112 ///////////////////// 113 Array( “2”, "3", "5", "10")113 Array("2", "3", "5", "10") 114 114 }}} 115 115 118 118 119 119 120 Once you ’ve made necessary changes in integration functions, you should install Ray Base. For this go to "'''http://[your_site]/ray/install/'''". Go through the Ray installation wizard, accurately filling out all necessary fields.120 Once you've made necessary changes in integration functions, you should install Ray Base. For this go to "'''http://[your_site]/ray/install/'''". Go through the Ray installation wizard, accurately filling out all necessary fields. 121 121 122 122 After this is done, the first part of integration is done. Your Ray admin panel (the login and password you should have set during installation steps) is available at 134 134 }}} 135 135 136 into every page of your site. Also every page of your site should include integration JavaScript script “'''global/js/integration.js'''” 137 {{{ 138 <script src="[url_to_ray]/modules/global/js/integration.js" type="text/javascript" language="javascript"></script> 136 into every page of your site. 137 138 Also every page of your site should include the result of the function '''getRayIntegrationJS()''' which is declared in the file '''[path_to_ray]/modules/global/inc/content.inc.php''' 139 140 It usually looks like this (in the default Dolphin installation): 141 {{{ 142 <script type="text/javascript" language="javascript"> 143 var sRayUrl = "http://www.boonex.us/ray/";var aRayApps = new Array(); 144 145 //global begin 146 aRayApps["global"] = new Array(); 147 aRayApps["global"]["admin"] = {"params": new Array('nick', 'password'), "top": 0, "left": 0, "width": 800, "height": 600, "resizable": 0}; 148 //global end 149 //im begin 150 aRayApps["im"] = new Array(); 151 aRayApps["im"]["user"] = {"params": new Array('sender', 'password', 'recipient'), "top": 0, "left": 0, "width": 550, "height": 500, "resizable": 1}; 152 //im end 153 //mp3 begin 154 aRayApps["mp3"] = new Array(); 155 aRayApps["mp3"]["player"] = {"params": new Array('id', 'password', 'vId', 'song'), "top": 0, "left": 0, "width": 350, "height": 380, "resizable": 0}; 156 aRayApps["mp3"]["editor"] = {"params": new Array('id', 'password'), "top": 0, "left": 0, "width": 480, "height": 640, "resizable": 1}; 157 //mp3 end 158 //presence begin 159 aRayApps["presence"] = new Array(); 160 aRayApps["presence"]["user"] = {"params": new Array('id', 'password'), "top": 0, "left": 0, "width": 220, "height": 600, "resizable": 1}; 161 //presence end 162 //video begin 163 aRayApps["video"] = new Array(); 164 aRayApps["video"]["recorder"] = {"params": new Array('id', 'password'), "top": 0, "left": 0, "width": 350, "height": 435, "resizable": 0}; 165 aRayApps["video"]["player"] = {"params": new Array('id'), "top": 0, "left": 0, "width": 350, "height": 435, "resizable": 1}; 166 aRayApps["video"]["admin"] = {"params": new Array('nick', 'password'), "top": 0, "left": 0, "width": 700, "height": 330, "resizable": 0}; 167 //video end//mp3_as3 begin 168 aRayApps["mp3_as3"] = new Array(); 169 aRayApps["mp3_as3"]["editor"] = {"params": new Array('id', 'password'), "top": 0, "left": 0, "width": 480, "height": 640, "resizable": 1}; 170 //mp3_as3 end\n</script><script src="http://www.boonex.us/ray/modules/global/js/integration.js" type="text/javascript" language="javascript"> 171 </script> 139 172 }}} 140 173 141 174 Some Ray widgets use information about online status of site users. So you should provide user online status updating. This can be done in two ways: 142 175 143 1. By calling to “'''updateRayUserStatus([user_ID])'''” JavaScript function (“'''global/js/integration.js'''”should be included) for HTML pages (as a rule on body onLoad event).144 145 2. By calling to “'''updateOnline([user_ID])'''” PHP function (“'''global/inc/apiFunctions.inc.php'''”should be required) for PHP scripts.176 1. By calling to "'''updateRayUserStatus([user_ID])'''" JavaScript function ("'''global/js/integration.js'''" should be included) for HTML pages (as a rule on body onLoad event). 177 178 2. By calling to "'''updateOnline([user_ID])'''" PHP function ("'''global/inc/apiFunctions.inc.php'''" should be required) for PHP scripts. 146 179 147 180 153 186 1. If you want to open the widget application in pop-up window you should set 154 187 {{{ 155 “$aModules[application_name][‘inline’]”156 }}} 157 variable in “'''inc/constants.inc.php'''” of the widget to “'''false'''”and then install the widget.188 "$aModules[application_name]['inline']" 189 }}} 190 variable in "'''inc/constants.inc.php'''" of the widget to "'''false'''" and then install the widget. 158 191 159 192 After installation you will be able to open the widget application by calling to JavaScript 161 194 function openRayWidget(module, application, [param1], [param2], …, [paramN]) 162 195 }}} 163 function ( “'''global/js/integration.js'''”should be included to this page) with necessary set of parameters passed to this function.196 function ("'''global/js/integration.js'''" should be included to this page) with necessary set of parameters passed to this function. 164 197 165 198 For example Ray chat (by Boonex) should be opened this way: 166 199 link to chat: 167 200 {{{ 168 <a href= ”#” onClick=” openRayWidget(“chat”, “user”, “1”, “12345”)”>open chat</a>169 }}} 170 171 Clicking on this link user will open Ray chat and login to it with “1”(user ID) and “12345”(user password) login information.172 173 Here are two compulsory for any widget application parameters – widget name ( “'''chat'''”) and widget application name (“'''user'''”).201 <a href="#" onClick=" openRayWidget("chat", "user", "1", "12345")">open chat</a> 202 }}} 203 204 Clicking on this link user will open Ray chat and login to it with "1"(user ID) and "12345"(user password) login information. 205 206 Here are two compulsory for any widget application parameters – widget name ("'''chat'''") and widget application name ("'''user'''"). 174 207 The rest of parameters depend on widget application and can be known from 175 208 {{{ 176 $aModules[application_name][ ‘parameters’]177 }}} 178 179 variable in “'''inc/constants.inc.php'''”of the widget.209 $aModules[application_name]['parameters'] 210 }}} 211 212 variable in "'''inc/constants.inc.php'''" of the widget. 180 213 181 214 2. If you want to integrate any widget application directly into your site page you should require on this page 194 227 function where the widget application should appear. 195 228 196 For example to insert Ray chat (by Boonex) in some page ( “'''chat_area.php'''”) of a site one should make the following changes to this page:229 For example to insert Ray chat (by Boonex) in some page ("'''chat_area.php'''") of a site one should make the following changes to this page: 197 230 198 231 '''chat_area.php''' 199 232 {{{ 200 233 <?php 201 require_once( “[path_to_ray]/modules/global/inc/ header.inc.php”);202 require_once( “[path_to_ray]/modules/global/inc/content.inc.php”);234 require_once("[path_to_ray]/modules/global/inc/ header.inc.php"); 235 require_once("[path_to_ray]/modules/global/inc/content.inc.php"); 203 236 //some code 204 237 ………………….. 205 238 $aParamValues = array(); 206 $aParamValues[ ‘id’] = “1”;//defining user ID207 $aParamValues[ ‘password’] = “12345”;//defining user password208 echo getApplicationContent( “chat”, “user”, $aParamValues, true);239 $aParamValues['id'] = "1";//defining user ID 240 $aParamValues['password'] = "12345";//defining user password 241 echo getApplicationContent("chat", "user", $aParamValues, true); 209 242 ………………….. 210 243 //some more code 212 245 }}} 213 246 214 This will display Ray chat and login to it with “1”(user ID) and “12345”(user password) login information directly in the “'''chat_area.php'''”page.247 This will display Ray chat and login to it with "1"(user ID) and "12345"(user password) login information directly in the "'''chat_area.php'''" page. 215 248 216 249 If you have questions, suggestions or feedbacks over this manual feel free to write them at [http://www.boonex.com/unity/forums/ Unity Forums for Ray].

