Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

November bug fixes #125

Merged
merged 3 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions repos/annotation-studio/config/services.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use Digirati\OmekaShared\Factory\UrlHelperFactory;
use Digirati\OmekaShared\Helper\SettingsHelper;
use Digirati\OmekaShared\Helper\UrlHelper;
use Omeka\Settings\Settings;
use Psr\Container\ContainerInterface;
use Zend\Http\Request;
use Zend\I18n\Translator\TranslatorInterface;
use Zend\Uri\Uri;

return [
'service_manager' => [
Expand All @@ -31,7 +31,7 @@
);
},
ModerationStatusVerificationSubscriber::class => function (ContainerInterface $c) {
/** @var \Omeka\Settings\Settings $config */
/** @var Settings $config */
$config = $c->get('Omeka\Settings');
/** @var Request $request */
$request = $c->get('Request');
Expand Down
1 change: 0 additions & 1 deletion repos/annotation-studio/src/Admin/ConfigurationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace AnnotationStudio\Admin;

use AnnotationStudio\AnnotationStudio;
use Digirati\OmekaShared\Framework\AbstractConfigurationForm;
use GuzzleHttp\Client;
use Zend\Form\Element;
Expand Down
13 changes: 12 additions & 1 deletion repos/annotation-studio/src/AnnotationStudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AnnotationStudio
private $components;
private $isLocked = false;
private $debug = false;
private $googleMapApiKey;

public function __construct()
{
Expand Down Expand Up @@ -72,13 +73,16 @@ public function getAssets($baseUrl = '')
);
}


return implode("\n", [
sprintf(
'<script type="application/javascript" src="%s"></script>',
$bundle
),
$this->debug ? $this->getWarning() : '',
$this->googleMapApiKey ? sprintf(
'<script src="https://maps.googleapis.com/maps/api/js?key=%s&libraries=places"></script>',
$this->googleMapApiKey
) : '',
sprintf(
'<link rel="stylesheet" type="text/css" href="https://unpkg.com/@annotation-studio/bundle@%s/umd/main.css" />',
$this->getVersion()
Expand All @@ -93,6 +97,13 @@ public function addComponent($name, Component $component)
}
}

public function setGoogleMapApiKey(string $key)
{
$this->googleMapApiKey = $key;

return $this;
}

public function __get($name)
{
return $this->__call($name, []);
Expand Down
20 changes: 18 additions & 2 deletions repos/iiif-storage/asset/css/iiif-storage.css
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,34 @@
.c-image {
position: relative;;
}
.c-image__status--started:after {

.c-image__status--started:after,
.c-image__status--complete:after {
position: absolute;
bottom: -2px;
border: 2px solid #000;
right: -7px;
width: 14px;
height: 14px;
content: '';
background: dodgerblue;
border-radius: 50%;
}

.c-image__status--started:after {
background: #ffc645;
}

.c-image__status--complete:after {
background: #37804a;
content: '✔';
color: #fff;
font-size: 11px;
right: -9px;
bottom: -4px;
width: 18px;
height: 18px;
}

.info-panel {
background: palegoldenrod;
color: #333;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
height="{{ thumbnailWidth | default(150) }}"
alt="{{ thumbnailAlt | default('Image thumbnail') }}"/>
{% if (showImageStatus | default(true)) %}
{% if image.complete %}
{% if image.completed %}
{% set statusClass = 'complete' %}
{% set statusTitle = translate('Editing complete') %}
{% elseif image.edited %}
Expand Down
7 changes: 5 additions & 2 deletions repos/public-user/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,11 @@ public function attachListeners(SharedEventManagerInterface $sharedEventManager)
'label' => 'New user role', // @translate
'info' => 'The user role for users when registering' // @translate
])
->setValueOptions($roles)
->setValue($form->getSiteSettings()->get('public-user-registration-role', 'researcher'))
->setValueOptions([
// This can only be transcriber for the time being.
'transcriber' => 'Transcriber'
])
->setValue($form->getSiteSettings()->get('public-user-registration-role', 'transcriber'))
)
->add(
(new Checkbox('public-user-profile-logged-in'))
Expand Down
8 changes: 7 additions & 1 deletion repos/public-user/src/Settings/PublicUserSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ public function isActivationAutomatic()
*/
public function getDefaultUserRole()
{
return (string) $this->currentSiteSettings->get(self::DEFAULT_NEW_ROLE);
$role = (string) $this->currentSiteSettings->get(self::DEFAULT_NEW_ROLE, 'transcriber');

if ($role !== 'transcriber') {
error_log('Warning: One of your sites is configured to give users permissions on this Madoc site.');
}

return 'transcriber';
}

public function isUserProfilesEnabled(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function handleAnnotationLifecycleEvent(AnnotationLifecycleEvent $event,
} elseif (self::CROWDS_MOTIVATION_DRAFTING === $motivation) {
$this->log(Logger::DEBUG, 'Found incomplete annotation');
$incomplete = true;
} elseif (!in_array($motivation, self::OA_MOTIVATION_IGNORE, true)) {
} elseif (self::CROWDS_MOTIVATION_COMPLETED === $motivation) {
$this->log(Logger::DEBUG, 'Found completion annotation');
$complete = true;
}
Expand Down
10 changes: 6 additions & 4 deletions repos/public-user/src/Subscriber/ManifestStatsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ public function viewManifest(Event $event) {

if ($omekaId && $map[(string)$omekaId] ?? null) {
$stats = $map[(string)$omekaId];
$incomplete = $stats['incomplete_count'] ?: 0;
$complete = $stats['complete_count'] ?: 0;
$bookmarks = $stats['bookmarks'] ?: 0;

$incomplete = intval($stats['incomplete_count'], 10) ?? 0;
$complete = intval($stats['complete_count'], 10) ?? 0;
$bookmarks = intval($stats['bookmarks'], 10) ?? 0;

$canvas->addMetaData([
'edited' => $incomplete,
'completed' => $complete > 0 && $incomplete === 0,
// Incomplete count does not reset when marking as complete.
'completed' => $complete > 0 /*&& $incomplete === 0*/,
'totalBookmarks' => $bookmarks,
]);
}
Expand Down