filer: replace "file as" prompt with combobox opened in fancybox
This commit is contained in:
		
					parent
					
						
							
								7aec2fd68d
							
						
					
				
			
			
				commit
				
					
						0a2675d8b6
					
				
			
		
					 6 changed files with 145 additions and 29 deletions
				
			
		| 
						 | 
				
			
			@ -16,8 +16,20 @@ function filer_content(&$a) {
 | 
			
		|||
 | 
			
		||||
	logger('filer: tag ' . $term . ' item ' . $item_id);
 | 
			
		||||
 | 
			
		||||
	if($item_id && strlen($term))
 | 
			
		||||
	if($item_id && strlen($term)){
 | 
			
		||||
		// file item
 | 
			
		||||
		file_tag_save_file(local_user(),$item_id,$term);
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
		// return filer dialog
 | 
			
		||||
		$filetags = get_pconfig(local_user(),'system','filetags');
 | 
			
		||||
		$filetags = explode("][", trim($filetags,"[]"));
 | 
			
		||||
		$tpl = get_markup_template("filer_dialog.tpl");
 | 
			
		||||
		$o = replace_macros($tpl, array(
 | 
			
		||||
			'$field' => array('term', t("File as:"), '', '', $filetags, t('- select -')),
 | 
			
		||||
			'$submit' => t('Save'),
 | 
			
		||||
		));
 | 
			
		||||
		
 | 
			
		||||
		echo $o;
 | 
			
		||||
	}
 | 
			
		||||
	killme();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								view/filer_dialog.tpl
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								view/filer_dialog.tpl
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
{{ inc field_combobox.tpl }}{{ endinc }}
 | 
			
		||||
<div class="settings-submit-wrapper" >
 | 
			
		||||
	<input id="filer_save" type="button" class="settings-submit" value="$submit" />
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			@ -264,15 +264,36 @@ function enableOnUser(){
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	function itemFiler(id) {
 | 
			
		||||
		reply = prompt("$fileas");
 | 
			
		||||
		if(reply && reply.length) {
 | 
			
		||||
			commentBusy = true;
 | 
			
		||||
			$('body').css('cursor', 'wait');
 | 
			
		||||
			$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
			if(timer) clearTimeout(timer);
 | 
			
		||||
			timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
			liking = 1;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		var bordercolor = $("input").css("border-color");
 | 
			
		||||
		
 | 
			
		||||
		$.get('filer/', function(data){
 | 
			
		||||
			$.fancybox(data);
 | 
			
		||||
			$("#id_term").keypress(function(){
 | 
			
		||||
				$(this).css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			$("#select_term").change(function(){
 | 
			
		||||
				$("#id_term").css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			
 | 
			
		||||
			$("#filer_save").click(function(e){
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				reply = $("#id_term").val();
 | 
			
		||||
				if(reply && reply.length) {
 | 
			
		||||
					commentBusy = true;
 | 
			
		||||
					$('body').css('cursor', 'wait');
 | 
			
		||||
					$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
					if(timer) clearTimeout(timer);
 | 
			
		||||
					timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
					liking = 1;
 | 
			
		||||
					$.fancybox.close();
 | 
			
		||||
				} else {
 | 
			
		||||
					$("#id_term").css("border-color","#FF0000");
 | 
			
		||||
				}
 | 
			
		||||
				return false;
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function jotClearLocation() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -264,17 +264,39 @@ function enableOnUser(){
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	function itemFiler(id) {
 | 
			
		||||
		reply = prompt("$fileas");
 | 
			
		||||
		if(reply && reply.length) {
 | 
			
		||||
			commentBusy = true;
 | 
			
		||||
			$('body').css('cursor', 'wait');
 | 
			
		||||
			$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
			if(timer) clearTimeout(timer);
 | 
			
		||||
			timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
			liking = 1;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		var bordercolor = $("input").css("border-color");
 | 
			
		||||
		
 | 
			
		||||
		$.get('filer/', function(data){
 | 
			
		||||
			$.fancybox(data);
 | 
			
		||||
			$("#id_term").keypress(function(){
 | 
			
		||||
				$(this).css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			$("#select_term").change(function(){
 | 
			
		||||
				$("#id_term").css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			
 | 
			
		||||
			$("#filer_save").click(function(e){
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				reply = $("#id_term").val();
 | 
			
		||||
				if(reply && reply.length) {
 | 
			
		||||
					commentBusy = true;
 | 
			
		||||
					$('body').css('cursor', 'wait');
 | 
			
		||||
					$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
					if(timer) clearTimeout(timer);
 | 
			
		||||
					timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
					liking = 1;
 | 
			
		||||
					$.fancybox.close();
 | 
			
		||||
				} else {
 | 
			
		||||
					$("#id_term").css("border-color","#FF0000");
 | 
			
		||||
				}
 | 
			
		||||
				return false;
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	function jotClearLocation() {
 | 
			
		||||
		$('#jot-coord').val('');
 | 
			
		||||
		$('#profile-nolocation-wrapper').hide();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -264,17 +264,39 @@ function enableOnUser(){
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	function itemFiler(id) {
 | 
			
		||||
		reply = prompt("$fileas");
 | 
			
		||||
		if(reply && reply.length) {
 | 
			
		||||
			commentBusy = true;
 | 
			
		||||
			$('body').css('cursor', 'wait');
 | 
			
		||||
			$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
			if(timer) clearTimeout(timer);
 | 
			
		||||
			timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
			liking = 1;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		var bordercolor = $("input").css("border-color");
 | 
			
		||||
		
 | 
			
		||||
		$.get('filer/', function(data){
 | 
			
		||||
			$.fancybox(data);
 | 
			
		||||
			$("#id_term").keypress(function(){
 | 
			
		||||
				$(this).css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			$("#select_term").change(function(){
 | 
			
		||||
				$("#id_term").css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			
 | 
			
		||||
			$("#filer_save").click(function(e){
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				reply = $("#id_term").val();
 | 
			
		||||
				if(reply && reply.length) {
 | 
			
		||||
					commentBusy = true;
 | 
			
		||||
					$('body').css('cursor', 'wait');
 | 
			
		||||
					$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
					if(timer) clearTimeout(timer);
 | 
			
		||||
					timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
					liking = 1;
 | 
			
		||||
					$.fancybox.close();
 | 
			
		||||
				} else {
 | 
			
		||||
					$("#id_term").css("border-color","#FF0000");
 | 
			
		||||
				}
 | 
			
		||||
				return false;
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	function jotClearLocation() {
 | 
			
		||||
		$('#jot-coord').val('');
 | 
			
		||||
		$('#profile-nolocation-wrapper').hide();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -304,6 +304,41 @@ function initEditor(cb) {
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	function itemFiler(id) {
 | 
			
		||||
		
 | 
			
		||||
		var bordercolor = $("input").css("border-color");
 | 
			
		||||
		
 | 
			
		||||
		$.get('filer/', function(data){
 | 
			
		||||
			$.fancybox(data);
 | 
			
		||||
			$("#id_term").keypress(function(){
 | 
			
		||||
				$(this).css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			$("#select_term").change(function(){
 | 
			
		||||
				$("#id_term").css("border-color",bordercolor);
 | 
			
		||||
			})
 | 
			
		||||
			
 | 
			
		||||
			$("#filer_save").click(function(e){
 | 
			
		||||
				e.preventDefault();
 | 
			
		||||
				reply = $("#id_term").val();
 | 
			
		||||
				if(reply && reply.length) {
 | 
			
		||||
					commentBusy = true;
 | 
			
		||||
					$('body').css('cursor', 'wait');
 | 
			
		||||
					$.get('filer/' + id + '?term=' + reply);
 | 
			
		||||
					if(timer) clearTimeout(timer);
 | 
			
		||||
					timer = setTimeout(NavUpdate,3000);
 | 
			
		||||
					liking = 1;
 | 
			
		||||
					$.fancybox.close();
 | 
			
		||||
				} else {
 | 
			
		||||
					$("#id_term").css("border-color","#FF0000");
 | 
			
		||||
				}
 | 
			
		||||
				return false;
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	function jotClearLocation() {
 | 
			
		||||
		$('#jot-coord').val('');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue