Index: openacs-4/packages/curriculum-central/curriculum-central.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/curriculum-central.info,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/curriculum-central/curriculum-central.info	2 Feb 2006 11:45:48 -0000	1.8
+++ openacs-4/packages/curriculum-central/curriculum-central.info	2 Feb 2006 11:52:15 -0000	1.9
@@ -7,14 +7,14 @@
     <initial-install-p>f</initial-install-p>
     <singleton-p>f</singleton-p>
     
-    <version name="0.4.0d" url="http://openacs.org/repository/download/apm/curriculum-central-0.4.0d.apm">
+    <version name="0.4.1d" url="http://openacs.org/repository/download/apm/curriculum-central-0.4.1d.apm">
         <owner url="mailto:ncarroll@ee.usyd.edu.au">Nick Carroll</owner>
         <summary>An application for managing the subjects comprising a course of study in a School or University.</summary>
         <vendor url="http://www.weg.ee.usyd.edu.au">WEG</vendor>
         <description format="text/html">Curriculum Central is an application for managing subjects comprising a course of study in a School or University.  The application will allow academic staff to collaborate on course syllabus and rubrics, which can then be conveyed to students using course maps.</description>
         <maturity>0</maturity>
 
-        <provides url="curriculum-central" version="0.4.0d"/>
+        <provides url="curriculum-central" version="0.4.1d"/>
         <requires url="acs-content-repository" version="5.2.0d2"/>
         <requires url="acs-kernel" version="5.2.0d2"/>
         <requires url="acs-tcl" version="5.2.0d1"/>
Index: openacs-4/packages/curriculum-central/sql/postgresql/session-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/sql/postgresql/session-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/sql/postgresql/session-create.sql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,162 @@
+--
+-- packages/curriculum-central/sql/postgresql/session-create.sql
+--
+-- @author Nick Carroll (nick.c@rroll.net)
+-- @creation-date 2005-11-08
+-- @cvs-id $Id: session-create.sql,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+--
+--
+
+
+create function inline_0 ()
+returns integer as'
+begin 
+    PERFORM acs_object_type__create_type (
+	''cc_session'',			-- object_type
+	''#curriculum-central.session#'',	-- pretty_name
+	''#curriculum-central.sessions#'',	-- pretty_plural
+	''acs_object'',				-- supertype
+	''cc_session'',			-- table_name
+	''session_id'',			-- id_column
+	null,				-- package_name
+	''f'',				-- abstract_p
+	null,				-- type_extension_table
+	''cc_session__name''		-- name_method
+	);
+
+    return 0;
+end;' language 'plpgsql';
+
+select inline_0 ();
+drop function inline_0 ();
+
+
+create table cc_session (
+	session_id	integer
+                        constraint cc_session_session_id_fk
+                        references acs_objects(object_id)
+			constraint cc_session_session_id_pk primary key,
+	name 		varchar(256)
+			constraint cc_session_name_nn not null
+			constraint cc_session_name_un unique,
+	start_date 	timestamptz,
+	end_date	timestamptz,
+	package_id	integer
+			constraint cc_session_package_id_fk
+			references apm_packages(package_id) on delete cascade
+);
+
+
+--
+-- Attributes for the Session Object
+--
+create function inline_1 ()
+returns integer as '
+begin
+    PERFORM acs_attribute__create_attribute (
+	  ''cc_session'',		-- object_type
+	  ''name'',			-- attribute_name
+	  ''string'',			-- datatype
+	  ''curriculum-central.name'',	-- pretty_name
+	  ''curriculum-central.names'',	-- pretty_plural
+	  null,				-- table_name
+	  null,				-- column_name
+	  null,				-- default_value
+	  1,				-- min_n_values
+	  1,				-- max_n_values
+	  null,				-- sort_order
+	  ''type_specific'',		-- storage
+	  ''f''				-- static_p
+	);
+
+    return 0;
+end;' 
+language 'plpgsql';
+select inline_1 ();
+drop function inline_1 ();
+
+
+select define_function_args('cc_session__new', 'session_id,name,start_date,end_date,creation_user,creation_ip,package_id');
+
+create function cc_session__new(integer, varchar, timestamptz, timestamptz, integer, varchar, integer)
+returns integer as'
+
+declare
+
+	p_session_id		alias for $1;
+	p_name			alias for $2;
+	p_start_date		alias for $3;
+	p_end_date		alias for $4;
+	p_creation_user		alias for $5;
+	p_creation_ip		alias for $6;
+	p_package_id		alias for $7;
+
+	v_session_id		cc_session.session_id%TYPE;
+begin
+
+	v_session_id := acs_object__new (
+			p_session_id,
+			''cc_session'',
+			now(),
+			p_creation_user,
+			p_creation_ip,
+			p_package_id
+		);
+
+	insert into cc_session values(v_session_id, p_name, p_start_date, p_end_date, p_package_id);
+	
+	PERFORM acs_permission__grant_permission(
+          v_session_id,
+          p_creation_user,
+          ''read''
+    	);
+
+	PERFORM acs_permission__grant_permission(
+          v_session_id,
+          p_creation_user,
+          ''write''
+    	);
+
+	return v_session_id;
+
+end;
+' language plpgsql;
+
+
+select define_function_args('cc_session__delete', 'session_id');
+
+create function cc_session__delete (integer)
+returns integer as '
+declare
+  p_session_id				alias for $1;
+begin
+    delete from acs_permissions
+		   where object_id = p_session_id;
+
+	delete from cc_session
+		   where session_id = p_session_id;
+
+	raise NOTICE ''Deleting Session...'';
+	PERFORM acs_object__delete(p_session_id);
+
+	return 0;
+
+end;' 
+language plpgsql;
+
+
+select define_function_args('cc_session__name', 'session_id');
+
+create function cc_session__name (integer)
+returns varchar as '
+declare
+    p_session_id      alias for $1;
+    v_session_name    cc_session.name%TYPE;
+begin
+	select name into v_session_name
+		from cc_session
+		where session_id = p_session_id;
+
+    return v_session_name;
+end;
+' language plpgsql;
Index: openacs-4/packages/curriculum-central/sql/postgresql/uos-names-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/sql/postgresql/uos-names-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/sql/postgresql/uos-names-create.sql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,204 @@
+--
+-- packages/curriculum-central/sql/postgresql/uos-names-create.sql
+--
+-- @author Nick Carroll (nick.c@rroll.net)
+-- @creation-date 2005-11-08
+-- @cvs-id $Id: uos-names-create.sql,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+--
+--
+
+
+create function inline_0 ()
+returns integer as'
+begin 
+    PERFORM acs_object_type__create_type (
+	''cc_uos_name'',			-- object_type
+	''#curriculum-central.uos_name#'',	-- pretty_name
+	''#curriculum-central.uos_names#'',	-- pretty_plural
+	''acs_object'',				-- supertype
+	''cc_uos_name'',			-- table_name
+	''name_id'',				-- id_column
+	null,					-- package_name
+	''f'',					-- abstract_p
+	null,					-- type_extension_table
+	''cc_uos_name__name''			-- name_method
+	);
+
+    return 0;
+end;' language 'plpgsql';
+
+select inline_0 ();
+drop function inline_0 ();
+
+
+create table cc_uos_name (
+	name_id	integer
+                        constraint cc_uos_name_name_id_fk
+                        references acs_objects(object_id)
+			constraint cc_uos_name_name_id_pk primary key,
+	uos_code	varchar(256)
+			constraint cc_uos_name_uos_code_nn not null
+			constraint cc_uos_name_uos_code_un unique,
+	uos_name 	varchar(256)
+			constraint cc_uos_name_uos_name_nn not null
+			constraint cc_uos_name_uos_name_un unique,
+	package_id	integer
+			constraint cc_uos_name_package_id_fk
+			references apm_packages(package_id) on delete cascade
+);
+
+
+--
+-- Attributes for the UoS Name Object
+--
+create function inline_1 ()
+returns integer as '
+begin
+    PERFORM acs_attribute__create_attribute (
+	  ''cc_uos_name'',		-- object_type
+	  ''uos_code'',			-- attribute_name
+	  ''string'',			-- datatype
+	  ''curriculum-central.uos_code'',	-- pretty_name
+	  ''curriculum-central.uos_codes'',	-- pretty_plural
+	  null,				-- table_name
+	  null,				-- column_name
+	  null,				-- default_value
+	  1,				-- min_n_values
+	  1,				-- max_n_values
+	  null,				-- sort_order
+	  ''type_specific'',		-- storage
+	  ''f''				-- static_p
+	);
+
+    PERFORM acs_attribute__create_attribute (
+	  ''cc_uos_name'',		-- object_type
+	  ''uos_name'',			-- attribute_name
+	  ''string'',			-- datatype
+	  ''curriculum-central.uos_name'',	-- pretty_name
+	  ''curriculum-central.uos_names'',	-- pretty_plural
+	  null,				-- table_name
+	  null,				-- column_name
+	  null,				-- default_value
+	  1,				-- min_n_values
+	  1,				-- max_n_values
+	  null,				-- sort_order
+	  ''type_specific'',		-- storage
+	  ''f''				-- static_p
+	);
+
+    return 0;
+end;' 
+language 'plpgsql';
+select inline_1 ();
+drop function inline_1 ();
+
+
+select define_function_args ('cc_uos_name__new', 'name_id,uos_code,uos_name,creation_user,creation_ip,package_id');
+
+create function cc_uos_name__new (
+	integer,		-- name_id
+	varchar,		-- uos_code
+	varchar,		-- uos_name
+	integer,		-- creation_user
+	varchar,		-- creation_ip
+	integer			-- package_id
+) returns integer as'
+
+declare
+
+	p_name_id		alias for $1;
+	p_uos_code		alias for $2;
+	p_uos_name		alias for $3;
+	p_creation_user		alias for $4;
+	p_creation_ip		alias for $5;
+	p_package_id		alias for $6;
+
+	v_name_id		cc_uos_name.name_id%TYPE;
+begin
+
+	v_name_id := acs_object__new (
+			p_name_id,
+			''cc_uos_name'',
+			now(),
+			p_creation_user,
+			p_creation_ip,
+			p_package_id
+		);
+
+	insert into cc_uos_name values (
+		v_name_id,
+		p_uos_code,
+		p_uos_name,
+		p_package_id
+	);
+	
+	PERFORM acs_permission__grant_permission(
+          v_name_id,
+          p_creation_user,
+          ''read''
+    	);
+
+	PERFORM acs_permission__grant_permission(
+          v_name_id,
+          p_creation_user,
+          ''write''
+    	);
+
+	return v_name_id;
+
+end;
+' language plpgsql;
+
+
+select define_function_args('cc_uos_name__delete', 'name_id');
+
+create function cc_uos_name__delete (integer)
+returns integer as '
+declare
+  p_name_id				alias for $1;
+begin
+    delete from acs_permissions
+		   where object_id = p_name_id;
+
+	delete from cc_uos_name
+		   where name_id = p_name_id;
+
+	raise NOTICE ''Deleting UoS Name...'';
+	PERFORM acs_object__delete(p_name_id);
+
+	return 0;
+
+end;' 
+language plpgsql;
+
+
+select define_function_args('cc_uos_name__name', 'name_id');
+
+create function cc_uos_name__name (integer)
+returns varchar as '
+declare
+    p_name_id      		alias for $1;
+    v_uos_name    		cc_uos_name.uos_name%TYPE;
+begin
+	select uos_name into v_uos_name
+		from cc_uos_name
+		where name_id = p_name_id;
+
+    return v_uos_name;
+end;
+' language plpgsql;
+
+
+create function cc_uos_name__code (integer)
+returns varchar as '
+declare
+    p_name_id      		alias for $1;
+    v_uos_code    		cc_uos_name.uos_code%TYPE;
+begin
+	select uos_code into v_uos_code
+		from cc_uos_name
+		where name_id = p_name_id;
+
+    return v_uos_code;
+end;
+' language plpgsql;
Index: openacs-4/packages/curriculum-central/www/stream-map-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/stream-map-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/stream-map-postgresql.xql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+
+<queryset>
+   <rdbms><type>postgresql</type><version>7.4</version></rdbms>
+
+   <fullquery name="context">
+     <querytext>
+       SELECT f.faculty_id, f.faculty_name, d.department_id, d.department_name
+           FROM cc_faculty f, cc_department d, cc_stream s
+	   WHERE f.faculty_id = d.faculty_id
+	       AND d.department_id = s.department_id
+	       AND s.stream_id = :stream_id
+	       AND s.package_id = :package_id
+     </querytext>
+   </fullquery>
+
+   <fullquery name="units_of_study">
+     <querytext>
+       SELECT map.map_id, n.uos_code, n.uos_name, uos.uos_id,
+           rev.year_id, y.name, rev.core_id,
+	   map.live_revision_id, uosr.session_ids
+       FROM cc_uos uos, cc_uos_revisions uosr, cc_stream_uos_map map,
+           cc_stream_uos_map_rev rev, cc_year y, cc_uos_name n
+       WHERE uos.uos_id = map.uos_id
+       AND map.stream_id = :stream_id
+       AND map.live_revision_id = rev.map_rev_id
+       AND rev.year_id = y.year_id
+       AND rev.year_id != 0
+       AND uos.live_revision_id = uosr.uos_revision_id
+       AND n.name_id = uos.uos_name_id
+     </querytext>
+   </fullquery>
+
+   <fullquery name="session_name">
+     <querytext>
+       SELECT cc_session__name(:session_id)
+     </querytext>
+   </fullquery>
+
+</queryset>
Index: openacs-4/packages/curriculum-central/www/stream-map.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/stream-map.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/stream-map.adp	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,24 @@
+<master>
+<property name="title">@page_title;noquote@</property>
+<property name="context">@context;noquote@</property>
+<property name="header_stuff">
+<link rel="stylesheet" type="text/css" href="/resources/curriculum-central/curriculum-central.css" media="all">
+</property>
+
+<div id="cc-stream-map-container">
+
+  <div class="spacer">&nbsp;</div>
+
+  <multiple name="stream">
+  <div class="float">
+    <ul>
+      <li class="uos-code">@stream.uos_code@</li>  
+      <li class="uos-name">@stream.uos_name@</li>
+      <li class="session">@stream.session_name@</li>
+    </ul>
+  </div>
+  </multiple>
+
+  <div class="spacer">&nbsp;</div>
+
+</div>
Index: openacs-4/packages/curriculum-central/www/stream-map.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/stream-map.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/stream-map.tcl	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+    Displays the UoS map for the specified stream ID.
+
+    @author Nick Carroll (nick.c@rroll.net)
+    @creation-date 2005-11-15
+    @cvs-id $Id: stream-map.tcl,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+} {
+    stream_id:integer
+    stream_name
+}
+
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+
+# Retrieve info about the faculty, department and stream.
+db_1row context {}
+
+set page_title "$stream_name - [_ curriculum-central.map_view]"
+set context [list \
+    [list [export_vars -url -base faculty-depts {faculty_name faculty_id}] \
+        $faculty_name] \
+    [list [export_vars -url -base dept-streams \
+	{department_name department_id}] $department_name] \
+    $page_title]
+
+# Retrieve a list of Units of Study.
+set units_of_study [db_list_of_lists units_of_study {}]
+
+template::multirow create stream map_id year_id year_name \
+    session_id session_name core_or_not uos_id uos_code uos_name
+
+foreach uos $units_of_study {
+    set map_id [lindex $uos 0]
+    set uos_code [lindex $uos 1]
+    set uos_name [lindex $uos 2]
+    set uos_id [lindex $uos 3]
+    set year_id [lindex $uos 4]
+    set year_name [lindex $uos 5]
+    set core_id [lindex $uos 6]
+    set live_revision_id [lindex $uos 7]
+    set session_ids [lindex $uos 8]
+
+    foreach session_id $session_ids {
+	
+	# Get name of session_id
+	set session_name [db_string session_name {} -default ""]
+    
+	template::multirow append stream $map_id $year_id $year_name \
+	    $session_id $session_name $core_id $uos_id $uos_code $uos_name
+    
+    }
+}
+
+ad_return_template
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-all-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-all-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-all-postgresql.xql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<queryset>
+    <rdbms><type>postgresql</type><version>7.4</version></rdbms>
+
+    <fullquery name="get_all_uos">
+      <querytext>
+        SELECT n.uos_code, n.uos_name, u.uos_id, u.unit_coordinator_id,
+	    s.short_name, s.pretty_name
+        FROM cc_uos u,
+	    cc_uos_name n,
+	    workflow_cases c,
+	    workflow_case_fsm f,
+	    workflow_fsm_states s
+	WHERE c.case_id = f.case_id
+	AND s.state_id = f.current_state
+	AND c.workflow_id = :workflow_id
+	AND u.uos_id = c.object_id
+	AND n.name_id = u.uos_name_id
+      </querytext>
+    </fullquery>
+
+</queryset>
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-all.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-all.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-all.adp	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,6 @@
+<master src="../resources/main-portal">
+<property name="title">@page_title;noquote@</property>
+<property name="context">@context;noquote@</property>
+
+<ul><li>#curriculum-central.list_of_all_units_of_study#</li></ul>
+<listtemplate name="all_uos"></listtemplate>
\ No newline at end of file
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-all.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-all.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-all.tcl	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,52 @@
+ad_page_contract {
+    Index page for displaying all Units of Study.
+
+    @author Nick Carroll (nick.c@rroll.net)
+    @creation-date 2005-11-15
+    @cvs-id $Id: uos-all.tcl,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+}
+
+auth::require_login
+
+set page_title [_ curriculum-central.all_units_of_study]
+set context [list [list . [_ curriculum-central.coordinate]] $page_title]
+set user_id [ad_conn user_id]
+set workflow_id [curriculum_central::uos::get_instance_workflow_id]
+
+
+set elements {
+    edit {
+	sub_class narrow
+	display_template {
+	    <img src="/shared/images/Edit16.gif" height="16" width="16" border="0">
+	}
+	link_url_eval {[export_vars -base uos-edit { uos_id }]}
+	link_html {title "#curriculum-central.edit_uos#"}
+    }
+    uos_code {
+	sub_class narrow
+	label "#curriculum-central.uos_code#"
+    }
+    uos_name {
+	label "#curriculum-central.uos_name#"
+    }
+    unit_coordinator {
+	label "#curriculum-central.unit_coordinator#"
+    }
+    pretty_name {
+	label "#curriculum-central.current_state#"
+    }
+}
+
+template::list::create \
+    -name all_uos \
+    -multirow all_uos \
+    -no_data "#curriculum-central.no_uos_have_been_created#" \
+    -elements $elements
+
+db_multirow -extend {unit_coordinator} all_uos get_all_uos {} {
+    set unit_coordinator [curriculum_central::staff::pretty_name $unit_coordinator_id]
+}
+
+
+ad_return_template
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae-postgresql.xql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<queryset>
+   <rdbms><type>postgresql</type><version>7.4</version></rdbms>
+
+   <fullquery name="uos_name_update">
+     <querytext>
+       UPDATE cc_uos_name
+           SET uos_code = :uos_code,
+	   uos_name = :uos_name
+	   WHERE name_id = :name_id
+     </querytext>
+   </fullquery>
+
+   <fullquery name="object_update">
+     <querytext>
+       UPDATE acs_objects
+           SET modifying_user = :modifying_user,
+	   modifying_ip = :modifying_ip,
+	   package_id = :package_id
+	   WHERE object_id = :name_id
+     </querytext>
+   </fullquery>
+
+</queryset>
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.adp	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,6 @@
+<master src="../resources/main-portal">
+<property name="title">@page_title;noquote@</property>
+<property name="context">@context;noquote@</property>
+<property name="focus">uos_name.uos_code</property>
+
+<formtemplate id="uos_name"></formtemplate>
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-name-ae.tcl	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,57 @@
+ad_page_contract {
+    Add/Edit a UoS name.
+
+    @author Nick Carroll (nick.c@rroll.net)
+    @creation-date 2006-01-04
+    @cvs-id $Id: uos-name-ae.tcl,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+} {
+    name_id:integer,optional
+    {return_url "uos-names"}
+}
+
+auth::require_login
+
+if { [info exists name_id] } {
+    set page_title [_ curriculum-central.edit_uos_name]
+} else {
+    set page_title [_ curriculum-central.add_uos_name]
+}
+
+set context [list [list . [_ curriculum-central.coordinate]] $page_title]
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+
+ad_form -name uos_name -cancel_url $return_url -form {
+    {name_id:key(acs_object_id_seq)}
+    {return_url:text(hidden) {value $return_url}}
+    {uos_code:text
+	{html {size 50}}
+	{label "[_ curriculum-central.uos_code]" }
+	{help_text "[_ curriculum-central.help_enter_uos_code]"}
+    }
+    {uos_name:text
+	{html {size 50}}
+	{label "[_ curriculum-central.uos_name]" }
+	{help_text "[_ curriculum-central.help_enter_uos_name]"}
+    }
+} -select_query {
+       SELECT uos_code, uos_name
+	   FROM cc_uos_name WHERE name_id = :name_id
+} -new_data {
+    package_instantiate_object \
+	-var_list [list [list package_id $package_id] \
+		        [list object_type cc_uos_name] \
+		        [list uos_code $uos_code] \
+		       [list uos_name $uos_name]] \
+	-form_id uos_name cc_uos_name
+
+} -edit_data {
+    set modifying_user [ad_conn user_id]
+    set modifying_ip [ad_conn peeraddr]
+
+    db_dml uos_name_update {}
+    db_dml object_update {}
+} -after_submit {
+    ad_returnredirect $return_url
+    ad_script_abort
+}
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-names-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-names-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-names-postgresql.xql	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<queryset>
+   <rdbms><type>postgresql</type><version>7.4</version></rdbms>
+
+   <fullquery name="get_uos_names">
+     <querytext>
+       SELECT u.name_id, u.uos_code, u.uos_name
+	   FROM cc_uos_name u
+	   WHERE package_id = :package_id
+	   [template::list::orderby_clause -orderby -name "uos_names"]
+     </querytext>
+   </fullquery>
+
+</queryset>
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-names.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-names.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-names.adp	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,5 @@
+<master src="../resources/main-portal">
+<property name="title">@page_title;noquote@</property>
+<property name="context">@context;noquote@</property>
+
+<listtemplate name="uos_names"></listtemplate>
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-names.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-names.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-names.tcl	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,54 @@
+ad_page_contract {
+    Displays a list of Unit of Study names.  This is used to create a
+    set of Units of Study that may or may not exist.  If they exist
+    then the stream coordinator will add details to the UoS using
+    uos-add and uos-edit.
+
+    @author Nick Carroll (nick.c@rroll.net)
+    @creation-date 2005-11-15
+    @cvs-id $Id: uos-names.tcl,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+} {
+    {orderby "uos_code,asc"}
+}
+
+set page_title "[_ curriculum-central.uos_names]"
+set context [list [list . [_ curriculum-central.coordinate]] $page_title]
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+
+# Only stream coordinators can create UoS names..
+if { ![curriculum_central::staff::stream_coordinator_p $user_id] } {
+    ad_returnredirect -message [_ curriculum-central.only_stream_coordinators_can_create_uos_names] index
+}
+
+set elements {
+    edit {
+	sub_class narrow
+	display_template {
+	    <img src="/shared/images/Edit16.gif" height="16" width="16" border="0">
+	}
+	link_url_eval {[export_vars -base uos-name-ae { name_id }]}
+	link_html {title "#curriculum-central.edit_uos_name#"}
+    }
+    uos_code {
+	label "#curriculum-central.uos_code#"
+    }
+    uos_name {
+	label "#curriculum-central.uos_name#"
+    }
+}
+
+template::list::create \
+    -name uos_names \
+    -multirow uos_names \
+    -actions [list "#curriculum-central.add_uos_name#" [export_vars -base uos-name-ae {}] "#curriculum-central.add_uos_name_to_list#"] \
+    -no_data "#curriculum-central.no_uos_names_have_been_created#" \
+    -elements $elements \
+    -orderby {
+	uos_code {orderby {lower(uos_code)}}
+	uos_name {orderby {lower(uos_name)}}
+    }
+
+db_multirow uos_names get_uos_names {}
+
+ad_return_template
\ No newline at end of file
Index: openacs-4/packages/curriculum-central/www/resources/main-portal.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/resources/main-portal.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/resources/main-portal.adp	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,36 @@
+<master>
+<property name="title">@title@</property>
+<property name="context">@context;noquote@</property>
+<property name="header_stuff">
+@header_stuff;noquote@
+<link rel="stylesheet" type="text/css" href="@curriculum_central_css@" media="all"/>
+</property>
+
+<P>
+<div class="visualClear"></div>
+
+<table id="portal-columns">
+  <tbody>
+    <tr>
+      <td id="portal-column-content">
+        <div class="visualPadding">
+          <div class="documentBorder">
+            <if @admin_p@ eq "1">
+            <div class="portletOptions">
+              @admin_options;noquote@
+            </div>
+	    </if>
+            <if @staff_p@ eq "1">
+            <div class="portletOptions">
+              @staff_options;noquote@
+            </div>
+	    </if>
+            <div class="documentContent">
+              <slave>
+            </div>
+          </div>
+        </div>
+      </td>
+    </tr>
+  </tbody>
+</table>
Index: openacs-4/packages/curriculum-central/www/resources/main-portal.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/resources/main-portal.css,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/resources/main-portal.css	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,39 @@
+.portletOptions {
+    display: inline;
+    font-size: 10px;
+    font-weight: normal;
+    float:right;
+    padding: 1px;
+}
+
+.visualClear {
+    display: block;
+    clear: both;
+}
+
+#portal-columns {
+    width: 100% !important;
+    border-collapse: collapse;
+    border-spacing: 0;
+}
+
+#portal-column-content {
+    vertical-align: top;
+    margin: 0;
+    padding: 0;
+}
+
+/* Padding for the columns */
+#portal-column-content .visualPadding {
+    /*padding: 0em 2em 1em 2em;*/
+    padding: 0em 1em 1em 1em;
+}
+
+.documentBorder {
+    border: 1px solid #666;
+    background: White;
+}
+
+.documentContent {
+    padding: 1em !important;
+}
Index: openacs-4/packages/curriculum-central/www/resources/main-portal.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/resources/main-portal.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/resources/main-portal.tcl	2 Feb 2006 11:52:15 -0000	1.1
@@ -0,0 +1,45 @@
+ad_page_contract {
+
+    Simple portal page featuring a main portlet.
+
+    @author  Nick Carroll (nick.c@rroll.net)
+    @creation-date 2005-03-24
+    @cvs-id  $Id: main-portal.tcl,v 1.1 2006/02/02 11:52:15 ncarroll Exp $
+} {
+
+}
+
+
+if { ![info exists title] } {
+    set title {}
+}
+
+if { ![info exists context] } {
+    set context {}
+}
+
+if { ![info exists header_stuff] } {
+    set header_stuff {}
+}
+
+if { ![info exists admin_options] } {
+    set admin_options {}
+}
+
+if { ![info exists staff_options] } {
+    set staff_options {}
+}
+
+set user_id [ad_conn user_id]
+
+set package_id [ad_conn package_id]
+
+set admin_p [permission::permission_p -object_id $package_id -privilege admin]
+
+set staff_p [curriculum_central::staff::staff_p $user_id]
+
+set curriculum_central_css [parameter::get_from_package_key \
+				-parameter "CurriculumCentralCSS" \
+				-package_key "curriculum-central"]
+
+ad_return_template
\ No newline at end of file