18 require_once SQ_CORE_PACKAGE_PATH.
'/folder/folder_edit_fns.inc';
42 unset($this->static_screens[
'dependants']);
43 unset($this->static_screens[
'preview']);
60 $site_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'site', FALSE,
'primary_site');
61 $write_access = $asset->writeAccess(
'links');
65 if (!empty($site_link)) {
66 $site_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($site_link[
'minorid']);
68 if (!is_null($site_asset)) {
69 echo $asset->getPrimaryURL();
70 echo
'<br/ ><i>'.strtolower(translate(
'from')).
' '.get_asset_tag_line($site_asset->id).
'</i>';
72 echo translate(
'core_primary_url_not_set');
75 asset_finder($prefix.
'_primary_site', (!empty($site_link)) ? $site_link[
'minorid'] :
'', Array(
'site' =>
'D'));
95 if (empty($_POST[$prefix.
'_primary_site'][
'assetid'])) {
98 $new_site = $_POST[$prefix.
'_primary_site'][
'assetid'];
100 $site_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'site', FALSE,
'primary_site');
103 if (!empty($site_link) && $site_link[
'minorid'] == $new_site) {
108 $network_link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($asset->id, $new_site, SQ_SC_LINK_SIGNIFICANT);
109 if (empty($network_link)) {
110 trigger_localised_error(
'CORE0122', E_USER_WARNING);
115 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
116 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
119 if (!empty($site_link) && !$GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($site_link[
'linkid'])) {
121 }
else if ($new_site) {
122 $site = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($new_site);
123 if (!is_null($site)) {
124 if (!$asset->createLink($site, SQ_LINK_NOTICE,
'primary_site')) {
126 trigger_localised_error(
'CORE0028', E_USER_WARNING, $site->name, $site->id);
132 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
134 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
138 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();