Browse Source

инициализация модуля

master
root 8 years ago
commit
5bbe30bea5
  1. 1421
      contactsnew/class.contactsnew.php
  2. 454
      contactsnew/demo.php
  3. 8
      contactsnew/index.php
  4. 11
      contactsnew/js/jquery.form.min.js
  5. 8
      contactsnew/lang/index.php
  6. 166
      contactsnew/lang/ru.txt
  7. 155
      contactsnew/module.php
  8. 133
      contactsnew/sql.php
  9. 265
      contactsnew/templates/dialog.tpl
  10. 801
      contactsnew/templates/form_edit.tpl
  11. 398
      contactsnew/templates/form_fields.tpl
  12. 98
      contactsnew/templates/forms.tpl
  13. 129
      contactsnew/templates/history.tpl
  14. 8
      contactsnew/templates/index.php

1421
contactsnew/class.contactsnew.php

File diff suppressed because it is too large Load Diff

454
contactsnew/demo.php

@ -0,0 +1,454 @@
<?php
$form_tpl = array(
'noajax' =>
'[tag:hide:2:У вас нет прав для заполнения данной формы!]
<div id=\\"[tag:formalias]\\">
<form method=\\"post\\" enctype=\\"multipart/form-data\\" class=\\"form-horizontal\\" role=\\"form\\" action=\\"\\">
[tag:if_form_invalid]
<div class=\\"alert alert-danger alert-dismissable\\">
При заполнении формы возникли ошибки!
<button type=\\"button\\" class=\\"close\\" data-dismiss=\\"alert\\" aria-hidden=\\"true\\">&times;</button>
</div>
[/tag:if_form_invalid]
[tag:fld:email]
[tag:fld:subject]
[tag:fld:receivers]
[tag:fld:6]
[tag:fld:7]
[tag:fld:8]
[tag:fld:9]
[tag:fld:10]
[tag:fld:11]
[tag:fld:copy]
[tag:fld:captcha]
<div class=\\"form-group\\">
<div class=\\"col-sm-offset-4 col-sm-4\\">
<button type=\\"submit\\" class=\\"btn btn-primary\\">Отправить</button>
</div>
</div>
</form>
[tag:if_form_invalid]
<script>
function form_popover () {
$(\\\'#[tag:formalias] .form-control.invalid\\\').each(function(index, element) {
$(element).popover(\\\'show\\\')
});
}
$(function() {
form_popover();
});
</script>
[/tag:if_form_invalid]
</div>
[/tag:hide]',
'ajax' => '[tag:hide:2:У вас нет прав для заполнения данной формы!]
<div id=\\"[tag:formalias]\\">
<form method=\\"post\\" enctype=\\"multipart/form-data\\" class=\\"form-horizontal\\" role=\\"form\\" action=\\"\\">
<div class=\\"alert alert-warning alert-dismissable\\">
Если форма не работает, убедитесь, что скрипт jquery.form.min.js подключен к странице
<button type=\\"button\\" class=\\"close\\" data-dismiss=\\"alert\\" aria-hidden=\\"true\\">&times;</button>
</div>
[tag:if_form_invalid]
<div class=\\"alert alert-danger alert-dismissable\\">
При заполнении формы возникли ошибки!
<button type=\\"button\\" class=\\"close\\" data-dismiss=\\"alert\\" aria-hidden=\\"true\\">&times;</button>
</div>
[/tag:if_form_invalid]
[tag:fld:email]
[tag:fld:subject]
[tag:fld:receivers]
[tag:fld:6]
[tag:fld:7]
[tag:fld:8]
[tag:fld:9]
[tag:fld:10]
[tag:fld:11]
[tag:fld:copy]
[tag:fld:captcha]
<div class=\\"form-group\\">
<div class=\\"col-sm-offset-4 col-sm-4\\">
<button type=\\"submit\\" class=\\"btn btn-primary\\">Отправить</button>
</div>
</div>
</form>
<script>
function form_popover (action) {
var _action = (action == undefined || !action) ? \\\'show\\\' : action;
$(\\\'#[tag:formalias] .form-control.invalid\\\').each(function(index, element) {
$(element).popover(_action);
if (_action == \\\'hide\\\') $(element).removeClass(\\\'invalid\\\');
});
}
$(document).on(\\\'submit\\\',\\\'#[tag:formalias] form\\\',function (e) {
e.preventDefault();
var form = $(this);
form.ajaxSubmit({
url: \\\'[tag:path]index.php?module=contactsnew\\\',
data: {
alias_id: \\\'[tag:formalias]\\\'
},
beforeSubmit: function () {
$(\\\'button[type=submit]\\\',form).prop(\\\'disabled\\\',true);
form_popover(\\\'hide\\\');
form.css(\\\'opacity\\\',0.3);
},
success: function (data) {
form.after(data).remove();
form_popover(\\\'show\\\');
}
});
return false;
});
</script>
</div>
[/tag:hide]',
'ajax_o' =>
'[tag:hide:2:У вас нет прав для заполнения данной формы!]
<div id=\\"[tag:formalias]\\">
<form method=\\"post\\" enctype=\\"multipart/form-data\\" class=\\"form-horizontal\\" role=\\"form\\" action=\\"\\">
<div class=\\"alert alert-warning alert-dismissable\\">
Если форма не работает, убедитесь, что скрипт jquery.form.min.js подключен к странице
<button type=\\"button\\" class=\\"close\\" data-dismiss=\\"alert\\" aria-hidden=\\"true\\">&times;</button>
</div>
[tag:if_form_invalid]
<div class=\\"alert alert-danger alert-dismissable\\">
При заполнении формы возникли ошибки!
<button type=\\"button\\" class=\\"close\\" data-dismiss=\\"alert\\" aria-hidden=\\"true\\">&times;</button>
</div>
[/tag:if_form_invalid]
[tag:fld:email]
[tag:fld:subject]
[tag:fld:receivers]
[tag:fld:6]
[tag:fld:7]
[tag:fld:8]
[tag:fld:9]
[tag:fld:10]
[tag:fld:11]
[tag:fld:copy]
<div class=\\"form-group\\">
<div class=\\"col-sm-offset-4 col-sm-4\\">
<button type=\\"submit\\" class=\\"btn btn-primary\\">Отправить</button>
</div>
</div>
</form>
<script>
$(document).on(\\\'submit\\\',\\\'#[tag:formalias] form\\\',function (e) {
e.preventDefault();
var form = $(this);
form.ajaxSubmit({
url: \\\'[tag:path]index.php?module=contactsnew\\\',
data: {
alias_id: \\\'[tag:formalias]\\\',
action: \\\'validate\\\'
},
dataType: \\\'json\\\',
beforeSubmit: function () {
$(\\\'button[type=submit]\\\',form).prop(\\\'disabled\\\',true);
//form.css(\\\'opacity\\\',0.3);
},
success: function (data) {
alert(\\\'Данные получены и отправлены в консоль console.log(data). Если у вас Chrome, нажмите F12.\\\');
console.log(data);
}
});
return false;
});
</script>
</div>
[/tag:hide]'
);
$demo = array(
'mail_set' => array(
'from_name' => '[tag:if_user]Администратор сайта [tag:sitename][/tag:if_user]
[tag:if_admin][tag:uname] ([tag:ulogin])[/tag:if_admin]',
'from_email' => '[tag:if_user]admin@form.ru[/tag:if_user]
[tag:if_admin][tag:fld:email][/tag:if_admin]',
'subject_tpl' => '[tag:if_user]Вы заполнили форму "[tag:fld:subject]" на сайте [tag:sitename][/tag:if_user]
[tag:if_admin]Заполнена форма: [tag:formtitle] ([tag:formalias])[/tag:if_admin]',
'receivers' => array(
array(
'email' => 'form@form.ru',
'name' => 'form'
)
),
'format' => 'text',
),
'rubheader' => '<!--
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>' . ($_REQUEST['demo'] != 'noajax' ? '
<script src="http://malsup.github.io/min/jquery.form.min.js"></script>' : '') . '
-->',
'form_tpl' => $form_tpl[$_REQUEST['demo']],
'mail_tpl' => '[tag:if_user]
Здравствуйте, [tag:uname]!
Вы заполнили форму на нашем сайте и ввели следующие данные:
[tag:easymail]
В ближайшее время администрация рассмотрит вашу заявку
--
С уважением, Администрация
[/tag:if_user]
[tag:if_admin]
Здравствуйте!
Пользователь [tag:uname] ([tag:ulogin]) заполнил форму \\\'[tag:formtitle]\\\' ([tag:formalias]) и ожидает ответа.
Введённые данные:
[tag:easymail]
[/tag:if_admin]',
'finish_tpl' => '<div class="alert alert-success">
Форма успешно отправлена!
</div>',
'code_onsubmit' => '',
'code_onvalidate' => '',
'code_onsend' => '',
'fields' => array(
1 => array(
'new' => true,
'form_id' => $fid,
'title' => 'email',
'active' => 1,
'type' => 'input',
'main' => 1,
'setting' => 'FILTER_VALIDATE_EMAIL',
'required' => 1,
'defaultval' => '[tag:uemail]',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_invalid]invalid[/tag:if_invalid]" placeholder="[tag:title]" data-placement="right" data-content="Неверный email!" data-container="body" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_valid]has-feedback has-success[/tag:if_valid] [tag:if_invalid]has-feedback has-error[/tag:if_invalid]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title] *
</label>
<div class="col-sm-4">
[tag:fld]
[tag:if_valid]<span class="glyphicon glyphicon-ok form-control-feedback"></span>[/tag:if_valid]
[tag:if_invalid]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_invalid]
</div>
</div>'
),
2 => array(
'new' => true,
'form_id' => $fid,
'title' => 'subject',
'active' => 1,
'type' => 'input',
'main' => 1,
'setting' => '',
'required' => 1,
'defaultval' => 'Тема по умолчанию',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]" data-placement="right" data-content="Укажите тему!" data-container="body" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_notempty]has-feedback has-success[/tag:if_notempty] [tag:if_empty]has-feedback has-error[/tag:if_empty]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title] *
</label>
<div class="col-sm-4">
[tag:fld]
[tag:if_notempty]<span class="glyphicon glyphicon-ok form-control-feedback"></span>[/tag:if_notempty]
[tag:if_empty]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_empty]
</div>
</div>'
),
3 => array(
'new' => true,
'form_id' => $fid,
'title' => 'receivers',
'active' => 1,
'type' => 'select',
'main' => 1,
'setting' => array(
0 => array(
'email' => 'sales@form.ru',
'name' => 'Отдел продаж'
),
1 => array(
'email' => 'support@form.ru',
'name' => 'Служба поддержки'
)
),
'required' => 0,
'defaultval' => 0,
'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"',
'tpl' => '<div class="form-group">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title]
</label>
<div class="col-sm-4">
[tag:fld]
</div>
</div>'
),
4 => array(
'new' => true,
'form_id' => $fid,
'title' => 'copy',
'active' => 1,
'type' => 'checkbox',
'main' => 1,
'setting' => '',
'required' => 0,
'defaultval' => 1,
'attributes' => '',
'tpl' => '<div class="form-group">
<div class="col-sm-offset-4 col-sm-4">
<div class="checkbox">
<label>
[tag:fld] [tag:title]
</label>
</div>
</div>
</div>'
),
5 => array(
'new' => true,
'form_id' => $fid,
'title' => 'captcha',
'active' => 1,
'type' => 'input',
'main' => 1,
'setting' => '',
'required' => 1,
'defaultval' => '',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_invalid]invalid[/tag:if_invalid]" placeholder="[tag:title]" data-placement="right" data-content="Неверный код!" data-container="body" autocomplete="off" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_invalid]has-feedback has-error[/tag:if_invalid]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
<img src="[tag:path][tag:captcha]" alt="Капча">
</label>
<div class="col-sm-4">
[tag:fld]
[tag:if_invalid]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_invalid]
</div>
</div>'
),
6 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Выбор',
'active' => 1,
'type' => 'select',
'main' => 0,
'setting' => array('выберите','а','б','в'),
'required' => 1,
'defaultval' => 0,
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]" data-placement="right" data-content="Выберите что-нибудь!" data-container="body" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_notempty]has-success[/tag:if_notempty] [tag:if_empty]has-error[/tag:if_empty]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title] *
</label>
<div class="col-sm-4">
[tag:fld]
</div>
</div>'
),
7 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Текстовое поле',
'active' => 1,
'type' => 'textarea',
'main' => 0,
'setting' => '',
'required' => 0,
'defaultval' => '',
'attributes' => 'id="fld[[tag:id]]" class="form-control" placeholder="[tag:title]"',
'tpl' => '<div class="form-group [tag:if_notempty]has-feedback has-success[/tag:if_notempty] [tag:if_empty]has-feedback has-error[/tag:if_empty]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title]
</label>
<div class="col-sm-4">
[tag:fld]
[tag:if_notempty]<span class="glyphicon glyphicon-ok form-control-feedback"></span>[/tag:if_notempty]
[tag:if_empty]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_empty]
</div>
</div>'
),
8 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Мульти',
'active' => 1,
'type' => 'multiselect',
'main' => 0,
'setting' => array(1,2,3,4,5),
'required' => 1,
'defaultval' => array(0,3),
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]" data-placement="right" data-content="Выберите что-нибудь!" data-container="body" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_notempty]has-success[/tag:if_notempty] [tag:if_empty]has-error[/tag:if_empty]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title] *
</label>
<div class="col-sm-4">
[tag:fld]
</div>
</div>'
),
9 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Файл (до 1мб)',
'active' => 1,
'type' => 'file',
'main' => 0,
'setting' => 1,
'required' => 0,
'defaultval' => '',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_invalid]invalid[/tag:if_invalid] [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]" data-placement="right" data-content="[tag:if_invalid]Слишком большой файл![/tag:if_invalid][tag:if_empty]Отсутствует файл![/tag:if_empty]" data-container="body" data-trigger="manual"',
'tpl' => '<div class="form-group [tag:if_notempty][tag:if_valid]has-feedback has-success[/tag:if_valid][/tag:if_notempty] [tag:if_invalid]has-feedback has-error[/tag:if_invalid] [tag:if_empty]has-feedback has-error[/tag:if_empty]">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title]
</label>
<div class="col-sm-4">
[tag:fld]
[tag:if_notempty][tag:if_valid]<span class="glyphicon glyphicon-ok form-control-feedback"></span>[/tag:if_valid][/tag:if_notempty]
[tag:if_invalid]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_invalid]
[tag:if_empty]<span class="glyphicon glyphicon-remove form-control-feedback"></span>[/tag:if_empty]
</div>
</div>'
),
10 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Документ',
'active' => 1,
'type' => 'doc',
'main' => 0,
'setting' => array(1),
'required' => 0,
'defaultval' => '',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]"',
'tpl' => '<div class="form-group">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title]
</label>
<div class="col-sm-4">
[tag:fld]
</div>
</div>'
),
11 => array(
'new' => true,
'form_id' => $fid,
'title' => 'Мультидокумент',
'active' => 1,
'type' => 'multidoc',
'main' => 0,
'setting' => array(1,2),
'required' => 0,
'defaultval' => '',
'attributes' => 'id="fld[[tag:id]]" class="form-control [tag:if_empty]invalid[/tag:if_empty]" placeholder="[tag:title]"',
'tpl' => '<div class="form-group">
<label for="fld[[tag:id]]" class="col-sm-4 control-label">
[tag:title]
</label>
<div class="col-sm-4">
[tag:fld]
</div>
</div>'
)
)
);

8
contactsnew/index.php

@ -0,0 +1,8 @@
<?php
/**
* Файл-заглушка, предназначенный для запрета показа списка файлов в текущей директории,
* если через адресную строку браузера было прямое общращение к данной директории.
*/
header('Location:/');
exit;
?>

11
contactsnew/js/jquery.form.min.js vendored

File diff suppressed because one or more lines are too long

8
contactsnew/lang/index.php

@ -0,0 +1,8 @@
<?php
/**
* Файл-заглушка, предназначенный для запрета показа списка файлов в текущей директории,
* если через адресную строку браузера было прямое общращение к данной директории.
*/
header('Location:/');
exit;
?>

166
contactsnew/lang/ru.txt

@ -0,0 +1,166 @@
contacts = "Контакты New"
mod_info = "В данном разделе приведен список всех контактных форм. Вы можете, добавить новую форму или отредактировать существующую."
forms = "Список форм"
form = "Форма"
noforms = "В модуле пока нет ни одной контактной формы"
form_new = "Создать форму"
form_deleting = "Вы уверены, что хотите удалить форму?"
form_creating = "Создание новой формы"
form_notfound = "указанная форма не найдена"
form_editing = "Редактирование формы"
main_sets = "Основные параметры"
title = "Название"
alias = "Алиас"
protection = "Защита от повторной отправки"
protect_i = "Рекомендуется включать для форм без Ajax.&lt;br/&gt;&lt;br/&gt;Если защита включена, на финишной странице (после успешной отправки формы) при обновлении страницы пользователь не увидит сообщения &quot;Подтвердите повторную отправку данных...&quot;. Вместо этого загрузится заново чистая форма."
demo = "Создать пример формы"
demo_noajax = "без Ajax"
demo_ajax = "Ajax, сервер возвращает код формы"
demo_ajax_o = "Ajax, сервер возвращает результат валидации"
alias_i = "Опционально. Алиас формы позволяет использовать легко запоминающийся тег [mod_contact:alias] вместо [mod_contact:id]. Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание, иметь длину не более 20 символов и быть уникальным в пределах модуля"
alias_accept = "Этот алиас можно использовать"
alias_er_syn = "Неверный алиас!<br> Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание и иметь длину не более 20 символов"
alias_er_exists = "Неверный алиас!<br> Данный алиас уже привязан к другой контактной форме"
recs = "Получатели"
name = "Имя"
fields_sets = "Настройки полей"
active_i = "Активировать поле (если чекбокс пустой, тег в шаблоне будет заменён на пустую строку)"
type = "Тип"
doc = "Документ"
multidoc = "Документ (multi)"
other_input = "Другой input"
other_input_i = "Аттрибут type"
pattern_i = "Шаблон для preg_match<br/> <em>Пример:</em> <strong>/^[A-Za-z0-9]+$/ie</strong><br/><br/> Либо фильтр для filter_var<br/> <em>Пример:</em> <strong>FILTER_VALIDATE_EMAIL</strong>"
pattern = "Валидация"
defaultval = "По умолчанию"
sets = "Параметры"
attributes = "Аттрибуты тега поля"
field_add = "Добавить поле"
form_tpl = "Шаблон формы"
mail_tpl = "Шаблон письма"
finish_tpl = "Шаблон страницы после отправки формы"
conditions = "Условия"
rubheader = "Скрипты и стили, необходимые для оформления и функционирования формы"
rubheader_info = "Избегайте дублирования скриптов в модуле и шаблоне"
tag = "Тег"
field_creating = "Добавление поля..."
field_new_error = "Укажите название поля!"
type_i = "Для <strong>input</strong> в аттрибутах можно указать свой <strong>type</strong> (по умолчанию подставится <strong>text</strong>)"
fld_tpl_toggle = "Показать/свернуть шаблон вывода поля"
field_tpl = "Шаблон поля"
fld_del = "Вы уверены, что хотите удалить это поле?"
fld_deleting = "Удаление поля..."
required = "Обязательное поле"
setting_empty = "Сначала настройте опции для выбора (слева)"
yes = "да"
no = "нет"
fld_i = "Поле работает только если его тег вставлен в шаблон и слева стоит галочка активации"
copy_fld_i = "<strong>Отправка копии </strong> будет выполнена, даже если в значении по умолчанию стоит галка, а тег в шаблон не вставлен / поле не активировано"
select_req_i = "Селект будет считаться не заполненным, если выбран первый вариант"
file_size = "Макс. размер, мб"
file_size2 = "Ограничение размера файла, мб"
create = "Создать"
edit = "Редактировать"
copy = "Копировать"
delete = "Удалить"
actions = "Действия"
saved = "Сохранено"
notsaved = "Во время сохранения произошла ошибка"
created = "Форма успешно создана"
copied = "Форма успешно скопирована и сохранена<br>Отредактируйте название и алиас"
deleting = "Удаление..."
add_refresh = "Добавить и обновить"
save = "Сохранить"
return_to_forms = "Вернуться к списку контактных форм"
refresh = "Обновить"
mail_set = "Настройки письма"
format = "Формат"
text = "Текст"
from_email = "Email отправителя"
from_name = "Имя отправителя"
recs_main = "Главные получатели"
recs_main_i = "Эти адресаты получат письмо в любом случае"
subject_tpl = "Шаблон темы"
email_accept = "Правильный Email"
email_error = "Неверный синтаксис Email-а!"
tag_fld = "Тег поля, поле подставляется с использованием своего шаблона"
tag_fld_mail = "Значение поля, введённое пользователем"
tag_fld_tpl = "Тег поля, поле подставляется с подстановкой аттрибутов"
tag_attr = "Вставить основные аттрибуты"
tag_id = "Id поля"
tag_title = "Тег названия поля"
tag_valid = "Выведет контент, если поле соответствует заданному шаблону"
tag_invalid = "Выведет контент, если поле не соответствует заданному шаблону"
tag_nempty = "Выведет контент, если поле помечено как обязательное и пользователь ввёл данные"
tag_empty = "Выведет контент, если поле помечено как обязательное и пользователь не ввёл данные"
tag_path = "Корневой путь установки"
tag_media = "Путь до папки с шаблоном<br><br><i>Пример:</i> [tag:mediapath]images/logo.gif"
tag_css = "Сжимает несколько css-файлов в один. Возвращает путь.<br><b>FFF</b> - имена файлов через запятую<br><b>P</b> - путь к папке с файлами, не обязательно. По умолчанию - [tag:mediapath]css/<br><br><i>Пример:</i> href=&quot;[tag:css:reset.css,style.css]&quot;"
tag_js = "Сжимает несколько js-файлов в один. Возвращает путь.<br><b>FFF</b> - имена файлов через запятую<br><b>P</b> - путь к папке с файлами, не обязательно. По умолчанию - [tag:mediapath]js/<br><br><i>Пример:</i> href=&quot;[tag:js:common.js,main.js]&quot;"
tag_formtitle = "Название формы"
tag_formalias = "Алиас формы (или id, если алиас не назначен)"
tag_url = "URL текущей страницы"
tag_docid = "ID текущего документа"
tag_hide = "Тег, позволяющий скрыть контент для определенных групп пользователей<br><br><strong>Х</strong> - номер группы<br><strong>TEXT</strong> - текст, если доступ запрещён<br><br><em>Пример:</em> [tag:hide:2:Эта форма не для вас!][/tag:hide]"
tag_uemail = "Email пользователя (на основе данных из профиля, а не формы!)"
tag_uname = "И. Фамилия пользователя (на основе данных из профиля)"
tag_ufname = "Имя пользователя (на основе данных из профиля)"
tag_ulname = "Фамилия пользователя (на основе данных из профиля)"
tag_ulogin = "Логин пользователя (на основе данных из профиля)"
tag_if_fld = "Условие на значение поля. В теге используйте стандартные конструкции сравнения PHP/JS<br><br><em>Пример:</em><br>[tag:if_fld:15 == '1']<br>...<br>[tag:elseif_fld:15 > '2']<br>...<br>[tag:else_fld]<br>...<br>[/tag:if_fld]"
tag_f_valid = "Выведет контент, если все поля формы прошли валидацию"
tag_f_invalid = "Выведет контент, если хотя бы одно поле формы не прошло валидацию"
tag_easymail = "Быстро генерирует список всех значений полей, участвующих в шаблоне формы (вместо того, чтобы прописывать все теги вручную)"
tag_if_user = "Выведет контент в письме пользователю, заполнившему форму"
tag_if_admin = "Выведет контент в письме получателям-админам (&quot;главным получателям&quot; или адресату из поля &quot;получатель на выбор&quot;)"
tag_fld_subject = "Значение поля <strong>Тема</strong>"
tag_fld_email = "Значение поля <strong>Email</strong>"
tag_sitename = "Название сайта"
tag_sitehost = "Адрес сайта"
info_php_tags = "Доступен php и теги"
code = "Исполняемый код"
code_info = "Данные формы (валидация, шаблоны, получатели и т.д.) хранятся в переменной класса $this->form."
code_onsubmit = "Код, исполняемый сразу после отправки формы (до валидации)"
code_onvalidate = "Код, исполняемый после валидации формы"
code_onsend = "Код, исполняемый после отправки писем"
mfld_email = "Email"
mfld_subject = "Тема"
mfld_receivers = "Получатель на выбор"
mfld_captcha = "Капча"
mfld_copy = "Отправка копии"
tag_mail_empty = "не заполнено"
history = "История"
date = "Дата"
author = "Автор"
status = "Статус"
stat_new = "Новое"
list_new = "Новых"
stat_viewed = "Просмотрено"
list_viewed = "Просмотренных"
stat_replied = "Отвечено"
list_replied = "Отвеченных"
request = "Обращение"
response = "Ответ"
responses = "Ответы"
write_response = "Написать ответ"
body = "Тело письма"
save_draft = "Сохранить черновик"
send = "Отправить ответ"
return_dialogs = "Вернуться к списку обращений"
profile_look = "Перейти к профилю"
write_email = "Написать письмо"
from = "от"
look = "Посмотреть"
set_replied = "Пометить как отвеченное"
marked_replied = "Было отмечено как отвеченное"
attach = "Вложения"
respose_sent = "Ответ успешно отправлен"

155
contactsnew/module.php

@ -0,0 +1,155 @@
<?php
/**
* Модуль "Контакты New"
*
* @package AVE.cms
* @subpackage module: ContactsNew
* @since 1.4
* @author vudaltsov
* @filesource
*/
if(!defined('BASE_DIR')) exit;
if (defined('ACP'))
{
$modul['ModuleName'] = 'Контакты New';
$modul['ModuleSysName'] = 'contactsnew';
$modul['ModuleVersion'] = '1.2';
$modul['ModuleDescription'] = 'Данный модуль предназначен для создания веб-форм (например, обратной связи или простейшего оформления заказа), которые могут состоять из любого набора полей. Для вывода в публичной части сайта используйте тег <strong>[mod_contactsnew:XXX]</strong>, где XXX - это id или алиас формы.';
$modul['ModuleAutor'] = 'vudaltsov UPD Repellent';
$modul['ModuleCopyright'] = '&copy; 2007-2016 AVE.CMS Team';
$modul['ModuleIsFunction'] = 1;
$modul['ModuleAdminEdit'] = 1;
$modul['ModuleFunction'] = 'mod_contactsnew';
$modul['ModuleTag'] = '[mod_contactsnew:alias/id:email]';
$modul['ModuleTagLink'] = null;
$modul['ModuleAveTag'] = '#\\\[mod_contactsnew:([A-Za-z0-9_]{1,20})]#';
$modul['ModulePHPTag'] = "<?php mod_contactsnew(''$1''); ?>";
}
/**
* Тег
*/
function mod_contactsnew($alias_id)
{
global $AVE_Template;
require_once(BASE_DIR . '/modules/contactsnew/class.contactsnew.php');
$contactsnew = new ContactsNew;
$contactsnew->tpl_dir = BASE_DIR . '/modules/contactsnew/templates/';
$lang_file = BASE_DIR . '/modules/contactsnew/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file);
echo $contactsnew->form_display($alias_id);
}
/**
* AJAX-методы
*/
if (!defined('ACP') && isset($_REQUEST['module']) && $_REQUEST['module'] == 'contactsnew')
{
global $AVE_Template;
$alias_id = $_REQUEST['alias_id'];
require_once(BASE_DIR . '/modules/contactsnew/class.contactsnew.php');
$contactsnew = new ContactsNew;
$contactsnew->tpl_dir = BASE_DIR . '/modules/contactsnew/templates/';
$lang_file = BASE_DIR . '/modules/contactsnew/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file);
switch($_REQUEST['action'])
{
case '':
case 'full':
exit ($contactsnew->form_display($alias_id));
case 'validate':
$contactsnew->form_display($alias_id);
exit (json_encode($contactsnew->form['ajax']));
}
}
/**
* Админка
*/
if (defined('ACP') && isset($_REQUEST['mod']) && $_REQUEST['mod'] == 'contactsnew' && !empty($_REQUEST['moduleaction']))
{
$fid = !empty($_REQUEST['fid']) ? (int)$_REQUEST['fid'] : 0;
require_once(BASE_DIR . '/modules/contactsnew/class.contactsnew.php');
$contactsnew = new ContactsNew;
$contactsnew->tpl_dir = BASE_DIR . '/modules/contactsnew/templates/';
$lang_file = BASE_DIR . '/modules/contactsnew/lang/' . $_SESSION['admin_language'] . '.txt';
$AVE_Template->config_load($lang_file);
// создаём переменные с версией движка
$ave14 = ((float)str_replace(',','.',APP_VERSION) < 1.5);
$AVE_Template->assign('ave14', $ave14);
$AVE_Template->assign('ave15', !$ave14);
switch($_REQUEST['moduleaction'])
{
case '1':
$contactsnew->forms_list();
break;
case 'form_edit':
$response = $contactsnew->form_edit($fid);
break;
case 'form_save':
$response = $contactsnew->form_save($fid);
// если передан запрос на обновление полей, передаём tpl
if (isset($_REQUEST['fields_reload']) && $_REQUEST['fields_reload'] == 1)
{
exit ($contactsnew->form_fields_fetch());
}
break;
case 'form_del':
$contactsnew->form_del($fid);
header('Location: index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=1&cp=' . SESSION);
exit;
case 'form_copy':
$fid_new = $contactsnew->form_copy($fid);
$_SESSION['module_contactsnew_admin'][$fid_new]['edit_alert'] = array('text' => 'copied', 'theme' => 'accept');
header('Location: index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=form_edit&fid=' . $fid_new . '&cp=' . SESSION);
exit;
case 'email_validate':
$response = (int)$contactsnew->_email_validate($_REQUEST['email']);
break;
case 'alias_validate':
$response = $contactsnew->_alias_validate($_REQUEST['alias'],$fid);
$response = ($response === 'syn') ? 'syn' : (int)$response;
break;
case 'history_list':
$contactsnew->history_list($fid);
break;
case 'history_dialog':
$hid = !empty($_REQUEST['hid']) ? (int)$_REQUEST['hid'] : 0;
$contactsnew->history_dialog($hid);
break;
case 'history_dialog_submit':
$hid = !empty($_REQUEST['hid']) ? (int)$_REQUEST['hid'] : 0;
$contactsnew->history_dialog_submit($hid);
break;
case 'dialog_status':
$hid = !empty($_REQUEST['hid']) ? (int)$_REQUEST['hid'] : 0;
$contactsnew->dialog_status($hid);
break;
}
if ($_REQUEST['ajax']) exit((string)$response);
}
?>

133
contactsnew/sql.php

@ -0,0 +1,133 @@
<?php
/**
* Модуль "Контакты New"
*
* @package AVE.cms
* @subpackage module: ContactsNew
* @since 1.4
* @author vudaltsov
* @filesource
*/
$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();
// Удаление
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_contactsnew_forms;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_contactsnew_fields;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_contactsnew_history;";
// Установка
$module_sql_install[] = "
CREATE TABLE IF NOT EXISTS `CPPREFIX_module_contactsnew_forms` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`alias` varchar(20) NOT NULL,
`title` varchar(255) NOT NULL,
`protection` enum('0','1') NOT NULL DEFAULT '1',
`rubheader` text NOT NULL,
`form_tpl` text NOT NULL,
`mail_set` text NOT NULL,
`mail_tpl` text NOT NULL,
`finish_tpl` text NOT NULL,
`code_onsubmit` text NOT NULL,
`code_onvalidate` text NOT NULL,
`code_onsend` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 AUTO_INCREMENT=1;
";
$module_sql_install[] = "
CREATE TABLE IF NOT EXISTS `CPPREFIX_module_contactsnew_fields` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`form_id` int(10) NOT NULL,
`active` enum('0','1') NOT NULL DEFAULT '1',
`title` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`main` enum('0','1') NOT NULL DEFAULT '0',
`setting` text NOT NULL,
`required` enum('0','1') NOT NULL DEFAULT '0',
`defaultval` varchar(255) NOT NULL,
`attributes` text NOT NULL,
`tpl` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 AUTO_INCREMENT=1;
";
$module_sql_install[] = "
CREATE TABLE IF NOT EXISTS `CPPREFIX_module_contactsnew_history` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`form_id` int(10) NOT NULL,
`email` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`status` enum('new','viewed','replied') NOT NULL DEFAULT 'new',
`date` int(10) NOT NULL,
`dialog` longtext NOT NULL,
`postdata` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 AUTO_INCREMENT=1;
";
// Обновление
$module_sql_update[] = "
UPDATE `CPPREFIX_module`
SET
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
ModuleVersion = '" . $modul['ModuleVersion'] . "'
WHERE
ModuleSysName = '" . $modul['ModuleSysName'] . "'
LIMIT 1;
";
// beta 3
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_forms`
ADD `code_onsubmit` text NOT NULL
AFTER `finish_tpl`";
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_forms`
ADD `code_onvalidate` text NOT NULL
AFTER `code_onsubmit`";
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_forms`
ADD `code_onsend` text NOT NULL
AFTER `code_onvalidate`";
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_forms`
DROP INDEX `alias`";
// beta 8
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_fields`
ADD `active` enum('0','1') NOT NULL DEFAULT '1'
AFTER `form_id`";
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_fields`
DROP `position`";
// v1.1 beta 1
$module_sql_update[] = "
CREATE TABLE IF NOT EXISTS `CPPREFIX_module_contactsnew_history` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`form_id` int(10) NOT NULL,
`email` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`status` enum('new','viewed','replied') NOT NULL DEFAULT 'new',
`date` int(10) NOT NULL,
`dialog` longtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 AUTO_INCREMENT=1;
";
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_forms`
ADD `protection` enum('0','1') NOT NULL DEFAULT '1'
AFTER `title`";
// v1.1 beta 2
$module_sql_update[] = "
ALTER TABLE `CPPREFIX_module_contactsnew_history`
ADD `postdata` text NOT NULL
AFTER `dialog`";
?>

265
contactsnew/templates/dialog.tpl

@ -0,0 +1,265 @@
<!-- Включаем CodeMirror разными способами в зависимости от версии движка -->
{if $ave15}
{include file="$codemirror_connect"}
{else}
<link rel="stylesheet" href="{$ABS_PATH}admin/codemirror/lib/codemirror.css">
{literal}
<style type="text/css">
.activeline {
background: #e8f2ff !important;
}
.CodeMirror-scroll {
height: 450px;
}
.smallBtn {
padding: 4px 7px !important;
}
</style>
{/literal}
<script src="{$ABS_PATH}admin/codemirror/lib/codemirror.js" type="text/javascript"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/xml/xml.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/javascript/javascript.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/css/css.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/clike/clike.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/php/php.js"></script>
{/if}
<!-- /Включаем CodeMirror -->
{literal}
<style>
#forms input {
box-sizing:border-box;
}
</style>
{/literal}
<script type="text/javascript">
// назначаем языковые переменные (так удобнее работать со smarty)
$fid = parseInt('{$fid}');
$sess = '{$sess}';
$smarty = new Array;
$smarty['start_alert'] = '{$alert.text}';
$smarty['start_alert_theme'] = '{$alert.theme}';
</script>
<div class="title">
<h5>{#contacts#}</h5>
</div>
<div class="widget" style="margin-top:0">
<div class="body">{#mod_info#}</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}" class="toprightDir"></a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#contacts#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#forms#}</a></li>
<li><strong class="code"><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_edit&amp;fid={$fid}&amp;cp={$sess}" {if $ave14}style="float:none; display:inline;"{/if}>{$form.title|escape}</a></strong></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_list&amp;fid={$fid}&amp;cp={$sess}">{#history#}</a></li>
<li><strong class="code"><em style="font-weight:lighter;">{$date|date_format:$TIME_FORMAT|pretty_date}</em> | {$subject|escape}</strong></li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#history#}: {$subject}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm" id="forms">
<colgroup>
<col width="250">
<col>
</colgroup>
<tbody>
<tr>
<td colspan="2"><h6>{#request#}</h6></td>
</tr>
<tr>
{assign var=item value=$dialog.request}
<td valign="middle">
{if $item.user_name}
[<a target="_blank" href="index.php?do=user&amp;action=edit&Id={$item.user_id}&cp={$sess}" class="toprightDir" title="{#profile_look#}">{$item.user_name}</a>] {if $item.firstname || $item.lastname}{$item.firstname} {$item.lastname}{/if}<br/>
{/if}
<a href="mailto:{$email}" title="{#write_email#}" class="toprightDir">{$email}</a><br/>
<span class="date_text dgrey">{$date|date_format:$TIME_FORMAT|pretty_date}</span>
</td>
<td>
{if $item.format=='text'}
<div style="white-space:pre">{$item.body}</div>
{else}
{$item.body}
{/if}
</td>
</tr>
{if $dialog.response}
<tr>
<td colspan="2"><h5>{if $dialog.response|@count == 1}{#response#}{else}{#responses#}{/if}</h5></td>
</tr>
{foreach from=$dialog.response item=item}
<tr>
<td valign="middle">
{if $item.user_name}
[<a target="_blank" href="index.php?do=user&amp;action=edit&Id={$item.user_id}&cp={$sess}" class="toprightDir" title="{#profile_look#}">{$item.user_name}</a>] {if $item.firstname || $item.lastname}{$item.firstname} {$item.lastname}{/if}<br/>
{/if}
{#from#} <a href="mailto:{$item.from_email}" title="{#write_email#}" class="toprightDir">{$item.from_email}</a> &lt;{$item.from_name|escape}&gt;<br/>
<span class="date_text dgrey">{$item.date|date_format:$TIME_FORMAT|pretty_date}</span>
</td>
<td>
{if $item.format=='text'}
<div style="white-space:pre">{$item.body}</div>
{else}
{$item.body}
{/if}
</td>
</tr>
{/foreach}
{else}
<tr class="{if $status==='replied'}yellow{/if}">
<td colspan="2" style="padding:15px 10px;">
{if $status!=='replied'}<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=dialog_status&amp;hid={$hid}&amp;status=replied&amp;fid={$fid}&amp;cp={$sess}" class="btn redBtn">{#set_replied#}</a>
{else}
<strong>{#marked_replied#}</strong>
{/if}
</td>
</tr>
{/if}
</tbody>
</table>
</div>
<form method="post" class="mainForm" id="response_form" action="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_dialog_submit&amp;hid={$hid}&amp;cp={$sess}" data-accept="{#saved#}" data-error="{#notsaved#}">
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#write_response#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr class="noborder">
<td>{#from_name#}:</td>
<td><input type="text" name="from_name" placeholder="{#from_name#}" class="mousetrap" value="{$dialog.response_draft.from_name|escape}"/></td>
</tr>
<tr>
<td>{#from_email#}:</td>
<td><input type="text" name="from_email" placeholder="{#from_email#}" class="mousetrap" value="{$dialog.response_draft.from_email|escape}"/></td>
</tr>
<tr>
<td>{#mfld_subject#}:</td>
<td><input type="text" name="subject" placeholder="{#mfld_subject#}" class="mousetrap" value="{$dialog.response_draft.subject|escape|default:"RE: $subject"}"/></td>
</tr>
<tr>
<td>{#format#}:</td>
<td>
<input class="mousetrap" type="radio" name="format" value="text" {if $dialog.response_draft.format!='html'}checked="checked"{/if}/>
<label>{#text#}</label>
<input class="mousetrap" type="radio" name="format" value="html" {if $dialog.response_draft.format=='html'}checked="checked"{/if}/>
<label>HTML</label>
</td>
</tr>
<tr>
<td>{#body#}</td>
<td>
<textarea name="body" id="response_body" wrap="off">{$dialog.response_draft.body|escape}</textarea>
<div style="margin-top:5px;">
| <a href="javascript:void(0);" onClick="textSelection_response_body('<ol>', '</ol>');"><strong>OL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<ul>', '</ul>');"><strong>UL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<li>', '</li>');"><strong>LI</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<strong>', '</strong>');"><strong>B</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<em>', '</em>');"><strong>I</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<h1>', '</h1>');"><strong>H1</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<h2>', '</h2>');"><strong>H2</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<h3>', '</h3>');"><strong>H3</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<h4>', '</h4>');"><strong>H4</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<h5>', '</h5>');"><strong>H5</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<span>', '</span>');"><strong>SPAN</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<pre>', '</pre>');"><strong>PRE</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('<br />', '');"><strong>BR</strong></a> | <a href="javascript:void(0);" onClick="textSelection_response_body('\t', '');"><strong>TAB</strong></a> |
</div>
</td>
</tr>
{*<tr>
<td>{#attach#}</td>
<td><input type="file"></td>
</tr>*}
</tbody>
</table>
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#save_draft#} (Ctrl+S)" onClick="response_save();return false;" />&nbsp;
<button type="submit" class="btn redBtn mousetrap" value="1" name="send">{#send#}</button>&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_list&amp;fid={$fid}&amp;cp={$sess}" class="btn greenBtn">{#return_dialogs#}</a>
</div>
</div>
</form>
{literal}
<script type="text/javascript">
// на старте документа
$(function() {
// показываем стартовый алерт
if ($smarty.start_alert > '') $.jGrowl($smarty.start_alert, {theme: $smarty.start_alert_theme});
// сохранение по Ctrl+S
Mousetrap.bind(['ctrl+s', 'meta+s'], function(e) {
e.preventDefault();
response_save ();
});
});
// функция сохранения формы
function response_save () {
var form = $('#response_form');
form.ajaxSubmit({
data: {
ajax: 1
},
beforeSubmit: function () {
$.alerts._overlay('show');
},
success: function () {
$.alerts._overlay('hide');
$.jGrowl(form.attr('data-accept'), {theme: 'accept'});
},
error: function () {
$.jGrowl(form.attr('data-error'), {theme: 'error'});
}
});
}
</script>
{/literal}
{assign var=cdmr_id value=response_body}
{assign var=cdmr_h value=300}
{if $ave15}
{include file="$codemirror_editor" ctrls='response_save();' conn_id="_$cdmr_id" textarea_id=$cdmr_id height=$cdmr_h}
{else}
<script>
var editor_{$cdmr_id} = CodeMirror.fromTextArea(document.getElementById('{$cdmr_id}'), {ldelim}
extraKeys: {ldelim}
'Ctrl-S': function(cm) {ldelim}
response_save();
{rdelim}
{rdelim},
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'application/x-httpd-php',
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
tabMode: 'shift',
onChange: function() {ldelim}
editor_{$cdmr_id}.save();
{rdelim},
onCursorActivity: function() {ldelim}
editor_{$cdmr_id}.setLineClass(hlLine, null, null);
hlLine = editor_{$cdmr_id}.setLineClass(editor_{$cdmr_id}.getCursor().line, null, 'activeline');
{rdelim}
{rdelim});
editor_{$cdmr_id}.setSize('100%',{$cdmr_h});
function getSelectedRange_{$cdmr_id}() {ldelim}
return {ldelim}
from: editor_{$cdmr_id}.getCursor(true),
to: editor_{$cdmr_id}.getCursor(false)
{rdelim};
{rdelim}
function textSelection_{$cdmr_id}(startTag,endTag) {ldelim}
var range = getSelectedRange_{$cdmr_id}();
editor_{$cdmr_id}.replaceRange(startTag + editor_{$cdmr_id}.getRange(range.from, range.to) + endTag, range.from, range.to)
editor_{$cdmr_id}.setCursor(range.from.line, range.from.ch + startTag.length);
{rdelim}
</script>
{/if}

801
contactsnew/templates/form_edit.tpl

@ -0,0 +1,801 @@
<!-- Включаем CodeMirror разными способами в зависимости от версии движка -->
{if $ave15}
{include file="$codemirror_connect"}
{else}
<link rel="stylesheet" href="{$ABS_PATH}admin/codemirror/lib/codemirror.css">
{literal}
<style type="text/css">
.activeline {
background: #e8f2ff !important;
}
.CodeMirror-scroll {
height: 450px;
}
.smallBtn {
padding: 4px 7px !important;
}
</style>
{/literal}
<script src="{$ABS_PATH}admin/codemirror/lib/codemirror.js" type="text/javascript"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/xml/xml.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/javascript/javascript.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/css/css.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/clike/clike.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/php/php.js"></script>
{/if}
<!-- /Включаем CodeMirror -->
{literal}
<style type="text/css">
#form_edit td > input, #form_edit td > textarea {
box-sizing: border-box;
}
#form_edit .settings input, #form_edit .settings textarea, .add_wrap input, .add_wrap textarea {
width: auto !important;
}
#form_edit input+input {
margin-left: 4px;
}
#form_edit a.ico_info {
cursor: pointer;
}
.add_wrap {
white-space: nowrap;
float: none;
display:block;
width:100%;
}
.add_wrap + .add_wrap {
margin-top: 4px;
}
.icon_sprite.inline {
display: inline-block;
vertical-align: middle;
margin: 0;
padding: 0;
}
.jqTransformSelectWrapper + .icon_sprite.inline {
margin: 4px 0 0 8px;
float: left;
}
.nowrap {
white-space: nowrap;
}
.col-half {
width: 50%;
box-sizing: border-box;
float: left;
padding-right: 8px;
}
.col-half+.col-half {
padding: 0 0 0 8px;
}
.col-half h6 {
margin-bottom: 6px;
}
.col-half .CodeMirror-wrap {
border: 1px solid #B9CFDF;
box-sizing: border-box;
}
.col-half textarea {
box-sizing: border-box;
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
</style>
{/literal}
<script type="text/javascript">
// назначаем языковые переменные (так удобнее работать со smarty)
$fid = parseInt('{$fid}');
$sess = '{$sess}';
$smarty = new Array;
$smarty['start_alert'] = '{$alert.text}';
$smarty['start_alert_theme'] = '{$alert.theme}';
$smarty['_email_accept'] = '{#email_accept#}';
$smarty['_email_error'] = '{#email_error#}';
$smarty['tpl_dir'] = '{$tpl_dir}';
$smarty['_refresh'] = '{#refresh#}';
</script>
<div class="title">
<h5>{#contacts#}</h5>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}" class="toprightDir"></a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#contacts#}</a></li>
{if $fid}
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#forms#}</a></li>
<li><strong class="code">{$form.title|escape}</strong></li>
{/if}
<li>{if $fid}{#form_editing#}{else}{#form_creating#}{/if}</strong></li>
</ul>
</div>
</div>
<form method="post" class="mainForm" id="form_edit" action="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_save&amp;fid={$fid}&amp;cp={$sess}" data-accept="{#saved#}" data-error="{#notsaved#}">
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#main_sets#}</h5>
<div class="num">
<a class="basicNum" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_list&amp;fid={$fid}&amp;cp={$sess}">{#history#}</a>
</div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic settings">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr class="noborder">
<td>{#title#}:</td>
<td>
<input type="text" name="title" id="form_title" value="{$form.title|escape}" class="mousetrap" placeholder="{#title#}" size="40" {if !$fid}autofocus{/if} />
</td>
</tr>
<tr>
<td>
<div class="nowrap">
{#alias#}
<a class="toprightDir icon_sprite ico_info inline" title="{#alias_i#}"></a>:
</div>
</td>
<td>
<input type="text" name="alias" id="form_alias" value="{$form.alias|escape}" class="mousetrap" data-accept="{#alias_accept#}" data-error-syn="{#alias_er_syn#}" data-error-exists="{#alias_er_exists#}" placeholder="{#alias#}" maxlength="20" size="40" />
<input type="text" id="form_tag" value="[mod_contactsnew:{if $fid && $form.alias}{$form.alias}{elseif $fid}{$fid}{/if}]" readonly size="40" class="mousetrap" />
</td>
</tr>
<tr>
<td>
<div class="nowrap">
{#protection#}
<a class="toprightDir icon_sprite ico_info inline" title="{#protect_i#}"></a>:
</div>
</td>
<td>
<input type="checkbox" name="protection" value="1" {if $form.protection!=='0'}checked="checked"{/if} class="mousetrap"/>
</td>
</tr>
{if !$fid}
<tr>
<td>{#demo#}:</td>
<td>
<select name="demo">
<option value="">{#no#}</option>
<option value="noajax">{#demo_noajax#}</option>
<option value="ajax">{#demo_ajax#}</option>
<option value="ajax_o">{#demo_ajax_o#}</option>
</select>
</td>
</tr>
{/if}
</tbody>
</table>
{if !$fid}
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#create#} (Ctrl+S)" />
</div>
{/if}
</div>
{if $fid}
<div class="widget first">
<div class="head closed">
<h5 class="iFrames">{#rubheader#}</h5>
</div>
<div>
<div class="body">{#rubheader_info#}</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr>
<td><a class="toprightDir" title="{#tag_path#}" href="javascript:void(0);" onClick="textSelection_rubheader('[tag:path]','');"><strong>[tag:path]</strong></a></td>
<td rowspan="3">
<textarea wrap="off" name="rubheader" id="rubheader">{$form.rubheader|escape}</textarea>
</td>
</tr>
<tr>
<td><a class="toprightDir" title="{#tag_media#}" href="javascript:void(0);" onClick="textSelection_rubheader('[tag:mediapath]','');"><strong>[tag:mediapath]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" title="{#tag_css#}" href="javascript:void(0);" onClick="textSelection_rubheader('[tag:css:]','');"><strong>[tag:css:FFF:P]</strong></a>, <a class="toprightDir" title="{#tag_js#}" href="javascript:void(0);" onClick="textSelection_rubheader('[tag:js:]','');"><strong>[tag:js:FFF:P]</strong></a></td>
</tr>
<tr>
<td>HTML tags</td>
<td> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<ol>', '</ol>');"><strong>OL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<ul>', '</ul>');"><strong>UL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<li>', '</li>');"><strong>LI</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<strong>', '</strong>');"><strong>B</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<em>', '</em>');"><strong>I</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<h1>', '</h1>');"><strong>H1</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<h2>', '</h2>');"><strong>H2</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<h3>', '</h3>');"><strong>H3</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<h4>', '</h4>');"><strong>H4</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<h5>', '</h5>');"><strong>H5</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<span>', '</span>');"><strong>SPAN</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<pre>', '</pre>');"><strong>PRE</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('<br />', '');"><strong>BR</strong></a> | <a href="javascript:void(0);" onClick="textSelection_rubheader('\t', '');"><strong>TAB</strong></a> | </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#fields_sets#}</h5>
</div>
<div id="form_fields_appendto">
{include file=$form_fields_tpl fields=$form.fields}
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#form_tpl#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr class="noborder">
<td>{#conditions#}</td>
<td> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_form_tpl('[tag:if_fld:]', '[/tag:if_fld]');"><strong>[tag:if_fld:XXX == '123'][/tag:if_fld]</strong></a> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_form_tpl('[tag:elseif_fld:]', '');"><strong>[tag:elseif_fld:XXX > 2]</strong></a> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_form_tpl('[tag:else_fld]', '');"><strong>[tag:else_fld]</strong></a> |
<br/> |
<a title="{#tag_f_valid#}" href="javascript:void(0);" class="topDir" onClick="textSelection_form_tpl('[tag:if_form_valid]', '[/tag:if_form_valid]');"><strong>[tag:if_form_valid][/tag:if_form_valid]</strong></a> |
<a title="{#tag_f_invalid#}" href="javascript:void(0);" class="topDir" onClick="textSelection_form_tpl('[tag:if_form_invalid]', '[/tag:if_form_invalid]');"><strong>[tag:if_form_invalid][/tag:if_form_invalid]</strong></a> |
</td>
</tr>
<tr>
<td><strong><a title="{#tag_fld#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:fld:]', '');">[tag:fld:XXX]</a></strong></td>
<td rowspan="16"><textarea name="form_tpl" id="form_tpl" wrap="off">{$form.form_tpl|escape}</textarea></td>
</tr>
<tr>
<td><strong><a title="{#tag_title#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:title:]', '');">[tag:title:XXX]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_docid#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:docid]', '');">[tag:docid]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_url#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:document]', '');">[tag:document]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formalias#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:formalias]', '');">[tag:formalias]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formtitle#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:formtitle]', '');">[tag:formtitle]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_path#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:path]', '');">[tag:path]</a></strong></td>
</tr>
<tr>
<td><a class="toprightDir" title="{#tag_media#}" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:mediapath]','');"><strong>[tag:mediapath]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:hide:]','[/tag:hide]');" title="{#tag_hide#}"><strong>[tag:hide:X,X:TEXT][/tag:hide]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:uemail]','');" title="{#tag_uemail#}"><strong>[tag:uemail]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:ulogin]','');" title="{#tag_ulogin#}"><strong>[tag:ulogin]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:uname]','');" title="{#tag_uname#}"><strong>[tag:uname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:ufname]','');" title="{#tag_ufname#}"><strong>[tag:ufname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:ulname]','');" title="{#tag_ulname#}"><strong>[tag:ulname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:sitename]','');" title="{#tag_sitename#}"><strong>[tag:sitename]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:sitehost]','');" title="{#tag_sitehost#}"><strong>[tag:sitehost]</strong></a></td>
</tr>
<tr>
<td>HTML Tags</td>
<td> | <a href="javascript:void(0);" onClick='textSelection_form_tpl("<form action=\"\" method=\"post\" id=\"[tag:formalias]\" enctype=\"multipart/form-data\" role=\"form\">", "\n</form>\n");'><strong>FORM</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<ol>', '</ol>');"><strong>OL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<ul>', '</ul>');"><strong>UL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<li>', '</li>');"><strong>LI</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<strong>', '</strong>');"><strong>B</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<em>', '</em>');"><strong>I</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<h1>', '</h1>');"><strong>H1</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<h2>', '</h2>');"><strong>H2</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<h3>', '</h3>');"><strong>H3</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<h4>', '</h4>');"><strong>H4</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<h5>', '</h5>');"><strong>H5</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<span>', '</span>');"><strong>SPAN</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<pre>', '</pre>');"><strong>PRE</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('<br />', '');"><strong>BR</strong></a> | <a href="javascript:void(0);" onClick="textSelection_form_tpl('\t', '');"><strong>TAB</strong></a> | </td>
</tr>
</tbody>
</table>
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#save#} (Ctrl+S)" />&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}" class="btn greenBtn">{#return_to_forms#}</a>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#mail_set#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr class="noborder">
<td>{#from_name#}:</td>
<td>
<textarea id="from_name" name="mail_set[from_name]" placeholder="{#from_name#}" rows="2" class="mousetrap">{$form.mail_set.from_name|escape}</textarea>
<div>|
php |
<a class="docname botDir" title="{#tag_fld_mail#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:fld:]','');"><strong>[tag:fld:XXX]</strong></a> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_login#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:login]','');"><strong>[tag:ulogin]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
<a class="docname botDir" title="{#tag_formtitle#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:formtitle]','');"><strong>[tag:formtitle]</strong></a> |
<a class="docname botDir" title="{#tag_formalias#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:formalias]','');"><strong>[tag:formalias]</strong></a> |
<a class="docname botDir" title="{#tag_sitename#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:sitename]','');"><strong>[tag:sitename]</strong></a> |
<a class="docname botDir" title="{#tag_sitehost#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:sitehost]','');"><strong>[tag:sitehost]</strong></a> |
<br> |
<a class="docname botDir" title="{#tag_if_user#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:if_user]','[/tag:if_user]');"><strong>[tag:if_user][/tag:if_user]</strong></a> |
<a class="docname botDir" title="{#tag_if_admin#}" href="javascript:void(0);" onClick="textSelection_from_name('[tag:if_admin]','[/tag:if_admin]');"><strong>[tag:if_admin][/tag:if_admin]</strong></a> |
</div>
</td>
</tr>
<tr>
<td>{#from_email#}:</td>
<td>
<textarea id="from_email" name="mail_set[from_email]" placeholder="{#from_email#}" rows="2" class="mousetrap">{$form.mail_set.from_email|escape}</textarea>
<div>|
php |
<a class="docname botDir" title="{#tag_fld_email#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:fld:email]','');"><strong>[tag:fld:email]</strong></a> |
<a class="docname botDir" title="{#tag_fld_mail#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:fld:]','');"><strong>[tag:fld:XXX]</strong></a> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_login#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:login]','');"><strong>[tag:ulogin]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
<a class="docname botDir" title="{#tag_formtitle#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:formtitle]','');"><strong>[tag:formtitle]</strong></a> |
<a class="docname botDir" title="{#tag_formalias#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:formalias]','');"><strong>[tag:formalias]</strong></a> |
<a class="docname botDir" title="{#tag_sitename#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:sitename]','');"><strong>[tag:sitename]</strong></a> |
<a class="docname botDir" title="{#tag_sitehost#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:sitehost]','');"><strong>[tag:sitehost]</strong></a> |
<br> |
<a class="docname botDir" title="{#tag_if_user#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:if_user]','[/tag:if_user]');"><strong>[tag:if_user][/tag:if_user]</strong></a> |
<a class="docname botDir" title="{#tag_if_admin#}" href="javascript:void(0);" onClick="textSelection_from_email('[tag:if_admin]','[/tag:if_admin]');"><strong>[tag:if_admin][/tag:if_admin]</strong></a> |
</div>
</td>
</tr>
<tr>
<td>{#subject_tpl#}:</td>
<td>
<textarea id="subject_tpl" name="mail_set[subject_tpl]" placeholder="{#subject_tpl#}" rows="2" class="mousetrap">{$form.mail_set.subject_tpl|escape}</textarea>
<div>|
php |
<a class="docname botDir" title="{#tag_fld_subject#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:fld:subject]','');"><strong>[tag:fld:subject]</strong></a> |
<a class="docname botDir" title="{#tag_fld_mail#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:fld:]','');"><strong>[tag:fld:XXX]</strong></a> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_login#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:login]','');"><strong>[tag:ulogin]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
<a class="docname botDir" title="{#tag_formtitle#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:formtitle]','');"><strong>[tag:formtitle]</strong></a> |
<a class="docname botDir" title="{#tag_formalias#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:formalias]','');"><strong>[tag:formalias]</strong></a> |
<a class="docname botDir" title="{#tag_sitename#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:sitename]','');"><strong>[tag:sitename]</strong></a> |
<a class="docname botDir" title="{#tag_sitehost#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:sitehost]','');"><strong>[tag:sitehost]</strong></a> |
<br> |
<a class="docname botDir" title="{#tag_if_user#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:if_user]','[/tag:if_user]');"><strong>[tag:if_user][/tag:if_user]</strong></a> |
<a class="docname botDir" title="{#tag_if_admin#}" href="javascript:void(0);" onClick="textSelection_subject_tpl('[tag:if_admin]','[/tag:if_admin]');"><strong>[tag:if_admin][/tag:if_admin]</strong></a> |
</div>
</td>
</tr>
<tr>
<td>{#recs_main#} <a class="toprightDir icon_sprite ico_info inline" title="{#recs_main_i#}"></a>:</td>
<td>
{foreach from=$form.mail_set.receivers item=receiver name=receivers}
<div class="add_wrap">
<input type="text" name="mail_set[receivers][{$smarty.foreach.receivers.index}][email]" value="{$receiver.email|escape}" placeholder="Email" size="40" class="mousetrap email" />
<input type="text" name="mail_set[receivers][{$smarty.foreach.receivers.index}][name]" value="{$receiver.name|escape}" placeholder="{#name#}" size="40" class="mousetrap" />
{if $smarty.foreach.receivers.index == 0}
<input type="button" value="+" class="btn basicBtn smallBtn addParentBtn mousetrap" data-content='<div class="add_wrap"><input type="text" name="mail_set[receivers][%count%][email]" placeholder="Email" class="mousetrap email" size="40"/> <input class="mousetrap" type="text" name="mail_set[receivers][%count%][name]" placeholder="{#name#}" size="40"/> <input type="button" value="&times;" class="btn redBtn smallBtn delParentBtn" data-target="div"></div>' data-target="td" data-count="{$form.mail_set.receivers|@count}">
{else}
<input type="button" value="&times;" class="btn redBtn smallBtn delParentBtn" data-target="div">
{/if}
</div>
{/foreach}
</td>
</tr>
<tr>
<td>{#format#}:</td>
<td>
<input class="mousetrap" type="radio" name="mail_set[format]" value="text" {if $form.mail_set.format!='html'}checked="checked"{/if}/>
<label>{#text#}</label>
<input class="mousetrap" type="radio" name="mail_set[format]" value="html" {if $form.mail_set.format=='html'}checked="checked"{/if}/>
<label>HTML</label>
</td>
</tr>
<tr>
<td colspan="2">
<h6>{#mail_tpl#}</h6>
</td>
</tr>
<tr>
<td>{#conditions#}</td>
<td> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_mail_tpl('[tag:if_fld:]', '[/tag:if_fld]');"><strong>[tag:if_fld:XXX == '123'][/tag:if_fld]</strong></a> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_mail_tpl('[tag:elseif_fld:]', '');"><strong>[tag:elseif_fld:XXX > 2]</strong></a> |
<a title="{#tag_if_fld#}" href="javascript:void(0);" class="topDir" onClick="textSelection_mail_tpl('[tag:else_fld]', '');"><strong>[tag:else_fld]</strong></a> |
<br>|
<a title="{#tag_if_user#}" href="javascript:void(0);" class="topDir" onClick="textSelection_mail_tpl('[tag:if_user]', '[/tag:if_user]');"><strong>[tag:if_user][/tag:if_user]</strong></a> |
<a title="{#tag_if_admin#}" href="javascript:void(0);" class="topDir" onClick="textSelection_mail_tpl('[tag:if_admin]', '[/tag:if_admin]');"><strong>[tag:if_admin][/tag:if_admin]</strong></a> |
</td>
</tr>
<tr>
<td><strong><a title="{#tag_fld_mail#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:fld:]', '');">[tag:fld:XXX]</a></strong></td>
<td rowspan="15"><textarea name="mail_tpl" id="mail_tpl" wrap="off">{$form.mail_tpl|escape}</textarea></td>
</tr>
<tr>
<td><strong><a title="{#tag_title#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:title:]', '');">[tag:title:XXX]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_docid#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:docid]', '');">[tag:docid]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_url#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:document]', '');">[tag:document]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formtitle#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:formtitle]', '');">[tag:formtitle]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formalias#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:formalias]', '');">[tag:formalias]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_path#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:path]', '');">[tag:path]</a></strong></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:easymail]','');" title="{#tag_easymail#}"><strong>[tag:easymail]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:uemail]','');" title="{#tag_uemail#}"><strong>[tag:uemail]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:ulogin]','');" title="{#tag_ulogin#}"><strong>[tag:ulogin]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:uname]','');" title="{#tag_uname#}"><strong>[tag:uname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:ufname]','');" title="{#tag_ufname#}"><strong>[tag:ufname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:ulname]','');" title="{#tag_ulname#}"><strong>[tag:ulname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:sitename]','');" title="{#tag_sitename#}"><strong>[tag:sitename]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_mail_tpl('[tag:sitehost]','');" title="{#tag_sitehost#}"><strong>[tag:sitehost]</strong></a></td>
</tr>
<tr>
<td>HTML Tags</td>
<td> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<ol>', '</ol>');"><strong>OL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<ul>', '</ul>');"><strong>UL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<li>', '</li>');"><strong>LI</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<strong>', '</strong>');"><strong>B</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<em>', '</em>');"><strong>I</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<h1>', '</h1>');"><strong>H1</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<h2>', '</h2>');"><strong>H2</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<h3>', '</h3>');"><strong>H3</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<h4>', '</h4>');"><strong>H4</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<h5>', '</h5>');"><strong>H5</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<span>', '</span>');"><strong>SPAN</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<pre>', '</pre>');"><strong>PRE</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('<br />', '');"><strong>BR</strong></a> | <a href="javascript:void(0);" onClick="textSelection_mail_tpl('\t', '');"><strong>TAB</strong></a> | </td>
</tr>
</tbody>
</table>
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#save#} (Ctrl+S)" />&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}" class="btn greenBtn">{#return_to_forms#}</a>
</div>
</div>
<div class="widget first">
<div class="head closed">
<h5 class="iFrames">{#finish_tpl#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="200">
<col>
</colgroup>
<tbody>
<tr class="noborder">
<td><strong><a title="{#tag_docid#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:docid]', '');">[tag:docid]</a></strong></td>
<td rowspan="11"><textarea name="finish_tpl" id="finish_tpl" wrap="off">{$form.finish_tpl|escape}</textarea></td>
</tr>
<tr>
<td><strong><a title="{#tag_url#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:document]', '');">[tag:document]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formalias#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:formalias]', '');">[tag:formalias]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_formtitle#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:formtitle]', '');">[tag:formtitle]</a></strong></td>
</tr>
<tr>
<td><strong><a title="{#tag_path#}" class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:path]', '');">[tag:path]</a></strong></td>
<tr>
<td><a class="toprightDir" title="{#tag_media#}" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:mediapath]','');"><strong>[tag:mediapath]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:uemail]','');" title="{#tag_uemail#}"><strong>[tag:uemail]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:ulogin]','');" title="{#tag_ulogin#}"><strong>[tag:ulogin]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:uname]','');" title="{#tag_uname#}"><strong>[tag:uname]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:sitename]','');" title="{#tag_sitename#}"><strong>[tag:sitename]</strong></a></td>
</tr>
<tr>
<td><a class="toprightDir" href="javascript:void(0);" onClick="textSelection_finish_tpl('[tag:sitehost]','');" title="{#tag_sitehost#}"><strong>[tag:sitehost]</strong></a></td>
</tr>
<tr>
<td>HTML Tags</td>
<td> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<ol>', '</ol>');"><strong>OL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<ul>', '</ul>');"><strong>UL</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<li>', '</li>');"><strong>LI</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<strong>', '</strong>');"><strong>B</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<em>', '</em>');"><strong>I</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<h1>', '</h1>');"><strong>H1</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<h2>', '</h2>');"><strong>H2</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<h3>', '</h3>');"><strong>H3</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<h4>', '</h4>');"><strong>H4</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<h5>', '</h5>');"><strong>H5</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<span>', '</span>');"><strong>SPAN</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<pre>', '</pre>');"><strong>PRE</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('<br />', '');"><strong>BR</strong></a> | <a href="javascript:void(0);" onClick="textSelection_finish_tpl('\t', '');"><strong>TAB</strong></a> | </td>
</tr>
</tbody>
</table>
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#save#} (Ctrl+S)" />&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}" class="btn greenBtn">{#return_to_forms#}</a>
</div>
</div>
<div class="widget first">
<div class="head closed">
<h5 class="iFrames">{#code#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tbody>
<tr class="noborder">
<td>{#code_info#}</td>
</tr>
<tr>
<td><h6>{#code_onsubmit#}</h6></td>
</tr>
<tr>
<td><textarea name="code_onsubmit" id="code_onsubmit" wrap="off">{$form.code_onsubmit|escape}</textarea></td>
</tr>
<tr>
<td><h6>{#code_onvalidate#}</h6></td>
</tr>
<tr>
<td><textarea name="code_onvalidate" id="code_onvalidate" wrap="off">{$form.code_onvalidate|escape}</textarea></td>
</tr>
<tr>
<td><h6>{#code_onsend#}</h6></td>
</tr>
<tr>
<td><textarea name="code_onsend" id="code_onsend" wrap="off">{$form.code_onsend|escape}</textarea></td>
</tr>
</tbody>
</table>
<div class="rowElem">
<input type="submit" class="btn basicBtn mousetrap" value="{#save#} (Ctrl+S)" />&nbsp;
<a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}" class="btn greenBtn">{#return_to_forms#}</a>
</div>
</div>
{/if}
</form>
{literal}
<script type="text/javascript">
// на старте документа
$(function() {
// показываем стартовый алерт
if ($smarty.start_alert > '') $.jGrowl($smarty.start_alert, {theme: $smarty.start_alert_theme});
// сохранение по Ctrl+S
Mousetrap.bind(['ctrl+s', 'meta+s'], function(e) {
e.preventDefault();
form_save ();
});
});
// функция сохранения формы
function form_save (fields_reload, data) {
if (data == undefined) var data = new Object();
var form = $('#form_edit');
data.ajax = 1;
data.fields_reload = (fields_reload == true || $('.form_fields_new_title').val() > '') ? 1 : 0;
var fields_appendto = $('#form_fields_appendto');
form.ajaxSubmit({
data: data,
beforeSubmit: function () {
$.alerts._overlay('show');
if (data.fields_reload == 1) fields_appendto.css('opacity',0.3);
},
success: function (response) {
if ($fid) {
$.alerts._overlay('hide');
$.jGrowl(form.attr('data-accept'), {theme: 'accept'});
if (data.fields_reload == 1) fields_appendto.height(fields_appendto.height()).empty().append(response).height('auto').updateContent().css('opacity',1);
}
else {
document.location.href = 'index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=form_edit&fid='+parseInt(response)+'&cp='+$sess;
}
},
error: function () {
$.jGrowl(form.attr('data-error'), {theme: 'error'});
}
});
}
// навешиваем функционал на пришедший аяксом контент
(function($)
{
$.fn.updateContent = function()
{
this.jqTransform({imgPath:$smarty.tpl_dir+'/images'})
$('.topleftDir',this).tipsy({fade: false, gravity: 'se', opacity: 0.9});
$('.toprightDir',this).tipsy({fade: false, gravity: 'sw', opacity: 0.9});
$('.leftDir',this).tipsy({fade: false, gravity: 'e', opacity: 0.9});
$('.rightDir',this).tipsy({fade: false, gravity: 'w', opacity: 0.9});
$('.topDir',this).tipsy({fade: false, gravity: 's', opacity: 0.9});
$('.botDir',this).tipsy({fade: false, gravity: 'n', opacity: 0.9});
return this;
}
})(jQuery);
// обработчики
$(document)
// валидация алиаса формы
.on('change', '#form_alias', function (e) {
var input = $(this);
var alias = input.val();
if (alias > '') {
$.ajax({
url: 'index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=alias_validate&cp='+$sess,
data: {
alias: alias,
ajax: 1,
fid: $fid
},
success: function (data) {
if (data === '1') {
$.jGrowl(input.attr('data-accept'), {theme: 'accept'});
}
else if (data === 'syn') {
$.jGrowl(input.attr('data-error-syn'), {theme: 'error'});
alias = $fid ? $fid : '';
}
else {
$.jGrowl(input.attr('data-error-exists'), {theme: 'error'});
alias = $fid ? $fid : '';
}
$('#form_tag').val('[mod_contactsnew:'+alias+']');
}
});
}
else {
alias = $fid ? $fid : '';
$('#form_tag').val('[mod_contactsnew:'+alias+']');
}
})
// кнопки добавления
.on('click', '.addParentBtn', function (e) {
e.preventDefault();
var btn = $(this);
var count = parseInt(btn.attr('data-count')) + 1;
var content = btn.attr('data-content').replace(/%count%/g, count);
$(this).parents(btn.attr('data-target')).eq(0).append(content);
btn.attr('data-count',count);
})
// кнопки удаления
.on('click', '.delParentBtn', function (e) {
e.preventDefault();
$(this).parents($(this).attr('data-target')).eq(0).remove();
})
// сохранение формы
.on('submit', '#form_edit', function (e) {
e.preventDefault();
form_save();
})
// проверка email-а на валидность
.on('change', '.email', function (e) {
e.preventDefault();
var email = $(this).val();
$.ajax({
url: 'index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=email_validate&cp='+$sess,
data: {
email: email,
ajax: 1
},
success: function (data) {
if (data == '1')
$.jGrowl($smarty._email_accept, {theme: 'accept'});
else
$.jGrowl($smarty._email_error, {theme: 'error'});
}
});
})
// удаление поля
.on('click', '.form_field_del', function (e) {
e.preventDefault();
var btn = $(this);
jConfirm(btn.attr('data-confirm'),btn.attr('data-confirm-title'), function(b) {
if (b) {
var field_id = btn.attr('data-field');
var data = new Object();
data.field_del = new Object();
data.field_del[field_id] = 1;
form_save(true, data);
}
});
})
// изменение типа поля
.on('change', '.form_field_type_change', function (e) {
form_save(true);
})
// изменение настроек поля
.on('click', ':button.form_field_switch', function (e) {
$(this).parents('tr').eq(0).find('.defaultval').removeClass('defaultval').empty().html('<input type="button" value="'+$smarty._refresh+'" class="btn greenBtn mousetrap" onClick="form_save(true);return false;" />');
if ($(this).hasClass('del')) {
$(this).parents($(this).attr('data-target')).eq(0).remove();
return false;
}
})
// изменение настроек поля
.on('change', '.form_field_switch', function (e) {
$(this).parents('tr').eq(0).find('.defaultval').removeClass('defaultval').empty().html('<input type="button" value="'+$smarty._refresh+'" class="btn greenBtn mousetrap" onClick="form_save(true);return false;" />');
})
// скрыть/показать шаблон поля
.on('click', '.form_field_tpl_btn', function (e) {
e.preventDefault();
var tr = $(this).parents('tr').eq(0).next('.form_field_tpl_tr');
var input = $(this).next('.form_field_tpl_input');
if (tr.is(':visible')) {
tr.hide();
input.val(0);
}
else {
tr.show();
input.val(1);
}
})
</script>
{/literal}
<!-- Оформляем поля в CodeMirror -->
{foreach from=$codemirror key='cdmr_id' item='cdmr_h'}
{if $ave15}
{include file="$codemirror_editor" ctrls='form_save();' conn_id="_$cdmr_id" textarea_id=$cdmr_id height=$cdmr_h}
{else}
<script>
var editor_{$cdmr_id} = CodeMirror.fromTextArea(document.getElementById('{$cdmr_id}'), {ldelim}
extraKeys: {ldelim}
'Ctrl-S': function(cm) {ldelim}
form_save();
{rdelim}
{rdelim},
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'application/x-httpd-php',
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
tabMode: 'shift',
onChange: function() {ldelim}
editor_{$cdmr_id}.save();
{rdelim},
onCursorActivity: function() {ldelim}
editor_{$cdmr_id}.setLineClass(hlLine, null, null);
hlLine = editor_{$cdmr_id}.setLineClass(editor_{$cdmr_id}.getCursor().line, null, 'activeline');
{rdelim}
{rdelim});
editor_{$cdmr_id}.setSize('100%',{$cdmr_h});
function getSelectedRange_{$cdmr_id}() {ldelim}
return {ldelim}
from: editor_{$cdmr_id}.getCursor(true),
to: editor_{$cdmr_id}.getCursor(false)
{rdelim};
{rdelim}
function textSelection_{$cdmr_id}(startTag,endTag) {ldelim}
var range = getSelectedRange_{$cdmr_id}();
editor_{$cdmr_id}.replaceRange(startTag + editor_{$cdmr_id}.getRange(range.from, range.to) + endTag, range.from, range.to)
editor_{$cdmr_id}.setCursor(range.from.line, range.from.ch + startTag.length);
{rdelim}
</script>
{/if}
{/foreach}
<!-- /Оформляем поля в CodeMirror -->

398
contactsnew/templates/form_fields.tpl

@ -0,0 +1,398 @@
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<colgroup>
<col width="1">
<col width="1">
<col>
<col width="160">
<col width="1">
<col width="1">
<col>
<col width="1">
<col width="1">
</colgroup>
<thead>
<tr>
<td align="center"><a href="javascript:void(0);" class="toprightDir icon_sprite ico_ok{if $ave15}_green{/if}" style="cursor:help;display:inline-block" title="{#active_i#}"></a></td>
<td>ID</td>
<td>{#title#}</td>
<td>{#type#}</td>
<td>{#sets#}</td>
<td align="center"><div class="topDir" style="cursor:pointer" title="{#required#}">!</div></td>
<td>{#defaultval#}</td>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
{foreach from=$fields item=field key=field_id}
<tr>
<td align="center">
<input type="checkbox" class="toprightDir" name="fields[{$field.id}][active]" value="1" {if $field.active}checked="checked"{/if} title="{#active_i#}" />
</td>
<td>
<div class="nowrap">
<a class="toprightDir icon_sprite ico_info inline" title="{#fld_i#}"></a>
{if $field.main}
<a href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:fld:{$field.title}]','');"><strong>[tag:fld:{$field.title}]</strong></a>
{else}
<a href="javascript:void(0);" onClick="textSelection_form_tpl('[tag:fld:{$field.id}]','');"><strong>[tag:fld:{$field.id}]</strong></a>
{/if}
</div>
</td>
<td>
{if $field.main}
<div class="nowrap">
{$field.title_lang|escape}
<input type="hidden" name="fields[{$field.id}][title]" value="{$field.title|escape}"/>
{if $field.title=='copy'}<a class="topDir icon_sprite ico_info inline" title="{#copy_fld_i#}"></a>{/if}
</div>
{else}
<input type="text" name="fields[{$field.id}][title]" placeholder="{#title#}" class="mousetrap" value="{$field.title|escape}" />
{/if}
</td>
{if $field.main && $field.title != 'subject' && $field.title != 'email'}
<td colspan="2">
<input type="hidden" name="fields[{$field.id}][type]" value="{$field.type|escape}"/>
{if $field.main && $field.title=='receivers'}
{foreach from=$field.setting item=receiver name=receivers}
<div class="add_wrap">
<input type="text" name="fields[{$field.id}][setting][{$smarty.foreach.receivers.index}][email]" value="{$receiver.email|escape}" placeholder="Email" size="20" class="mousetrap email form_field_switch" />
<input type="text" name="fields[{$field.id}][setting][{$smarty.foreach.receivers.index}][name]" value="{$receiver.name|escape}" placeholder="{#name#}" size="20" class="mousetrap form_field_switch" />
{if $smarty.foreach.receivers.index == 0}
<input type="button" value="+" class="btn basicBtn smallBtn addParentBtn mousetrap form_field_switch" data-content='<div class="add_wrap"><input type="text" class="mousetrap email form_field_switch" name="fields[{$field.id}][setting][%count%][email]" placeholder="Email" size="20"/> <input class="mousetrap form_field_switch" type="text" name="fields[{$field.id}][setting][%count%][name]" placeholder="{#name#}" size="20"/> <input type="button" value="&times;" class="btn redBtn smallBtn delParentBtn form_field_switch" data-target="div"></div>' data-target="td" data-count="{$field.setting|@count}">
{else}
<input type="button" value="&times;" class="btn redBtn smallBtn delParentBtn form_field_switch" data-target="div">
{/if}
</div>
{/foreach}
{else}
<input type="hidden" name="fields[{$field.id}][setting]" value="{$field.setting|escape}" />
{/if}
</td>
{else}
<td>
{if $field.main}
<input type="hidden" name="fields[{$field.id}][type]" value="{$field.type|escape}"/>
{else}
<div class="nowrap">
<select name="fields[{$field.id}][type]" class="mousetrap form_field_type_change">
<option value="input" {if $field.type=='input'}selected="selected"{/if}>input</option>
<option value="textarea" {if $field.type=='textarea'}selected="selected"{/if}>textarea</option>
<option value="select" {if $field.type=='select'}selected="selected"{/if}>select</option>
<option value="multiselect" {if $field.type=='multiselect'}selected="selected"{/if}>multiselect</option>
<option value="checkbox" {if $field.type=='checkbox'}selected="selected"{/if}>checkbox</option>
<option value="file" {if $field.type=='file'}selected="selected"{/if}>file</option>
<option value="doc" {if $field.type=='doc'}selected="selected"{/if}>{#doc#}</option>
<option value="multidoc" {if $field.type=='multidoc'}selected="selected"{/if}>{#multidoc#}</option>
</select>
<a class="toprightDir icon_sprite ico_info inline" title="{#type_i#}"></a>
</div>
{/if}
</td>
<td>
{if $field.type=='input' || $field.type=='textarea'}
<div class="nowrap">
<input type="text" name="fields[{$field.id}][setting]" value="{$field.setting|escape}" placeholder="{#pattern#}" class="mousetrap" style="width:142px" />
<a class="toprightDir icon_sprite ico_info inline" title="{#pattern_i#}"></a>
</div>
{elseif $field.type=='select' || $field.type=='multiselect'}
{foreach from=$field.setting item=title name=select}
<div class="add_wrap">
<input type="text" name="fields[{$field.id}][setting][]" value="{$title|escape}" placeholder="option" size="20" class="mousetrap form_field_switch" />
{if $smarty.foreach.select.index == 0}
<input type="button" value="+" class="btn basicBtn smallBtn addParentBtn mousetrap form_field_switch" data-content='<div class="add_wrap"><input type="text" name="fields[{$field.id}][setting][]" placeholder="option" size="20" class="mousetrap form_field_switch" /> <input type="button" value="&times;" class="btn redBtn smallBtn form_field_switch del" data-target="div"></div>' data-target="td">
{else}
<input type="button" value="&times;" class="btn redBtn smallBtn form_field_switch del" data-target="div">
{/if}
</div>
{/foreach}
{elseif $field.type=='doc' || $field.type=='multidoc'}
<select class="mousetrap" name="fields[{$field.id}][setting][]" multiple="multiple" size="4" style="width:100%">
{foreach from=$rubrics item=rtitle key=rid}
<option value="{$rid}" {if $rid|in_array:$field.setting}selected="selected"{/if}>{$rtitle|escape}</option>
{/foreach}
</select>
{elseif $field.type == 'file'}
<input type="text" name="fields[{$field.id}][setting]" value="{$field.setting|escape}" title="{#file_size2#}" placeholder="{#file_size#}" class="mousetrap botDir" />
{/if}
</td>
{/if}
<td align="center">
{if !($field.type == 'doc' || $field.type == 'multidoc' || ($field.main && ($field.title == 'copy' || $field.title == 'receivers')))}
<input type="checkbox" class="topDir" name="fields[{$field.id}][required]" value="1" {if $field.required}checked="checked"{/if} title="{#required#}" {if $field.main && $field.title=='captcha'}disabled="disabled"{/if} />
{if $field.main && $field.title=='captcha'}
<input type="hidden" name="fields[{$field.id}][required]" value="1" />
{/if}
{/if}
{if !$field.main && $field.type == 'select'}
<a style="margin-top:5px;" class="botDir icon_sprite ico_info inline" style="display:block;" title="{#select_req_i#}"></a>
{/if}
</td>
<td class="defaultval">
{if $field.main && $field.title=='captcha'}
{elseif $field.type=='input' || $field.type=='textarea'}
<textarea name="fields[{$field.id}][defaultval]" placeholder="{#defaultval#}" class="mousetrap" id="field_defaultval[{$field.id}]" rows="1">{$field.defaultval|escape}</textarea>
<div> |
php |
<a class="docname botDir" title="{#tag_title#}" href="javascript:void(0);" onClick="textSelection_field_defaultval_{$field.id}('[tag:title]','')"><strong>[tag:title]</strong></a> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_field_defaultval_{$field.id}('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_field_defaultval_{$field.id}('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_field_defaultval_{$field.id}('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_field_defaultval_{$field.id}('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
</div>
<!-- Оформляем поле в CodeMirror -->
{if $ave15}
{include file="$codemirror_editor" ctrls='form_save();' conn_id="_field_defaultval_$field_id" textarea_id="field_defaultval[$field_id]" height=60}
{else}
<script>
var editor_field_defaultval_{$field_id} = CodeMirror.fromTextArea(document.getElementById('field_defaultval[{$field_id}]'), {ldelim}
extraKeys: {ldelim}
'Ctrl-S': function(cm) {ldelim}
form_save();
{rdelim}
{rdelim},
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'application/x-httpd-php',
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
tabMode: 'shift',
onChange: function() {ldelim}
editor_field_defaultval_{$field_id}.save();
{rdelim},
onCursorActivity: function() {ldelim}
editor_field_defaultval_{$field_id}.setLineClass(hlLine, null, null);
hlLine = editor_field_defaultval_{$field_id}.setLineClass(editor_field_defaultval_{$field_id}.getCursor().line, null, 'activeline');
{rdelim}
{rdelim});
editor_field_defaultval_{$field_id}.setSize('100%',60);
function getSelectedRange_field_defaultval_{$field_id}() {ldelim}
return {ldelim}
from: editor_field_defaultval_{$field_id}.getCursor(true),
to: editor_field_defaultval_{$field_id}.getCursor(false)
{rdelim};
{rdelim}
function textSelection_field_defaultval_{$field_id}(startTag,endTag) {ldelim}
var range = getSelectedRange_field_defaultval_{$field_id}();
editor_field_defaultval_{$field_id}.replaceRange(startTag + editor_field_defaultval_{$field_id}.getRange(range.from, range.to) + endTag, range.from, range.to)
editor_field_defaultval_{$field_id}.setCursor(range.from.line, range.from.ch + startTag.length);
{rdelim}
</script>
{/if}
{elseif ($field.type=='select' || $field.type=='multiselect')}
{if !$field.setting_empty}
<select name="fields[{$field.id}][defaultval]{if $field.type=='multiselect'}[]{/if}" {if $field.type=='multiselect'}multiple="multiple" size="{$field.setting|@count}" style="width:100%"{/if} class="mousetrap">
{foreach from=$field.setting item=item name=select}
{if $field.main && $field.title=='receivers'}
<option value="{$smarty.foreach.select.index}" {if $smarty.foreach.select.index==$field.defaultval}selected="selected"{/if}>{$item.name|escape}</option>
{else}
<option value="{$smarty.foreach.select.index}" {if ($field.type=='select' && $smarty.foreach.select.index==$field.defaultval) || ($field.type=='multiselect' && $smarty.foreach.select.index|in_array:$field.defaultval)}selected="selected"{/if}>{$item|escape}</option>
{/if}
{/foreach}
</select>
{else}
{#setting_empty#}
{/if}
{elseif $field.type=='checkbox'}
<input type="hidden" name="fields[{$field.id}][defaultval]" value="0">
<input type="checkbox" name="fields[{$field.id}][defaultval]" value="1" {if $field.defaultval}checked="checked"{/if}>
{/if}
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_template form_field_tpl_btn" href="javascript:void(0);" title="{#fld_tpl_toggle#}"></a>
<input type="hidden" class="form_field_tpl_input" name="field_tpl_open[{$field.id}]" value="{if $field_tpl_open[$field_id]}1{else}0{/if}">
</td>
<td align="center">
{if !$field.main}
<a class="topleftDir icon_sprite ico_delete form_field_del" data-confirm="{#fld_del#}" data-confirm-title="{#fld_deleting#}" href="javascript:void(0)" data-field="{$field.id}"></a>
{/if}
</td>
</tr>
<tr class="form_field_tpl_tr {if !$field_tpl_open[$field_id]}hide{/if}">
<td colspan="8">
<div class="col-half">
<h6>{#attributes#}</h6>
<textarea name="fields[{$field.id}][attributes]" id="field_attr[{$field.id}]" placeholder="{#attributes#}" class="mousetrap" rows="8">{$field.attributes|escape}</textarea>
<div> |
php |
<a class="icon_sprite ico_start botDir inline" title="{#tag_attr#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('id=&quot;fld[[tag:id]]&quot; class=&quot;&quot; placeholder=&quot;[tag:title]&quot;','')"></a> |
<a class="docname botDir" title="{#tag_id#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:id]','')"><strong>[tag:id]</strong></a> |
<a class="docname botDir" title="{#tag_title#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:title]','')"><strong>[tag:title]</strong></a> |
<a class="docname botDir" title="{#tag_nempty#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:if_notempty]','[/tag:if_notempty]')"><strong>[tag:if_notempty][/tag:if_notempty]</strong></a> |
<a class="docname botDir" title="{#tag_empty#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:if_empty]','[/tag:if_empty]')"><strong>[tag:if_empty][/tag:if_empty]</strong></a> |
<br> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
{if $field.type=='input' || $field.type=='textarea' || $field.type=='file'}
<br> |
<a class="docname botDir" title="{#tag_valid#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:if_valid]','[/tag:if_valid]')"><strong>[tag:if_valid][/tag:if_valid]</strong></a> |
<a class="docname botDir" title="{#tag_invalid#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:if_invalid]','[/tag:if_invalid]')"><strong>[tag:if_invalid][/tag:if_invalid]</strong></a> |
{/if}
{if $field.main && $field.title == 'captcha'}
<br> |
<a class="docname botDir" title="{#tag_captcha#}" href="javascript:void(0);" onClick="textSelection_field_attr_{$field.id}('[tag:captcha]','')"><strong>[tag:captcha]</strong></a> |
{/if}
</div>
</div>
<div class="col-half">
<h6>{#field_tpl#}</h6>
<textarea name="fields[{$field.id}][tpl]" id="field_tpl[{$field.id}]" placeholder="{#field_tpl#}" class="mousetrap" rows="8">{$field.tpl|escape}</textarea>
<div> |
php |
<a class="docname botDir" title="{#tag_fld_tpl#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:fld]','')"><strong>[tag:fld]</strong></a> |
<a class="docname botDir" title="{#tag_id#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:id]','')"><strong>[tag:id]</strong></a> |
<a class="docname botDir" title="{#tag_title#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:title]','')"><strong>[tag:title]</strong></a> |
<a class="docname botDir" title="{#tag_nempty#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:if_notempty]','[/tag:if_notempty]')"><strong>[tag:if_notempty][/tag:if_notempty]</strong></a> |
<a class="docname botDir" title="{#tag_empty#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:if_empty]','[/tag:if_empty]')"><strong>[tag:if_empty][/tag:if_empty]</strong></a> |
<br> |
<a class="docname botDir" title="{#tag_uemail#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:uemail]','');"><strong>[tag:uemail]</strong></a> |
<a class="docname botDir" title="{#tag_uname#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:uname]','');"><strong>[tag:uname]</strong></a> |
<a class="docname botDir" title="{#tag_ufname#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:ufname]','');"><strong>[tag:ufname]</strong></a> |
<a class="docname botDir" title="{#tag_ulname#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:ulname]','');"><strong>[tag:ulname]</strong></a> |
{if $field.type=='input' || $field.type=='textarea' || $field.type=='file'}
<br> |
<a class="docname botDir" title="{#tag_valid#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:if_valid]','[/tag:if_valid]')"><strong>[tag:if_valid][/tag:if_valid]</strong></a> |
<a class="docname botDir" title="{#tag_invalid#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:if_invalid]','[/tag:if_invalid]')"><strong>[tag:if_invalid][/tag:if_invalid]</strong></a> |
{/if}
{if $field.main && $field.title == 'captcha'}
<br> |
<a class="docname botDir" title="{#tag_captcha#}" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('[tag:captcha]','')"><strong>[tag:captcha]</strong></a> |
<a class="docname" href="javascript:void(0);" onClick="textSelection_field_tpl_{$field.id}('&lt;img src=&quot;[tag:path][tag:captcha]&quot; alt=&quot;Капча&quot;&gt;','')"><strong>captcha_img</strong></a> |
{/if}
</div>
</div>
</td>
</tr>
{/foreach}
<tr>
<td colspan="9"><h6>{#field_add#}</h6></td>
</tr>
<tr>
<td align="center">
<input type="checkbox" class="toprightDir" name="fields[0][active]" value="1" checked="checked" title="{#active_i#}" />
</td>
<td></td>
<td>
<input type="text" name="fields[0][title]" placeholder="{#title#}" class="mousetrap form_fields_new_title" />
</td>
<td>
<select name="fields[0][type]" class="mousetrap">
<option value="input">input</option>
<option value="textarea">textarea</option>
<option value="select">select</option>
<option value="multiselect">multiselect</option>
<option value="checkbox">checkbox</option>
<option value="file">file</option>
<option value="doc">{#doc#}</option>
<option value="multidoc">{#multidoc#}</option>
</select>
</td>
<td colspan="5" align="right">
<input type="hidden" name="fields[0][new]" value="1" />
<input type="button" class="btn greenBtn mousetrap" value="{#add_refresh#} (Ctrl+S)" onClick="if(!$('.form_fields_new_title').val()) jAlert('{#field_new_error#}','{#field_creating#}'); else form_save(true); return false;" />
</td>
</tr>
</tbody>
</table>
<!-- Оформляем поля в CodeMirror -->
{foreach from=$fields item=field key=field_id}
{if $ave15}
{include file="$codemirror_editor" ctrls='form_save();' conn_id="_field_attr_$field_id" textarea_id="field_attr[$field_id]" height=176}
{include file="$codemirror_editor" ctrls='form_save();' conn_id="_field_tpl_$field_id" textarea_id="field_tpl[$field_id]" height=176}
{else}
<script>
// аттрибуты поля
var editor_field_attr_{$field_id} = CodeMirror.fromTextArea(document.getElementById('field_attr[{$field_id}]'), {ldelim}
extraKeys: {ldelim}
'Ctrl-S': function(cm) {ldelim}
form_save();
{rdelim}
{rdelim},
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'application/x-httpd-php',
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
tabMode: 'shift',
onChange: function() {ldelim}
editor_field_attr_{$field_id}.save();
{rdelim},
onCursorActivity: function() {ldelim}
editor_field_attr_{$field_id}.setLineClass(hlLine, null, null);
hlLine = editor_field_attr_{$field_id}.setLineClass(editor_field_attr_{$field_id}.getCursor().line, null, 'activeline');
{rdelim}
{rdelim});
editor_field_attr_{$field_id}.setSize('100%',176);
function getSelectedRange_field_attr_{$field_id}() {ldelim}
return {ldelim}
from: editor_field_attr_{$field_id}.getCursor(true),
to: editor_field_attr_{$field_id}.getCursor(false)
{rdelim};
{rdelim}
function textSelection_field_attr_{$field_id}(startTag,endTag) {ldelim}
var range = getSelectedRange_field_attr_{$field_id}();
editor_field_attr_{$field_id}.replaceRange(startTag + editor_field_attr_{$field_id}.getRange(range.from, range.to) + endTag, range.from, range.to)
editor_field_attr_{$field_id}.setCursor(range.from.line, range.from.ch + startTag.length);
{rdelim}
// шаблон поля
var editor_field_tpl_{$field_id} = CodeMirror.fromTextArea(document.getElementById('field_tpl[{$field_id}]'), {ldelim}
extraKeys: {ldelim}
'Ctrl-S': function(cm) {ldelim}
form_save();
{rdelim}
{rdelim},
lineNumbers: true,
lineWrapping: true,
matchBrackets: true,
mode: 'application/x-httpd-php',
indentUnit: 4,
indentWithTabs: true,
enterMode: 'keep',
tabMode: 'shift',
onChange: function() {ldelim}
editor_field_tpl_{$field_id}.save();
{rdelim},
onCursorActivity: function() {ldelim}
editor_field_tpl_{$field_id}.setLineClass(hlLine, null, null);
hlLine = editor_field_tpl_{$field_id}.setLineClass(editor_field_tpl_{$field_id}.getCursor().line, null, 'activeline');
{rdelim}
{rdelim});
editor_field_tpl_{$field_id}.setSize('100%',176);
function getSelectedRange_field_tpl_{$field_id}() {ldelim}
return {ldelim}
from: editor_field_tpl_{$field_id}.getCursor(true),
to: editor_field_tpl_{$field_id}.getCursor(false)
{rdelim};
{rdelim}
function textSelection_field_tpl_{$field_id}(startTag,endTag) {ldelim}
var range = getSelectedRange_field_tpl_{$field_id}();
editor_field_tpl_{$field_id}.replaceRange(startTag + editor_field_tpl_{$field_id}.getRange(range.from, range.to) + endTag, range.from, range.to)
editor_field_tpl_{$field_id}.setCursor(range.from.line, range.from.ch + startTag.length);
{rdelim}
</script>
{/if}
{/foreach}
<!-- /Оформляем поля в CodeMirror -->
<!-- Скрываем поля -->
<script>
$('.form_field_tpl_tr.hide').hide();
</script>
<!-- /Скрываем поля -->

98
contactsnew/templates/forms.tpl

@ -0,0 +1,98 @@
{literal}
<style>
#forms input {
box-sizing:border-box;
}
</style>
{/literal}
<div class="title">
<h5>{#contacts#}</h5>
</div>
<div class="widget" style="margin-top:0">
<div class="body">{#mod_info#}</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}" class="toprightDir"></a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#contacts#}</a></li>
<li><strong class="code">{#forms#}</strong></li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#forms#}</h5>
<div class="num">
<a class="basicNum" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_edit&amp;cp={$sess}" target="_self">{#form_new#}</a>
</div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm" id="forms">
<colgroup>
<col width="1">
<col>
<col width="1">
<col width="1">
<col width="1">
<col width="1">
<col width="1">
<col width="1">
</colgroup>
<thead>
<tr>
<td>ID</td>
<td>{#title#}</td>
<td>{#tag#}</td>
<td>{#history#}</td>
<td colspan="4">{#actions#}</td>
</tr>
</thead>
<tbody>
{foreach from=$forms item=form}
<tr>
<td align="center">{$form.id}</td>
<td>
<strong><a class="toprightDir" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_edit&amp;fid={$form.id}&amp;cp={$sess}" title="{#edit#}">{$form.title|stripslashes|escape}
</a></strong>
</td>
<td>
<input type="text" id="form_tag" value="[mod_contactsnew:{if $form.alias}{$form.alias}{else}{$form.id}{/if}]" style="width:200px" readonly class="mousetrap" />
</td>
<td nowrap="nowrap">
{if $form.history_new > 0}<strong><a class="topDir doclink" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_list&amp;fid={$form.id}&amp;cp={$sess}" title="{#look#}">{#list_new#}: {$form.history_new}</a></strong>{else}{#list_new#}: {$form.history_new}{/if}<br/>
{#list_viewed#}: {$form.history_viewed}<br/>
{#list_replied#}: {$form.history_replied}
</td>
<td align="center">
<a class="topDir icon_sprite ico_edit" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_edit&amp;fid={$form.id}&amp;cp={$sess}" title="{#edit#}"></a>
</td>
<td align="center">
<a class="topDir icon_sprite ico_query" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_list&amp;fid={$form.id}&amp;cp={$sess}" title="{#history#}"></a>
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_copy" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_copy&amp;fid={$form.id}&amp;cp={$sess}" title="{#copy#}"></a>
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_delete ConfirmDelete" dir="{#deleting#}" name="{#form_deleting#}" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_del&amp;fid={$form.id}&amp;cp={$sess}" title="{#delete#}"></a>
</td>
</tr>
{foreachelse}
<tr>
<td colspan="8">
<ul class="messages">
<li class="highlight yellow">{#noforms#}</li>
</ul>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}

129
contactsnew/templates/history.tpl

@ -0,0 +1,129 @@
{literal}
<style>
#forms input {
box-sizing:border-box;
}
</style>
{/literal}
<script type="text/javascript">
// назначаем языковые переменные (так удобнее работать со smarty)
$smarty = new Array;
$smarty['stat_replied'] = '{#stat_replied#}';
$smarty['stat_viewed'] = '{#stat_viewed#}';
</script>
<div class="title">
<h5>{#contacts#}</h5>
</div>
<div class="widget" style="margin-top:0">
<div class="body">{#mod_info#}</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}" class="toprightDir"></a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#contacts#}</a></li>
<li><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=1&amp;cp={$sess}">{#forms#}</a></li>
<li><strong class="code"><a href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=form_edit&amp;fid={$fid}&amp;cp={$sess}" {if $ave14}style="float:none; display:inline;"{/if}>{$form.title|escape}</a></strong></li>
<li>{#history#}</li>
</ul>
</div>
</div>
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#history#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm" id="forms">
<colgroup>
<col width="100"/>
<col/>
<col width="1"/>
<col width="1"/>
</colgroup>
<thead>
<tr>
<td>{#date#}</td>
<td>{#mfld_subject#}</td>
<td>{#author#}</td>
<td>{#status#}</td>
</tr>
</thead>
<tbody>
{foreach from=$dialogs item=dialog}
<tr class="{if $dialog.status==='new'}green{elseif $dialog.status==='viewed'}yellow{/if}">
<td align="right" nowrap="nowrap">
<span class="date_text dgrey">{$dialog.date|date_format:$TIME_FORMAT|pretty_date}</span>
</td>
<td>
<strong><a class="toprightDir" href="index.php?do=modules&amp;action=modedit&amp;mod=contactsnew&amp;moduleaction=history_dialog&amp;hid={$dialog.id}&amp;cp={$sess}" title="{#look#}">{$dialog.subject|stripslashes|escape}</a></strong>
</td>
<td>
<a href="mailto:{$dialog.email}" title="{#write_email#}" class="topDir">{$dialog.email}</a>
</td>
<td nowrap="nowrap">
{if $dialog.status!='replied'}
<select class="dialog_status" data-hid="{$dialog.id}" onChange="status_change($(this));">
{if $dialog.status=='new'}<option value="">{#stat_new#}</option>{/if}
<option value="viewed">{#stat_viewed#}</option>
<option value="replied">{#stat_replied#}</option>
</select>
{else}{#stat_replied#}
{/if}
</td>
</tr>
{foreachelse}
<tr>
<td colspan="4">
<ul class="messages">
<li class="highlight yellow">{#noforms#}</li>
</ul>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}
{literal}
<script type="text/javascript">
function status_change (sel) {
var status = sel.val();
var td = sel.parents('td');
var hid = sel.attr('data-hid');
$.ajax({
url: 'index.php?do=modules&action=modedit&mod=contactsnew&moduleaction=dialog_status',
type: 'POST',
data: {
hid: hid,
status: status,
ajax: 1
},
beforeSend: function() {
$.alerts._overlay('show');
},
success: function(e) {
$.alerts._overlay('hide');
td.empty();
if (status === 'replied') {
td.text($smarty['stat_replied']);
td.parent().removeClass('yellow');
}
else if (status === 'viewed') {
td.parent().removeClass('green').addClass('yellow');
$('<select class="dialog_status" data-hid="'+hid+'" onChange="status_change($(this));"><option value="viewed">'+$smarty['stat_viewed']+'</option><option value="replied">'+$smarty['stat_replied']+'</option></select>').appendTo(td).jqTransform({imgPath: "../images"}).styler({selectVisibleOptions: 5,selectSearch: false});
}
}
});
};
</script>
{/literal}

8
contactsnew/templates/index.php

@ -0,0 +1,8 @@
<?php
/**
* Файл-заглушка, предназначенный для запрета показа списка файлов в текущей директории,
* если через адресную строку браузера было прямое общращение к данной директории.
*/
header('Location:/');
exit;
?>
Loading…
Cancel
Save