Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

+46 -29
View File
@@ -18,6 +18,7 @@ _poll.prototype.poll = {
_choices: $H(),
votes: $H(),
multi: $H(),
popup: false,
effectDuration: 0.3,
@@ -39,6 +40,19 @@ _poll.prototype.poll = {
*/
initPoll: function()
{
ipb.poll.popup = new ipb.Popup( 'poll_popup', { type: 'pane',
initial: $('poll_wrap'),
modal: true,
hideAtStart: true,
hideClose: true,
defer: false,
w: '700px',
h: 300
});
//if( $('check_public_poll') ){ $('check_public_poll').tooltip(); }
//if( $('check_poll_only') ){ $('check_poll_only').tooltip(); }
// Are there any questions so far?
if( ipb.poll.questions.size() > 0 )
{
@@ -71,6 +85,8 @@ _poll.prototype.poll = {
var html = ipb.templates['poll_question'].evaluate( { qid: qid, value: question } );
$( 'poll_container' ).insert( html );
Debug.write( $('poll_container').innerHTML );
// Allowing multiple choice?
if( ipb.poll.multi.get( qid ) == 1 ){
$('multi_' + qid).checked = true;
@@ -118,27 +134,17 @@ _poll.prototype.poll = {
ipb.poll.updateStatus();
if( $('add_new_question') ){
$('add_new_question').observe('click', ipb.poll.addQuestion );
$('add_new_question').on('click', ipb.poll.addQuestion );
}
// What should we show?
if( ipb.poll.showOnLoad ){
$('add_poll').hide();
$('poll_wrap').show();
} else {
$('poll_wrap').hide();
$('add_poll').show();
}
$('add_poll').down('li').observe('click', ipb.poll.toggleForm);
$('add_poll').observe('click', ipb.poll.toggleForm);
$('close_poll').observe('click', ipb.poll.toggleForm);
// We need to hook an event onto the form for this poll,
// so we can make sure they have entered enough choices
var form = $('poll_form').up('form');
var form = $('add_poll').up('form');
if( !Object.isUndefined( form ) )
{
if( !Object.isUndefined( form ) ){
$( form ).observe('submit', ipb.poll.submitCheckPoll );
}
},
@@ -154,22 +160,41 @@ _poll.prototype.poll = {
{
var stop = false;
if( ipb.poll._choices.size() > 1 )
if( ipb.poll._choices.size() > 0 )
{
ipb.poll._choices.each( function( q ){
if( q.value.size() < 2 ){
stop = true;
return;
}
// Bug #31129 - check for filled values
var filled_values = q.value.select( function( c ){
if( $('poll_' + q.key + '_' + c.key) ){
return !$('poll_' + q.key + '_' + c.key).value.empty();
}
});
if( filled_values.length < 2 ){
stop = true;
return;
}
});
if( stop == true )
{
ipb.poll.popup.show();
alert( ipb.lang['poll_not_enough_choices'] );
Event.stop(e);
return false;
}
}
// Move the popup contents back into the form
try {
$('poll_wrap').hide();
$('add_poll').insert({ after: $('poll_wrap') });
} catch(err){ }
},
/* ------------------------------ */
@@ -197,25 +222,16 @@ _poll.prototype.poll = {
{
Event.stop(e);
if( $('poll_wrap').visible() ){
$('add_poll').show();
// No choices, so destroy poll
/*if( ipb.poll._choices.size() == 0 )
{
ipb.poll.destroyPoll( e );
}*/
if( ipb.poll.popup.getObj().visible() ){
ipb.poll.popup.hide();
} else {
$('add_poll').hide();
// Add a default question
if( ipb.poll._choices.size() == 0 )
{
if( ipb.poll._choices.size() == 0 ){
ipb.poll.addQuestion( e, 1 );
}
ipb.poll.popup.show();
}
Effect.toggle( $('poll_wrap'), 'blind', { duration: ipb.poll.effectDuration } );
},
/* ------------------------------ */
@@ -317,6 +333,7 @@ _poll.prototype.poll = {
*/
addQuestion: function(e, instant)
{
Debug.write("Here");
Event.stop(e);
if( ipb.poll._choices.size() >= ipb.poll.maxQuestions ){