213 lines
7.5 KiB
Smarty
213 lines
7.5 KiB
Smarty
|
|
{capture name=tabs}
|
|||
|
|
<li class="active"><a href="{url module=BlogAdmin id=null page=null}">Блог</a></li>
|
|||
|
|
{/capture}
|
|||
|
|
|
|||
|
|
{if $post->id}
|
|||
|
|
{$meta_title = $post->name scope=parent}
|
|||
|
|
{else}
|
|||
|
|
{$meta_title = 'Новая запись в блоге' scope=parent}
|
|||
|
|
{/if}
|
|||
|
|
|
|||
|
|
{* Подключаем Tiny MCE *}
|
|||
|
|
{include file='tinymce_init.tpl'}
|
|||
|
|
|
|||
|
|
{* On document load *}
|
|||
|
|
{literal}
|
|||
|
|
<script src="design/js/jquery/datepicker/jquery.ui.datepicker-ru.js"></script>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
$(function() {
|
|||
|
|
|
|||
|
|
update = {/literal}{if $post->url}true;{else}false;{/if}{literal}
|
|||
|
|
|
|||
|
|
$('input[name="date"]').datepicker({
|
|||
|
|
regional:'ru'
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// Автозаполнение мета-тегов
|
|||
|
|
meta_title_touched = true;
|
|||
|
|
meta_keywords_touched = true;
|
|||
|
|
meta_description_touched = true;
|
|||
|
|
url_touched = true;
|
|||
|
|
|
|||
|
|
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() || $('input[name="url"]').val() == '')
|
|||
|
|
url_touched = false;
|
|||
|
|
|
|||
|
|
$('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; });
|
|||
|
|
|
|||
|
|
$('input[name="name"]').keyup(function() { set_meta(); });
|
|||
|
|
$('select[name="brand_id"]').change(function() { set_meta(); });
|
|||
|
|
$('select[name="categories[]"]').change(function() { set_meta(); });
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function set_meta()
|
|||
|
|
{
|
|||
|
|
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 && !update)
|
|||
|
|
$('input[name="url"]').val(generate_url());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function generate_meta_title()
|
|||
|
|
{
|
|||
|
|
name = $('input[name="name"]').val();
|
|||
|
|
return name;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function generate_meta_keywords()
|
|||
|
|
{
|
|||
|
|
name = $('input[name="name"]').val();
|
|||
|
|
return name;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function generate_meta_description()
|
|||
|
|
{
|
|||
|
|
if(typeof(tinyMCE.get("annotation")) =='object')
|
|||
|
|
{
|
|||
|
|
description = tinyMCE.get("annotation").getContent().replace(/(<([^>]+)>)/ig," ").replace(/(\ )/ig," ").replace(/^\s+|\s+$/g, '').substr(0, 512);
|
|||
|
|
return description;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
return $('textarea[name=annotation]').val().replace(/(<([^>]+)>)/ig," ").replace(/(\ )/ig," ").replace(/^\s+|\s+$/g, '').substr(0, 512);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function generate_url()
|
|||
|
|
{
|
|||
|
|
url = $('input[name="name"]').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}
|
|||
|
|
|
|||
|
|
{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="../blog/{$post->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=name type="text" value="{$post->name|escape}"/>
|
|||
|
|
<input name=id type="hidden" value="{$post->id|escape}"/>
|
|||
|
|
<div class="checkbox">
|
|||
|
|
<input name=visible value='1' type="checkbox" id="active_checkbox" {if $post->visible}checked{/if}/> <label for="active_checkbox">Активна</label>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- Левая колонка свойств товара -->
|
|||
|
|
<div id="column_left">
|
|||
|
|
|
|||
|
|
<!-- Параметры страницы -->
|
|||
|
|
<div class="block">
|
|||
|
|
<ul>
|
|||
|
|
<li><label class=property>Дата</label><input type=text name=date value='{$post->date|date}'></li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
<div class="block layer">
|
|||
|
|
<!-- Параметры страницы (The End)-->
|
|||
|
|
<h2>Параметры страницы</h2>
|
|||
|
|
<!-- Параметры страницы -->
|
|||
|
|
<ul>
|
|||
|
|
<li><label class=property>Адрес</label><div class="page_url"> /blog/</div><input name="url" class="page_url" type="text" value="{$post->url|escape}" /></li>
|
|||
|
|
<li><label class=property>Заголовок</label><input name="meta_title" type="text" value="{$post->meta_title|escape}" /></li>
|
|||
|
|
<li><label class=property>Ключевые слова</label><input name="meta_keywords" type="text" value="{$post->meta_keywords|escape}" /></li>
|
|||
|
|
<li><label class=property>Описание</label><textarea name="meta_description" />{$post->meta_description|escape}</textarea></li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
<!-- Параметры страницы (The End)-->
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</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 $post->image}
|
|||
|
|
<ul>
|
|||
|
|
<li>
|
|||
|
|
<a href='#' class="delete"><img src='design/images/cross-circle-frame.png'></a>
|
|||
|
|
<img src="{$post->image|resizepost:100:100}" alt="" />
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
{/if}
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- Правая колонка свойств товара (The End)-->
|
|||
|
|
|
|||
|
|
<!-- Описагние товара -->
|
|||
|
|
<div class="block layer">
|
|||
|
|
<h2>Краткое описание</h2>
|
|||
|
|
<textarea name="annotation" class='editor_small'>{$post->annotation|escape}</textarea>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="block">
|
|||
|
|
<h2>Полное описание</h2>
|
|||
|
|
<textarea name="body" class='editor_large'>{$post->text|escape}</textarea>
|
|||
|
|
</div>
|
|||
|
|
<!-- Описание товара (The End)-->
|
|||
|
|
<input class="button_green button_save" type="submit" name="" value="Сохранить" />
|
|||
|
|
|
|||
|
|
</form>
|
|||
|
|
<!-- Основная форма (The End) -->
|