diff --git a/app/controllers/resources/resource.php b/app/controllers/resources/resource.php index 19d951b0429d210547ea3960ccf604f0c8db41ca..42de1f321277f2b41124025e845ee4f1116e43b9 100644 --- a/app/controllers/resources/resource.php +++ b/app/controllers/resources/resource.php @@ -1016,7 +1016,6 @@ class Resources_ResourceController extends AuthenticatedController //Get the list of temporary permissions for the user-IDs in the list: $user_permissions = Request::getArray('permissions'); - //var_dump($user_permissions);die(); $processed_permissions = 0; $errors = []; diff --git a/app/controllers/resources/room.php b/app/controllers/resources/room.php index 7b1ad87d543c8e729a088c22ad4950c45a47a2a9..01af12eda85b7545bf27ab2e9e4a7a77a9f11bd9 100644 --- a/app/controllers/resources/room.php +++ b/app/controllers/resources/room.php @@ -67,10 +67,7 @@ class Resources_RoomController extends AuthenticatedController $user, 'autor' ); - $current_user_is_resource_user = $this->room->userHasPermission( - $user, - 'user' - ); + $current_user_is_resource_user = $this->room->userHasPermission($user); $sidebar = Sidebar::get(); $actions = new ActionsWidget(); @@ -167,6 +164,7 @@ class Resources_RoomController extends AuthenticatedController $this->grouped_properties = $this->room->getGroupedProperties( $this->room->getRequiredPropertyNames() ); + $this->geo_coordinates_object = $this->room->building->getPropertyObject('geo_coordinates'); } diff --git a/app/views/resources/_common/_room_search_result.php b/app/views/resources/_common/_room_search_result.php index 45b700b9ec30343702cd771e658ea30756c666e7..7c82fcfd3e10f95e7bb43fbe17d0ec875bd79077 100644 --- a/app/views/resources/_common/_room_search_result.php +++ b/app/views/resources/_common/_room_search_result.php @@ -55,14 +55,17 @@ ); } if ($room->building) { - $actions->addLink( - ResourceManager::getMapUrlForResourcePosition( - $room->building->getPropertyObject('geo_coordinates') - ), - _('Zum Lageplan'), - Icon::create('globe'), - ['target' => '_blank'] - ); + $geo_coordinates_object = $room->building->getPropertyObject('geo_coordinates'); + if ($geo_coordinates_object instanceof ResourceProperty) { + $actions->addLink( + ResourceManager::getMapUrlForResourcePosition( + $room->building->getPropertyObject('geo_coordinates') + ), + _('Zum Lageplan'), + Icon::create('globe'), + ['target' => '_blank'] + ); + } } if ($clipboard_widget_id) { $actions->addLink( diff --git a/app/views/resources/building/index.php b/app/views/resources/building/index.php index 140bbfe60277e1ec3a92b3e75144809bc141f972..4f46a0c17a1a94adfbf68aba6ab56478571fc341 100644 --- a/app/views/resources/building/index.php +++ b/app/views/resources/building/index.php @@ -30,7 +30,6 @@ </section> </section> <? endif ?> - <div data-dialog-button> <? if (Request::isDialog()) : ?> <? if ($geo_coordinates_object instanceof ResourceProperty): ?> @@ -40,13 +39,15 @@ ['target' => '_blank'] ) ?> <? endif ?> - <?= \Studip\LinkButton::createEdit( - _('Bearbeiten'), - $building->getActionURL('edit'), - [ - 'data-dialog' => 'size=auto' - ] - ) ?> + <? if ($building->userHasPermission($GLOBALS['user']->getAuthenticatedUser(), 'admin')) : ?> + <?= \Studip\LinkButton::createEdit( + _('Bearbeiten'), + $building->getActionURL('edit'), + [ + 'data-dialog' => 'size=auto' + ] + ) ?> + <? endif ?> <? endif ?> </div> <? diff --git a/app/views/resources/location/index.php b/app/views/resources/location/index.php index ae281970e70c57ee0748adb6c165c51b22d446da..162bfcd8d5c14c060bf624f4252bca6cf1c3d737 100644 --- a/app/views/resources/location/index.php +++ b/app/views/resources/location/index.php @@ -19,13 +19,15 @@ ['target' => '_blank'] ) ?> </div> - <?= \Studip\LinkButton::createEdit( - _('Bearbeiten'), - $location->getActionURL('edit'), - [ - 'data-dialog' => 'size=auto' - ] - ) ?> + <? if($location->userHasPermission(User::findCurrent(), 'admin')) : ?> + <?= \Studip\LinkButton::createEdit( + _('Bearbeiten'), + $location->getActionURL('edit'), + [ + 'data-dialog' => 'size=auto' + ] + ) ?> + <? endif ?> <? endif ?> <? endif ?> <? $property_groups = $location->getGroupedProperties($other_properties) ?> diff --git a/app/views/resources/room/index.php b/app/views/resources/room/index.php index a68bfc989746348338f8f9053a9095020333612b..92143b960fa566f3b6ba66b53df6d0f4f1a2847d 100644 --- a/app/views/resources/room/index.php +++ b/app/views/resources/room/index.php @@ -88,21 +88,24 @@ $room->getActionURL('semester_plan'), ['data-dialog' => 'size=big']) ?> <? endif ?> - <? if ($room->building) : ?> + + <? if ($geo_coordinates_object instanceof ResourceProperty): ?> <?= \Studip\LinkButton::create( _('Zum Lageplan'), ResourceManager::getMapUrlForResourcePosition( - $room->building->getPropertyObject('geo_coordinates') + $geo_coordinates_object ) ) ?> <? endif ?> - <?= \Studip\LinkButton::createEdit( - _('Bearbeiten'), - $room->getActionURL('edit'), - [ - 'data-dialog' => 'size=auto' - ] - ) ?> + <? if ($room->userHasPermission(User::findCurrent(), 'admin')) : ?> + <?= \Studip\LinkButton::createEdit( + _('Bearbeiten'), + $room->getActionURL('edit'), + [ + 'data-dialog' => 'size=auto' + ] + ) ?> + <? endif ?> <? if (!$current_user_is_resource_autor && $room->requestable) : ?> <?= \Studip\LinkButton::create( _('Raum anfragen'), diff --git a/lib/models/resources/Resource.class.php b/lib/models/resources/Resource.class.php index 7fbaf575fc15b08f0fb9d2fa9e2ffe631d39cbf1..b012daed85471e699cde1dca19ce66d5e7ec118b 100644 --- a/lib/models/resources/Resource.class.php +++ b/lib/models/resources/Resource.class.php @@ -1439,13 +1439,16 @@ class Resource extends SimpleORMap implements StudipItem ); $property->store(); + + if ($name === 'geo_coordinates' && $property->state === '+0.0000000+0.0000000+0.0000000CRSWGS_84/') { + return null; + } return $property; } else { return null; } } - - return ResourceProperty::findOneBySql( + $property = ResourceProperty::findOneBySql( "INNER JOIN resource_property_definitions rpd ON resource_properties.property_id = rpd.property_id WHERE resource_properties.resource_id = :resource_id @@ -1455,6 +1458,11 @@ class Resource extends SimpleORMap implements StudipItem 'name' => $name ] ); + + if ($name === 'geo_coordinates' && $property->state === '+0.0000000+0.0000000+0.0000000CRSWGS_84/') { + return null; + } + return $property; } /**