Index: openacs-4/packages/acs-subsite/www/admin/applications/application-add.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/application-add.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/application-add.adp 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/application-add.adp 18 Sep 2003 20:58:18 -0000 1.3
@@ -1,6 +1,6 @@
@page_title@
@context@
- application.package_key
+ @focus;noquote@
Index: openacs-4/packages/acs-subsite/www/admin/applications/application-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/application-add.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/application-add.tcl 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/application-add.tcl 18 Sep 2003 20:58:18 -0000 1.3
@@ -4,18 +4,28 @@
@author Lars Pind (lars@collaboraid.biz)
@creation-date 2003-05-28
@cvs-id $Id$
+} {
+ node_id:integer,optional
}
set page_title "New Application"
set context [list [list "." "Applications"] $page_title]
set packages [db_list_of_lists package_types {}]
+if { [ad_form_new_p -key node_id] } {
+ set focus application.package_key
+} else {
+ set focus application.instance_name
+}
+
ad_form -name application -cancel_url . -form {
+ {node_id:key}
{package_key:text(select)
{label "Application"}
{options $packages}
{help_text "The type of application you want to add."}
+ {mode {[ad_decode [ad_form_new_p -key node_id] 1 "" "display"]}}
}
{instance_name:text,optional
{label "Application name"}
@@ -26,15 +36,21 @@
{label "URL folder name"}
{help_text "This should be a short string, all lowercase, with hyphens instead of spaces, whicn will be used in the URL of the new application. If you leave this blank, we will generate one for you from name of the application."}
{html {size 30}}
- {validate {
- empty_or_not_exists
- {expr \[empty_string_p \$value\] || \[catch { site_node::get_from_url -url "[ad_conn package_url]\$value/" -exact }\]}
- {This folder name is already used.}
- }}
}
+} -edit_request {
+ array set node [site_node::get -node_id $node_id]
+ set package_key $node(package_key)
+ set instance_name $node(instance_name)
+ set folder $node(name)
} -on_submit {
- # Get the node ID of this subsite
- set node_id [ad_conn node_id]
+ if { ![empty_string_p $folder] } {
+ set existing_node(node_id) {}
+ set errno [catch { array set existing_node [site_node::get_from_url -exact -url "[ad_conn package_url]$folder"] }]
+ if { ([ad_form_new_p -key node_id] && !$errno) || (![ad_form_new_p -key node_id] && !$errno && $existing_node(node_id) != $node_id)} {
+ form set_error application folder "This folder name is already used"
+ break
+ }
+ }
if { [empty_string_p $instance_name] } {
# Find the package pretty name from the list of packages
@@ -53,23 +69,35 @@
# Autogenerate folder name
if { [empty_string_p $folder] } {
+ set parent_node_id [ad_conn node_id]
set existing_urls [db_list existing_urls {}]
set folder [util_text_to_url \
-existing_urls $existing_urls \
-text $instance_name]
}
-
+} -new_data {
if { [catch {
site_node::instantiate_and_mount \
- -parent_node_id $node_id \
+ -parent_node_id [ad_conn node_id] \
-node_name $folder \
-package_name $instance_name \
-package_key $package_key
} errsmg] } {
ad_return_error "Problem Creating Application" "We had a problem creating the application."
}
+} -edit_data {
+ # this is where we would rename ...
+
+ array set node [site_node::get -node_id $node_id]
+ set package_id $node(object_id)
+ db_transaction {
+ apm_package_rename -package_id $node(package_id) -instance_name $instance_name
+
+ site_node::rename -node_id $node_id -name $folder
+ }
+} -after_submit {
ad_returnredirect .
ad_script_abort
}
Index: openacs-4/packages/acs-subsite/www/admin/applications/application-add.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/Attic/application-add.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/application-add.xql 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/application-add.xql 18 Sep 2003 20:58:18 -0000 1.3
@@ -6,7 +6,7 @@
select name
from site_nodes
- where parent_id = :node_id
+ where parent_id = :parent_node_id
Index: openacs-4/packages/acs-subsite/www/admin/applications/application-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/application-delete.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-subsite/www/admin/applications/application-delete.adp 18 Sep 2003 20:58:54 -0000 1.1
@@ -0,0 +1,11 @@
+
+ @page_title@
+ @context@
+
+
+ Are you sure you want to delete this applicationthese @num@ applications?
+
+
+
+ Delete - Cancel, do not delete
+
Index: openacs-4/packages/acs-subsite/www/admin/applications/application-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/application-delete.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/application-delete.tcl 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/application-delete.tcl 18 Sep 2003 20:58:18 -0000 1.3
@@ -6,11 +6,25 @@
@cvs-id $Id$
} {
node_id:integer,multiple
+ {confirm_p 0}
}
-# TODO:
-# Add some kind of confirmation
+if { !$confirm_p } {
+ set num [llength $node_id]
+ if { $num == 0 } {
+ ad_returnredirect .
+ return
+ }
+
+ set page_title "Delete [ad_decode $num 1 "Application" "Applications"]"
+ set context [list [list "." "Applications"] $page_title]
+ set yes_url [export_vars -base [ad_conn url] { node_id:multiple { confirm_p 1 } }]
+ set no_url "."
+
+ return
+}
+
db_transaction {
foreach id $node_id {
set package_id [site_node::get_object_id -node_id $id]
@@ -26,6 +40,7 @@
}
}
-
+
ad_returnredirect .
+
Index: openacs-4/packages/acs-subsite/www/admin/applications/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/index.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/index.adp 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/index.adp 18 Sep 2003 20:58:18 -0000 1.3
@@ -8,14 +8,3 @@
TODO: Edit application name and path.
-
- TODO: Deactivate application (hide it from navbar, but don't delete it).
-
-
-
- TODO: Control the ordering of applications.
-
-
-
- TODO: Confirmation before nuking an application.
-
Index: openacs-4/packages/acs-subsite/www/admin/applications/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/applications/index.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/www/admin/applications/index.tcl 28 Aug 2003 09:41:40 -0000 1.2
+++ openacs-4/packages/acs-subsite/www/admin/applications/index.tcl 18 Sep 2003 20:58:18 -0000 1.3
@@ -39,6 +39,14 @@
"Delete" application-delete "Delete selected applications"
} \
-elements {
+ edit {
+ sub_class narrow
+ display_template {
+
+ }
+ link_url_eval {[export_vars -base application-add { node_id }]}
+ link_html { title "Edit application name and path" }
+ }
instance_name {
label "Name"
link_url_eval {../../$name/}
@@ -49,6 +57,14 @@
package_pretty_name {
label "Application"
}
+ delete {
+ sub_class narrow
+ display_template {
+
+ }
+ link_url_eval {[export_vars -base application-delete { node_id }]}
+ link_html { title "Delete this application" }
+ }
}