/** * @param string $ps_bundle_name * @param string $ps_placement_code * @param array $pa_bundle_settings * @param array $pa_options Supported options are: * config * viewPath * graphicsPath * request */ public function getBundleFormHTML($ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options, &$ps_bundle_label = null) { global $g_ui_locale; $vb_batch = isset($pa_options['batch']) && $pa_options['batch'] ? true : false; // Check if user has access to this bundle if ($pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_NONE__) { return; } $vb_read_only_because_deaccessioned = $this->hasField('is_deaccessioned') && (bool) $this->getAppConfig()->get('deaccession_dont_allow_editing') && (bool) $this->get('is_deaccessioned'); if ($vb_read_only_because_deaccessioned && $ps_bundle_name != 'ca_objects_deaccession') { $pa_bundle_settings['readonly'] = true; } // Check if user has access to this type // The type id is not set for batch edits so skip this check for those. if (!$vb_batch && (bool) $this->getAppConfig()->get('perform_type_access_checking')) { $vn_type_access = $pa_options['request']->user->getTypeAccessLevel($this->tableName(), $this->getTypeID()); if ($vn_type_access == __CA_BUNDLE_ACCESS_NONE__) { return; } if ($vn_type_access == __CA_BUNDLE_ACCESS_READONLY__) { $pa_bundle_settings['readonly'] = true; } } // Check if user has access to this source if ((bool) $this->getAppConfig()->get('perform_source_access_checking')) { $vn_source_access = $pa_options['request']->user->getSourceAccessLevel($this->tableName(), $this->getSourceID()); if ($vn_source_access == __CA_BUNDLE_ACCESS_NONE__) { return; } if ($vn_source_access == __CA_BUNDLE_ACCESS_READONLY__) { $pa_bundle_settings['readonly'] = true; } } if ((bool) $this->getAppConfig()->get('perform_item_level_access_checking') && $this->getPrimaryKey()) { $vn_item_access = $this->checkACLAccessForUser($pa_options['request']->user); if ($vn_item_access == __CA_ACL_NO_ACCESS__) { return; } if ($vn_item_access == __CA_ACL_READONLY_ACCESS__) { $pa_bundle_settings['readonly'] = true; } } $va_info = $this->getBundleInfo($ps_bundle_name); if (!($vs_type = $va_info['type'])) { return null; } if (isset($pa_options['config']) && is_object($pa_options['config'])) { $o_config = $pa_options['config']; } else { $o_config = $this->getAppConfig(); } if (!($vs_required_marker = $o_config->get('required_field_marker'))) { $vs_required_marker = '[' . _t('REQUIRED') . ']'; } $vs_label = $vs_label_text = null; $ps_bundle_name_proc = str_replace("ca_attribute_", "", $ps_bundle_name); $va_violations = null; if (($va_dictionary_entry = ca_metadata_dictionary_entries::getEntry($ps_bundle_name_proc, $pa_bundle_settings)) || ($va_dictionary_entry = ca_metadata_dictionary_entries::getEntry($this->tableName() . '.' . $ps_bundle_name_proc, $pa_bundle_settings))) { $pa_bundle_settings['definition'][$g_ui_locale] = $va_dictionary_entry['settings']['definition']; if ($va_dictionary_entry['settings']['mandatory']) { $pa_bundle_settings['definition'][$g_ui_locale] = $this->getAppConfig()->get('required_field_marker') . $pa_bundle_settings['definition'][$g_ui_locale]; } $va_violations = $this->getMetadataDictionaryRuleViolations($ps_bundle_name); if (is_array($va_violations) && sizeof($va_violations)) { $va_violation_text = array(); foreach ($va_violations as $va_violation) { $va_violation_text[] = "<li class='caMetadataDictionaryViolation'><span class='caMetadataDictionaryViolation" . ucfirst(strtolower($va_violation['level'])) . "'>" . $va_violation['levelDisplay'] . '</span>: ' . $va_violation['violationMessage'] . "</li>"; } $pa_bundle_settings['definition'][$g_ui_locale] = "<div class='caMetadataDictionaryViolationsList'><div class='caMetadataDictionaryViolationsListHeading'>" . _t('These problems require attention:') . "</div><ol>" . join("\n", $va_violation_text) . "</ol></div>\n" . $pa_bundle_settings['definition'][$g_ui_locale] . "<br style='clear: both;'/>"; } if (!caGetOption($g_ui_locale, $pa_bundle_settings['description'], null)) { $pa_bundle_settings['description'][$g_ui_locale] = $va_dictionary_entry['settings']['definition']; } } // is label for this bundle forced in bundle settings? if (isset($pa_bundle_settings['label']) && isset($pa_bundle_settings['label'][$g_ui_locale]) && $pa_bundle_settings['label'][$g_ui_locale]) { $vs_label = $vs_label_text = $pa_bundle_settings['label'][$g_ui_locale]; } // Set bundle level documentation URL $vs_documentation_url = trim(isset($pa_bundle_settings['documentation_url']) && $pa_bundle_settings['documentation_url'] ? $pa_bundle_settings['documentation_url'] : ''); $vs_element = ''; $va_errors = array(); switch ($vs_type) { # ------------------------------------------------- case 'preferred_label': case 'nonpreferred_label': if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name)) && sizeof($va_error_objects)) { $vs_display_format = $o_config->get('bundle_element_error_display_format'); foreach ($va_error_objects as $o_e) { $va_errors[] = $o_e->getErrorDescription(); } } else { $vs_display_format = $o_config->get('bundle_element_display_format'); } $pa_options['dontCache'] = true; // we *don't* want to cache labels here $vs_element = $vs_type === 'preferred_label' ? $this->getPreferredLabelHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options) : $this->getNonPreferredLabelHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); $vs_field_id = "ca_{$vs_type}_" . $pa_options['formName'] . "_{$ps_placement_code}"; if (!$vs_label_text) { $vs_label_text = $va_info['label']; } $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span>'; if ($vs_type == 'preferred_label' && $o_config->get('show_required_field_marker') && $o_config->get('require_preferred_label_for_' . $this->tableName())) { $vs_label .= ' ' . $vs_required_marker; } $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) ? $pa_bundle_settings['description'][$g_ui_locale] : null; if ($vs_label && $vs_description) { TooltipManager::add('#' . $vs_field_id, "<h3>{$vs_label_text}</h3>{$vs_description}"); } break; # ------------------------------------------------- # ------------------------------------------------- case 'intrinsic': if (isset($pa_bundle_settings['label'][$g_ui_locale]) && $pa_bundle_settings['label'][$g_ui_locale]) { $pa_options['label'] = $pa_bundle_settings['label'][$g_ui_locale]; } if (!$pa_options['label']) { $pa_options['label'] = $this->getFieldInfo($ps_bundle_name, 'LABEL'); } $vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $pa_options['request']->getViewsDirectoryPath(); $o_view = new View($pa_options['request'], "{$vs_view_path}/bundles/"); $va_lookup_url_info = caJSONLookupServiceUrl($pa_options['request'], $this->tableName()); if ($this->getFieldInfo($ps_bundle_name, 'IDENTITY')) { $o_view->setVar('form_element', ($vn_id = (int) $this->get($ps_bundle_name)) ? $vn_id : "<" . _t('Not yet issued') . ">"); } else { $vb_read_only = $pa_bundle_settings['readonly'] || $pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_READONLY__ ? true : false; $va_additional_field_options = array(); if ($vn_width = caGetOption('width', $pa_bundle_settings)) { $va_additional_field_options['width'] = $vn_width; } if ($vn_height = caGetOption('height', $pa_bundle_settings)) { $va_additional_field_options['height'] = $vn_height; } $o_view->setVar('form_element', $this->htmlFormElement($ps_bundle_name, $this->getProperty('ID_NUMBERING_ID_FIELD') == $ps_bundle_name ? $o_config->get('idno_element_display_format_without_label') : $o_config->get('bundle_element_display_format_without_label'), array_merge(array('readonly' => $vb_read_only, 'error_icon' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/warning_small.gif", 'progress_indicator' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif", 'lookup_url' => $va_lookup_url_info['intrinsic'], 'name' => $ps_placement_code . $pa_options['formName'] . $ps_bundle_name), $pa_options, $va_additional_field_options))); } $o_view->setVar('errors', $pa_options['request']->getActionErrors($ps_bundle_name)); if (method_exists($this, "getDefaultMediaPreviewVersion")) { $o_view->setVar('display_media', $this->getMediaTag($ps_bundle_name, $this->getDefaultMediaPreviewVersion($ps_bundle_name))); } $vs_field_id = 'ca_intrinsic_' . $pa_options['formName'] . '_' . $ps_placement_code; $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $pa_options['label'] . '</span>'; if ($o_config->get('show_required_field_marker')) { if ($this->getFieldInfo($ps_bundle_name, 'FIELD_TYPE') == FT_TEXT && is_array($va_bounds = $this->getFieldInfo($ps_bundle_name, 'BOUNDS_LENGTH')) && $va_bounds[0] > 0) { $vs_label .= ' ' . $vs_required_marker; } else { if (in_array($this->getFieldInfo($ps_bundle_name, 'FIELD_TYPE'), array(FT_NUMBER, FT_HISTORIC_DATERANGE, FT_DATERANGE)) && !$this->getFieldInfo($ps_bundle_name, 'IS_NULL')) { $vs_label .= ' ' . $vs_required_marker; } } } // Set access inheritance default if ((bool) $this->getAppConfig()->get($this->tableName() . '_allow_access_inheritance') && $this->hasField('access_inherit_from_parent') && !$this->getPrimaryKey()) { $this->set('access_inherit_from_parent', (bool) $this->getAppConfig()->get($this->tableName() . '_access_inheritance_default') ? 1 : 0); } $o_view->setVar('bundle_name', $ps_bundle_name); $o_view->setVar('id_prefix', $pa_options['formName']); $o_view->setVar('placement_code', $ps_placement_code); $o_view->setVar('settings', $pa_bundle_settings); $o_view->setVar('t_instance', $this); $o_view->setVar('batch', (bool) (isset($pa_options['batch']) && $pa_options['batch'])); $vs_element = $o_view->render('intrinsic.php', true); $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : $this->getFieldInfo($ps_bundle_name, 'DESCRIPTION'); if ($pa_options['label'] && $vs_description) { TooltipManager::add('#' . $vs_field_id, "<h3>" . $pa_options['label'] . "</h3>{$vs_description}"); } if (isset($pa_bundle_settings['forACLAccessScreen']) && $pa_bundle_settings['forACLAccessScreen']) { $vs_display_format = '^ELEMENT'; } else { $vs_display_format = $o_config->get('bundle_element_display_format'); } break; # ------------------------------------------------- # ------------------------------------------------- case 'attribute': // bundle names for attributes are simply element codes prefixed with 'ca_attribute_' // since getAttributeHTMLFormBundle() takes a straight element code we have to strip the prefix here $vs_attr_element_code = str_replace('ca_attribute_', '', $ps_bundle_name); $vs_display_format = $o_config->get('bundle_element_display_format'); $vs_element = $this->getAttributeHTMLFormBundle($pa_options['request'], $pa_options['formName'], $vs_attr_element_code, $ps_placement_code, $pa_bundle_settings, $pa_options); $vs_field_id = 'ca_attribute_' . $pa_options['formName'] . '_' . $vs_attr_element_code; if (!$vs_label_text) { $vs_label_text = $this->getAttributeLabel($vs_attr_element_code); } if ($vb_batch) { $t_element = $this->_getElementInstance($vs_attr_element_code); $va_type_restrictions = $t_element->getTypeRestrictionsForDisplay($this->tableNum()); if (sizeof($va_type_restrictions)) { $vs_restriction_list = join("; ", $va_type_restrictions); $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span> <span class="formLabelSubtext" id="subtext_' . $vs_field_id . '">(' . caTruncateStringWithEllipsis($vs_restriction_list, 75) . ')</span>'; TooltipManager::add("#subtext_{$vs_field_id}", "<h3>" . _t("Restricted to types") . "</h3>" . join("<br/>", $va_type_restrictions)); } else { $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span>'; } } else { $vs_label = '<span class="formLabelText" id="' . $vs_field_id . '">' . $vs_label_text . '</span>'; } // fall back to element description if applicable $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : $this->getAttributeDescription($vs_attr_element_code); $vs_documentation_url = trim(isset($pa_bundle_settings['documentation_url']) && $pa_bundle_settings['documentation_url'] ? $pa_bundle_settings['documentation_url'] : ($vs_documentation_url = $this->getAttributeDocumentationUrl($vs_attr_element_code))); if ($t_element = $this->_getElementInstance($vs_attr_element_code)) { if ($o_config->get('show_required_field_marker') && ($t_element->getSetting('minChars') > 0 || (bool) $t_element->getSetting('mustNotBeBlank') || (bool) $t_element->getSetting('requireValue'))) { $vs_label .= ' ' . $vs_required_marker; } } if ($vs_label_text && $vs_description) { TooltipManager::add('#' . $vs_field_id, "<h3>{$vs_label_text}</h3>{$vs_description}"); } break; # ------------------------------------------------- # ------------------------------------------------- case 'related_table': if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name, 'general')) && sizeof($va_error_objects)) { $vs_display_format = $o_config->get('bundle_element_error_display_format'); foreach ($va_error_objects as $o_e) { $va_errors[] = $o_e->getErrorDescription(); } } else { $vs_display_format = $o_config->get('bundle_element_display_format'); } switch ($ps_bundle_name) { # ------------------------------- case 'ca_object_representations': $pa_options['start'] = 0; $pa_options['limit'] = 20; $vs_element = $this->getRelatedHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options); break; case 'ca_entities': case 'ca_places': case 'ca_occurrences': case 'ca_objects': case 'ca_collections': case 'ca_list_items': case 'ca_storage_locations': case 'ca_loans': case 'ca_movements': case 'ca_tour_stops': if ($this->_CONFIG->get($ps_bundle_name . '_disable')) { return ''; } // don't display if master "disable" switch is set $pa_options['start'] = 0; $vs_element = $this->getRelatedHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- # ------------------------------- case 'ca_object_lots': if ($this->_CONFIG->get($ps_bundle_name . '_disable')) { break; } // don't display if master "disable" switch is set $pa_lot_options = array('batch' => $vb_batch); if ($this->tableName() != 'ca_object_lots' && ($vn_lot_id = $pa_options['request']->getParameter('lot_id', pInteger))) { $pa_lot_options['force'][] = $vn_lot_id; } $vs_element = $this->getRelatedHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_lot_options); break; # ------------------------------- # ------------------------------- case 'ca_representation_annotations': //if (!method_exists($this, "getAnnotationType") || !$this->getAnnotationType()) { continue; } // don't show bundle if this representation doesn't support annotations //if (!method_exists($this, "useBundleBasedAnnotationEditor") || !$this->useBundleBasedAnnotationEditor()) { continue; } // don't show bundle if this representation doesn't use bundles to edit annotations $pa_options['fields'] = array('ca_representation_annotations.status', 'ca_representation_annotations.access', 'ca_representation_annotations.props', 'ca_representation_annotations.representation_id'); $vs_element = $this->getRepresentationAnnotationHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- # ------------------------------- default: $vs_element = "'{$ps_bundle_name}' is not a valid related-table bundle name"; break; # ------------------------------- } if (!$vs_label_text) { $vs_label_text = $va_info['label']; } $vs_label = '<span class="formLabelText" id="' . $pa_options['formName'] . '_' . $ps_placement_code . '">' . $vs_label_text . '</span>'; $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : null; if ($vs_label_text && $vs_description) { TooltipManager::add('#' . $pa_options['formName'] . '_' . $ps_placement_code, "<h3>{$vs_label}</h3>{$vs_description}"); } break; # ------------------------------------------------- # ------------------------------------------------- case 'special': if (is_array($va_error_objects = $pa_options['request']->getActionErrors($ps_bundle_name, 'general')) && sizeof($va_error_objects)) { $vs_display_format = $o_config->get('bundle_element_error_display_format'); foreach ($va_error_objects as $o_e) { $va_errors[] = $o_e->getErrorDescription(); } } else { $vs_display_format = $o_config->get('bundle_element_display_format'); } $vb_read_only = $pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_READONLY__ ? true : false; if (!$pa_bundle_settings['readonly']) { $pa_bundle_settings['readonly'] = !isset($pa_bundle_settings['readonly']) || !$pa_bundle_settings['readonly'] ? $vb_read_only : true; } switch ($ps_bundle_name) { # ------------------------------- // This bundle is only available when editing objects of type ca_representation_annotations case 'ca_representation_annotation_properties': if ($vb_batch) { return null; } // not supported in batch mode if (!$this->useInEditor()) { return null; } foreach ($this->getPropertyList() as $vs_property) { $vs_element .= $this->getPropertyHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $vs_property, $pa_options); } break; # ------------------------------- // This bundle is only available when editing objects of type ca_sets # ------------------------------- // This bundle is only available when editing objects of type ca_sets case 'ca_set_items': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getSetItemHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options, $pa_bundle_settings); break; # ------------------------------- // This bundle is only available for types which support set membership # ------------------------------- // This bundle is only available for types which support set membership case 'ca_sets': require_once __CA_MODELS_DIR__ . "/ca_sets.php"; // need to include here to avoid dependency errors on parse/compile $t_set = new ca_sets(); $vs_element .= $t_set->getItemSetMembershipHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_editor_uis # ------------------------------- // This bundle is only available when editing objects of type ca_editor_uis case 'ca_editor_ui_screens': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getScreenHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_editor_uis # ------------------------------- // This bundle is only available when editing objects of type ca_editor_uis case 'ca_editor_ui_type_restrictions': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_editor_ui_screens # ------------------------------- // This bundle is only available when editing objects of type ca_editor_ui_screens case 'ca_editor_ui_screen_type_restrictions': $t_editor = new ca_editor_uis($this->get('ui_id')); $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_editor_ui_screens # ------------------------------- // This bundle is only available when editing objects of type ca_editor_ui_screens case 'ca_editor_ui_bundle_placements': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getPlacementsHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_tours # ------------------------------- // This bundle is only available when editing objects of type ca_tours case 'ca_tour_stops_list': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getTourStopHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // Hierarchy navigation bar for hierarchical tables # ------------------------------- // Hierarchy navigation bar for hierarchical tables case 'hierarchy_navigation': if ($vb_batch) { return null; } // not supported in batch mode if ($this->isHierarchical()) { $vs_element .= $this->getHierarchyNavigationHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, array(), $pa_bundle_settings, $pa_options); } break; # ------------------------------- // Hierarchical item location control # ------------------------------- // Hierarchical item location control case 'hierarchy_location': if ($vb_batch) { return null; } // not supported in batch mode if ($this->isHierarchical()) { $vs_element .= $this->getHierarchyLocationHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, array(), $pa_bundle_settings, $pa_options); } break; # ------------------------------- // This bundle is only available when editing objects of type ca_search_forms # ------------------------------- // This bundle is only available when editing objects of type ca_search_forms case 'ca_search_form_placements': if ($vb_batch) { return null; } // not supported in batch mode //if (!$this->getPrimaryKey()) { return ''; } $vs_element .= $this->getSearchFormHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_bundle_displays # ------------------------------- // This bundle is only available when editing objects of type ca_bundle_displays case 'ca_bundle_display_placements': if ($vb_batch) { return null; } // not supported in batch mode //if (!$this->getPrimaryKey()) { return ''; } $vs_element .= $this->getBundleDisplayHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_bundle_displays # ------------------------------- // This bundle is only available when editing objects of type ca_bundle_displays case 'ca_bundle_display_type_restrictions': $vs_element .= $this->getTypeRestrictionsHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_options); break; # ------------------------------- // # ------------------------------- // case 'ca_users': if (!$pa_options['request']->user->canDoAction('is_administrator') && $pa_options['request']->getUserID() != $this->get('user_id')) { return ''; } // don't allow setting of per-user access if user is not owner $vs_element .= $this->getUserHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_options); break; # ------------------------------- // # ------------------------------- // case 'ca_user_groups': if (!$pa_options['request']->user->canDoAction('is_administrator') && $pa_options['request']->getUserID() != $this->get('user_id')) { return ''; } // don't allow setting of group access if user is not owner $vs_element .= $this->getUserGroupHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $this->tableNum(), $this->getPrimaryKey(), $pa_options['request']->getUserID(), $pa_options); break; # ------------------------------- # ------------------------------- case 'settings': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getHTMLSettingFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $this->tableNum(), $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_object_representations # ------------------------------- // This bundle is only available when editing objects of type ca_object_representations case 'ca_object_representations_media_display': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getMediaDisplayHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available when editing objects of type ca_object_representations # ------------------------------- // This bundle is only available when editing objects of type ca_object_representations case 'ca_object_representation_captions': if ($vb_batch) { return null; } // not supported in batch mode if (!$this->representationIsOfClass("video")) { return ''; } $vs_element .= $this->getCaptionHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_commerce_order_history': if ($vb_batch) { return null; } // not supported in batch mode if (!$pa_options['request']->user->canDoAction('can_manage_clients')) { break; } $vs_label_text = $pa_bundle_settings['order_type'][0] == 'O' ? _t('Order history') : _t('Loan history'); $vs_element .= $this->getCommerceOrderHistoryHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_objects_components_list': if ($vb_batch) { return null; } // not supported in batch mode if (!$pa_options['request']->user->canDoAction('can_edit_ca_objects')) { break; } if (!$this->canTakeComponents()) { return null; } $vs_element .= $this->getComponentListHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_objects_location': // storage location via ca_objects_x_storage_locations or ca_movements_x_objects if ($vb_batch) { return null; } // not supported in batch mode if (!$this->getPrimaryKey()) { return null; } // not supported for new records if (!$pa_options['request']->user->canDoAction('can_edit_ca_objects')) { break; } $vs_element .= $this->getObjectLocationHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_objects_history': // summary of object accession, movement, exhibition and deaccession if ($vb_batch) { return null; } // not supported in batch mode if (!$this->getPrimaryKey()) { return null; } // not supported for new records if (!$pa_options['request']->user->canDoAction('can_edit_ca_objects')) { break; } $vs_element .= $this->getObjectHistoryHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_objects_deaccession': // object deaccession information if (!$vb_batch && !$this->getPrimaryKey()) { return null; } // not supported for new records if (!$pa_options['request']->user->canDoAction('can_edit_ca_objects')) { break; } $vs_element .= $this->getObjectDeaccessionHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for objects # ------------------------------- // This bundle is only available for objects case 'ca_object_checkouts': // object checkout information if ($vb_batch) { return null; } // not supported in batch mode if (!$vb_batch && !$this->getPrimaryKey()) { return null; } // not supported for new records if (!$pa_options['request']->user->canDoAction('can_edit_ca_objects')) { break; } $vs_element .= $this->getObjectCheckoutsHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available for relationships that include an object on one end # ------------------------------- // This bundle is only available for relationships that include an object on one end case 'ca_object_representation_chooser': if ($vb_batch) { return null; } // not supported in batch mode $vs_element .= $this->getRepresentationChooserHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- // This bundle is only available items that can be used as authority references (object, entities, occurrences, list items, etc.) # ------------------------------- // This bundle is only available items that can be used as authority references (object, entities, occurrences, list items, etc.) case 'authority_references_list': $vs_element .= $this->getAuthorityReferenceListHTMLFormBundle($pa_options['request'], $pa_options['formName'], $ps_placement_code, $pa_bundle_settings, $pa_options); break; # ------------------------------- # ------------------------------- default: $vs_element = "'{$ps_bundle_name}' is not a valid bundle name"; break; # ------------------------------- } if (!$vs_label_text) { $vs_label_text = $va_info['label']; } $vs_label = '<span class="formLabelText" id="' . $pa_options['formName'] . '_' . $ps_placement_code . '">' . $vs_label_text . '</span>'; $vs_description = isset($pa_bundle_settings['description'][$g_ui_locale]) && $pa_bundle_settings['description'][$g_ui_locale] ? $pa_bundle_settings['description'][$g_ui_locale] : null; if ($vs_label_text && $vs_description) { TooltipManager::add('#' . $pa_options['formName'] . '_' . $ps_placement_code, "<h3>{$vs_label}</h3>{$vs_description}"); } break; # ------------------------------------------------- # ------------------------------------------------- default: return "'{$ps_bundle_name}' is not a valid bundle name"; break; # ------------------------------------------------- } if ($vs_documentation_url) { // catch doc URL without protocol aka starting with letters but not http/https if (preg_match("!^[a-z]!", $vs_documentation_url) && !preg_match("!^http[s]?://!", $vs_documentation_url)) { $vs_documentation_url = "http://" . $vs_documentation_url; } $vs_documentation_link = "<a class='bundleDocumentationLink' href='{$vs_documentation_url}' target='_blank'>documentation</a>"; } if (is_array($va_violations) && sizeof($va_violations)) { $vs_label .= "<img src='" . $pa_options['request']->getThemeUrlPath() . "/graphics/icons/warning_small.gif' style='margin-left: 5px;' onclick='jQuery(this).parent().find(\".caMetadataDictionaryDefinitionToggle\").click(); return false;'/>"; } $vs_output = str_replace("^ELEMENT", $vs_element, $vs_display_format); $vs_output = str_replace("^ERRORS", join('; ', $va_errors), $vs_output); $vs_output = str_replace("^LABEL", $vs_label, $vs_output); $vs_output = str_replace("^DOCUMENTATIONLINK", $vs_documentation_link, $vs_output); $ps_bundle_label = $vs_label_text; return caGetOption('contentOnly', $pa_options, false) ? $vs_element : $vs_output; }