/[cvs]/nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/FlexibleNegotiation.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/FlexibleNegotiation.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Apr 11 00:59:10 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.1: +6 -3 lines
minor update regarding function rename

1 <?
2 /**
3 * This file contains the FlexibleNegotiation child class.
4 * It inherits from another patch to phpHtmlLib: the EditDataItem class.
5 *
6 * @package org.netfrag.patches
7 * @name FlexibleNegotiation
8 *
9 */
10
11 /**
12 * Cvs-Log
13 *
14 * $Id: FlexibleNegotiation.php,v 1.1 2003/04/11 00:40:31 joko Exp $
15 *
16 * $Log: FlexibleNegotiation.php,v $
17 * Revision 1.1 2003/04/11 00:40:31 joko
18 * initial commit
19 *
20 *
21 */
22
23 /**
24 * FlexibleNegotiation
25 *
26 * Encapsulate arbitrary actions into flexible negotiations.
27 *
28 *
29 * @package org.netfrag.patches
30 * @subpackage phphtmllib/widgets
31 * @name FlexibleNegotiation
32 *
33 */
34 class FlexibleNegotiation extends EditDataItem {
35
36 var $_negotiation_options;
37
38 /**
39 * The constructor of the FlexibleNegotiation is used to advance
40 * the workflow to "Confirm" automagically.
41 *
42 * We just have to flag this behavior here, phpHtmlLib
43 * already handles almost everything smoothly.
44 *
45 */
46 function FlexibleNegotiation($title, $options = array(), $negotiation_options = array()) {
47
48 $this->_negotiation_options = $negotiation_options;
49
50 // change phpHtmlLib default behavior to change
51 // entrypoint of form- approve-/confirm-workflow
52 // TODO: integrate into negotiation options!?
53 $_POST[FORM_VISITED] = 1;
54 //$_POST[FORM_CONFIRM] = 1;
55
56 // call constructor of base class
57 $this->EditDataItem($title, $options);
58 //$this->StandardFormContent($title, $PHP_SELF, 600);
59
60 // debug
61 //print "options: " . Dumper($this->_options);
62 }
63
64
65 /**
66 * This function is used to build the standard
67 * buttons for a form.
68 * Overwritten from EditDataItem.
69 *
70 * @return ButtonPanel DIVtag object
71 */
72 function form_content_buttons() {
73 //print Dumper($this->_options);
74 $div = new DIVtag(
75 array(
76 "style" => "background-color: #eeeeee;" . "padding-top:5px;padding-bottom:5px",
77 "align"=>"center",
78 "nowrap"
79 ),
80 //form_submit('ecdfc', "Back")
81 link::plain( url::viewdatanode($this->_options[data_locator_meta][nodename]), 'Back' )
82 //'abc'
83 );
84 return $div;
85 }
86
87
88
89
90 /**
91 * This should display a generic confirmation page.
92 *
93 * @return mixed - either raw html, or some container HTMLTag object.
94 *
95 */
96 function form_confirm( ) {
97
98 $this->add_hidden_element('ecmod', 'delete');
99 $this->add_hidden_element('ecdid', $this->_options[data_locator_meta][ident]);
100 $this->add_hidden_element('ecdm', $this->_options[data_locator_meta][nodename]);
101
102 $title = "Form Confirmation / " . $this->_options['caption'];
103 $title .="( ".$this->_required_field_marker." ".$this->_required_field_text." )";
104 $table = new InfoTable($title, $this->_width);
105
106 $this->build_confirm_table( $table );
107
108 //now add the confirmation button
109 $td = new TDtag(array("colspan" => 2,
110 "class" => "contentnovertical",
111 "align" => "center"),
112 form_submit('ecdfd', "Confirm"),
113 _HTML_SPACE,
114 //$this->add_action("Edit")
115 form_submit('ecdfc', "Cancel")
116 );
117
118 if ($this->_cancel_action) {
119 $td->add(_HTML_SPACE, $this->add_cancel());
120 }
121
122 $table->add_row( $td );
123
124 return $table;
125 }
126
127
128 /**
129 * This should execute the confirmed action and indicate success or failure.
130 *
131 * @todo error status & message propagation (e.g. logging)
132 * @todo advanced exception handling
133 * @todo actions might be synchronous and/or asynchronous (mixed)!?
134 * @todo what about triggers? before-action, after-action, etc.
135 * would solve some stuff, but would make other stuff more complicated
136 *
137 * @return bool
138 *
139 */
140 function confirm_action() {
141
142 // If user confirms action, issue delete request on current item.
143 $this->_options['data_locator_meta']['action'] = "delete";
144 $error = $this->data_prefetch();
145
146 $this->_datasource = null;
147
148 $msg = "Action confirmed! Changes may take a while to propagate through all parts of the system.";
149 $this->set_action_message($msg);
150
151 /*
152 $this->_options['data_locator_meta']['action'] = "read";
153 $error = $this->data_prefetch();
154 */
155
156 // TODO: review - what about the status of the action if executed
157 // asynchronous? try to implement something to monitor state here!?
158 return TRUE;
159 }
160
161
162 }
163
164 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed