Skip to content
Permalink
Browse files

added status logging; closes #260

  • Loading branch information...
following5 committed Oct 31, 2018
1 parent e5307b0 commit 7a6c62ec1ba03def0a1e71672e008edcff65d276
@@ -1070,6 +1070,9 @@ public static function logtypename2id($name)
if ($name == 'Comment') return 3;
if ($name == 'Attended') return 7;
if ($name == 'Will attend') return 8;
if ($name == 'Archived') return 9;
if ($name == 'Available') return 10;
if ($name == 'Temporarily unavailable') return 11;
if (($name == 'Needs maintenance') && (Settings::get('OC_BRANCH') == 'oc.pl')) return 5;
throw new \Exception("logtype2id called with invalid log type argument: $name");
}
Binary file not shown.
@@ -2,9 +2,9 @@ msgid ""
msgstr ""
"Project-Id-Version: OKAPI\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 15:51+0200\n"
"PO-Revision-Date: 2018-09-25 14:41+0200\n"
"Last-Translator: Harrie Klomp <harrie@harrieklomp.be>\n"
"POT-Creation-Date: 2018-10-31 13:46+0100\n"
"PO-Revision-Date: 2018-10-31 13:53+0100\n"
"Last-Translator: following <following@online.de>\n"
"Language-Team: following <following@online.de>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
@@ -14,41 +14,41 @@ msgstr ""
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Generator: Poedit 2.0.6\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: .git\n"

#: services/caches/edit/WebService.php:65
#: services/caches/edit/WebService.php:82
#, php-format
msgid "The password must not be longer than %d characters."
msgstr "Das Passwort darf nicht länger als %d Zeichen sein."

#: services/caches/edit/WebService.php:78
#: services/caches/edit/WebService.php:95
#, php-format
msgid "%s does not allow log passwords for traditional caches."
msgstr "Tradis können bei %s keine Passwörter haben."

#: services/caches/formatters/gpx/WebService.php:427
#: services/caches/formatters/gpx/WebService.php:404
msgid ""
"<b>Geocache coordinates have been changed.</b> They have been replaced with "
"your own custom coordinates which you have provided for this geocache."
msgstr ""
"<b>Die Koordinaten des Geocaches wurden geändert.</b> Sie wurden durch deine "
"eigenen Koordinaten aus der persönlichen Notiz für diesen Cache ersetzt."

#: services/caches/formatters/gpx/WebService.php:433
#: services/caches/formatters/gpx/WebService.php:410
msgid ""
"<b>Geocache coordinates have been changed.</b> Currently they point to one "
"of the alternate waypoints originally described as:"
msgstr ""
"<b>Die Koordinaten des Geocaches wurden geändert.</b> Sie zeigen zurzeit auf "
"einen der zusätzlichen Wegpunkte mit der ursprünglichen Beschreibung:"

#: services/caches/formatters/gpx/WebService.php:446
#: services/caches/formatters/gpx/WebService.php:423
msgid "Original geocache location"
msgstr "Originalposition des Caches"

#: services/caches/formatters/gpx/WebService.php:448
#: services/caches/formatters/gpx/WebService.php:425
#, php-format
msgid "Original (owner-supplied) location of the %s geocache"
msgstr "Originale, vom Besitzer angegebene Position des Geocaches %s"
@@ -212,23 +212,23 @@ msgstr "Das Bild wurde erfolgreich gespeichert."
msgid "Image properties have been successfully updated."
msgstr "Die Bildeigenschaften wurden geändert."

#: services/logs/submit/WebService.php:74
#: services/logs/submit/WebService.php:75
msgid ""
"You are trying to publish a log entry with a date in future. Cache log "
"entries are allowed to be published in the past, but NOT in the future."
msgstr ""
"Das Datum deines Logeintrags liegt in der Zukunft. Cache-Logs können nur für "
"die Vergangenheit oder für heute eingetragen werden."

#: services/logs/submit/WebService.php:110
#: services/logs/submit/WebService.php:111
#, php-format
msgid ""
"However, your cache rating was ignored, because %s does not have a rating "
"system."
msgstr ""
"Deine Cachewertung wurde jedoch ignoriert, weil %s kein Bewertungssystem hat."

#: services/logs/submit/WebService.php:135
#: services/logs/submit/WebService.php:136
#, php-format
msgid ""
"However, your cache recommendation was ignored, because %s does not allow "
@@ -237,7 +237,7 @@ msgstr ""
"Deine Empfehlung wurde jedoch ignoriert, weil auf %s keine Event-Caches "
"empfohlen werden können."

#: services/logs/submit/WebService.php:184
#: services/logs/submit/WebService.php:185
#, php-format
msgid ""
"However, your \"does not need maintenance\" flag was ignored, because %s "
@@ -246,91 +246,99 @@ msgstr ""
"Deine Angabe \"benötigt Wartung\" wurde jedoch ignoriert, weil es diese "
"Funktion bei %s nicht gibt. "

#: services/logs/submit/WebService.php:214
#: services/logs/submit/WebService.php:215
msgid ""
"This cache is an Event cache. You cannot \"Find\" it (but you can attend it, "
"or comment on it)!"
msgstr ""
"Dies ist ein Event-Cache. Du kannst ihn nicht \"finden\" (aber du kannst am "
"Event teilnehmen oder einen Hinweis loggen)."

#: services/logs/submit/WebService.php:220
#, fuzzy
#: services/logs/submit/WebService.php:221
msgid ""
"You cannot attend an event before it takes place. Please check the log type "
"and date."
msgstr ""
"Du kannst ein Event nicht besuchen, bevor es stattfindet. Bitte überprüfe "
"den Logtyp und das Logdatum."

#: services/logs/submit/WebService.php:229
#: services/logs/submit/WebService.php:230
msgid ""
"This cache is NOT an Event cache. You cannot \"Attend\" it (but you can find "
"it, or comment on it)!"
msgstr ""
"Dies ist KEIN Event-Cache. Du kannst an ihm nicht \"teilnehmen\" (aber du "
"kannst ihn finden oder kommentieren)."

#: services/logs/submit/WebService.php:239
#: services/logs/submit/WebService.php:237
msgid "Your have to supply some text for your comment."
msgstr "Du musst einen Text für dein Hinweislog eingeben!"

#: services/logs/submit/WebService.php:255
#, php-format
msgid "%s does not allow to unarchive geocaches."
msgstr "%s erlaubt keine Reaktivierung archivierter Caches."

#: services/logs/submit/WebService.php:267
msgid "The geocache must be maintained before it is enabled."
msgstr "Der Geocache muss gewartet werden, bevor er aktiviert wird."

#: services/logs/submit/WebService.php:286
msgid "This cache requires a password. You didn't provide one!"
msgstr ""
"Dieser Cache kann nur mit Kennwort geloggt werden, aber du hast keines "
"angegeben."

#: services/logs/submit/WebService.php:259
#: services/logs/submit/WebService.php:290
msgid "Invalid password!"
msgstr "Ungültiges Kennwort!"

#: services/logs/submit/WebService.php:396
#: services/logs/submit/WebService.php:427
msgid "You have already submitted a log entry with exactly the same contents."
msgstr ""
"Du hast bereits einen Logeintrag mit genau dem gleichen Inhalt gemacht."

#: services/logs/submit/WebService.php:430
#: services/logs/submit/WebService.php:461
msgid ""
"You have already submitted a \"Found it\" log entry once. Now you may submit "
"\"Comments\" only!"
msgstr ""
"Du hast diesen Cache bereits als \"gefunden\" geloggt. Ein zweites Fundlog "
"ist nicht möglich, aber du kannst stattdessen einen Hinweis loggen."

#: services/logs/submit/WebService.php:432
#: services/logs/submit/WebService.php:463
msgid ""
"You have already submitted an \"Attended\" log entry once. Now you may "
"submit \"Comments\" only!"
msgstr ""
"Du hast dieses Event bereits als \"teilgenommen\" geloggt. Eine zweite "
"Teilnahme ist nicht möglich, aber du kannst stattdessen einen Hinweis loggen."

#: services/logs/submit/WebService.php:442
#: services/logs/submit/WebService.php:473
msgid "You are the owner of this cache. You may submit \"Comments\" only!"
msgstr ""
"Als Besitzer des Caches kannst du nur Hinweise loggen, keine Funde oder "
"Nichtfunde."

#: services/logs/submit/WebService.php:464
#: services/logs/submit/WebService.php:495
msgid "You have already rated this cache once. Your rating cannot be changed."
msgstr ""
"Du hast diesen Cache bereits bewertet. Deine Bewertung ist nicht änderbar."

#: services/logs/submit/WebService.php:485
#: services/logs/submit/WebService.php:516
msgid "You have already recommended this cache once."
msgstr "Du hast diesen Cache bereits empfohlen."

#: services/logs/submit/WebService.php:501
#: services/logs/submit/WebService.php:532
msgid "You don't have any recommendations to give. Find more caches first!"
msgstr ""
"Du musst mehr Caches finden, um eine weitere Bewertung abgeben zu können."

#: services/logs/submit/WebService.php:552
#: services/logs/submit/WebService.php:595
msgid "Event caches cannot \"need maintenance\"."
msgstr "Event-Caches können keine \"Wartung benötigen\"."

#: services/logs/submit/WebService.php:710
#: services/logs/submit/WebService.php:753
msgid "Your cache log entry was posted successfully."
msgstr "Dein Log wurde veröffentlicht."

@@ -47,7 +47,8 @@ private static function _call(OkapiRequest $request)
$logtype = $request->get_parameter('logtype');
if (!$logtype) throw new ParamMissing('logtype');
if (!in_array($logtype, array(
'Found it', "Didn't find it", 'Comment', 'Will attend', 'Attended'
'Found it', "Didn't find it", 'Comment', 'Will attend', 'Attended',
'Available', 'Temporarily unavailable', 'Archived'
))) {
throw new InvalidParam('logtype', "'$logtype' in not a valid logtype code.");
}
@@ -209,7 +210,7 @@ private static function _call(OkapiRequest $request)
if ($cache['type'] == 'Event')
{
if (!in_array($logtype, array('Will attend', 'Attended', 'Comment'))) {
if (in_array($logtype, array('Found it', "Didn't find it"))) {
throw new CannotPublishException(_(
'This cache is an Event cache. You cannot "Find" it (but '.
'you can attend it, or comment on it)!'
@@ -230,16 +231,46 @@ private static function _call(OkapiRequest $request)
'(but you can find it, or comment on it)!'
));
}
else if (!in_array($logtype, array('Found it', "Didn't find it", 'Comment'))) {
throw new Exception("Unknown log entry - should be documented here.");
}
}
if ($logtype == 'Comment' && strlen(trim($comment)) == 0) {
throw new CannotPublishException(_(
"Your have to supply some text for your comment."
));
}
if (in_array($logtype, array('Available', 'Temporarily unavailable', 'Archived')))
{
if ($user['uuid'] != $cache['owner']['uuid'])
throw new BadRequest("The status of a geocache can only be changed by the owner.");
if (Settings::get('OC_BRANCH') == 'oc.pl')
{
if ($logtype == $cache['status']) {
# OCPL does not allow to confirm an existing geocache status.
# We silently change the log to a comment.
$logtype = 'Comment';
}
elseif ($cache['status'] == 'Archived') {
throw new CannotPublishException(sprintf(_(
"%s does not allow to unarchive geocaches."
), Okapi::get_normalized_site_name()));
}
}
# Geocaches must be in good shape before enabling them. At OCDE,
# enabling implies setting "cache is ok" (does not need maintenance).
if ($logtype == 'Available')
{
if ($needs_maintenance2 == 'true')
throw new CannotPublishException(_(
"The geocache must be maintained before it is enabled."
));
elseif ($needs_maintenance2 == 'null' && Settings::get('OC_BRANCH') == 'oc.de')
$needs_maintenance2 = 'false';
}
}
# Password check.
if (($logtype == 'Found it' || $logtype == 'Attended') && $cache['req_passwd'])
@@ -543,6 +574,18 @@ private static function _call(OkapiRequest $request)
$second_formatted_comment = $formatted_comment;
$formatted_comment = "";
}
elseif (in_array($logtype, array(
'Available', 'Temporarily unavailable', 'Archived')))
{
# For status-changing logs, we'll issue two log entries, but this time
# we put the "Needs maintenance" first with empty comment, then the
# status-changing log with comment text.
$second_logtype = $logtype;
$second_formatted_comment = $formatted_comment;
$logtype = 'Needs maintenance';
$formatted_comment = "";
}
else if ($logtype == 'Will attend' || $logtype == 'Attended')
{
# OC branches which allow maintenance logs, still don't allow them on
@@ -865,6 +908,28 @@ private static function insert_log_row(
);
");
# update geocache status
if (in_array($logtype, array('Available', 'Temporarily unavailable', 'Archived')))
{
if (Settings::get('OC_BRANCH') == 'oc.de') {
Db::execute("
set @STATUS_CHANGE_USER_ID = '".Db::escape_string($user_internal_id)."'"
);
$set_last_modified_SQL = "";
# OCDE will update last_modified via trigger if status changes.
}
else
$set_last_modified_SQL = ", last_modified = NOW()";
$status_id = Okapi::cache_status_name2id($logtype);
DB::execute("
update caches
set status = '".Db::escape_string($status_id)."'".$set_last_modified_SQL."
where cache_id = '".Db::escape_string($cache_internal_id)."'
");
}
return $log_uuid;
}
}
@@ -9,14 +9,19 @@
<p>Code of the geocache.</p>
</req>
<req name='logtype'>
<p>Type of an entry. This should be one of:</p>
<p>Type of an entry. This may be one of:</p>
<ul>
<li>
<i>Will attend</i>, <i>Attended</i> or <i>Comment</i> for Event caches;
</li>
<li>
<i>Found it</i>, <i>Didn't find it</i> or <i>Comment</i> for all other
cache types.
cache types;
</li>
<li>
<i>Available</i>, <i>Temporarily unavailable</i> or <i>Archived</i> for
any caches owned by your user. This will set the corresponding geocache
status.
</li>
</ul>
</req>

0 comments on commit 7a6c62e

Please sign in to comment.
You can’t perform that action at this time.