home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / Denk-Daran.gadget / exportimport.js < prev    next >
Text File  |  2013-04-15  |  13KB  |  397 lines

  1. ∩╗┐//sicherung erstellen
  2. function exportier(){
  3.  
  4.     if(typeof(stat_timeout) != "undefined") clearTimeout(stat_timeout);
  5.     document.getElementById("neustat").innerHTML=dwe;
  6.     document.getElementById("neustat").style.background="none";
  7.     
  8.     //dialog ausgeben
  9.     var ordnerpfad = ShowOpenFolder();
  10.     
  11.     //vorgang abgebrochen
  12.     if(ordnerpfad == "") statreset();
  13.     else{
  14.         
  15.         var temp="DATENSICHERUNG VON GADGET DENK-DARAN - DIESE DATEI NICHT BEARBEITEN! - DATA BACKUP OF GADGET DENK-DARAN - DO NOT EDIT THIS FILE!\r\n";
  16.         temp+=System.Gadget.version+"\r\n";
  17.         temp+=document.getElementById("farbwae").checked+"\r\n";
  18.         temp+=farbe_rahm+"\r\n";
  19.         temp+=farbe_hint+"\r\n";
  20.         temp+=document.getElementById("rahmbreite").selectedIndex+"\r\n";
  21.         temp+=document.getElementById("effekt").selectedIndex+"\r\n";
  22.         temp+=uhr+"\r\n";
  23.         temp+=(document.getElementById("segfarb").selectedIndex+1)+"\r\n";
  24.         temp+=document.getElementById("sek_segment").checked+"\r\n";
  25.         temp+=document.getElementById("blinkgeschw").checked+"\r\n";
  26.         temp+=(document.getElementById("ziffblfarb").selectedIndex+1)+"\r\n";
  27.         temp+=(document.getElementById("hfarb").selectedIndex+1)+"\r\n";
  28.         temp+=(document.getElementById("mfarb").selectedIndex+1)+"\r\n";
  29.         temp+=(document.getElementById("sfarb").selectedIndex+1)+"\r\n";
  30.         temp+=document.getElementById("sek_zeiger").checked+"\r\n";
  31.         temp+=document.getElementById("regspeich").checked+"\r\n";
  32.         temp+=document.getElementById("autoupdate").checked;
  33.         
  34.             
  35.         if(fso.FileExists(ordnerpfad)){
  36.             if (bestat(dvh) == 6) SchreibeDatei(ordnerpfad, temp);
  37.             else statreset();
  38.         }
  39.         else SchreibeDatei(ordnerpfad, temp);
  40.     }
  41. }
  42.  
  43. function SchreibeDatei(ordnerpfad, temp){
  44.     var fso_dat = fso.CreateTextFile(ordnerpfad, true, true);
  45.     fso_dat.Write(temp+"\r\n\r\n"+auftraege[0].join("\r\n")+"\r\n\r\n"+auftraege[1].join("\r\n"));
  46.     fso_dat.close();
  47.     
  48.     document.getElementById("neustat").innerHTML=dad;
  49.     document.getElementById("neustat").style.background="#00CC33";
  50.     stat_timeout = setTimeout("statreset()", 3000);
  51. }
  52.  
  53.  
  54. function ShowOpenFolder(){
  55.     //ordner suchen dialog oeffnen
  56.     var objShell =  new ActiveXObject("Shell.Application");
  57.     var objFolder = objShell.BrowseForFolder(0, wao, 0); 
  58.     
  59.     //Wenn abgebrochen wurde
  60.     if(objFolder == null){
  61.         return "";
  62.     }
  63.     else{ 
  64.         //Pfad des Ordners aus Rueckgabewert extrahieren
  65.         var Pfad = objFolder.Self.Path;
  66.         
  67.         vers=System.Gadget.version;
  68.         
  69.         datnamergeb=datnam();
  70.         if(typeof(datnamergeb) == "undefined") return "";
  71.         else return Pfad+"\\"+datnamergeb+".dat";
  72.     }
  73. }
  74.  
  75.  
  76. function importier(){
  77.     
  78.     if(typeof(stat_timeout) != "undefined") clearTimeout(stat_timeout);
  79.     if(typeof(sumtime) != "undefined") clearTimeout(sumtime);
  80.     
  81.     document.getElementById("neustat").innerHTML=dwg;
  82.     document.getElementById("neustat").style.background="none";
  83.     
  84.     //vermeiden dass noch eine datei vorgew├ñhlt ist
  85.     document.fileform.reset();
  86.     
  87.     
  88.     
  89.     if(document.getElementById("set_ch").checked == false && document.getElementById("auf_ch").checked == false){//keine haken gesetzt
  90.         document.getElementById("neustat").innerHTML=hak;
  91.         document.getElementById("neustat").style.background="red";
  92.         stat_timeout=setTimeout("statreset()", 3000);
  93.     }
  94.     else{
  95.         //durchsuchen-button "anklicken"
  96.         document.getElementById("dateifile").click();
  97.         
  98.         if(document.getElementById("dateifile").value == "") statreset();
  99.         else{
  100.             
  101.             //erster einleseversuch mit pr├╝fung auf leere datei
  102.             var fso_dat = fso.OpenTextFile(document.getElementById("dateifile").value, 1);
  103.             if(fso_dat.AtEndOfStream == false) var dattxt = fso_dat.ReadAll();
  104.             else var dattxt = "";
  105.             fso_dat.close();
  106.             
  107.             //wenn unicode-datei (ab 1.0.0) -> datei in unicode neu laden
  108.             if(dattxt.substring(0, 3) == "├┐├╛D"){
  109.                 var fso_dat = fso.OpenTextFile(document.getElementById("dateifile").value, 1, false, -1);
  110.                 var dattxt = fso_dat.ReadAll();
  111.                 fso_dat.close();
  112.             }
  113.             
  114.             
  115.             
  116.             dattxt = dattxt.split("\r\n\r\n"); //in untergruppen aufteilen
  117.             dattxt[0] = dattxt[0].split("\r\n"); //einstellungen aufteilen
  118.             
  119.             
  120.             //g├╝ltigkeitspr├╝fung
  121.             if(dattxt[0][0] != "DATENSICHERUNG VON GADGET DENK-DARAN - DIESE DATEI NICHT BEARBEITEN! - DATA BACKUP OF GADGET DENK-DARAN - DO NOT EDIT THIS FILE!"){
  122.                 document.getElementById("neustat").innerHTML=ddu;
  123.                 document.getElementById("neustat").style.background="red";
  124.                 stat_timeout = setTimeout("statreset()", 3000);
  125.             }
  126.             else{ //datei g├╝ltig, mit einlesen fortfahren
  127.             
  128.                 //Achtung, ab hier wird zb 0.1.2 zu 102, 0.12.3 zu 1203 oder 1.2.3 zu 10203!
  129.                 var vers_dat_temp = dattxt[0][1].split(".");
  130.                 //0 zus├ñtzlich einf├╝gen wenn zahl kleiner 10
  131.                 for (var i=0; i < vers_dat_temp.length; i++){
  132.                     if(vers_dat_temp[i].length == 1) vers_dat_temp[i] = "0" + vers_dat_temp[i];    
  133.                 }
  134.                 var vers_dat = parseFloat(vers_dat_temp.join(""));
  135.                 
  136.                 var vers_gad_temp = System.Gadget.version.split(".");
  137.                 //0 zus├ñtzlich einf├╝gen wenn zahl kleiner 10
  138.                 for (var i=0; i < vers_gad_temp.length; i++){
  139.                     if(vers_gad_temp[i].length == 1) vers_gad_temp[i] = "0" + vers_gad_temp[i];    
  140.                 }
  141.                 var vers_gad = parseFloat(vers_gad_temp.join(""));
  142.                 
  143.                 
  144.                 if(vers_dat > vers_gad){ //ist datei neuer als gadget?
  145.                     document.getElementById("neustat").innerHTML=ddn;
  146.                     document.getElementById("neustat").style.background="red";
  147.                     stat_timeout = setTimeout("statreset()", 3000);
  148.                 }
  149.                 else{ //alles ok, mit import starten
  150.                     
  151.                     // - - - - - - - Einstellungen - - - - - - -
  152.                     
  153.                     if(document.getElementById("set_ch").checked == true){
  154.                     
  155.                     
  156.                         
  157.                         // - - - - - Version-Konvertierung(en) - - - - -
  158.                         
  159.                         
  160.                         //├ältere Version?
  161.                         if(vers_gad > vers_dat){
  162.                             
  163.                             //├älter als Version 0.29.0?
  164.                             if(vers_dat < 2900){
  165.                                 //"bileff" wurde entfernt
  166.                                 dattxt[0].splice(7,1);
  167.                                 //"pfad" wird nicht neu eingelesen
  168.                                 dattxt[0].splice(11,1);
  169.                             }
  170.                             
  171.                             //├älter als Version 0.31.0?
  172.                             if(vers_dat < 3100){
  173.                                 //zifferblatt: bilder k├╢nnen gew├ñhlt werden
  174.                                 dattxt[0].splice(10, 0, document.getElementById("ziffblfarb").selectedIndex+1, document.getElementById("hfarb").selectedIndex+1, document.getElementById("mfarb").selectedIndex+1, document.getElementById("sfarb").selectedIndex+1);
  175.                             }
  176.                             
  177.                             //├älter als Version 0.32.0?
  178.                             if(vers_dat < 3200){
  179.                                 //schriftfarbe wurde entfernt
  180.                                 dattxt[0].splice(5,1);
  181.                             }
  182.                             
  183.                             //├älter als Version 1.1.3?
  184.                             if(vers_dat < 10103){
  185.                                 //neue, logischere Reihenfolge
  186.                                 var tmp = dattxt[0][5];
  187.                                 dattxt[0].splice(5, 1);
  188.                                 dattxt[0].splice(2, 0, tmp);
  189.                                 
  190.                                 tmp = dattxt[0][8];
  191.                                 dattxt[0].splice(8, 1);
  192.                                 dattxt[0].splice(7, 0, tmp);
  193.                                 
  194.                                 
  195.                                 tmp = new Array(dattxt[0][14], dattxt[0][15]);
  196.                                 dattxt[0].splice(14, 2);
  197.                                 dattxt[0].splice(9, 0, tmp[0], tmp[1]);
  198.                             }
  199.                             
  200.                             //├älter als Version 1.2.0?
  201.                             if(vers_dat < 10200){
  202.                                 //option "autoupdate" kommt hinzu
  203.                                 dattxt[0].splice(17,0, String(document.getElementById("autoupdate").checked));
  204.                             }
  205.                             
  206.                             //├älter als Version 1.2.2?
  207.                             if(vers_dat < 10202){
  208.                                 //option "upmeld" wurde entfernt (wird nun intern geregelt)
  209.                                 dattxt[0].splice(18,1);
  210.                             }
  211.                         }
  212.                         
  213.                         
  214.                         
  215.                         //boolean-werte von string in boolean
  216.                         if(dattxt[0][2] == "true") dattxt[0][2] = true;
  217.                         else dattxt[0][2] = false;
  218.                         
  219.                         if(dattxt[0][9] == "true") dattxt[0][9] = true;
  220.                         else dattxt[0][9] = false;
  221.                         
  222.                         if(dattxt[0][10] == "true") dattxt[0][10] = true;
  223.                         else dattxt[0][10] = false;
  224.                         
  225.                         if(dattxt[0][15] == "true") dattxt[0][15] = true;
  226.                         else dattxt[0][15] = false;
  227.                         
  228.                         if(dattxt[0][16] == "true") dattxt[0][16] = true;
  229.                         else dattxt[0][16] = false;
  230.                         
  231.                         if(dattxt[0][17] == "true") dattxt[0][17] = true;
  232.                         else dattxt[0][17] = false;
  233.                         
  234.                         
  235.                         // - - - - - einstellungen setzen - - - - -
  236.                     
  237.                         //farben erweitert definieren
  238.                         document.getElementById("farbwae").checked = dattxt[0][2];
  239.                         
  240.                         //Rahmenfarbe
  241.                         farbe_rahm = dattxt[0][3];
  242.                         document.getElementById("farbe_rahm_div").style.backgroundColor = farbe_rahm;
  243.                         
  244.                         //Hintergrundfarbe
  245.                         farbe_hint = dattxt[0][4];
  246.                         document.getElementById("farbe_hint_div").style.backgroundColor = farbe_hint;
  247.                         
  248.                         //Rahmendicke
  249.                         document.getElementById("rahmbreite").selectedIndex = dattxt[0][5];
  250.                         
  251.                         //Hintergrundeffekt
  252.                         document.getElementById("effekt").selectedIndex = dattxt[0][6];
  253.                         
  254.                         //Segment oder Zifferblatt
  255.                         document.getElementsByName("uhrinput")[dattxt[0][7]].checked = true;
  256.                         zei(dattxt[0][7]);
  257.                         
  258.                         //segmentfarbe
  259.                         document.getElementById("segfarb").selectedIndex = (dattxt[0][8]-1);
  260.                         
  261.                         //sekunden anzeigen
  262.                         document.getElementById("sek_segment").checked = dattxt[0][9];
  263.                         
  264.                         //blinkgeschwindigkeit
  265.                         document.getElementById("blinkgeschw").checked = dattxt[0][10];
  266.                         disspeed();
  267.                         
  268.                         //zifferblattfarbe
  269.                         document.getElementById("ziffblfarb").selectedIndex = (dattxt[0][11]-1);
  270.                         
  271.                         //stundenzeiger
  272.                         document.getElementById("hfarb").selectedIndex = (dattxt[0][12]-1);
  273.                         
  274.                         //minutenzeiger
  275.                         document.getElementById("mfarb").selectedIndex = (dattxt[0][13]-1);
  276.                         
  277.                         //sekundenzeiger
  278.                         document.getElementById("sfarb").selectedIndex = (dattxt[0][14]-1);
  279.                         
  280.                         //Sekundenzeiger anzeigen
  281.                         document.getElementById("sek_zeiger").checked = dattxt[0][15];
  282.                         
  283.                         //Register Position merken
  284.                         document.getElementById("regspeich").checked = dattxt[0][16];
  285.                         
  286.                         //auto-update
  287.                         document.getElementById("autoupdate").checked = dattxt[0][17];
  288.                         
  289.                     }
  290.                     
  291.                     
  292.                     
  293.                     // - - - - - - -  Auftr├ñge - - - - - - - 
  294.                     
  295.                     if(document.getElementById("auf_ch").checked == true){                    
  296.                         //hinweis: eintr├ñge werden an existierene angeh├ñngt
  297.  
  298.                         //einmalig
  299.                         if(dattxt[1] != ""){
  300.                             
  301.                             //kompatiblit├ñt zu dateistruktur vor v0.32.0
  302.                             if(vers_dat < 3200) dattxt[1] = dattxt[1].split(",");
  303.                             else dattxt[1] = dattxt[1].split("\r\n");
  304.                             
  305.                             
  306.                             // - - - - - Version-Konvertierung(en) - - - - -
  307.                             
  308.                             //├ältere Version?
  309.                             if(vers_gad > vers_dat){
  310.                                 
  311.                                 //Version 0.32.0?
  312.                                 if(vers_dat == 3200){
  313.                                     //maskierte ascii-dateien (wurde nur in dieser version verwendet)
  314.                                     for(var i=0; i<dattxt[1].length; i++){
  315.                                         dattxt[1][i] = decodeURIComponent(dattxt[1][i]);
  316.                                     }
  317.                                 }
  318.                                 
  319.                                 //├älter als Version 1.3.0?
  320.                                 if(vers_dat < 10300){
  321.                                     //nachreich-funktion hinzugef├╝gt
  322.                                     for(var i=0; i<dattxt[1].length; i++){
  323.                                         dattxt[1][i] = dattxt[1][i].substring(0,12) + "0" + dattxt[1][i].substring(12);
  324.                                     }
  325.                                 }
  326.                             
  327.                             }
  328.                             
  329.                             //in bestehende strukur einbinden
  330.                             for(var i=0; i<dattxt[1].length; i++){
  331.                                 auftraege[0].push(dattxt[1][i]);
  332.                             }
  333.                             //├╝bersicht aktualisieren
  334.                             sumschreib(0);
  335.                         }
  336.                         
  337.                         
  338.                         
  339.                         //w├╢chentlich
  340.                         if(dattxt[2] != ""){
  341.                             
  342.                             //kompatiblit├ñt zu dateistruktur vor v0.32.0
  343.                             if(vers_dat < 3200) dattxt[2] = dattxt[2].split(",");
  344.                             else dattxt[2] = dattxt[2].split("\r\n");
  345.                             
  346.                             // - - - - - Version-Konvertierung(en) - - - - -
  347.                             
  348.                             //├ältere Version?
  349.                             if(vers_gad > vers_dat){
  350.                                 
  351.                                 //Version 0.32.0?
  352.                                 if(vers_dat == 3200){
  353.                                     //maskierte ascii-dateien (wurde nur in dieser version verwendet)
  354.                                     for(var i=0; i<dattxt[2].length; i++){
  355.                                         dattxt[2][i] = decodeURIComponent(dattxt[2][i]);
  356.                                     }
  357.                                 }
  358.                                 
  359.                                 //├älter als Version 1.3.0?
  360.                                 if(vers_dat < 10300){
  361.                                     //nachreich-funktion hinzugef├╝gt; montag ist nun statt sonntag an erster stelle
  362.                                     for(var i=0; i<dattxt[2].length; i++){
  363.                                         dattxt[2][i] = dattxt[2][i].substring(1,7) + dattxt[2][i].substring(0,1) +  dattxt[2][i].substring(7,11) + "00" + dattxt[2][i].substring(11);
  364.                                     }
  365.                                 }
  366.                             }
  367.                             
  368.                             //in bestehende strukur einbinden
  369.                             for(var i=0; i<dattxt[2].length; i++){
  370.                                 auftraege[1].push(dattxt[2][i]);
  371.                             }
  372.                             //├╝bersicht aktualisieren
  373.                             sumschreib(1);
  374.                         }
  375.                         
  376.                         ztensave();
  377.                     }
  378.                     
  379.                     
  380.                     //import abgeschlossen
  381.                     document.getElementById("neustat").innerHTML=wie;
  382.                     document.getElementById("neustat").style.background="#00CC33";
  383.                     stat_timeout = setTimeout("statreset()", 3000);
  384.                     
  385.                 }
  386.             }
  387.         }
  388.     }
  389. }
  390.  
  391.  
  392. //status resetten
  393. function statreset(){
  394.     document.getElementById("neustat").innerHTML="";
  395.     document.getElementById("neustat").style.background="none";
  396. }
  397.