Utente:FixBot/DeletionBot/main2.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
(18 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 1:
var guiTimeout = 0;
if (wgTitle == "FixBot/DeletinBot/GUI")
{
Riga 7 ⟶ 8:
function testGUI()
{
form_data = '<select id="giorno" name="giorno" style="height:
form_data += '<select id="mese" name="mese" style="margin-left:2px; height:
form_data += '<input type="text" id="anno" name="anno" id="anno" size="4" style="margin-left:2px; height:
form_data += '<label style="margin-left:100px;">Giorni:</label><input type="text" name="giorni" id="giorni" size="2" style="margin-left:2px; height:
form_runBot = ' <button type="button" id="RunBot_button" onclick="runBot_GUI(\'letturaPDC\')">Aggiorna Log e Tabelle</button>';
form_runBotCat = ' <button type="button" id="RunBotCat_button" onclick="runBot_GUI(\'aggiornaCategorie\')">Aggiorna categorie</button>';
form_log = '<textarea id="botlog" name="botlog" rows="50" cols="
$("#form-data").html(form_data);
d = new Date();
$('
$('
$('
$('
$('#form-RunBot').html(form_runBot);
$('#form-RunBotCat').html(form_runBotCat);
$('#form-log').html(form_log);
$('#botPanel').show();
}
function runBot_GUI(tipo)
{
disattivaGUI();
r = [];
appStatusRouter = [];
// Validazione data e numero giorni
d = validazioneData();
if(!d)
{
alert('La data selezionata non è valida!');
attivaGUI();▼
return;
}
giorni=parseInt($('#giorni').val());
alert('Il valore inserito nel campo "giorni" non è valido!');
▲ attivaGUI();
attivaGUI();
return;
}
else if( giorni < 1 || giorni > 9 )
{
alert('Il numero di giorni deve essere compreso tra 1 e 8');
attivaGUI();
return;
}
switch(tipo)
{
case 'letturaPDC':
r['letturaPDC'] = true;
break;
case 'aggiornaCategorie':
r['gestioneCategorieAnnuali'] = true;
r['gestioneCategorieMensili'] = true;
r['gestioneCategorieGiornaliere'] = true;
r['leggiStatoCatInCorso'] = true;
break;
}
for( key in r )
{
if( r[key] )
appStatusRouter.push(key);
}
messages = [];
guiTimeout = 5*60+10;
guiInt=setInterval(checkGUItimeout, 1000);
mainDeletionBot(d, giorni, appStatusRouter, 5);
}
function checkGUItimeout()
{
if( currentAppStatus == 'finish' || currentAppStatus == 'timeout')
{
clearInterval(guiInt);
messages_str = '';
for( var i=0; i < messages.length; i++)
messages_str = messages_str+messages[i]+'\n';
$('#botlog').val( messages_str );
attivaGUI();
}
else if( guiTimeout == 0 )
{
$('#botlog').val( 'Interruzione del bot...' );
}
else
{
guiTimeout--;
min = Math.floor(guiTimeout/60);
if(min<10) min='0'+min;
s = guiTimeout%60;
if(s<10) s='0'+s;
$('#botlog').val( 'Esecuzione in corso (timeout: '+min+':'+s+')' );
}
}
Riga 62 ⟶ 141:
function validazioneData()
{
dd=$('
mm=$('
yy=$('
d = new Date(yy, mm-1,
if( d.getDate()==dd && d.getMonth()==mm-1 && d.getFullYear()==yy )
|