Poll Maker v2

This commit is contained in:
YJSoft 2015-06-12 18:50:13 +09:00
parent 660da39c60
commit f550e45012
5 changed files with 41 additions and 15 deletions

View file

@ -18,8 +18,8 @@
<description xml:lang="ru">Вы можете присоединить опрос при написании статей. Компонент опросов зависит от настроек модуля отпросов.</description>
<description xml:lang="zh-TW">發表主題時可以附加投票調查。投票調查組件受投票調查模組設置的影響。</description>
<description xml:lang="tr">Oylamaları yazı makalelerine ekleyebilirsiniz. Oylama bileşeni, oylama modülü ayarlarından ayarlanır.</description>
<version>1.7</version>
<date>2013-11-27</date>
<version>2.0</version>
<date>2015-06-09</date>
<author email_address="developers@xpressengine.com" link="http://xpressengine.com/">
<name xml:lang="vi">NAVER</name>

View file

@ -27,7 +27,7 @@ class poll_maker extends EditorHandler
{
// Wanted Skins survey
$oModuleModel = getModel('module');
$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/poll/');
$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'widgets/pollWidget/');
Context::set('skin_list', $skin_list);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
@ -45,17 +45,29 @@ class poll_maker extends EditorHandler
*/
function transHTML($xml_obj)
{
$poll_srl = $xml_obj->attrs->poll_srl;
$args = new stdClass();
$args->poll_srl = $xml_obj->attrs->poll_srl;
$skin = $xml_obj->attrs->skin;
if(!$skin) $skin = 'default';
$args->skin = $skin;
preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$width = $matches[2];
if(!$width) $width = 400;
$style = sprintf('width:%dpx', $width);
// poll model object creation to come get it return html
$oPollModel = getModel('poll');
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
$args->style = sprintf('width:%dpx', $width);
// Set a path of the template skin (values of skin, colorset settings)
$tpl_path = sprintf('%sskins/%s', _XE_PATH_ . 'widgets/pollWidget/', $args->skin);
$tpl_file = 'pollview';
Context::set('colorset', $args->colorset);
Context::set('poll_srl', $args->poll_srl);
Context::set('style', $args->style);
// Compile a template
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
}
/* End of file poll_maker.class.php */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -18,8 +18,8 @@
<div class="x_control-group">
<label for="" class="x_control-label">{$lang->poll_stop_date}</label>
<div class="x_controls">
<input type="hidden" name="stop_date" id="stop_date" value="{date('Ymd',time()+60*60*24*7)}" />
<input type="date" class="inputDate" value="{date('Y-m-d',time()+60*60*24*7)}" />
<input type="hidden" name="stop_date" id="stop_date" value="{date('Ymd',time()+60*60*24*30)}" />
<input type="date" class="inputDate" value="{date('Y-m-d',time()+60*60*24*30)}" />
<script>
(function($){
$(function(){
@ -31,7 +31,7 @@ $(function(){
, onSelect:function(){
$(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""));
}
,minDate: new Date("{date('Y-m-d',time())}")
,minDate: new Date("{date('Y-m-d',time()+60*60*24*30)}")
};
$.extend(option,$.datepicker.regional['{$lang_type}']);
$(".inputDate").datepicker(option);
@ -42,15 +42,30 @@ $(function(){
</div>
</div>
<div class="x_control-group">
<label for="" class="x_control-label">{$lang->skin}</label>
<label for="skin" class="x_control-label">{$lang->skin}</label>
<div class="x_controls">
<select name="skin">
<select id="skin" name="skin">
<!--@foreach($skin_list as $skin=>$skin_info)-->
<option value="{$skin}">{$skin_info->title} (skin by {$skin_info->maker->name})</option>
<option value="{$skin}">{$skin_info->title} (skin by <!--@foreach($skin_info->author as $author=>$author_info)-->{@ $authorname = array(); $authorname[] = $author_info->name; }<!--@end-->{implode(",",$authorname)})</option>
<!--@end-->
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">사용자 공개</label>
<div class="x_controls">
<input type="radio" name="show_vote" value="1" /> 투표한 사용자 공개
<input type="radio" name="show_vote" value="0" checked="checked" /> 투표한 사용자 비공개
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">항목 추가</label>
<div class="x_controls">
<input type="radio" name="add_item" value="2" /> 항목 추가 가능
<input type="radio" name="add_item" value="0" checked="checked" /> 항목 추가 금지
</div>
</div>
<div id="poll_source" style="display:none">
<div class="table">
<table class="x_table x_table-striped x_table-hover">

View file

@ -16,7 +16,6 @@ function completeInsertPoll(ret_obj) {
if(!poll_srl) return null;
var text = "<img src=\"../../../../common/img/blank.gif\" poll_srl=\""+poll_srl+"\" editor_component=\"poll_maker\" skin=\""+skin+"\" style=\"display:block;width:400px;height:300px;border:2px dotted #4371B9;background:url(./modules/editor/components/poll_maker/tpl/poll_maker_component.gif) no-repeat center;\" />";
alert(ret_obj['message']);
opener.editorFocus(opener.editorPrevSrl);