Skip to content

Commit

Permalink
tabs=>spaces, update copyrights, README, CONTRIBUTING, Makefile, AUTHORS
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Veyssier committed Apr 11, 2019
1 parent b8b8a44 commit 02bf36e
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 87 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Authors

* Julien Veyssier: <[email protected]>
* Arne Hamann: <[email protected]>
* Sander Brand: <[email protected]>
* Vinzenz Rosenkranz: <[email protected]>
18 changes: 8 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
## Submitting issues

If you have questions about how to install or use ownCloud, please direct these to the [mailing list][mailinglist] or our [forum][forum]. We are also available on [IRC][irc].
If you have questions about how to install or use Nextcloud, please direct these to the [online documentation][documentation] or our [forum][forum]. We are also available on [IRC][irc].

### Short version

* The [**issue template can be found here**][template]. Please always use the issue template when reporting issues.
* Please always try to be as precise as possible when reporting issues.

### Guidelines
* Please search the existing issues first, it's likely that your issue was already reported or even fixed.
- Go to one of the repositories, click "issues" and type any word in the top search/command bar.
- You can also filter by appending e. g. "state:open" to the search string.
- More info on [search syntax within github](https://help.github.com/articles/searching-issues)
* This repository ([maps](https://github.com/owncloud/maps/issues)) is *only* for issues within the ownCloud maps code.
* __SECURITY__: Report any potential security bug to [email protected] following our [security policy](https://owncloud.org/security/) instead of filing an issue in our bug tracker
* Report the issue using our [template][template], it includes all the information we need to track down the issue.
* This repository ([maps](https://github.com/nextcloud/maps/issues)) is *only* for issues within the Nextcloud maps code.
* __SECURITY__: Report any potential security bug to [email protected] following our [security policy](https://nextcloud.com/security/) instead of filing an issue in our bug tracker

Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.

[template]: https://raw.github.com/owncloud/core/master/issue_template.md
[mailinglist]: https://mailman.owncloud.org/mailman/listinfo/owncloud
[forum]: https://forum.owncloud.org/
[irc]: https://webchat.freenode.net/?channels=owncloud&uio=d4
[documentation]: https://docs.nextcloud.com/
[forum]: https://help.nextcloud.com/
[irc]: https://webchat.freenode.net/?channels=nextcloud

### Contribute Code and translations
Please check [core's contribution guidelines](https://github.com/owncloud/core/blob/master/CONTRIBUTING.md) for further information about contributing code and translations.
Please check [core's contribution guidelines](https://github.com/nextcloud/server/blob/master/.github/CONTRIBUTING.md) for further information about contributing code and translations.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Place this app in **nextcloud/apps/**

The app can be built by running:

npm install
make

This requires the following things to be present:
* tar: for building the archive
* curl: used if phpunit and composer are not installed to fetch them from the web
* npm: for building and testing everything JS, only required if a package.json is placed inside the **js/** folder
* npm: for building and testing everything JS, only required if a package.json is placed at the top of the repository

The make command will install or update Composer dependencies if a composer.json is present and also **npm run build** if a package.json is present in the **js/** folder. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.:
The make command will install or update Composer dependencies if a composer.json is present and also **npm install** if a package.json is present at the top of the repository. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.:

**package.json**:
```json
Expand Down
2 changes: 1 addition & 1 deletion js/nonLocalizedPhotosController.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ NonLocalizedPhotosController.prototype = {
paths.push( markerData.path);
lats.push(markerData.lat);
lngs.push(markerData.lng);
this.nonLocalizedPhotoLayer.removeLayer(this.nonLocalizedPhotoMarkers[i]);
this.nonLocalizedPhotoLayer.removeLayer(this.nonLocalizedPhotoMarkers[i]);
delete this.nonLocalizedPhotoMarkers[i];
}
this.photosController.placePhotos(paths, lats, lngs);
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Piotr Bator <[email protected]>
* @copyright Piotr Bator 2017
* @author Julien Veyssier <[email protected]>
* @copyright Julien Veyssier 2019
*/

namespace OCA\Maps\Controller;
Expand Down
18 changes: 9 additions & 9 deletions lib/Controller/PhotosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ public function getPhotosFromDb() {
return new DataResponse($result);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getNonLocalizedPhotosFromDb() {
$result = $this->geophotoService->getNonLocalizedFromDB($this->userId);
return new DataResponse($result);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getNonLocalizedPhotosFromDb() {
$result = $this->geophotoService->getNonLocalizedFromDB($this->userId);
return new DataResponse($result);
}


/**
/**
* @NoAdminRequired
*/
public function placePhotos($paths, $lats, $lngs, $directory=false) {
Expand Down
8 changes: 4 additions & 4 deletions lib/DB/GeophotoMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public function findAll($userId, $limit=null, $offset=null) {
return $this->findEntities($sql, [$userId], $limit, $offset);
}

public function findAllNonLocalized($userId, $limit=null, $offset=null) {
$sql = 'SELECT * FROM `*PREFIX*maps_photos` where `user_id` = ? and (`lat` is null or `long` is null)';
return $this->findEntities($sql, [$userId], $limit, $offset);
}
public function findAllNonLocalized($userId, $limit=null, $offset=null) {
$sql = 'SELECT * FROM `*PREFIX*maps_photos` where `user_id` = ? and (`lat` is null or `long` is null)';
return $this->findEntities($sql, [$userId], $limit, $offset);
}

public function deleteByFileId($fileId) {
$sql = 'DELETE FROM `*PREFIX*maps_photos` where `file_id` = ?';
Expand Down
60 changes: 30 additions & 30 deletions lib/Service/GeophotoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@ public function getAllFromDB ($userId) {
return $filesById;
}

/**
* @param string $userId
* @return array with geodatas of all nonLocalizedPhotos
*/
public function getNonLocalizedFromDB ($userId) {
$foo = $this->loadTimeordedPointSets($userId);
$photoEntities = $this->photoMapper->findAllNonLocalized($userId);
$userFolder = $this->getFolderForUser($userId);
$filesById = [];
$cache = $userFolder->getStorage()->getCache();
$previewEnableMimetypes = $this->getPreviewEnabledMimetypes();
foreach ($photoEntities as $photoEntity) {
$cacheEntry = $cache->get($photoEntity->getFileId());
if ($cacheEntry) {
$path = $cacheEntry->getPath();
/**
* @param string $userId
* @return array with geodatas of all nonLocalizedPhotos
*/
public function getNonLocalizedFromDB ($userId) {
$foo = $this->loadTimeordedPointSets($userId);
$photoEntities = $this->photoMapper->findAllNonLocalized($userId);
$userFolder = $this->getFolderForUser($userId);
$filesById = [];
$cache = $userFolder->getStorage()->getCache();
$previewEnableMimetypes = $this->getPreviewEnabledMimetypes();
foreach ($photoEntities as $photoEntity) {
$cacheEntry = $cache->get($photoEntity->getFileId());
if ($cacheEntry) {
$path = $cacheEntry->getPath();
$date = $photoEntity->getDateTaken() ?? \time();
$locations = $this->getLocationGuesses($date);
foreach ($locations as $location) {
$locations = $this->getLocationGuesses($date);
foreach ($locations as $location) {
$file_object = new \stdClass();
$file_object->fileId = $photoEntity->getFileId();
$file_object->path = $this->normalizePath($path);
Expand All @@ -106,27 +106,27 @@ public function getNonLocalizedFromDB ($userId) {
$filesById[] = $file_object;
}

}
}

}
return $filesById;
}
}
return $filesById;
}

/**
* returns a array of locations for a given date
* @param $dateTaken
* @return array
*/
private function getLocationGuesses($dateTaken) {
$locations = [];
foreach ($this->timeordedPointSets as $timeordedPointSet) {
private function getLocationGuesses($dateTaken) {
$locations = [];
foreach ($this->timeordedPointSets as $timeordedPointSet) {
$location = $this->getLocationFromSequenceOfPoints($dateTaken,$timeordedPointSet);
if (!is_null($location)) {
$locations[] = $location;
}
}
if (count($locations) === 0) {
$locations[] = [null, null];
if (count($locations) === 0) {
$locations[] = [null, null];
}
return $locations;

Expand All @@ -138,7 +138,7 @@ private function getLocationGuesses($dateTaken) {
*/
private function loadTimeordedPointSets($userId) {
$userFolder = $this->getFolderForUser($userId);
foreach ($this->tracksService->getTracksFromDB($userId) as $gpxfile) {
foreach ($this->tracksService->getTracksFromDB($userId) as $gpxfile) {
$res = $userFolder->getById($gpxfile['file_id']);
if (is_array($res) and count($res) > 0) {
$file = $res[0];
Expand All @@ -149,7 +149,7 @@ private function loadTimeordedPointSets($userId) {
}
}
}
return null;
return null;
}

/*
Expand All @@ -158,7 +158,7 @@ private function loadTimeordedPointSets($userId) {
* @return array
*/
private function getTracksFromGPX($content) {
$tracks = [];
$tracks = [];
$gpx = simplexml_load_string($content);
foreach ($gpx->trk as $trk) {
$tracks[] = $trk;
Expand All @@ -172,7 +172,7 @@ private function getTracksFromGPX($content) {
* @return array
*/
private function getTimeorderdPointsFromTrack($track) {
$points = [];
$points = [];
foreach ($track->trkseg as $seg) {
foreach ($seg->trkpt as $pt) {
$points[strtotime($pt->time)] = [(string) $pt["lat"],(string) $pt["lon"]];
Expand Down
56 changes: 28 additions & 28 deletions templates/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,34 +99,34 @@
</li>
</ul>
</div>
<ul>
<li id="navigation-nonLocalizedPhotos">
<a class="icon-picture" href="#"><?php p($l->t('non localized')); ?></a>
<div class="app-navigation-entry-utils">
<ul>
<li class="app-navigation-entry-utils-counter">
<span></span>
</li>
<li id="toggleNonLocalizedPhotosButton" class="app-navigation-entry-utils-menu-button" title="<?php p($l->t('Toggle non localized Photos')); ?>">
<button class="icon-toggle"></button>
</li>
<li class="app-navigation-entry-utils-menu-button nonLocalizedPhotosMenuButton">
<button></button>
</li>
</ul>
</div>
<div class="app-navigation-entry-menu">
<ul>
<li>
<a href="#" class="save-all-nonlocalized">
<span class="icon-category-office"></span>
<span><?php p($l->t('Save all visibile')); ?></span>
</a>
</li>
</ul>
</div>
</li>
</ul>
<ul>
<li id="navigation-nonLocalizedPhotos">
<a class="icon-picture" href="#"><?php p($l->t('non localized')); ?></a>
<div class="app-navigation-entry-utils">
<ul>
<li class="app-navigation-entry-utils-counter">
<span></span>
</li>
<li id="toggleNonLocalizedPhotosButton" class="app-navigation-entry-utils-menu-button" title="<?php p($l->t('Toggle non localized Photos')); ?>">
<button class="icon-toggle"></button>
</li>
<li class="app-navigation-entry-utils-menu-button nonLocalizedPhotosMenuButton">
<button></button>
</li>
</ul>
</div>
<div class="app-navigation-entry-menu">
<ul>
<li>
<a href="#" class="save-all-nonlocalized">
<span class="icon-category-office"></span>
<span><?php p($l->t('Save all visibile')); ?></span>
</a>
</li>
</ul>
</div>
</li>
</ul>
</li>
<li id="navigation-contacts">
<a class="icon-group" href="#"><?php p($l->t('Contacts')); ?></a>
Expand Down
9 changes: 9 additions & 0 deletions tests/Integration/AppTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php
/**
* Nextcloud - maps
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Julien Veyssier <[email protected]>
* @copyright Julien Veyssier 2019
*/

namespace OCA\Maps\Tests\Integration\Controller;

Expand Down
9 changes: 9 additions & 0 deletions tests/Unit/Controller/FavoritesControllerTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php
/**
* Nextcloud - maps
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Julien Veyssier <[email protected]>
* @copyright Julien Veyssier 2019
*/

namespace OCA\Maps\Controller;

Expand Down
9 changes: 9 additions & 0 deletions tests/Unit/Controller/PageControllerTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php
/**
* Nextcloud - maps
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Julien Veyssier <[email protected]>
* @copyright Julien Veyssier 2019
*/

namespace OCA\Maps\Controller;

Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Julien Veyssier <[email protected]>
* @copyright Julien Veyssier 2019
*/
define('PHPUNIT_RUN', 1);

Expand Down

0 comments on commit 02bf36e

Please sign in to comment.