Changeset 22752
- Timestamp:
- 06/30/09 18:14:14 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ragnaroek/midcom/midgard.admin.asgard/handler/object/manage.php
r22473 r22752 86 86 $this->_component = 'midgard.admin.asgard'; 87 87 parent::__construct(); 88 } 89 90 /** 91 * Helper function to retrieve the object from the db 92 * 93 * @param string $guid GUID 94 */ 95 private function _load_object($guid) 96 { 97 $this->_object = $_MIDCOM->dbfactory->get_object_by_guid($guid); 98 99 if ( !$this->_object 100 || !$this->_object->guid) 101 { 102 if (midgard_connection::get_error() == MGD_ERR_OBJECT_DELETED) 103 { 104 //TODO: redirect to "object deleted" page (see #236) 105 } 106 107 $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The GUID '{$guid}' was not found."); 108 // This will exit. 109 } 88 110 } 89 111 … … 728 750 midgard_admin_asgard_plugin::init_language($handler_id, $args, $data); 729 751 730 $this->_object = $_MIDCOM->dbfactory->get_object_by_guid($args[0]); 731 732 if ( !$this->_object 733 || !$this->_object->guid) 734 { 735 $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The GUID '{$args[0]}' was not found."); 736 // This will exit. 737 } 752 $this->_load_object($args[0]); 738 753 739 754 $_MIDCOM->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); … … 792 807 { 793 808 midgard_admin_asgard_plugin::init_language($handler_id, $args, $data); 794 $this->_object = $_MIDCOM->dbfactory->get_object_by_guid($args[0]); 795 if ( !$this->_object 796 || !$this->_object->guid) 797 { 798 $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The GUID '{$args[0]}' was not found."); 799 // This will exit 800 } 801 midgard_admin_asgard_plugin::set_last_visited($this->_object->guid); 809 810 $this->_load_object($args[0]); 802 811 803 812 $this->_object->require_do('midgard:update'); 804 813 $_MIDCOM->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); 814 815 midgard_admin_asgard_plugin::set_last_visited($this->_object->guid); 805 816 806 817 // Set the object language … … 1165 1176 { 1166 1177 midgard_admin_asgard_plugin::init_language($handler_id, $args, $data); 1167 $this->_object = $_MIDCOM->dbfactory->get_object_by_guid($args[0]); 1168 if ( !$this->_object 1169 || !$this->_object->guid) 1170 { 1171 $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The GUID '{$args[0]}' was not found."); 1172 // This will exit. 1173 } 1178 1179 $this->_load_object($args[0]); 1174 1180 1175 1181 $this->_object->require_do('midgard:delete'); … … 1334 1340 1335 1341 // Get the object that will be copied 1336 $this->_object = $_MIDCOM->dbfactory->get_object_by_guid($args[0]); 1337 if ( !$this->_object 1338 || !$this->_object->guid) 1339 { 1340 $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The GUID '{$args[0]}' was not found."); 1341 // This will exit. 1342 } 1342 $this->_load_object($args[0]); 1343 1343 1344 1344 $_MIDCOM->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); 1345 1346 midgard_admin_asgard_plugin::set_last_visited($this->_object->guid); 1345 1347 1346 1348 static $targets = array();
