mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
Add an ability to select style for operator pages
This commit is contained in:
parent
b4ba38d770
commit
d406f720d8
@ -423,7 +423,7 @@ function setup_chatview(Thread $thread) {
|
||||
= $style_config['mail']['window_params'];
|
||||
|
||||
// Load core style options
|
||||
$style_config = get_core_style_config();
|
||||
$style_config = get_core_style_config(get_operator_pages_style());
|
||||
$data['chat']['windowsParams']['history']
|
||||
= $style_config['history']['window_params'];
|
||||
|
||||
|
@ -67,6 +67,7 @@ Class Settings {
|
||||
'usernamepattern' => '{name}',
|
||||
'chatstyle' => 'default',
|
||||
'invitationstyle' => 'default',
|
||||
'operator_pages_style' => 'default',
|
||||
'chattitle' => 'Live Support',
|
||||
'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}',
|
||||
'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1',
|
||||
|
@ -34,12 +34,12 @@ function read_config_file($file) {
|
||||
*
|
||||
* @return array Configuration array
|
||||
*/
|
||||
function get_core_style_config() {
|
||||
function get_core_style_config($style) {
|
||||
// Get root dir of mibew messanger
|
||||
$base_path = realpath(dirname(dirname(dirname(__FILE__))));
|
||||
|
||||
// Load config
|
||||
$config = read_config_file($base_path.'/styles/operator_pages/default/config.ini');
|
||||
$config = read_config_file($base_path.'/styles/operator_pages/' . $style . '/config.ini');
|
||||
|
||||
// Set default values
|
||||
$config = ($config === false) ? array() : $config;
|
||||
@ -60,7 +60,8 @@ function get_core_style_config() {
|
||||
),
|
||||
'ban' => array(
|
||||
'window_params' => ''
|
||||
)
|
||||
),
|
||||
'screenshots' => array()
|
||||
);
|
||||
|
||||
return $config;
|
||||
|
@ -85,4 +85,13 @@ function getchatstyle()
|
||||
return Settings::get('chatstyle');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns name of the current operator pages style
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_operator_pages_style() {
|
||||
return Settings::get('operator_pages_style');
|
||||
}
|
||||
|
||||
?>
|
@ -22,10 +22,11 @@ function setup_settings_tabs($active)
|
||||
getlocal("page_settings.tab.main") => $active != 0 ? "$mibewroot/operator/settings.php" : "",
|
||||
getlocal("page_settings.tab.features") => $active != 1 ? "$mibewroot/operator/features.php" : "",
|
||||
getlocal("page_settings.tab.performance") => $active != 2 ? "$mibewroot/operator/performance.php" : "",
|
||||
getlocal("page_settings.tab.themes") => $active != 3 ? "$mibewroot/operator/themes.php" : "",
|
||||
getlocal("page_settings.tab.operator_pages_themes") => $active != 3 ? "$mibewroot/operator/operator_pages_themes.php" : "",
|
||||
getlocal("page_settings.tab.themes") => $active != 4 ? "$mibewroot/operator/themes.php" : "",
|
||||
);
|
||||
if (Settings::get('enabletracking')) {
|
||||
$page['tabs'][getlocal("page_settings.tab.invitationthemes")] = ($active != 4 ? "$mibewroot/operator/invitationthemes.php" : "");
|
||||
$page['tabs'][getlocal("page_settings.tab.invitationthemes")] = ($active != 5 ? "$mibewroot/operator/invitationthemes.php" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,31 +16,46 @@
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/common/response.php');
|
||||
require_once(dirname(__FILE__).'/common/request.php');
|
||||
|
||||
|
||||
/**
|
||||
* Renders a view for an operator page
|
||||
*
|
||||
* At the moment all views are stored in /views folder.
|
||||
* All views are stored in "styles/operator_pages/<style_name>" folders.
|
||||
*
|
||||
* $view_name param should include neither full view's path nor its extension.
|
||||
* Just view name. For example, to render and output
|
||||
* 'styles/operator_pages/default/agents.php' view one should use 'agents' as
|
||||
* "styles/operator_pages/default/agents.php" view one should use "agents" as
|
||||
* the view name.
|
||||
*
|
||||
* @param string $view_name Name of the view to render
|
||||
* @param string $view_name Name of the view to render.
|
||||
* @param string $style_name Name of the style from which a view should
|
||||
* be rendered. If this param is empty the value from configurations will
|
||||
* be used.
|
||||
*/
|
||||
function render_view($view_name) {
|
||||
function render_view($view_name, $style_name = NULL) {
|
||||
// Code of this function replaces code from the global scope. Thus we need
|
||||
// to import some variables to make them visible to required views.
|
||||
global $page, $mibewroot, $version, $errors;
|
||||
|
||||
if (empty($style_name)) {
|
||||
if (installation_in_progress()) {
|
||||
// We currently instal Mibew. Thus we cannot use Database and
|
||||
// Settings classes. Just use "default" style for installation pages.
|
||||
$style_name = 'default';
|
||||
} else {
|
||||
$style_name = get_operator_pages_style();
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare to output html
|
||||
start_html_output();
|
||||
|
||||
// Build full view name. Remove '\' and '/' characters form the specified
|
||||
// view name
|
||||
$full_view_name = dirname(dirname(__FILE__)) .
|
||||
'/styles/operator_pages/default/views/' .
|
||||
'/styles/operator_pages/' . $style_name . '/views/' .
|
||||
str_replace("/\\", '', $view_name) . '.php';
|
||||
|
||||
// Load and execute the view
|
||||
|
@ -418,6 +418,7 @@ 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.operator_pages_themes=Operator pages themes preview
|
||||
page_settings.tab.themes=Chat themes preview
|
||||
page_settings.tab.invitationthemes=Invitation themes preview
|
||||
pending.errors.network=Network problems detected. Please refresh the page.
|
||||
@ -559,6 +560,8 @@ settings.onehostconnections.description=0 allows any number of connections
|
||||
settings.onehostconnections=Max number of threads from one address
|
||||
settings.onlinetimeout.description=Set the number of seconds to show an operator as online. Default is 30 seconds.
|
||||
settings.onlinetimeout=Operator online time threshold
|
||||
settings.operator_pages_style.description=A preview for each style is available <a href="operator_pages_themes.php">here</a>
|
||||
settings.operator_pages_style=Select a style for your operator pages
|
||||
settings.popup_notification.description=Small dialog appears to attract your attention.
|
||||
settings.popup_notification=Enable "Popup dialog notification of the new visitor".
|
||||
settings.saved=Changes saved
|
||||
|
@ -39,7 +39,7 @@ $page['availablePreviews'] = $stylelist;
|
||||
$page['operatorName'] = (empty($operator['vclocalname'])?$operator['vccommonname']:$operator['vclocalname']);
|
||||
|
||||
prepare_menu($operator);
|
||||
setup_settings_tabs(4);
|
||||
setup_settings_tabs(5);
|
||||
render_view('invitation_themes');
|
||||
|
||||
?>
|
54
src/mibew/operator/operator_pages_themes.php
Normal file
54
src/mibew/operator/operator_pages_themes.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once(dirname(dirname(__FILE__)).'/libs/init.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/libs/settings.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$stylelist = get_style_list(dirname(dirname(__FILE__)).'/styles/operator_pages');
|
||||
|
||||
$preview = verifyparam("preview", "/^\w+$/", "default");
|
||||
if (!in_array($preview, $stylelist)) {
|
||||
$style_names = array_keys($stylelist);
|
||||
$preview = $stylelist[$style_names[0]];
|
||||
}
|
||||
|
||||
$style_config = get_core_style_config($preview);
|
||||
|
||||
$screenshots = array();
|
||||
foreach($style_config['screenshots'] as $name => $desc) {
|
||||
$screenshots[] = array(
|
||||
'name' => $name,
|
||||
'file' => $mibewroot . '/styles/operator_pages/' . $preview
|
||||
. '/screenshots/' . $name . '.png',
|
||||
'description' => $desc
|
||||
);
|
||||
}
|
||||
|
||||
$page['formpreview'] = $preview;
|
||||
$page['availablePreviews'] = $stylelist;
|
||||
$page['screenshotsList'] = $screenshots;
|
||||
|
||||
prepare_menu($operator);
|
||||
setup_settings_tabs(3);
|
||||
render_view('operator_pages_themes');
|
||||
|
||||
?>
|
@ -30,11 +30,22 @@ $page = array('agentId' => '');
|
||||
$errors = array();
|
||||
|
||||
$stylelist = get_style_list(dirname(dirname(__FILE__)).'/styles/dialogs');
|
||||
$operator_pages_style_list = get_style_list(dirname(dirname(__FILE__)).'/styles/operator_pages');
|
||||
|
||||
$options = array(
|
||||
'email', 'title', 'logo', 'hosturl', 'usernamepattern',
|
||||
'chatstyle', 'chattitle', 'geolink', 'geolinkparams',
|
||||
'sendmessagekey', 'cron_key');
|
||||
'email',
|
||||
'title',
|
||||
'logo',
|
||||
'hosturl',
|
||||
'usernamepattern',
|
||||
'operator_pages_style',
|
||||
'chatstyle',
|
||||
'chattitle',
|
||||
'geolink',
|
||||
'geolinkparams',
|
||||
'sendmessagekey',
|
||||
'cron_key'
|
||||
);
|
||||
|
||||
if (Settings::get('enabletracking')) {
|
||||
$options[] = 'invitationstyle';
|
||||
@ -63,6 +74,11 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
|
||||
$params['chatstyle'] = $stylelist[0];
|
||||
}
|
||||
|
||||
$params['operator_pages_style'] = verifyparam("operator_pages_style", "/^\w+$/", $params['operator_pages_style']);
|
||||
if (!in_array($params['operator_pages_style'], $operator_pages_style_list)) {
|
||||
$params['operator_pages_style'] = $operator_pages_style_list[0];
|
||||
}
|
||||
|
||||
if (Settings::get('enabletracking')) {
|
||||
$params['invitationstyle'] = verifyparam("invitationstyle", "/^\w+$/", $params['invitationstyle']);
|
||||
if (!in_array($params['invitationstyle'], $invitationstylelist)) {
|
||||
@ -103,6 +119,8 @@ $page['formhosturl'] = topage($params['hosturl']);
|
||||
$page['formgeolink'] = topage($params['geolink']);
|
||||
$page['formgeolinkparams'] = topage($params['geolinkparams']);
|
||||
$page['formusernamepattern'] = topage($params['usernamepattern']);
|
||||
$page['formoperatorpagesstyle'] = $params['operator_pages_style'];
|
||||
$page['availableOperatorPagesStyles'] = $operator_pages_style_list;
|
||||
$page['formchatstyle'] = $params['chatstyle'];
|
||||
$page['formchattitle'] = topage($params['chattitle']);
|
||||
$page['formsendmessagekey'] = $params['sendmessagekey'];
|
||||
|
@ -52,7 +52,7 @@ $page['availablePreviews'] = $stylelist;
|
||||
$page['screenshotsList'] = $screenshots;
|
||||
|
||||
prepare_menu($operator);
|
||||
setup_settings_tabs(3);
|
||||
setup_settings_tabs(4);
|
||||
render_view('themes');
|
||||
|
||||
?>
|
@ -42,7 +42,6 @@ foreach ($default_extensions as $ext) {
|
||||
}
|
||||
|
||||
prepare_menu($operator);
|
||||
setup_settings_tabs(3);
|
||||
render_view('updates');
|
||||
|
||||
?>
|
@ -45,7 +45,7 @@ $style_config = get_dialogs_style_config(getchatstyle());
|
||||
$page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
|
||||
|
||||
// Load core style options
|
||||
$style_config = get_core_style_config();
|
||||
$style_config = get_core_style_config(get_operator_pages_style());
|
||||
$page['coreStyles.threadTag'] = $style_config['users']['thread_tag'];
|
||||
$page['coreStyles.visitorTag'] = $style_config['users']['visitor_tag'];
|
||||
$page['coreStyles.trackedUserWindowParams'] = $style_config['tracked']['user_window_params'];
|
||||
|
@ -23,3 +23,10 @@ window_params = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,
|
||||
[ban]
|
||||
; window_param use as param string in JavaScript window.open method
|
||||
window_params = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=720,height=480,resizable=1"
|
||||
|
||||
; Screenshots section describe all screenshots shiped with style
|
||||
; Params names should be equals to file names without extension. Pictures
|
||||
; extension should be '.png'
|
||||
; Params values should be equals to screenshot desription
|
||||
[screenshots]
|
||||
home = "Operator's home page"
|
BIN
src/mibew/styles/operator_pages/default/screenshots/home.png
Normal file
BIN
src/mibew/styles/operator_pages/default/screenshots/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/inc_menu.php');
|
||||
require_once(dirname(__FILE__).'/inc_tabbar.php');
|
||||
|
||||
$page['title'] = getlocal("page.preview.title");
|
||||
$page['menuid'] = "settings";
|
||||
|
||||
function tpl_content() { global $page, $mibewroot;
|
||||
?>
|
||||
|
||||
<?php echo getlocal("page.preview.intro") ?>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<form name="preview" method="get" action="<?php echo $mibewroot ?>/operator/operator_pages_themes.php">
|
||||
<div>
|
||||
<?php print_tabbar(); ?>
|
||||
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
|
||||
|
||||
<div class="fieldForm">
|
||||
<div class="field">
|
||||
<label for="preview" class="flabel"><?php echo getlocal("page.preview.choose") ?></label>
|
||||
<div class="fvaluenodesc">
|
||||
<select id="preview" 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>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach($page['screenshotsList'] as $screenshot) { ?>
|
||||
<div class="field">
|
||||
<div class="flabel">
|
||||
<?php echo($screenshot['description']); ?>
|
||||
</div>
|
||||
<div class="fvalueframe">
|
||||
<img class="screenshot" alt="<?php echo($screenshot['name']); ?>" src="<?php echo($screenshot['file']); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} /* content */
|
||||
|
||||
require_once(dirname(__FILE__).'/inc_main.php');
|
||||
?>
|
@ -122,6 +122,15 @@ require_once(dirname(__FILE__).'/inc_errors.php');
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="operator_pages_style" class="flabel"><?php echo getlocal('settings.operator_pages_style') ?></label>
|
||||
<div class="fvalue">
|
||||
<select id="chatstyle" name="operator_pages_style" ><?php foreach($page['availableOperatorPagesStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("operatorpagesstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
|
||||
</div>
|
||||
<label for="operator_pages_style" class="fdescr"> — <?php echo getlocal('settings.operator_pages_style.description') ?></label>
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="chatstyle" class="flabel"><?php echo getlocal('settings.chatstyle') ?></label>
|
||||
<div class="fvalue">
|
||||
|
Loading…
Reference in New Issue
Block a user