⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitk_map_comps.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
字号:
function ScriptableTask(taskId, contextPath, mapId) {
	this.taskId = taskId;
	this.contextPath = contextPath;
	this.mapId = mapId;
}

function PersonalisableTask(taskId, contextPath, mapId, userId) {
	this.inheritsFrom(new ScriptableTask(taskId, contextPath, mapId));
	this.userId = userId;
}

function OpenMapCompsTask(taskId, contextPath, mapId, userId) {
	this.inheritsFrom(new PersonalisableTask(taskId, contextPath, mapId, userId));
	var displayDescriptionUponRerender = false;
	
	this.setDisplayDescriptionUponRerender = function(display) {
		displayDescriptionUponRerender = display;
	}
	
	this.getDisplayDescriptionUponRerender = function() {
		return displayDescriptionUponRerender;
	}
	
   	this.confirmDeleteMapComposition = function(confirmMsg) {
   		var mapSelectBox = document.getElementById(this.taskId + '_param_maps');
   		var mapName = this.findMapName(mapSelectBox.value);
   	
   		confirmMsg = confirmMsg.replace("{name}", mapName);
   		
   		if (confirm(confirmMsg)) {
   			return true;
   			
   			//Call to delete left inside task XSL due to number
   			//of XSL parameters that needed to be passed
   			//return deleteMapComposition();
   		}
   		
   		return false;
   	}	
   	
    this.onSortChange =	function(sortBox) {
   		var sortBtn = document.getElementById('button_' + this.taskId + '_action_sort');
   		
   		if (sortBtn) {
   			this.setDisplayDescriptionUponRerender(true);
   			
   			sortBtn.click();
   		} 
   	}  
   	
   	this.findMapName = function(selectedMapId) {
   		var mapSelectBox = document.getElementById(this.taskId + '_param_maps');
		
		for (i = 0; i < mapSelectBox.options.length; i++) {
			if (mapSelectBox.options[i].value == selectedMapId) {
				return mapSelectBox.options[i].text;
			}
		}
		    		
		return "";
   	}   
   	
    this.findMapDescription = function(selectedMapId) {
		var descSelectBox = document.getElementById(this.taskId + '_param_mapDescriptions');
		
		for (i = 0; i < descSelectBox.options.length; i++) {
			if (descSelectBox.options[i].value == selectedMapId) {
				return descSelectBox.options[i].text;
			}
		}
		    		
		return "";
   	}   		
   	
   	this.onMapSelectionChange = function(selectBox) {
   		var selectedMapId = selectBox.value;
   		var descriptionText = this.findMapDescription(selectedMapId);
   		//var descriptionUI = document.getElementById(this.taskId + '_description');
   		//descriptionUI.innerText = descriptionText;
   		
   		$("#"+this.taskId+"_description").text(descriptionText);
   		
   		this.updatePreviewImage(selectedMapId);   		
   	}
   	
   	this.updatePreviewImage = function (selectedMapId) {
        if (selectedMapId == null || selectedMapId == '') {
            return;
        }
        
        var previewImage = new JitkImagePreview(this.taskId);
        previewImage.init(document.getElementById(this.taskId + '_fieldset_preview'));
        previewImage.showPreviewImage(this.contextPath + 'maps/preview/' + this.userId + '/' + selectedMapId);   	    
   	}  
   	
   	this.openMapTaskUpdateListener = function () {
   		// if the maps have just been sorted, then display the description
   		// field for the selected map
   		if (mvsOpenMapCompsTask.getDisplayDescriptionUponRerender()) {
   			var mapSelectBox = document.getElementById(mvsOpenMapCompsTask.taskId + '_param_maps');
   			var mapDescription = mvsOpenMapCompsTask.findMapDescription(mapSelectBox.value);
   			
   			$("#" + mvsOpenMapCompsTask.taskId + "_description").text(mapDescription);
   			
   			// set the flag to false so this code is not called upon every
   			// rerender of the task
   			mvsOpenMapCompsTask.setDisplayDescriptionUponRerender(false);
   		}
   	}		
}

var mvsOpenMapCompsTask = null;

function jitkInitMapCompsTask(taskId, contextPath, mapId, userId) {
	if (mvsOpenMapCompsTask == null) {
		mvsOpenMapCompsTask = new OpenMapCompsTask(taskId, contextPath, mapId, userId);
		
		var task = EsriControls.tasks[taskId];
		
		if (task) {
			task.addUpdateListener("openMapTaskUpdateListener", mvsOpenMapCompsTask.openMapTaskUpdateListener);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -