Changeset 16259

Show
Ignore:
Timestamp:
07/24/08 22:55:25 (5 years ago)
Author:
hoge1e3
Message:
 
Location:
lang/actionscript/todoshare
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/todoshare/jsonDB.html

    r16061 r16259  
    1313                   //alert(httpObj); 
    1414                   //alert(httpObj.responseText); 
     15//                 $("res").value=httpObj.responseText.evalJSON(  ); 
    1516                   $("res").value=httpObj.responseText; 
     17                    
    1618                }, 
    1719                onFailure:function(httpObj) { 
  • lang/actionscript/todoshare/nohada.cgi

    r16147 r16259  
    1313my $scr=<<'EOF'; 
    1414 
    15 function test() { 
    16   alert("aho"); 
     15function doFocus(target) { 
     16  var tName=target.id; 
     17  var val=function (name) { 
     18    return (name==tName?["*"]:["like",$(name).value+"%"]); 
     19  } 
     20  var list=[ 
     21     "FINDREL" , 
     22     val("obj"), 
     23     val("name"), 
     24     val("val") 
     25  ]; 
     26   
     27  $("test").innerHTML=Object.toJSON(list); 
     28  get(list,function(data) { 
     29     var cand=data.map(function (e) { 
     30         return e[tName]; 
     31     }).sort().uniq(); 
     32     $("test").innerHTML=cand.length; 
     33     if (cand.length==1) {$(tName).value=cand[0];} 
     34     else {sugs[tName].candidateList=cand;} 
     35  }); 
     36} 
     37function get(cmd,onComplete) { 
     38   new Ajax.Request("db.cgi", { 
     39                method: "put", 
     40                parameters: 'cmd='+encodeURI(Object.toJSON(cmd)) , 
     41                onSuccess:function(httpObj){ 
     42                   //alert(httpObj); 
     43                   //alert(httpObj.responseText); 
     44                   try { 
     45                     onComplete( httpObj.responseText.evalJSON() ); 
     46                   } catch(e) {$("test").innerHTML=e;} 
     47                   //$("test").innerHTML=httpObj.responseText; 
     48                    
     49                }, 
     50                onFailure:function(httpObj) { 
     51                   $("test").innerHTML=httpObj.responseText; 
     52                } 
     53   }); 
    1754} 
    1855 
     56var sugs=[]; 
     57function init(id) { 
     58   sugs[id]= new Suggest.Local( 
     59             id, id+"_suggest",[id,id+"!"], 
     60             {dispAllKey: true});    
     61}  
     62var start = function(){ 
     63   init("obj"); 
     64   init("name"); 
     65   init("val"); 
     66}; 
     67function () {    
     68              var suggest = new Suggest.LocalMulti("obj", "suggest", 
     69               list[0/*document.getElementById('select').selectedIndex*/], {dispAllKey: true}); 
     70              /*var select = document.getElementById('select') 
     71              var change = function(){ 
     72                suggest.candidateList = list[select.selectedIndex]; 
     73              }; 
     74              select.addEventListener ? 
     75                select.addEventListener('change', change, false) : 
     76                select.attachEvent('onchange', change);*/ 
     77}; 
     78window.addEventListener ? 
     79  window.addEventListener('load', start, false) : 
     80  window.attachEvent('onload', start); 
     81 
    1982EOF 
     83my $style=<<'EOF'; 
     84div.suggest { 
     85    position: absolute; 
     86    background-color: #FFFFFF; 
     87    border: 1px solid #CCCCFF; 
     88    font-size: 90%; 
     89    width: 200px; 
     90} 
     91div.select{ /* キー上下で選択した場合のスタイル */ 
     92    color: #FFFFFF; 
     93    background-color: #3366FF; 
     94} 
     95div.over{ /* マウスオーバ時のスタイル */ 
     96    background-color: #99CCFF; 
     97} 
     98EOF 
     99 
    20100 
    21101&Html::p( 
     
    23103    [head, 
    24104      [title,"のはだ"], 
    25       [script(src=>"prototype.js")], 
     105      script(src=>"prototype.js"), 
     106      script(src=>"suggest.js"), 
    26107      [script,$scr], 
     108      [style,$style], 
    27109    ], 
    28110    [body,[center, 
    29       [table, 
    30         [&tr, 
    31           [td,input(type=>"text",name=>"obj",size=>50),"の"], 
    32         ],"\n", 
    33         [&tr, 
    34           [td,input(type=>"text",name=>"name",size=>50),"は"], 
    35         ],"\n", 
    36         [&tr, 
    37           [td,input(type=>"text",name=>"val",size=>50),"だ"], 
    38         ],"\n", 
    39       ], 
    40       [button(onClick=>"test()"),"OK"], 
     111      [table,"\n", 
     112        &area("obj","の"),"\n", 
     113        &area("name","は"),"\n", 
     114        &area("val","だ"),"\n", 
     115      ],"\n", 
     116      [button(onClick=>"test()"),"OK"],[div(id=>"test"),"test"] 
    41117    ]] 
    42118  ] 
    43119); 
     120 
     121sub area { 
     122  my ($id,$tail)=@_; 
     123  [&tr, 
     124       [td, 
     125            input(id=>$id,type=>"text",name=>$id,size=>50 
     126                  ,onFocus=>"doFocus(this)", autocomplete=>"off" ), 
     127            $tail, 
     128            div(id=>"$id\_suggest",class=>"suggest")] 
     129  ]; 
     130} 
     131 
  • lang/actionscript/todoshare/perl/HtmlTag.pm

    r16061 r16259  
    227227sub s { closure q(s),@_;} 
    228228sub samp { closure q(samp),@_;} 
    229 sub script { closure q(script),@_;} 
     229sub script {my %params=@_; sub { 
     230    my $t=shift; 
     231    $t->out("<script "); 
     232    while (my ($k,$v)= each %params) { 
     233       $t->out(&stream::sym($k)."=".&stream::attr($v)." " );  
     234    } 
     235    if (@_>0) { 
     236      $t->out(">\n//<!--\n"); 
     237      for (@_) { 
     238         $t->out($_); 
     239      } 
     240      $t->out("\n//-->\n</script>"); 
     241    } else { 
     242      $t->out("></script>"); 
     243    } 
     244  }; 
     245} 
    230246sub select { closure q(select),@_;} 
    231247sub server { closure q(server),@_;} 
  • lang/actionscript/todoshare/perl/Obj.pm

    r16091 r16259  
    372372  my @res; 
    373373  while (my ($k,$v)=each %{$w}) { 
     374      next if (&isAny($v)); 
    374375      push @res, &whereElem($k,$v);  
    375376  }