מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף

אפשר
לא צריך "אישור" - בחירת תבנית מהרשימה צריכה להספיק.
שורה 189: שורה 189:
case 'notInParamPage': return 'השדה "' + param + '" לא מופיע ברשימת הפרמטרים של התבנית';
case 'notInParamPage': return 'השדה "' + param + '" לא מופיע ברשימת הפרמטרים של התבנית';
case 'editParamPage': return 'לעריכת דף הפרמטרים';
case 'editParamPage': return 'לעריכת דף הפרמטרים';
 
case 'no param page': return 'לתבנית "' + param + '" אין דף דף פרמטרים - האשף לא יכול לפעול ללא דף כזה';
case 'unknown error': return 'טעות בהפעלת האשף.\n' + param;
case 'please select template': return 'בחרו תבנית מהרשימה';
}
}
default:
default:
שורה 211: שורה 213:
case 'notInParamPage': return 'field "' + param + '" does not appear in the template\'s parameters list';
case 'notInParamPage': return 'field "' + param + '" does not appear in the template\'s parameters list';
case 'editParamPage': return 'Edit paramters page';
case 'editParamPage': return 'Edit paramters page';
case 'no param page': return 'Template "' + param + '" has no "parameters" page. Wizard can\'t be used.';
case 'unknown error': return 'Error occured: \n' + param;
case 'please select template': return 'select a template from the list';


}
}
שורה 407: שורה 412:
function reportError(a,b,error) {
function reportError(a,b,error) {
if (error == "Not Found")
if (error == "Not Found")
error = 'לתבנית "' + template + '" אין דף דף פרמטרים - האשף לא יכול לפעול ללא דף כזה';
error = i18n('no param page', template);
if (typeof console != 'undefined') {
if (typeof console != 'undefined') {
for (key in a)
for (key in a)
שורה 415: שורה 420:
console.log(error);
console.log(error);
}
}
alert('טעות בהפעלת האשף.' + '\n' + error);
alert(i18n('unknown error', error));
}
}


function pickTemplate() {
function pickTemplate() {
var selector = $('<select>');
var  
templateSelector,
selector = $('<select>')
.append($('<option>', {value: '', text: i18n('please select template')}))
.change(function() {
template = selector.val();
fireDialog();
templateSelector.dialog("close");
});
for (var i in allTemplates)
for (var i in allTemplates)
selector.append($('<option>', {value: allTemplates[i], text: allTemplates[i]}));
selector.append($('<option>', {value: allTemplates[i], text: allTemplates[i]}));
var templateSelector = $('<div>').dialog({
templateSelector = $('<div>')
title: i18n('template selector title'),
.dialog({
height: 'auto',
title: i18n('template selector title'),
width: 'auto',
height: 'auto',
modal: true,
width: 'auto',
buttons: [
modal: true,
{text: i18n('ok'), click: function(){template = selector.val(); fireDialog(); templateSelector.dialog("close")}},
buttons: [{text: i18n('cancel'), click: function() {templateSelector.dialog("close")}}]
{text: i18n('cancel'), click: function(){templateSelector.dialog("close")}}
})
]
.append(selector);
}).append(selector);
circumventRtlBug();
circumventRtlBug();
}
}
שורה 465: שורה 477:
function fireDialog() {
function fireDialog() {
$.ajax({
$.ajax({
url: mw.util.wikiScript() + '?title=' + mw.util.wikiUrlencode(paramPage()) + '&action=raw&ctype=text/x-wiki',
url: mw.util.wikiScript(),
data: {title: paramPage(), action: 'raw', ctype: 'text/x-wiki'},
success: buildDialog,
success: buildDialog,
error: reportError
error: reportError