18 require_once SQ_CORE_PACKAGE_PATH.
'/designs/design_area/design_area_edit_fns.inc';
41 parent::__construct();
62 foreach ($contents as $index => $element) {
63 if ($element[
'_type'] !=
'TAG')
continue;
65 if (
'asset' == $element[
'operation']) {
66 if (empty($element[
'contents'])) {
70 if (!$asset->
setAttrValue(
'asset_contents', $element[
'contents'])) {
74 $contents[$index] = Array(
76 'attributes' => Array (),
77 'operation' =>
'asset',
78 'self_terminating' => 1,
84 $GLOBALS[
'SQ_PROCESSED_DESIGN_AREAS'][$asset->
attr(
'id_name')] = TRUE;
106 $asset_types = $asset->
attr(
'asset_types');
107 $action_column = $write_access && count($asset_types);
109 $types = $GLOBALS[
'SQ_SYSTEM']->am->getAssetTypes(TRUE);
111 $print_types[
''] =
'-- Add New Type --';
113 foreach ($types as $code => $details) {
114 $type_name = $details[
'name'];
116 if (isset($asset_types[$code])) {
117 $present_types[$code] = $type_name;
119 $print_types[$code] = $type_name;
124 $req_type_count = count($asset->request_types);
126 <table class="sq-backend-table">
128 <th rowspan="2" style="vertical-align:bottom">Asset Type:</th>
129 <th colspan="'.$req_type_count.
'">What to do with request parameters?</th>';
131 if ($action_column) {
132 echo
'<th rowspan="2" style="vertical-align:bottom; background-color: #ccc;">Delete?</th>';
138 foreach ($asset->request_types as $name) {
139 echo
'<th>'.$name.
'</th>';
146 foreach ($asset_types as $type => $query_req) {
147 $type_prefix = $prefix.
'[types]['.$type.
']';
149 $row_class = $even ?
'class="alt"' :
'';
152 echo
'<tr '.$row_class.
'><td>';
153 echo get_asset_type_icon($type).$present_types[$type].
'</td>';
154 foreach ($asset->request_types as $req_type => $req_name) {
157 radio_button($type_prefix.
'[req_type]', $req_type, $req_type==$query_req);
159 if ($req_type==$query_req) {
160 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/tick.gif" alt="'.$req_name.
'" />';
168 if ($action_column) {
170 check_box($type_prefix.
'[delete]');
179 echo
'<tr class="alt"><td>';
180 echo combo_box($prefix.
'[new][type_code]', $print_types, FALSE,
'');
184 $new_radio_prefix = $prefix.
'[new][require_query]';
186 foreach ($asset->request_types as $req_type => $name) {
188 radio_button($new_radio_prefix, $req_type, $selected);
192 if ($action_column) echo
'<td> </td>';
196 if (empty($asset_types) && !$write_access) {
197 echo
'<tr><td colspan="'.($req_type_count+1).
'" style="color: red">No asset types have been chosen</td></tr>';
202 return $write_access;
219 $request_info = array_get_index($_REQUEST, $prefix, Array());
221 if (empty($request_info))
return TRUE;
223 $asset_types = $asset->
attr(
'asset_types');
226 $new_type = array_get_index($request_info,
'new');
227 if (!empty($new_type) && !empty($new_type[
'type_code'])) {
228 $updated_types[$new_type[
'type_code']] = $new_type[
'require_query'];
232 $existing_types = array_get_index($request_info,
'types');
233 if (!empty($existing_types) && is_array($existing_types)) {
234 foreach ($existing_types as $type => $params) {
235 if (!isset($params[
'delete']) && isset($asset_types[$type])) {
236 $updated_types[$type] = $params[
'req_type'];
261 multiple_asset_finder($prefix.
'exclude_assets', $asset->
attr(
'exclude_assets'), Array());
264 $asset_ids = $asset->
attr(
'exclude_assets');
265 $asset_names = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($asset_ids, Array(), TRUE,
'name');
266 foreach ($asset_names as $id => $name) {
267 echo get_asset_tag_line($id);
287 if (isset($_POST[$prefix.
'exclude_assets'])) {
288 $asset_ids = Array();
289 foreach ( $_POST[$prefix.
'exclude_assets'] as $asset_info ) {
290 if (!empty($asset_info[
'assetid'])) {
291 $asset_ids[] = $asset_info[
'assetid'];
294 return ($asset->
setAttrValue(
'exclude_assets',$asset_ids));
314 $types = $asset->
attr(
'add_history_asset_types');
317 $display_values = Array(
'type_code' => Array(),
'inherit' => Array());
318 foreach ($types as $type => $inherit) {
319 $display_values[
'type_code'][] = $type;
320 $display_values[
'inherit'][] = $inherit;
322 asset_type_chooser($prefix.
'_button_types', TRUE, $display_values, NULL, TRUE, TRUE);
327 echo
'<p class="sq-backend-warning">'.translate(
'no_asset_types_selected').
'</p>';
329 $type_names = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo(array_keys($types),
'name');
331 <table
class=
"sq-backend-table">
333 <th><?php echo translate(
'type') ?></th>
334 <th><?php echo translate(
'inherit_question') ?></th>
337 $inherit_image_path = sq_web_path(
'lib').
'/web/images/';
338 foreach ($types as $type => $inherit) {
339 $inherit_image = $inherit_image_path.($inherit ?
'tick' :
'cross').
'.gif';
340 $inherit_alt = $inherit ? translate(
'yes') : translate(
'no');
344 echo get_asset_type_icon($type);
345 echo $type_names[$type];
347 <td><img src=
"<?php echo $inherit_image; ?>" alt=
"<?php echo $inherit_alt; ?>" /></td>
373 if (isset($_POST[$prefix.
'_button_types'])) {
374 $existing_types = $asset->
attr(
'add_history_asset_types');
375 $submitted_types = Array();
376 foreach ($_POST[$prefix.
'_button_types'][
'type_code'] as $i => $type_code) {
377 if (!empty($type_code)) {
378 $submitted_types[$type_code] = $_POST[$prefix.
'_button_types'][
'inherit'][$i];
382 $asset->
setAttrValue(
'add_history_asset_types', $submitted_types);
402 return !$asset->
attr(
'add_history_button_image');
418 return !$asset->
attr(
'remove_history_button_image');
434 return $asset->
attr(
'remove_history_button_image');
450 return $asset->
attr(
'add_history_button_image');