[Phoenix-commits] rev 13752 - in public/phoenix/trunk/phoenix/prototypes/prototype1/src: . chrome/content chrome/locale/en chrome/skin

andi at wyona.com andi at wyona.com
Wed May 31 21:11:32 CEST 2006


Author: andi
Date: 2006-05-31 21:11:30 +0200 (Wed, 31 May 2006)
New Revision: 13752

Modified:
   public/phoenix/trunk/phoenix/prototypes/prototype1/src/HACKING.txt
   public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.js
   public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.xul
   public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/locale/en/editor.dtd
   public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/skin/editor.css
Log:
Added basic infrastructure for opening and saving documents from and to the file system.


Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/HACKING.txt
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/HACKING.txt	2006-05-31 16:52:12 UTC (rev 13751)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/HACKING.txt	2006-05-31 19:11:30 UTC (rev 13752)
@@ -4,8 +4,10 @@
     - background color for wysiwyg view should be fetched from browser.display.background_color pref
 
  * General directions:
-    1. dynamic edit view addition
-    2. save as... to desktop
-    3. open document button inside editor (should kill current edit
+    1. Save as... to desktop
+    2. Open document button inside editor (should kill current edit
        session, and restart, maybe by reloading the chrome url in the
        current tab)
+    3. Parse introspection file
+    4. Make "Edit" menu glow in case of available introspection
+    5. Dynamic view addition

Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.js
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.js	2006-05-31 16:52:12 UTC (rev 13751)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.js	2006-05-31 19:11:30 UTC (rev 13752)
@@ -27,30 +27,86 @@
  */
 
 const EDITOR_WINDOW_TITLE = "Phoenix Editor";
+const PHOENIX_EDITOR_CHROME_URI = "chrome://phoenix/content/editor.xul";
 
 var gEditorController = null;
 
-function onLoadListener() {
-    /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() invoked\n");
+var Editor = {
+    onLoadListener: function () {
+        /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() invoked\n");
 
-    // prevent from multiple initialisations
-    if (!document.getElementById("uiPhoenixEditorWindow").getAttribute("editorInit")) {
-        /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() is being run for the first time\n");
+        // prevent from multiple initialisations
+        if (!document.getElementById("uiPhoenixEditorWindow").getAttribute("editorInit")) {
+            /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() is being run for the first time\n");
 
-        // we are initialising
-        document.getElementById("uiPhoenixEditorWindow").setAttribute("editorInit", true);
+            // we are initialising
+            document.getElementById("uiPhoenixEditorWindow").setAttribute("editorInit", true);
 
 
-        // set window title
-        document.title = EDITOR_WINDOW_TITLE;
+            // set window title
+            document.title = EDITOR_WINDOW_TITLE;
 
-        gEditorController = new PhoenixEditController();
+            gEditorController = new PhoenixEditController();
 
-        /* Check which tab is currently selected and run
-         * its activation code. */
-        document.getElementById("uiPhoenixEditorTabbox").selectedTab.doCommand();
-    } else {
-        /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() already ran. Not going to initialise multiple times.\n");
-        return;
+            /* Check which tab is currently selected and run
+             * its activation code. */
+            document.getElementById("uiPhoenixEditorTabbox").selectedTab.doCommand();
+        } else {
+            /* DEBUG */ dump("Phoenix:editor.js:onLoadListener() already ran. Not going to initialise multiple times.\n");
+            return;
+        }
+    },
+
+    replaceEditor: function (aBrowser, aURI) {
+        var phoenixTab = null;
+        var targetURI  = null;
+
+        /* DEBUG */ dump("Phoenix:editor.js:replaceEditor() invoked\n");
+
+        try {
+            // construct target URI
+            targetURI = PHOENIX_EDITOR_CHROME_URI + "?" + aURI.spec;
+
+            window.location.replace(targetURI);
+        } catch (exception) {
+            dump("Phoenix:editor.js:replaceEditor: failed to replace editor: " + exception.toString() + "\n");
+            return;
+        }
+
+        /* DEBUG */ dump("Phoenix:editor.js:replaceEditor: replaced editor\n");
+    },
+
+    openFromFile: function () {
+        var documentURI = null;
+
+        // open file picker dialog for local file system
+
+        // replace the current editor
+        Editor.replaceEditor(documentURI);
+    },
+
+    openFromCMS: function () {
+        var documentURI = null;
+
+        // open file picker dialog for CMS
+
+        // replace the current editor
+        Editor.replaceEditor(documentURI);
+    },
+
+    saveTempToFile: function () {
+
+    },
+
+    saveToCMS: function () {
+
+    },
+
+    saveAsToFile: function () {
+
+    },
+
+    saveAsToCMS: function () {
+
     }
 }

Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.xul
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.xul	2006-05-31 16:52:12 UTC (rev 13751)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/editor.xul	2006-05-31 19:11:30 UTC (rev 13752)
@@ -32,7 +32,7 @@
 <window id="uiPhoenixEditorWindow"
         orient="vertical"
         align="stretch"
-        onload="onLoadListener()"
+        onload="Editor.onLoadListener()"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/x-javascript"
@@ -50,8 +50,24 @@
     <toolbar id="uiPhoenixEditorToolbar"
              toolbarname="Phoenix Editor Toolbar">
       <box id="uiPhoenixFileOperationsToolbarbuttons">
-        <toolbarbutton id="uiFileOperationSave"   label="&fileOperationSave.label;"   tooltiptext="&fileOperationSave.tooltip;"   disabled="true"/>
-        <toolbarbutton id="uiFileOperationSaveAs" label="&fileOperationSaveAs.label;" tooltiptext="&fileOperationSaveAs.tooltip;" disabled="true"/>
+        <toolbarbutton id="uiFileOperationOpen"   label="&fileOperationOpen.label;"   tooltiptext="&fileOperationOpen.tooltip;"   disabled="false" type="menu">
+          <menupopup id="uiFileOperationOpenMenupopup">
+            <menuitem id="uiFileOperationOpenLocalMenuitem" oncommand="Editor.openFromFile()" label="&fileOperationOpenLocalMenuitem.label;" tooltiptext="&fileOperationOpenLocalMenuitem.tooltip;"  disabled="false"/>
+            <menuitem id="uiFileOperationOpenCMSMenuitem"   oncommand="Editor.openFromCMS()"  label="&fileOperationOpenCMSMenuitem.label;"   tooltiptext="&fileOperationOpenCMSMenuitem.tooltip;"    disabled="true"/>
+          </menupopup>
+        </toolbarbutton>
+        <toolbarbutton id="uiFileOperationSave"   label="&fileOperationSave.label;"   tooltiptext="&fileOperationSave.tooltip;"   disabled="false" type="menu">
+          <menupopup id="uiFileOperationSaveMenupopup">
+            <menuitem id="uiFileOperationSaveTempMenuitem" oncommand="Editor.saveTempToFile()" label="&fileOperationSaveTempMenuitem.label;" tooltiptext="&fileOperationSaveTempMenuitem.tooltip;"  disabled="false"/>
+            <menuitem id="uiFileOperationSaveCMSMenuitem"   oncommand="Editor.saveToCMS()"     label="&fileOperationSaveCMSMenuitem.label;"  tooltiptext="&fileOperationSaveCMSMenuitem.tooltip;"    disabled="true"/>
+          </menupopup>
+        </toolbarbutton>
+        <toolbarbutton id="uiFileOperationSaveAs" label="&fileOperationSaveAs.label;" tooltiptext="&fileOperationSaveAs.tooltip;" disabled="false" type="menu">
+          <menupopup id="uiFileOperationSaveAsMenupopup">
+            <menuitem id="uiFileOperationSaveAsLocalMenuitem" oncommand="Editor.saveAsToFile()" label="&fileOperationSaveAsLocalMenuitem.label;" tooltiptext="&fileOperationSaveAsLocalMenuitem.tooltip;"  disabled="false"/>
+            <menuitem id="uiFileOperationSaveAsCMSMenuitem"   oncommand="Editor.saveAsToCMS()"  label="&fileOperationSaveAsCMSMenuitem.label;"   tooltiptext="&fileOperationSaveAsCMSMenuitem.tooltip;"    disabled="true"/>
+          </menupopup>
+        </toolbarbutton>
       </box>
       <toolbarseparator/>
       <box id="uiPhoenixEditOperationsToolbarbuttons">

Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/locale/en/editor.dtd
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/locale/en/editor.dtd	2006-05-31 16:52:12 UTC (rev 13751)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/locale/en/editor.dtd	2006-05-31 19:11:30 UTC (rev 13752)
@@ -1,19 +1,33 @@
-<!ENTITY editOperationCopy.label   "Copy">
-<!ENTITY editOperationCut.label    "Cut">
-<!ENTITY editOperationPaste.label  "Paste">
-<!ENTITY editOperationRedo.label   "Redo">
-<!ENTITY editOperationUndo.label   "Undo">
-<!ENTITY fileOperationSave.label   "Save">
-<!ENTITY fileOperationSaveAs.label "Save As...">
-<!ENTITY sourceViewTab.label       "Source">
-<!ENTITY wysiwygViewTab.label      "WYSIWYG">
+<!ENTITY editOperationCopy.label                "Copy">
+<!ENTITY editOperationCut.label                 "Cut">
+<!ENTITY editOperationPaste.label               "Paste">
+<!ENTITY editOperationRedo.label                "Redo">
+<!ENTITY editOperationUndo.label                "Undo">
+<!ENTITY fileOperationOpen.label                "Open">
+<!ENTITY fileOperationOpenLocalMenuitem.label   "Open from file system">
+<!ENTITY fileOperationOpenCMSMenuitem.label     "Checkout from CMS">
+<!ENTITY fileOperationSave.label                "Save">
+<!ENTITY fileOperationSaveTempMenuitem.label    "Save temporary copy">
+<!ENTITY fileOperationSaveCMSMenuitem.label     "Check back in to CMS">
+<!ENTITY fileOperationSaveAs.label              "Save As...">
+<!ENTITY fileOperationSaveAsLocalMenuitem.label "Save to file system as...">
+<!ENTITY fileOperationSaveAsCMSMenuitem.label   "Checkin to CMS as...">
+<!ENTITY sourceViewTab.label                    "Source">
+<!ENTITY wysiwygViewTab.label                   "WYSIWYG">
 
-<!ENTITY editOperationCopy.tooltip   "Copy selection to clipboard">
-<!ENTITY editOperationCut.tooltip    "Cut selection and copy to clipboard">
-<!ENTITY editOperationPaste.tooltip  "Paste from clipboard">
-<!ENTITY editOperationRedo.tooltip   "Redo last operation">
-<!ENTITY editOperationUndo.tooltip   "Undo last operation">
-<!ENTITY fileOperationSave.tooltip   "Save document">
-<!ENTITY fileOperationSaveAs.tooltip "Save document as...">
-<!ENTITY sourceViewTab.tooltip       "View the source code of the document">
-<!ENTITY wysiwygViewTab.tooltip      "View the WYSIWYG representation of the document">
+<!ENTITY editOperationCopy.tooltip                "Copy selection to clipboard">
+<!ENTITY editOperationCut.tooltip                 "Cut selection and copy to clipboard">
+<!ENTITY editOperationPaste.tooltip               "Paste from clipboard">
+<!ENTITY editOperationRedo.tooltip                "Redo last operation">
+<!ENTITY editOperationUndo.tooltip                "Undo last operation">
+<!ENTITY fileOperationOpen.tooltip                "Open document">
+<!ENTITY fileOperationOpenLocalMenuitem.tooltip   "Open document from file system and edit">
+<!ENTITY fileOperationOpenCMSMenuitem.tooltip     "Checkout document from CMS and edit">
+<!ENTITY fileOperationSave.tooltip                "Save document">
+<!ENTITY fileOperationSaveTempMenuitem.tooltip    "Save a temporary copy of the document to the file system">
+<!ENTITY fileOperationSaveCMSMenuitem.tooltip     "Check document back in to the CMS">
+<!ENTITY fileOperationSaveAs.tooltip              "Save document as...">
+<!ENTITY fileOperationSaveAsLocalMenuitem.tooltip "Save dcoument to file system as...">
+<!ENTITY fileOperationSaveAsCMSMenuitem.tooltip   "Checkin document to CMS as...">
+<!ENTITY sourceViewTab.tooltip                    "View the source code of the document">
+<!ENTITY wysiwygViewTab.tooltip                   "View the WYSIWYG representation of the document">

Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/skin/editor.css
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/skin/editor.css	2006-05-31 16:52:12 UTC (rev 13751)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/skin/editor.css	2006-05-31 19:11:30 UTC (rev 13752)
@@ -32,74 +32,133 @@
 /* for gnome icons see bin/share/icons/gnome/24x24/stock/generic */
 /* note: rect(top_edge right_edge bottom_edge left_edge) */
 
+#uiFileOperationOpen {
+  list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
+  -moz-image-region: rect(0px 264px 24px 240px);
+  -moz-box-orient: vertical;
+}
+
+#uiFileOperationOpen > dropmarker {
+  display: none !important;
+}
+
+#uiFileOperationOpen[disabled="false"]:active {
+  -moz-image-region: rect(24px 264px 48px 240px);
+}
+
+#uiFileOperationOpen[disabled="true"] {
+  -moz-image-region: rect(48px 264px 72px 240px);
+}
+
+
 #uiFileOperationSave {
   list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
   -moz-image-region: rect(0px 264px 24px 240px);
   -moz-box-orient: vertical;
 }
 
+#uiFileOperationSave > dropmarker {
+  display: none !important;
+}
+
+#uiFileOperationSave[disabled="false"]:active {
+  -moz-image-region: rect(24px 264px 48px 240px);
+}
+
 #uiFileOperationSave[disabled="true"] {
-  list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
   -moz-image-region: rect(48px 264px 72px 240px);
-  -moz-box-orient: vertical;
 }
 
+
 #uiFileOperationSaveAs {
   list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
   -moz-image-region: rect(0px 264px 24px 240px);
   -moz-box-orient: vertical;
 }
 
+#uiFileOperationSaveAs > dropmarker {
+  display: none !important;
+}
+
+#uiFileOperationSaveAs[disabled="false"]:active {
+  -moz-image-region: rect(24px 264px 48px 240px);
+}
+
 #uiFileOperationSaveAs[disabled="true"] {
   -moz-image-region: rect(48px 264px 72px 240px);
 }
 
+
 #uiEditOperationUndo {
   list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
   -moz-image-region: rect(0px 313px 24px 288px);
   -moz-box-orient: vertical;
 }
 
+#uiEditOperationUndo[disabled="false"]:active {
+  -moz-image-region: rect(24px 313px 48px 288px);
+}
+
 #uiEditOperationUndo[disabled="true"] {
   -moz-image-region: rect(48px 313px 72px 288px);
 }
 
+
 #uiEditOperationRedo {
   list-style-image: url("chrome://phoenix/skin/icons/mail-toolbar-small.png");
   -moz-image-region: rect(0px 339px 24px 314px);
   -moz-box-orient: vertical;
 }
 
+#uiEditOperationRedo[disabled="false"]:active {
+  -moz-image-region: rect(24px 339px 48px 314px);
+}
+
 #uiEditOperationRedo[disabled="true"] {
   -moz-image-region: rect(48px 339px 72px 314px);
 }
 
+
 #uiEditOperationCut {
   list-style-image: url("chrome://phoenix/skin/icons/compose-toolbar-small.png");
   -moz-image-region: rect(0px 192px 24px 168px);
   -moz-box-orient: vertical;
 }
 
+#uiEditOperationCut[disabled="false"]:active {
+  -moz-image-region: rect(24px 192px 48px 168px);
+}
+
 #uiEditOperationCut[disabled="true"] {
   -moz-image-region: rect(48px 192px 72px 168px);
 }
 
+
 #uiEditOperationCopy {
   list-style-image: url("chrome://phoenix/skin/icons/compose-toolbar-small.png");
   -moz-image-region: rect(0px 216px 24px 192px);
   -moz-box-orient: vertical;
 }
 
+#uiEditOperationCopy[disabled="false"]:active {
+  -moz-image-region: rect(24px 216px 48px 192px);
+}
+
 #uiEditOperationCopy[disabled="true"] {
   -moz-image-region: rect(48px 216px 72px 192px);
 }
 
+
 #uiEditOperationPaste {
   list-style-image: url("chrome://phoenix/skin/icons/compose-toolbar-small.png");
   -moz-image-region: rect(0px 239px 24px 216px);
   -moz-box-orient: vertical;
 }
 
+#uiEditOperationPaste[disabled="false"]:active {
+  -moz-image-region: rect(24px 239px 48px 216px);
+}
+
 #uiEditOperationPaste[disabled="true"] {
   -moz-image-region: rect(48px 239px 72px 216px);
 }




More information about the Phoenix-commits mailing list