18 require_once SQ_CORE_PACKAGE_PATH.
'/files/file/file_edit_fns.inc';
38 parent::__construct();
55 if (SQ_ROLLBACK_VIEW) {
57 $fv = $GLOBALS[
'SQ_SYSTEM']->getFileVersioning();
58 $rep_file = $asset->data_path_suffix.
'/'.$asset->name;
59 $then = iso8601_ts($_SESSION[
'sq_rollback_view'][
'rollback_time']);
60 $info = @$fv->_checkOutCheck($rep_file, NULL, $then);
61 $parse_file = $info[
'source_file'];
63 $success = $fv->output($rep_file, NULL, $then);
64 $str = ob_get_clean();
65 if (!$success)
return FALSE;
67 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
68 $parse_file = $asset->data_path.
'/'.$asset->name;
69 $str = file_to_string($parse_file);
72 if ($asset->writeAccess(
'attributes')) {
73 text_area($prefix.
'_new_file', $str, 0, 0, 0,
'style="font-family: \'Courier New\', Courier, monospace; white-space: pre-wrap; width: 99%; height: 480px"');
76 echo
'<pre>', htmlspecialchars($str),
'</pre>';
95 if (!$asset->writeAccess(
'attributes'))
return FALSE;
96 if (isset($_POST[$prefix.
'_new_file'])) {
99 $str = str_replace(
"\r\n",
"\n", $_POST[$prefix.
'_new_file']);
101 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
106 'name' => $asset->name,
107 'tmp_name' => $asset->data_path.
'/'.$asset->name.
'.new',
108 'non_uploaded_file' => TRUE,
111 if (!string_to_file($str, $file_info[
'tmp_name'])) {
116 unlink($file_info[
'tmp_name']);
138 $xsl = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'xsl_file', TRUE,
'transform');
139 $assetid = array_get_index($xsl,
'minorid', 0);
140 if (!class_exists(
'XSLTProcessor')) {
141 trigger_localised_error(
'XSL0001', E_USER_WARNING);
143 if ($asset->writeAccess(
'links')) {
144 echo asset_finder($prefix.
'_transform_xsl', $assetid, Array(
'xsl_file'=>
'I'));
146 if (empty($assetid)) {
147 echo
'No XSL file selected';
149 $xsl_file = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
150 if (!is_null($xsl_file)) {
153 echo
'No XSL File selected';
177 if (!$asset->writeAccess(
'links'))
return $status;
179 $current = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'xsl_file', TRUE,
'transform');
180 $selected = array_get_index($_POST, $prefix.
'_transform_xsl', Array());
181 $xsl_assetid = array_get_index($selected,
'assetid', 0);
184 if (!empty($xsl_assetid)) {
185 $minor = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($xsl_assetid);
186 if (is_null($minor) || $minor->type() !=
'xsl_file') {
192 if (!empty($current)) {
193 $current_id = array_get_index($current,
'minorid', 0);
194 $current_linkid = array_get_index($current,
'linkid', 0);
195 if ($current_id != $xsl_assetid) {
197 $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($current_linkid);
198 if (!is_null($minor)) {
199 $status = $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($asset, $minor, SQ_LINK_NOTICE,
'transform');
204 if (!is_null($minor)) {
205 $status = $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($asset, $minor, SQ_LINK_NOTICE,
'transform');