[LON-CAPA-cvs] cvs: modules /matthew/newrat Conditional.js DisplayManager.js HR.js Item.js Page.js Parameter.js Resource.js Sequence.js assembler.pl footer.html overview.js test.js
matthew
lon-capa-cvs@mail.lon-capa.org
Tue, 19 Mar 2002 18:46:53 -0000
This is a MIME encoded message
--matthew1016563613
Content-Type: text/plain
matthew Tue Mar 19 13:46:53 2002 EDT
Added files:
/modules/matthew/newrat Conditional.js DisplayManager.js HR.js
Item.js Page.js Parameter.js Resource.js
Sequence.js assembler.pl footer.html
overview.js test.js
Log:
Initial check in of work on a new resource assembly tool.
--matthew1016563613
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20020319134653.txt"
Index: modules/matthew/newrat/Conditional.js
+++ modules/matthew/newrat/Conditional.js
//
// Conditional.js
//
// $Id: Conditional.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Child of Item.js
// A Conditional is a file in the lon-capa system.
// A Conditional has parameters and links associated with it.
//
function Conditional_load(text) {}
function Conditional_save() {}
function Conditional_draw() {
var result = '';
var mode = 'other';
if (mode == 'icon') {
} else if (mode == 'edit') {
} else if (mode == 'normal') {
result += '<table bgcolor="#7777cc" width="100%">';
result += '<tr><td colspan="2">Conditional</td></tr>';
result += '<tr><td>Condition:</td><td>'+this.condition+'</td></tr>';
result += '</table><br \>';
} else if (mode == 'full') {
result += '<table bgcolor="#7777cc" width="100%">';
result += '<tr><td colspan="2">Conditional</td></tr>';
result += '<tr><td>Condition:</td><td>'+this.condition+'</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 Conditional_undo() {}
function Conditional_redo() {}
function Conditional_set_cond(condition) { this.condition=condition; }
function Conditional_get_cond(condition) { return this.condition; }
function Conditional(condition) {
this.parms = new Array();
//
this.set_cond = Conditional_set_cond;
this.get_cond = Conditional_get_cond;
//
this.set_type('condition');
if (arguments.length >= 1) { this.set_cond(condition);}
else { this.set_cond(''); }
// Required methods
this.draw = Conditional_draw;
this.load = Conditional_load;
this.save = Conditional_save;
this.undo = Conditional_undo;
this.redo = Conditional_redo;
}
Conditional.prototype = new Item();
Index: modules/matthew/newrat/DisplayManager.js
+++ modules/matthew/newrat/DisplayManager.js
// First attempt at getting these damned objects to display themselves
//
// $Id: DisplayManager.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Open debugging window
//
var debugging = true;
if (debugging) {
var debuggingWindow = window.open('','Debugging Window','width=400,height=300',true);
}
function output(text) {
if (debugging) {
debuggingWindow.document.writeln(text);
}
}
output("<html><head><title>Debugging Window</title></head>");
output("<body><hr /><pre>");
// IconPatterns holds the file extensions we have icons for. Changes to
// the contents of /html/adm/lonIcons need to be reflected here.
var IconPatterns = new Array(
"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/HR.js
+++ modules/matthew/newrat/HR.js
//
// HR.js
//
// $Id: HR.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Child of Item.js
// A HR is a horizontal rule which can be held inside a page.
//
function HR_load(text) { }
function HR_save() { }
function HR_draw(mode) {
var result = '';
if (mode == 'icon') {
} else if (mode == 'edit') {
} else if (mode == 'normal') {
result += '<table bgcolor="#00cc00" width="100%">';
result += '<tr><td>Horizontal Rule</td></tr>';
result += '</table><br \>';
} else if (mode == 'full') {
result += '<table bgcolor="#cc8888" width="100%">';
result += '<tr><td>Horizontal Rule</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(mode) + "<br />";
}
}
result += '</td></tr>';
result += '</table><br \>';
} else {
}
return result;
}
function HR_undo() { }
function HR_redo() { }
function HR(id) {
this.parms = new Array(); // Probably unnecessary, but what the hell.
//
this.set_type('hr');
if (arguments.length >= 1) {
this.set_id(id);
}
// Required methods
this.draw = HR_draw;
this.load = HR_load;
this.save = HR_save;
this.undo = HR_undo;
this.redo = HR_redo;
}
HR.prototype = new Item();
Index: modules/matthew/newrat/Item.js
+++ modules/matthew/newrat/Item.js
//
// Item.js
//
// $Id: Item.js,v 1.1 2002/03/19 18:46:53 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
// an Item.
//
function Item_draw() { }
function Item_get_icon() { return this.icon; }
function Item_set_type(t) { this.type = t; }
function Item_set_id(i) { this.id = i; }
function Item_get_id() { return this.id; }
function Item_get_type() { return this.type; }
function Item_add_parm(t,n,v,o) {
if (arguments.length == 1) { // Assume we've been given a parameter
this.parms[this.parms.length]=t;
} else if(arguments.length==4) {
this.parms[this.parms.length]=new Parameter(t,n,v,o);
}
}
function Item_remove_parm(n) {
for (var i = 0; i<this.parms.length; i++) {
if (this.parms[i] != null) {
if (this.parms[i].is_this_you(n)) {
delete this.parms[i];
}
}
}
}
function Item_change_parm(t,n,v,o) {
if (n == '') { return; } // User must specify a name
var index = -1;
for (var i = 0; i<this.parms.length; i++) {
if (this.parms[i] != null) {
if (this.parms[i].is_this_you(n)) {
index = i;
}
}
}
if (index < 0) { return; } // Invalid name specified
if (t != null) { this.parms[index].set_type(t); }
if (v != null) { this.parms[index].set_value(v); }
if (o != null) { this.parms[index].set_owner(o); }
return;
}
function Item() {
// internal data
this.icon = 'unknown.gif';
this.type = 'item';
this.id = null;
this.parms = null; // Each child must allocate their own.
// methods
this.set_type = Item_set_type;
this.set_id = Item_set_id;
this.get_id = Item_get_id;
this.get_type = Item_get_type;
this.add_parm = Item_add_parm;
this.remove_parm = Item_remove_parm;
this.change_parm = Item_change_parm;
// "virtual" methods (must be overridden by descendents)
this.draw = Item_draw;
this.load = null;
this.save = null;
this.undo = null;
this.redo = null;
}
Index: modules/matthew/newrat/Page.js
+++ modules/matthew/newrat/Page.js
//
// Page.js
//
// $Id: Page.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Child of Item.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_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???
// We'll do an html string at first.
var result = '';
for (var i = 0; i < this.contents.length; i++) {
if (this.contents[i]) {
result += this.contents[i].draw();
}
}
return result;
}
function Page_append(item) {
// Add (item) to the end of the contained items
var index = this.contents.length;
this.contents[index]=item;
}
function Page_indexof(id) {
var index = 0;
while(index < this.contents.length) {
if (this.contents[index] != null ) {
if (this.contents[index].get_id() == id) { break; }
}
index++;
}
return index;
}
function Page_insert(item,id) {
// Insert (item) behind item (id). If (id == null) then insert at head;
//
// Find the index of the one we want...
var index;
if (id == null ) {
index = 0;
} else {
index = this.get_indexof(id);
index++; // Hmmm?
}
//
// Move the others forward
var current = this.contents.length;
// move all items at index and above forward 1
while(current > index) {
this.contents[current]=this.contents[current-1];
current--;
}
//
// Finally, assign the new value
this.contents[index]=item;
}
function Page_remove(id) {
// Find the index of the one we want.
var index = this.get_indexof(id);
delete this.contents[index]; // This should delete the item from memory,
// but our array indicies don't change.
}
function Page() {
// 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;
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;
}
Page.prototype = new Item();
Index: modules/matthew/newrat/Parameter.js
+++ modules/matthew/newrat/Parameter.js
//
// Parameter.js
//
// $Id: Parameter.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// A parameter is simply a name, value, and type associated with an id.
//
function Parameter_draw(mode) {
var result = '';
if (mode == 'icon') {
} else if (mode == 'edit') {
} else if ((mode == 'normal') || mode=='full') {
result+='<table bgcolor="#bbbbbb" width="100%">';
result+='<tr><td>type: </td><td width="90%">'+this.get_type();
result+='</td></tr>';
result+='<tr><td>name: </td><td>' + this.get_name() + '</td></tr>';
result+='<tr><td>value:</td><td>' + this.get_value() + '</td></tr>';
result+='</table>';
} else {
}
return result;
}
function Parameter_load() {}
function Parameter_save() {}
function Parameter_undo() {}
function Parameter_redo() {}
function Parameter_set_owner(o) { this.owner = o; }
function Parameter_get_owner() { return this.owner; }
function Parameter_set_type(t) { this.type = t; }
function Parameter_get_type() { return this.type; }
function Parameter_set_name(n) { this.name = n; }
function Parameter_get_name() { return this.name; }
function Parameter_set_value(v) { this.value = v; }
function Parameter_get_value() { return this.value; }
function Parameter_is_this_you(name) {
if (this.name == name ) {
return true;
} else {
return false;
}
}
function Parameter(type,name,value,owner) {
// internal data
this.type = '';
this.name = '';
this.value = '';
this.owner = '';
//
if (arguments.length > 0) { this.type = type; }
if (arguments.length > 1) { this.name = name; }
if (arguments.length > 2) { this.value = value; }
if (arguments.length > 3) { this.owner = owner; }
// This may not work...
// if (arguments.length == 2) { this.owner = caller.get_id() };
//
// methods
this.set_type = Parameter_set_type;
this.get_type = Parameter_get_type;
this.set_name = Parameter_set_name;
this.get_name = Parameter_get_name;
this.set_value = Parameter_set_value;
this.get_value = Parameter_get_value;
this.is_this_you = Parameter_is_this_you;
//
// "virtual" methods (must be overridden by descendents)
this.draw = Parameter_draw;
this.load = Parameter_load;
this.save = Parameter_save;
this.undo = Parameter_undo;
this.redo = Parameter_redo;
}
Index: modules/matthew/newrat/Resource.js
+++ modules/matthew/newrat/Resource.js
//
// Resource.js
//
// $Id: Resource.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Child of Item.js
// A Resource is a file in the lon-capa system.
// A Resource has parameters and links associated with it.
//
function Resource_load() {}
function Resource_save() {}
function Resource_undo() {}
function Resource_redo() {}
function Resource_draw(mode) {
var result = '';
if (mode == 'icon') {
} else if (mode == 'edit') {
} else if (mode == 'normal') {
result+='<table bgcolor="#00cc00" width="100%" >';
result+='<tr><td colspan="2">Resource</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>icon:</td><td>'+this.icon+'</td></tr>';
result+='</table><br \>';
} else if (mode == 'full') {
result+='<table bgcolor="#00cc00" width="100%" >';
result+='<tr><td colspan="2">Resource</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>icon:</td><td>'+this.icon+'</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(mode) + "<br />";
}
}
result+='</td></tr>';
result+='</table><br \>';
} else {
}
return result;
}
function Resource_set_title(t) { this.Title=t; }
function Resource_get_title() { return this.Title; }
function Resource_get_url() { return this.url; }
function Resource_set_url(u) {
this.url = u;
// Figure out the icon we need.
this.icon = 'unknown.gif';
// Hmmm, have to test everyone we know?
var pattern;
for (var i = 0; i< IconPatterns.length; i++) {
pattern = new RegExp('\.'+IconPatterns[i]+'$');
if (pattern.test(this.url)) {
this.icon = IconPatterns[i]+'.gif';
break; // Escape from the for loop
}
}
}
function Resource(title,url) {
this.set_title = Resource_set_title;
this.get_title = Resource_get_title;
this.set_url = Resource_set_url;
this.get_url = Resource_get_url;
//
this.parms = new Array();
this.title = '';
this.url = '';
//
this.set_type('resource');
//
if (arguments.length > 0) { this.set_title(title);}
if (arguments.length > 1) { this.set_url(url); }
// Required methods
this.draw = Resource_draw;
this.load = Resource_load;
this.save = Resource_save;
this.undo = Resource_undo;
this.redo = Resource_redo;
}
Resource.prototype = new Item();
Index: modules/matthew/newrat/Sequence.js
+++ modules/matthew/newrat/Sequence.js
//
// Sequence.js
//
// $Id: Sequence.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Child of Item.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_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???
// We'll do an html string at first.
var result = '';
for (var i = 0; i < this.contents.length; i++) {
if (this.contents[i]) {
result += this.contents[i].draw(mode);
}
}
return result;
}
function Sequence_append(item) {
// Add (item) to the end of the contained items
var index = this.contents.length;
this.contents[index]=item;
}
function Sequence_indexof(id) {
var index = 0;
while(index < this.contents.length) {
if (this.contents[index] != null ) {
if (this.contents[index].get_id() == id) { break; }
}
index++;
}
return index;
}
function Sequence_insert(item,id) {
// Insert (item) behind item (id). If (id == null) then insert at head;
//
// Find the index of the one we want...
var index;
if (id == null ) {
index = 0;
} else {
index = this.get_indexof(id);
index++; // Hmmm?
}
//
// Move the others forward
var current = this.contents.length;
// move all items at index and above forward 1
while(current > index) {
this.contents[current]=this.contents[current-1];
current--;
}
//
// Finally, assign the new value
this.contents[index]=item;
}
function Sequence_remove(id) {
// Find the index of the one we want.
var index = this.get_indexof(id);
delete this.contents[index]; // This should delete the item from memory,
// but our array indicies don't change.
}
function Sequence_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 Sequence_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 Sequence_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 Sequence() {
// We have an item, 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;
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;
this.insert = Sequence_insert;
this.get_indexof = Sequence_indexof;
this.moveup = Sequence_moveup;
this.movedown = Sequence_movedown;
this.add_parm_to = Sequence_add_parm_to;
}
Sequence.prototype = new Item();
Index: modules/matthew/newrat/assembler.pl
+++ modules/matthew/newrat/assembler.pl
#!/usr/bin/perl -w
#
# $Id: assembler.pl,v 1.1 2002/03/19 18:46:53 matthew Exp $
#
$outfile = "simple_rat.html";
@Infiles = qw/
DisplayManager.js
Parameter.js
Item.js
Resource.js
Conditional.js
Sequence.js
Page.js
HR.js
/;
push (@Infiles,"test.js");
push (@Infiles,"footer.html");
open OUT, ">$outfile" || die "Unable to write file\n";
print OUT <<"END";
<html>
<script>
END
foreach (@Infiles) {
open IN, $_ || die "Unable to read $_\n";
while (<IN>) {
print OUT $_;
}
close IN;
}
close OUT;
Index: modules/matthew/newrat/footer.html
+++ modules/matthew/newrat/footer.html
</script>
<!-- $Id: footer.html,v 1.1 2002/03/19 18:46:53 matthew Exp $ -->
<head>
<title>Simple Resource Assembly Tool</title>
</head>
<body>
</body>
Index: modules/matthew/newrat/overview.js
+++ modules/matthew/newrat/overview.js
// 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 $
//
// The management of the display of the sequences is done by the
// DisplayManager object.
//
// 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)
//
// 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.....
//
// 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
//
// The display manager should take care of the window creation and layout
// (different window (frame) layouts should be available to the user at
// some point in the future). There should be a "file browser" window
// which allows users to add files to their sequence. At first this can
// take the form of an 'append' button, but ideally we should allow the
// user to insert files.
//
// Of course, the file browser should be available from the 'edit' button/link
// of the resource editing stuff.
//
// The display manager will provide hooks for the edit, status, and info
// windows. Using these hooks, items must:
// a) describe themselves briefly (status window)
// b) descrive themselves verbosely (info window)
// c) set up themselves to be edited (edit window)
// This means providing an edit window and taking the edited
// information and changing their own state.
//
// Each Item must keep track of its internal state - no changes to internal
// parameters will be made without calling the objects methods which will
// keep track of the latest changes.
//
// Resources, links, and conditionals must be editable.
// Resources will have parameters that can be edited, as well as a title
// and a url.
// Links can be made between two resources (specified by ID or selection
// (handled somehow by the display manager)), or deleted
// A resource can be linked to more than one other resource.
// Conditionals, it seems, will be a part of links (since the conditions
// control travel between resources).
//
Index: modules/matthew/newrat/test.js
+++ modules/matthew/newrat/test.js
//
// test.js - javascript testing file for new rat objects
//
// $Id: test.js,v 1.1 2002/03/19 18:46:53 matthew Exp $
//
// Create a fake sequence...
var Seq = new Sequence();
for (var i=0; i<15; i++) {
output("Creating Resource: "+i);
var tmp = new Resource("Resource " +i,"/dev/null");
tmp.set_id(i);
Seq.append(tmp);
}
output("Creating extra resource");
tmp = new Resource("Insurgent Resource","/simple.gif");
tmp.set_id(666);
output("Inserting extra resource");
Seq.insert(tmp);
output("Removing Resource");
Seq.remove(8);
output("Creating extra resource");
tmp = new Resource("Insurgent Resource","/sample.gif");
tmp.set_id(667);
output("Inserting extra resource");
Seq.insert(tmp,7);
output("Creating hr");
tmp = new HR(38);
output("Inserting hr");
Seq.insert(tmp,4);
output("moving hr up from 4...");
Seq.moveup(38);
output("moving hr up from 3...");
Seq.moveup(38);
output("moving hr up from 2...");
Seq.moveup(38);
output("moving hr up from 1...");
Seq.moveup(38);
output("moving hr up from 0...(once)");
Seq.moveup(38);
output("moving hr up from 0...(twice)");
Seq.moveup(38);
output("moving hr up from 0...(three times)");
Seq.moveup(38);
output("moving hr down a lot");
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
Seq.movedown(38);
output("Creating conditional");
tmp = new Conditional('pigs fly');
output("Inserting conditional");
Seq.insert(tmp,2);
output("Adding Parameters");
Seq.add_parm_to('creature','fish' ,'halibut' ,2);
Seq.add_parm_to('creature','mammal' ,'bear' ,2);
Seq.add_parm_to('creature','marsupial','duck-billed-platypus',2);
Seq.add_parm_to('creature','fish','bass',3);
Seq.add_parm_to('creature','fish','salmon',4);
Seq.add_parm_to('creature','fish','goldfish',5);
document.writeln(Seq.draw_contents('full'));
--matthew1016563613--