MediaWiki:Gadget-CatGenRepairForm.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
WWWIG (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „→------------------------------------------------: →Script zum Erstellen von Vorlagen und Kategorien: /* ------------------------------------------------…“) |
WWWIG (Diskussion | Beiträge) (Ergänzt) |
||
| Zeile 35: | Zeile 35: | ||
CatGenRepairForm.t_TypTexte['Archiv_de'] = 'Archiv '; | CatGenRepairForm.t_TypTexte['Archiv_de'] = 'Archiv '; | ||
CatGenRepairForm.t_TypTexte['Archiv_it'] = 'di Archivio '; | CatGenRepairForm.t_TypTexte['Archiv_it'] = 'di Archivio '; | ||
| + | |||
| + | CatGenRepairForm.t_VorlagenKategorie['de'] = 'Vorlagen'; | ||
| + | CatGenRepairForm.t_VorlagenKategorie['it'] = 'Template'; | ||
| + | |||
}, | }, | ||
| Zeile 45: | Zeile 49: | ||
} | } | ||
| + | CatGenRepairForm.t_vkdebug = document.getElementById('Debugging').checked; | ||
CatGenRepairForm.InitLanguageVars(); | CatGenRepairForm.InitLanguageVars(); | ||
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Hole Kategorienliste:</b><p id="PreviewSubForm"></p>'; | document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Hole Kategorienliste:</b><p id="PreviewSubForm"></p>'; | ||
| + | document.getElementById( 'StatusPrev' ).innerHTML = ''; | ||
t_FilesToCheckString = CatGenRepairForm.t_VorlagenTexte['de'] + document.getElementById('TypSel').value; | t_FilesToCheckString = CatGenRepairForm.t_VorlagenTexte['de'] + document.getElementById('TypSel').value; | ||
| Zeile 66: | Zeile 72: | ||
} | } | ||
if(t_http_req.readyState == 4 && t_http_req.status == 200) { | if(t_http_req.readyState == 4 && t_http_req.status == 200) { | ||
| − | |||
if ( CatGenRepairForm.t_vkdebug ) { | if ( CatGenRepairForm.t_vkdebug ) { | ||
document.getElementById( 'StatusPrev' ).style.display = 'block'; | document.getElementById( 'StatusPrev' ).style.display = 'block'; | ||
| Zeile 78: | Zeile 83: | ||
}, | }, | ||
| − | CheckRepairPreviewVFiles : function ( queryData, rawData ) { | + | CheckRepairPreviewVFiles : function ( queryData, rawData, t_clear ) { |
| + | |||
| + | if ( document.getElementById( 'InsertCreateForm' ) ) { | ||
| + | if ( document.getElementById( 'PreviewForm' ) ) { | ||
| + | document.getElementById( 'PreviewForm' ).innerHTML = ''; | ||
| + | } | ||
| + | if ( document.getElementById( 'TemplateForm' ) ) { | ||
| + | document.getElementById( 'TemplateForm' ).innerHTML = ''; | ||
| + | } | ||
| + | if ( document.getElementById( 'InsertCreateForm' ) && document.getElementById( 'Status' ) ) { | ||
| + | document.getElementById( 'InsertCreateForm' ).innerHTML = '<b>' + document.getElementById( 'Status' ).innerHTML + '</b>'; | ||
| + | } | ||
| + | if ( document.getElementById( 'InsertCreateForm' ) && t_clear == 'c' ) { | ||
| + | document.getElementById( 'InsertCreateForm' ).innerHTML = ''; | ||
| + | } | ||
| + | |||
| + | setcursor( 'wait' ); | ||
| + | CatGenRepairForm.t_Files.splice( 0, CatGenRepairForm.t_Files.length ); | ||
| + | CatGenRepairForm.t_HerstellerListe.splice( 0, CatGenRepairForm.t_HerstellerListe.length ); | ||
| + | |||
| + | t_pagecount = 0; | ||
| + | if ( queryData.query && queryData.query.pages ) { | ||
| + | for ( var t_Page in queryData.query.pages ) { | ||
| + | if ( queryData.query.pages[t_Page].pageid ) { | ||
| + | t_pagecount++; | ||
| + | |||
| + | CatGenRepairForm.t_HerstellerPreview = queryData.query.pages[t_Page].title.replace(/Vorlage:Kategorie Bildgalerie Uhrwerke /g, ""); | ||
| + | CatGenRepairForm.t_HerstellerListe.push( CatGenRepairForm.t_HerstellerPreview ); | ||
| + | CatGenRepairForm.t_TypPreview = document.getElementById( 'TypSel' ).value; | ||
| + | |||
| + | for ( var t_Page in CatGenRepairForm.t_FilesChecked ) { | ||
| + | if ( CatGenRepairForm.t_FilesChecked[t_Page] == 'class="new" ' ) { | ||
| + | CatGenRepairForm.t_FilesChecked[t_Page] = ''; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | t_Typ = document.getElementById('TypSel').value; | ||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | t_Hersteller = CatGenRepairForm.t_HerstellerPreview; | ||
| + | t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | } | ||
| + | t_Hersteller = CatGenRepairForm.t_HerstellerPreview; | ||
| + | t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte['de'] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de']; | ||
| + | t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | |||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | t_Hersteller = CatGenRepairForm.t_HerstellerPreview; | ||
| + | t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | } | ||
| + | t_Hersteller = CatGenRepairForm.t_HerstellerPreview; | ||
| + | t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte['de'] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de']; | ||
| + | t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (t_pagecount == 0) { | ||
| + | document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Keine Artikel gefunden</b><p id="PreviewSubForm"></p>'; | ||
| + | // return; | ||
| + | } | ||
| + | |||
| + | t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen'; | ||
| + | t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner ); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | |||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | |||
| + | t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + ' XXX' ); | ||
| + | CatGenRepairForm.t_Files.push( t_Zielbezeichner); | ||
| + | } | ||
| + | |||
| + | document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Vorschau wird erstellt für:</b><p id="PreviewSubForm"></p>'; | ||
| + | |||
| + | CatGenRepairForm.ProcessingRepairPreviewFile(); | ||
| + | } | ||
| + | }, | ||
| + | |||
| + | ProcessingRepairPreviewFile : function ( ) { | ||
| + | |||
| + | var t_FilesToCheckString; | ||
| + | |||
| + | if ( CatGenRepairForm.t_Files.length > 0 ) { | ||
| + | t_FilesToCheckString = CatGenRepairForm.t_Files.splice( 0, 1 ); | ||
| + | } | ||
| + | if ( CatGenRepairForm.t_Files.length > 0 ) { | ||
| + | t_FilesToCheckString += '|'; | ||
| + | t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 ); | ||
| + | } | ||
| + | if ( CatGenRepairForm.t_Files.length > 0 ) { | ||
| + | t_FilesToCheckString += '|'; | ||
| + | t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 ); | ||
| + | } | ||
| + | |||
| + | var t_parameters = '?action=query&format=json&prop=info|revisions&rvprop=content&titles=' + encodeURIComponent( t_FilesToCheckString ); | ||
| + | var t_http_req = null; | ||
| + | if (window.XMLHttpRequest) {t_http_req = new XMLHttpRequest();} | ||
| + | else if (window.ActiveXObject) {t_http_req = new ActiveXObject("Microsoft.XMLHTTP");} | ||
| + | t_http_req.open("POST", CatGenRepairForm.t_wikiurl + t_parameters, true); | ||
| + | t_http_req.onreadystatechange = function() { | ||
| + | if(t_http_req.readyState != 4) { | ||
| + | if ( t_FilesToCheckString != '' ) { | ||
| + | document.getElementById( 'PreviewSubForm' ).style.height = '75px'; | ||
| + | document.getElementById( 'PreviewSubForm' ).style.overflow = 'auto'; | ||
| + | document.getElementById( 'PreviewSubForm' ).scrollTop = 1000; | ||
| + | document.getElementById( 'PreviewSubForm' ).innerHTML += String(t_FilesToCheckString).replace(/\|/g, "<br>") + '<br>'; | ||
| + | t_FilesToCheckString = ''; | ||
| + | } | ||
| + | } | ||
| + | if(t_http_req.readyState == 4 && t_http_req.status == 200) { | ||
| + | if ( CatGenRepairForm.t_vkdebug ) { | ||
| + | document.getElementById( 'StatusPrev' ).style.display = 'block'; | ||
| + | document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + t_http_req.responseText; | ||
| + | } | ||
| + | CatGenRepairForm.ProcessedRepairPreviewFile( eval("(" + t_http_req.responseText + ")") ); | ||
| + | } | ||
| + | } | ||
| + | t_http_req.send(null); | ||
| + | }, | ||
| + | |||
| + | ProcessedRepairPreviewFile : function ( queryData, rawData ) { | ||
| + | |||
| + | if ( queryData.query && queryData.query.pages ) { | ||
| + | for ( var t_Page in queryData.query.pages ) { | ||
| + | if ( !queryData.query.pages[t_Page].pageid ) { | ||
| + | if ( queryData.query.normalized ) { | ||
| + | for ( t_PageNorm= 0; t_PageNorm < queryData.query.normalized.length; t_PageNorm++ ) { | ||
| + | if ( queryData.query.normalized[t_PageNorm].to == queryData.query.pages[t_Page].title ) { | ||
| + | CatGenRepairForm.t_FilesChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] = 'class="new" '; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = 'class="new" '; | ||
| + | } else { | ||
| + | CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = ''; | ||
| + | if ( queryData.query.pages[t_Page].revisions ) { | ||
| + | CatGenRepairForm.t_FilesContentChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = | ||
| + | queryData.query.pages[t_Page].revisions[0]['*']; | ||
| + | } | ||
| + | if ( queryData.query.normalized ) { | ||
| + | for ( t_PageNorm= 0; t_PageNorm < queryData.query.normalized.length; t_PageNorm++ ) { | ||
| + | if ( queryData.query.normalized[t_PageNorm].to == queryData.query.pages[t_Page].title ) { | ||
| + | if ( queryData.query.pages[t_Page].revisions ) { | ||
| + | CatGenRepairForm.t_FilesContentChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] = | ||
| + | queryData.query.pages[t_Page].revisions[0]['*']; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if ( CatGenRepairForm.t_Files.length > 0 ) { | ||
| + | CatGenRepairForm.ProcessingRepairPreviewFile(); | ||
| + | } else { | ||
| + | CatGenRepairForm.PreviewRepairVKFiles(); | ||
| + | } | ||
| + | }, | ||
| + | |||
| + | PreviewRepairVKFiles: function () { | ||
| + | |||
| + | if ( document.getElementById( 'PreviewForm' ) ) { | ||
| + | document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairPreview() + ''; | ||
| + | } | ||
| + | |||
| + | if ( document.getElementById( 'TemplateForm' ) ) { | ||
| + | document.getElementById( 'TemplateForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairTemplatePreview() + ''; | ||
| + | } | ||
| + | |||
| + | document.getElementById( 'InsertCreateForm' ).innerHTML = | ||
| + | '<hr style="margin-top:1em; margin-right:.5em;"><div style="margin-top:.5em; margin-right:1em;">' + | ||
| + | '<h3>Erstellen</h3>' + | ||
| + | '<label for="Summary" style="vertical-align:top">Zusammenfassung / Kommentar:</label>' + | ||
| + | '<p><input id="Summary" type="text" size="75" value="Mit neuer Vorlage automatisch erstellt"></p>' + | ||
| + | '<label for="Status" style="vertical-align:top;">Status:</label>' + | ||
| + | '<p id="Status" style="border: 1px solid #aaa; padding:.5em;height:75px;" >Vor dem Erstellen der Vorlagen und Kategorien bitte die Namen und Inhalte überprüfen ...</p>' + | ||
| + | '<p><input type="button" title="Erstellt die Vorlagen und Kategorien gemäß der Vorschau mit den angezeigten Inhalten" ' + | ||
| + | 'value="Erstellen" onClick="StartCreatingVKFiles()"> ' + | ||
| + | '<input type="button" value="Abbrechen" title="Die Abarbeitung der Erstellung und des Löschens von Vorlagen und Kategorien wird unterbrochen" ' + | ||
| + | 'onClick="StopProcessingVKFiles()">' + | ||
| + | '<input type="button" value="Löschen" style="float:right;" title="Löscht die Vorlagen und Kategorien gemäß der Vorschau" ' + | ||
| + | 'onClick="StartDeletingVKFiles()">' + | ||
| + | '</p></div>'; | ||
| + | |||
| + | setcursor( 'auto' ); | ||
| + | }, | ||
| + | |||
| + | CreateRepairTemplatePreview : function () { | ||
| + | var out = ''; | ||
| + | |||
| + | t_Typ = document.getElementById('TypSel').value; | ||
| + | |||
| + | out += '<h3>Verwendete Vorlagen (werden <u>nicht</u> automatisch erstellt)</h3>'; | ||
| + | |||
| + | t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen'; | ||
| + | t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner ); | ||
| + | t_ZielbezeichnerUrl = t_Zielbezeichner; | ||
| + | t_missingText = ''; | ||
| + | t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner]; | ||
| + | |||
| + | out += '<ul><li><span id="Vorlage_Sprachen">' + | ||
| + | '<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' + | ||
| + | t_Zielbezeichner + '</a></span></li></ul>'; | ||
| + | |||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | |||
| + | t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + 'XXX' ); | ||
| + | t_ZielbezeichnerUrl = t_Zielbezeichner; | ||
| + | t_missingText = ''; | ||
| + | t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner]; | ||
| + | |||
| + | out += '<ul><li><span id="Vorlage_' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + | ||
| + | '<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' + | ||
| + | t_Zielbezeichner + '</a></span></li></ul>'; | ||
| + | } | ||
| + | |||
| + | return out; | ||
| + | }, | ||
| + | |||
| + | CreateRepairPreview : function () { | ||
| + | |||
| + | var out = ''; | ||
| + | var out2 = ''; | ||
| + | var t_Sprachenparameter = ''; | ||
| + | |||
| + | out = '<h3>Vorschau Kategorievorlagen</h3>'; | ||
| + | out2 = '<h3>Vorschau Kategorien</h3>'; | ||
| + | t_Typ = document.getElementById('TypSel').value; | ||
| + | |||
| + | |||
| + | while ( CatGenRepairForm.t_HerstellerListe.length > 0 ) { | ||
| + | |||
| + | t_HerstellerPreview = CatGenRepairForm.t_HerstellerListe.splice( 0, 1 ); | ||
| + | |||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | |||
| + | t_Hersteller = t_HerstellerPreview; | ||
| + | t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Vorlagebezeichner_de = CatGenRepairForm.t_VorlagenTexte['de'] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de']; | ||
| + | t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller); | ||
| + | t_Zielbezeichner_de = trim('Vorlage:' + t_Vorlagebezeichner_de + t_Hersteller); | ||
| + | t_ZielbezeichnerUrl = t_Zielbezeichner; | ||
| + | |||
| + | t_Sprachenparameter = String( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner_de] ).replace("<includeonly>{{Bildgalerie "+t_Typ+" XXX Sprachen","").replace("}}</includeonly><noinclude>[[Kategorie:Vorlagen|" + t_Hersteller + "]]</noinclude>",""); | ||
| + | if ( t_Sprachenparameter == '' || t_Sprachenparameter == 'undefined' ) { | ||
| + | continue; | ||
| + | } | ||
| + | |||
| + | t_missingText = ''; | ||
| + | t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner]; | ||
| + | CatGenRepairForm.t_FilesChecked[t_Zielbezeichner] = ''; | ||
| + | |||
| + | t_Hersteller = String(t_Hersteller).replace(/&/g, "&"); | ||
| + | t_Inhalt = '<includeonly>{{Bildgalerie '+t_Typ+' XXX Sprachen' + | ||
| + | t_Sprachenparameter + '}}</includeonly><noinclude>[[Kategorie:' + | ||
| + | CatGenRepairForm.t_VorlagenKategorie[CatGenRepairForm.t_Sprachen[t_Sprache]] +'|' + t_Hersteller + ']]</noinclude>'; | ||
| + | t_identText = ''; | ||
| + | |||
| + | if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) { | ||
| + | t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)'; | ||
| + | CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] = ''; | ||
| + | } else | ||
| + | if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) { | ||
| + | t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ); | ||
| + | t_oldContent = t_oldContent.replace(/\'/g, '&apos;'); | ||
| + | |||
| + | t_identText = ' (<span style="color:red;font-size:180%;" ' + | ||
| + | 'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)'; | ||
| + | } | ||
| + | |||
| + | t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&"); | ||
| + | t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl ); | ||
| + | out += '<ul><li><span id="FileV' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + | ||
| + | '<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" ' + | ||
| + | t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' + | ||
| + | t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>'; | ||
| + | |||
| + | out += '<dl><dd><span id="InhaltV' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + t_Inhalt + '</span></dd></dl>'; | ||
| + | } | ||
| + | |||
| + | for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) { | ||
| + | t_Hersteller = t_HerstellerPreview; | ||
| + | t_Buchstabenparameter = ''; | ||
| + | |||
| + | t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]]; | ||
| + | t_Kategoriebezeichner_de = CatGenRepairForm.t_KategorienTexte['de'] + | ||
| + | CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de']; | ||
| + | t_Zielbezeichner = trim('' + t_Kategoriebezeichner + t_Hersteller); | ||
| + | t_Zielbezeichner_de = trim('' + t_Kategoriebezeichner_de + t_Hersteller); | ||
| + | t_ZielbezeichnerUrl = t_Zielbezeichner; | ||
| + | |||
| + | t_Buchstabenparameter = String( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner_de] ).replace("{{Kategoriebeschreibung " + t_Kategoriebezeichner_de + "XXX","").replace("}}",""); | ||
| + | if ( t_Buchstabenparameter == '' || t_Buchstabenparameter == 'undefined' ) { | ||
| + | continue; | ||
| + | } | ||
| + | |||
| + | t_missingText = ''; | ||
| + | t_missingText = CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner]; | ||
| + | CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner] = ''; | ||
| + | |||
| + | t_Inhalt = '{{Kategoriebeschreibung ' + t_Kategoriebezeichner + 'XXX' + t_Buchstabenparameter + '}}'; | ||
| + | t_identText = ''; | ||
| + | if ( CatGenRepairForm.t_vkdebug ) { | ||
| + | document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + 'FilesContentChecked<br>' + | ||
| + | encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) + '<br>' + | ||
| + | encodeURIComponent( t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&") ); | ||
| + | } | ||
| + | |||
| + | if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) { | ||
| + | if ( CatGenRepairForm.t_vkdebug ) document.getElementById( 'StatusPrev' ).innerHTML += '<br>' + 'equal'; | ||
| + | t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)'; | ||
| + | CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] = ''; | ||
| + | } else | ||
| + | if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) { | ||
| + | t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ); | ||
| + | t_oldContent = t_oldContent.replace(/\'/g, '&apos;'); | ||
| + | t_identText = ' (<span style="color:red;font-size:180%;" ' + | ||
| + | 'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)'; | ||
| + | } | ||
| + | t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&"); | ||
| + | t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl ); | ||
| + | out2 += '<ul><li><span id="FileK' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + | ||
| + | '<a href="' + wgScriptPath + '/index.php?title=Kategorie:' + t_ZielbezeichnerUrl + '" ' + | ||
| + | t_missingText + 'title="Kategorie:' + t_ZielbezeichnerUrl + '">Kategorie:' + | ||
| + | t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>'; | ||
| + | out2 += '<dl><dd><span id="InhaltK' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + t_Inhalt + '</span></dd></dl>'; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | return out+out2; | ||
}, | }, | ||
| Zeile 85: | Zeile 434: | ||
}, | }, | ||
| + | |||
| + | t_Files : new Array(), | ||
| + | t_HerstellerListe : new Array(), | ||
| + | t_FilesChecked : new Array(), | ||
| + | t_FilesContentChecked : new Array(), | ||
| + | t_processnext : 0, | ||
t_VorlagenTexte : new Array(), | t_VorlagenTexte : new Array(), | ||
t_KategorienTexte : new Array(), | t_KategorienTexte : new Array(), | ||
| + | t_VorlagenKategorie : new Array(), | ||
t_TypTexte : new Array(), | t_TypTexte : new Array(), | ||
| − | t_vkdebug : | + | t_vkdebug : false, |
t_Content : '', | t_Content : '', | ||
| Zeile 147: | Zeile 503: | ||
out += '</select><input id="TypSel" name="TypSel" type="hidden" value=""><br><br><br>' + | out += '</select><input id="TypSel" name="TypSel" type="hidden" value=""><br><br><br>' + | ||
| − | '< | + | '<table><tr><td><input id="Debugging" type="checkbox"></td><td>Debugging</td></tr></table>' + |
| − | |||
'<p id="StatusPrev" style="border: 1px solid #aaa; padding:.5em;display:none;">Debuginfo</p></p>' + | '<p id="StatusPrev" style="border: 1px solid #aaa; padding:.5em;display:none;">Debuginfo</p></p>' + | ||
'<div id="PreviewForm"></div>' + | '<div id="PreviewForm"></div>' + | ||
Version vom 4. Mai 2011, 15:33 Uhr
/* ------------------------------------------------ */
/* Script zum Erstellen von Vorlagen und Kategorien */
/* ------------------------------------------------ */
addOnloadHook( function () {
if ( window.wgUserGroups ) {
for ( var i = 0; i < wgUserGroups.length; i++ ) {
if ( wgUserGroups[i] === 'sysop' || wgUserGroups[i] === 'bot' ) {
InsertNode("javascript:CatGenRepairForm.LoadCatGenRepairForm()", "Ergänzungen", TW_WERKZEUGE, "ul");
break;
}
}
}
});
var CatGenRepairForm = {
t_Sprachen : new Array('it'),
t_Typen : new Array('Uhrenmodelle','Uhrwerke','Archiv','Porträt','Gebäude','Marken und Warenzeichen','Werkzeuge'),
InitLanguageVars : function () {
CatGenRepairForm.t_VorlagenTexte['de'] = 'Kategorie Bildgalerie ';
CatGenRepairForm.t_VorlagenTexte['it'] = 'Categoria galleria fotografica ';
CatGenRepairForm.t_KategorienTexte['de'] = 'Bildgalerie ';
CatGenRepairForm.t_KategorienTexte['it'] = 'Galleria fotografica ';
CatGenRepairForm.t_TypTexte['Uhrenmodelle_de'] = 'Uhrenmodelle ';
CatGenRepairForm.t_TypTexte['Uhrenmodelle_it'] = 'di modelli orologi ';
CatGenRepairForm.t_TypTexte['Uhrwerke_de'] = 'Uhrwerke ';
CatGenRepairForm.t_TypTexte['Uhrwerke_it'] = 'di movimento degli orologi ';
CatGenRepairForm.t_TypTexte['Archiv_de'] = 'Archiv ';
CatGenRepairForm.t_TypTexte['Archiv_it'] = 'di Archivio ';
CatGenRepairForm.t_VorlagenKategorie['de'] = 'Vorlagen';
CatGenRepairForm.t_VorlagenKategorie['it'] = 'Template';
},
PreCheckRepairPreviewVFiles : function () {
if ( document.getElementById('TypSel').value + '' == '' ) {
t_msg2 = 'Es ist kein Typ gewählt!';
document.getElementById( 'PreviewForm' ).innerHTML = t_msg2;
return;
}
CatGenRepairForm.t_vkdebug = document.getElementById('Debugging').checked;
CatGenRepairForm.InitLanguageVars();
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Hole Kategorienliste:</b><p id="PreviewSubForm"></p>';
document.getElementById( 'StatusPrev' ).innerHTML = '';
t_FilesToCheckString = CatGenRepairForm.t_VorlagenTexte['de'] + document.getElementById('TypSel').value;
var t_parameters = '?action=query&generator=search&format=json&gsrnamespace=10&gsrlimit=500&gsrsearch=' + encodeURIComponent( t_FilesToCheckString );
var t_http_req = null;
if (window.XMLHttpRequest) {t_http_req = new XMLHttpRequest();}
else if (window.ActiveXObject) {t_http_req = new ActiveXObject("Microsoft.XMLHTTP");}
t_http_req.open("POST", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if(t_http_req.readyState != 4) {
if ( t_FilesToCheckString != '' ) {
document.getElementById( 'PreviewSubForm' ).style.height = '75px';
document.getElementById( 'PreviewSubForm' ).style.overflow = 'auto';
document.getElementById( 'PreviewSubForm' ).scrollTop = 1000;
document.getElementById( 'PreviewSubForm' ).innerHTML += String(t_FilesToCheckString).replace(/\|/g, "<br>") + '<br>';
t_FilesToCheckString = '';
}
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).style.display = 'block';
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + t_http_req.responseText;
}
CatGenRepairForm.CheckRepairPreviewVFiles( eval("(" + t_http_req.responseText + ")") );
}
}
t_http_req.send(null);
},
CheckRepairPreviewVFiles : function ( queryData, rawData, t_clear ) {
if ( document.getElementById( 'InsertCreateForm' ) ) {
if ( document.getElementById( 'PreviewForm' ) ) {
document.getElementById( 'PreviewForm' ).innerHTML = '';
}
if ( document.getElementById( 'TemplateForm' ) ) {
document.getElementById( 'TemplateForm' ).innerHTML = '';
}
if ( document.getElementById( 'InsertCreateForm' ) && document.getElementById( 'Status' ) ) {
document.getElementById( 'InsertCreateForm' ).innerHTML = '<b>' + document.getElementById( 'Status' ).innerHTML + '</b>';
}
if ( document.getElementById( 'InsertCreateForm' ) && t_clear == 'c' ) {
document.getElementById( 'InsertCreateForm' ).innerHTML = '';
}
setcursor( 'wait' );
CatGenRepairForm.t_Files.splice( 0, CatGenRepairForm.t_Files.length );
CatGenRepairForm.t_HerstellerListe.splice( 0, CatGenRepairForm.t_HerstellerListe.length );
t_pagecount = 0;
if ( queryData.query && queryData.query.pages ) {
for ( var t_Page in queryData.query.pages ) {
if ( queryData.query.pages[t_Page].pageid ) {
t_pagecount++;
CatGenRepairForm.t_HerstellerPreview = queryData.query.pages[t_Page].title.replace(/Vorlage:Kategorie Bildgalerie Uhrwerke /g, "");
CatGenRepairForm.t_HerstellerListe.push( CatGenRepairForm.t_HerstellerPreview );
CatGenRepairForm.t_TypPreview = document.getElementById( 'TypSel' ).value;
for ( var t_Page in CatGenRepairForm.t_FilesChecked ) {
if ( CatGenRepairForm.t_FilesChecked[t_Page] == 'class="new" ' ) {
CatGenRepairForm.t_FilesChecked[t_Page] = '';
}
}
t_Typ = document.getElementById('TypSel').value;
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
t_Hersteller = CatGenRepairForm.t_HerstellerPreview;
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Kategorie:' + t_Kategoriebezeichner + t_Hersteller);
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
}
}
if (t_pagecount == 0) {
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Keine Artikel gefunden</b><p id="PreviewSubForm"></p>';
// return;
}
t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen';
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner );
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + ' XXX' );
CatGenRepairForm.t_Files.push( t_Zielbezeichner);
}
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + '<b>Vorschau wird erstellt für:</b><p id="PreviewSubForm"></p>';
CatGenRepairForm.ProcessingRepairPreviewFile();
}
},
ProcessingRepairPreviewFile : function ( ) {
var t_FilesToCheckString;
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString = CatGenRepairForm.t_Files.splice( 0, 1 );
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString += '|';
t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 );
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
t_FilesToCheckString += '|';
t_FilesToCheckString += CatGenRepairForm.t_Files.splice( 0, 1 );
}
var t_parameters = '?action=query&format=json&prop=info|revisions&rvprop=content&titles=' + encodeURIComponent( t_FilesToCheckString );
var t_http_req = null;
if (window.XMLHttpRequest) {t_http_req = new XMLHttpRequest();}
else if (window.ActiveXObject) {t_http_req = new ActiveXObject("Microsoft.XMLHTTP");}
t_http_req.open("POST", CatGenRepairForm.t_wikiurl + t_parameters, true);
t_http_req.onreadystatechange = function() {
if(t_http_req.readyState != 4) {
if ( t_FilesToCheckString != '' ) {
document.getElementById( 'PreviewSubForm' ).style.height = '75px';
document.getElementById( 'PreviewSubForm' ).style.overflow = 'auto';
document.getElementById( 'PreviewSubForm' ).scrollTop = 1000;
document.getElementById( 'PreviewSubForm' ).innerHTML += String(t_FilesToCheckString).replace(/\|/g, "<br>") + '<br>';
t_FilesToCheckString = '';
}
}
if(t_http_req.readyState == 4 && t_http_req.status == 200) {
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).style.display = 'block';
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + t_http_req.responseText;
}
CatGenRepairForm.ProcessedRepairPreviewFile( eval("(" + t_http_req.responseText + ")") );
}
}
t_http_req.send(null);
},
ProcessedRepairPreviewFile : function ( queryData, rawData ) {
if ( queryData.query && queryData.query.pages ) {
for ( var t_Page in queryData.query.pages ) {
if ( !queryData.query.pages[t_Page].pageid ) {
if ( queryData.query.normalized ) {
for ( t_PageNorm= 0; t_PageNorm < queryData.query.normalized.length; t_PageNorm++ ) {
if ( queryData.query.normalized[t_PageNorm].to == queryData.query.pages[t_Page].title ) {
CatGenRepairForm.t_FilesChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] = 'class="new" ';
}
}
}
CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = 'class="new" ';
} else {
CatGenRepairForm.t_FilesChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] = '';
if ( queryData.query.pages[t_Page].revisions ) {
CatGenRepairForm.t_FilesContentChecked[decodeURIComponent(queryData.query.pages[t_Page].title)] =
queryData.query.pages[t_Page].revisions[0]['*'];
}
if ( queryData.query.normalized ) {
for ( t_PageNorm= 0; t_PageNorm < queryData.query.normalized.length; t_PageNorm++ ) {
if ( queryData.query.normalized[t_PageNorm].to == queryData.query.pages[t_Page].title ) {
if ( queryData.query.pages[t_Page].revisions ) {
CatGenRepairForm.t_FilesContentChecked[decodeURIComponent( queryData.query.normalized[t_PageNorm].from )] =
queryData.query.pages[t_Page].revisions[0]['*'];
}
}
}
}
}
}
}
if ( CatGenRepairForm.t_Files.length > 0 ) {
CatGenRepairForm.ProcessingRepairPreviewFile();
} else {
CatGenRepairForm.PreviewRepairVKFiles();
}
},
PreviewRepairVKFiles: function () {
if ( document.getElementById( 'PreviewForm' ) ) {
document.getElementById( 'PreviewForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairPreview() + '';
}
if ( document.getElementById( 'TemplateForm' ) ) {
document.getElementById( 'TemplateForm' ).innerHTML = '<hr style="margin-top:1em;">' + CatGenRepairForm.CreateRepairTemplatePreview() + '';
}
document.getElementById( 'InsertCreateForm' ).innerHTML =
'<hr style="margin-top:1em; margin-right:.5em;"><div style="margin-top:.5em; margin-right:1em;">' +
'<h3>Erstellen</h3>' +
'<label for="Summary" style="vertical-align:top">Zusammenfassung / Kommentar:</label>' +
'<p><input id="Summary" type="text" size="75" value="Mit neuer Vorlage automatisch erstellt"></p>' +
'<label for="Status" style="vertical-align:top;">Status:</label>' +
'<p id="Status" style="border: 1px solid #aaa; padding:.5em;height:75px;" >Vor dem Erstellen der Vorlagen und Kategorien bitte die Namen und Inhalte überprüfen ...</p>' +
'<p><input type="button" title="Erstellt die Vorlagen und Kategorien gemäß der Vorschau mit den angezeigten Inhalten" ' +
'value="Erstellen" onClick="StartCreatingVKFiles()"> ' +
'<input type="button" value="Abbrechen" title="Die Abarbeitung der Erstellung und des Löschens von Vorlagen und Kategorien wird unterbrochen" ' +
'onClick="StopProcessingVKFiles()">' +
'<input type="button" value="Löschen" style="float:right;" title="Löscht die Vorlagen und Kategorien gemäß der Vorschau" ' +
'onClick="StartDeletingVKFiles()">' +
'</p></div>';
setcursor( 'auto' );
},
CreateRepairTemplatePreview : function () {
var out = '';
t_Typ = document.getElementById('TypSel').value;
out += '<h3>Verwendete Vorlagen (werden <u>nicht</u> automatisch erstellt)</h3>';
t_Vorlagebezeichner = 'Bildgalerie '+t_Typ+' XXX Sprachen';
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner );
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
out += '<ul><li><span id="Vorlage_Sprachen">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span></li></ul>';
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Vorlagebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Zielbezeichner = trim('Vorlage:Kategoriebeschreibung ' + t_Vorlagebezeichner + 'XXX' );
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
out += '<ul><li><span id="Vorlage_' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" '+ t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span></li></ul>';
}
return out;
},
CreateRepairPreview : function () {
var out = '';
var out2 = '';
var t_Sprachenparameter = '';
out = '<h3>Vorschau Kategorievorlagen</h3>';
out2 = '<h3>Vorschau Kategorien</h3>';
t_Typ = document.getElementById('TypSel').value;
while ( CatGenRepairForm.t_HerstellerListe.length > 0 ) {
t_HerstellerPreview = CatGenRepairForm.t_HerstellerListe.splice( 0, 1 );
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = t_HerstellerPreview;
t_Vorlagebezeichner = CatGenRepairForm.t_VorlagenTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Vorlagebezeichner_de = CatGenRepairForm.t_VorlagenTexte['de'] + CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('Vorlage:' + t_Vorlagebezeichner + t_Hersteller);
t_Zielbezeichner_de = trim('Vorlage:' + t_Vorlagebezeichner_de + t_Hersteller);
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_Sprachenparameter = String( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner_de] ).replace("<includeonly>{{Bildgalerie "+t_Typ+" XXX Sprachen","").replace("}}</includeonly><noinclude>[[Kategorie:Vorlagen|" + t_Hersteller + "]]</noinclude>","");
if ( t_Sprachenparameter == '' || t_Sprachenparameter == 'undefined' ) {
continue;
}
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked[t_Zielbezeichner];
CatGenRepairForm.t_FilesChecked[t_Zielbezeichner] = '';
t_Hersteller = String(t_Hersteller).replace(/&/g, "&");
t_Inhalt = '<includeonly>{{Bildgalerie '+t_Typ+' XXX Sprachen' +
t_Sprachenparameter + '}}</includeonly><noinclude>[[Kategorie:' +
CatGenRepairForm.t_VorlagenKategorie[CatGenRepairForm.t_Sprachen[t_Sprache]] +'|' + t_Hersteller + ']]</noinclude>';
t_identText = '';
if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) {
t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)';
CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] = '';
} else
if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] ) {
t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked[t_Zielbezeichner] );
t_oldContent = t_oldContent.replace(/\'/g, '&apos;');
t_identText = ' (<span style="color:red;font-size:180%;" ' +
'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)';
}
t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&");
t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl );
out += '<ul><li><span id="FileV' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' +
'<a href="'+wgScriptPath+'/index.php?title=' + t_ZielbezeichnerUrl + '" ' +
t_missingText + 'title="' + t_ZielbezeichnerUrl + '">' +
t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>';
out += '<dl><dd><span id="InhaltV' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + t_Inhalt + '</span></dd></dl>';
}
for ( t_Sprache = 0; t_Sprache < CatGenRepairForm.t_Sprachen.length; t_Sprache++ ) {
t_Hersteller = t_HerstellerPreview;
t_Buchstabenparameter = '';
t_Kategoriebezeichner = CatGenRepairForm.t_KategorienTexte[CatGenRepairForm.t_Sprachen[t_Sprache]] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+CatGenRepairForm.t_Sprachen[t_Sprache]];
t_Kategoriebezeichner_de = CatGenRepairForm.t_KategorienTexte['de'] +
CatGenRepairForm.t_TypTexte[t_Typ+'_'+'de'];
t_Zielbezeichner = trim('' + t_Kategoriebezeichner + t_Hersteller);
t_Zielbezeichner_de = trim('' + t_Kategoriebezeichner_de + t_Hersteller);
t_ZielbezeichnerUrl = t_Zielbezeichner;
t_Buchstabenparameter = String( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner_de] ).replace("{{Kategoriebeschreibung " + t_Kategoriebezeichner_de + "XXX","").replace("}}","");
if ( t_Buchstabenparameter == '' || t_Buchstabenparameter == 'undefined' ) {
continue;
}
t_missingText = '';
t_missingText = CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner];
CatGenRepairForm.t_FilesChecked['Kategorie:' + t_Zielbezeichner] = '';
t_Inhalt = '{{Kategoriebeschreibung ' + t_Kategoriebezeichner + 'XXX' + t_Buchstabenparameter + '}}';
t_identText = '';
if ( CatGenRepairForm.t_vkdebug ) {
document.getElementById( 'StatusPrev' ).innerHTML += '<hr>' + 'FilesContentChecked<br>' +
encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) + '<br>' +
encodeURIComponent( t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&") );
}
if ( (t_Inhalt.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")) == CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) {
if ( CatGenRepairForm.t_vkdebug ) document.getElementById( 'StatusPrev' ).innerHTML += '<br>' + 'equal';
t_identText = ' (<span style="color:green;font-size:180%;" title="Inhalt ist bereits aktuell">✔</span>)';
CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] = '';
} else
if ( t_missingText == '' && CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] ) {
t_oldContent = encodeURIComponent( CatGenRepairForm.t_FilesContentChecked['Kategorie:' + t_Zielbezeichner] );
t_oldContent = t_oldContent.replace(/\'/g, '&apos;');
t_identText = ' (<span style="color:red;font-size:180%;" ' +
'onmouseover="tippon('+"'"+t_oldContent+"'"+')" onmouseout="tippoff()">✘</span>)';
}
t_Zielbezeichner = t_Zielbezeichner.replace(/&/g, "&");
t_ZielbezeichnerUrl = encodeURIComponent( t_ZielbezeichnerUrl );
out2 += '<ul><li><span id="FileK' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' +
'<a href="' + wgScriptPath + '/index.php?title=Kategorie:' + t_ZielbezeichnerUrl + '" ' +
t_missingText + 'title="Kategorie:' + t_ZielbezeichnerUrl + '">Kategorie:' +
t_Zielbezeichner + '</a></span>' + t_identText + '</li></ul>';
out2 += '<dl><dd><span id="InhaltK' + CatGenRepairForm.t_Sprachen[t_Sprache] + '">' + t_Inhalt + '</span></dd></dl>';
}
}
return out+out2;
},
StartCreatingVKFiles : function () {
},
t_Files : new Array(),
t_HerstellerListe : new Array(),
t_FilesChecked : new Array(),
t_FilesContentChecked : new Array(),
t_processnext : 0,
t_VorlagenTexte : new Array(),
t_KategorienTexte : new Array(),
t_VorlagenKategorie : new Array(),
t_TypTexte : new Array(),
t_vkdebug : false,
t_Content : '',
t_Sic_GenContent : '',
t_Sic_selectedTyp : 0,
t_wikiurl2 : 'http://watch-wiki.org/api.php',
t_wikiurl : wgServer + wgScriptPath + '/api.php',
UnloadCatGenRepairForm : function () {
CatGenRepairForm.t_stopp = true;
setcursor( 'auto' );
CatGenRepairForm.t_Sic_GenContent = document.getElementById( 'content' ).innerHTML;
CatGenRepairForm.t_selectedTyp = document.getElementById( 'Typ' ).selectedIndex;
if ( CatGenRepairForm.t_Content != '' ) {
document.getElementById( 'content' ).innerHTML = CatGenRepairForm.t_Content;
CatGenRepairForm.t_Content = '';
}
},
LoadCatGenRepairForm : function ( t_status ) {
// if ( typeof my_vkdebug != "undefined" && my_vkdebug != '' ) CatGenRepairForm.t_vkdebug = my_vkdebug;
if ( document.getElementById( 'content' ) ) {
if ( CatGenRepairForm.t_Content != '' && t_status != 'n' ) {
return;
}
if ( CatGenRepairForm.t_Content == '' ) {
CatGenRepairForm.t_Content = document.getElementById( 'content' ).innerHTML;
}
if ( CatGenRepairForm.t_Sic_GenContent != '' ) {
document.getElementById( 'content' ).innerHTML = CatGenRepairForm.t_Sic_GenContent;
document.getElementById( 'Typ' ).selectedIndex = CatGenRepairForm.t_selectedTyp;
CatGenRepairForm.t_Sic_GenContent = '';
return;
}
out = '<form method="get" style="width:100%" name="CatGenRepairForm">' +
'<fieldset><legend>Vorlagen- und Kategoriegenerator - Ergänzungen</legend>' +
'<div style="margin-top:.5em; margin-left:1em; margin-right:1em;">' +
'<h3>Parameter</h3>' +
'<p><input type="button" value="Vorschau" ' +
'title="Erzeugt eine Vorschau der Vorlagen und Kategorien mit Inhalten" onClick="PreCheckRepairPreviewVFiles()"> ' +
'<input type="button" style="float:right;" value="Schließen" title="Beendet den Vorlagen und Kategorien-Generator" onClick="UnloadCatGenRepairForm()">' +
'<select id="Typ" size="8" type="hidden" ' +
'onchange="this.form.TypSel.value = this.form.Typ.options[this.form.Typ.selectedIndex].value">';
for ( t_Typ = 0; t_Typ < CatGenRepairForm.t_Typen.length; t_Typ++ ) {
out += '<option value="' + CatGenRepairForm.t_Typen[t_Typ] + '">' + CatGenRepairForm.t_Typen[t_Typ] + '</option>';
}
out += '</select><input id="TypSel" name="TypSel" type="hidden" value=""><br><br><br>' +
'<table><tr><td><input id="Debugging" type="checkbox"></td><td>Debugging</td></tr></table>' +
'<p id="StatusPrev" style="border: 1px solid #aaa; padding:.5em;display:none;">Debuginfo</p></p>' +
'<div id="PreviewForm"></div>' +
'<div id="TemplateForm"></div>' +
'<div id="InsertCreateForm"></div>' +
'</div></fieldset></form><div id="tippinfo"></div>';
document.getElementById( 'content' ).innerHTML = out;
t_tippinfo = document.getElementById('tippinfo');
}
}
};
function PreCheckRepairPreviewVFiles( ) {
CatGenRepairForm.PreCheckRepairPreviewVFiles();
}
function UnloadCatGenRepairForm( ) {
CatGenRepairForm.UnloadCatGenRepairForm();
}
var TW_PERSONAL = "p-personal";
var TW_WERKZEUGE = "p-tb";
var TW_REITER = "column-one";
function InsertNode(p_href, p_text, p_id, p_tag, p_before_id)
{
var new_a = document.createElement('a');
new_a.href = p_href;
new_a.appendChild(document.createTextNode(p_text));
var new_li = document.createElement('li');
new_li.appendChild(new_a);
var tmp_nodes = document.getElementById(p_id).getElementsByTagName(p_tag);
tmp_Node = tmp_nodes[0];
if (p_before_id)
{
tmp_Node.insertBefore(new_li.cloneNode(true), document.getElementById(p_before_id));
}
else
{
tmp_Node.appendChild(new_li.cloneNode(true));
}
}
function setcursor( cursortype ) {
document.getElementById( 'content' ).style.cursor = cursortype;
for ( i = 0; i < document.getElementById( 'content' ).getElementsByTagName( 'input' ).length; i++ ) {
document.getElementById( 'content' ).getElementsByTagName( 'input' )[i].style.cursor = cursortype;
}
}
function trim( t_string ) {
return t_string.replace (/^\s+/, '').replace (/\s+$/, '');
}