Changeset 12896
- Timestamp:
- 10/19/07 11:06:49 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager2/config/config.inc
r6060 r12896 9 9 'tinymce_use_compressor' => false, 10 10 //'tinymce_default_config_snippet' => "{$GLOBALS['midcom_config']['midcom_sgconfig_basedir']}/midcom.helper.datamanager2/tinymce", 11 12 'include_metadata_required' => false, trunk/midcom/midcom.helper.datamanager2/schema.php
r10966 r12896 120 120 121 121 /** 122 * The schema database path as read by the system. 123 * 124 * @access private 125 * @var Array 126 */ 127 var $_schemadb_path = null; 128 129 /** 122 130 * A simple array holding the fields in the order they should be rendered identified 123 131 * by their name. … … 172 180 * @see midcom_get_snippet_content() 173 181 */ 174 function midcom_helper_datamanager2_schema($schemadb, $name = null) 175 { 176 $this->_component = 'midcom.helper.datamanager2'; 177 parent::midcom_baseclasses_components_purecode(); 182 function midcom_helper_datamanager2_schema($schemadb, $name = null, $schemadb_path = null) 183 { 184 $this->_component = 'midcom.helper.datamanager2'; 185 parent::midcom_baseclasses_components_purecode(); 186 $this->_schemadb_path = $schemadb_path; 178 187 179 188 $this->_load_schemadb($schemadb); … … 278 287 $data['name'] = $name; 279 288 $this->append_field($name, $data); 289 } 290 291 if ( $this->_config->get('include_metadata_required') 292 && $this->_schemadb_path 293 && $this->_schemadb_path != $GLOBALS['midcom_config']['metadata_schema']) 294 { 295 // Include required fields from metadata schema to the schema 296 $metadata_schema = midcom_helper_datamanager2_schema::load_database($GLOBALS['midcom_config']['metadata_schema']); 297 if (isset($metadata_schema['metadata'])) 298 { 299 $prepended = false; 300 foreach ($metadata_schema['metadata']->fields as $name => $field) 301 { 302 303 if ($field['required']) 304 { 305 if (!$prepended) 306 { 307 $field['static_prepend'] = "<h3 style='clear: left;'>" . $_MIDCOM->i18n->get_string('metadata', 'midcom') . "</h3>\n" . $field['static_prepend']; 308 $prepended = true; 309 } 310 $this->append_field($name, $field); 311 } 312 } 313 } 280 314 } 281 315 } … … 513 547 function load_database($raw_db) 514 548 { 549 $path = null; 515 550 if (is_string($raw_db)) 516 551 { 552 $path = $raw_db; 517 553 $data = midcom_get_snippet_content($raw_db); 518 554 $result = eval ("\$raw_db = Array ( {$data}\n );"); … … 529 565 foreach ($raw_db as $name => $raw_schema) 530 566 { 531 $schemadb[$name] = new midcom_helper_datamanager2_schema($raw_db, $name );567 $schemadb[$name] = new midcom_helper_datamanager2_schema($raw_db, $name, $path); 532 568 } 533 569 return $schemadb;
