mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-08 00:34:42 +03:00
Port text button from legacy (see Issue #35)
This commit is contained in:
parent
e76ded074c
commit
88694193b4
@ -35,6 +35,8 @@ use Mibew\Style\InvitationStyle;
|
||||
* @param bool $mod_security add rule to remove protocol from document location
|
||||
* in generated javascript code
|
||||
* @param bool $operator_code add operator code to generated button code or not
|
||||
* @param bool $disable_invitation forcibly disable invitation regadless of
|
||||
* tracking settings
|
||||
*
|
||||
* @return string Generate chat button code
|
||||
*/
|
||||
@ -48,7 +50,8 @@ function generate_button(
|
||||
$show_host,
|
||||
$force_secure,
|
||||
$mod_security,
|
||||
$operator_code
|
||||
$operator_code,
|
||||
$disable_invitation
|
||||
) {
|
||||
$app_location = get_app_location($show_host, $force_secure);
|
||||
$link = $app_location . "/client.php";
|
||||
@ -92,7 +95,7 @@ function generate_button(
|
||||
|
||||
// Generate button
|
||||
$temp = get_popup($link, "$js_link", $inner, $title, "mibew", $popup_options);
|
||||
if (Settings::get('enabletracking')) {
|
||||
if (!$disable_invitation && Settings::get('enabletracking')) {
|
||||
$widget_data = array();
|
||||
|
||||
// Get actual invitation style instance
|
||||
|
@ -296,6 +296,8 @@ page.gen_button.modsecurity=Compatibility with mod_security (modsecurity.org), t
|
||||
page.gen_button.operator_code=operator code field
|
||||
page.gen_button.sample=Example
|
||||
page.gen_button.secure_links=Use secure links (https)
|
||||
page.gen_button.text_link=text link
|
||||
page.gen_button.text_link_text=Click to chat
|
||||
page.gen_button.title=Button HTML code generation
|
||||
page.group.create_new=Create new group here.
|
||||
page.group.duplicate_name=Please choose another name because a group with that name already exists.
|
||||
|
@ -59,7 +59,7 @@ $show_host = verify_param("hostname", "/^on$/", "") == "on";
|
||||
$force_secure = verify_param("secure", "/^on$/", "") == "on";
|
||||
$mod_security = verify_param("modsecurity", "/^on$/", "") == "on";
|
||||
|
||||
$code_type = verify_param("codetype", "/^(button|operator_code)$/", "button");
|
||||
$code_type = verify_param("codetype", "/^(button|operator_code|text_link)$/", "button");
|
||||
$operator_code = ($code_type == "operator_code");
|
||||
|
||||
$lang = verify_param("lang", "/^[\w-]{2,5}$/", "");
|
||||
@ -67,6 +67,15 @@ if (!$lang || !in_array($lang, $image_locales)) {
|
||||
$lang = in_array(CURRENT_LOCALE, $image_locales) ? CURRENT_LOCALE : $image_locales[0];
|
||||
}
|
||||
|
||||
if ($code_type == "text_link") {
|
||||
$disable_invitation = true;
|
||||
|
||||
$message = getlocal('page.gen_button.text_link_text');
|
||||
|
||||
}
|
||||
else {
|
||||
$disable_invitation = false;
|
||||
|
||||
$file = MIBEW_FS_ROOT . '/locales/${lang}/button/${image}_on.gif';
|
||||
$size = get_gifimage_size($file);
|
||||
|
||||
@ -75,6 +84,7 @@ if ($group_id) {
|
||||
$image_href .= "&group=$group_id";
|
||||
}
|
||||
$message = get_image($image_href, $size[0], $size[1]);
|
||||
}
|
||||
|
||||
$page['buttonCode'] = generate_button(
|
||||
"",
|
||||
@ -86,7 +96,8 @@ $page['buttonCode'] = generate_button(
|
||||
$show_host,
|
||||
$force_secure,
|
||||
$mod_security,
|
||||
$operator_code
|
||||
$operator_code,
|
||||
$disable_invitation
|
||||
);
|
||||
$page['availableImages'] = array_keys($image_locales_map);
|
||||
$page['availableLocales'] = $image_locales;
|
||||
@ -96,7 +107,8 @@ $page['groups'] = get_groups_list();
|
||||
|
||||
$page['availableCodeTypes'] = array(
|
||||
'button' => getlocal('page.gen_button.button'),
|
||||
'operator_code' => getlocal('page.gen_button.operator_code')
|
||||
'operator_code' => getlocal('page.gen_button.operator_code'),
|
||||
'text_link' => getlocal('page.gen_button.text_link')
|
||||
);
|
||||
|
||||
$page['formgroup'] = $group_id;
|
||||
@ -111,6 +123,7 @@ $page['formcodetype'] = $code_type;
|
||||
|
||||
$page['enabletracking'] = Settings::get('enabletracking');
|
||||
$page['operator_code'] = $operator_code;
|
||||
$page['generateButton'] = ($code_type == "button");
|
||||
|
||||
$page['title'] = getlocal("page.gen_button.title");
|
||||
$page['menuid'] = "getcode";
|
||||
|
@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<br clear="all"/>
|
||||
|
||||
{{#unless operator_code}}
|
||||
{{#if generateButton}}
|
||||
<div class="fieldinrow">
|
||||
<label for="i" class="flabel">{{l10n "page.gen_button.choose_image"}}</label>
|
||||
<div class="fvaluenodesc">
|
||||
@ -78,7 +78,7 @@
|
||||
{{/if}}
|
||||
|
||||
<br clear="all"/>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
<div class="fieldinrow">
|
||||
<label for="group" class="flabel">{{l10n "page.gen_button.choose_group"}}</label>
|
||||
|
Loading…
Reference in New Issue
Block a user