You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
299 lines
9.3 KiB
299 lines
9.3 KiB
<script language="Javascript" type="text/javascript" src="/modules/poll/admin/js/iColorPicker.js"></script> |
|
|
|
<script language="Javascript" type="text/javascript"> |
|
|
|
$(document).ready(function(){ldelim} |
|
|
|
{literal} |
|
(function($) { |
|
$.fn.tableSortable = function(options) { |
|
options = $.extend({}, $.fn.tableSortable.defaults, options); |
|
this.sortable({ |
|
items: options.items, |
|
axis: 'y', |
|
cursor: 'move', |
|
tolerance: 'pointer', |
|
handle: options.handle, |
|
helper: 'clone', |
|
placeholder: 'sortable-placeholder', |
|
start: function( event, ui ) { |
|
// задаём placeholder |
|
$(this).find(' .sortable-placeholder').html(ui.item.html()).css('opacity',0.3); |
|
// назначаем колонкам ширину |
|
origTd = $(this).find(' .sortable-placeholder td'); |
|
ui.helper.find(' td').each(function(index, element) { |
|
$(element).width(origTd.eq(index).width()); |
|
}); |
|
}, |
|
stop: function( event, ui ) { |
|
// удаляем ширину колонок |
|
ui.item.find(' tr:first td').each(function(index, element) { |
|
$(element).width(''); |
|
}); |
|
}, |
|
update: function( event, ui ) { |
|
// отправляем результаты сортировки |
|
sorted = $(this).sortable('serialize', { |
|
key: options.key+'[]', |
|
attribute: options.attr |
|
}); |
|
$.ajax({ |
|
url: options.url+'&'+sorted, |
|
success: function () { |
|
$.jGrowl(options.success,{theme: 'accept'}); |
|
} |
|
}); |
|
} |
|
}); |
|
}; |
|
|
|
$.fn.tableSortable.defaults = { |
|
items: 'tr', |
|
handle: '.ico_navigation', |
|
url: 'index.php?', |
|
key: 'sort', |
|
attr: 'data-id', |
|
success: 'Порядок сохранён' |
|
}; |
|
|
|
})(jQuery); |
|
{/literal} |
|
|
|
$('#published').datetimepicker({ldelim} |
|
changeMonth: true, |
|
changeYear: true, |
|
stepHour: 1, |
|
stepMinute: 1, |
|
|
|
onClose: function(dateText, inst) {ldelim} |
|
var endDateTextBox = $('#expire'); |
|
if (endDateTextBox.val() != '') {ldelim} |
|
var testStartDate = new Date(dateText); |
|
var testEndDate = new Date(endDateTextBox.val()); |
|
if (testStartDate > testEndDate) |
|
endDateTextBox.val(dateText); |
|
{rdelim} |
|
else {ldelim} |
|
endDateTextBox.val(dateText); |
|
{rdelim} |
|
{rdelim} |
|
{rdelim}); |
|
|
|
$('#expire').datetimepicker({ldelim} |
|
changeMonth: true, |
|
changeYear: true, |
|
|
|
stepHour: 1, |
|
stepMinute: 1, |
|
|
|
onClose: function(dateText, inst) {ldelim} |
|
var startDateTextBox = $('#published'); |
|
if (startDateTextBox.val() != '') {ldelim} |
|
var testStartDate = new Date(startDateTextBox.val()); |
|
var testEndDate = new Date(dateText); |
|
if (testStartDate > testEndDate) |
|
startDateTextBox.val(dateText); |
|
{rdelim} |
|
else {ldelim} |
|
startDateTextBox.val(dateText); |
|
{rdelim} |
|
{rdelim}, |
|
onSelect: function (selectedDateTime){ldelim} |
|
var end = $(this).datetimepicker('getDate'); |
|
$('#published').datetimepicker('option', 'maxDate', new Date(end.getTime()) ); |
|
{rdelim} |
|
{rdelim}); |
|
|
|
// Сортировка |
|
$('#itemsId').tableSortable({ldelim} |
|
url: 'index.php?do=modules&action=modedit&mod=poll&moduleaction=edit&sub=sortable&cp={$sess}', |
|
success: '{#POLL_POSITION_SUCCES#}' |
|
{rdelim}); |
|
|
|
{rdelim}); |
|
</script> |
|
|
|
|
|
{if $smarty.request.moduleaction == 'new'} |
|
<div class="title"><h5>{#POLL_ADD_POLL#}</h5></div> |
|
|
|
<div class="widget" style="margin-top: 0px;"> |
|
<div class="body"> |
|
{#POLL_NEW_INFO#} |
|
</div> |
|
</div> |
|
{else} |
|
<div class="title"><h5>{#POLL_EDIT#}</h5></div> |
|
|
|
<div class="widget" style="margin-top: 0px;"> |
|
<div class="body"> |
|
{#POLL_EDIT_INFO#} |
|
</div> |
|
</div> |
|
{/if} |
|
|
|
<div class="breadCrumbHolder module"> |
|
<div class="breadCrumb module"> |
|
<ul> |
|
<li class="firstB"><a href="#" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li> |
|
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li> |
|
<li><a href="index.php?do=modules&action=modedit&mod=poll&moduleaction=1&cp={$sess}">{#POLL_MODULE_NAME#}</a></li> |
|
{if $smarty.request.moduleaction == 'new'} |
|
<li><strong class="code">{#POLL_ADD_POLL#}</strong></li> |
|
{else} |
|
<li>{#POLL_EDIT#}</li> |
|
<li><strong class="code">{$row->poll_title|default:''}</strong></li> |
|
{/if} |
|
</ul> |
|
</div> |
|
</div> |
|
|
|
|
|
<form method="post" action="{$formaction}" class="mainForm"> |
|
|
|
<div class="widget first"> |
|
<div class="head"> |
|
<h5 class="iFrames">{if $smarty.request.id != ''}{#POLL_EDIT#}{else}{#POLL_ADD_POLL#}{/if}</h5> |
|
</div> |
|
|
|
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm"> |
|
<col width="200"> |
|
<tr> |
|
<td>{#POLL_NAME#}:</td> |
|
<td colspan="3"> |
|
<div class="pr12"><input name="poll_name" type="text" id="poll_name" value="{$row->poll_title|default:''}" size="20" /></div> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td>{#POLL_STATUS#}?</td> |
|
<td colspan="3"> |
|
<input type="radio" name="poll_status" id="poll_status" {if $row->poll_status==1}checked{/if} value="1"/><label>{#POLL_YES#}</label> |
|
<input type="radio" name="poll_status" id="poll_status" {if $row->poll_status==0}checked{/if} value="0" /><label>{#POLL_NO#}</label> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td>{#POLL_CAN_COMMENT#}</td> |
|
<td colspan="3"> |
|
<input type="radio" name="poll_can_comment" id="poll_can_comment" value="1" {if $row->poll_can_comment==1}checked{/if} /><label>{#POLL_YES#}</label> |
|
<input type="radio" name="poll_can_comment" id="poll_can_comment" value="0" {if $row->poll_can_comment==0}checked{/if} /><label>{#POLL_NO#}</label> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td>{#POLL_START_TIME#}</td> |
|
<td> |
|
<input id="published" name="poll_published" type="text" value="{if $row->poll_end}{$row->poll_start|date_format:"%d.%m.%Y %H:%M"}{else}{$published|date_format:"%d.%m.%Y %H:%M"}{/if}" style="width: 150px;" /> |
|
</td> |
|
<td>{#POLL_END_TIME#}</td> |
|
<td> |
|
<input id="expire" name="poll_expire" type="text" value="{if $row->poll_end}{$row->poll_end|date_format:"%d.%m.%Y %H:%M"}{else}{$expire|date_format:"%d.%m.%Y %H:%M"}{/if}" style="width: 150px;" /> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td valign="top">{#POLL_USER_GROUPS#}<br /><small>{#POLL_GROUP_INFO#}</small></td> |
|
<td colspan="3"> |
|
<select class="select" style="width:200px" name="groups[]" size="5" multiple="multiple"> |
|
{html_options options=$groups selected=$selected} |
|
</select> |
|
</td> |
|
</tr> |
|
</table> |
|
|
|
{if $smarty.request.id != ''} |
|
</div> |
|
<div class="widget first"> |
|
<div class="head"> |
|
<h5 class="iFrames">{#POLL_QUESTIONS#}</h5> |
|
</div> |
|
|
|
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm"> |
|
<col width="10" /> |
|
<col width="10" /> |
|
<col /> |
|
<col width="160" /> |
|
<col width="100" /> |
|
<thead> |
|
<tr> |
|
<td align="center"><div align="center"><span class="icon_sprite ico_delete"></span></div></td> |
|
<td align="center"></td> |
|
<td>{#POLL_QUESTION_NAME#}</td> |
|
<td>{#POLL_QUESTION_COLOR#} </td> |
|
<td>{#POLL_QUESTION_HITS#}</td> |
|
</tr> |
|
</thead> |
|
<tbody id="itemsId"> |
|
{if $items} |
|
{foreach from=$items item=item} |
|
<tr data-id="item_{$item->id}"> |
|
<td> |
|
<input title="{#POLL_MARK_DELETE#}" name="del[{$item->id}]" class="topDir" type="checkbox" id="del[{$item->id}]" value="1" /> |
|
</td> |
|
<td> |
|
<div align="center"><span class="icon_sprite ico_navigation" style="cursor: move;"></span></div> |
|
</td> |
|
<td > |
|
<div class="pr12"><input name="item_title[{$item->id}]" type="text" id="item_title[{$item->id}]" value="{$item->poll_item_title}" /></div> |
|
</td> |
|
<td> |
|
<input maxlength="7" style="width: 100px;" type="text" name="line_color[{$item->id}]" value="{$item->poll_item_color}" class="iColorPicker" id="line_color{$item->id}" /> |
|
</td> |
|
<td> |
|
<input style="width:80px" name="poll_item_hits[{$item->id}]" type="text" id="poll_item_hits[{$item->id}]" value="{$item->poll_item_hits}" /> |
|
</td> |
|
</tr> |
|
{/foreach} |
|
{else} |
|
<tr> |
|
<td colspan="5"> |
|
<ul class="messages"> |
|
<li class="highlight yellow">{#POLL_QUESTION_NO_ITEMS#}</li> |
|
</ul> |
|
</td> |
|
</tr> |
|
{/if} |
|
</tbody> |
|
</table> |
|
|
|
{/if} |
|
<div class="rowElem"> |
|
<input type="submit" class="basicBtn" value="{#POLL_BUTTON_SAVE#}" /> |
|
</div> |
|
</div> |
|
</form> |
|
|
|
{if $smarty.request.id != ''} |
|
<div class="widget first"> |
|
<div class="head"> |
|
<h5 class="iFrames">{#POLL_QUESTIONS_ADD#}</h5> |
|
</div> |
|
<form method="post" action="index.php?do=modules&action=modedit&mod=poll&moduleaction=save_new&cp={$sess}&id={$smarty.request.id|escape}" name="new"> |
|
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm"> |
|
<col /> |
|
<col width="160" /> |
|
<col width="100" /> |
|
<thead> |
|
<tr> |
|
<td>{#POLL_QUESTION_NAME#}</td> |
|
<td>{#POLL_QUESTION_COLOR#} </td> |
|
<td>{#POLL_QUESTION_HITS#}</td> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<tr> |
|
<td> |
|
<div class="pr12"><input name="item_title" type="text" id="item_title" value="" /></div> |
|
</td> |
|
<td> |
|
<input maxlength="7" style="width: 100px;" type="text" name="line_color" class="iColorPicker" value="" id="color1" /> |
|
</td> |
|
<td> |
|
<input style="width:80px" name="poll_item_hits" type="text" id="poll_item_hits" value="" /> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"><input type="submit" class="basicBtn" value="{#POLL_BUTTON_ADD#}" /></td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
</form> |
|
</div> |
|
{/if} |