Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
import_tools_manager_edit_fns.inc
1 <?php
17 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
18 require_once SQ_DATA_PATH.'/private/conf/import_tools_manager.inc';
19 
33 {
34 
35 
42  {
43  $this->Asset_Edit_Fns();
44  unset($this->static_screens['settings']);
45  unset($this->static_screens['preview']);
46  unset($this->static_screens['lookupValues']);
47  unset($this->static_screens['metadata']);
48  unset($this->static_screens['metadataSchemas']);
49  unset($this->static_screens['workflow']);
50  unset($this->static_screens['tagging']);
51  unset($this->static_screens['dependants']);
52  unset($this->static_screens['linking']);
53  unset($this->static_screens['roles']);
54  unset($this->static_screens['permissions']);
55  unset($this->static_screens['layouts']);
56 
57  }//end constructor
58 
59 
60 
71  function paintStructuredFileImportDirectory(&$asset, &$o, $prefix)
72  {
73  echo STRUCTURED_FILE_IMPORT_DIR;
74  }
75 
76 
87  function paintHeadings(&$asset, &$o, $prefix)
88  {
89  $write_access = $asset->writeAccess('attributes');
90  $heading_defaults = $asset->attr('heading_defaults');
91  $o->openField('Heading Selection Defaults');
92  // Images for showing boolean values, when there is no
93  $tick = '<img src="'.sq_web_path('lib').'/web/images/tick.gif" alt="Yes" style="position: relative; right: 0px;"/>';
94  $cross = '<img src="'.sq_web_path('lib').'/web/images/cross.gif" alt="Yes" />';
95  ?>
96  <table class="sq-backend-table" style="width: 300px;">
97  <tr>
98  <th class="sq-backend-table-header">Heading Style</th>
99  <th class="sq-backend-table-header" style="width: 120px;">Use for structure?</th>
100  </tr>
101  <?php
102  for ($i = 1; $i <= 6; $i++) {
103  $h_string = 'h'.strval($i);
104  ?>
105  <tr>
106  <td class="sq-backend-table-cell"><?php echo strtoupper($h_string); ?></td>
107  <td class="sq-backend-table-cell" style="text-align: center;">
108  <?php
109  if ($write_access) {
110  check_box($prefix.'_headings['.$h_string.']', '1', in_array($h_string, $heading_defaults));
111  } else {
112  echo (in_array($h_string, $heading_defaults)) ? $tick : $cross;
113  }
114  ?>
115  </td>
116  </tr>
117  <?php
118  }
119  ?>
120  </table>
121  <?php
122  $o->closeField();
123 
124  }//end paintHeadings()
125 
126 
137  function processHeadings(&$asset, &$o, $prefix)
138  {
139  if ($asset->writeAccess('attributes')) {
140  $keys = array_keys($_POST[$prefix.'_headings']);
141  $asset->setAttrValue('heading_defaults', $keys);
142  }
143 
144  }//end processHeadings()
145 
146 
157  function paintHtmlUpload(&$asset, &$o, $prefix)
158  {
159  $write_access = $asset->writeAccess('attributes');
160  $o->openField(translate('import_tools_new_html_file_select'));
161  if ($write_access) {
162  file_upload('structured_file_import_html_upload', $extras='');
163  echo '&nbsp;&nbsp;&nbsp;&nbsp;';
164  check_box('structured_file_import_html_upload_overwrite');
165  label(translate('import_tools_overwrite_existing'), 'structured_file_import_html_upload_overwrite');
166  }
167  $o->closeField();
168 
169  }//end paintHtmlUpload()
170 
171 
182  function processHtmlUpload(&$asset, &$o, $prefix)
183  {
184  $write_access = $asset->writeAccess('attributes');
185  if ($write_access) {
186  $html_upload = get_file_upload_info('structured_file_import_html_upload');
187  $max_size = $asset->attr('max_file_size');
188  if ($html_upload === FALSE) {
189  trigger_error('Error Uploading HTML File', E_USER_WARNING);
190  } else {
191  if (!empty($html_upload)) {
192  $import_dir = STRUCTURED_FILE_IMPORT_DIR;
193  $compatible_types = $asset->attr('valid_file_types');
194  $overwrite = isset($_POST['structured_file_import_html_upload_overwrite']);
195  commit_file_upload('structured_file_import_html_upload', $import_dir, $overwrite, $max_size, TRUE, $compatible_types);
196  }
197  }
198  }
199 
200  }//end processHtmlUpload()
201 
202 
213  function paintBulkFileImport(&$asset, &$o, $prefix)
214  {
215  $write_access = $asset->writeAccess('attributes');
216  $allowed_import_type = $asset->attr('allowed_import_type');
217 
218 
219  if ($write_access) {
220  $o->openField(translate('import_tools_manager_allowed_import_type'));
221  combo_box($prefix.'_allowed_import_type', Array('Server and Local' => 'Server and Local', 'Server Only' => 'Server Only', 'Local Only' => 'Local Only'), FALSE, $allowed_import_type, 0);
222  $o->closeField();
223 
224  $o->openField(translate('import_tools_manager_server_import_dir'));
225  echo BULK_FILE_IMPORT_DIR;
226  $o->note(translate('import_tools_manager_server_import_dir_msg'));
227  $o->closeField();
228 
229  } else {
230  $o->openField(translate('import_tools_manager_allowed_import_type'));
231  echo $allowed_import_type;
232  $o->closeField();
233 
234  $o->openField(translate('import_tools_manager_server_import_dir'));
235  echo BULK_FILE_IMPORT_DIR;
236  $o->note(translate('import_tools_manager_server_import_dir_msg'));
237  $o->closeField();
238  }
239 
240  return $write_access;
241 
242  }//end paintBulkFileImport()
243 
244 
255  function processBulkFileImport(&$asset, &$o, $prefix)
256  {
257  $write_access = $asset->writeAccess('attributes');
258  if ($write_access) {
259  $allowed_import_type = array_get_index($_POST, $prefix.'_allowed_import_type', '');
260 
261  $asset->setAttrValue('allowed_import_type', $allowed_import_type);
262  }
263 
264  return $write_access;
265 
266  }//end processBulkFileImport()
267 
268 
279  function paintCMSFileExport(&$asset, &$o, $prefix)
280  {
281  $write_access = $asset->writeAccess('attributes');
282  $server_export_dir = $asset->attr('cms_file_export_dir');
283  $server_export_name = $asset->attr('cms_file_export_name');
284 
285  if ($write_access) {
286  $o->openField(translate('import_tools_manager_server_export_name'));
287  text_box($prefix.'_server_export_filename', $server_export_name, '50', '', FALSE);
288  $o->note(translate('import_tools_manager_server_export_name_msg'));
289  $o->closeField();
290 
291  $o->openField(translate('import_tools_manager_server_export_dir'));
292  text_box($prefix.'_server_export_directory', $server_export_dir, '50', '', FALSE);
293  $o->note(translate('import_tools_manager_server_export_dir_msg'));
294  $o->closeField();
295  } else {
296  $o->openField(translate('import_tools_manager_server_export_name'));
297  echo $server_export_name;
298  $o->note(translate('import_tools_manager_server_export_name_msg'));
299  $o->closeField();
300 
301  $o->openField(translate('import_tools_manager_server_export_dir'));
302  echo $server_export_dir;
303  $o->note(translate('import_tools_manager_server_export_dir_msg'));
304  $o->closeField();
305  }//end if
306 
307  return $write_access;
308 
309  }//end paintCMSFileExport()
310 
311 
322  function processCMSFileExport(&$asset, &$o, $prefix)
323  {
324  $write_access = $asset->writeAccess('attributes');
325  if ($write_access) {
326  $server_export_dir = array_get_index($_POST, $prefix.'_server_export_directory', '');
327  $server_export_name = array_get_index($_POST, $prefix.'_server_export_filename', '');
328 
329  $asset->setAttrValue('cms_file_export_dir', $server_export_dir);
330  $asset->setAttrValue('cms_file_export_name', $server_export_name);
331  }
332 
333  return $write_access;
334 
335  }//end processCMSFileExport()
336 
337 
338 }//end class
339 ?>