18 require_once SQ_PACKAGES_PATH.
'/cms/page_templates/page_asset_listing/page_asset_listing_edit_fns.inc';
19 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
43 parent::__construct();
62 $relator_asset_ids = $asset->getStaticRelators();
63 sort($relator_asset_ids);
65 if ($asset->writeAccess(
'links')) {
66 multiple_asset_finder($prefix.
'_relator_nodes', $relator_asset_ids);
68 $infos = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($relator_asset_ids);
69 ?><ul style=
"margin: 1px 15px;"><?php
70 foreach ($infos as $assetid => $info) {
71 echo
'<li>'.get_asset_tag_line($assetid).
'</li>';
92 if (!isset($_POST[$prefix.
'_relator_nodes'])) {
95 $new_relator_nodes = $_POST[$prefix.
'_relator_nodes'];
96 foreach ($new_relator_nodes as $new_relator_node) {
97 $new_relator_node_ids[] = $new_relator_node[
'assetid'];
101 $relator_asset_ids = $asset->getStaticRelators();
103 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
104 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
107 foreach ($relator_asset_ids as $relator_asset_id) {
108 if (!in_array($relator_asset_id, $new_relator_node_ids)) {
109 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($asset->id, $relator_asset_id, SQ_LINK_NOTICE,
'relator', $side_of_link=
'major');
110 if (!$GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($link[
'linkid'])) {
111 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
112 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
119 foreach ($new_relator_nodes as $index => $node) {
121 if (isset($relator_asset_ids[$node[
'assetid']])) {
125 if (!empty($node[
'assetid'])) {
126 $new_relator = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($node[
'assetid']);
127 if (!$asset->createLink($new_relator, SQ_LINK_NOTICE,
'relator')) {
128 trigger_localised_error(
'CMS0016', E_USER_WARNING, $new_relator->name, $new_relator->id);
129 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
130 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
137 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
138 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
156 return $this->
paintNoticeLinkedAsset($asset,
'thesaurus_filter', Array(
'thesaurus' =>
'D'), $prefix.
'thesaurus_filters', TRUE);
173 if ($asset->writeAccess(
'links')) {