Project

General

Profile

« Previous | Next » 

Revision 44426

ticket #2399

View differences:

modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/repos/repoApi.st
57 57
				</span>
58 58
			</div>
59 59
			<span class="input-group-btn">
60
				<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editAccessParamsModal">access params</button>
60
				<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editAccessParamsModal" ng-click="prepareUpdateRepoApi()">access params</button>
61 61
			</span>
62 62
		</div>
63 63
		
......
176 176
			<div class="modal-body">
177 177
				<div class="well">
178 178
					<form class="form-horizontal" role="form">
179
						<div class="form-group" ng-repeat="p in currentRepoApi.accessParams">
179
						<div class="form-group" ng-repeat="p in tempAccessParams">
180 180
							<label for="input_ap_{{p.name}}" class="col-sm-3 control-label">{{p.name}}</label>
181 181
							<div class="col-sm-9" ng-hide="currentRepoApi.protocol == 'oai' && p.name == 'set'">
182 182
								<input type="text" class="form-control" id="input_ap_{{p.name}}" ng-model="p.value"/>
183 183
							</div>
184 184
							<div class="col-sm-9" ng-show="currentRepoApi.protocol == 'oai' && p.name == 'set'"> 
185
								<select class="form-control" style="font-size: 11px" size="10" multiple ng-model="selectedSets" ng-change="updateSets(selectedSets, currentRepoApi.accessParams)">
185
								<select class="form-control" style="font-size: 11px" size="10" multiple ng-model="selectedSets" ng-change="updateSets(selectedSets, tempAccessParams)">
186 186
									<option ng-repeat="set in currentSets" value="{{set.id}}" ng-selected="set.selected">{{set.name}}</option>
187 187
								</select>
188 188
								<span><b>Current set(s): </b>{{selectedSets.join(', ')}}</span>
189
								<button class="btn btn-xs btn-default pull-right" style="margin-top: 4px" ng-click="listSets(currentRepoApi.accessParams)"><span class="glyphicon glyphicon-refresh"></span> refresh</button>
189
								<button class="btn btn-xs btn-default pull-right" style="margin-top: 4px" ng-click="listSets(tempAccessParams)"><span class="glyphicon glyphicon-refresh"></span> refresh</button>
190 190
							</div>
191 191
  						</div>
192
  						<div class="form-group" ng-repeat="p in currentRepoApi.otherParams" ng-if="p.name == 'metadata_identifier_path'">
192
  						<div class="form-group">
193 193
							<label for="input_mdid_path" class="col-sm-3 control-label">ID XPath</label>
194 194
							<div class="col-sm-9">
195
								<input type="text" class="form-control" id="input_mdid_path" ng-model="p.value"/>
195
								<input type="text" class="form-control" id="input_mdid_path" ng-model="tempMdIdPath"/>
196 196
							</div>
197 197
  						</div>
198 198
 					</form>
modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/repoControllers.js
273 273
			});
274 274
		}
275 275
	
276
		$scope.prepareUpdateRepoApi = function() {
277
			$scope.tempAccessParams = angular.copy($scope.currentRepoApi.accessParams); 
278

  
279
			$scope.tempMdIdPath = '';
280
			angular.forEach($scope.currentRepoApi.otherParams, function(param, pos){
281
	            if (param.name == 'metadata_identifier_path') {
282
	            	$scope.tempMdIdPath = param.value;
283
	            }
284
			});
285
		}
286
		
287
		
276 288
		$scope.updateRepoApi = function() {
277 289
			$scope.showSpinner();
278 290
	
279 291
			var map = {};
280
			angular.forEach($scope.currentRepoApi.accessParams, function(param, pos){
292
			angular.forEach($scope.tempAccessParams, function(param, pos){
281 293
	            if (param.name) {
282 294
	            	map[param.name] = param.value
283 295
	            }
284 296
			});
285

  
286
			var mdIdPath = '';
287
			angular.forEach($scope.currentRepoApi.otherParams, function(param, pos){
288
	            if (param.name == 'metadata_identifier_path') {
289
	            	mdIdPath = param.value;
290
	            }
291
			});
292 297
			
293
			
294 298
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
295 299
	        $http.post('repoApi.update', $.param({
296 300
	      		'id'           : $scope.currentRepoApi.repoId,
297 301
	      		'iface'        : $scope.currentRepoApi.id,
298
	      		'mdIdPath'     : mdIdPath,
302
	      		'mdIdPath'     : $scope.tempMdIdPath,
299 303
	      		'accessParams' : JSON.stringify(map)
300 304
	      	})).success(function(data) {
301 305
	      		$scope.showNotification('Api correctly saved !');

Also available in: Unified diff