]> git.mxchange.org Git - friendica.git/commitdiff
filer: replace "file as" prompt with combobox opened in fancybox
authorFabio Comuni <fabrix.xm@gmail.com>
Wed, 28 Mar 2012 08:49:34 +0000 (10:49 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Wed, 28 Mar 2012 08:49:34 +0000 (10:49 +0200)
mod/filer.php
view/filer_dialog.tpl [new file with mode: 0644]
view/jot-header.tpl
view/theme/dispy-dark/jot-header.tpl
view/theme/dispy/jot-header.tpl
view/theme/testbubble/jot-header.tpl

index a9e2135361d147dc64207860bc36d553fa3e0043..82537848ba11f12415640b66e94df1c2ec32f28b 100755 (executable)
@@ -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();
 }
diff --git a/view/filer_dialog.tpl b/view/filer_dialog.tpl
new file mode 100644 (file)
index 0000000..ae837d6
--- /dev/null
@@ -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>
index 99e3aa0ec5eba0a20144f1968d28925b2bbd60fe..67e5eb6810748d4d3fe842f9c8872e8448f0ed29 100755 (executable)
@@ -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() {
index 4c8f59d7969bd2348ebbacf1d3daa26da4f6f4e2..92eccf74012dcafc20ac1e89c2a6a76e53c69fd8 100644 (file)
@@ -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();
index 4c8f59d7969bd2348ebbacf1d3daa26da4f6f4e2..92eccf74012dcafc20ac1e89c2a6a76e53c69fd8 100644 (file)
@@ -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();
index b44ea78fddafb53a105cb5fe07192f4d7e9f5928..0d11da271758c35e6df778d90fbae59f9b17ea37 100755 (executable)
@@ -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('');