41 |
} |
} |
42 |
|
|
43 |
function form_init_elements() { |
function form_init_elements() { |
44 |
|
|
45 |
//we want a confirmation page for this form. |
//we want a confirmation page for this form. |
46 |
global $app; |
global $app; |
47 |
|
|
49 |
|
|
50 |
// add hidden element for page control |
// add hidden element for page control |
51 |
$this->add_hidden_element( 't', 'News' ); |
$this->add_hidden_element( 't', 'News' ); |
52 |
$this->add_hidden_element( 'subtopic', $_REQUEST['subtopic'] ); |
$this->add_hidden_element( 'sub_lang', $_REQUEST['sub_lang'] ); |
53 |
|
|
54 |
$this->add_element( new FEText("Titel", true, 10, 20)); |
$this->add_element( new FEText("Titel", true, 50, 255)); |
55 |
$this->add_element( new FETextArea("kurzer Text", true, 10, 20)); |
$this->add_element( new FETextArea("kurzer Text", true, 10, 50, 50)); |
56 |
$this->add_element( new FETextArea("langer Text", true, 10, 20)); |
$this->add_element( new FETextArea("langer Text", true, 10, 50, 50)); |
57 |
$this->add_element( new FEText("Quelle", true, 10, 20)); |
$this->add_element( new FEText("Quelle", true, 50, 255)); |
58 |
|
|
59 |
$handle=opendir ($app->getConfig("path.news.img.archive")); |
$handle=opendir ($app->getConfig("path.news.img.archive")); |
60 |
$myFileList= array(); |
$myFileList= array(); |
63 |
} |
} |
64 |
closedir($handle); |
closedir($handle); |
65 |
|
|
66 |
$this->add_element( new FEListBox("Bilderarchiv", FALSE,"200px", "80px",$myFileList)); |
$this->add_element( new FEListBox("Bilderarchiv", FALSE,"300px", "150px",$myFileList)); |
67 |
|
|
68 |
} |
} |
69 |
function form_init_data() { |
function form_init_data() { |
71 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
72 |
if ($value['lcountrykey'] == $this->_language) { |
if ($value['lcountrykey'] == $this->_language) { |
73 |
if ($value['lkey'] == $this->_sql_key_long) { |
if ($value['lkey'] == $this->_sql_key_long) { |
74 |
$this->set_element_value("langer Text", $value['lvalue']); |
$this->set_element_value("langer Text", $value['lvalue']); |
75 |
} |
} |
76 |
if ($value['lkey'] == $this->_sql_key_short) { |
if ($value['lkey'] == $this->_sql_key_short) { |
77 |
$this->set_element_value("kurzer Text", $value['lvalue']); |
$this->set_element_value("kurzer Text", $value['lvalue']); |
132 |
} |
} |
133 |
} |
} |
134 |
} |
} |
|
|
|
135 |
|
|
136 |
|
|
137 |
// write new data to datasource in $data as array (keep old indices, set new values) |
// write new data to datasource in $data as array (keep old indices, set new values) |
140 |
// TODO: 'data_prefetch()' will never return ANYTHING! |
// TODO: 'data_prefetch()' will never return ANYTHING! |
141 |
// Implement some error-handling there or somewhere. |
// Implement some error-handling there or somewhere. |
142 |
$error = $this->data_prefetch(); |
$error = $this->data_prefetch(); |
143 |
|
|
|
//$error = $this->_datasource->set($item); |
|
|
/* if(!$error) { |
|
|
// fetch fresh data |
|
|
$this->_options['data_locator_meta']['action'] = "read"; |
|
|
// unset previous initialed 'data' var |
|
|
$this->_options['data_locator_meta']['data'] = NULL; |
|
|
$this->data_prefetch(); |
|
|
|
|
|
$this->set_action_message($this->_confirm_msg); |
|
|
return TRUE; |
|
|
} else { |
|
|
return FALSE; |
|
|
}*/ |
|
|
global $app; |
|
144 |
|
|
145 |
// This contains the image-file that has to be moved from the archive-dir to the online-dir. |
// This contains the image-file that has to be moved from the archive-dir to the online-dir. |
146 |
// The name of the file has to be changed to the name which is hardcoded in the news-templates. |
// The name of the file has to be changed to the name which is hardcoded in the news-templates. |
148 |
// Make sure that this will be removed also, so that there is only one file matching in the online-dir. |
// Make sure that this will be removed also, so that there is only one file matching in the online-dir. |
149 |
|
|
150 |
// prepare to copy selected file from archive-dir to online-dir |
// prepare to copy selected file from archive-dir to online-dir |
151 |
|
global $app; |
152 |
|
|
153 |
if ($this->get_element_value("Bilderarchiv")) { |
if ($this->get_element_value("Bilderarchiv")) { |
154 |
$_dest_file_suffix = substr($this->get_element_value("Bilderarchiv"), count($this->get_element_value("Bilderarchiv")) - 4, 4); |
$_dest_file_suffix = substr($this->get_element_value("Bilderarchiv"), count($this->get_element_value("Bilderarchiv")) - 4, 4); |
160 |
$handle=opendir ($app->getConfig("path.news.img.online") . $this->_language. "/"); |
$handle=opendir ($app->getConfig("path.news.img.online") . $this->_language. "/"); |
161 |
|
|
162 |
while ($myFile = readdir ($handle)) { |
while ($myFile = readdir ($handle)) { |
163 |
if (substr($myFile, 9, 1) == $this->_whichNews){unlink($app->getConfig("path.news.img.online") . "de/" . $myFile);} |
if (substr($myFile, 9, 1) == $this->_whichNews){unlink($app->getConfig("path.news.img.online") . $this->_language . "/" . $myFile);} |
164 |
} |
} |
165 |
closedir($handle); |
closedir($handle); |
166 |
|
|
167 |
copy($_source_file_name, $_dest_file_name); |
copy($_source_file_name, $_dest_file_name); |
168 |
} |
} |
|
|
|
|
} |
|
|
function form_confirm( ) { |
|
|
$title = "Form Confirmation / " . $this->_options['caption']; |
|
|
$title .="( ".$this->_required_field_marker." ".$this->_required_field_text." )"; |
|
|
$table = new InfoTable($title, $this->_width); |
|
|
|
|
|
$this->build_confirm_table( $table ); |
|
|
|
|
|
//now add the confirmation button |
|
|
$td = new TDtag(array("colspan" => 2, |
|
|
"class" => "contentnovertical", |
|
|
"align" => "center"), |
|
|
form_submit('ecdfe', "Confirm"), |
|
|
_HTML_SPACE, |
|
|
$this->add_action("Edit")); |
|
169 |
|
|
170 |
if ($this->_cancel_action) { |
if(!$error) { |
171 |
$td->add(_HTML_SPACE, $this->add_cancel()); |
// fetch fresh data |
172 |
|
$this->_options['data_locator_meta']['action'] = "read"; |
173 |
|
// unset previous initialed 'data' var |
174 |
|
$this->_options['data_locator_meta']['data'] = NULL; |
175 |
|
$this->data_prefetch(); |
176 |
|
|
177 |
|
$this->set_action_message($this->_confirm_msg); |
178 |
|
return TRUE; |
179 |
|
} else { |
180 |
|
return FALSE; |
181 |
} |
} |
182 |
|
|
|
$table->add_row( $td ); |
|
|
|
|
|
return $table; |
|
183 |
} |
} |
184 |
function form_backend_validation() { |
function form_backend_validation() { |
185 |
|
|
186 |
$this->set_action("Confirm"); |
$this->set_action("Confirm"); |
|
|
|
|
$this->add_error("Titel", "Duplicate!! You suck!"); |
|
187 |
return true; |
return true; |
188 |
} |
} |
189 |
|
|