| |
89 |
89 |
|
| |
90 |
90 |
package_instantiate_object \ |
| |
91 |
91 |
-var_list [list [list context_id $package_id]] \ |
| |
92 |
92 |
-form_id add-edit \ |
| |
93 |
93 |
template_demo_note |
| |
94 |
94 |
|
| |
95 |
95 |
} -edit_data { |
| |
96 |
96 |
|
| |
97 |
97 |
# Currently we need to update our object manually ... |
| |
98 |
98 |
|
| |
99 |
99 |
set modifying_user [ad_conn user_id] |
| |
100 |
100 |
set modifying_ip [ad_conn peeraddr] |
| |
101 |
101 |
|
| |
102 |
102 |
db_transaction { |
| |
103 |
103 |
db_dml object_update {} |
| |
104 |
104 |
db_dml template_demo_note_update {} |
| |
105 |
105 |
} |
| |
106 |
106 |
|
| |
107 |
107 |
} -after_submit { |
| |
108 |
108 |
|
| |
109 |
|
# We've successfully processed the submission, send the user back to the index page. |
| |
|
109 |
# We've successfully processed the submission. |
| |
|
110 |
# Clear the pagination cache. |
| |
110 |
111 |
|
| |
|
112 |
cache flush notes* |
| |
|
113 |
|
| |
|
114 |
# send the user back to the index page |
| |
|
115 |
|
| |
111 |
116 |
ad_returnredirect "./" |
| |
112 |
117 |
|
| |
|
118 |
# NOTE! guess what, we wouldn't be done here; there is a problem: |
| |
|
119 |
# notice that when you add a note when you have filters active, |
| |
|
120 |
# it doesn't remember your filters when you come back from editing. |
| |
|
121 |
# |
| |
|
122 |
# we've decided this is beyond the scope of this tutorial and you |
| |
|
123 |
# can learn more by studying the function export_vars (which would |
| |
|
124 |
# be applied to the filter variables) |
| |
|
125 |
|
| |
113 |
126 |
# ad_returnredirect returns after redirecting the user, so abort the script rather |
| |
114 |
127 |
# than fall through to the display code. Failure to abort the script will burden |
| |
115 |
128 |
# your server with needless template processing, though the user won't notice due to |
| |
116 |
129 |
# having been redirected. |
| |
117 |
130 |
|
| |
118 |
131 |
ad_script_abort |
| |
119 |
132 |
|
| |
120 |
133 |
} |
| |
121 |
134 |
|
| |
122 |
135 |
# The following is only executed if we did not process a valid submission, in other |
| |
123 |
136 |
# words on the initial "new" or "edit" form request or after a submission which |
| |
124 |
137 |
# contained errors. Add the page title to the breadcrumb context bar. |
| |
125 |
138 |
|
| |
126 |
139 |
set context [list $page_title] |
| |
127 |
140 |
|
| |
128 |
141 |
# Display the form, blank if we're processing a "new" request, filled with data if we're |
| |
129 |
142 |
# processing an "edit" request or a submitted form that contains errors. |
| |
130 |
143 |
|
| |
131 |
144 |
ad_return_template |