17 require_once SQ_SYSTEM_ROOT.
'/core/assets/system/tool/tool.inc';
44 parent::__construct($assetid);
60 $tool_info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
61 $o->openSection($tool_info[
'name']);
62 $o->openField(translate(
'file_root_node'));
64 'physical_file' =>
'I',
65 'physical_folder' =>
'I',
68 asset_finder($type_code.
'_importing_root_assetid',
'', $root_nodes);
69 $o->note(translate(
'file_root_node_note'));
71 $o->openField(translate(
'file_parent_node'));
72 asset_finder($type_code.
'_importing_parent_assetid',
'');
74 $o->openField(translate(
'file_recursive'));
75 check_box($type_code.
'_recursive',
'1');
76 $o->note(translate(
'file_recursive_note'));
78 $o->openField(translate(
'file_index_file'));
79 check_box($type_code.
'_index_file',
'1');
80 $o->note(translate(
'file_index_file_note'));
102 if (isset($_REQUEST[$type_code.
'_importing_root_assetid'][
'assetid'])) {
103 $importr = $_REQUEST[$type_code.
'_importing_root_assetid'][
'assetid'];
106 if (isset($_REQUEST[$type_code.
'_importing_parent_assetid'][
'assetid'])) {
107 $importp = $_REQUEST[$type_code.
'_importing_parent_assetid'][
'assetid'];
110 $recursive = (array_get_index($_REQUEST, $type_code.
'_recursive', FALSE)) ? TRUE : FALSE;
111 $index_file = (array_get_index($_REQUEST, $type_code.
'_index_file', FALSE)) ? TRUE : FALSE;
113 $sanity_check = TRUE;
114 $allowable_root_nodes = Array(
'physical_file',
'physical_folder',
'file_bridge');
115 $root_node = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($importr);
116 if (is_null($root_node) || !in_array(strtolower($root_node->type()), $allowable_root_nodes)) {
117 $sanity_check = FALSE;
118 if (!is_null($root_node)) {
119 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($root_node, TRUE);
123 if (!empty($importr) && !empty($importp) && $sanity_check) {
125 'root_assetid' => Array($importr),
126 'parent_assetid' => $importp,
127 'recursive' => $recursive,
128 'index_file' => $index_file,
131 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
132 $hh->queueHipo(
'hipo_job_import_file', $vars,
'', SQ_PACKAGES_PATH.
'/filesystem/hipo_jobs');
133 $url = $hh->runQueuedJobs();
134 if (!empty($url)) $o->setRedirect($url);
138 if (empty($importr) && $sanity_check) {
139 trigger_localised_error(
'FIL0001', E_USER_ERROR);
141 trigger_localised_error(
'FIL0003', E_USER_ERROR);