summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-04-30 08:21:42 +0000
committerthomascube <thomas@roundcube.net>2008-04-30 08:21:42 +0000
commit197601ef5fa2e6aaabfb6e0baaf56179f7cc1ee3 (patch)
tree464b77acd299fa37a753e384b5bc14bda0cd16fa /program/steps/addressbook
parent0dfae004d84f428f1af1884282d24c32d6fc3173 (diff)
Next step: introduce the application class 'rcmail' and get rid of some global vars
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/edit.inc15
-rw-r--r--program/steps/addressbook/save.inc6
2 files changed, 10 insertions, 11 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index e3218a35e..64eab86eb 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -33,10 +33,10 @@ if ($CONTACTS->readonly)
function rcmail_contact_editform($attrib)
{
- global $CONTACTS, $OUTPUT;
+ global $RCMAIL, $CONTACTS, $OUTPUT;
// check if we have a valid result
- if ($GLOBALS['_action'] != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first())))
+ if ($RCMAIL->action != 'add' && !(($result = $CONTACTS->get_result()) && ($record = $result->first())))
{
$OUTPUT->show_message('contactnotfound');
return false;
@@ -83,20 +83,19 @@ $OUTPUT->add_handler('contacteditform', 'rcmail_contact_editform');
// similar function as in /steps/settings/edit_identity.inc
function get_form_tags($attrib)
{
- global $CONTACTS, $OUTPUT, $EDIT_FORM, $SESS_HIDDEN_FIELD;
+ global $CONTACTS, $EDIT_FORM, $RCMAIL;
$result = $CONTACTS->get_result();
$form_start = '';
if (!strlen($EDIT_FORM))
{
- $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
+ $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task));
$hiddenfields->add(array('name' => '_action', 'value' => 'save', 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
if (($result = $CONTACTS->get_result()) && ($record = $result->first()))
$hiddenfields->add(array('name' => '_cid', 'value' => $record['ID']));
- $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : '';
- $form_start .= "\n$SESS_HIDDEN_FIELD\n";
+ $form_start = !strlen($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : '';
$form_start .= $hiddenfields->show();
}
@@ -104,11 +103,11 @@ function get_form_tags($attrib)
$form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
if (!strlen($EDIT_FORM))
- $OUTPUT->add_gui_object('editform', $form_name);
+ $RCMAIL->output->add_gui_object('editform', $form_name);
$EDIT_FORM = $form_name;
- return array($form_start, $form_end);
+ return array($form_start, $form_end);
}
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index c16d4729f..94a0d587d 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -28,7 +28,7 @@ if ($CONTACTS->readonly)
}
// check input
-if ((!get_input_value('_name', RCUBE_INPUT_POST) || !get_input_value('_email', RCUBE_INPUT_POST)) && $_framed)
+if ((!get_input_value('_name', RCUBE_INPUT_POST) || !get_input_value('_email', RCUBE_INPUT_POST)) && $OUTPUT->action)
{
$OUTPUT->show_message('formincomplete', 'warning');
rcmail_overwrite_action(empty($_POST['_cid']) ? 'add' : 'show');
@@ -54,7 +54,7 @@ if (!empty($cid))
{
if ($CONTACTS->update($cid, $a_record))
{
- if ($_framed)
+ if ($OUTPUT->action)
{
// define list of cols to be displayed
$a_js_cols = array();
@@ -96,7 +96,7 @@ else
// insert record and send response
if ($insert_id = $CONTACTS->insert($a_record))
{
- if ($_framed)
+ if ($OUTPUT->action)
{
// add contact row or jump to the page where it should appear
$CONTACTS->reset();