-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Flash upload with Uppy, refs #13319
This commit removes the YAHOO.widget.Uploader SFW Flash library. The mulitupload window now uses Uppy.io to achieve equivalent functionality. - Uppy UI strings will be available for translation in Weblate. - Uppy will respect AtoM's file size limits. - Includes bulk title update screen.
- Loading branch information
Showing
18 changed files
with
17,353 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
apps/qubit/modules/informationobject/actions/multiFileUpdateAction.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Access to Memory (AtoM) software. | ||
* | ||
* Access to Memory (AtoM) is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Access to Memory (AtoM) is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Access to Memory (AtoM). If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
class InformationObjectMultiFileUpdateAction extends sfAction | ||
{ | ||
protected $informationObjectList = array(); | ||
protected $informationObjectOrignalTitles = array(); | ||
|
||
public function execute($request) | ||
{ | ||
$this->resource = $this->getRoute()->resource; | ||
|
||
// Check user authorization | ||
if (!QubitAcl::check($this->resource, 'update')) | ||
{ | ||
QubitAcl::forwardUnauthorized(); | ||
} | ||
|
||
// Check that object exists and that it is not the root | ||
if (!isset($this->resource) || !isset($this->resource->parent)) | ||
{ | ||
$this->forward404(); | ||
} | ||
|
||
if (isset($request->items)) | ||
{ | ||
if (false === $this->items = explode(",", $request->items)) | ||
{ | ||
$this->forward404(); | ||
} | ||
|
||
foreach ($this->items as $slug) | ||
{ | ||
if (null !== $io = QubitInformationObject::getBySlug($slug)) | ||
{ | ||
if (!QubitAcl::check($io, 'update')) | ||
{ | ||
continue; | ||
} | ||
|
||
// Child IOs should not be root and should be direct descendants of resource. | ||
if (!isset($io->parent) || $io->parentId !== $this->resource->id) | ||
{ | ||
continue; | ||
} | ||
|
||
$this->informationObjectList[$slug] = $io; | ||
$this->informationObjectOrignalTitles[$slug] = $io->title; | ||
} | ||
else | ||
{ | ||
continue; | ||
} | ||
} | ||
} | ||
|
||
$this->digitalObjectTitleForm = new DigitalObjectTitleUpdateForm(array(), | ||
array('informationObjects' => $this->informationObjectList)); | ||
|
||
// Handle POST data (form submit) | ||
if ($request->isMethod('post')) | ||
{ | ||
$this->digitalObjectTitleForm->bind($request->titles); | ||
|
||
if ($this->digitalObjectTitleForm->isValid()) | ||
{ | ||
$this->updateDigitalObjectTitles(); | ||
$this->redirect(array($this->resource, 'module' => 'informationobject')); | ||
} | ||
} | ||
|
||
$this->populateDigitalObjectTitleForm(); | ||
} | ||
|
||
/** | ||
* Populate the ui_label form with database values (localized) | ||
*/ | ||
protected function populateDigitalObjectTitleForm() | ||
{ | ||
foreach ($this->digitalObjectTitleForm->getInformationObjects() as $io) | ||
{ | ||
$this->digitalObjectTitleForm->setDefault($io->id, $io->getTitle(array('cultureFallback' => true))); | ||
} | ||
} | ||
|
||
/** | ||
* Update ui_label db values with form values (localized) | ||
* | ||
* @return $this | ||
*/ | ||
protected function updateDigitalObjectTitles() | ||
{ | ||
foreach ($this->digitalObjectTitleForm->getInformationObjects() as $informationObject) | ||
{ | ||
if (null !== $title = $this->digitalObjectTitleForm->getValue($informationObject->id)) | ||
{ | ||
// Test if title changed. | ||
if ($this->informationObjectOrignalTitles[$informationObject->id] !== $title) | ||
{ | ||
$informationObject->title = $title; | ||
$informationObject->save(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
apps/qubit/modules/informationobject/templates/multiFileUpdateSuccess.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php decorate_with('layout_1col.php') ?> | ||
|
||
<?php slot('title') ?> | ||
<h1 class="multiline"> | ||
<?php echo __('Update digital object titles') ?> | ||
<span class="sub"><?php echo render_title(new sfIsadPlugin($resource)) ?> </span> | ||
</h1> | ||
<?php end_slot() ?> | ||
|
||
<?php slot('content') ?> | ||
|
||
<?php echo $digitalObjectTitleForm->renderGlobalErrors() ?> | ||
<?php echo $digitalObjectTitleForm->renderFormTag(url_for(array($resource, 'module' => 'informationobject', 'action' => 'multiFileUpdate', 'items' => $sf_request->items)), array('method' => 'post', 'id' => 'bulk-title-update-form')) ?> | ||
<?php echo $digitalObjectTitleForm->renderHiddenFields() ?> | ||
|
||
<div id="content"> | ||
|
||
<table class="table sticky-enabled"> | ||
<thead> | ||
<tr> | ||
<th><?php echo __('Object')?></th> | ||
<th><?php echo __('Title')?></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($digitalObjectTitleForm->getInformationObjects() as $io): ?> | ||
<tr> | ||
<td class="thumbnail-container"> | ||
<?php foreach ($io->digitalObjectsRelatedByobjectId as $do): ?> | ||
<?php if ( | ||
(null !== $thumbnail = $do->getRepresentationByUsage(QubitTerm::THUMBNAIL_ID)) | ||
&& QubitAcl::check($io, 'readThumbnail') | ||
): ?> | ||
<?php echo image_tag($thumbnail->getFullPath(), array('alt' => __($do->getDigitalObjectAltText() ?: 'Original %1% not accessible', array('%1%' => sfConfig::get('app_ui_label_digitalobject'))))) ?> | ||
<?php else: ?> | ||
<?php echo image_tag(QubitDigitalObject::getGenericIconPathByMediaTypeId($do->mediaTypeId), array('alt' => __($do->getDigitalObjectAltText() ?: 'Original %1% not accessible', array('%1%' => sfConfig::get('app_ui_label_digitalobject'))))) ?> | ||
<?php endif; ?> | ||
<?php endforeach; ?> | ||
</td> | ||
<td> | ||
<?php if ($sf_user->getCulture() != $io->getSourceCulture() && !strlen($io->title)): ?> | ||
<div class="default-translation"> | ||
<?php echo render_value($digitalObjectTitleForm[$io->id]->getValue(), $io) ?> | ||
</div> | ||
<?php endif; ?> | ||
|
||
<?php echo $digitalObjectTitleForm[$io->id] | ||
->label(__('Title')) ?> | ||
<?php echo __($io->digitalObjectsRelatedByobjectId[0]->name) ?> | ||
<?php echo render_show(__('Level of description'), render_value_inline($io->levelOfDescription)) ?> | ||
</td> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<section class="actions"> | ||
<ul> | ||
<li><input class="c-btn c-btn-submit" id="rename-form-submit" type="submit" value="<?php echo __('Save') ?>"/></li> | ||
</ul> | ||
</section> | ||
</form> | ||
|
||
<?php end_slot() ?> |
Oops, something went wrong.