select style from settings page

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@187 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-14 21:34:27 +00:00
parent 341e5d85b6
commit c35e785951
4 changed files with 28 additions and 0 deletions

View File

@ -255,6 +255,8 @@ page_avatar.intro=You can upload your photo only in JPG, GIF, PNG or TIF image f
page_avatar.title=Upload photo
page_search.intro=Search for chat history of a specified user or a specified phrase in a message.
page_settings.intro=Specify options affecting chat window and common system behavior
settings.chatstyle=Select style for your chat windows
settings.chatstyle.description=
settings.company.title=Company title
settings.company.title.description=Enter your company title
settings.email=Email

View File

@ -255,6 +255,8 @@ page_avatar.intro=
page_avatar.title=Загрузка фотографии
page_search.intro=На данной странице можно осуществить поиск диалогов по имени пользователя или фразе, встречающейся в сообщении.
page_settings.intro=Здесь вы можете задать опции влияющие на отображение чат окна и общее поведение системы
settings.chatstyle=Âûáåðèòå âèä âàøåãî ÷àò îêíà
settings.chatstyle.description=
settings.company.title=Название компании
settings.company.title.description=Введите название Вашей компании
settings.email=Адрес электронной почты

View File

@ -34,6 +34,17 @@ function update_settings() {
$page = array('agentId' => '');
$errors = array();
$stylelist = array();
$stylesfolder = "../styles";
if($handle = opendir($stylesfolder)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) {
$stylelist[] = $file;
}
}
closedir($handle);
}
loadsettings();
$email = $settings['email'];
$title = $settings['title'];
@ -42,6 +53,7 @@ $hosturl = $settings['hosturl'];
$enableban = $settings['enableban'];
$usernamepattern = $settings['usernamepattern'];
$usercanchangename = $settings['usercanchangename'];
$chatstyle = $settings['chatstyle'];
if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
$email = getparam('email');
@ -52,6 +64,11 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
$usernamepattern = getparam('usernamepattern');
$usercanchangename = verifyparam("usercanchangename", "/^on$/", "") == "on" ? "1" : "0";
$chatstyle = verifyparam("chatstyle","/^\w+$/", $chatstyle);
if(!in_array($chatstyle, $stylelist)) {
$chatstyle = $stylelist[0];
}
if($email && !is_valid_email($email)) {
$errors[] = getlocal("settings.wrong.email");
}
@ -64,6 +81,7 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
$settings['enableban'] = $enableban;
$settings['usernamepattern'] = $usernamepattern;
$settings['usercanchangename'] = $usercanchangename;
$settings['chatstyle'] = $chatstyle;
update_settings();
header("Location: $webimroot/operator/index.php");
exit;
@ -78,6 +96,8 @@ $page['formhosturl'] = topage($hosturl);
$page['formenableban'] = $enableban == "1";
$page['formusernamepattern'] = topage($usernamepattern);
$page['formusercanchangename'] = $usercanchangename == "1";
$page['formchatstyle'] = $chatstyle;
$page['availableStyles'] = $stylelist;
start_html_output();
require('../view/settings.php');

View File

@ -86,6 +86,10 @@
<input type="text" name="usernamepattern" size="40" value="<?php echo form_value('usernamepattern') ?>" class="formauth"/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.usernamepattern.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
<tr><td class='formauth'><?php echo getlocal('settings.chatstyle') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
<select name="chatstyle" ><?php foreach($page['availableStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("chatstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.chatstyle.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
<tr><td class='formauth'><?php echo getlocal('settings.usercanchangename') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
<input type="checkbox" name="usercanchangename" value="on"<?php echo form_value_cb('usercanchangename') ? " checked=\"checked\"" : "" ?>/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.usercanchangename.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>