Changeset 12094
- Timestamp:
- 09/10/07 11:09:39 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/application.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/baseclasses/database/group.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/config/metadata_default.inc (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/helper/metadata.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/application.php
r12085 r12094 1462 1462 * @access private 1463 1463 */ 1464 function _set_context_data($value, $param1, $param2 = null) { 1465 1466 global $midcom_errstr; 1467 1464 function _set_context_data($value, $param1, $param2 = null) 1465 { 1468 1466 if (is_null($param2)) 1469 1467 { trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php
r11911 r12094 190 190 } 191 191 192 // Default the owner to current user192 // Default the owner to first group of current user 193 193 if (!$object->metadata->owner) 194 194 { 195 $object->metadata->owner = $_MIDCOM->auth->user->_storage->guid; 195 $groups = $_MIDCOM->auth->user->list_all_memberships(); 196 if (count($groups) > 0) 197 { 198 $first_group = array_shift($groups); 199 $object->metadata->owner = str_replace('group:', '', $first_group->id); 200 } 196 201 } 197 202 } trunk/midcom/midcom.core/midcom/baseclasses/database/group.php
r3766 r12094 30 30 31 31 /** 32 * Updates all computed members. 33 * 34 * @access protected 35 */ 36 function _on_loaded() 37 { 38 if (! parent::_on_loaded()) 39 { 40 return false; 41 } 42 43 if (empty($this->official)) 44 { 45 $this->official = $this->name; 46 } 47 48 if (empty($this->official)) 49 { 50 $this->official = "Group #{$this->id}"; 51 } 52 return true; 53 } 54 55 /** 32 56 * Gets the parent object of the current one. 33 57 * trunk/midcom/midcom.core/midcom/config/metadata_default.inc
r5873 r12094 151 151 'widget_config' => array 152 152 ( 153 'class' => 'midcom_db_ person',154 'component' => 'net.nemein.personnel', 155 'titlefield' => ' name',156 'idfield' => 'guid', 157 'constraints' => array 158 ( 159 ), 160 'searchfields' => array 161 ( 162 ' firstname',163 ' lastname',164 ), 165 'orders' => array(array(' lastname', 'ASC')),153 'class' => 'midcom_db_group', 154 'component' => 'net.nemein.personnel', 155 'titlefield' => 'official', 156 'idfield' => 'guid', 157 'constraints' => array 158 ( 159 ), 160 'searchfields' => array 161 ( 162 'official', 163 'name', 164 ), 165 'orders' => array(array('official', 'ASC')), 166 166 ), 167 167 ), trunk/midcom/midcom.core/midcom/helper/metadata.php
r11906 r12094 371 371 case 'approver': 372 372 case 'authors': 373 $value = $this->object->metadata->$key; 374 if (!$value) 375 { 376 // Fall back to "Midgard admin" if person is not found 377 $value = 1; 378 } 379 break; 380 381 // Group property 373 382 case 'owner': 374 383 $value = $this->object->metadata->$key; 375 384 if (!$value) 376 385 { 377 // Fall back to "Midgard admin" if person is not found 378 $value = 1; 386 // Fall back to SG admin group if owner is not found 387 static $sg = null; 388 if (is_null($sg)) 389 { 390 $sg = mgd_get_sitegroup($_MIDGARD['sitegroup']); 391 } 392 $value = $sg->admingroup; 379 393 } 380 394 break;
