Index: openacs-4/packages/dbm/dbm.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/dbm.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/dbm.info 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,67 @@ + + + + + Database Manager + Database Manager + f + t + /dbm + + + Michael Riecker + Nima Mazloumi + This package is a port of PhpPgAdmin and PgAdmin for OpenACS + 2006-06-07 + University of Mannheim + Copyright (C) 2006 Michael Riecker, Nima Mazloumi + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + A copy of the GNU General Public License + can be found under http://www.gnu.org/licenses/gpl.txt; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt + GPL + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/dbm/catalog/dbm.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/catalog/dbm.de_DE.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/catalog/dbm.de_DE.ISO-8859-1.xml 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,126 @@ + + + + Aktion + Aktionen + Einen neuen Eintrag hinzuf�gen + Spalte Hinzuf�gen + Eintrag hinzuf�gen + Check hinzuf�gen + Domain Check hinzuf�gen + Fremdschl�ssel hinzuf�gen + Prim�rschl�ssel hinzuf�gen + Eindeutigen Schl�ssel hinzuf�gen + Verwalten + Privilegien �ndern + Analysiern + Analyse abgeschlossen + Argumente + Anzeigen + Cachewert + Cluster + Cluster abgeschlossen + Spalten + Spalten in der Zieltabelle + Spalten im Index + Datenbank anlegen oder entfernen + Domain erstellen + Funktion definieren + Index anlegen + Regel definieren + Schema erzeugen + Sequenz erstellen + Tabelle anlegen + Trigger erstellen + Sicht erstellen + Datenbank + Standardwert + L�schen + Domain + Domains + Sind Sie sicher, dass Sie die Spalte "%column%" der Tabelle "%table%" entfernen m�chten? + Sind Sie sicher, dass Sie die Einschr�nkung "%constraint%" der Tabelle "%table%" entfernen m�chten? + Sind Sie sicher, dass sie die Datenbank %database% l�schen m�chten? + Datenbank l�schen + Standardwert entfernen + Sind Sie sicher, dass Sie die Domain(s) %domainlist% l�schen wollen? + Domain l�schen + Sind Sie sicher, dass sie den Check %check% der Domain %Name% entfernen wollen? + Domain Check entfernen + Sind Sie sicher, dass Sie die Funktion "%proname%" mit de Argumentent "%args%" l�schen wollen? + Funktion entfernen + Sind Sie sicher, dass Sie den Index %index% l�schen wollen? + Sind Sie sicher, dass Sie die Regel %rulename% der Tabelle %tablename% l�schen wollen? + Regel entfernen + Sind Sie sicher, dass Sie das Schema/die Schemata %schemalist% entfernen wollen? + Schema entfernen + Sind Sie sicher, dass Sie die Sequenz(en) %sequencelist% l�schen wollen? + Sequenz l�schen + Sind Sie sicher, dass Sie die Tabelle %table% l�schen wollen? + Sind Sie sicher, dass Sie die folgenden Trigger l�schen wollen? + Trigger entfernen + Sind Sie sicher, dass Sie die Sicht(en) %viewlist% l�schen wollen? + Sicht l�schen + Bearbeiten + Domain bearbeiten + Funktion bearbeiten + Leeren + Sind Sie sicher, dass Sie die Tabelle %table% leeren wollen? + Encoding + Geben Sie ein was innerhalb der Klammern stehen soll + Ereignis + Feld + Dateiname + F�r jede Zeile + Funktion + Funktionen + Allgemein + Gruppen + Start + Heraufgesetzt durch + Indizes + Hinzuf�gen + Enth�lt einen Zyklus? + L�nge + Max. Wert + Min. Wert + Anz. d. Felder + Optionen + Besitzer + Rechte + Rechte + Prozess + Prozesse + Programmiersprache + Eigenschaften + Neuindizieren + Neuindizierung abgeschlossen + Entfernen + Ausgew�hlte Schemata entfernen + Ausgew�hlte Sequenzen entfernen + Ausgew�hlte Sichten entfernen + Ausgew�hlte Domains entfernen + Sind Sie sicher, dass Sie die Sequenz %sequence% initialisieren wollen? + Sequenz initialisieren + R�ckgabewert + Regel + Schemata + Sequenz + Sequenzen + Einstellung + Anfangswert + Tabelle + Tabellen + Zieltabelle + Trigger + Typ + Indexart + Benutzer + Vakuum abgeschlossen + Vakuum + Variablen + Sicht + Sichten + When + ja + Index: openacs-4/packages/dbm/catalog/dbm.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/catalog/dbm.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/catalog/dbm.en_US.ISO-8859-1.xml 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,126 @@ + + + + Action + Actions + Add a new entry + Add a column + Add Entry + Add check + Add Domain check + Add foreign key + Add primary key + Add unique key + Admin + Alter privileges + Analyze + Analyze Complete + Arguments + Browse + Cache value + Cluster + Cluster Complete + Columns + Columns in Target table + Columns in index + Create or drop a database + Create Domain + Create a function + Create index + Create rule + Create Schema + Create Sequence + Create Table + Create trigger + Create View + Database + Default + Delete + Domain + Domains + Are you sure to drop the column "%column%" from table "%table%"? + Are you sure to drop the constraint "%constraint%" on table "%table%"? + Are you sure to drop the database %database%? + Drop Database + Drop Default + Are you sure to drop the domain(s) %domainlist%? + Drop Domain + Are you sure to drop the check %check% from the domain %Name%? + Drop Domain Check + Are you sure to drop the function "%proname%" with arguments "%args%"? + Drop Function + Are you sure to drop the index %index%? + Are you sure to drop the rule %rulename% on %tablename%? + Drop Rule + Are you sure to drop the schema(s) %schemalist%? + Drop Schema + Are you sure to drop the sequence(s) %sequencelist%? + Drop Sequence + Are you sure to drop the table %table%? + Are you sure to drop the following trigger? + Drop Trigger + Are you sure to drop the view(s) %viewlist%? + Drop View + Edit + Edit Domain + Edit Function + Empty + Are you sure to empty the table %table%? + Encoding + Enter what's inside the brackets + Event + Field + Filename + For each row + Function + Functions + General + Groups + Home + Increment by + Indexes + Insert + Is cycled? + Length + Max value + Min value + Num. of fields + Options + Owner + Privileges + Privileges + Process + Processes + Programming Language + Properties + Reindex + Reindex Complete + Remove + Remove checked schemas + Remove checked sequences + Remove checked views + Remove checked domains + Are you sure to reset the sequence %sequence%? + Reset Sequence + Returns + Rules + Schemas + Sequence + Sequences + Setting + Start value + Table + Tables + Target table + Triggers + Type + Type of index + Users + Vaccum complete + Vacuum + Variables + View + Views + When + yes + Index: openacs-4/packages/dbm/tcl/dbm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/tcl/dbm-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/tcl/dbm-procs.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,268 @@ +ad_library { + Helper Procs for dbm +} + +namespace eval dbm {} + +ad_proc dbm::create_combo_opts { + -parameter + {-split " "} + -no_empty_option:boolean +} { + Simple procedure to create options for dropdown menu +} { + set opts [list] + if {!$no_empty_option_p} { + set opts [linsert $opts 0 ""] + } + set props [split [parameter::get -parameter $parameter] "$split"] + foreach prop $props { + lappend opts [list $prop $prop] + } + return $opts +} + +ad_proc dbm::format_list { + -name +} { + Simple procedure to format a list for output +} { + set format [join $name ","] + return $format +} + + +ad_proc dbm::highlight_sql { + -sql +} { + A simple proc to highlight sql +} { + set result [list] + + regsub -all {([^ \n\t]+)} $sql {\0} sql + set sql [split $sql " "] + set commands [split [parameter::get -parameter "HighlightingCommands"] " "] + + foreach el $sql { + foreach cmd $commands { + if {[regsub -all -nocase "^$cmd" $el {
\0
} el]} { + break + } + } + lappend result $el + } + return [join $result " "] +} + +ad_proc dbm::replace_arguments { + -args +} { + A simple proc to replace arguments +} { + + set arguments [parameter::get -parameter "FunctionArguments"] + + foreach pair $arguments { + set p1 [lindex $pair 0] + set p2 [lindex $pair 1] + regsub -all $p1 $args $p2 args + } + return $args +} + +ad_proc dbm::table_icon { + -name + -show_labels:boolean + {-cmd fdp} +} { + Simple proc that generates a graphical representation of the table + @param name The name of the relation + @param colspec List of columns + @return string img-tag with path to the icon +} { + + db_1row get_table_info {} + set constraints [db_list_of_lists get_table_constraints {}] + #ns_log Notice "$constraints" + + set graph "digraph g { +label=\"$name\" fontsize=\"9\"; +graph \[size=\"8.5,11\",ratio=\"1.5\",rankdir = \"LR\"\,fontname=\"Arial\" \]; +node \[fontcolor=\"red\",color=\"blue\",fontsize=\"9\" \]; +\"$name\" \[shape=\"box\"\]" + +#label = \"" + +#first we get the columns of the table +# db_foreach get_table_properties {} { +# append graph "$field $type|" +# } if_no_rows { +# append graph "no cols|" +# } + +# set graph "[string range $graph 0 end-1]\"" +# append graph "shape = \"record\"\];" + +#now we create nodes for all referenced relations +foreach constraint $constraints { + append graph " +\"[lindex $constraint 5]\" \[ label = \"[lindex $constraint 5]\",URL= \"graph?table=[lindex $constraint 5]\",shape = \"record\" \];" +} + +#and for all referencing relations +db_foreach get_referencing_tables {} { + if {$table_name != $name} { + append graph " +\"$table_name\" \[fontcolor=\"blue\",label = \"$table_name\",URL= \"graph?table=$table_name\",shape = \"ellipse\" \];" + } +} + +#and created the edges between source and target relation +foreach constraint $constraints { + append graph " +\"$name\" -> \"[lindex $constraint 5]\" \[" + if {$show_labels_p} { + append graph "label=\"[lindex $constraint 2]\", " + } + append graph "fontsize=\"7\"];" +} + +#finally we add referencing relations +db_foreach get_referencing_tables {} { + append graph " +\"$ref_table_name\" -> \"$table_name\" \[color=\"grey\",arrowhead=\"none\"," + if {$show_labels_p} { + append graph "label=\"constraint_name\"," + } + append graph "fontsize=\"7\"];" +} + +append graph " +}" + +set fileId [open /tmp/dot w 0600] +puts $fileId $graph +close $fileId +exec /usr/local/bin/$cmd -Tpng -o[acs_root_dir]/www/table.png < /tmp/dot +exec /usr/local/bin/$cmd -Tcmapx -o[acs_root_dir]/www/table.cmap < /tmp/dot + + +set html ""; +#get the image map +set fileId [open "[acs_root_dir]/www/table.cmap" r] +append html "[read $fileId]" +close $fileId +return $html +} + +ad_proc -private dbm::create_form_def { + {-elements:required} + {-form_name:required} + {-prefix:required} +} { + Generate a form given the size, field prefixes and name + @param elements A list of lists with touples. The first should be the Id the second the pretty name + @param prefix The prefix to be used for the form fields + + @return list A list that contains the full definition of the form. + + @author Nima Mazloumi + @creation-date 2005-08-24 +} { + set fields [list] + + set count [llength $elements] + + for {set j 1} {$j <= $count} {incr j} { + upvar "$prefix$j" local$j + #ns_log Notice "Variable $prefix$j is [set local$j]" + } + + for {set j 1} {$j <= $count} {incr j} { + set field_p 0 + + if {[exists_and_not_null local$j]} { + set value [set local$j] + for {set i 0} {$i < $count} {incr i} { + if { $value == [lindex $elements $i 0]} { + + lappend fields [list "$prefix${j}_dummy:text" \ + [list label "$j. Field"] \ + [list value [lindex $elements $i 1]] \ + [list mode "display"] \ + ] + + lappend fields [list "$prefix${j}_dummy2:text" \ + [list label "Length"] \ + ] + lappend fields [list "$prefix${j}_dummy5:text" \ + [list label "Default"] \ + ] + + set field_p 1 + } + } + } + + if {!$field_p} { + + lappend fields [list "$prefix${j}_dummy:text" \ + [list label "$j. Field"] \ + ] + lappend fields [list "$prefix${j}_dummy3:text" \ + [list label "[_ dbm.type]"] \ + ] + lappend fields [list "$prefix${j}_dummy2:text,optional" \ + [list label "[_ dbm.length]"] \ + ] + lappend fields [list "$prefix${j}_dummy5:text,optional" \ + [list label "[_ dbm.default]"] \ + ] + lappend fields [list "$prefix${j}_dummy4:text(checkbox),optional" \ + [list label ""] \ + [list options [list [list "Not Null" 1]]] \ + ] + + + + + } + } + return $fields +} + +ad_proc dbm::after-install { +} { + Copies the form and list builder templates to acs-templating +} { + file copy -force [acs_root_dir]/packages/dbm/templates/forms/dbm.adp [acs_root_dir]/packages/acs-templating/resources/forms + file copy -force [acs_root_dir]/packages/dbm/templates/lists/dbm.adp [acs_root_dir]/packages/acs-templating/resources/lists +} + +ad_proc dbm::before-uninstall { +} { + Removes the form and list builder templates from acs-templating +} { + file delete -force [acs_root_dir]/packages/acs-templating/resources/forms/dbm.adp + file delete -force [acs_root_dir]/packages/acs-templating/resources/lists/dbm.adp +} + +ad_proc dbm::graphVizP { +} { + Returns 1 if GraphViz is installed and 0 if not +} { + set graphVizP [parameter::get -parameter "GraphViz"] + + if {$graphVizP == ""} { + set graphCmd [parameter::get -parameter "GraphCmd"] + if {[catch {exec $graphCmd} results]} { + parameter::set_value -parameter "GraphVizP" -value 0 + return 0 + } else { + parameter::set_value -parameter "GraphVizP" -value 1 + return 1 + } + } else { + return $graphVizP + } +} Index: openacs-4/packages/dbm/tcl/dbm-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/tcl/dbm-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/tcl/dbm-procs.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,98 @@ + + + postgresql7.1 + + + SELECT a.attnum, + a.attname AS field, + t.typname AS type, + a.attnotnull AS not_null, + a.atthasdef as has_default + FROM + pg_class c, pg_attribute a, pg_type t + WHERE + c.relname = :name AND + a.attnum > 0 AND + a.attrelid = c.oid AND + a.atttypid = t.oid + ORDER BY + a.attnum; + + + + + + SELECT nspname as namespace, + relname as tablename, + pg_catalog.pg_get_userbyid(relowner) AS tableowner, + relhasindex as hasindexes, + relhasrules as hasrules, + reltriggers as hastriggers, + pg_class.oid as table_id, + pg_catalog.obj_description(pg_class.oid,'pg_class') as + table_description, + relacl, + CASE WHEN relkind = 'r' THEN 'table' WHEN relkind = 's' THEN 'special' ELSE 'view' END as reltype, + CASE WHEN relkind = 'v' THEN pg_get_viewdef(pg_class.oid) ELSE NULL END as view_definition + FROM pg_catalog.pg_class + JOIN pg_catalog.pg_namespace ON (relnamespace = pg_namespace.oid) + WHERE relkind IN ('r', 's', 'v') + AND relname = :name + + + + + + SELECT pg_constraint.oid, + pg_namespace.nspname AS namespace, + pg_constraint.conname AS constraint_name, + conkey AS constraint_key, + confkey AS constraint_fkey, + (select relname from pg_class where pg_class.oid = confrelid) as table_name, + confrelid + FROM pg_catalog.pg_constraint + JOIN pg_catalog.pg_class ON (pg_class.oid = conrelid) + JOIN pg_catalog.pg_class AS pc ON (pc.oid = confrelid) + JOIN pg_catalog.pg_namespace ON (pg_class.relnamespace = pg_namespace.oid) + JOIN pg_catalog.pg_namespace AS pn ON (pn.oid = pc.relnamespace) + WHERE contype = 'f' + AND conrelid = :table_id + + + + + + + SELECT distinct + pg_constraint.conname AS constraint_name, + (select relname from pg_class where pg_class.oid = confrelid) as ref_table_name, + (select relname from pg_class where pg_class.oid = conrelid) as table_name + FROM pg_catalog.pg_constraint + JOIN pg_catalog.pg_class ON (pg_class.oid = conrelid) + JOIN pg_catalog.pg_class AS pc ON (pc.oid = confrelid) + JOIN pg_catalog.pg_namespace ON (pg_class.relnamespace = pg_namespace.oid) + JOIN pg_catalog.pg_namespace AS pn ON (pn.oid = pc.relnamespace) + WHERE contype = 'f' + AND confrelid = :table_id + + + + + + + SELECT pg_catalog.format_type(t.oid, NULL) AS typname, + pg_catalog.format_type(t.oid, NULL) AS typname2 + FROM (pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace) + LEFT JOIN pg_catalog.pg_user pu ON t.typowner = pu.usesysid + WHERE (t.typrelid = 0 OR (SELECT c.relkind IN ('c') FROM + pg_catalog.pg_class c + WHERE c.oid = t.typrelid AND c.relnamespace NOT IN (SELECT oid FROM + pg_catalog.pg_namespace WHERE nspname LIKE 'pg_%'))) + AND pg_catalog.pg_type_is_visible(t.oid) + ORDER BY typname + + + + + Index: openacs-4/packages/dbm/templates/forms/dbm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/templates/forms/dbm.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/templates/forms/dbm.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,135 @@ + +
+ + +
@elements.section@
+
+ +
+
    + + + + + + + + + + + + + + + + +
  • + + + + +
    + + + + + +
    + + +
     
    + +
    + + @elements.label;noquote@ + + * + + +
    + + + +
     
    + +
    + @elements.label;noquote@ + + * + +
    +
    + + + + +
    + + +
    + + + + + +
    + + + + +
    + +
    + \@formgroup.widget;noquote@
    +
    +
    +
    +
    + + + + + +
    + \@formerror.@elements.id@;noquote\@ +
    +
    +
    + + +
  • + +
    + +
+ +
+ + + + + + + +
+ [i] + +
+
+ + + + + + + +
+
+ + + + + * #acs-templating.required# <% break %> + + + \ No newline at end of file Index: openacs-4/packages/dbm/templates/lists/dbm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/templates/lists/dbm.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/templates/lists/dbm.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,280 @@ +
+ + + + + + + + + + + + + + +
+
+ + + + @list_properties.bulk_action_export_chunk;noquote@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + << + + + << + + + +  <  + + +  <  + + + + +   \@paginator_pages.page@ + + +   \@paginator_pages.page@ + + + + +  >  + + +  >  + + + + >> + + + >> + + + + + + +
+ \@list_properties.page_size_export_chunk;noquote@ + +
+ + +
+ + @actions.label@ + +
+ + + @elements.label;noquote@ + + + + @elements.label;noquote@ + + + + @elements.label;noquote@ + +
+ @list_properties.no_data@ +
+ @list_properties.groupby_label@: +
+ +
+ + @elements.aggregate_group_label@ + + + \@@list_properties.multirow@.@elements.aggregate_group_col@@ + +
+ + @elements.aggregate_label@ + + + \@@list_properties.multirow@.@elements.aggregate_col@@ + +
+ + + << + + + << + + + +  <  + + +  <  + + + + +   \@paginator_pages.page@ + + +   \@paginator_pages.page@ + + + + +  >  + + +  >  + + + + >> + + + >> + + +
+ + @bulk_actions.label@ + +
+
\ No newline at end of file Index: openacs-4/packages/dbm/www/addcolumn.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addcolumn.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addcolumn.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addcolumn.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addcolumn.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addcolumn.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,49 @@ +ad_page_contract { + Add a column +} { + table +} + + +set type_opts1 [db_list_of_lists get_types {}] +set type_opts2 [db_list_of_lists get_domains {}] +set type_opts [concat $type_opts1 $type_opts2] + +ad_form -name addcolumn -form { + {table:text(hidden) + {value $table}} + {name:text + {label "[_ dbm.field]"} + {float "left"} + {section "[_ dbm.field]"} + {text_align "left"}} + {type:text(select) + {options {$type_opts}} + {float "left"} + {label ""} + {text_align "center"} + {section "[_ dbm.type]"}} + {array:text(checkbox),optional + {label ""} + {float "left"} + {section "[_ dbm.type]"} + {options {{"Array" 1}}}} + {length:text,optional + {float "left"} + {section "[_ dbm.length]"} + {help_text "[_ dbm.add_column]"} + {label "[_ dbm.length]"}} +} -on_submit { + + if {$array != ""} { + set array "[]" + } + if {$length == ""} { + db_dml add_column "ALTER TABLE \"$table\" ADD COLUMN \"$name\" $type$array" + } else { + db_dml add_column "ALTER TABLE \"$table\" ADD COLUMN \"$name\" $type($length)$array" + } +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/addcolumn.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addcolumn.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addcolumn.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,30 @@ + + + postgresql7.1 + + + SELECT pg_catalog.format_type(t.oid, NULL) AS type1, + pg_catalog.format_type(t.oid, NULL) AS type2 + FROM pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace + WHERE (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM + pg_catalog.pg_class c + WHERE c.oid = t.typrelid)) AND t.typname !~ '^_' + AND pg_catalog.pg_type_is_visible(t.oid) + AND n.nspname = 'pg_catalog' + ORDER BY pg_catalog.format_type(t.oid, NULL); + + + + + + SELECT t.typname AS name1, t.typname AS name2 + FROM pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace + WHERE t.typtype = 'd' + AND pg_catalog.pg_type_is_visible(t.oid) + ORDER BY t.typname; + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/adddomaincheck.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/adddomaincheck.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/adddomaincheck.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/adddomaincheck.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/adddomaincheck.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/adddomaincheck.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,22 @@ +ad_page_contract { + Add a check +} { + domain +} + + +ad_form -name addcheck -form { + {domain:text(hidden) + {mode "display"} + {value $domain}} + {checkname:text + {label "Name"}} + {definition:text + {label "Definition"} + {help_text "[_ dbm.enter]"}} +} -on_submit { + db_dml add_check "alter domain $domain add constraint $checkname check($definition);" +} -after_submit { + ad_returnredirect "alterdomain?domain=$domain" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Create foreign key +} { + table +} + +set columns [db_list_of_lists get_columns {}] +set tables [db_list_of_lists get_tables {}] + +ad_form -name createforeignkey -form { + {name:text + {label "Name"} + } + {table:text(hidden) + {value $table} + } + {column:text(multiselect),multiple + {label "[_ dbm.columns]"} + {options {$columns}} + } + {targettable:text(select) + {label "[_ dbm.target]"} + {options {$tables}} + } +} -on_submit { + ad_returnredirect "addforeignkey2?table=$table&name=$name&column=$column&targettable=$targettable" + +} \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,26 @@ + + + postgresql7.1 + + + SELECT a.attname AS field1, a.attname AS field2 + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + + + + + + SELECT tablename AS name1, tablename AS name2 + FROM pg_catalog.pg_tables + WHERE schemaname NOT IN ('pg_catalog', + 'information_schema', 'pg_toast') + order by tablename + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey2.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey2.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,75 @@ +ad_page_contract { + Create foreign key +} { + table + name + column + targettable +} + +set columns2 [db_list_of_lists get_columns2 {}] +set update_delete_opts [dbm::create_combo_opts -parameter update_delete -split ";"] +set match_opts [dbm::create_combo_opts -parameter match -split ";"] +set deferrable_opts [dbm::create_combo_opts -parameter deferrable -split ";"] +set initially_opts [dbm::create_combo_opts -parameter initially -split ";"] + +ad_form -name createforeignkey2 -form { + {name:text(hidden) + {value $name} + } + {table:text(hidden) + {value $table} + } + {column:text(hidden) + {value $column} + } + {targettable:text(hidden) + {value $targettable} + } + {column2:text(multiselect),multiple + {label "[_ dbm.columns2]"} + {options {$columns2}} + } + {update:text(select) + {label "On update"} + {options {$update_delete_opts}} + } + {delete:text(select) + {label "On delete"} + {options {$update_delete_opts}} + } + {match:text(select) + {label ""} + {options {$match_opts}} + } + {deferrable:text(select) + {label ""} + {options {$deferrable_opts}} + } + {initially:text(select) + {label ""} + {options {$initially_opts}} + } + +} -on_submit { + + set output [list] + set output2 [list] + + foreach el $column { + lappend output [concat \"$el\"] + } + + foreach el $column2 { + lappend output2 [concat \"$el\"] + } + + set columnslist [dbm::format_list -name $output] + set columnslist2 [dbm::format_list -name $output2] + + db_dml create_foreignkey "alter table \"$table\" add constraint \"$name\" foreign key ($columnslist) references \"$targettable\" ($columnslist2) $match on update $update on delete $delete $deferrable $initially" + + + ad_returnredirect "tableconstraints?table=$table" + +} \ No newline at end of file Index: openacs-4/packages/dbm/www/addforeignkey2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addforeignkey2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addforeignkey2.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + SELECT a.attname AS field1, a.attname AS field2 + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$targettable' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addprimarykey.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addprimarykey.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addprimarykey.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addprimarykey.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addprimarykey.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addprimarykey.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + Create primary key +} { + table +} + +set columns [db_list_of_lists get_columns {}] + +ad_form -name createprimarykey -form { + {name:text + {label "Name"} + } + {table:text(hidden) + {value $table} + } + {column:text(multiselect),multiple + {label "[_ dbm.columns]"} + {options {$columns}} + } +} -on_submit { + + set output [list] + + foreach el $column { + lappend output [concat \"$el\"] + } + + set columnslist [dbm::format_list -name $output] + + db_dml create_primarykey "alter table \"$table\" add constraint \"$name\" primary key ($columnslist)" + + + ad_returnredirect "tableconstraints?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/addprimarykey.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addprimarykey.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addprimarykey.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + SELECT a.attname AS field1, a.attname AS field2 + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addtablecheck.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addtablecheck.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addtablecheck.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/addtablecheck.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/addtablecheck.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/addtablecheck.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + Add a check +} { + table +} + + +ad_form -name addcheck -form { + {table:text(hidden) + {value $table}} + {checkname:text + {label "Name"}} + {definition:text + {label "Definition(...)"} + {help_text "[_ dbm.enter]"}} +} -on_submit { + db_dml add_check "alter table \"$table\" add constraint \"$checkname\" check($definition);" +} -after_submit { + ad_returnredirect "tableconstraints?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/adduniquekey.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/adduniquekey.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/adduniquekey.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/adduniquekey.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/adduniquekey.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/adduniquekey.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + Create unique key +} { + table +} + +set columns [db_list_of_lists get_columns {}] + +ad_form -name createuniquekey -form { + {name:text + {label "Name"} + } + {table:text(hidden) + {value $table} + } + {column:text(multiselect),multiple + {label "[_ dbm.columns]"} + {options {$columns}} + } +} -on_submit { + + set output [list] + + foreach el $column { + lappend output [concat \"$el\"] + } + + set columnslist [dbm::format_list -name $output] + + db_dml create_uniquekey "alter table \"$table\" add constraint \"$name\" unique ($columnslist)" + + + ad_returnredirect "tableconstraints?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/adduniquekey.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/adduniquekey.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/adduniquekey.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + SELECT a.attname AS field1, a.attname AS field2 + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/admin.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/admin.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1 @@ +@msg@ Index: openacs-4/packages/dbm/www/admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/admin.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/admin.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,5 @@ +ad_page_contract { + Admin functions +} { + {msg ""} +} Index: openacs-4/packages/dbm/www/altercolumn.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/altercolumn.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/altercolumn.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/altercolumn.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/altercolumn.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/altercolumn.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,65 @@ +ad_page_contract { + Alter column +} { + table + column +} + + + +set notnull [db_string get_null "SELECT a.attnotnull FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '$table' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND a.attname = '$column'"] + +set type [db_string get_type "SELECT t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '$table' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND a.attname = '$column'"] + +set hasdefault [db_string has_default "SELECT a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '$table' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND a.attname = '$column'"] + +if {$hasdefault == "f"} { + set default "" +} else { + set default [db_string get_default "SELECT a.adsrc FROM pg_class c, pg_attrdef a, pg_attribute b, pg_type t WHERE c.relname = '$table' AND a.adrelid = c.oid AND b.attnum > 0 AND b.attrelid = c.oid AND b.attname = '$column' AND b.atttypid = t.oid AND b.atthasdef='t'"] +} + + + +if {$notnull == "t"} { + set checked_p [list checked ""] +} else { + set checked_p "" +} + +ad_form -name altercolumn -form { + {table:text(hidden) + {value $table}} + {column:text(hidden) + {value $column}} + {name:text + {label "Name"} + {value $column}} + {type:text + {mode "display"} + {label "[_ dbm.type]"} + {value $type}} + {notnull:text(checkbox),optional + {label "Not Null"} + {options {{"" "t"}}} + {html $checked_p}} + {default2:text,optional + {label "[_ dbm.default]"} + {value $default}} +} -on_submit { + if {$notnull != "" && $checked_p == ""} { + db_dml alter_column "alter table \"$table\" alter column \"$column\" set not null" + } elseif {$notnull == "" && $checked_p != ""} { + db_dml alter_column "alter table \"$table\" alter column \"$column\" drop not null" + } + if {$name != $column} { + db_dml alter_column "alter table \"$table\" rename column \"$column\" to \"$name\"" + } + if {$default2 != ""} { + db_dml alter_column "alter table \"$table\" alter column \"$column\" set default '$default2'" + } + +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/alterdomain.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterdomain.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterdomain.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/alterdomain.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterdomain.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterdomain.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Display domain checks +} { + domain +} + + +db_multirow checks get_checks {} + +template::list::create \ + -name check \ + -multirow checks \ + -key conname \ + -actions [list "[_ dbm.adddomaincheck]" [export_vars -base adddomaincheck {domain}] "[_ dbm.adddomaincheck]"] \ + -elements { + conname { + label "Name" + } + consrc { + label "Definition" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } \ No newline at end of file Index: openacs-4/packages/dbm/www/alterdomain.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterdomain.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterdomain.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,11 @@ + + + postgresql7.1 + + + select conname, 'CHECK (' || consrc || ')' as consrc from pg_catalog.pg_constraint where + contypid = (select oid from + pg_catalog.pg_type where typname='$domain'); + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/alterfunction.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterfunction.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterfunction.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/alterfunction.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterfunction.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterfunction.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,102 @@ +ad_page_contract { + Alter function properties +} { + function + args +} + +set prosrc [db_string get_definition "select prosrc from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set proarguments $args +set proresult [db_string get_result "select pt.typname from pg_type pt, pg_proc pc where proname = '$function' and pc.prorettype = pt.oid and oidvectortypes(proargtypes)='$args'"] +set prolanguage [db_string get_lang "select lanname from pg_proc pc, pg_language pl where proname = '$function' and pc.prolang = pl.oid and oidvectortypes(proargtypes)='$args'"] +set provolatile [db_string get_prop1 "select provolatile from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set proisstrict [db_string get_prop2 "select proisstrict from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set prosecdef [db_string get_prop3 "select prosecdef from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] + +set p1_opts [dbm::create_combo_opts -parameter Properties1] +set p2_opts [dbm::create_combo_opts -parameter Properties2 -split ";"] +set p3_opts [dbm::create_combo_opts -parameter Properties3 -split ";"] + +if {$provolatile == "v"} { + set provolatile "VOLATILE" +} elseif {$provolatile == "i"} { + set provolatile "IMMUTABLE" +} elseif {$provolatile == "s"} { + set provolatile "STABLE" +} else { + set provolatile "Error" +} + +if {$proisstrict == "t"} { + set proisstrict "RETURNS NULL ON NULL INPUT" +} else { + set proisstrict "CALLED ON NULL INPUT" +} + +if {$prosecdef == "t"} { + set prosecdef "SECURITY DEFINER" +} else { + set prosecdef "SECURITY INVOKER" +} + +ad_form -name alterfunction -form { + {function:text + {value $function} + {mode "display"} + {label "[_ dbm.function]"} + } + {args:text(hidden) + {value $args} + } + {proarguments:text + {label "[_ dbm.arguments]"} + {mode "display"} + {value $proarguments} + } + {proresult:text + {value $proresult} + {mode "display"} + {label "[_ dbm.returns]"} + } + + {prolanguage:text + {value $prolanguage} + {mode "display"} + {label "[_ dbm.prolang]"} + } + {prosrc:text(textarea) + {label ""} + {nospell} + {section "Definition"} + {value $prosrc} + {html {rows 15 cols 70}} + } + {provolatile:text(select),optional + {value $provolatile} + {options {$p1_opts}} + {label ""} + {section "[_ dbm.properties]"} + } + {proisstrict:text(select),optional + {value $proisstrict} + {options {$p2_opts}} + {label ""} + {section "[_ dbm.properties]"} + } + {prosecdef:text(select),optional + {value $prosecdef} + {options {$p3_opts}} + {label ""} + {section "[_ dbm.properties]"} + } + +} -on_submit { + if {$proarguments != ""} { + db_dml alter_function "create or replace function $function ($proarguments) returns $proresult as '$prosrc' language $prolanguage \n$provolatile \n$proisstrict \n$prosecdef;" + } else { + db_dml alter_function "create or replace function $function () returns $proresult as '$prosrc' language $prolanguage \n$provolatile \n$proisstrict \n$prosecdef;" + } +} -after_submit { + ad_returnredirect "showfunctions" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/alterprivileges2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterprivileges2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterprivileges2.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/alterprivileges2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterprivileges2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterprivileges2.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,215 @@ +ad_page_contract { + Alter privileges +} { + {function ""} + {args ""} + {oid ""} + {schema ""} + {sequence ""} + {table ""} + {view ""} + {database ""} +} + +set users [db_list_of_lists get_users {}] +set groups [db_list_of_lists get_groups {}] + +if {$function != ""} { + set opts "{\"EXECUTE\" \"EXECUTE\"}" + set returnurl "functionprivileges?function=$function&args=$args&oid=$oid" +} + +if {$schema != ""} { + set opts "{\"CREATE\" \"CREATE\"} {\"USAGE\" \"USAGE\"}" + set returnurl "schemaprivileges?schema=$schema" +} + +if {$sequence != ""} { + set opts "{\"SELECT\" \"SELECT\"} {\"UPDATE\" \"UPDATE\"}" + set returnurl "sequenceprivileges?sequence=$sequence" +} + +if {$table != ""} { + set opts "{\"SELECT\" \"SELECT\"} {\"INSERT\" \"INSERT\"} {\"UPDATE\" \"UPDATE\"} {\"DELETE\" \"DELETE\"} {\"RULE\" \"RULE\"} {\"REFERENCES\" \"REFERENCES\"} {\"TRIGGER\" \"TRIGGER\"}" + set returnurl "tableprivileges?table=$table" +} + +if {$view != ""} { + set opts "{\"SELECT\" \"SELECT\"} {\"RULE\" \"RULE\"}" + set returnurl "viewprivileges?view=$view" +} + +if {$database != ""} { + set opts "{\"CREATE\" \"CREATE\"} {\"TEMPORARY\" \"TEMPORARY\"}" + set returnurl "privileges" +} + + ad_form -name alterprivileges -form { + {function:text(hidden) + {value $function} + } + {args:text(hidden) + {value $args} + } + {oid:text(hidden) + {value $oid} + } + {schema:text(hidden) + {value $schema} + } + {sequence:text(hidden) + {value $sequence} + } + {table:text(hidden) + {value $table} + } + {view:text(hidden) + {value $view} + } + {database:text(hidden) + {value $database} + } + {user:text(multiselect),multiple,optional + {label ""} + {options {$users}} + {section "[_ dbm.users]"} + } + {public:text(checkbox),optional + {label ""} + {section "[_ dbm.groups]"} + {options {{"PUBLIC" 1}}} + } + {group:text(multiselect),multiple,optional + {label ""} + {options {$groups}} + {section "[_ dbm.groups]"} + } + {privs:text(checkbox),multiple + {label ""} + {section "[_ dbm.privileges]"} + {options $opts} + } + {grant:text(checkbox),optional + {label ""} + {section "[_ dbm.options]"} + {options {{"GRANT OPTION" 1}}} + } + {cascade:text(checkbox),optional + {label ""} + {section "[_ dbm.options]"} + {options {{"CASCADE (Revoke)" 1}}} + } + {revoke:text(checkbox),optional + {label ""} + {section "[_ dbm.options]"} + {options {{"Revoke" 1}}} + } + } -on_submit { + + foreach el $group { + set temp $el + set el [concat "GROUP" $temp] + } + + set userlist [dbm::format_list -name $user] + set grouplist [dbm::format_list -name $group] + + if {$revoke == ""} { + set sql "grant" + } else { + set sql "revoke" + } + + if {$grant != "" && $revoke != ""} { + set sql [concat $sql "grant option for"] + } + + set privlist [dbm::format_list -name $privs] + set sql [concat $sql $privlist] + + if {$function != ""} { + if {$revoke == ""} { + set sql [concat $sql "on function \"$function\" ($args) to"] + } else { + set sql [concat $sql "on function \"$function\" ($args) from"] + } + } + + if {$schema != ""} { + if {$revoke == ""} { + set sql [concat $sql "on schema \"$schema\" to"] + } else { + set sql [concat $sql "on schema \"$schema\" from"] + } + } + + if {$sequence != ""} { + if {$revoke == ""} { + set sql [concat $sql "on \"$sequence\" to"] + } else { + set sql [concat $sql "on \"$sequence\" from"] + } + } + + if {$table != ""} { + if {$revoke == ""} { + set sql [concat $sql "on \"$table\" to"] + } else { + set sql [concat $sql "on \"$table\" from"] + } + } + + if {$view != ""} { + if {$revoke == ""} { + set sql [concat $sql "on \"$view\" to"] + } else { + set sql [concat $sql "on \"$view\" from"] + } + } + + if {$database != ""} { + if {$revoke == ""} { + set sql [concat $sql "on database \"$database\" to"] + } else { + set sql [concat $sql "on database \"$database\" from"] + } + } + + if {$public != ""} { + set sql [concat $sql "public"] + } + + if {$user != "" && $public == ""} { + set sql [concat $sql $userlist] + } + + if {$user != "" && $public != ""} { + set sql [concat $sql "," $userlist] + } + + if {$group != "" && $public == "" && $user == ""} { + set sql [concat $sql $grouplist] + } + + if {$group != "" && $public != ""} { + set sql [concat $sql "," $grouplist] + } elseif {$group != "" && $user != ""} { + set sql [concat $sql "," $grouplist] + } + + if {$grant != "" && $revoke == ""} { + set sql [concat $sql "with grant option"] + } + + if {$cascade != "" && $revoke != ""} { + set sql [concat $sql "CASCADE"] + } + + db_dml alter_privs "$sql" + ad_returnredirect "$returnurl" + ad_script_abort + } + + + + Index: openacs-4/packages/dbm/www/alterprivileges2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterprivileges2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterprivileges2.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,17 @@ + + + postgresql7.1 + + + select usename as name1, usename as name2 from pg_user order by usename + + + + + + SELECT groname as group1, groname as group2 FROM pg_group ORDER BY + groname + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/altertable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/altertable.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/altertable.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/altertable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/altertable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/altertable.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + Alter table +} { + table +} + +set users [db_list_of_lists get_users {}] + +ad_form -name altertable -form { + {table:text(hidden) + {value $table} + } + {newtable:text + {value $table} + {label "Name"} + } + {user:text(select) + {label "[_ dbm.owner]"} + {options {$users}} + } +} -on_submit { + db_dml alter_table "alter table \"$table\" rename to \"$newtable\"" + db_dml alter_table2 "alter table \"$newtable\" owner to \"$user\"" +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/altertable.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/altertable.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/altertable.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + + postgresql7.1 + + + select usename as name1, usename as name2 from pg_user order by usename + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/alterview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterview.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterview.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/alterview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/alterview.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/alterview.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,24 @@ +ad_page_contract { + Alter view definition +} { + name +} + +set definition [db_string get_definition "select definition from pg_views where viewname='$name'"] + +ad_form -name alterview -form { + {name:text + {value $name} + {mode "display"} + {label "Name"}} + {definition:text(textarea) + {label "Definition"} + {nospell} + {value $definition} + {html {rows 8 cols 50}}} +} -on_submit { + db_dml alter_view "create or replace view $name as $definition;" +} -after_submit { + ad_returnredirect "views" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/analyze.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/analyze.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/analyze.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ +db_dml analyze "ANALYZE" +ad_returnredirect "admin?msg=[_ dbm.analyzecomplete]" \ No newline at end of file Index: openacs-4/packages/dbm/www/bottombar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/bottombar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/bottombar.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1 @@ +bottom \ No newline at end of file Index: openacs-4/packages/dbm/www/browser.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browser.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browser.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,29 @@ + +
    + +
+ + +
    +
  • #dbm.Vacuum# +
  • #dbm.Analyze# +
  • #dbm.Cluster# +
  • #dbm.Reindex# +
      + + + Index: openacs-4/packages/dbm/www/browser.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browser.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browser.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ +db_multirow databases get_databases {} + Index: openacs-4/packages/dbm/www/browser.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browser.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browser.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + + postgresql7.1 + + + select datname from pg_database order by datname + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/browsetable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browsetable.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browsetable.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,4 @@ + + + + Index: openacs-4/packages/dbm/www/browsetable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browsetable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browsetable.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,39 @@ +ad_page_contract { + Browse a table +} { + table +} + +db_multirow tables browse_table {} + +set elements [db_list_of_lists get_fields {}] +# what we get: rel_id member_state +# what we want: rel_id {label rel_id} member_state {label member_state} + + +foreach element $elements { + set temp "{label $element}" + append output [concat $element "$temp"] " " +} + +append output "mycolumn { label \"[_ dbm.actions]\" \n display_template { }}" + + +template::list::create \ + -name browsed_table \ + -multirow tables \ + -elements $output + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/browsetable.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browsetable.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browsetable.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,21 @@ + + + postgresql7.1 + + + select * from $table + + + + + + SELECT a.attname AS field + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/browseview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browseview.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browseview.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/browseview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browseview.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browseview.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,36 @@ +ad_page_contract { + Browse a view +} { + {view ""} + page:optional + orderby:optional +} + +if {[empty_string_p $view]} { + set view [ad_get_client_property dbm view] +} else { + ad_set_client_property dbm view $view +} + +set pagesize [parameter::get -parameter "PageSize"] +set elements [db_list_of_lists get_fields {}] + +set column [lindex $elements 0] + + +foreach element $elements { + set temp "{label $element}" + append output [concat $element "$temp"] " " +} + +template::list::create \ + -name views \ + -multirow views \ + -key $column \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name views_pagination \ + -elements $output + + +db_multirow views browse_view {} Index: openacs-4/packages/dbm/www/browseview.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/browseview.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/browseview.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,30 @@ + + + postgresql7.1 + + + + select * from $view + + + + + + + select * from $view where + [template::list::page_where_clause -name "views"] + + + + + + SELECT a.attname + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$view' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/cluster.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/cluster.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/cluster.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ +db_dml cluster "CLUSTER" +ad_returnredirect "admin?msg=[_ dbm.clustercomplete]" Index: openacs-4/packages/dbm/www/clusterconstraint.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/clusterconstraint.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/clusterconstraint.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + Cluster +} { + table + constraint +} + +db_dml cluster "cluster $constraint on $table" + +ad_returnredirect "tableconstraints?table=$table&msg=[_ dbm.clustercomplete]" +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/clusterindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/clusterindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/clusterindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + Cluster an index +} { + index + table +} + +db_dml cluster_index "cluster \"$index\" on \"$table\"" + +ad_returnredirect "tableindex?table=$table&msg=[_ dbm.clustercomplete]" +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/createdatabase.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdatabase.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdatabase.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + + + +

      + + Index: openacs-4/packages/dbm/www/createdatabase.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdatabase.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdatabase.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + Create Database +} { + {name ""} + {encoding_type ""} + +} + +db_multirow databases get_information {} + +template::list::create \ + -name database_information \ + -multirow databases \ + -key Name \ + -elements { + Name { + label "[_ dbm.database]" + } + Owner { + label "[_ dbm.owner]" + } + Encoding { + label "[_ dbm.encoding]" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } + +set encoding_opts [dbm::create_combo_opts -parameter EncodingTypes] + +ad_form -name createdatabase -form { + {name:text + {label "Name"}} + {encoding_type:text(select),optional + {label "[_ dbm.encoding]"} + {options {$encoding_opts}}} +} -validate { + {name + {[string length $name] >= 1} + "\"Name\" must be a string containing 1 character" + } +} -on_submit { + if {$encoding_type == ""} { + db_dml create_database "create database $name" + } else { + db_dml create_database "create database $name with encoding=:encoding_type" + } +} -after_submit { + ad_returnredirect "createdatabase" + ad_script_abort +} + + Index: openacs-4/packages/dbm/www/createdatabase.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdatabase.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdatabase.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.1 + + + SELECT d.datname as "Name", + u.usename as "Owner", + pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding" +FROM pg_catalog.pg_database d + LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid +ORDER BY 1; + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createdomain.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdomain.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdomain.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createdomain.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdomain.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdomain.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,63 @@ + +set type_opts [db_list_of_lists get_types {}] + +ad_form -name createdomain -form { + {name:text + {label "Name"} + {float "left"} + {section "Name"} + {text_align "left"}} + {type:text(select) + {options {$type_opts}} + {float "left"} + {label ""} + {text_align "center"} + {section "[_ dbm.type]"}} + {arg:text,optional + {float "left"} + {label ""} + {section "[_ dbm.type]"}} + {array:text(checkbox),optional + {label ""} + {float "left"} + {section "[_ dbm.type]"} + {options {{"Array" 1}}}} + {notnull:text(checkbox),optional + {label ""} + {float "left"} + {text_align "left"} + {section "Not Null"} + {options {{"Not Null" 1}}}} + {default:text,optional + {float "left"} + {section "[_ dbm.default]"} + {label "[_ dbm.default]"}} + {check:text,optional + {float "left"} + {help_text "[_ dbm.enter]"} + {section "Check"} + {label "Check(...)"}} +} -on_submit { + if {$check != ""} { + set check "CHECK ($check)" + } + if {$default != ""} { + set default "DEFAULT $default" + } + if {$array != ""} { + set array "[]" + } + if {$notnull == ""} { + set notnull "NULL" + } else { + set notnull "NOT NULL" + } + if {$arg != ""} { + db_dml create_domain "create domain $name as $type ($arg)$array $notnull $default $check" + } else { + db_dml create_domain "create domain $name as $type$array $notnull $default $check" + } +} -after_submit { + ad_returnredirect "showdomains" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createdomain.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createdomain.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createdomain.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ + + + postgresql7.1 + + + SELECT pg_catalog.format_type(t.oid, NULL) AS type1, + pg_catalog.format_type(t.oid, NULL) AS type2 + FROM pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace + WHERE (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c + WHERE c.oid = t.typrelid)) AND t.typname !~ '^_' + AND pg_catalog.pg_type_is_visible(t.oid) + AND n.nspname = 'pg_catalog' + ORDER BY pg_catalog.format_type(t.oid, NULL); + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createfunction.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createfunction.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createfunction.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/createfunction.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createfunction.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createfunction.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,72 @@ + +set p1_opts [dbm::create_combo_opts -parameter Properties1] +set p2_opts [dbm::create_combo_opts -parameter Properties2 -split ";"] +set p3_opts [dbm::create_combo_opts -parameter Properties3 -split ";"] +set r1_opts [dbm::create_combo_opts -parameter Returns1] +set lang_opts [dbm::create_combo_opts -parameter ProgrammingLanguages] +set r2_opts [db_list_of_lists get_returns {}] + +ad_form -name createfunction -form { + {name:text + {label "Name"} + {float "left"} + {text_align "center"} + {section "[_ dbm.general]"} + } + {arguments:text,optional + {label "[_ dbm.arguments]"} + {float "left"} + {text_align "center"} + {section "[_ dbm.general]"} + } + {return1:text(select),optional + {options {$r1_opts}} + {section "[_ dbm.returns]"} + {label ""} + {float "left"} + } + {return2:text(select) + {options {$r2_opts}} + {section "[_ dbm.returns]"} + {label ""} + {float "left"} + } + {language:text(select) + {options {$lang_opts}} + {float "left"} + {section "[_ dbm.prolang]"} + {label ""} + } + {definition:text(textarea) + {label ""} + {nospell} + {section "Definition"} + {html {rows 15 cols 70}} + } + {propertie1:text(select),optional + {options {$p1_opts}} + {section "[_ dbm.properties]"} + {label ""} + } + {propertie2:text(select),optional + {options {$p2_opts}} + {section "[_ dbm.properties]"} + {label ""} + } + {propertie3:text(select),optional + {options {$p3_opts}} + {section "[_ dbm.properties]"} + {label ""} + {help_text "[_ dbm.createfunction]"} + } + +} -on_submit { + if {$arguments != ""} { + db_dml create_function "create function $name ($arguments) returns $return1 $return2 as '$definition' language $language \n$propertie1 \n$propertie2 \n$propertie3;" + } else { + db_dml create_function "create function $name () returns $return1 $return2 as '$definition' language $language \n$propertie1 \n$propertie2 \n$propertie3;" + } +} -after_submit { + ad_returnredirect "showfunctions" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createfunction.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createfunction.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createfunction.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,20 @@ + + + postgresql7.1 + + + SELECT pg_catalog.format_type(t.oid, NULL) AS typname1, + pg_catalog.format_type(t.oid, NULL) AS typname2 + FROM (pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace) + LEFT JOIN pg_catalog.pg_user pu ON t.typowner = pu.usesysid + WHERE (t.typrelid = 0 OR (SELECT c.relkind IN ('c', 'r', 'v') + FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid AND c.relnamespace NOT IN + (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname LIKE 'pg_%'))) + AND t.typname !~ '^_' + AND pg_catalog.pg_type_is_visible(t.oid) + ORDER BY typname1 + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createindex.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createindex.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createindex.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,55 @@ +ad_page_contract { + Create index +} { + table +} + +set method_opts [dbm::create_combo_opts -parameter methods] + +set columns [db_list_of_lists get_columns {}] + +ad_form -name createindex -form { + {name:text + {label "Name"} + } + {table:text(hidden) + {value $table} + } + {column:text(multiselect),multiple + {label "[_ dbm.columnsinindex]"} + {options {$columns}} + } + {method:text(select) + {options {$method_opts}} + {label "[_ dbm.typeofindex]"} + } + {unique:text(checkbox),optional + {label ""} + {options {{"Unique" 1}}} + } + {where:text,optional + {label "Where(...)"} + {help_text "[_ dbm.enter]"} + } +} -on_submit { + if {$unique != ""} { + set unique "UNIQUE" + } + + set output [list] + + foreach el $column { + lappend output [concat \"$el\"] + } + + set columnslist [dbm::format_list -name $output] + + if {$where != ""} { + db_dml create_index "create $unique index \"$name\" on \"$table\" using $method ($columnslist) where ($where)" + } else { + db_dml create_index "create $unique index \"$name\" on \"$table\" using $method ($columnslist)" + } + + ad_returnredirect "tableindex?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createindex.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createindex.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createindex.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + SELECT a.attname AS field1, a.attname AS field2 + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createrule.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createrule.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createrule.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createrule.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createrule.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createrule.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + Create a rule +} { + table +} + +set event_opts [dbm::create_combo_opts -parameter RuleEvent] + +ad_form -name createrule -form { + {table:text(hidden) + {mode "display"} + {value $table} + } + {name:text + {label "Name"} + } + {event:text(select) + {options {$event_opts}} + {label "[_ dbm.event]"} + } + {where:text,optional + {label "Where"} + {html {size 50}} + } + {instead:text(checkbox),optional + {label "Do Instead"} + {options {{"" 1}}} + } + {action:text + {label "[_ dbm.action]"} + {html {size 50}} + } +} -on_submit { + if {$where != ""} { + set where "WHERE $where" + } + if {$instead != ""} { + set instead "INSTEAD" + } + db_dml create_rule "create rule $name as on $event to $table $where do $instead $action" + +} -after_submit { + ad_returnredirect "showrules?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createschema.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createschema.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createschema.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createschema.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createschema.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createschema.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,21 @@ + +set users [db_list_of_lists get_users {}] + + +ad_form -name createschema -form { + {name:text + {label "Name"} + } + {user:text(select),optional + {label "[_ dbm.owner]"} + {options {$users}} + } +} -on_submit { + if {$user != ""} { + db_dml create_schema "create schema $name authorization \"$user\"" + } else { + db_dml create_schema "create schema $name" + } + ad_returnredirect "schemas" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createschema.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createschema.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createschema.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + + postgresql7.1 + + + select usename as name1, usename as name2 from pg_user order by usename + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createsequence.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createsequence.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createsequence.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createsequence.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createsequence.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createsequence.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,54 @@ +ad_page_contract { + Create Sequence +} { + {name ""} + +} + +ad_form -name createsequence -form { + {name:text + {label "Name"}} + {increment:text,optional + {label "[_ dbm.increment_by]"}} + {min:text + {label "[_ dbm.minvalue]"}} + {max:text + {label "[_ dbm.maxvalue]"}} + {start:text,optional + {label "[_ dbm.startvalue]"}} + {cache:text,optional + {label "[_ dbm.cachevalue]"}} + {cycle:text(checkbox),optional + {label "[_ dbm.iscycle]"} + {options {{[_ dbm.yes] 1}}}} +} -validate { + {name + {[string length $name] >= 1} + "\"Name\" must be a string containing 1 character" + } +} -on_submit { + if {$increment == ""} { + set increment2 "INCREMENT 1" + } else { + set increment2 "INCREMENT $increment" + } + if {$start < 0} { + set start2 "START $max" + } else { + set start2 "START $min" + } + if {$cache == ""} { + set cache2 "CACHE 1" + } else { + set cache2 "CACHE $cache" + } + if {$cycle == ""} { + set cycle2 "NO CYCLE" + } else { + set cycle2 "CYCLE" + } + db_dml create_sequence "create sequence $name $increment2 minvalue $min maxvalue $max $start2 $cache2 $cycle2" +} -after_submit { + ad_returnredirect "showsequences" + ad_script_abort +} Index: openacs-4/packages/dbm/www/createtable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtable.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtable.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createtable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtable.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ +ad_form -name createtable -form { + {name:text + {label "Name"} + } + {amount:text + {label "[_ dbm.numfields]"} + } + {oids:text(checkbox),optional + {label "[_ dbm.options]"} + {options {{"WITHOUT OIDS" 1}}}} + } -on_submit { + if {$oids == ""} { + set oids "WITH OIDS" + } else { + set oids "WITHOUT OIDS" + } + ad_returnredirect "createtable2?name=$name&amount=$amount&oids=$oids" +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createtable2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtable2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtable2.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createtable2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtable2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtable2.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,96 @@ +ad_page_contract { + Create table +} { + name + amount + oids +} + + +# now retrieve the data +set field_ids [list] +for {set i 0} {$i<$amount} {incr i} { + lappend field_ids f_$i +} + +set form_name createtable2 + +set elements [list] +for {set i 0} {$i<$amount} {incr i} { + lappend elements $i +} +set prefix "myprefix" + +set fields [dbm::create_form_def -form_name $form_name -elements $elements -prefix $prefix] + +lappend fields [list "name:text(hidden)" \ + [list value "$name"] \ + ] +lappend fields [list "oids:text(hidden)" \ + [list value "$oids"] \ + ] +lappend fields [list "amount:text(hidden)" \ + [list value "$amount"] \ + ] + +#length:myprefix1_dummy2 etc + +ad_form -name $form_name -form $fields -after_submit { + + for {set i 1} {$i<=$amount} {incr i} { + set x [concat myprefix${i}_dummy] + set x2 [concat myprefix${i}_dummy2] + set x3 [concat myprefix${i}_dummy3] + set x4 [concat myprefix${i}_dummy4] + set x5 [concat myprefix${i}_dummy5] + set y [set [set x]] + set y2 [set [set x2]] + set y3 [set [set x3]] + set y4 [set [set x4]] + set y5 [set [set x5]] + + set temp 0 + if {$i == $amount} { + set temp 1 + } + + if {$y2 != ""} { + set z2 "($y2)" + } else { + set z2 "" + } + + if {$y4 != ""} { + set z4 "NOT NULL" + } else { + set z4 "" + } + + if {$y5 != ""} { + set z5 "DEFAULT $y5" + } else { + set z5 "" + } + + if {$temp == 0} { + set temp2 "," + } else { + set temp2 "" + } + + append output [concat $y $y3$z2 $z4 $z5$temp2] " " + } + + if {$oids != ""} { + set oids2 "WITHOUT OIDS" + } else { + set oids2 "WITH OIDS" + } + + set alpha [concat "create table \"$name\"\(" $output "\)" $oids2] + db_dml create_table "$alpha" + + ad_returnredirect "showtables" + ad_script_abort + +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createtable2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtable2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtable2.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,20 @@ + + + postgresql7.1 + + + SELECT pg_catalog.format_type(t.oid, NULL) AS typname, + pg_catalog.format_type(t.oid, NULL) AS typname2 + FROM (pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace) + LEFT JOIN pg_catalog.pg_user pu ON t.typowner = pu.usesysid + WHERE (t.typrelid = 0 OR (SELECT c.relkind IN ('c') FROM pg_catalog.pg_class c + WHERE c.oid = t.typrelid AND c.relnamespace NOT IN (SELECT oid FROM + pg_catalog.pg_namespace WHERE nspname LIKE 'pg_%'))) + AND pg_catalog.pg_type_is_visible(t.oid) + ORDER BY typname + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createtrigger.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtrigger.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtrigger.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createtrigger.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtrigger.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtrigger.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + Create a trigger +} { + table +} + +set functions_opts [db_list_of_lists get_functions {}] +set when_opts [dbm::create_combo_opts -parameter when] +set event_opts [dbm::create_combo_opts -parameter event -split ","] + +ad_form -name createtrigger -form { + {name:text + {label "Name"}} + {table:text(hidden) + {value $table}} + {when:text(select) + {options {$when_opts}} + {label "[_ dbm.when]"}} + {event:text(select) + {options {$event_opts}} + {label "[_ dbm.event]"}} + {function:text(select) + {options {$functions_opts}} + {label "[_ dbm.function]"}} + {row:text(checkbox),optional + {label "[_ dbm.for_each_row]"} + {options {{"[_ dbm.yes]" 1}}}} + {args:text,optional + {help_text "[_ dbm.enter]"} + {label "[_ dbm.arguments](...)"}} +} -on_submit { + if {$row == ""} { + set row "STATEMENT" + } else { + set row "ROW" + } + + db_dml create_trigger "create trigger $name $when $event on $table for each $row execute procedure \"$function\" ($args)" + +} -after_submit { + ad_returnredirect "tabletriggers?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/createtrigger.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createtrigger.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createtrigger.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,20 @@ + + + postgresql7.1 + + + SELECT DISTINCT ON (p.proname) + p.proname AS name, p.proname AS name2 + FROM pg_catalog.pg_proc p + INNER JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace + INNER JOIN pg_catalog.pg_language pl ON pl.oid = p.prolang + LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner + WHERE NOT p.proisagg + AND pg_catalog.pg_function_is_visible(p.oid) + AND p.prorettype = (select oid from pg_catalog.pg_type p where p.typname + = 'trigger') + ORDER BY p.proname + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createview.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createview.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/createview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/createview.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/createview.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,22 @@ +ad_form -name createview -form { + {name:text + {label "Name"}} + {definition:text(textarea) + {label "Definition"} + {nospell} + {html {rows 8 cols 50}}} +} -validate { + {name + {[string length $name] >= 1} + "\"Name\" must be a string containing 1 character" + } + {definition + {[string length $definition] >= 1} + "\"Definition\" must be a string containing 1 character" + } +} -on_submit { + db_dml create_view "create view $name as $definition;" +} -after_submit { + ad_returnredirect "views" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/deleterow.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/deleterow.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/deleterow.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,60 @@ + +set params "table" + +ad_page_contract { + Delete a row +} $params + +set elements [db_list_of_lists get_fields {}] +set params $elements + +ad_page_contract { + Delete a row +} $params + +set output "where" +set count [llength $elements] +set i 1 + +foreach element $elements { + set temp [set [set element]] + + set type [db_string get_type "select t.typname from pg_class c, pg_attribute a, pg_type t where c.relname = '$table' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and a.attname='$element'"] + + if {$type == "int4" || $type == "int8" || $type == "serial8" || $type == "float8" || $type == "decimal" || $type == "int2" || $type == "serial4"} { + set integer 1 + } else { + set integer 0 + } + + + if {$i != $count} { + + if {$integer == 0 && $temp != ""} { + append output " " [concat \"$element\" "='$temp' and"] " " + } elseif {$integer == 0 && $temp == ""} { + append output " " [concat \"$element\" "is null and"] " " + } elseif {$integer == 1 && $temp != ""} { + append output " " [concat \"$element\" "=$temp and"] " " + } elseif {$integer == 1 && $temp == ""} { + append output " " [concat \"$element\" "is null and"] " " + } + + } else { + + if {$integer == 0 && $temp != ""} { + append output " " [concat \"$element\" "='$temp'"] " " + } elseif {$integer == 1 && $temp != ""} { + append output " " [concat \"$element\" "=$temp"] " " + } elseif {$integer == 0 && $temp == ""} { + append output " " [concat \"$element\" "is null"] " " + } elseif {$integer == 1 && $temp == ""} { + append output " " [concat \"$element\" "is null"] " " + } + } + + set i [expr $i + 1] +} + +db_dml delete_row "delete from $table $output" +ad_returnredirect "browsetable?table=$table" Index: openacs-4/packages/dbm/www/deleterow.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/deleterow.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/deleterow.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.1 + + + SELECT a.attname AS field + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/dropcolumn.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropcolumn.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropcolumn.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropcolumn#
      + Index: openacs-4/packages/dbm/www/dropcolumn.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropcolumn.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropcolumn.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,30 @@ +ad_page_contract { + Confirm dropping of a column +} { + table + column +} + + + +ad_form -name dropcolumn -form { + {table:text(hidden) + {value $table}} + {column:text(hidden) + {value $column}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_column "alter table \"$table\" drop column \"$column\" $cascade2" + +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropconstraint.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropconstraint.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropconstraint.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropconstraint#
      + Index: openacs-4/packages/dbm/www/dropconstraint.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropconstraint.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropconstraint.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Confirm dropping of a constraint +} { + constraint + table +} + + +ad_form -name dropconstraint -form { + {constraint:text(hidden) + {value $constraint}} + {table:text(hidden) + {value $table}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_constraint "alter table \"$table\" drop constraint \"$constraint\" $cascade2" + +} -after_submit { + ad_returnredirect "tableconstraints?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropdatabase.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdatabase.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdatabase.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropdatabase#
      + Index: openacs-4/packages/dbm/www/dropdatabase.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdatabase.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdatabase.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + Confirm dropping of a database +} { + database +} + + +ad_form -name dropdatabase -form { + {database:text(hidden) + {mode "display"} + {value $database}} +} -on_submit { + + db_dml drop_database "drop database \"$database\"" + +} -after_submit { + ad_returnredirect "createdatabase" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropdefault.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdefault.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdefault.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + Drop default +} { + table + column +} + +db_dml alter_column "alter table \"$table\" alter column \"$column\" DROP DEFAULT" + +ad_returnredirect "showtables" +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/dropdomain.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdomain.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdomain.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropdomain#
      + Index: openacs-4/packages/dbm/www/dropdomain.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdomain.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdomain.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Confirm dropping of a domain +} { + typname:multiple +} + +set domainlist [dbm::format_list -name $typname] + +ad_form -name dropdomain -form { + {typname:text(hidden) + {mode "display"} + {value $typname}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + foreach domain $typname { + db_dml drop_domain "drop domain $domain $cascade2" + } +} -after_submit { + ad_returnredirect "showdomains" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropdomaincheck.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdomaincheck.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdomaincheck.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropdomaincheck#
      + Index: openacs-4/packages/dbm/www/dropdomaincheck.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropdomaincheck.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropdomaincheck.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + Confirm dropping of a domain check +} { + Name + check +} + + +ad_form -name dropcheck -form { + {Name:text(hidden) + {mode "display"} + {value $Name}} + {check:text(hidden) + {mode "display"} + {value $check}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_check "alter domain $Name drop constraint $check $cascade2" + +} -after_submit { + ad_returnredirect "alterdomain?domain=$Name" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropfunction.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropfunction.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropfunction.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,5 @@ + +#dbm.dropfunction#
      + + + Index: openacs-4/packages/dbm/www/dropfunction.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropfunction.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropfunction.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + Confirm dropping of a function +} { + proname + args +} + + +ad_form -name dropfunction -form { + {proname:text(hidden) + {mode "display"} + {value $proname}} + {args:text(hidden) + {mode "display"} + {value $args}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_function "drop function $proname ( $args ) $cascade2" + +} -after_submit { + ad_returnredirect "showfunctions" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropindex.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropindex.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropindex.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropindex#
      + Index: openacs-4/packages/dbm/www/dropindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Confirm dropping of an index +} { + index + table +} + + +ad_form -name dropindex -form { + {index:text(hidden) + {value $index}} + {table:text(hidden) + {value $table}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_index "drop index \"$index\" $cascade2" + +} -after_submit { + ad_returnredirect "tableindex?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/droprule.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droprule.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droprule.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.droprule#
      + Index: openacs-4/packages/dbm/www/droprule.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droprule.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droprule.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + Confirm dropping of a rule +} { + rulename + tablename +} + + +ad_form -name droprule -form { + {rulename:text(hidden) + {mode "display"} + {value $rulename}} + {tablename:text(hidden) + {mode "display"} + {value $tablename}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_rule "drop rule $rulename on $tablename $cascade2" + +} -after_submit { + ad_returnredirect "showrules?table=$tablename" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropschema.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropschema.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropschema.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropschema#
      + Index: openacs-4/packages/dbm/www/dropschema.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropschema.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropschema.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Confirm dropping of a schema +} { + nspname:multiple +} + +set schemalist [dbm::format_list -name $nspname] + +ad_form -name dropschema -form { + {nspname:text(hidden) + {mode "display"} + {value $nspname}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + foreach schema $nspname { + db_dml drop_schema "drop schema $schema $cascade2" + } +} -after_submit { + ad_returnredirect "schemas" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropsequence.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropsequence.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropsequence.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropsequence#
      + Index: openacs-4/packages/dbm/www/dropsequence.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropsequence.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropsequence.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Confirm dropping of a sequence +} { + relname:multiple +} + +set sequencelist [dbm::format_list -name $relname] + +ad_form -name dropsequence -form { + {relname:text(hidden) + {value $relname} + {mode "display"}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + foreach sequence $relname { + db_dml drop_sequence "drop sequence $sequence $cascade2" + } +} -after_submit { + ad_returnredirect "showsequences" + ad_script_abort +} Index: openacs-4/packages/dbm/www/droptable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droptable.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droptable.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.droptable#
      + Index: openacs-4/packages/dbm/www/droptable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droptable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droptable.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Confirm dropping of a table +} { + table +} + +ad_form -name droptable -form { + {table:text(hidden) + {value $table}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_table "drop table \"$table\" $cascade2" + +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/droptrigger.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droptrigger.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droptrigger.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.droptrigger# + Index: openacs-4/packages/dbm/www/droptrigger.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/droptrigger.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/droptrigger.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,32 @@ +ad_page_contract { + Confirm dropping of a trigger +} { + table + trigger +} + + + +ad_form -name droptrigger -form { + {table:text + {mode "display"} + {value $table}} + {trigger:text + {mode "display"} + {value $trigger}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + + db_dml drop_trigger "drop trigger $trigger on $table $cascade2" + +} -after_submit { + ad_returnredirect "tabletriggers?table=$table" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/dropview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropview.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropview.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.dropview#
      + Index: openacs-4/packages/dbm/www/dropview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/dropview.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/dropview.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,29 @@ +ad_page_contract { + Confirm dropping of a view +} { + relname:multiple +} + +set viewlist [dbm::format_list -name $relname] + + +ad_form -name dropview -form { + {relname:text(hidden) + {mode "display"} + {value $relname}} + {cascade:text(checkbox),optional + {label "CASCADE"} + {options {{[_ dbm.yes] 1}}}} +} -on_submit { + if {$cascade == ""} { + set cascade2 "RESTRICT" + } else { + set cascade2 "CASCADE" + } + foreach view $relname { + db_dml drop_view "drop view \"$view\" $cascade2" + } +} -after_submit { + ad_returnredirect "views" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/editrow.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/editrow.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/editrow.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/editrow.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/editrow.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/editrow.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,112 @@ +set params "table" + +ad_page_contract { + Edit a row +} $params + +set elements [db_list_of_lists get_fields {}] +set params $elements + +ad_page_contract { + Edit a row +} $params + + +set dummy 1 + +foreach element $elements { + + set value [set [set element]] + + set temp1 "{" + set temp2 ":text\n {mode \"display\"}\n {label \"$element\"}}\n {$element$dummy:text(hidden)\n {value $value}}\n {$element:text,optional\n {mode \"edit\"}\n {value $value}\n {float \"left\"}\n {label \"\"}}\n" + append form $temp1$dummy $temp2 + lappend oldvalues $element$dummy + set dummy [expr $dummy + 1] +} + + +append form "{table:text(hidden)\n {value $table}}\n" + + +ad_form -name edit -form $form \ + -on_submit { + +set output "where" +set count [llength $elements] +set i 1 + +foreach element $elements { + + set old [concat $element$i] + + set temp [set [set old]] + + set type [db_string get_type "select t.typname from pg_class c, pg_attribute a, pg_type t where c.relname = '$table' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and a.attname='$element'"] + + if {$type == "int4" || $type == "int8" || $type == "serial8" || $type == "float8" || $type == "decimal" || $type == "int2" || $type == "serial4"} { + set integer 1 + } else { + set integer 0 + } + + if {$i != $count} { + + if {$integer == 0 && $temp != ""} { + append output " " [concat \"$element\" "='$temp' and"] " " + } elseif {$integer == 0 && $temp == ""} { + append output " " [concat \"$element\" "is null and"] " " + } elseif {$integer == 1 && $temp != ""} { + append output " " [concat \"$element\" "=$temp and"] " " + } elseif {$integer == 1 && $temp == ""} { + append output " " [concat \"$element\" "is null and"] " " + } + + + } else { + + if {$integer == 0 && $temp != ""} { + append output " " [concat \"$element\" "='$temp'"] " " + } elseif {$integer == 1 && $temp != ""} { + append output " " [concat \"$element\" "=$temp"] " " + } elseif {$integer == 0 && $temp == ""} { + append output " " [concat \"$element\" "is null"] " " + } elseif {$integer == 1 && $temp == ""} { + append output " " [concat \"$element\" "is null"] " " + } + } + + set i [expr $i + 1] +} + + foreach element $elements { + set temp [set [set element]] + + + set type [db_string get_type "select t.typname from pg_class c, pg_attribute a, pg_type t where c.relname = '$table' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and a.attname='$element'"] + + if {$type == "int4" || $type == "int8" || $type == "serial8" || $type == "float8" || $type == "decimal" || $type == "int2" || $type == "serial4"} { + set integer 1 + } else { + set integer 0 + } + + if {$integer == 0 && $temp != ""} { + lappend update "\"$element\"='$temp'" + } elseif {$integer == 0 && $temp == ""} { + lappend update "\"$element\"=null" + } elseif {$integer == 1 && $temp != ""} { + lappend update "\"$element\"=$temp" + } elseif {$integer == 1 && $temp == ""} { + lappend update "\"$element\"=null" + } + } + + set updatelist [dbm::format_list -name $update] + + + db_dml edit_row "update $table set $updatelist $output" + ad_returnredirect "browsetable?table=$table" + + +} Index: openacs-4/packages/dbm/www/editrow.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/editrow.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/editrow.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.1 + + + SELECT a.attname AS field + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/emptytable.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/emptytable.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/emptytable.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.emptytable#
      + Index: openacs-4/packages/dbm/www/emptytable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/emptytable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/emptytable.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ +ad_page_contract { + Confirm emptying of a table +} { + table +} + +ad_form -name emptytable -form { + {table:text(hidden) + {value $table}} +} -on_submit { + db_dml empty_table "delete from \"$table\"" +} -after_submit { + ad_returnredirect "showtables" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/functionprivileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/functionprivileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/functionprivileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/functionprivileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/functionprivileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/functionprivileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + Show function privileges +} { + function + args + oid +} + +template::list::create \ + -name priv \ + -multirow priv \ + -key proacl \ + -actions [list "[_ dbm.alterprivileges]" [export_vars -base alterprivileges2 {oid args function}] "[_ dbm.alterprivileges]"] \ + -elements { + proacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/functionprivileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/functionprivileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/functionprivileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + postgresql7.1 + + + + select proacl from pg_proc where oid='$oid' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/functionproperties.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/functionproperties.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/functionproperties.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/functionproperties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/functionproperties.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/functionproperties.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,91 @@ +ad_page_contract { + Show function properties +} { + function + args +} + + +set prosrc [db_string get_definition "select prosrc from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set proarguments $args +set proresult [db_string get_result "select pt.typname from pg_type pt, pg_proc pc where proname = '$function' and pc.prorettype = pt.oid and oidvectortypes(proargtypes)='$args'"] +set prolanguage [db_string get_lang "select lanname from pg_proc pc, pg_language pl where proname = '$function' and pc.prolang = pl.oid and oidvectortypes(proargtypes)='$args'"] +set provolatile [db_string get_prop1 "select provolatile from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set proisstrict [db_string get_prop2 "select proisstrict from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] +set prosecdef [db_string get_prop3 "select prosecdef from pg_proc where proname='$function' and oidvectortypes(proargtypes)='$args'"] + +if {$provolatile == "v"} { + set provolatile "VOLATILE" +} elseif {$provolatile == "i"} { + set provolatile "IMMUTABLE" +} elseif {$provolatile == "s"} { + set provolatile "STABLE" +} else { + set provolatile "Error" +} + +if {$proisstrict == "t"} { + set proisstrict "RETURNS NULL ON NULL INPUT" +} else { + set proisstrict "CALLED ON NULL INPUT" +} + +if {$prosecdef == "t"} { + set prosecdef "SECURITY DEFINER" +} else { + set prosecdef "SECURITY INVOKER" +} + +ad_form -name displayfunction -form { + {function:text + {value $function} + {mode "display"} + {label "[_ dbm.function]"} + } + {proarguments:text + {label "[_ dbm.arguments]"} + {mode "display"} + {value $proarguments} + } + {proresult:text + {value $proresult} + {mode "display"} + {label "[_ dbm.returns]"} + } + + {prolanguage:text + {value $prolanguage} + {mode "display"} + {label "[_ dbm.prolang]"} + } + {prosrc:text(textarea) + {label ""} + {nospell} + {section "Definition"} + {mode "display"} + {value $prosrc} + {html {rows 15 cols 70}} + } + {provolatile:text + {value $provolatile} + {mode "display"} + {label ""} + {section "[_ dbm.properties]"} + } + {proisstrict:text + {value $proisstrict} + {mode "display"} + {label ""} + {section "[_ dbm.properties]"} + } + {prosecdef:text + {value $prosecdef} + {mode "display"} + {label ""} + {section "[_ dbm.properties]"} + } + +} -has_submit { + 1 +} + \ No newline at end of file Index: openacs-4/packages/dbm/www/graph.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/graph.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/graph.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,10 @@ + + + + + + + +

      +@icon;noquote@ +
      \ No newline at end of file Index: openacs-4/packages/dbm/www/graph.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/graph.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/graph.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,7 @@ +ad_page_contract { + Display table relationships as a graph +} { + table +} + +set icon [dbm::table_icon -name $table] \ No newline at end of file Index: openacs-4/packages/dbm/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/index.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ + + +DB Manager + + + + + + + + + + + + + <body>You need a frames-enabled browser to use this application.</body> + + Index: openacs-4/packages/dbm/www/insertrows.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/insertrows.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/insertrows.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/insertrows.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/insertrows.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/insertrows.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + Insert rows +} { + table + +} + +set elements [db_list_of_lists get_fields {}] + +set dummy 1 + + +foreach element $elements { + + set temp1 "{" + set temp2 ":text\n {mode \"display\"}\n {text_align \"left\"}\n {section \"[_ dbm.insert]\"}\n {label \"$element\"}}\n {$element:text,optional\n {mode \"edit\"}\n {section \"[_ dbm.insert]\"}\n {label \"\"}}\n" + append output $temp1$dummy $temp2 + lappend values $element + set dummy [expr $dummy + 1] +} + + +append output "{table:text(hidden)\n {value $table}}\n" + +ad_form -name insert -form $output \ + -on_submit { + foreach el $values { + set temp [set [set el]] + if {$temp != ""} { + lappend output3 '$temp' + lappend output2 [concat \"$el\"] + } + } + + set columnslist [dbm::format_list -name $output2] + + set valuelist [dbm::format_list -name $output3] + + db_dml insert "insert into \"$table\" ($columnslist) values ($valuelist)" + + ad_returnredirect "showtables" + +} \ No newline at end of file Index: openacs-4/packages/dbm/www/insertrows.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/insertrows.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/insertrows.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ + + + postgresql7.1 + + + + SELECT a.attname AS field + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + + + Index: openacs-4/packages/dbm/www/intro.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/intro.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/intro.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1 @@ \ No newline at end of file Index: openacs-4/packages/dbm/www/privileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/privileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/privileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/privileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/privileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/privileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,13 @@ + +template::list::create \ + -name priv \ + -multirow priv \ + -key datacl \ + -actions [list "[_ dbm.alterprivileges]" alterprivileges2?database=oacs-5-2 "[_ dbm.alterprivileges]"] \ + -elements { + datacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/privileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/privileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/privileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,10 @@ + + + postgresql7.1 + + + + select datacl from pg_database where datname='oacs-5-2' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/processes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/processes.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/processes.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/processes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/processes.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/processes.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ + +template::list::create \ + -name processes \ + -multirow processes \ + -elements { + usename { + label "[_ dbm.users]" + } + procpid { + label "[_ dbm.process]" + } + current_query { + label "SQL" + } + } + + +db_multirow processes show_processes "select usename,procpid,current_query from pg_stat_activity where datname='oacs-5-2' order by usename, procpid" \ No newline at end of file Index: openacs-4/packages/dbm/www/reindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/reindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/reindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ +db_dml reindex "REINDEX DATABASE \"oacs-5-2\"" +ad_returnredirect "admin?msg=[_ dbm.reindex_complete]" Index: openacs-4/packages/dbm/www/reindexconstraint.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/reindexconstraint.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/reindexconstraint.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + Reindex +} { + + table +} + +db_dml reindex "REINDEX TABLE \"$table\"" +ad_returnredirect "tableconstraints?table=$table&msg=[_ dbm.reindex_complete]" +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/reindexindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/reindexindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/reindexindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + Reindex an index +} { + index + table +} + +db_dml reindex "REINDEX INDEX \"$index\"" +ad_returnredirect "tableindex?table=$table&msg=[_ dbm.reindex_complete]" +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/resetsequence.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resetsequence.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/resetsequence.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + +#dbm.resetsequence#
      + Index: openacs-4/packages/dbm/www/resetsequence.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resetsequence.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/resetsequence.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,17 @@ +ad_page_contract { + Confirm resetting of a sequence +} { + sequence +} + +ad_form -name resetsequence -form { + {sequence:text(hidden) + {mode "display"} + {value $sequence}} +} -on_submit { + set minvalue [db_list get_minvalue "select min_value from $sequence"] + db_1row reset_sequence "select setval('$sequence', $minvalue)" +} -after_submit { + ad_returnredirect "sequenceproperties?sequence=$sequence" + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dbm/www/schemaprivileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemaprivileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemaprivileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/schemaprivileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemaprivileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemaprivileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + Show schema privileges +} { + schema +} + +template::list::create \ + -name priv \ + -multirow priv \ + -key nspacl \ + -actions [list "[_ dbm.alterprivileges]" [export_vars -base alterprivileges2 {schema}] "[_ dbm.alterprivileges]"] \ + -elements { + nspacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/schemaprivileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemaprivileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemaprivileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + postgresql7.1 + + + + select nspacl from pg_namespace where nspname='$schema' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/schemas.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemas.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemas.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/schemas.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemas.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemas.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,22 @@ +template::list::create \ + -name schemas \ + -multirow schemas \ + -key nspname \ + -actions [list "[_ dbm.createschema]" createschema "[_ dbm.createschema]"] \ + -bulk_actions [list "[_ dbm.remove]" "dropschema" "[_ dbm.remove_checked_schemas]"] \ + -elements { + nspname { + label "Schema" + } + usename { + label "[_ dbm.owner]" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } + +db_multirow schemas get_schemas {} \ No newline at end of file Index: openacs-4/packages/dbm/www/schemas.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/schemas.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/schemas.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + + SELECT pn.nspname, pu.usename + FROM pg_catalog.pg_namespace pn LEFT JOIN pg_catalog.pg_user pu ON + (pn.nspowner = pu.usesysid) + WHERE nspname NOT LIKE 'pg_%' + AND nspname NOT IN ('information_schema') + ORDER BY nspname; + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/sequenceprivileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceprivileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceprivileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + + + Index: openacs-4/packages/dbm/www/sequenceprivileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceprivileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceprivileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + Show sequence privileges +} { + sequence +} + +template::list::create \ + -name priv \ + -multirow priv \ + -key relacl \ + -actions [list "[_ dbm.alterprivileges]" [export_vars -base alterprivileges2 {sequence}] "[_ dbm.alterprivileges]"] \ + -elements { + relacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/sequenceprivileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceprivileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceprivileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + postgresql7.1 + + + + select relacl from pg_class where relname='$sequence' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/sequenceproperties.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceproperties.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceproperties.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/sequenceproperties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceproperties.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceproperties.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,23 @@ +ad_page_contract { + Show sequence properties +} { + sequence +} + +db_multirow properties browse_sequence {} + +set elements [db_list_of_lists get_fields {}] +# what we get: rel_id member_state +# what we want: rel_id {label rel_id} member_state {label member_state} + + +foreach element $elements { + set temp "{label $element}" + append output [concat $element "$temp"] " " +} + + +template::list::create \ + -name sequence_properties \ + -multirow properties \ + -elements $output \ No newline at end of file Index: openacs-4/packages/dbm/www/sequenceproperties.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/sequenceproperties.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/sequenceproperties.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,21 @@ + + + postgresql7.1 + + + select * from $sequence + + + + + + SELECT a.attname AS field + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$sequence' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showdomains.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showdomains.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showdomains.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/showdomains.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showdomains.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showdomains.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,59 @@ +ad_page_contract { + +} { + page:optional + orderby:optional +} + +set pagesize [parameter::get -parameter "PageSize"] + +template::list::create \ + -name domains \ + -multirow domains \ + -key typname \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name domains_pagination \ + -actions [list "[_ dbm.createdomain]" createdomain "[_ dbm.createdomain]"] \ + -bulk_actions [list "[_ dbm.remove]" "dropdomain" "[_ dbm.removedomains]"] \ + -elements { + typname { + label "[_ dbm.domain]" + } + format_type { + label "[_ dbm.type]" + } + typnotnull { + label "Not Null" + display_template { + + + + + + + } + } + typdefault { + label "[_ dbm.default]" + } + nspname { + label "Schema" + } + pg_get_userbyid { + label "[_ dbm.owner]" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } -orderby { + typname {orderby typname} + nspname {orderby nspname} + pg_get_userbyid {orderby pg_get_userbyid} + default_value typname, asc + } + +db_multirow domains get_domains {} Index: openacs-4/packages/dbm/www/showdomains.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showdomains.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showdomains.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,34 @@ + + + postgresql7.1 + + + + SELECT t.typname, n.nspname, + t.typnotnull, t.typdefault, + pg_catalog.format_type(t.typbasetype, t.typtypmod), + pg_catalog.pg_get_userbyid(t.typowner) + FROM pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace + WHERE t.typtype = 'd' + AND pg_catalog.pg_type_is_visible(t.oid) + [template::list::orderby_clause -name domains -orderby] + + + + + + SELECT t.typname, n.nspname, + t.typnotnull, t.typdefault, + pg_catalog.format_type(t.typbasetype, t.typtypmod), + pg_catalog.pg_get_userbyid(t.typowner) + FROM pg_catalog.pg_type t + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace + WHERE t.typtype = 'd' + AND pg_catalog.pg_type_is_visible(t.oid) + and [template::list::page_where_clause -name domains] + [template::list::orderby_clause -name domains -orderby] + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showfunctions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showfunctions.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showfunctions.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showfunctions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showfunctions.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showfunctions.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + +} { + page:optional + orderby:optional +} + +set pagesize [parameter::get -parameter "PageSize"] + + +template::list::create \ + -name functions \ + -multirow functions \ + -key proname \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name functions_pagination \ + -actions [list "[_ dbm.createfunction]" createfunction "[_ dbm.createfunction]"] \ + -elements { + proname { + label "[_ dbm.function]" + } + typname { + label "[_ dbm.returns]" + } + oidvectortypes { + label "[_ dbm.arguments]" + display_template { +
      @functions.oidvectortypes;noquote@
      + } + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } -orderby { + proname {orderby proname} + default_value proname,asc + } + +db_multirow functions get_functions {} Index: openacs-4/packages/dbm/www/showfunctions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showfunctions.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showfunctions.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,31 @@ + + + postgresql7.1 + + + + SELECT proname, pt.typname, oidvectortypes(pc.proargtypes), pc.oid + FROM pg_proc pc, pg_user pu, pg_type pt, pg_language pl + WHERE pc.proowner = pu.usesysid AND pc.prorettype = pt.oid AND + pc.prolang = pl.oid AND + pc.oid > (SELECT datlastsysoid from pg_database limit 1) + [template::list::orderby_clause -name functions -orderby] + + + + + + + + SELECT proname, pt.typname, oidvectortypes(pc.proargtypes), pc.oid + + FROM pg_proc pc, pg_user pu, pg_type pt, pg_language pl + WHERE pc.proowner = pu.usesysid AND pc.prorettype = pt.oid AND + pc.prolang = pl.oid AND + pc.oid > (SELECT datlastsysoid from pg_database limit 1) + and [template::list::page_where_clause -name functions] + [template::list::orderby_clause -name functions -orderby] + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showrules.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showrules.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showrules.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/showrules.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showrules.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showrules.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Show rules +} { + table +} + + +db_multirow rules get_rules {} + +template::list::create \ + -name rules \ + -multirow rules \ + -key rulename \ + -actions [list "[_ dbm.createrule]" [export_vars -base createrule {table}] "[_ dbm.createrule]"] \ + -elements { + rulename { + label "Name" + } + definition { + label "Definition" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } \ No newline at end of file Index: openacs-4/packages/dbm/www/showrules.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showrules.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showrules.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,11 @@ + + + postgresql7.1 + + + select rulename, definition from pg_rules + where tablename ='$table' ORDER BY rulename; + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showsequences.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showsequences.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showsequences.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/showsequences.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showsequences.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showsequences.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,46 @@ +ad_page_contract { + +} { + page:optional + orderby:optional +} + +set pagesize [parameter::get -parameter "PageSize"] + +template::list::create \ + -name sequences \ + -multirow sequences \ + -key relname \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name sequences_pagination \ + -actions [list "[_ dbm.createsequence]" createsequence "[_ dbm.createsequence]"] \ + -bulk_actions [list "[_ dbm.remove]" "dropsequence" "[_ dbm.remove_checked_sequences]"] \ + -elements { + relname { + label "[_ dbm.sequence]" + } + nspname { + label "Schema" + } + usename { + label "[_ dbm.owner]" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + + + + } + } + } -orderby { + relname {orderby relname} + nspname {orderby nspname} + usename {orderby usename} + default_value relname,asc + } + + +db_multirow sequences get_sequences {} Index: openacs-4/packages/dbm/www/showsequences.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showsequences.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showsequences.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,40 @@ + + + postgresql7.1 + + + SELECT + c.relname, + n.nspname, + CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN + 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN + 'special' END, u.usename + FROM pg_catalog.pg_class c + LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('S','') + AND n.nspname NOT IN ('pg_catalog', 'pg_toast') + AND pg_catalog.pg_table_is_visible(c.oid) + [template::list::orderby_clause -name sequences -orderby] + + + + + + SELECT + c.relname, + n.nspname, + CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN + 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END, u.usename + FROM pg_catalog.pg_class c + LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('S','') + AND n.nspname NOT IN ('pg_catalog', 'pg_toast') + AND pg_catalog.pg_table_is_visible(c.oid) + and [template::list::page_where_clause -name sequences] + [template::list::orderby_clause -name sequences -orderby] + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/showtables.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showtables.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showtables.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/showtables.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showtables.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showtables.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + +} { + page:optional + orderby:optional +} + +set pagesize [parameter::get -parameter "PageSize"] + +set graphVizP [dbm::graphVizP] + +template::list::create \ + -name tables \ + -pass_properties {graphVizP} \ + -multirow tables \ + -key tablename \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name tables_pagination \ + -actions [list "[_ dbm.createtable]" createtable "[_ dbm.createtable]"] \ + -elements { + tablename { + label "[_ dbm.table]" + } + tableowner { + label "[_ dbm.owner]" + } + schemaname { + label "Schema" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } -orderby { + tablename {orderby tablename} + tableowner {orderby tableowner} + schemaname {orderby schemaname} + default_value tablename,asc + } + + +db_multirow tables get_tablename {} Index: openacs-4/packages/dbm/www/showtables.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/showtables.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/showtables.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,25 @@ + + + postgresql7.1 + + + SELECT tablename, schemaname, + tableowner FROM pg_catalog.pg_tables + WHERE schemaname NOT IN ('pg_catalog', + 'information_schema', 'pg_toast') + [template::list::orderby_clause -name tables -orderby] + + + + + + + SELECT tablename, schemaname, + tableowner FROM pg_catalog.pg_tables + WHERE schemaname NOT IN ('pg_catalog', + 'information_schema', 'pg_toast') + and [template::list::page_where_clause -name tables] + [template::list::orderby_clause -name tables -orderby] + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tableconstraints.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableconstraints.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableconstraints.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,4 @@ + + +
      +@msg@ \ No newline at end of file Index: openacs-4/packages/dbm/www/tableconstraints.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableconstraints.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableconstraints.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,49 @@ +ad_page_contract { + +} { + table + {msg ""} +} + + +template::list::create \ + -name constraints \ + -multirow constraints \ + -key conname \ + -actions [list "[_ dbm.addcheck]" [export_vars -base addtablecheck {table}] "[_ dbm.addcheck]" \ + "[_ dbm.adduniquekey]" [export_vars -base adduniquekey {table}] "[_ dbm.adduniquekey]" \ + "[_ dbm.addprimarykey]" [export_vars -base addprimarykey {table}] "[_ dbm.addprimarykey]" \ + "[_ dbm.addforeignkey]" [export_vars -base addforeignkey {table}] "[_ dbm.addforeignkey]"] \ + -elements { + conname { + label "Name" + } + consrc { + label "Definition" + } + indisclustered { + label "Clustered?" + display_template { + + + + + + + } + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + Cluster || Reindex + + + + + } + } + } + +db_multirow constraints get_constraints {} \ No newline at end of file Index: openacs-4/packages/dbm/www/tableconstraints.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableconstraints.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableconstraints.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,36 @@ + + + postgresql7.1 + + + + SELECT + pc.conname, + pg_catalog.pg_get_constraintdef(pc.oid, true) AS consrc, + pc.contype, + CASE WHEN pc.contype='u' OR pc.contype='p' THEN ( + SELECT + indisclustered + FROM + pg_catalog.pg_depend pd, + pg_catalog.pg_class pl, + pg_catalog.pg_index pi + WHERE + pd.refclassid=pc.tableoid + AND pd.refobjid=pc.oid + AND pd.objid=pl.oid + AND pl.oid=pi.indexrelid + ) ELSE + NULL + END AS indisclustered + FROM + pg_catalog.pg_constraint pc + WHERE + pc.conrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='$table' + AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace + WHERE nspname='public')) + ORDER BY 1 + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tableexport.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableexport.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableexport.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,15 @@ +ad_page_contract { + Export a table +} { + table +} + +set path "/tmp/tableexport" +db_dml export "copy $table to '$path' with delimiter ','" + +set file_inp [open $path r] +set csv [read $file_inp] +close $file_inp +ns_return 200 text/text $csv + +ad_script_abort \ No newline at end of file Index: openacs-4/packages/dbm/www/tableimport.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableimport.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableimport.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tableimport.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableimport.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableimport.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Import a table +} { + table +} + +ad_form -name import -html {enctype multipart/form-data} -form { + {upload_file:file + {label "[_ dbm.filename]"} + {html {size 50}} + } + {table:text(hidden) + {value $table} + } +} -on_submit { + + set filename [template::util::file::get_property filename $upload_file] + set tmp_filename [template::util::file::get_property tmp_filename $upload_file] + + db_dml import "copy $table from '$tmp_filename' with delimiter ','" + ad_returnredirect "showtables" + +} -after_submit { + ad_script_abort +} Index: openacs-4/packages/dbm/www/tableindex.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableindex.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableindex.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,4 @@ + + +
      +@msg@ Index: openacs-4/packages/dbm/www/tableindex.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableindex.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableindex.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,40 @@ +ad_page_contract { + +} { + table + {msg ""} +} + + +template::list::create \ + -name indexes \ + -multirow indexes \ + -key relname \ + -actions [list "[_ dbm.createindex]" [export_vars -base createindex {table}] "[_ dbm.createindex]"] \ + -elements { + relname { + label "Name" + } + pg_get_indexdef { + label "Definition" + } + indisclustered { + label "Clustered?" + display_template { + + + + + + + } + } + mycolumn { + label "[_ dbm.actions]" + display_template { + Cluster || Reindex + } + } + } + +db_multirow indexes get_indexes {} Index: openacs-4/packages/dbm/www/tableindex.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableindex.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableindex.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + + + SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, + pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) + FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index + i + WHERE c.relname = '$table' AND pg_catalog.pg_table_is_visible(c.oid) + AND c.oid = i.indrelid AND i.indexrelid = c2.oid + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tableprivileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableprivileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableprivileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + + + Index: openacs-4/packages/dbm/www/tableprivileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableprivileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableprivileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + Show table privileges +} { + table +} + +template::list::create \ + -name priv \ + -multirow priv \ + -key relacl \ + -actions [list "[_ dbm.alterprivileges]" [export_vars -base alterprivileges2 {table}] "[_ dbm.alterprivileges]"] \ + -elements { + relacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/tableprivileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableprivileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableprivileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + postgresql7.1 + + + + select relacl from pg_class where relname='$table' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tableproperties.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableproperties.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableproperties.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,3 @@ + + + Index: openacs-4/packages/dbm/www/tableproperties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableproperties.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableproperties.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { + Display table properties +} { + table +} + +db_multirow properties get_properties {} + +template::list::create \ + -name table_properties \ + -multirow properties \ + -key field \ + -elements { + field { + label "[_ dbm.field]" + } + type { + label "[_ dbm.type]" + } + not_null { + label "Not Null" + display_template { + + + + + + + } + } + has_default { + label "[_ dbm.default]" + display_template { + + + + + + + } + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + + + + + + } + } + } \ No newline at end of file Index: openacs-4/packages/dbm/www/tableproperties.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tableproperties.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tableproperties.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + +SELECT a.attnum, a.attname AS field, t.typname AS type, + a.attnotnull AS not_null, a.atthasdef as has_default + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/tabletriggers.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tabletriggers.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tabletriggers.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/tabletriggers.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tabletriggers.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tabletriggers.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,26 @@ +ad_page_contract { + +} { + table +} + + + +template::list::create \ + -name triggers \ + -multirow triggers \ + -key tgname \ + -actions [list "[_ dbm.createtrigger]" [export_vars -base createtrigger {table}] "[_ dbm.createtrigger]"] \ + -elements { + tgname { + label "Name" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } + +db_multirow triggers get_triggers {} Index: openacs-4/packages/dbm/www/tabletriggers.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/tabletriggers.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/tabletriggers.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,24 @@ + + + postgresql7.1 + + + +SELECT t.tgname, +p.proname AS tgfname, c.relname, NULL AS tgdef +FROM pg_catalog.pg_trigger t LEFT JOIN pg_catalog.pg_proc p +ON t.tgfoid=p.oid, pg_catalog.pg_class c +WHERE t.tgrelid=c.oid +AND c.relname='$table' +AND c.relnamespace=(SELECT oid FROM pg_catalog.pg_namespace WHERE + nspname='public') +AND (NOT tgisconstraint OR NOT EXISTS +(SELECT 1 FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c +ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) +WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND + c.contype = 'f')) + + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/topbar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/topbar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/topbar.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1 @@ + \ No newline at end of file Index: openacs-4/packages/dbm/www/triggerdefinition.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/triggerdefinition.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/triggerdefinition.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ +Name: @trigger@
      +Definition: @definition@ \ No newline at end of file Index: openacs-4/packages/dbm/www/triggerdefinition.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/triggerdefinition.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/triggerdefinition.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,70 @@ +ad_page_contract { + Show trigger definition +} { + table + trigger + +} + + +set tgisconstraint [db_string get_const "select tgisconstraint from pg_trigger t, pg_class c where t.tgrelid=c.oid and c.relname='$table' and tgname='$trigger'"] +set tgtype [db_string get_type "select tgtype from pg_trigger t, pg_class c where t.tgrelid=c.oid and c.relname='$table' and tgname='$trigger'"] +set tgfname [db_string get_fname "select p.proname from pg_trigger t left join pg_proc p on t.tgfoid=p.oid, pg_class c where t.tgrelid=c.oid and c.relname='$table' and tgname='$trigger'"] +set tgargs [db_string get_args "select t.tgargs from pg_trigger t, pg_class c where t.tgrelid=c.oid and c.relname='$table' and tgname='$trigger'"] + +set TRIGGER_TYPE_ROW [expr 1 << 0] +set TRIGGER_TYPE_BEFORE [expr 1 << 1] +set TRIGGER_TYPE_INSERT [expr 1 << 2] +set TRIGGER_TYPE_DELETE [expr 1 << 3] +set TRIGGER_TYPE_UPDATE [expr 1 << 4] + + +if {$tgisconstraint == "t"} { + set tgisconstraint "CREATE CONSTRAINT TRIGGER" +} else { + set tgisconstraint "CREATE TRIGGER" +} + +set findx 0 + +set expr1 [expr $tgtype & $TRIGGER_TYPE_ROW] +set expr2 [expr $tgtype & $TRIGGER_TYPE_BEFORE] +set expr3 [expr $tgtype & $TRIGGER_TYPE_INSERT] +set expr4 [expr $tgtype & $TRIGGER_TYPE_DELETE] +set expr5 [expr $tgtype & $TRIGGER_TYPE_UPDATE] + +if {$expr2 == $TRIGGER_TYPE_BEFORE} { + set def "BEFORE" +} else { + set def "AFTER" +} + +if {$expr3 == $TRIGGER_TYPE_INSERT} { + set def [concat $def "INSERT"] + set findx [expr $findx + 1] +} + +if {$expr4 == $TRIGGER_TYPE_DELETE} { + if {$findx > 0} { + set def [concat $def "OR DELETE"] + } else { + set def [concat $def "DELETE"] + set findx [expr $findx + 1] + } +} + +if {$expr5 == $TRIGGER_TYPE_UPDATE} { + if {$findx > 0} { + set def [concat $def "OR UPDATE"] + } else { + set def [concat $def "UPDATE"] + } +} +if {$expr1 == $TRIGGER_TYPE_ROW} { + set row "FOR EACH ROW" +} else { + set row "FOR EACH STATEMENT" +} + + +set definition [concat $tgisconstraint $trigger $def "ON" $table $row "EXECUTE PROCEDURE" \"$tgfname\"($tgargs)] \ No newline at end of file Index: openacs-4/packages/dbm/www/vacuum.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/vacuum.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/vacuum.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/dbm/www/vacuum.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/vacuum.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/vacuum.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,26 @@ +ad_form -name vacuum -form { + {analyze:text(checkbox),optional + {label ""} + {options {{"Analyze" 1}}}} + {full:text(checkbox),optional + {label ""} + {options {{"Full" 1}}}} + {freeze:text(checkbox),optional + {label ""} + {options {{"Freeze" 1}}}} + +} -on_submit { + if {$analyze != ""} { + set analyze "ANALYZE" + } + if {$full != ""} { + set full "FULL" + } + if {$freeze != ""} { + set freeze "FREEZE" + } + db_dml vacuum "VACUUM $full $freeze $analyze" +} -after_submit { + ad_returnredirect "admin?msg=[_ dbm.vaccum_complete]" + ad_script_abort +} Index: openacs-4/packages/dbm/www/variables.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/variables.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/variables.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/variables.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/variables.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/variables.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,14 @@ +template::list::create \ + -name info \ + -multirow info \ + -elements { + name { + label "Name" + } + setting { + label "[_ dbm.setting]" + } + } + + +db_multirow info show_all "show all" \ No newline at end of file Index: openacs-4/packages/dbm/www/viewdefinition.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewdefinition.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewdefinition.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,5 @@ + + + + + Index: openacs-4/packages/dbm/www/viewdefinition.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewdefinition.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewdefinition.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,23 @@ +ad_page_contract { + Show view definition +} { + view +} + +db_multirow viewdefinition get_definition "select definition from pg_views where viewname='$view'" { + set definition [dbm::highlight_sql -sql $definition] +} + +template::list::create \ + -name view_definition \ + -multirow viewdefinition \ + -elements { + definition { + label "Definition" + display_template { + @viewdefinition.definition;noquote@ + } + } + } + + \ No newline at end of file Index: openacs-4/packages/dbm/www/viewprivileges.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewprivileges.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewprivileges.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/viewprivileges.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewprivileges.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewprivileges.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + Show view privileges +} { + view +} + +template::list::create \ + -name priv \ + -multirow priv \ + -key relacl \ + -actions [list "[_ dbm.alterprivileges]" [export_vars -base alterprivileges2 {view}] "[_ dbm.alterprivileges]"] \ + -elements { + relacl { + label "[_ dbm.Privileges]" + } + } + +db_multirow priv get_privileges {} \ No newline at end of file Index: openacs-4/packages/dbm/www/viewprivileges.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewprivileges.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewprivileges.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,9 @@ + + postgresql7.1 + + + + select relacl from pg_class where relname='$view' + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/viewproperties.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewproperties.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewproperties.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/viewproperties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewproperties.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewproperties.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,22 @@ +ad_page_contract { + Display view properties +} { + view +} + +db_multirow properties get_properties {} + +template::list::create \ + -name view_properties \ + -multirow properties \ + -elements { + field { + label "[_ dbm.field]" + } + type { + label "[_ dbm.type]" + } + has_default { + label "[_ dbm.default]" + } + } \ No newline at end of file Index: openacs-4/packages/dbm/www/viewproperties.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/viewproperties.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/viewproperties.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,16 @@ + + + postgresql7.1 + + +SELECT a.attnum, a.attname AS field, t.typname AS type, + a.atthasdef as has_default + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$view' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum; + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/views.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/views.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/views.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/dbm/www/views.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/views.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/views.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,44 @@ +ad_page_contract { + +} { + page:optional + orderby:optional +} + + +set pagesize [parameter::get -parameter "PageSize"] + +template::list::create \ + -name views \ + -multirow views \ + -key relname \ + -page_size $pagesize \ + -page_flush_p 0 \ + -page_query_name views_pagination \ + -actions [list "[_ dbm.createview]" createview "[_ dbm.createview]"] \ + -bulk_actions [list "[_ dbm.remove]" "dropview" "[_ dbm.remove_checked_views]"] \ + -elements { + relname { + label "[_ dbm.view]" + } + nspname { + label "Schema" + } + usename { + label "[_ dbm.owner]" + } + mycolumn { + label "[_ dbm.actions]" + display_template { + + } + } + } -orderby { + relname {orderby relname} + nspname {orderby nspname} + usename {orderby usename} + default_value relname,asc + } + + +db_multirow views get_views {} Index: openacs-4/packages/dbm/www/views.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/views.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/views.xql 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,40 @@ + + + postgresql7.1 + + + SELECT c.relname, + n.nspname, + CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN + 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END, + u.usename + FROM pg_catalog.pg_class c + LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('v','') + AND n.nspname NOT IN ('pg_catalog', 'pg_toast') + AND pg_catalog.pg_table_is_visible(c.oid) + [template::list::orderby_clause -name views -orderby] + + + + + + + SELECT c.relname, + n.nspname, + CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN + 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' END, + u.usename + FROM pg_catalog.pg_class c + LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner + LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + WHERE c.relkind IN ('v','') + AND n.nspname NOT IN ('pg_catalog', 'pg_toast') + AND pg_catalog.pg_table_is_visible(c.oid) + AND [template::list::page_where_clause -name views] + [template::list::orderby_clause -name views -orderby] + + + + \ No newline at end of file Index: openacs-4/packages/dbm/www/doc/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/doc/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/doc/index.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,77 @@ + +

      Database Manager

      +Authors: Michael Rieker, Nima Mazloumi + +

      General

      +This package is a port of PhPMyAdmin, PhPPgAdmin and PgAdmin to +OpenACS. Currently only PostgreSQL is supported. All PostgreSQL specific stuff +has been sourced out though we have to say that still the code right now only +will work for PostgreSQL as we use PostgreSQL API. There is some work in the +community going on to write an db abstractional layer that might be used in +future to support several other database management systems. + +

      Installation

      +The package is fully internationalized and will be auto-mounted under /dbm. + +

      Restrictions

      +Please note that due to the AOLServer only the main database pool can be +accessed currently. You are able to create or remove other databases depending +on the permissions the user has under which the AOLServer is running but only +the main database is accessible right now. + +

      Warning

      +Please note that only site-wide admins are permitted to +access it since THIS PACKAGE CAN SEVERELY HARM YOUR +OPENACS INSTALLATION. Be therefore warned and do not use it on a production +sytems and also if you don't know what you are doing. + +

      Features

      +
        +
      • coverage of the most relevant features like management of tables, views, +functions, sequences, domains, databases, schemas, variables, privileges, db +management features, import and exports +
      • full i18n +
      • full list builder support (sorting, pagination) +
      • full form builder support +
      • graphical representation - If you have GraphViz installed. Set the correct path to a GraphViz command +like dot in the parameters. This will enable you to get a graphical +representation of the relationships between the tables and even allows you to navigate. +
      • Also along with this package comes two new templates for form and list +builder. Due to restrictions in acs-templating the templates are copied to +acs-templating when the package is installed and removed later on. While the +forms template is a full rewrite to support div-Tags (XHTML,CSS2) +and allows the vertical and horizontal positioning of form elements within a +given section (new form builder attributes) the lists template basically +provides support for vertical table headers (only for IE). +
      + +

      Future Work

      +Future work will +
        +
      • provide more import and export formats and +
      • allow the management of all databases and not only the main pool defined in the +AOLServer configuration file +
      • provide a SQL Shell +
      + +

      License

      +This work is published under the GPL. +

      + Copyright (C) 2006 Michael Rieker, Nima Mazloumi +

      + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +

      + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +

      + You should have received a link to the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA Index: openacs-4/packages/dbm/www/lib/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/lib/master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/lib/master.adp 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,28 @@ +@doc_type;noquote@ + + + @title;noquote@ + + + + + + + + + @header_stuff;noquote@ + + + @attribute.key@="@attribute.value@"> + + + You must be a site wide admin! + + \ No newline at end of file Index: openacs-4/packages/dbm/www/lib/master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/lib/master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dbm/www/lib/master.tcl 7 Jun 2006 10:43:18 -0000 1.1 @@ -0,0 +1,70 @@ +# master.tcl +# +# Set basic attributes and provide the logical defaults for variables that +# aren't provided by the slave page. +# +# Author: Nima Mazloumi +# Creation Date: 20.04.06 +# + +# fall back on defaults + +set admin_p [acs_user::site_wide_admin_p] + +if { [template::util::is_nil doc_type] } { + set doc_type {} +} + +if { [template::util::is_nil title] } { + set title [ad_conn instance_name] +} + +#AG: Markup in tags doesn't render well. +set title [ns_striphtml $title] + + +if { ![info exists header_stuff] } { + set header_stuff {} +} + + +# Attributes + +multirow create attribute key value + +set onload {} + +# Handle RTE widget, which needs special javascript and css in the page header +global acs_blank_master__htmlareas +if {[info exists acs_blank_master__htmlareas] } { + foreach htmlarea_id [lsort -unique $acs_blank_master__htmlareas] { + lappend onload "acs_rteInit('${htmlarea_id}');" + } +} + +if { ![template::util::is_nil focus] } { + # Handle elements where the name contains a dot + if { [regexp {^([^.]*)\.(.*)$} $focus match form_name element_name] } { + lappend onload "acs_Focus('${form_name}', '${element_name}');" + } +} + +if {![empty_string_p $onload]} { + multirow append attribute onload [join $onload " "] +} + +# Additional Body Attributes + +if {[exists_and_not_null body_attributes]} { + foreach body_attribute $body_attributes { + multirow append attribute [lindex $body_attribute 0] [lindex $body_attribute 1] + } +} else { + set body_attributes "" +} + +# Header links (stylesheets, javascript) +multirow create header_links rel type href media +multirow append header_links "stylesheet" "text/css" "/resources/acs-templating/lists.css" "all" +multirow append header_links "stylesheet" "text/css" "/resources/acs-templating/forms.css" "all" +#multirow append header_links "stylesheet" "text/css" "/resources/acs-subsite/default-master.css" "all" \ No newline at end of file Index: openacs-4/packages/dbm/www/resources/images/Delete16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/Delete16.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/Delete24.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/Delete24.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/Edit16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/Edit16.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/Edit24.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/Edit24.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_addcolumn.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_addcolumn.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_browse.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_browse.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_constraints.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_constraints.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_drop.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_drop.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_empty.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_empty.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_index.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_index.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_info.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_info.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_insrow.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_insrow.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_props.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_props.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_reset.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_reset.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_rules.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_rules.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_tblexport.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_tblexport.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_tblimport.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_tblimport.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_triggers.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_triggers.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/b_view.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/b_view.png,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/checkbox.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/checkbox.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/checkboxchecked.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/checkboxchecked.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/new.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/new.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/radio.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/radio.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/radiochecked.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/radiochecked.gif,v diff -u Binary files differ Index: openacs-4/packages/dbm/www/resources/images/s_rights.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dbm/www/resources/images/s_rights.png,v diff -u Binary files differ