18 require_once SQ_INCLUDE_PATH.
'/asset_attribute.inc';
50 $this->_edit_params[
'type_codes'] = Array();
53 $this->_edit_params[
'type_codes'] = Array();
69 if (!parent::setEditParams($node))
return FALSE;
71 $this->_edit_params[
'type_codes'] = Array();
72 if (isset($node->attributes()->type_codes)) {
73 $codes = explode(
',', (
string)$node->attributes()->type_codes);
74 foreach ($codes as $code_name) {
75 list($code, $flag) = explode(
':', $code_name);
76 $this->_edit_params[
'type_codes'][$code] = $flag;
94 function paint($prefix, $read_only=FALSE)
98 echo translate(
'no_asset_selected');
100 echo get_asset_tag_line($this->value);
105 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
106 asset_finder($prefix, $this->value, $this->_edit_params[
'type_codes']);
121 $type_code_flag = TRUE;
122 if (!isset($_REQUEST[$prefix][
'assetid'])) {
125 $value = $_REQUEST[$prefix][
'assetid'];
127 $type_code_flag = empty($this->_edit_params[
'type_codes']) ? TRUE : FALSE;
128 $value_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($value);
129 foreach ($this->_edit_params[
'type_codes'] as $type_accepted => $inheritance) {
130 if ($value_asset instanceof $type_accepted) {
131 $type_code_flag = TRUE;
137 if (!$type_code_flag) {
138 $this->processed = FALSE;
139 return $type_code_flag;
141 if ($this->value != $value && $this->
setValue($value)) {
142 $this->processed = TRUE;
144 $this->processed = FALSE;
161 $error_msg = translate(
'fail_setting_assetid', $this->name, $this->
id);
162 if (!assert_valid_assetid($value, $error_msg, TRUE, FALSE)) {
165 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($value);
166 if (is_null($asset))
return FALSE;