18 require_once SQ_PACKAGES_PATH.
'/cms/listing_engine/listing_engine_edit_fns.inc';
41 parent::__construct();
58 $search_page_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'',
false,
'search_page');
59 $write_access = $asset->writeAccess(
'links');
63 if (!empty($search_page_link)) {
64 echo get_asset_tag_line($search_page_link[
'minorid']);
66 echo translate(
'sch_no_search_page_specified');
70 asset_finder($prefix.
'_search_page', (!empty($search_page_link)) ? $search_page_link[
'minorid'] :
'', Array(
'search_page' =>
'I'));
90 if (!isset($_POST[$prefix.
'_search_page'][
'assetid'])) {
94 $new_search_page = $_POST[$prefix.
'_search_page'][
'assetid'];
97 $search_page_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'',
false,
'search_page');
100 if (!empty($search_page_link) && $search_page_link[
'minorid'] == $new_search_page) {
106 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
107 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
110 if (!empty($search_page_link) && !$GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($search_page_link[
'linkid'])) {
112 }
else if ($new_search_page) {
113 $search_page = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($new_search_page);
114 if (!is_null($search_page)) {
115 if (!$asset->createLink($search_page, SQ_LINK_NOTICE,
'search_page')) {
117 trigger_localised_error(
'SCH0011', E_USER_WARNING, $search_page->name, $search_page->id);
123 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
125 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
128 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
147 $search_page_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'',
false,
'search_page');
148 if (!empty($search_page_link)) {
149 $search_page = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($search_page_link[
'minorid']);
152 if (is_null($search_page)) {
153 echo translate(
'sch_list_page_before_field');
157 if ($asset->writeAccess(
'attributes')) {
158 $fields = $search_page->attr(
'fields');
161 foreach ($fields as $field_name => $field) {
166 foreach($field[
'data_sources'] as $data_source) {
167 if (($data_source[
'type'] ==
'include_all') || ($data_source[
'type'] ==
'exclude')) {
174 $options[$field_name] = $field[
'name'];
178 $options = array_merge(Array(
'' => translate(
'none')), $options);
179 combo_box($prefix.
'_field_name', $options,
false, $asset->attr(
'search_field'));
182 echo $asset->attr(
'search_field');
201 if (!isset($_POST[$prefix.
'_field_name'])) {
205 return $asset->setAttrValue(
'search_field', $_POST[$prefix.
'_field_name']);