Commit 976ffc0f authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

Implement edit dialog

parent c1724525
......@@ -5,14 +5,10 @@ angular.module('ddaApp').controller('PublicationsSourcesXmlXsltSourceEditDialogC
function($scope, $stateParams, $uibModalInstance, entity, $state, BundlesSource, MetadataTransformer) {
$scope.entity = entity;
$scope.newMetadataPrefix = '';
$scope.iso8601From = ( new Date( angular.fromJson(entity.data).from.seconds * 1000) ).toISOString();
$scope.dataDto = {
oaiPmhEndpoint: angular.fromJson(entity.data).oaiPmhEndpoint,
metadataPrefix2XsltMap: angular.fromJson(entity.data).metadataPrefix2XsltMap,
from: angular.fromJson(entity.data).from,
until: angular.fromJson(entity.data).until
xmlContent: angular.fromJson(entity.data).xmlContent,
xsltContent: angular.fromJson(entity.data).xsltContent
};
$scope.clear = function() {
......@@ -29,17 +25,7 @@ angular.module('ddaApp').controller('PublicationsSourcesXmlXsltSourceEditDialogC
var onSaveError = function (result) {
};
$scope.addMetadataPrefix = function() {
$scope.dataDto.metadataPrefix2XsltMap[$scope.newMetadataPrefix] = '';
};
$scope.removeMetadataPrefix = function(metadataPrefix) {
delete $scope.dataDto.metadataPrefix2XsltMap[metadataPrefix];
};
$scope.convertTimeString = function() {
$scope.dataDto.from.seconds = Date.parse($scope.iso8601From) / 1000;
}
$scope.save = function () {
console.log($scope.dataDto);
BundlesSource.updateData({id: $scope.entity.id}, $scope.dataDto, onSaveSuccess, onSaveError);
......
......@@ -4,51 +4,22 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
ng-click="clear()">&times;</button>
<h4 class="modal-title" id="myFileLabel">Edit XSLT-based OAI-PMH publications source</h4>
<h4 class="modal-title" id="myFileLabel">Edit XSLT-transformed XML publication source</h4>
</div>
<div class="modal-body">
<div>
<label>Base URL
<input type="text" name="input" ng-model="dataDto.oaiPmhEndpoint">
<label>XML
<textarea name="xmlContent" cols=80 rows=10 ng-model="dataDto.xmlContent"></textarea>
</label>
</div>
<div>
<table>
<tr>
<th>&nbsp;</th>
<th>Metadata prefix</th>
<th>XSLT</th>
</tr>
<tr ng-repeat="(metadataPrefix, xsltContent) in dataDto.metadataPrefix2XsltMap">
<td>
<button type="button" class="btn btn-danger" ng-click="removeMetadataPrefix(metadataPrefix)">
<span class="glyphicon glyphicon-remove"></span>
</button>
</td>
<td>{{metadataPrefix}}</td>
<td><textarea name="xslt" cols=80 rows=5 ng-model="dataDto.metadataPrefix2XsltMap[metadataPrefix]"></textarea></td>
</tr>
</table>
<input type="text" name="metadataPrefix" ng-model="newMetadataPrefix">
<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="addMetadataPrefix()">
<span class="glyphicon glyphicon-plus"></span>&nbsp;<span>Add additional metadata prefix</span>
</button>
</div>
<div>
<label>Harvest onwards from (ISO8601 format)
<input type="text" name="iso8601From" ng-model="iso8601From" ng-change="convertTimeString()">
<label>XSLT
<textarea name="xsltContent" cols=80 rows=10 ng-model="dataDto.xsltContent"></textarea>
</label>
</div>
<div>
<label for="field_metadataTransformer">Metadata transformer</label>
<select class="form-control" id="field_metadataTransformer" name="metadataTransformer" ng-model="selectedMetadataTransformer" ng-options="metadataTransformer as metadataTransformer.name for metadataTransformer in metadataTransformers track by metadataTransformer.id">
<option value=""></option>
</select>
</div>
</div>
<div>{{message}}</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="clear()">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment