mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 07:09:56 +09:00
issue 44 : Remove x-functions from the poll module
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8495 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
657061e16a
commit
db7403c469
12 changed files with 63 additions and 92 deletions
75
modules/poll/tpl/js/poll.js
Normal file
75
modules/poll/tpl/js/poll.js
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* 설문 참여 함수 */
|
||||
function doPoll(fo_obj) {
|
||||
|
||||
var checkcount = new Array();
|
||||
var item = new Array();
|
||||
|
||||
for(var i=0;i<fo_obj.length;i++) {
|
||||
var obj = fo_obj[i];
|
||||
if(obj.nodeName != 'INPUT') continue;
|
||||
|
||||
var name = obj.name;
|
||||
if(name.indexOf('checkcount')>-1) {
|
||||
var t = name.split('_');
|
||||
var poll_srl_index = parseInt(t[1],10);
|
||||
checkcount[poll_srl_index] = obj.value;
|
||||
item[poll_srl_index] = new Array();
|
||||
|
||||
} else if(name.indexOf('item_')>-1) {
|
||||
var t = name.split('_');
|
||||
var poll_srl = parseInt(t[1],10);
|
||||
var poll_srl_index = parseInt(t[2],10);
|
||||
if(obj.checked == true) item[poll_srl_index][item[poll_srl_index].length] = obj.value;
|
||||
}
|
||||
}
|
||||
|
||||
var poll_srl_indexes = "";
|
||||
for(var poll_srl_index in checkcount) {
|
||||
if(!checkcount.hasOwnProperty(poll_srl_index)) continue;
|
||||
var count = checkcount[poll_srl_index];
|
||||
var items = item[poll_srl_index];
|
||||
if(items.length < 1 || count < items.length) {
|
||||
alert(poll_alert_lang);
|
||||
return false;
|
||||
}
|
||||
|
||||
poll_srl_indexes += items.join(',')+',';
|
||||
}
|
||||
fo_obj.poll_srl_indexes.value = poll_srl_indexes;
|
||||
|
||||
procFilter(fo_obj, poll);
|
||||
return false;
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
/* View poll result */
|
||||
$('._poll_result').click(function(){
|
||||
var cls = $(this).attr('class'), srl, skin;
|
||||
|
||||
try{
|
||||
srl = cls.match(/\b_srl_(\d+)\b/)[1];
|
||||
skin = cls.match(/\b_skin_(.+?)\b/)[1];
|
||||
}catch(e){ };
|
||||
|
||||
if(!srl) return false;
|
||||
if(!skin) skin = 'default';
|
||||
|
||||
function on_complete(ret) {
|
||||
var $poll = $('#poll_'+srl), width;
|
||||
|
||||
width = $poll.width();
|
||||
$poll.html(ret['tpl']);
|
||||
$poll.width(width);
|
||||
}
|
||||
|
||||
exec_xml(
|
||||
'poll', // module
|
||||
'procPollViewResult', // act
|
||||
{poll_srl:srl, skin:skin}, // parameters
|
||||
on_complete,
|
||||
['error','message','tpl']
|
||||
);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
2
modules/poll/tpl/js/poll.min.js
vendored
Normal file
2
modules/poll/tpl/js/poll.min.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
function doPoll(fo_obj){var checkcount=new Array(),item=new Array();for(var i=0;i<fo_obj.length;i++){var obj=fo_obj[i];if(obj.nodeName!='INPUT')continue;var name=obj.name;if(name.indexOf('checkcount')>-1){var t=name.split('_'),poll_srl_index=parseInt(t[1],10);checkcount[poll_srl_index]=obj.value;item[poll_srl_index]=new Array()}else if(name.indexOf('item_')>-1){var t=name.split('_'),poll_srl=parseInt(t[1],10),poll_srl_index=parseInt(t[2],10);if(obj.checked==true)item[poll_srl_index][item[poll_srl_index].length]=obj.value}};var poll_srl_indexes="";for(var poll_srl_index in checkcount){if(!checkcount.hasOwnProperty(poll_srl_index))continue;var count=checkcount[poll_srl_index],items=item[poll_srl_index];if(items.length<1||count<items.length){alert(poll_alert_lang);return false};poll_srl_indexes+=items.join(',')+','};fo_obj.poll_srl_indexes.value=poll_srl_indexes;procFilter(fo_obj,poll);return false};jQuery(function($){$('._poll_result').click(function(){var cls=$(this).attr('class'),srl,skin;try{srl=cls.match(/\b_srl_(\d+)\b/)[1];skin=cls.match(/\b_skin_(.+?)\b/)[1]}catch(e){};if(!srl)return false;if(!skin)skin='default'
|
||||
function on_complete(ret){var $poll=$('#poll_'+srl),width;width=$poll.width();$poll.html(ret.tpl);$poll.width(width)};exec_xml('poll','procPollViewResult',{poll_srl:srl,skin:skin},on_complete,['error','message','tpl']);return false})})
|
||||
|
|
@ -19,7 +19,7 @@ function doDisplaySkinColorset(sel, colorset) {
|
|||
|
||||
/* 서버에서 받아온 컬러셋을 표시 */
|
||||
function completeGetSkinColorset(ret_obj, response_tags, params, fo_obj) {
|
||||
var sel = xGetElementById("fo_poll").poll_colorset;
|
||||
var sel = get_by_id("fo_poll").poll_colorset;
|
||||
var length = sel.options.length;
|
||||
var selected_colorset = params["colorset"];
|
||||
for(var i=0;i<length;i++) sel.remove(0);
|
||||
|
|
|
|||
9
modules/poll/tpl/js/poll_admin.min.js
vendored
Normal file
9
modules/poll/tpl/js/poll_admin.min.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @file modules/poll/js/poll_admin.js
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief poll 모듈의 관리자용 javascript
|
||||
**/
|
||||
function doDisplaySkinColorset(sel,colorset){var skin=sel.options[sel.selectedIndex].value,params=new Array();params.skin=skin;params.colorset=colorset;var response_tags=new Array("error","message","colorset_list");exec_xml("poll","getPollGetColorsetList",params,completeGetSkinColorset,response_tags,params)}
|
||||
function completeGetSkinColorset(ret_obj,response_tags,params,fo_obj){var sel=get_by_id("fo_poll").poll_colorset,length=sel.options.length,selected_colorset=params.colorset;for(var i=0;i<length;i++)sel.remove(0);var colorset_list=ret_obj.colorset_list.split("\n"),selected_index=0;for(var i=0;i<colorset_list.length;i++){var tmp=colorset_list[i].split("|@|");if(selected_colorset&&selected_colorset==tmp[0])selected_index=i;var opt=new Option(tmp[1],tmp[0],false,false);sel.options.add(opt)};sel.selectedIndex=selected_index}
|
||||
function doMovePoll(poll_srl,upload_target_srl){var params=new Array();params.poll_srl=poll_srl;params.upload_target_srl=upload_target_srl;var response_tags=new Array('error','message','document_srl','comment_srl');exec_xml('poll','getPollAdminTarget',params,completeMovePoll,response_tags)}
|
||||
function completeMovePoll(ret_obj,response_tags){var document_srl=ret_obj.document_srl,comment_srl=ret_obj.comment_srl,url=request_uri.setQuery('document_srl',document_srl);if(comment_srl)url=url+'#comment_'+comment_srl;winopen(url,'pollTarget')}
|
||||
Loading…
Add table
Add a link
Reference in a new issue