17 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
18 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_action/trigger_action.inc';
55 public static function execute($settings, &$state)
58 if (empty($settings[
'file_path']) || !file_exists($settings[
'file_path'])) {
65 if (empty($settings[
'append'])) {
68 $append = $settings[
'append'];
72 if (empty($state[
'asset'])) {
74 if (empty($state[
'assetid'])) {
77 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
81 if (is_null($state[
'asset']))
return FALSE;
83 $asset =& $state[
'asset'];
86 if (is_readable($settings[
'file_path'])) {
89 if (!copy_file($settings[
'file_path'], $asset->getXmlFilePath())) {
90 trigger_localised_error(
'CORE0235', E_USER_WARNING, $info[
'tmp_name'], $asset->getXmlFilePath());
95 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
96 $running_vars = Array(
97 'thesaurus_id' => $asset->id,
99 'file_path' => $settings[
'file_path'],
101 $errors = $hh->freestyleHipo(
'hipo_job_import_thesaurus_xml', $running_vars);
104 'assetid' => $state[
'asset']->
id,
120 public static function getInterface($settings, $prefix, $write_access=FALSE)
122 $file_path = array_get_index($settings,
'file_path',
'');
123 $append = array_get_index($settings,
'append', FALSE);
129 <td valign=
"top"><b><?php echo
'Path to XML File'; ?></b></td>
130 <td valign=
"top" style=
"padding-bottom: 10px;"><?php
133 echo text_box($prefix.
'[file_path]', $file_path,
'50');
135 echo check_box($prefix.
'[append]',
'1', $append).
'Append?';
137 echo $file_path.
' ';
138 echo htmlspecialchars(
'(Append option is'.($append ?
' ' :
' not ').
'selected)');
146 return ob_get_clean();
164 $file_path = array_get_index($request_data,
'file_path',
'');
165 $file_path = trim($file_path);
166 if ($file_path ==
'') {
167 return 'file path is not specified.';
169 $settings[
'file_path'] = $file_path;
171 $append = array_get_index($request_data,
'append', FALSE);
172 $settings[
'append'] = $append;
188 public static function getLocks($settings, &$state)
191 $state[
'assetid'] => Array(