[LON-CAPA-cvs] cvs: modules /matthew/newrat Container.js DisplayManager.js Item.js Page.js Resource.js Sequence.js assembler.pl notes.txt overview.js test.js

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 20 Mar 2002 22:03:07 -0000


This is a MIME encoded message

--matthew1016661787
Content-Type: text/plain

matthew		Wed Mar 20 17:03:07 2002 EDT

  Added files:                 
    /modules/matthew/newrat	Container.js notes.txt 

  Modified files:              
    /modules/matthew/newrat	DisplayManager.js Item.js Page.js 
                           	Resource.js Sequence.js assembler.pl 
                           	overview.js test.js 
  Log:
  To see the "progress", run ./assembler.pl and point your web browser
  at ./simple_rat.html.
  
  Sequence and Page objects are now descendents of a new Container object, 
  instead of being descendents of Item.  Added 'edit' mode for drawing items.
  notes.txt contains random (rat-related) thoughts.  overview.js was updated
  to include a little verbage about the Container object and the descriptions
  of the other guys (Item and Display Manager (still ficticious, but there is
  always some hope)) was updated.  
  
  
--matthew1016661787
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20020320170307.txt"

Index: modules/matthew/newrat/DisplayManager.js
diff -u modules/matthew/newrat/DisplayManager.js:1.1 modules/matthew/newrat/DisplayManager.js:1.2
--- modules/matthew/newrat/DisplayManager.js:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/DisplayManager.js	Wed Mar 20 17:03:06 2002
@@ -1,13 +1,13 @@
 // First attempt at getting these damned objects to display themselves
 //
-// $Id: DisplayManager.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
+// $Id: DisplayManager.js,v 1.2 2002/03/20 22:03:06 matthew Exp $
 //
 // Open debugging window
 //
 
 var debugging = true;
 if (debugging) {
-    var debuggingWindow = window.open('','Debugging Window','width=400,height=300',true);
+    var debuggingWindow = window.open('','Debug','width=400,height=300',true);
 } 
 
 function output(text) {
@@ -24,3 +24,4 @@
         "html","problem","quiz","exam","page","sequence","gif","jpg","png",
         "pdf","txt","wav","xml","zip","cab","class","dvi","eps","form","jar",
         "meta","mov","ps","survey","tex");
+
Index: modules/matthew/newrat/Item.js
diff -u modules/matthew/newrat/Item.js:1.1 modules/matthew/newrat/Item.js:1.2
--- modules/matthew/newrat/Item.js:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/Item.js	Wed Mar 20 17:03:06 2002
@@ -1,7 +1,7 @@
 //
 // Item.js
 //
-// $Id: Item.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
+// $Id: Item.js,v 1.2 2002/03/20 22:03:06 matthew Exp $
 // 
 // The base item for a resource, sequence, link, page, rule, etc
 //   Essentially, everything that can be held in a sequence or page is
@@ -50,6 +50,39 @@
     return;
 }
 
+function Item_radiobuttons(name,values,current) {
+    var myname = this.id + ':' + name;
+    var result = '';
+    for (var i = 0; i<values.length; i++) {
+        result += '<input type="radio" name="'+myname+'" id="'+myname+'" ';
+        result += 'value="'+values[i]+'"';
+        if (values[i] == current) {
+             result += ' checked="true"';
+        }
+        result += ' > '+values[i]+'</input>';
+    }
+    return result;
+}
+
+function Item_textfield(name,value) {
+    var result = '';
+    var editsize = 40;
+    var myname = this.id + ':' + name;
+    result += '<input type="text" maxlength="200" size="'+editsize+'" ';
+    result += 'name="'+myname+'" id="'+myname+'" ';
+    result += 'value="'+value+'" />';
+    return result;
+}
+
+function Item_checkbox(name,state) {
+    var myname = this.id + ":" + name;
+    var result = '';
+    result += '<input type="checkbox" name="'+myname+'" id="'+myname+'"';
+    if (state) { result += ' checked ' } ;
+    result += '" >'+name+'</input>';
+    return result;
+}
+
 function Item() {
     // internal data
     this.icon  = 'unknown.gif';
@@ -64,6 +97,10 @@
     this.add_parm = Item_add_parm;
     this.remove_parm = Item_remove_parm;
     this.change_parm = Item_change_parm;
+    // Editing help
+    this.checkbox     = Item_checkbox;
+    this.textfield    = Item_textfield;
+    this.radiobuttons = Item_radiobuttons;
     // "virtual" methods (must be overridden by descendents)
     this.draw = Item_draw;
     this.load = null;
Index: modules/matthew/newrat/Page.js
diff -u modules/matthew/newrat/Page.js:1.1 modules/matthew/newrat/Page.js:1.2
--- modules/matthew/newrat/Page.js:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/Page.js	Wed Mar 20 17:03:06 2002
@@ -1,40 +1,18 @@
 // 
 // Page.js
 //
-// $Id: Page.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
+// $Id: Page.js,v 1.2 2002/03/20 22:03:06 matthew Exp $
 //
-// Child of Item.js
+// Child of Container.js
 // A Page is a file in the lon-capa system.  A Page contains items.
 // The page object cannot be a child of a sequence as they are not 
 // guaranteed to use the same storage mechanism.
 
-function Page_load(text) {}
-function Page_save()     {}
-
-function Page_draw() {
-    var result = '';
-    var mode = 'other';
-    if (mode == 'icon') {
-    } else if (mode == 'detailed') {
-    } else if (mode == 'edit') {
-    } else {
-        result += '<table bgcolor="#00cc00" >';
-        result += '<tr><td rowspan="2">Page</td></tr>';
-        result += '<tr><td>Title:</td><td>'+this.Title+'</td></tr>';
-        result += '<tr><td>URL:</td><td>'+this.url+'</td></tr>';
-        result += '</table>';
-    }
-    return result;
-}
-
+function Page_load() {}
+function Page_save() {}
 function Page_undo() {}
 function Page_redo() {}
 
-function Page_set_title(t) { this.Title=t; }
-function Page_get_title()  { return this.Title; }
-function Page_set_url(u)   { this.url = u;}      
-function Page_get_url()    { return this.url; }  
-
 function Page_draw_contents(mode) {
     // Call the item.draw() method of each of the contained items
     // Should I return an array or an html string???
@@ -96,34 +74,67 @@
                                    // but our array indicies don't change.
 }
 
+function Page_moveup(id) {
+    var index = this.get_indexof(id);
+    if (index == 0) { return; } // We're definately at the top!
+    // find the previous non-empty slot in the array
+    var newindex = index-1;
+    while ((this.contents[newindex] == null) &&
+           (newindex >= 0)) { 
+        newindex --; 
+    }
+    if (newindex < 0) { return; }; // Only empty space between us and the top!
+    // Make the swap
+    var tmp = this.contents[index];
+    this.contents[index]    = this.contents[newindex];
+    this.contents[newindex] = tmp;
+    return;
+}
+
+function Page_movedown(id) {
+    var index = this.get_indexof(id);
+    if (index == (this.contents.length - 1)) { return; } // At the bottom
+    // find the next non-empty slot in the array
+    var newindex = index+1;
+    while ((this.contents[newindex] == null ) &&
+           (newindex <= this.contents.length)) { 
+        newindex ++; 
+    }
+    if (newindex == this.contents.length) { 
+        // Only empty slots between us and the bottom
+        return;
+    }
+    tmp = this.contents[index];
+    this.contents[index]    = this.contents[newindex];
+    this.contents[newindex] = tmp;
+    return;
+}
+
+function Page_add_parm_to(t,n,v,id) {
+    var index = this.get_indexof(id);    
+    if ((index < 0) || (index>= this.contents.length)) { return; }
+    this.contents[index].add_parm(t,n,v,id);
+}
+
 function Page() {
+    // Allocate memory for the items we will store.
+    this.contents = new Array();
+    //
     // We have an item, now make it a sequence
     this.set_type('sequence');
-    this.Title = '';
-    this.url   = '';
-    this.parms = new Array();
-    // 
-    this.set_title = Page_set_title;
-    this.get_title = Page_get_title;
-    this.set_url   = Page_set_url;
-    this.get_url   = Page_get_url;
-    // Required methods
-    this.draw = Page_draw;
+    // Unimplemented methods
     this.load = Page_load;
     this.save = Page_save;
     this.undo = Page_undo;
     this.redo = Page_redo;
     // Container specific methods
-    this.contents = new Array();
     this.draw_contents = Page_draw_contents;
     this.append        = Page_append;
     this.remove        = Page_remove;
     this.insert        = Page_insert;
     this.get_indexof   = Page_indexof;
+    this.moveup        = Page_moveup;
+    this.movedown      = Page_movedown;
+    this.add_parm_to   = Page_add_parm_to;
 }
-Page.prototype = new Item();
-
-
-
-
-
+Page.prototype = new Container();
Index: modules/matthew/newrat/Resource.js
diff -u modules/matthew/newrat/Resource.js:1.2 modules/matthew/newrat/Resource.js:1.3
--- modules/matthew/newrat/Resource.js:1.2	Tue Mar 19 17:06:52 2002
+++ modules/matthew/newrat/Resource.js	Wed Mar 20 17:03:06 2002
@@ -1,7 +1,7 @@
 // 
 // Resource.js
 //
-// $Id: Resource.js,v 1.2 2002/03/19 22:06:52 matthew Exp $
+// $Id: Resource.js,v 1.3 2002/03/20 22:03:06 matthew Exp $
 //
 // Child of Item.js
 // A Resource is a file in the lon-capa system.
@@ -18,7 +18,7 @@
     if (mode == 'icon') {
     } else if (mode == 'normal') {
         result+='<table bgcolor="'+this.get_color()+'" width="100%" >';
-        result+='<tr><td colspan="2">Resource</td></tr>';
+        result+='<tr><td>Resource</td><td align="right">'+this.id+'</td></tr>';
         result+='<tr><td>Title:</td><td width="100%">'+this.Title+'</td></tr>';
         result+='<tr><td>URL:</td><td>'+this.url+'</td></tr>';
         result+='<tr><td>use:</td><td>'+this.use+'</td></tr>';
@@ -26,7 +26,7 @@
         result+='</table><br \>';
     } else if (mode == 'full') {
         result+='<table bgcolor="'+this.get_color()+'" width="100%" >';
-        result+='<tr><td colspan="2">Resource</td></tr>';
+        result+='<tr><td>Resource</td><td align="right">'+this.id+'</td></tr>';
         result+='<tr><td>Title:</td><td width="100%">'+this.Title+'</td></tr>';
         result+='<tr><td>URL:</td><td>'+this.url+'</td></tr>';
         result+='<tr><td>use:</td><td>'+this.use+'</td></tr>';
@@ -41,14 +41,15 @@
         result+='</table><br \>';
     } else if (mode == 'edit') {
         result+='<table bgcolor="'+this.get_color()+'" width="100%" >';
-        result+='<tr><td colspan="2">Resource</td></tr>';
+        result+='<tr><td>Resource</td><td align="right">'+this.id+'</td></tr>';
         result+='<tr><td>Title:</td><td width="100%">';
         result+=this.textfield('title',this.Title);
         result+='</td></tr>';
         result+='<tr><td>URL:</td><td>';
         result+=this.textfield('url',this.url);
         result+='</td></tr>';
-        result+='<tr><td>use:</td><td>'+this.use+'</td></tr>';
+        result+='<tr><td colspan="2">'+this.radiobuttons('use',Resource_uses,this.use)+'</td></tr>';
+        result+='<tr><td colspan="2">'+this.checkbox('External',this.external)+'</td></tr>';
         result+='<tr><td>icon:</td><td>'+this.icon+'</td></tr>';
         result+='</table><br \>';
     } else {
@@ -56,14 +57,6 @@
     return result;
 }
 
-function Resource_textfield(name,value) {
-    var result = '';
-    var editsize = 40;
-    result+='<input type="text" maxlength="200" size="'+editsize+'"';
-    result+='name="'+this.id+name+'" value="'+value+'" />';
-    return result;
-}
-
 function Resource_set_title(t) { this.Title=t;      }
 function Resource_get_title()  { return this.Title; }
 function Resource_get_url()    { return this.url;   }  
@@ -106,6 +99,8 @@
 function Resource_set_external()    { this.external = true; }
 function Resource_set_nonexternal() { this.external = false; }
 
+var Resource_uses=new Array('Regular','Mandatory','Optional');
+
 function Resource(title,url) {
     this.set_title = Resource_set_title;
     this.get_title = Resource_get_title;
@@ -113,11 +108,10 @@
     this.get_url   = Resource_get_url;
     this.set_use   = Resource_set_use;
     this.get_use   = Resource_get_use;
-    this.set_external = Resource_set_external;
+    this.set_external    = Resource_set_external;
     this.set_nonexternal = Resource_set_nonexternal;
-    this.is_external  = Resource_is_external;
-    this.get_color = Resource_get_color;
-    this.textfield = Resource_textfield;
+    this.is_external     = Resource_is_external;
+    this.get_color       = Resource_get_color;
     //
     this.parms = new Array();
     this.title = '';
Index: modules/matthew/newrat/Sequence.js
diff -u modules/matthew/newrat/Sequence.js:1.1 modules/matthew/newrat/Sequence.js:1.2
--- modules/matthew/newrat/Sequence.js:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/Sequence.js	Wed Mar 20 17:03:06 2002
@@ -1,51 +1,17 @@
 //
 // Sequence.js
 //
-// $Id: Sequence.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
+// $Id: Sequence.js,v 1.2 2002/03/20 22:03:06 matthew Exp $
 //
-// Child of Item.js
+// Child of Container.js
 // A Sequence is a file in the lon-capa system.  A Sequence contains items.
 //
 
-function Sequence_load(text) {}
-function Sequence_save()     {}
-
-function Sequence_draw(mode) {
-    var result = '';
-    if (mode == 'icon') {
-    } else if (mode == 'edit') {
-    } else if (mode == 'normal') {
-        result += '<table bgcolor="#00cc00" >';
-        result += '<tr><td rowspan="2">Sequence</td></tr>';
-        result += '<tr><td>Title:</td><td>'+this.Title+'</td></tr>';
-        result += '<tr><td>URL:</td><td>'+this.url+'</td></tr>';
-        result += '</table>';
-    } else if (mode == 'full') {
-        result+='<table bgcolor="#00cc00" width="100%" >';
-        result+='<tr><td colspan="2">Parameter</td></tr>';
-        result+='<tr><td>Title:</td><td width="100%">'+this.Title+'</td></tr>';
-        result+='<tr><td>URL:</td><td>'+this.url+'</td></tr>';
-        result+='<tr><td valign="top" >Parameters:</td><td>';
-        for (var i=0; i<this.parms.length; i++) {
-            if (this.parms[i] != null) {
-                result += this.parms[i].draw() + "<br />";
-            }
-        }
-        result += '</td></tr>';
-        result += '</table><br \>';
-    } else {
-    }
-    return result;
-}
-
+function Sequence_load() {}
+function Sequence_save() {}
 function Sequence_undo() {}
 function Sequence_redo() {}
 
-function Sequence_set_title(t) { this.Title=t; }
-function Sequence_get_title()  { return this.Title; }
-function Sequence_set_url(u)   { this.url = u;}      
-function Sequence_get_url()    { return this.url; }  
-
 function Sequence_draw_contents(mode) {
     // Call the item.draw() method of each of the contained items
     // Should I return an array or an html string???
@@ -150,24 +116,17 @@
 }
 
 function Sequence() {
-    // We have an item, now make it a sequence
+    // Allocate storage space for items
+    this.contents = new Array();
+
+    // We have a container, now make it a sequence
     this.set_type('sequence');
-    this.Title = '';
-    this.url   = '';
-    this.parms = new Array();
-    // 
-    this.set_title = Sequence_set_title;
-    this.get_title = Sequence_get_title;
-    this.set_url   = Sequence_set_url;
-    this.get_url   = Sequence_get_url;
-    // Required methods
-    this.draw = Sequence_draw;
+    // Unimplemented methods
     this.load = Sequence_load;
     this.save = Sequence_save;
     this.undo = Sequence_undo;
     this.redo = Sequence_redo;
-    // Container specific methods
-    this.contents = new Array();
+    //
     this.draw_contents = Sequence_draw_contents;
     this.append        = Sequence_append;
     this.remove        = Sequence_remove;
@@ -177,4 +136,4 @@
     this.movedown      = Sequence_movedown;
     this.add_parm_to   = Sequence_add_parm_to;
 }
-Sequence.prototype = new Item();
+Sequence.prototype = new Container();
Index: modules/matthew/newrat/assembler.pl
diff -u modules/matthew/newrat/assembler.pl:1.1 modules/matthew/newrat/assembler.pl:1.2
--- modules/matthew/newrat/assembler.pl:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/assembler.pl	Wed Mar 20 17:03:06 2002
@@ -1,11 +1,12 @@
 #!/usr/bin/perl -w
 #
-# $Id: assembler.pl,v 1.1 2002/03/19 18:46:53 matthew Exp $
+# $Id: assembler.pl,v 1.2 2002/03/20 22:03:06 matthew Exp $
 #
 $outfile = "simple_rat.html";
 
 @Infiles = qw/
 DisplayManager.js
+Container.js
 Parameter.js
 Item.js
 Resource.js
Index: modules/matthew/newrat/overview.js
diff -u modules/matthew/newrat/overview.js:1.1 modules/matthew/newrat/overview.js:1.2
--- modules/matthew/newrat/overview.js:1.1	Tue Mar 19 13:46:53 2002
+++ modules/matthew/newrat/overview.js	Wed Mar 20 17:03:06 2002
@@ -1,69 +1,56 @@
 // This document provides an overview of the new rat object hierarchy.
 //
-// $Id: overview.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
+// $Id: overview.js,v 1.2 2002/03/20 22:03:06 matthew Exp $
 //
 // The management of the display of the sequences is done by the 
-// DisplayManager object.
+// DisplayManager object.  
+//
+// DisplayManager (aka DM) 
+//     in charge of the final presentation of the data to the user.  
+//     must pass events to the Container object(s) being displayed
+//     allows for display mode selection
+//     provides interface to load, save, undo, redo
+//     "There can only be one!"
+//
+// Container
+//     holds Items
+//     responds to DM commands and event passing
+//     handles events and/or passes events on to the appropriate Item
+//     assigns unique ID's to the Items it holds
+//     when asked to draw its contents, it calls each Items drawing method,
+//         adds any decorations needed for the drawing mode, and passes
+//         the array up to the DM.
+//     provides drawing helpers - code to generate checkboxes, radio buttons,
+//         text entry fields, etc. used by the Items.  This is to ensure the
+//         proper event handling takes place??????
 //
-// The items which can be displayed are:
-//    sequences
-//    pages
-//  
 //    conditionals
 //    links
 //    resources
 //    rules (horizontal lines, like the <hr> tag) (only in pages)
 // 
-// Sequences can contain all of the other types
-// pages can contain only resources, links, and rules (no sub-pages)
+// Containers:
+//     Sequence can contain all of the other types
+//     Pages can contain only resources, links, and rules (no sub-pages)
 // 
-// It is probably the case that sequences and pages should be descendents 
-// of a subclass that defines the interface functions they should provide.
-// This will allow us to add other containment types in the future.
-//
-// The base class is:
 // Item:
-//    type
-//    id
-//    set_type()
-//    get_type()
-//    set_id()
-//    get_id()
-//    --------------------- methods below this line must be overridden
-//    set_parm()
-//    get_parm()
-//    get_icon()
-//    draw()
-//    load()
-//    save()
-//    undo()
-//    redo()
-//
-// Sequences and pages, since they can contain other Items,
-// have the following additional methods:
-//    draw_contents()
-//    load_contents()
-//    save_contents()
-//    undo_contents()
-//    redo_contents()
-//    remove()
-//    moveup()
-//    movedown()
-//    link()
-//
-// conditionals may need to be a part of a resource... or a link...
-// I'm not sure.  This is a bit confusing.....
+//    is a generic type
+//    has a unique id
+//    provides load and save methods.
+//    can draw itself (return a string with html commands to render itself)
+//
+// Items:
+//     Resources have title, url, icon, external, 
+//         use method (regular, manditory, optional)
+//     Conditionals have a condition and an effect (recommend, stop, force)
+//     Horizontal Rules have no attributes
 //
 // resources, sequences, pages, and rules have no need to know where they lay
 // in a containing sequence or page.
 //
-// Each Item must have a unique ID assigned to it.  Once it is assigned, it 
-// should not be changed, so facilities have to be made to deal with this...
-//
-// The display manager will communicate to a container the display mode:
-//    icon
-//    detailed
-//    detailed_edit
+//----------------------------------------------------------------------
+//                                   OLD NOTES
+//----------------------------------------------------------------------
 //
 // The display manager should take care of the window creation and layout
 // (different window (frame) layouts should be available to the user at
@@ -96,3 +83,4 @@
 // Conditionals, it seems, will be a part of links (since the conditions 
 // control travel between resources).
 // 
+
Index: modules/matthew/newrat/test.js
diff -u modules/matthew/newrat/test.js:1.2 modules/matthew/newrat/test.js:1.3
--- modules/matthew/newrat/test.js:1.2	Tue Mar 19 17:06:52 2002
+++ modules/matthew/newrat/test.js	Wed Mar 20 17:03:06 2002
@@ -1,7 +1,7 @@
 //
 // test.js - javascript testing file for new rat objects
 //
-// $Id: test.js,v 1.2 2002/03/19 22:06:52 matthew Exp $
+// $Id: test.js,v 1.3 2002/03/20 22:03:06 matthew Exp $
 //
 // Create a fake sequence...
 var Seq = new Sequence();
@@ -12,24 +12,24 @@
     Seq.append(tmp);
 }
 
-output("Creating extra resource");
+output("Creating Insurgent Resource (id 666)");
 tmp = new Resource("Insurgent Resource","/simple.gif");
 tmp.set_id(666);
-output("Inserting extra resource");
+output("Inserting Insurgent Resource");
 Seq.insert(tmp);
 
-output("Removing Resource");
+output("Removing Resource 8");
 Seq.remove(8);
 
-output("Creating extra resource");
-tmp = new Resource("Insurgent Resource","/sample.gif");
+output("Creating another extra resource");
+tmp = new Resource("Another Insurgent Resource","/sample.png");
 tmp.set_id(667);
-output("Inserting extra resource");
+output("Inserting extra resource after element 7");
 Seq.insert(tmp,7);
 
-output("Creating hr");
+output("Creating hr (38)");
 tmp = new HR(38);
-output("Inserting hr");
+output("Inserting hr after resource id 4");
 Seq.insert(tmp,4);
 
 output("moving hr up from 4...");
@@ -45,6 +45,7 @@
 output("moving hr up from 0...(twice)");
 Seq.moveup(38);
 output("moving hr up from 0...(three times)");
+output("see, it doesn\'t break");
 Seq.moveup(38);
 output("moving hr down a lot");
 Seq.movedown(38);
@@ -61,6 +62,8 @@
 tmp = new Conditional('pigs fly');
 output("Inserting conditional");
 Seq.insert(tmp,2);
+output("Since things are not set up properly yet,");
+output("I was able to insert the conditional without an id");
 
 output("Adding Parameters");
 Seq.add_parm_to('creature','fish'     ,'halibut'             ,2);
@@ -70,6 +73,9 @@
 Seq.add_parm_to('creature','fish','salmon',4);
 Seq.add_parm_to('creature','fish','goldfish',5);
 
+//
+output("Displaying the results");
 document.writeln('<form>');
-document.writeln(Seq.draw_contents('edit'));
+// mode can be 'edit', 'normal', or 'full' ('icon' is planned in the future
+document.writeln(Seq.draw_contents('full'));
 document.writeln('</form>');

Index: modules/matthew/newrat/Container.js
+++ modules/matthew/newrat/Container.js
//
// Container.js
//
// $Id: Container.js,v 1.1 2002/03/20 22:03:06 matthew Exp $
//
// Base class for sequences and pages
//

function Container_load() { alert("Call to Container_load"); }
function Container_save() { alert("Call to Container_save"); }

// Container_undo and Container_redo: 
//     return true (success) or false (there was nothing to undo/redo)
function Container_undo() { alert("Call to Container_undo"); }
function Container_redo() { alert("Call to Container_redo"); }

// These are pretty obvious.  (id) is the unique id of the item being acted on
function Container_remove(id)   { alert("Call to Container_remove");  }
function Container_moveup(id)   { alert("Call to Container_moveup");  }
function Container_movedown(id) { alert("Call to Container_movedown");}
function Container_append(item) { alert("Call to Container_append");  }

// Container_insert: Insert (item) behind item (id).  
//     If (id == null) then insert at head;
//     How we'll deal with this if there is more than one 'behind' 
//     remains to be determined.
function Container_insert() { alert("Call to  Container_insert"); }

// Container_draw_contents(mode)
//     Send draw commands to childern.  Return an array of strings
function Container_draw_contents(mode) { alert("Call to Container_draw"); }

// Container_add_parm_to(parm,id)
//     Add parameter parm to item id
function Container_add_parm_to()   { alert("Call to Container_add");    }

// Container_handle_event(eventstring)
//     Deal with the event yourself or pass it on to the correct item
//     Return true or false (event was handled or not)
function Container_handle_event(eventstring) {
    alert("Call to Container_handle");
}

function Container_set_type(t) { this.type = t; }
function Container_get_type()  { return this.type; }

function Container() {
    this.type = "Container";
    // this.contents holds the items, this is implementation specific.
    this.contents = null;  
    this.set_type = Container_set_type;
    this.get_type = Container_set_type;
    // Unimplemented methods
    this.load = Container_load;
    this.save = Container_save;
    this.undo = Container_undo;
    this.redo = Container_redo;
    // Content manipulation methods
    this.remove        = Container_remove;
    this.moveup        = Container_moveup;
    this.movedown      = Container_movedown;
    this.append        = Container_append;
    this.insert        = Container_insert;
    this.add_parm_to   = Container_add_parm_to;
    // Content display method
    this.draw_contents = Container_draw_contents;
    // Event handler
    this.handle_event  = Container_handle_event;
}

Index: modules/matthew/newrat/notes.txt
+++ modules/matthew/newrat/notes.txt
cd modules/matthew/newrat
./assembler.pl

open simple_rat.html in your web browser to see what's going on.

Sequences need to assign id's automagically:
    manage an array of used ids
    take care of reassigning them when items are deleted.
    
undo/redo need to be carefully thought out....
load/save also need to be thought out.

unit tests need to be developed
    insert, remove, moveup, movedown, add_parm, change_parm, etc.
    All of the interface commands for Conditional and Item must be tested
        in each of their implementations.  
    The tests must be run on each of the platforms

Display Manager needs to be set up - I need to be able to monitor events
    can I automatically detect changes in my forms?  Will 
    onblur="javascript:dispatchevent('eventstring')"
    work for NS4.x,6.2,mozilla, IE4.05,4.5,5.x, mac, windows, linux?



--matthew1016661787--