mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 18:41:09 +03:00 
			
		
		
		
	design preview started, show demo thread for user-chat
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@178 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									e0d80f3c61
								
							
						
					
					
						commit
						6a204b7d78
					
				| @ -73,11 +73,6 @@ $remote_visitor = 'visitor_from_request'; | ||||
|  */ | ||||
| $online_timeout = 30; | ||||
| 
 | ||||
| /* | ||||
|  *   Link to page with information about user, {id} is substituted | ||||
|  */ | ||||
| $user_link_pattern = ""; | ||||
| 
 | ||||
| /* | ||||
|  *   Maximum uploaded file size. | ||||
|  */ | ||||
|  | ||||
							
								
								
									
										47
									
								
								src/messenger/webim/libs/demothread.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/messenger/webim/libs/demothread.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2008 Web Messenger Community | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  * http://www.eclipse.org/legal/epl-v10.html | ||||
|  * | ||||
|  * Contributors: | ||||
|  *    Evgeny Gryaznov - initial API and implementation | ||||
|  */ | ||||
| 
 | ||||
| function demo_print_message($msg) { | ||||
| 	global $webim_encoding; | ||||
| 	print "<message>".myiconv($webim_encoding,"utf-8",escape_with_cdata(message_to_html($msg)))."</message>\n"; | ||||
| } | ||||
| 
 | ||||
| function demo_process_thread($act,$lastid,$isuser,$canpost) { | ||||
| 	global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent; | ||||
| 	if( $act == "refresh" ) { | ||||
| 		$lastid++; | ||||
| 		start_xml_output(); | ||||
| 		print("<thread lastid=\"$lastid\" typing=\"".((($lastid/3)%2)==1 ? 1 : 0)."\" canpost=\"".($canpost ? 1 : 0)."\">"); | ||||
| 		if($lastid == 1) { | ||||
| 			demo_print_message( | ||||
| 				array('ikind'=>$kind_for_agent,'created'=>time()-15,'tname'=>'', | ||||
| 					  'tmessage'=>getstring2('chat.came.from',array("http://google.com")))); | ||||
| 			demo_print_message( | ||||
| 				array('ikind'=>$kind_info,'created'=>time()-15,'tname'=>'', | ||||
| 					  'tmessage'=>getstring('chat.wait'))); | ||||
| 			demo_print_message( | ||||
| 				array('ikind'=>$kind_events,'created'=>time()-10,'tname'=>'', | ||||
| 					  'tmessage'=>getstring2("chat.status.operator.joined", array("Administrator")))); | ||||
| 			demo_print_message( | ||||
| 				array('ikind'=>$kind_agent,'created'=>time()-9,'tname'=>'Administrator', | ||||
| 					  'tmessage'=>getstring("demo.chat.welcome"))); | ||||
| 			demo_print_message( | ||||
| 				array('ikind'=>$kind_user,'created'=>time()-5,'tname'=>getstring("chat.default.username"), | ||||
| 					  'tmessage'=>getstring("demo.chat.question"))); | ||||
| 		} | ||||
| 		print("</thread>"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| @ -178,6 +178,8 @@ confirm.take.yes=Yes, I'm sure | ||||
| content.blocked=Here you can defend from malicious visitors. | ||||
| content.history=Search the dialogs history | ||||
| content.logoff=Log out of the system. | ||||
| demo.chat.question=There are so many browsers to choose from. Which one(s) do you recommend?  | ||||
| demo.chat.welcome=Hello, how may I help you? | ||||
| errors.failed.uploading.file=Error uploading file "{0}": "{1}". | ||||
| errors.file.move.error=Error moving file | ||||
| errors.file.size.exceeded=Uploaded file size exceeded | ||||
| @ -229,6 +231,10 @@ page.gen_button.choose_image=Choose image | ||||
| page.gen_button.choose_locale=Target locale | ||||
| page.gen_button.include_site_name=Include host name into code | ||||
| page.gen_button.secure_links=Use secure links (https) | ||||
| page.preview.choose=Choose style | ||||
| page.preview.intro=You can preview styles for your site | ||||
| page.preview.title=Site style | ||||
| page.preview.userchat=Chat window (user-mode) | ||||
| page_agent.create_new=Here you can create new operator | ||||
| page_agent.tab.avatar=Photo | ||||
| page_agent.tab.main=General | ||||
|  | ||||
| @ -178,6 +178,8 @@ confirm.take.yes= | ||||
| content.blocked=Здесь можно защищаться от спама и вредных посетителей | ||||
| content.history=Поиск по истории диалогов | ||||
| content.logoff=Покинуть систему. | ||||
| demo.chat.question=Ïîñîâåòóéòå ìíå, ïîæàëóéñòà, õîðîøèé áðàóçåð?  | ||||
| demo.chat.welcome=Çäðàâñòâóéòå! ×åì ÿ ìîãó Âàì ïîìî÷ü? | ||||
| errors.failed.uploading.file=Ошибка выгрузки файла "{0}": "{1}". | ||||
| errors.file.move.error=Ошибка копирования файла | ||||
| errors.file.size.exceeded=Превышен допустимый размер файла | ||||
| @ -229,6 +231,10 @@ page.gen_button.choose_image= | ||||
| page.gen_button.choose_locale=Для какой локали создавать кнопку | ||||
| page.gen_button.include_site_name=Включать имя сайта в код | ||||
| page.gen_button.secure_links=Использовать защищенное соединение (https) | ||||
| page.preview.choose=Âûáåðèòå ñòèëü  | ||||
| page.preview.intro=Çäåñü âû ìîæåòå ïîñìîòðåòü íà ñòèëü âàøåãî ñàéòà | ||||
| page.preview.title=Ñòèëü ìåññåíäæåðà | ||||
| page.preview.userchat=Chat window (user-mode) | ||||
| page_agent.create_new=Создание нового оператора | ||||
| page_agent.tab.avatar=Фотография | ||||
| page_agent.tab.main=Общее | ||||
|  | ||||
							
								
								
									
										53
									
								
								src/messenger/webim/operator/preview.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/messenger/webim/operator/preview.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2008 Web Messenger Community | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  * http://www.eclipse.org/legal/epl-v10.html | ||||
|  * | ||||
|  * Contributors: | ||||
|  *    Evgeny Gryaznov - initial API and implementation | ||||
|  */ | ||||
| 
 | ||||
| require_once('../libs/common.php'); | ||||
| require_once('../libs/chat.php'); | ||||
| require_once('../libs/operator.php'); | ||||
| require_once('../libs/expand.php'); | ||||
| 
 | ||||
| $operator = check_login(); | ||||
| 
 | ||||
| $designlist = array(); | ||||
| $designfolder = "../design"; | ||||
| if($handle = opendir($designfolder)) { | ||||
| 	while (false !== ($file = readdir($handle))) { | ||||
| 		if (preg_match("/^\w+$/", $file) && is_dir("$designfolder/$file")) { | ||||
| 			$designlist[] = $file; | ||||
| 		} | ||||
| 	} | ||||
| 	closedir($handle); | ||||
| } | ||||
| 
 | ||||
| $preview = verifyparam("preview","/^\w+$/", "default"); | ||||
| if(!in_array($preview, $designlist)) { | ||||
| 	$preview = $designlist[0]; | ||||
| } | ||||
| 
 | ||||
| $show = verifyparam("show", "/^(chat)$/", ""); | ||||
| 
 | ||||
| if($show == 'chat') { | ||||
| 	setup_chatview_for_user(array('threadid' => 0,'userName' => getstring("chat.default.username"), 'ltoken' => 123), "ajaxed"); | ||||
| 	expand("../design/$preview/chat.tpl"); | ||||
| 	exit; | ||||
| } | ||||
| 
 | ||||
| $page['formpreview'] = $preview; | ||||
| $page['availablePreviews'] = $designlist; | ||||
| $page['operator'] = topage(get_operator_name($operator)); | ||||
| $page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&show="; | ||||
| 
 | ||||
| start_html_output(); | ||||
| require('../view/preview.php'); | ||||
| ?>
 | ||||
| @ -23,6 +23,13 @@ $isuser = verifyparam( "user", "/^true$/", "false") == 'true'; | ||||
| $outformat = ((verifyparam( "html", "/^on$/", "off") == 'on') ? "html" : "xml"); | ||||
| $istyping = verifyparam( "typed", "/^1$/", "") == '1'; | ||||
| 
 | ||||
| if($threadid == 0 && ($token == 123 || $token == 124)) { | ||||
| 	require_once('libs/demothread.php'); | ||||
| 	$lastid = verifyparam( "lastid", "/^\d{1,9}$/", 0); | ||||
| 	demo_process_thread($act,$lastid,$isuser,$token == 123); | ||||
| 	exit; | ||||
| } | ||||
| 
 | ||||
| $thread = thread_by_id($threadid); | ||||
| if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) { | ||||
| 	die("wrong thread"); | ||||
|  | ||||
							
								
								
									
										78
									
								
								src/messenger/webim/view/preview.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								src/messenger/webim/view/preview.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,78 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2008 Web Messenger Community | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  * http://www.eclipse.org/legal/epl-v10.html | ||||
|  * | ||||
|  * Contributors: | ||||
|  *    Evgeny Gryaznov - initial API and implementation | ||||
|  */ | ||||
| ?>
 | ||||
| <html> | ||||
| <head> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| <link rel="stylesheet" type="text/css" media="all" href="<?php echo $webimroot ?>/styles.css" /> | ||||
| 
 | ||||
| 
 | ||||
| <link rel="shortcut icon" href="<?php echo $webimroot ?>/images/favicon.ico" type="image/x-icon"/> | ||||
| <title> | ||||
| 	<?php echo getlocal("app.title") ?>	- <?php echo getlocal("page.preview.title") ?>
 | ||||
| </title> | ||||
| 
 | ||||
| <meta http-equiv="keywords" content="<?php echo getlocal("page.main_layout.meta_keyword") ?>"> | ||||
| <meta http-equiv="description" content="<?php echo getlocal("page.main_layout.meta_description") ?>"> | ||||
| </head> | ||||
| 
 | ||||
| <body bgcolor="#FFFFFF" text="#000000" link="#2971C1" vlink="#2971C1" alink="#2971C1"> | ||||
| 
 | ||||
| <table width="100%" cellpadding="2" cellspacing="0" border="0"> | ||||
| <tr> | ||||
| <td valign="top" class="text"> | ||||
| 
 | ||||
|  <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="left" valign="top"> | ||||
| 		<h1><?php echo getlocal("page.preview.title") ?></h1>
 | ||||
|  </td><td align="right" class="text" valign="top"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="textform"><?php echo getlocal2("menu.operator",array($page['operator'])) ?></td><td class="textform"><img src='<?php echo $webimroot ?>/images/topdiv.gif' width="25" height="15" border="0" alt="|" /></td><td class="textform"><a href="<?php echo $webimroot ?>/operator/index.php" title="<?php echo getlocal("menu.main") ?>"><?php echo getlocal("menu.main") ?></a></td></tr></table></td></tr></table>
 | ||||
| 
 | ||||
| 
 | ||||
| 	<?php echo getlocal("page.preview.intro") ?>
 | ||||
| <br /> | ||||
| <br /> | ||||
| 
 | ||||
| <form name="preview" method="get" action="<?php echo $webimroot ?>/operator/preview.php"> | ||||
| <table cellspacing='0' cellpadding='0' border='0'><tr><td background='<?php echo $webimroot ?>/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'> | ||||
| 	<tr> | ||||
| 		<td colspan="3" class="formauth"><?php echo getlocal("page.preview.choose") ?></td>
 | ||||
| 	</tr> | ||||
| 	<tr><td colspan="3" height="2"></td></tr> | ||||
| 	<tr> | ||||
| 		<td colspan="3"> | ||||
| 			<select name="preview" onchange="this.form.submit();"><?php foreach($page['availablePreviews'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("preview") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
 | ||||
| 		</td> | ||||
| 	</tr> | ||||
| 	<tr><td colspan="3" height="10"></td></tr> | ||||
| 	<tr> | ||||
| 		<td colspan="3" class="formauth"><?php echo getlocal("page.preview.userchat") ?></td>
 | ||||
| 	</tr> | ||||
| 	<tr><td colspan="3" height="7"></td></tr> | ||||
| 	<tr> | ||||
| 		<td colspan="3"> | ||||
| 			<iframe id="sample1" width="600" height="420" src="<?php echo $page['showlink'] ?>chat" frameborder="1" style="overflow:none;"> | ||||
| 			No iframes | ||||
| 			</iframe> | ||||
| 		</td> | ||||
| 	</tr> | ||||
| </table></td><td></td></tr><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table> | ||||
| </form> | ||||
| </td> | ||||
| </tr> | ||||
| </table> | ||||
| 
 | ||||
| </body> | ||||
| </html> | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user