Skip to content

Commit

Permalink
Added invitations styles
Browse files Browse the repository at this point in the history
  • Loading branch information
JustBlackBird committed Dec 15, 2011
1 parent b216789 commit 57f742a
Show file tree
Hide file tree
Showing 147 changed files with 349 additions and 138 deletions.
12 changes: 6 additions & 6 deletions src/messenger/webim/client.php
Expand Up @@ -93,15 +93,15 @@
$page = array();
setup_logo();
setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer,can_show_captcha());
expand("styles", getchatstyle(), "leavemessage.tpl");
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
exit;
}

if($settings['enablepresurvey'] == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on')) {
$page = array();
setup_logo();
setup_survey($visitor['name'], $email, $groupid, $info, $referrer);
expand("styles", getchatstyle(), "survey.tpl");
expand("styles/dialogs", getchatstyle(), "survey.tpl");
exit;
}

Expand Down Expand Up @@ -160,13 +160,13 @@

$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
if( $pparam == "mailthread" ) {
expand("styles", getchatstyle(), "mail.tpl");
expand("styles/dialogs", getchatstyle(), "mail.tpl");
} else if( $level == "ajaxed" ) {
expand("styles", getchatstyle(), "chat.tpl");
expand("styles/dialogs", getchatstyle(), "chat.tpl");
} else if( $level == "simple" ) {
expand("styles", getchatstyle(), "chatsimple.tpl");
expand("styles/dialogs", getchatstyle(), "chatsimple.tpl");
} else if( $level == "old" ) {
expand("styles", getchatstyle(), "nochat.tpl");
expand("styles/dialogs", getchatstyle(), "nochat.tpl");
}

?>
65 changes: 0 additions & 65 deletions src/messenger/webim/invite.css

This file was deleted.

4 changes: 2 additions & 2 deletions src/messenger/webim/leavemessage.php
Expand Up @@ -95,7 +95,7 @@ function store_message($name, $email, $info, $message,$groupid,$referrer) {
if( count($errors) > 0 ) {
setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer,can_show_captcha());
setup_logo();
expand("styles", getchatstyle(), "leavemessage.tpl");
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
exit;
}

Expand All @@ -122,5 +122,5 @@ function store_message($name, $email, $info, $message,$groupid,$referrer) {
}

setup_logo();
expand("styles", getchatstyle(), "leavemessagesent.tpl");
expand("styles/dialogs", getchatstyle(), "leavemessagesent.tpl");
?>
2 changes: 1 addition & 1 deletion src/messenger/webim/libs/expand.php
Expand Up @@ -55,7 +55,7 @@ function expand_var($matches)
} else if ($var == 'jsver') {
return $jsver;
} else if ($var == 'tplroot') {
return "$webimroot/styles/$current_style";
return "$webimroot/styles/dialogs/$current_style";
} else if ($var == 'styleid') {
return $current_style;
} else if ($var == 'pagination') {
Expand Down
18 changes: 3 additions & 15 deletions src/messenger/webim/libs/getcode.php
Expand Up @@ -19,7 +19,7 @@
* Evgeny Gryaznov - initial API and implementation
*/

function generate_button($title, $locale, $style, $group, $inner, $showhost, $forcesecure, $modsecurity)
function generate_button($title, $locale, $style, $invitationstyle, $group, $inner, $showhost, $forcesecure, $modsecurity)
{
global $settings;
$link = get_app_location($showhost, $forcesecure) . "/client.php";
Expand All @@ -38,6 +38,8 @@ function generate_button($title, $locale, $style, $group, $inner, $showhost, $fo
$temp = preg_replace('/^(<a )/', '\1id="mibewAgentButton" ', $temp);
$temp .= '<div id="mibewinvitation"></div><script type="text/javascript">var mibewInviteStyle = \'@import url(';
$temp .= get_app_location($showhost, $forcesecure);
$temp .= '/styles/invitations/';
$temp .= ($invitationstyle?$invitationstyle:$settings['invitationstyle']);
$temp .= '/invite.css);\'; var mibewRequestTimeout = ';
$temp .= $settings['updatefrequency_tracking'];
$temp .= '*1000; var mibewRequestUrl = \'';
Expand All @@ -49,20 +51,6 @@ function generate_button($title, $locale, $style, $group, $inner, $showhost, $fo
return "<!-- mibew button -->" . $temp . "<!-- / mibew button -->";
}

function get_style_list($stylesfolder)
{
$stylelist = array("" => getlocal("page.preview.style_default"));
if ($handle = opendir($stylesfolder)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) {
$stylelist[$file] = $file;
}
}
closedir($handle);
}
return $stylelist;
}

function verifyparam_groupid($paramid)
{
global $settings, $errors;
Expand Down
5 changes: 4 additions & 1 deletion src/messenger/webim/libs/settings.php
Expand Up @@ -36,13 +36,16 @@ function update_settings()

function setup_settings_tabs($active)
{
global $page, $webimroot;
global $settings, $page, $webimroot;
$page['tabs'] = array(
getlocal("page_settings.tab.main") => $active != 0 ? "$webimroot/operator/settings.php" : "",
getlocal("page_settings.tab.features") => $active != 1 ? "$webimroot/operator/features.php" : "",
getlocal("page_settings.tab.performance") => $active != 2 ? "$webimroot/operator/performance.php" : "",
getlocal("page_settings.tab.themes") => $active != 3 ? "$webimroot/operator/themes.php" : "",
);
if ($settings['enabletracking']) {
$page['tabs'][getlocal("page_settings.tab.invitationthemes")] = ($active != 4 ? "$webimroot/operator/invitationthemes.php" : "");
}
}

?>
36 changes: 36 additions & 0 deletions src/messenger/webim/libs/styles.php
@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Mibew Messenger project.
*
* Copyright (c) 2005-2011 Mibew Messenger Community
* All rights reserved. The contents of this file are subject to 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
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License Version 2 or later (the "GPL"), in which case
* the provisions of the GPL are applicable instead of those above. If you wish
* to allow use of your version of this file only under the terms of the GPL, and
* not to allow others to use your version of this file under the terms of the
* EPL, indicate your decision by deleting the provisions above and replace them
* with the notice and other provisions required by the GPL.
*
* Contributors:
* Evgeny Gryaznov - initial API and implementation
*/

function get_style_list($stylesfolder)
{
$stylelist = array();
if ($handle = opendir($stylesfolder)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) {
$stylelist[$file] = $file;
}
}
closedir($handle);
}
return $stylelist;
}

?>
8 changes: 6 additions & 2 deletions src/messenger/webim/locales/en/properties
Expand Up @@ -265,6 +265,7 @@ page.chat.old_browser.problem=<p>Your web browser is not fully supported. \nPlea
page.chat.old_browser.title=Please use a more recent browser
page.gen_button.choose_group=Code for group
page.gen_button.choose_image=Choose image
page.gen_button.choose_invitationstyle=Invitation style
page.gen_button.choose_locale=Code for language
page.gen_button.choose_style=Chat window style
page.gen_button.code.description=<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!
Expand Down Expand Up @@ -361,7 +362,8 @@ page_settings.intro=Specify options affecting chat window and common system beha
page_settings.tab.features=Optional Services
page_settings.tab.main=General
page_settings.tab.performance=Performance
page_settings.tab.themes=Themes preview
page_settings.tab.themes=Chat themes preview
page_settings.tab.invitationthemes=Invitation themes preview
pending.menu.hide=Hide menu >>
pending.menu.show=Show menu >>
pending.popup_notification=A new visitor is waiting for an answer.
Expand Down Expand Up @@ -467,8 +469,10 @@ settings.host.description=Destination for your company name or logo link
settings.host=URL of your website
settings.invitationlifetime.description=Specify the lifetime of invitation in seconds. Default is 60 seconds.
settings.invitationlifetime=Invitation lifetime
settings.invitationstyle.description=A preview for invitation style is available <a href="invitationthemes.php">here</a>
settings.invitationstyle=Select a style for your invitation
settings.leavemessage_captcha.description=Protection against automated spam (captcha)
settings.leavemessage_captcha=Force visitor to enter a verification code when leaving message
settings.leavemessage_captcha=Force visitorOD to enter a verification code when leaving message
settings.logo.description=Enter http address of your company logo
settings.logo=Your company logo
settings.no.title=Please enter your company title
Expand Down
6 changes: 5 additions & 1 deletion src/messenger/webim/locales/ru/properties
Expand Up @@ -263,6 +263,7 @@ page.chat.old_browser.problem=<p>
page.chat.old_browser.title=����������� ����� ����� browser
page.gen_button.choose_group=��� ������
page.gen_button.choose_image=����� ��������
page.gen_button.choose_invitationstyle=����� �����������
page.gen_button.choose_locale=��� ����� ������ ��������� ������
page.gen_button.choose_style=����� ���-����
page.gen_button.code.description=<strong>��������!</strong> ��� ��������<br/> �����-���� ���������<br/> � ���� ��� �����������������<br/> ������ �� �������������!
Expand Down Expand Up @@ -359,7 +360,8 @@ page_settings.intro=
page_settings.tab.features=����������
page_settings.tab.main=�����
page_settings.tab.performance=������������������
page_settings.tab.themes=�������� ������
page_settings.tab.themes=�������� ������ ��������
page_settings.tab.invitationthemes=�������� ������ �����������
pending.menu.hide=�������� ���� >>
pending.menu.show=�������� ���� >>
pending.popup_notification=����� ���������� ������� ������.
Expand Down Expand Up @@ -457,6 +459,8 @@ settings.host.description=
settings.host=������ �� ��� ��� ����
settings.invitationlifetime.description=������� ���� �������� ����������� � ������� � ��������. �� ���������, 60 ������.
settings.invitationlifetime=���� �������� �����������
settings.invitationstyle.description=������������ ����� ����������� �������� <a href="invitationthemes.php">�����</a>
settings.invitationstyle=�������� ��� �����������
settings.leavemessage_captcha.description=������ �� ������������������� ����� (captcha)
settings.leavemessage_captcha=��������� ��������� ��������� ������ ����� ����� ������������ ���� � ��������
settings.logo.description=������� ������ �� ������� ��������
Expand Down
4 changes: 2 additions & 2 deletions src/messenger/webim/mail.php
Expand Up @@ -50,7 +50,7 @@
$page['ct.token'] = $thread['ltoken'];
$page['level'] = "";
setup_logo();
expand("styles", getchatstyle(), "mail.tpl");
expand("styles/dialogs", getchatstyle(), "mail.tpl");
exit;
}

Expand All @@ -69,6 +69,6 @@
close_connection($link);

setup_logo();
expand("styles", getchatstyle(), "mailsent.tpl");
expand("styles/dialogs", getchatstyle(), "mailsent.tpl");
exit;
?>
10 changes: 5 additions & 5 deletions src/messenger/webim/operator/agent.php
Expand Up @@ -63,7 +63,7 @@
if (!is_capable($can_takeover, $operator)) {
$errors = array("Cannot take over");
start_html_output();
expand("../styles", getchatstyle(), "error.tpl");
expand("../styles/dialogs", getchatstyle(), "error.tpl");
exit;
}

Expand All @@ -82,7 +82,7 @@
} else if (!is_capable($can_viewthreads, $operator)) {
$errors = array("Cannot view threads");
start_html_output();
expand("../styles", getchatstyle(), "error.tpl");
expand("../styles/dialogs", getchatstyle(), "error.tpl");
exit;
}

Expand All @@ -101,7 +101,7 @@
if ($thread['agentId'] != $operator['operatorid'] && !is_capable($can_viewthreads, $operator)) {
$errors = array("Cannot view threads");
start_html_output();
expand("../styles", getchatstyle(), "error.tpl");
expand("../styles/dialogs", getchatstyle(), "error.tpl");
exit;
}

Expand All @@ -112,9 +112,9 @@
$pparam = verifyparam("act", "/^(redirect)$/", "default");
if ($pparam == "redirect") {
setup_redirect_links($threadid, $token);
expand("../styles", getchatstyle(), "redirect.tpl");
expand("../styles/dialogs", getchatstyle(), "redirect.tpl");
} else {
expand("../styles", getchatstyle(), "chat.tpl");
expand("../styles/dialogs", getchatstyle(), "chat.tpl");
}

?>
19 changes: 16 additions & 3 deletions src/messenger/webim/operator/getcode.php
Expand Up @@ -23,6 +23,7 @@
require_once('../libs/operator.php');
require_once('../libs/groups.php');
require_once('../libs/getcode.php');
require_once('../libs/styles.php');

$operator = check_login();
force_password($operator);
Expand All @@ -38,12 +39,20 @@
}
$image_locales = $imageLocales[$image];

$stylelist = get_style_list("../styles");
$stylelist = get_style_list("../styles/dialogs");
$stylelist[""] = getlocal("page.preview.style_default");
$style = verifyparam("style", "/^\w*$/", "");
if ($style && !in_array($style, $stylelist)) {
$style = "";
}

$invitationstylelist = get_style_list("../styles/invitations");
$invitationstylelist[""] = getlocal("page.preview.style_default");
$invitationstyle = verifyparam("invitationstyle", "/^\w*$/", "");
if ($invitationstyle && !in_array($invitationstyle, $invitationstylelist)) {
$invitationstyle = "";
}

$groupid = verifyparam_groupid("group");
$showhost = verifyparam("hostname", "/^on$/", "") == "on";
$forcesecure = verifyparam("secure", "/^on$/", "") == "on";
Expand All @@ -63,20 +72,24 @@
$message = get_image($imagehref, $size[0], $size[1]);

$page = array();
$page['buttonCode'] = generate_button("", $lang, $style, $groupid, $message, $showhost, $forcesecure, $modsecurity);
$page['buttonCode'] = generate_button("", $lang, $style, $invitationstyle, $groupid, $message, $showhost, $forcesecure, $modsecurity);
$page['availableImages'] = array_keys($imageLocales);
$page['availableLocales'] = $image_locales;
$page['availableStyles'] = $stylelist;
$page['availableChatStyles'] = $stylelist;
$page['availableInvitationStyles'] = $invitationstylelist;
$page['groups'] = get_groups_list();

$page['formgroup'] = $groupid;
$page['formstyle'] = $style;
$page['forminvitationstyle'] = $invitationstyle;
$page['formimage'] = $image;
$page['formlang'] = $lang;
$page['formhostname'] = $showhost;
$page['formsecure'] = $forcesecure;
$page['formmodsecurity'] = $modsecurity;

$page['enabletracking'] = $settings['enabletracking'];

prepare_menu($operator);
start_html_output();
require('../view/gen_button.php');
Expand Down

0 comments on commit 57f742a

Please sign in to comment.