Files
AtomicOld/simpla/design/html/service.tpl
2026-02-14 19:50:25 +03:00

622 lines
28 KiB
Smarty
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{* Вкладки *}
{capture name=tabs}
<li class="active"><a href="index.php?module=ServicesAdmin">Услуги</a></li>
<li><a href="index.php?module=ServicesMenuAdmin">Меню услуг</a></li>
{/capture}
{if $page->id}
{$meta_title = $page->name scope=parent}
{else}
{$meta_title = 'Новая услуга' scope=parent}
{/if}
{* Подключаем Tiny MCE *}
{include file='tinymce_init.tpl'}
{if $message_success}
<!-- Системное сообщение -->
<div class="message message_success">
<span>{if $message_success == 'added'}Услуга добавлена{elseif $message_success == 'updated'}Услуга обновлена{/if}</span>
<a class="link" target="_blank" href="../{$root_url}{$page->url}">Открыть страницу на сайте</a>
{if $smarty.get.return}
<a class="button" href="{$smarty.get.return}">Вернуться</a>
{/if}
</div>
<!-- Системное сообщение (The End)-->
{/if}
{if $message_error}
<!-- Системное сообщение -->
<div class="message message_error">
<span>{if $message_error == 'url_exists'}Страница с таким адресом уже существует{/if}</span>
<a class="button" href="">Вернуться</a>
</div>
<!-- Системное сообщение (The End)-->
{/if}
<!-- Основная форма -->
<form method=post id=product enctype="multipart/form-data">
<input type=hidden name="session_id" value="{$smarty.session.id}">
<div id="name">
<input class="name" name=header type="text" value="{$page->header|escape}"/>
<input name=id type="hidden" value="{$page->id|escape}"/>
<div class="checkbox">
<input name="visible" value='1' type="checkbox" id="active_checkbox" {if $page->visible}checked{/if}/>
<label for="active_checkbox">Активна</label>
</div>
<div class="checkbox">
<input name="show_home" value='1' type="checkbox" id="home_checkbox" {if $page->show_home}checked{/if}/>
<label for="home_checkbox">На главной</label>
</div>
<div class="checkbox">
<input name="show_service" value='1' type="checkbox" id="home_checkbox"
{if $page->show_service}checked{/if}/> <label for="home_checkbox">В услугах</label>
</div>
</div>
<!-- Параметры страницы -->
<div class="block">
<ul>
<li>
<label class=property>Название пункта в меню</label>
<input name="name" class="simpla_inp" type="text" value="{$page->name|escape}"/>
</li>
<li>
<label class=property>Родительский раздел</label>
<select name="parent">
<option value='28'>Верхний уровень</option>
{foreach from=$select_items item=select_item}
<option value='{$select_item->id}'
{if $page->parent == $select_item->id}selected{/if}>{$select_item->name|escape}</option>
{/foreach}
</select>
</li>
</ul>
</div>
<!-- Параметры страницы (The End)-->
<!-- Левая колонка свойств товара -->
<div id="column_left">
<!-- Параметры страницы -->
<div class="block layer">
<h2>Параметры страницы</h2>
<ul>
<li>
<label class=property>Адрес</label>
<div class="page_url">/</div>
<input type="text" name="url" value="{$page->url|escape}" class="page_url" {if $page->brand_id}readonly{/if}/>
</li>
<li>
<label class=property>Заголовок</label>
<input name="meta_title" class="simpla_inp" type="text" value="{$page->meta_title|escape}"/>
</li>
<li>
<label class=property>Ключевые слова</label>
<input name="meta_keywords" class="simpla_inp" type="text" value="{$page->meta_keywords|escape}"/>
</li>
<li>
<label class=property>Описание</label>
<textarea name="meta_description" class="simpla_inp">{$page->meta_description|escape}</textarea>
</li>
</ul>
</div>
<!-- Параметры страницы (The End)-->
{* Услуга по брендам *}
{if $page->menu_id == 3 && !$page->brand_id}
<div class="block layer">
<h2>Услуга по маркам авто</h2>
<div id="service_brands" class="mb-2">
{if $service_brands}
{foreach $service_brands as $brand}
<div data-brand-id="{$brand->id}" class="d-flex mt-2 brand_row">
<input type="hidden" name="brands[]" value="{$brand->id}">
<div class="name flex-grow-1"><a href="/simpla/index.php?module=ServiceAdmin&id={$brand->page_id}" target="_blank">{$brand->name}</a></div>
<div class="icons"><a class="preview" href="/{$root_url}{$brand->page_url}/" target="_blank" title="Посмотреть на сайте"></a></div>
<div class="icons"><a class="enable {if !$brand->page_visible}a-invisible{else}a-visible{/if}" data-id="{$brand->page_id}" href="#" title="Активировать/Деактивировать"></a></div>
<div class="icons"><a class="delete" href="#" title="Удалить"></a></div>
</div>
{/foreach}
{/if}
</div>
<select id="brands_autocomplete" class="mt-2">
<option value="">Выберите марку для добавления</option>
{foreach $brands as $brand}
<option value="{$brand->id}">{$brand->name}</option>
{/foreach}
</select>
<div class="text- mt-1">
или <a id="add_all_brands" class="" href="#">добавьте все марки</a>
</div>
</div>
{/if}
</div>
<!-- Левая колонка свойств товара (The End)-->
<!-- Правая колонка свойств товара -->
<div id="column_right">
<!-- Изображение категории -->
<div class="block layer images">
<h2>Изображение</h2>
<input class='upload_image' name=image type=file>
<input type=hidden name="delete_image" value="">
{if $page->image}
<ul>
<li>
<a href='#' class="delete"><img src='design/images/cross-circle-frame.png'></a>
<img src="{$page->image|resizepage:100:100}" alt=""/>
</li>
</ul>
{/if}
</div>
<div class="block">
<h2>Связанные товары <small>(Хиты продаж)</small></h2>
<div id=list class="related_products">
{foreach from=$related_products item=related_product}
<div class="row">
<div class="name cell">
<input type=hidden name=related_products[] value='{$related_product->id}'>
<a href="/simpla/index.php?module=ProductAdmin&id={$related_product->id}">{$related_product->name}</a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
{/foreach}
<div id="new_related_product" class="row" style='display:none;'>
<div class="name cell">
<input type=hidden name=related_products[] value=''>
<a class="related_product_name" href=""></a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
</div>
<input type=text name=related id='related_products' class="input_autocomplete"
placeholder='Выберите товар чтобы добавить его'>
</div>
<div class="block layer">
<h2>Связанные страницы (Другие услуги)</h2>
<div id=list class="related_pages">
{foreach from=$related_pages item=related_page}
<div class="row">
<div class="name cell">
<input type=hidden name=related_pages[] value='{$related_page->id}'>
<a href="{url id=$related_page->id}">{$related_page->name}</a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
{/foreach}
<div id="new_related_page" class="row" style='display:none;'>
<div class="name cell">
<input type=hidden name=related_pages[] value=''>
<a class="related_page_name" href=""></a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
</div>
<input type=text name=related id='related_pages' class="input_autocomplete"
placeholder='Выберите статью чтобы добавить ее'>
</div>
<div class="block layer">
<h2>Связанные страницы (Примеры работ)</h2>
<div id=list class="related_articles">
{foreach from=$related_articles item=related_page}
<div class="row">
<div class="name cell">
<input type=hidden name=related_articles[] value='{$related_page->id}'>
<a href="/simpla/index.php?module=ArticleAdmin&id={$related_page->id}">{$related_page->name}</a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
{/foreach}
<div id="new_related_article" class="row" style='display:none;'>
<div class="name cell">
<input type=hidden name=related_articles[] value=''>
<a class="related_article_name" href=""></a>
</div>
<div class="icons cell">
<a href='#' class="delete"></a>
</div>
<div class="clear"></div>
</div>
</div>
<input type=text name=related id='related_articles' class="input_autocomplete"
placeholder='Выберите статью чтобы добавить ее'>
</div>
<div class="block layer">
<ul>
<li>
<label style="float:none;" class=property>Ссылка на все работы</label>
<input style="width:90%" name="works_url" type="text" value="{$page->works_url}"/>
</li>
<li>
<label style="float:none;" class=property>Текст ссылки</label>
<input style="width:90%" name="works_url_text" class="simpla_inp" type="text"
value="{$page->works_url_text|escape}"/>
</li>
</ul>
</div>
</div>
<!-- Правая колонка свойств товара (The End)-->
<!-- Параметры страницы -->
<div class="block layer">
<h2>Краткое содержание</h2>
<textarea name="introtext" style="width: 100%; height: 100px;"
id="_introtext">{$page->introtext|escape}</textarea>
</div>
<!-- Параметры страницы (The End)-->
<!-- Параметры страницы -->
<div class="block layer">
<h2>Текст перед текстом страницы</h2>
<textarea name="toptext" class="editor_large" id="_toptext">{$page->toptext|escape}</textarea>
</div>
<!-- Параметры страницы (The End)-->
<!-- Описагние товара -->
<div class="block layer">
<h2>Текст страницы</h2>
<textarea name="body" id="_body" class="editor_large">{$page->body|escape}</textarea>
</div>
<!-- Описание товара (The End)-->
<!-- Параметры страницы -->
<div class="block layer">
<h2>Текст после текста страницы</h2>
<textarea name="bottext" class="editor_large" id="_bottext">{$page->bottext|escape}</textarea>
</div>
<!-- Параметры страницы (The End)-->
<input class="button_green button_save" type="submit" name="" value="Сохранить"/>
</form>
<!-- Основная форма (The End) -->
{* On document load *}
{literal}
<script src="design/js/jquery/datepicker/jquery.ui.datepicker-ru.js"></script>
<script src="design/js/autocomplete/jquery.autocomplete-min.js"></script>
<style>
.autocomplete-w1 {
position: absolute;
top: 0px;
left: 0px;
margin: 6px 0 0 6px; /* IE6 fix: */
_background: none;
_margin: 1px 0 0 0;
}
.autocomplete {
border: 1px solid #999;
background: #FFF;
cursor: default;
text-align: left;
overflow-x: auto;
min-width: 300px;
overflow-y: auto;
margin: -6px 6px 6px -6px; /* IE6 specific: */
_height: 350px;
_margin: 0;
_overflow-x: hidden;
}
.autocomplete .selected {
background: #F0F0F0;
}
.autocomplete div {
padding: 2px 5px;
white-space: nowrap;
}
.autocomplete strong {
font-weight: normal;
color: #3399FF;
}
</style>
<script>
$(function () {
// Удаление связанного товара
$(".related_products a.delete").live('click', function () {
$(this).closest("div.row").fadeOut(200, function () {
$(this).remove();
});
return false;
});
// Добавление связанного товара
var new_related_product = $('#new_related_product').clone(true);
$('#new_related_product').remove().removeAttr('id');
$("input#related_products").autocomplete({
serviceUrl: 'ajax/search_products.php',
minChars: 0,
noCache: false,
onSelect:
function (value, data) {
new_item = new_related_product.clone().appendTo('.related_products');
new_item.removeAttr('id');
new_item.find('a.related_product_name').html(data.name);
new_item.find('a.related_product_name').attr('href', 'index.php?module=ProductAdmin&id=' + data.id);
new_item.find('input[name*="related_products"]').val(data.id);
$("#related_products").val('');
new_item.show();
},
fnFormatResult:
function (value, data, currentValue) {
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
return value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
}
});
// Удаление связанноq статьи
$(".related_pages a.delete").live('click', function () {
$(this).closest("div.row").fadeOut(200, function () {
$(this).remove();
});
return false;
});
// Добавление связанной статьи
var new_related_page = $('#new_related_page').clone(true);
$('#new_related_page').remove().removeAttr('id');
$("input#related_pages").autocomplete({
serviceUrl: 'ajax/search_pages.php',
minChars: 0,
noCache: false,
onSelect:
function (value, data) {
new_item = new_related_page.clone().appendTo('.related_pages');
new_item.removeAttr('id');
new_item.find('a.related_page_name').html(data.name);
new_item.find('a.related_page_name').attr('href', 'index.php?module=pageAdmin&id=' + data.id);
new_item.find('input[name*="related_pages"]').val(data.id);
$("#related_pages").val('');
new_item.show();
},
fnFormatResult:
function (value, data, currentValue) {
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
return value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
}
});
// Удаление связанноq статьи
$(".related_articles a.delete").live('click', function () {
$(this).closest("div.row").fadeOut(200, function () {
$(this).remove();
});
return false;
});
// Добавление связанной статьи
var new_related_article = $('#new_related_article').clone(true);
$('#new_related_article').remove().removeAttr('id');
$("input#related_articles").autocomplete({
serviceUrl: 'ajax/search_articles.php',
minChars: 0,
noCache: false,
onSelect:
function (value, data) {
new_item = new_related_article.clone().appendTo('.related_articles');
new_item.removeAttr('id');
new_item.find('a.related_article_name').html(data.name);
new_item.find('a.related_article_name').attr('href', 'index.php?module=articleAdmin&id=' + data.id);
new_item.find('input[name*="related_articles"]').val(data.id);
$("#related_articles").val('');
new_item.show();
},
fnFormatResult:
function (value, data, currentValue) {
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
return value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
}
});
$(".images a.delete").click(function () {
$("input[name='delete_image']").val('1');
$(this).closest("ul").fadeOut(200, function () {
$(this).remove();
});
return false;
});
// Автозаполнение мета-тегов
menu_item_name_touched = true;
meta_title_touched = true;
meta_keywords_touched = true;
meta_description_touched = true;
url_touched = true;
if ($('input[name="menu_item_name"]').val() == generate_menu_item_name() || $('input[name="name"]').val() == '')
menu_item_name_touched = false;
if ($('input[name="meta_title"]').val() == generate_meta_title() || $('input[name="meta_title"]').val() == '')
meta_title_touched = false;
if ($('input[name="meta_keywords"]').val() == generate_meta_keywords() || $('input[name="meta_keywords"]').val() == '')
meta_keywords_touched = false;
if ($('textarea[name="meta_description"]').val() == generate_meta_description() || $('textarea[name="meta_description"]').val() == '')
meta_description_touched = false;
if ($('input[name="url"]').val() == generate_url())
url_touched = false;
$('input[name="name"]').change(function () {
menu_item_name_touched = true;
});
$('input[name="meta_title"]').change(function () {
meta_title_touched = true;
});
$('input[name="meta_keywords"]').change(function () {
meta_keywords_touched = true;
});
$('textarea[name="meta_description"]').change(function () {
meta_description_touched = true;
});
$('input[name="url"]').change(function () {
url_touched = true;
});
if ($('input[name="name"]').val() == '') {
$('input[name="header"]').keyup(function () {
set_meta();
});
}
});
function set_meta() {
/* MODIFICATION /15.04.2016/ coder:SP отключено автозаполнение титла и кейворда */
if (!menu_item_name_touched)
$('input[name="name"]').val(generate_menu_item_name());
if (!meta_title_touched)
/* $('input[name="meta_title"]').val(generate_meta_title());*/
if (!meta_keywords_touched)
/* $('input[name="meta_keywords"]').val(generate_meta_keywords()); */
if (!meta_description_touched) {
descr = $('textarea[name="meta_description"]');
descr.val(generate_meta_description());
descr.scrollTop(descr.outerHeight());
}
if (!url_touched)
$('input[name="url"]').val(generate_url());
}
function generate_menu_item_name() {
name = $('input[name="header"]').val();
return name;
}
function generate_meta_title() {
name = $('input[name="header"]').val();
return name;
}
function generate_meta_keywords() {
name = $('input[name="header"]').val();
return name;
}
function generate_meta_description() {
/* if(typeof(tinyMCE.get("body")) =='object')
{
description = tinyMCE.get("body").getContent().replace(/(<([^>]+)>)/ig," ").replace(/(\&nbsp;)/ig," ").replace(/^\s+|\s+$/g, '').substr(0, 512);
return description;
}
else
return $('textarea[name=body]').val().replace(/(<([^>]+)>)/ig," ").replace(/(\&nbsp;)/ig," ").replace(/^\s+|\s+$/g, '').substr(0, 512);
*/
}
function generate_url() {
url = $('input[name="header"]').val();
url = url.replace(/[\s]+/gi, '-');
url = translit(url);
url = url.replace(/[^0-9a-z_\-]+/gi, '').toLowerCase();
return url;
}
function translit(str) {
var ru = ("А-а-Б-б-В-в-Ґ-ґ-Г-г-Д-д-Е-е-Ё-ё-Є-є-Ж-ж-З-з-И-и-І-і-Ї-ї-Й-й-К-к-Л-л-М-м-Н-н-О-о-П-п-Р-р-С-с-Т-т-У-у-Ф-ф-Х-х-Ц-ц-Ч-ч-Ш-ш-Щ-щ-Ъ-ъ-Ы-ы-Ь-ь-Э-э-Ю-ю-Я-я").split("-")
var en = ("A-a-B-b-V-v-G-g-G-g-D-d-E-e-E-e-E-e-ZH-zh-Z-z-I-i-I-i-I-i-J-j-K-k-L-l-M-m-N-n-O-o-P-p-R-r-S-s-T-t-U-u-F-f-H-h-TS-ts-CH-ch-SH-sh-SCH-sch-'-'-Y-y-'-'-E-e-YU-yu-YA-ya").split("-")
var res = '';
for (var i = 0, l = str.length; i < l; i++) {
var s = str.charAt(i), n = ru.indexOf(s);
if (n >= 0) {
res += en[n];
} else {
res += s;
}
}
return res;
}
</script>
{/literal}
{literal}
<script>
$(document).ready(function () {
var $brands_list = $('#service_brands');
function create_brand_row(brand_id, brand_name) {
return '<div data-brand-id="' + brand_id + '" class="d-flex mt-2 brand_row">' +
' <input type="hidden" name="brands[]" value="' + brand_id + '">' +
' <div class="name flex-grow-1">' + brand_name + '</div>' +
' <div class="icons"><a class="delete" href="#" title="Удалить"></a></div>' +
'</div>';
}
$("#brands_autocomplete").on('change', function () {
var id = this.value,
name = $("option:selected", this).text();
if (!$('[data-brand-id="' + id + '"]', $brands_list).length)
$brands_list.append(create_brand_row(id, name));
$(this).val('');
});
$('#add_all_brands').click(function () {
$brands_list.empty();
$("option", $("#brands_autocomplete")).each(function () {
if (this.value)
$brands_list.append(create_brand_row(this.value, $(this).text()));
});
return false;
})
$brands_list.click(function (e) {
var $el = $(e.target);
if ($el.is('a')) {
if ($el.hasClass('delete')) {
$el.parents('.brand_row').remove();
return false;
} else if($el.hasClass('enable')) {
$.ajax({
type: 'POST',
url: 'ajax/update_object.php',
dataType: 'json',
data: {
'object': 'page',
'action': 'enable',
'id': $el.data('id'),
'values': {'visible': $el.hasClass('a-invisible') ? 1 : 0},
'session_id': '{/literal}{$smarty.session.id}{literal}'
},
beforeSend: function () {
$el.addClass('loading_icon');
},
success: function (data) {
$el.toggleClass('a-invisible').toggleClass('a-visible');
$el.removeClass('loading_icon');
}
});
}
}
});
});
</script>
{/literal}