17 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
18 require_once SQ_CORE_PACKAGE_PATH.
'/data_source/data_source/data_source_edit_fns.inc';
41 parent::__construct();
58 if (isset($asset->vars[
'root_object'][
'value'])) {
59 echo
'<pre>' . $asset->vars[
'root_object'][
'value'] .
'</pre>';
80 foreach ($nodes as $node) {
142 $connector_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'', FALSE,
'json_data_source');
143 if (empty($connector_link)) {
144 $connector_asset_id = NULL;
146 $connector_asset_id = $connector_link[
'minorid'];
149 if ($asset->writeAccess(
'links')) {
150 asset_finder($prefix.
'_connector_node', $connector_asset_id, Array(
151 'page_rest_resource' =>
'D',
152 'page_standard' =>
'I',
153 'page_asset_listing' =>
'I',
154 'search_page' =>
'I',
161 if (empty($connector_asset_id)) {
162 echo
'No source asset selected.';
164 echo get_asset_tag_line($connector_asset_id);
183 $new_connector_id = @$_REQUEST[$prefix.
'_connector_node'][
'assetid'];
185 if (!$asset->writeAccess(
'links')) {
186 trigger_error(
'You do not have write access to change the JSON source link', E_USER_WARNING);
190 $current_connector_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'', FALSE,
'json_data_source');
191 $current_connector_asset_id = @$current_connector_link[
'minorid'];
193 if (!empty($current_connector_link)) {
196 if ((!empty($new_connector_id)) && ($current_connector_asset_id === $new_connector_id)) {
201 $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($current_connector_link[
'linkid']);
205 if (empty($new_connector_id))
return TRUE;
209 if (!empty($new_connector_id)) {
210 $new_connector_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($new_connector_id);
211 $result_id = $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($asset, $new_connector_asset, SQ_LINK_NOTICE,
'json_data_source');
213 if (empty($result_id)) {
214 trigger_error(
'Could not link asset as JSON source asset', E_USER_WARNING);