mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
issue 47 Refactore the 'poll_maker' editor component.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8479 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4a50363cb1
commit
9142149a3a
11 changed files with 209 additions and 216 deletions
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
|
||||
$lang->poll_title = "Title";
|
||||
$lang->poll_item = "Items";
|
||||
$lang->poll_stop_date = "Expiration Date";
|
||||
$lang->poll_chk_count = "Number of Checking Item";
|
||||
$lang->poll_title = "Title";
|
||||
$lang->poll_item = "Items";
|
||||
$lang->poll_stop_date = "Expiration Date";
|
||||
$lang->poll_chk_count = "Number of Checking Item";
|
||||
|
||||
$lang->cmd_add_poll = "Add Poll";
|
||||
$lang->cmd_del_poll = "Delete Poll";
|
||||
$lang->cmd_add_item = "Add Item";
|
||||
$lang->cmd_add_poll = "Add a poll";
|
||||
$lang->cmd_del_poll = "Delete this poll";
|
||||
$lang->cmd_add_item = "Add an item";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = "You cannot modify the poll. You need to delete it if you want to create a new poll.";
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = "You cannot modify the poll. You need to delete it if you want to create a new poll.";
|
||||
|
||||
/* file : en.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
|
||||
$lang->poll_title = "Titulo";
|
||||
$lang->poll_item = "Temas";
|
||||
$lang->poll_stop_date = "Fecha de Expiracion";
|
||||
$lang->poll_chk_count = "Numero de Comprobacion de Partida";
|
||||
$lang->poll_title = "Titulo";
|
||||
$lang->poll_item = "Temas";
|
||||
$lang->poll_stop_date = "Fecha de Expiracion";
|
||||
$lang->poll_chk_count = "Numero de Comprobacion de Partida";
|
||||
|
||||
$lang->cmd_add_poll = "Anadir Encuesta";
|
||||
$lang->cmd_del_poll = "Borrar encuesta";
|
||||
$lang->cmd_add_item = "Anadir Tema";
|
||||
$lang->cmd_add_poll = "Anadir Encuesta";
|
||||
$lang->cmd_del_poll = "Borrar encuesta";
|
||||
$lang->cmd_add_item = "Anadir Tema";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = "No se puede modificar la encuesta. Por lo que debe suprimirse para crear una nueva encuesta";
|
||||
$lang->msg_poll_cannot_modify = "No se puede modificar la encuesta. Por lo que debe suprimirse para crear una nueva encuesta";
|
||||
|
||||
?>
|
||||
/* file : en.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file modules/editor/components/urllink/lang/jp.lang.php
|
||||
* @author NHN (developers@xpressengine.com) 翻訳:RisaPapa、ミニミ
|
||||
* @brief ウィジウィグエディター(editor)モジュール > アンケート調査言語パッケージ
|
||||
**/
|
||||
/**
|
||||
* @file modules/editor/components/urllink/lang/jp.lang.php
|
||||
* @author NHN (developers@xpressengine.com) 翻訳:RisaPapa、ミニミ
|
||||
* @brief ウィジウィグエディター(editor)モジュール > アンケート調査言語パッケージ
|
||||
**/
|
||||
|
||||
$lang->poll_title = "タイトル";
|
||||
$lang->poll_item = "項目";
|
||||
$lang->poll_stop_date = "終了日";
|
||||
$lang->poll_chk_count = "選択項目数";
|
||||
$lang->poll_title = "タイトル";
|
||||
$lang->poll_item = "項目";
|
||||
$lang->poll_stop_date = "終了日";
|
||||
$lang->poll_chk_count = "選択項目数";
|
||||
|
||||
$lang->cmd_add_poll = "アンケート追加";
|
||||
$lang->cmd_del_poll = "アンケート削除";
|
||||
$lang->cmd_add_item = "項目追加";
|
||||
$lang->cmd_add_poll = "アンケート追加";
|
||||
$lang->cmd_del_poll = "アンケート削除";
|
||||
$lang->cmd_add_item = "項目追加";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = 'アンケートは修正出来ません。削除後、改めて新しく作成して下さい。';
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = 'アンケートは修正出来ません。削除後、改めて新しく作成して下さい。';
|
||||
|
||||
/* file : jp.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file modules/editor/components/urllink/lang/ko.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief 위지윅에디터(editor) 모듈 > 설문조사 컴포넌트의 언어팩
|
||||
**/
|
||||
/**
|
||||
* @file modules/editor/components/urllink/lang/ko.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief 위지윅에디터(editor) 모듈 > 설문조사 컴포넌트의 언어팩
|
||||
**/
|
||||
|
||||
$lang->poll_title = '제목';
|
||||
$lang->poll_item = '항목';
|
||||
$lang->poll_stop_date = '종료 일자';
|
||||
$lang->poll_chk_count = '선택항목 수';
|
||||
$lang->poll_title = '제목';
|
||||
$lang->poll_item = '항목';
|
||||
$lang->poll_stop_date = '종료 일자';
|
||||
$lang->poll_chk_count = '선택항목 수';
|
||||
|
||||
$lang->cmd_add_poll = '설문 추가';
|
||||
$lang->cmd_del_poll = '설문 제거';
|
||||
$lang->cmd_add_item = '항목 추가';
|
||||
$lang->cmd_add_poll = '설문 추가';
|
||||
$lang->cmd_del_poll = '설문 제거';
|
||||
$lang->cmd_add_item = '항목 추가';
|
||||
$lang->cmd_del_item = '마지막 항목 제거';
|
||||
|
||||
$lang->msg_poll_cannot_modify = '설문조사는 수정하실 수 없습니다. 삭제 후 다시 생성하셔야 합니다.';
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = '설문조사는 수정할 수 없습니다. 삭제 후 다시 생성하셔야 합니다.';
|
||||
|
||||
/* file : ko.lang.php */
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
$lang->cmd_add_poll = "Добавить опрос";
|
||||
$lang->cmd_del_poll = "Удалить опрос";
|
||||
$lang->cmd_add_item = "Добавить пункт";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = "Вы не можете изменить этот опрос. Его следует удалить для того, чтобы создать новый.";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
/**
|
||||
* @file /modules/editor/components/poll_maker/lang/tr.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module > language pack of poll_maker component
|
||||
**/
|
||||
|
||||
$lang->poll_title = "Başlık";
|
||||
$lang->poll_item = "Parça";
|
||||
$lang->poll_stop_date = "Sonlandırma Tarihi";
|
||||
$lang->poll_chk_count = "Denetlenen Parça Sayısı";
|
||||
$lang->poll_title = "Başlık";
|
||||
$lang->poll_item = "Parça";
|
||||
$lang->poll_stop_date = "Sonlandırma Tarihi";
|
||||
$lang->poll_chk_count = "Denetlenen Parça Sayısı";
|
||||
|
||||
$lang->cmd_add_poll = "Oylama Ekle";
|
||||
$lang->cmd_del_poll = "Parçayı Sil";
|
||||
$lang->cmd_add_item = "Parça Ekle";
|
||||
$lang->cmd_add_poll = "Oylama Ekle";
|
||||
$lang->cmd_del_poll = "Parçayı Sil";
|
||||
$lang->cmd_add_item = "Parça Ekle";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = "Oylamayı düzenleyemezsiniz. Yeni oylama oluşturmak için, oylamanın silinmesi gerekiyor.";
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = "Oylamayı düzenleyemezsiniz. Yeni oylama oluşturmak için, oylamanın silinmesi gerekiyor.";
|
||||
|
||||
/* file : tr.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,20 +1,22 @@
|
|||
<?php
|
||||
/* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
||||
░░ * @File : common/lang/vi.lang.php ░░
|
||||
░░ * @Author : NHN (developers@xpressengine.com) ░░
|
||||
░░ * @Trans : Đào Đức Duy (ducduy.dao.vn@vietxe.net) ░░
|
||||
░░ * @Website: http://vietxe.net ░░
|
||||
░░ * @Brief : Vietnamese Language Pack (Only basic words are included here) ░░
|
||||
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ */
|
||||
/**
|
||||
* @File : common/lang/vi.lang.php
|
||||
* @Author : NHN (developers@xpressengine.com)
|
||||
* @Trans : Đào Đức Duy (ducduy.dao.vn@vietxe.net)
|
||||
* @Website: http://vietxe.net
|
||||
* @Brief : Vietnamese Language Pack (Only basic words are included here)
|
||||
*/
|
||||
|
||||
$lang->poll_title = "Tiêu đề";
|
||||
$lang->poll_item = "Mục";
|
||||
$lang->poll_stop_date = "Ngày hết hạn";
|
||||
$lang->poll_chk_count = "Số phiếu";
|
||||
$lang->poll_title = "Tiêu đề";
|
||||
$lang->poll_item = "Mục";
|
||||
$lang->poll_stop_date = "Ngày hết hạn";
|
||||
$lang->poll_chk_count = "Số phiếu";
|
||||
|
||||
$lang->cmd_add_poll = "Tạo thăm dò";
|
||||
$lang->cmd_del_poll = "Xóa thăm dò";
|
||||
$lang->cmd_add_item = "Thêm mục";
|
||||
$lang->cmd_add_poll = "Tạo thăm dò";
|
||||
$lang->cmd_del_poll = "Xóa thăm dò";
|
||||
$lang->cmd_add_item = "Thêm mục";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = "Bạn không thể sửa đổi được. Nó sẽ được xóa để tạo cuộc thăm dò mới.";
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = "Bạn không thể sửa đổi được. Nó sẽ được xóa để tạo cuộc thăm dò mới.";
|
||||
|
||||
/* file : vi.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/urllink/lang/zh-CN.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief 网页编辑器(editor) 模块 > 投票调查组件语言包
|
||||
**/
|
||||
/**
|
||||
* @file /modules/editor/components/urllink/lang/zh-CN.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief 网页编辑器(editor) 模块 > 投票调查组件语言包
|
||||
**/
|
||||
|
||||
$lang->poll_title = "标题";
|
||||
$lang->poll_item = "项目";
|
||||
$lang->poll_stop_date = "结束日期";
|
||||
$lang->poll_chk_count = "选择项目数";
|
||||
$lang->poll_title = "标题";
|
||||
$lang->poll_item = "项目";
|
||||
$lang->poll_stop_date = "结束日期";
|
||||
$lang->poll_chk_count = "选择项目数";
|
||||
|
||||
$lang->cmd_add_poll = "添加投票";
|
||||
$lang->cmd_del_poll = "解除投票";
|
||||
$lang->cmd_add_item = "添加项目";
|
||||
$lang->cmd_add_poll = "添加投票";
|
||||
$lang->cmd_del_poll = "解除投票";
|
||||
$lang->cmd_add_item = "添加项目";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = '投票调查不提供修改功能。必须删除后再生成';
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = '投票调查不提供修改功能。必须删除后再生成';
|
||||
|
||||
/* file : zh-CN.lang.php */
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file /modules/editor/components/urllink/lang/zh-TW.lang.php
|
||||
* @author NHN (developers@xpressengine.com) 翻譯:royallin
|
||||
* @brief 網頁編輯器(editor) 模組 > 投票調查組件語言
|
||||
**/
|
||||
/**
|
||||
* @file /modules/editor/components/urllink/lang/zh-TW.lang.php
|
||||
* @author NHN (developers@xpressengine.com) 翻譯:royallin
|
||||
* @brief 網頁編輯器(editor) 模組 > 投票調查組件語言
|
||||
**/
|
||||
|
||||
$lang->poll_title = "標題";
|
||||
$lang->poll_item = "項目";
|
||||
$lang->poll_stop_date = "結束日期";
|
||||
$lang->poll_chk_count = "選擇項目數";
|
||||
$lang->poll_title = "標題";
|
||||
$lang->poll_item = "項目";
|
||||
$lang->poll_stop_date = "結束日期";
|
||||
$lang->poll_chk_count = "選擇項目數";
|
||||
|
||||
$lang->cmd_add_poll = "新增投票";
|
||||
$lang->cmd_del_poll = "刪除投票";
|
||||
$lang->cmd_add_item = "新增項目";
|
||||
$lang->cmd_add_poll = "新增投票";
|
||||
$lang->cmd_del_poll = "刪除投票";
|
||||
$lang->cmd_add_item = "新增項目";
|
||||
$lang->cmd_del_item = "Delete last item";
|
||||
|
||||
$lang->msg_poll_cannot_modify = '投票調查不提供修改功能。必須刪除後再新增';
|
||||
?>
|
||||
$lang->msg_poll_cannot_modify = '投票調查不提供修改功能。必須刪除後再新增';
|
||||
|
||||
/* file : zh-TW.lang.php */
|
||||
|
|
|
|||
|
|
@ -89,16 +89,17 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<a href="#" onclick="doPollAddItem(this); return false;" class="button black small"><span>{$lang->cmd_add_item}</span></a>
|
||||
<a href="#" onclick="doPollDelete(this); return false;" class="button red small"><span>{$lang->cmd_del_poll}</span></a>
|
||||
<button type="button" class="_add_item">{$lang->cmd_add_item}</button>
|
||||
<button type="button" class="_del_item">{$lang->cmd_del_item}</button>
|
||||
<button type="button" class="_del_poll">{$lang->cmd_del_poll}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="popFooter">
|
||||
<span class="button black strong"><input type="submit" value="{$lang->cmd_submit}" /></span>
|
||||
<a href="#" onclick="doPollAdd(); return false;" class="button blue"><span>{$lang->cmd_add_poll}</span></a>
|
||||
<a href="#" onclick="winopen('./?module=editor&act=dispEditorComponentInfo&component_name={$component_info->component_name}','ComponentInfo','left=10,top=10,width=10,height=10,resizable=no,scrollbars=no,toolbars=no');return false;" class="button"><span>{$lang->about_component}</span></a>
|
||||
<button type="button" id="add_poll">{$lang->cmd_add_poll}</button>
|
||||
<a href="./?module=editor&act=dispEditorComponentInfo&component_name={$component_info->component_name}" class="button _xe_popup"><span>{$lang->about_component}</span></a>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,30 +2,6 @@
|
|||
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 block이 있는지 체크하여
|
||||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
var poll_index = 1;
|
||||
function setPoll() {
|
||||
var node = opener.editorPrevNode;
|
||||
if(node && node.getAttribute('editor_component')=='poll_maker') {
|
||||
alert(msg_poll_cannot_modify);
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = xCreateElement("div");
|
||||
var source = xGetElementById("poll_source");
|
||||
|
||||
var html = xInnerHtml(source);
|
||||
html = html.replace(/tidx/g, poll_index);
|
||||
xInnerHtml(obj, html);
|
||||
|
||||
obj.id = "poll_"+poll_index;
|
||||
obj.className = "poll_box";
|
||||
obj.style.display = "block";
|
||||
|
||||
source.parentNode.insertBefore(obj, source);
|
||||
|
||||
setFixedPopupSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 부모창의 위지윅에디터에 데이터를 삽입
|
||||
|
|
@ -52,93 +28,93 @@ function completeInsertPoll(ret_obj) {
|
|||
return null;
|
||||
}
|
||||
|
||||
xAddEventListener(window, "load", setPoll);
|
||||
jQuery(function($){
|
||||
var $node, poll_last_idx = 1;
|
||||
|
||||
/**
|
||||
* 새 설문 추가
|
||||
**/
|
||||
function doPollAdd() {
|
||||
var obj = xCreateElement("div");
|
||||
var source = xGetElementById("poll_source");
|
||||
if(poll_index+1>8) return null;
|
||||
poll_index++;
|
||||
$node = $(opener.editorPrevNode);
|
||||
if($node.length && $node.attr('editor_component') == 'poll_maker') {
|
||||
alert(msg_poll_cannot_modify);
|
||||
return window.close();
|
||||
}
|
||||
|
||||
var html = xInnerHtml(source);
|
||||
html = html.replace(/tidx/g, poll_index);
|
||||
xInnerHtml(obj, html);
|
||||
// Add a new poll
|
||||
$('#add_poll').click(function(){
|
||||
addPoll();
|
||||
setFixedPopupSize();
|
||||
});
|
||||
|
||||
obj.id = "poll_"+poll_index;
|
||||
obj.className = "poll_box";
|
||||
obj.style.display = "block";
|
||||
// Add a new item
|
||||
$('button._add_item').click(function(){
|
||||
var $tr_src, $tr_new, $th, idx;
|
||||
|
||||
source.parentNode.insertBefore(obj, source);
|
||||
$tr_src = $(this).prev('table').find('>tbody>tr:last');
|
||||
$tr_new = $tr_src.clone();
|
||||
|
||||
setFixedPopupSize();
|
||||
match = $tr_src.find('td>input').attr('name').match(/item_(\d+)_(\d+)$/);
|
||||
if(!match) return;
|
||||
|
||||
return null;
|
||||
}
|
||||
match[2]++;
|
||||
|
||||
/**
|
||||
* 항목 삭제
|
||||
**/
|
||||
function doPollDelete(obj) {
|
||||
var pobj = xPrevSib(xPrevSib(obj)).lastChild.lastChild;
|
||||
if(!pobj || typeof(pobj.id)=='undefined') return;
|
||||
var tmp_arr = pobj.id.split('_');
|
||||
var index = tmp_arr[1];
|
||||
if(index==1) return;
|
||||
($th=$tr_new.find('th')).html( $th.html().replace(/ \d+/, ' '+match[2]) );
|
||||
$tr_new.find('td>input').attr('name', 'item_'+match[1]+'_'+match[2]);
|
||||
|
||||
pobj.parentNode.removeChild(pobj);
|
||||
$tr_src.after($tr_new);
|
||||
|
||||
var obj_list = xGetElementsByClassName('poll_box');
|
||||
for(var i=0;i<obj_list.length;i++) {
|
||||
var nobj = obj_list[i];
|
||||
if(nobj.id == 'poll_source') continue;
|
||||
var tmp_arr = nobj.id.split('_');
|
||||
var index = tmp_arr[1];
|
||||
nobj.id = 'poll_'+(i+1);
|
||||
}
|
||||
poll_index = i-1;
|
||||
setFixedPopupSize();
|
||||
});
|
||||
|
||||
setFixedPopupSize();
|
||||
}
|
||||
// delete an item
|
||||
$('button._del_item').click(function(){
|
||||
var $tr, match;
|
||||
|
||||
/**
|
||||
* 새 항목 추가
|
||||
**/
|
||||
function doPollAddItem(obj) {
|
||||
var tbl = xPrevSib(obj);
|
||||
var tbody = tbl.lastChild;
|
||||
var tmp = tbody.firstChild;
|
||||
var source = null;
|
||||
while(tmp.nextSibling) {
|
||||
tmp = tmp.nextSibling;
|
||||
if(tmp.nodeName == "TR") source = tmp;
|
||||
}
|
||||
$tr = $(this).prevAll('table:first').find('>tbody>tr:last');
|
||||
match = $tr.find('td>input').attr('name').match(/item_(\d+)_(\d+)/);
|
||||
if(!match || match[2] == 2) return;
|
||||
|
||||
var new_obj = source.cloneNode(true);
|
||||
new_obj.className = source.className;
|
||||
source.parentNode.appendChild(new_obj);
|
||||
$tr.remove();
|
||||
|
||||
var html = xInnerHtml(new_obj);
|
||||
var idx_match = html.match(/ ([0-9]+)</i);
|
||||
var idx = parseInt(idx_match[1],10);
|
||||
setFixedPopupSize();
|
||||
});
|
||||
|
||||
var tmp = new_obj.firstChild;
|
||||
while(tmp) {
|
||||
if(tmp.nodeName == "TH") {
|
||||
var html = xInnerHtml(tmp);
|
||||
html = html.replace(/ ([0-9]+)/, ' '+(idx+1));
|
||||
xInnerHtml(tmp, html);
|
||||
} else if(tmp.nodeName == "TD") {
|
||||
var html = xInnerHtml(tmp);
|
||||
html = html.replace(/item_([0-9]+)_([0-9]+)/, 'item_$1_'+(idx+1));
|
||||
xInnerHtml(tmp, html);
|
||||
}
|
||||
tmp = tmp.nextSibling;
|
||||
}
|
||||
// delete a poll
|
||||
$('button._del_poll').click(function(){
|
||||
$(this).parent('.poll_box').remove();
|
||||
|
||||
setFixedPopupSize();
|
||||
reindex();
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
function reindex() {
|
||||
var $polls = $('.poll_box'); $inputs = $polls.find('input'), poll_idx = 0;
|
||||
|
||||
$inputs.attr('name', function(idx, val) {
|
||||
if(/^checkcount_/.test(val)) poll_idx++;
|
||||
return val.replace(/^([a-z]+_)(?:tidx|\d+)/, '$1'+poll_idx);
|
||||
});
|
||||
|
||||
// If there are two or more polls, show 'delete poll' button.
|
||||
// Otherwise hide the button.
|
||||
if($polls.length > 1) {
|
||||
$polls.find('button._del_poll').show();
|
||||
} else {
|
||||
$polls.find('button._del_poll').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function addPoll() {
|
||||
var $src = $('#poll_source');
|
||||
|
||||
$src.before(
|
||||
$src.clone(true)
|
||||
.removeAttr('id')
|
||||
.addClass('poll_box')
|
||||
.css('display', 'block')
|
||||
);
|
||||
|
||||
reindex();
|
||||
}
|
||||
|
||||
// add a poll
|
||||
addPoll();
|
||||
});
|
||||
|
||||
jQuery(window).load(setFixedPopupSize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue