]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/index.html
Matitaweb: added a titlebar to the GUI.
[helm.git] / matitaB / matita / index.html
index fa119b5bae1e632e7364f0c84aa99e33146dc065..d3fe3491f263e0e34314fe5ff35496d329c5e4b9 100644 (file)
 <html>
-<head>
-</head>
-                 
-<head>
-<script language="JavaScript">
-var locked;
-var unlocked;
-var workarea;
-var scriptcell;
-var goalcell;
-var goals;
-var goalview;
-var filename;
-var logarea;
-var advanceButton;
-var retractButton;
-var cursorButton;
-var bottomButton;
-
-function initialize()
-{
-  locked = document.getElementById("locked");
-  unlocked = document.getElementById("unlocked");
-  workarea = document.getElementById("workarea");
-  scriptcell = document.getElementById("scriptcell");
-  goalcell = document.getElementById("goalcell");
-  goals = document.getElementById("goals");
-  goalview = document.getElementById("goalview");
-  filename = document.getElementById("filename");
-  logarea = document.getElementById("logarea");
-  advanceButton = document.getElementById("advance");
-  retractButton = document.getElementById("retract");
-  cursorButton = document.getElementById("cursor");
-  bottomButton = document.getElementById("bottom");
-
-  // hide sequent view at start
-  hideSequent();
-}
-
-function debug(txt)
-{
-        logarea.innerHTML = txt + "\n" + logarea.innerHTML;
-}
-
-function listhd(l)
-{
-       ar = l.split("#");
-        debug("hd of '" + l + "' = '" + ar[0] + "'");
-        return (ar[0]);
-}
-
-function listtl(l)
-{
-        i = l.indexOf("#");
-        tl = l.substr(i+1);
-        debug("tl of '" + l + "' = '" + tl + "'");
-        return (tl);
-}
-
-function listcons(x,l)
-{
-        debug("cons '" + x + "' on '" + l + "'");
-       return (x + "#" + l);
-}
-
-function listnil()
-{
-       return ("");
-}
-
-function is_nil(l)
-{
-       return (l == "");
-}
-
-function fold_left (f,acc,l)
-{
-       if (is_nil(l))
-           { debug("'" + l + "' is fold end");
-          return (acc); }
-        else
-          { debug("'" + l + "' is fold cons");
-             return(fold_left (f,f(acc,(listhd(l))),listtl(l))); }
-}
-
-function listiter (f,l)
-{
-       if (is_nil(l))
-        { debug("'" + l + "' is nil");
-          return;
-        }
-       else
-       {
-           debug("'" + l + "' is not nil");
-          f(listhd(l));
-          listiter(f,listtl(l));
-        }
-}
-
-function listmap (f,l)
-{
-        debug("listmap on " + l);
-       if (is_nil(l)) 
-           { debug("returning listnil");
-            return(listnil());
-           }
-       else 
-          { debug("cons f(hd) map(f,tl)");
-            return(f(listhd(l)) + "#" + listmap(f,listtl(l)));
-           }
-}
-
-var statements = listnil();
-
-var goalarray;
-var metalist = listnil();
-
-function pairmap (f,p)
-{
-  debug("pairmap of '" + p + "'");
-  ar = p.split("|");
-  return (f(ar[0],ar[1])); 
-}
-
-function tripletmap (f,p)
-{
-  debug("tripletmap of '" + p + "'");
-  ar = p.split("|");
-  return (f(ar[0],ar[1],ar[2])); 
-}
-
-function fst (p)
-{
-  debug("fst");
-  return (pairmap (function (a,b) { return (a); }, p));
-}
-
-function p13 (p)
-{
-  debug("p13");
-  return (tripletmap (function (a,b,c) { return (a); }, p));
-}
-
-function p23 (p)
-{
-  debug("p23");
-  return (tripletmap (function (a,b,c) { return (b); }, p));
-}
-
-function p33 (p)
-{
-  debug("f33");
-  return (tripletmap (function (a,b,c) { return (c); }, p));
-}
-
-function populate_goalarray(txt)
-{
-  if (txt == "") {
-      try {
-          hideSequent();
-      } catch (err) { };
-  } else {
-      showSequent();
-      debug("populate with '" + txt + "'");
-      goalarray = new Array();
-      metalist = listnil();
-      var tmp_goallist = "";
-      listiter (function(item)
-        {
-         debug ("item is '" + item + "'");
-         tripletmap (function(a,ahtml,b) {   
-          debug ("found meta n. " + a);
-          debug ("found goal\nBEGIN" + unescape(b) + "\nEND");
-          goalarray[a] = unescape(b);
-          tmp_goallist = " <A href=\"javascript:switch_goal(" + a + ")\">" + unescape(ahtml) + "</A>" + tmp_goallist;
-          metalist = listcons(a,metalist);
-          debug ("goalarray[\"" + a + "\"] = " + goalarray[a]); 
-         },item);
-        }, txt);
-      // metalist = listmap (p13,txt);
-      goals.innerHTML = tmp_goallist;
-      debug("new metalist is '" + metalist + "'");
-      if (is_nil(metalist)) {
-        switch_goal();
-      }
-      else {
-        switch_goal(listhd(metalist));
-      }
-  }
-}
-
-function switch_goal(meta)
-{
-  if (typeof meta == "undefined") {
-    goalview.innerHTML = "";
-  }
-  else {
-    debug("switch_goal " + meta + "\n" + goalarray[meta]);
-    goalview.innerHTML = "<B>Goal ?" + meta + ":</B>\n\n" + goalarray[meta];
-  }
-}
 
-String.prototype.unescapeHTML = function()
-{
-       var patt1 = /<br(\/|)>/gi;
-       var patt2 = /&lt;/gi;
-       var patt3 = /&gt;/gi;
-       var result = this;
-       result = result.replace(patt1,"\n");
-       result = result.replace(patt2,"<");
-       result = result.replace(patt3,">");
-       return (unescape(result));
-}
-
-function pause()
-{
-       advanceButton.disabled = true;
-        retractButton.disabled = true;
-        cursorButton.disabled = true;
-        bottomButton.disabled = true;
-}
-
-function resume()
-{
-       advanceButton.disabled = false;
-        retractButton.disabled = false;
-        cursorButton.disabled = false;
-        bottomButton.disabled = false;
-}
-
-function advanceForm1(cb)
-{
-       var req = null; 
-        pause();
-       if (window.XMLHttpRequest)
-       {
-               req = new XMLHttpRequest();
-       } 
-       else if (window.ActiveXObject) 
-       {
-               try {
-                               req = new ActiveXObject("Msxml2.XMLHTTP");
-               } catch (e)
-               {
-                       try {
-                               req = new ActiveXObject("Microsoft.XMLHTTP");
-                               } catch (e) {}
-               }
-       }
-       req.onreadystatechange = function()
-       { 
-
-               rs = req.readyState;
-               stat = req.status;
-               stxt = req.statusText;
-
-               if(rs == 4)
-               {
-                       var len;
-                       if(stat == 200)
-                       {
-                               debug("advance: received response\nBEGIN\n" + req.responseText + "\nEND");
-                               response = req.responseText.split("@");
-                               len = parseInt(response[0]);
-                                len0 = unlocked.innerHTML.length;
-                               unescaped = unlocked.innerHTML.unescapeHTML();
-                               parsedtxt = unescaped.substr(0,len); 
-                               unparsedtxt = unescaped.substr(len);
-                               locked.innerHTML = locked.innerHTML + parsedtxt;
-                               unlocked.innerHTML = unparsedtxt;
-                               len1 = unlocked.innerHTML.length;
-                               len2 = len0 - len1;
-                                populate_goalarray(response[1]);
-                               statements = listcons(len2,statements);
-                               unlocked.scrollIntoView(true);
-                       }       
-                       else    
-                       {
-                               debug("advance error: returned status code " + req.status + " " + req.statusText + "\n" + 
-                                 req.responseText);
-                               len = 0;       
-                       }       
-                       resume();
-                       if (cb) {
-                               cb(len);
-                       }
-               } 
-       };
-       req.open("POST", "advance"); // + escape(unlocked.innerHTML), true); 
-       req.send(unlocked.innerHTML.unescapeHTML()); 
-  
-}
-
-function gotoBottom()
-{
-       var req = null; 
-        pause();
-       if (window.XMLHttpRequest)
-       {
-               req = new XMLHttpRequest();
-       } 
-       else if (window.ActiveXObject) 
-       {
-               try {
-                               req = new ActiveXObject("Msxml2.XMLHTTP");
-               } catch (e)
-               {
-                       try {
-                               req = new ActiveXObject("Microsoft.XMLHTTP");
-                               } catch (e) {}
-               }
-       }
-       req.onreadystatechange = function()
-       { 
-
-               rs = req.readyState;
-               stat = req.status;
-               stxt = req.statusText;
-
-               if(rs == 4)
-               {
-                       if(stat == 200)
-                       {
-                               debug("goto bottom: received response\nBEGIN\n" + req.responseText + "\nEND");
-                               response = req.responseText.split("@");
-                               len = parseInt(response[0]);
-                                len0 = unlocked.innerHTML.length;
-                               unescaped = unlocked.innerHTML.unescapeHTML();
-                               parsedtxt = unescaped.substr(0,len); 
-                               unparsedtxt = unescaped.substr(len);
-                               locked.innerHTML = locked.innerHTML + parsedtxt;
-                               unlocked.innerHTML = unparsedtxt;
-                               len1 = unlocked.innerHTML.length;
-                               len = len0 - len1;
-                                populate_goalarray(response[1]);
-                               statements = listcons(len,statements);
-                                unlocked.scrollIntoView(true);
-                       }       
-                       else    
-                       {
-                               debug("goto bottom error: returned status code " + req.status + " " + req.statusText + "\n" + 
-                                  req.responseText);
-                       }       
-                        resume();
-               } 
-       };
-       req.open("POST", "bottom"); // + escape(unlocked.innerHTML), true); 
-       req.send(unlocked.innerHTML.unescapeHTML()); 
-  
-}
-
-function gotoPos(offset)
-{
-        if (!offset) {
-               offset = getCursorPos();
-        }
-       if (offset > 0) {
-               advanceForm1(function(len) {
-                       gotoPos(offset-len)
-               });
-       }
-           
-}
-
-function retract()
-{
-       var req = null; 
-       if (window.XMLHttpRequest)
-       {
-               req = new XMLHttpRequest();
-       } 
-       else if (window.ActiveXObject) 
-       {
-               try {
-                               req = new ActiveXObject("Msxml2.XMLHTTP");
-               } catch (e)
-               {
-                       try {
-                               req = new ActiveXObject("Microsoft.XMLHTTP");
-                               } catch (e) {}
-               }
-       }
-       req.onreadystatechange = function()
-       { 
-
-               rs = req.readyState;
-               stat = req.status;
-               stxt = req.statusText;
-
-               if(rs == 4)
-               {
-                       if(stat == 200)
-                       {
-                               debug("retract: received response\nBEGIN\n" + req.responseText + "\nEND");
-                               response = req.responseText;
-                               statementlen = parseInt(listhd(statements));
-                                statements = listtl(statements);
-                                lockedlen = locked.innerHTML.length - statementlen;
-                               statement = locked.innerHTML.substr(lockedlen, statementlen);
-                                locked.innerHTML = locked.innerHTML.substr(0,lockedlen);
-                               unlocked.innerHTML = statement + unlocked.innerHTML;
-                                populate_goalarray(response);
-                                unlocked.scrollIntoView(true);
-                       }       
-                       else    
-                       {
-                               debug("retract error: returned status code " + req.status + " " + req.statusText + "\n" + 
-                                  req.responseText);
-                       }       
-                        resume();
-               } 
-       };
-       req.open("GET", "retract"); // + escape(unlocked.innerHTML), true); 
-       req.send(); 
-  
-}
-
-function openFile()
-{ 
-       var req = null; 
-       if (window.XMLHttpRequest)
-       {
-               req = new XMLHttpRequest();
-       } 
-       else if (window.ActiveXObject) 
-       {
-               try {
-                               req = new ActiveXObject("Msxml2.XMLHTTP");
-               } catch (e)
-               {
-                       try {
-                               req = new ActiveXObject("Microsoft.XMLHTTP");
-                               } catch (e) {}
-               }
-       }
-       req.onreadystatechange = function()
-       { 
-
-               rs = req.readyState;
-               stat = req.status;
-               stxt = req.statusText;
-
-               if(rs == 4)
-               {
-                       if(stat == 200)
-                       {
-                                locked.innerHTML = "";
-                                unlocked.innerHTML = req.responseText;
-                       }       
-                       else    
-                       {
-                               debug("open error: returned status code " + req.status + " " + req.statusText + "\n" + 
-                                  req.responseText);
-                       }       
-               } 
-       };
-       req.open("GET", "open?file=" + escape(filename.value), true); 
-       req.send(); 
-}
-
-var goalcell;
-
-function hideSequent() {
-  goalcell.parentNode.removeChild(goalcell);
-  scriptcell.setAttribute("colspan","2");
-}
-
-function showSequent() {
-  scriptcell.setAttribute("colspan","1");
-  workarea.appendChild(goalcell);
-}
-
-function removeElement(id) {
-  var element = document.getElementById(id);
-  element.parentNode.removeChild(element);
-} 
-
-function getCursorPos() {
-  var cursorPos;
-  if (window.getSelection) {
-    var selObj = window.getSelection();
-    var selRange = selObj.getRangeAt(0);
-    //cursorPos =  findNode(selObj.anchorNode.parentNode.childNodes, selObj.anchorNode) + selObj.anchorOffset;
-    cursorPos =  findNode(unlocked.childNodes, selObj.anchorNode,0) + selObj.anchorOffset;
-    /* FIXME the following works wrong in Opera when the document is longer than 32767 chars */
-    return(cursorPos);
-  }
-  else if (document.selection) {
-    var range = document.selection.createRange();
-    var bookmark = range.getBookmark();
-    /* FIXME the following works wrong when the document is longer than 65535 chars */
-    cursorPos = bookmark.charCodeAt(2) - 11; /* Undocumented function [3] */
-    return(cursorPos);
-  }
-}
+<head>
+<script type="text/javascript" src="utf8MacroTable.js"></script>
+<script type="text/javascript" src="matitaweb.js"></script>
+<link rel="stylesheet" type="text/css" href="matitaweb.css"/>
 
-function findNode(list, node, acc) {
-  for (var i = 0; i < list.length; i++) {
-    if (list[i] == node) {
-   //   debug("success " + i);
-      return acc;
-    }
-    if (list[i].hasChildNodes()) {
-       try {
-   //      debug("recursion on node " + i);
-         return (findNode(list[i].childNodes,node,acc))
-       }
-       catch (e) { /* debug("recursion failed"); */ }
-    }
-    sandbox = document.getElementById("sandbox");
-    dup = list[i].cloneNode(true);
-    sandbox.appendChild(dup);
-//    debug("fail " + i + ": " + sandbox.innerHTML);
-    acc += sandbox.innerHTML.length;
-    sandbox.removeChild(dup);
-  }
-  throw "not found";
-}
+<link href="treeview/xmlTree.css" type="text/css" rel="stylesheet"/>
+<script src="treeview/xmlTree.js" type="text/javascript"></script>
 
-function test () {
-  debug("cursor test: " + unlocked.innerHTML.substr(0,getCursorPos()));
-}
-</script>
 </head>
 
 <body onLoad="initialize();">
+<textarea id="unescape" style="display:none;"></textarea>
 <div id="sandbox" style="visibility:hidden;"></div>
-<table style="table-layout: fixed; width:100%; height:100%; border-spacing: 0px; border-style: none;">
-<tr>
-<td style="padding: 0px; width:67%; border-style: none;">
-       <textarea id="unescape" style="display:none;"></textarea>
-       <p><INPUT type="BUTTON" value="advance" id="advance" ONCLICK="advanceForm1()">
-          <INPUT type="BUTTON" value="go back" id="retract" ONCLICK="retract()">
-          <INPUT type="BUTTON" value="go to cursor" id="cursor" ONCLICK="gotoPos()">
-          <INPUT type="BUTTON" value="bottom" id="bottom" ONCLICK="gotoBottom()"> &nbsp;
-       <INPUT type="TEXT" id="filename" value=""><INPUT type="BUTTON" value="Open" ONCLICK="openFile()"></p>
-          <INPUT type="BUTTON" value="show sequent" id="showseq" ONCLICK="showSequent()">
+
+<div class="matitaapparea">
+
+<div class="titlebar">
+  <div class="mainTitle"><H2 id="matitaTitle">Matita - &lt;&lt;Filename&gt;&gt;</H2></div>
+  <div class="mainRight" id="matitaLogout"><A id="hlogout" href="/logout.html">Log out</A></div>
+</div>
+
+
+<div class="toparea">
+<div class="navibar">
+           <A href="javascript:advanceForm1()"><IMG class="topimg" src="icons/advance.png" 
+                                                    id="advance" alt="Advance" 
+                                                    title="Execute one step of the script."></A>
+          <A href="javascript:retract()"><IMG class="topimg" src="icons/retract.png" 
+                                              id="retract" alt="Retract"
+                                               title="Undo execution of one step of the script."></A>
+          <A href="javascript:gotoTop()"><IMG class="topimg" src="icons/top.png" 
+                                                 id="top" alt="Top" title="Undo execution of the whole script."></A>
+          <A href="javascript:gotoPos()"><IMG class="topimg" src="icons/position.png" 
+                                               id="cursor" alt="Play"
+                                               title="Execute the script until the current position of the cursor."></A>
+          <A href="javascript:gotoBottom()"><IMG class="topimg" src="icons/bottom.png" 
+                                                 id="bottom" alt="Bottom" title="Execute the whole script."></A>
+</div>
+<div class="toolbar">
+  <table>
+  <tr>
+    <td>
+          <INPUT type="BUTTON" value="New" id="newbutton" ONCLICK="newDialog()">
+          <INPUT type="BUTTON" value="Open" id="showdialog" ONCLICK="openDialog()">
+          <INPUT type="BUTTON" value="Save" id="savebutton" ONCLICK="saveFile()">
+          <INPUT type="BUTTON" value="Save as" id="saveasbutton" ONCLICK="saveDialog()">
+    </td>
+  </tr>
+  <tr>
+    <td>
+          <INPUT type="BUTTON" value="Upload" id="uploadbutton" ONCLICK="uploadDialog()">
+           <INPUT type="BUTTON" value="Commit" id="commitbutton" ONCLICK="commitAll()">
+           <INPUT type="BUTTON" value="Update" id="updatebutton" ONCLICK="updateAll()">
+           <INPUT type="BUTTON" value="Log" id="logbutton" ONCLICK="showLog()">
+<!--      <INPUT type="BUTTON" value="show sequent" id="showseq" ONCLICK="showSequent()">
           <INPUT type="BUTTON" value="hide sequent" id="hideseq" ONCLICK="hideSequent()">
-          <INPUT type="BUTTON" value="selection test" id="hideseq" ONCLICK="test()">
+          <INPUT type="BUTTON" value="selection test" id="hideseq" ONCLICK="test()"> -->
+    </td>
+  </tr>
+  </table> 
+
+</div>
+<div class="caption"><p><img align="bottom" class="topimg" src="icons/matita-text.png"></p></div>
+</div>
 
-</td>
-<td style="width:33%; text-align:center;"><img src="icons/matita-text.png"></td>
-</tr>
-<tr id="workarea" style="height:80%;">
-<td id="scriptcell" style="padding: 0px; border-style: none; padding: 0px;">
+<div class="workarea" id="workarea">
+<div class="scriptarea" id="scriptcell">
   <!-- the script --> 
   <!-- 
   The two DIVs "locked" and "unlocked" MUST be on the same line (since they are 
@@ -552,19 +75,36 @@ function test () {
   <div style="width:100%; height:100%; overflow:auto;">
   <pre><div contentEditable="false" id="locked" style="background-color:#bfbfff; display:inline;"></div><div contentEditable="true" id="unlocked" style="display:inline">(* script *)</div></pre></div>
   <!-- the script (end) --> 
-</td>
-<td id="goalcell" style="padding: 0px; width:33%; border-style: none;">
+</div>
+<div class="goalarea" id="goalcell">
   <div id="goals"></div>
-  <div contentEditable="true" style="border-style:solid; height:100%; width:100%; overflow:auto;">
+  <div contentEditable="true" style="border-style:solid; height:95%; width:100%; overflow:auto;">
   <pre id="goalview"></pre>
   </div>
-</td>
+</div>
+</div>
 
-<tr style="height:15%">
-<td colspan="2" style="padding: 0px; border-style: none;">
+<!-- <div class="bottomarea">
        <textarea id="logarea" style="width:100%; height:100%"></textarea>
-</td>
-</tr>
-</table>
+</div> -->
+
+</div>
+
+<div class="dialog" id="dialogBox" style="display: none;">
+  <div class="diaTitle" id="dialogTitle"></div>
+  <div class="diaClose" id="dialogClose"><H2><A id="butClose" href="javascript:abortDialog()">X</A></H2></div>
+  <INPUT type="button" id="dialogNewdir" value="Create dir..." ONCLICK="createDir()" style="width:150px"><br/>
+  <div class="scroll" id="dialogContent"></div>
+  <INPUT class="diaFile" type="text" id="dialogFilename">
+  <INPUT type="button" id="dialogSelect" value="OK" ONCLICK="dialogOK()" style="width:70px">
+</div>
+
+<div class="upload" id="uploadBox" style="display: none;">
+  <div class="dialogTitle" id="uploadTitle"></div>
+  <div class="diaClose" id="uploadClose"><H2><A id="but1Close" href="javascript:abortUpload()">X</A></H2></div>
+  <INPUT class="diaFile" type="file" id="uploadFilename">
+  <INPUT type="button" id="uploadSelect" value="OK" ONCLICK="uploadOK()" style="width:70px">
+</div>
+
  </body>
  </html>