filer: replace "file as" prompt with combobox opened in fancybox

This commit is contained in:
Fabio Comuni 2012-03-28 10:49:34 +02:00
parent 7aec2fd68d
commit 0a2675d8b6
6 changed files with 145 additions and 29 deletions

View File

@ -16,8 +16,20 @@ function filer_content(&$a) {
logger('filer: tag ' . $term . ' item ' . $item_id); 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); 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(); killme();
} }

4
view/filer_dialog.tpl Normal file
View 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>

View File

@ -264,15 +264,36 @@ function enableOnUser(){
} }
function itemFiler(id) { function itemFiler(id) {
reply = prompt("$fileas");
if(reply && reply.length) { var bordercolor = $("input").css("border-color");
commentBusy = true;
$('body').css('cursor', 'wait'); $.get('filer/', function(data){
$.get('filer/' + id + '?term=' + reply); $.fancybox(data);
if(timer) clearTimeout(timer); $("#id_term").keypress(function(){
timer = setTimeout(NavUpdate,3000); $(this).css("border-color",bordercolor);
liking = 1; })
} $("#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() { function jotClearLocation() {

View File

@ -264,17 +264,39 @@ function enableOnUser(){
} }
function itemFiler(id) { function itemFiler(id) {
reply = prompt("$fileas");
if(reply && reply.length) { var bordercolor = $("input").css("border-color");
commentBusy = true;
$('body').css('cursor', 'wait'); $.get('filer/', function(data){
$.get('filer/' + id + '?term=' + reply); $.fancybox(data);
if(timer) clearTimeout(timer); $("#id_term").keypress(function(){
timer = setTimeout(NavUpdate,3000); $(this).css("border-color",bordercolor);
liking = 1; })
} $("#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() { function jotClearLocation() {
$('#jot-coord').val(''); $('#jot-coord').val('');
$('#profile-nolocation-wrapper').hide(); $('#profile-nolocation-wrapper').hide();

View File

@ -264,17 +264,39 @@ function enableOnUser(){
} }
function itemFiler(id) { function itemFiler(id) {
reply = prompt("$fileas");
if(reply && reply.length) { var bordercolor = $("input").css("border-color");
commentBusy = true;
$('body').css('cursor', 'wait'); $.get('filer/', function(data){
$.get('filer/' + id + '?term=' + reply); $.fancybox(data);
if(timer) clearTimeout(timer); $("#id_term").keypress(function(){
timer = setTimeout(NavUpdate,3000); $(this).css("border-color",bordercolor);
liking = 1; })
} $("#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() { function jotClearLocation() {
$('#jot-coord').val(''); $('#jot-coord').val('');
$('#profile-nolocation-wrapper').hide(); $('#profile-nolocation-wrapper').hide();

View File

@ -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() { function jotClearLocation() {
$('#jot-coord').val(''); $('#jot-coord').val('');