Changeset 16425 for lang/actionscript

Show
Ignore:
Timestamp:
07/25/08 20:51:33 (4 months ago)
Author:
hoge1e3
Message:
 
Location:
lang/actionscript/todoshare
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/todoshare/index.cgi

    r16061 r16425  
    1616      [h1,"メニュー"], 
    1717       link("todo.cgi","Todo"), 
     18       link("nohada.cgi","のはだ"), 
    1819       link("swkText.cgi","SWK(Text Mode)"), 
    1920       link("DBConsoleFlash.html","SWK(Flash Mode)"), 
  • lang/actionscript/todoshare/nohada.cgi

    r16259 r16425  
    2626   
    2727  $("test").innerHTML=Object.toJSON(list); 
    28   get(list,function(data) { 
     28  db(list,function(data) { 
    2929     var cand=data.map(function (e) { 
    3030         return e[tName]; 
    3131     }).sort().uniq(); 
    32      $("test").innerHTML=cand.length; 
     32     print(cand.join(", ")); 
    3333     if (cand.length==1) {$(tName).value=cand[0];} 
    3434     else {sugs[tName].candidateList=cand;} 
    3535  }); 
    3636} 
    37 function get(cmd,onComplete) { 
     37function db(cmd,onComplete) { 
    3838   new Ajax.Request("db.cgi", { 
    3939                method: "put", 
    4040                parameters: 'cmd='+encodeURI(Object.toJSON(cmd)) , 
    4141                onSuccess:function(httpObj){ 
    42                    //alert(httpObj); 
    43                    //alert(httpObj.responseText); 
    4442                   try { 
    4543                     onComplete( httpObj.responseText.evalJSON() ); 
    46                    } catch(e) {$("test").innerHTML=e;} 
    47                    //$("test").innerHTML=httpObj.responseText; 
    48                     
     44                   } catch(e) {print(e);} 
    4945                }, 
    5046                onFailure:function(httpObj) { 
    51                    $("test").innerHTML=httpObj.responseText; 
     47                   print (httpObj.responseText); 
    5248                } 
    5349   }); 
     50} 
     51function print(c) { 
     52  $("test").innerHTML=c; 
    5453} 
    5554 
     
    6564   init("val"); 
    6665}; 
    67 function () {    
    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 }; 
     66function exe() { 
     67   db(["MAKEREL",  
     68      $("obj").value, 
     69      $("name").value, 
     70      $("val").value],function (res) { 
     71      print (Object.toJSON(res)); 
     72      clearForm(); 
     73   }); 
     74} 
     75function clearForm(target) { 
     76      $("obj").value=""; 
     77      $("name").value=""; 
     78      $("val").value=""; 
     79} 
     80 
    7881window.addEventListener ? 
    7982  window.addEventListener('load', start, false) : 
     
    114117        &area("val","だ"),"\n", 
    115118      ],"\n", 
    116       [button(onClick=>"test()"),"OK"],[div(id=>"test"),"test"] 
     119      [button(onClick=>"exe(this)"),"OK"], 
     120      [button(onClick=>"clearForm(this)"),"Clear"], 
     121      [div(id=>"test"),"test"] 
    117122    ]] 
    118123  ] 
  • lang/actionscript/todoshare/perl/Obj.pm

    r16259 r16425  
    318318        return array($res); 
    319319    } elsif ($cmd->[0] eq 'MAKEREL') { 
     320        my $res=&exe( ["FINDREL",$cmd->[1],$cmd->[2],$cmd->[3]] ); 
     321        if (@$res>0) { 
     322           return ["EXISTS"]; 
     323        } 
    320324            return &exe(["INSERT",$relName, { 
    321325               obj => $cmd->[1], 
     
    326330            # ["FINDREL", obj , name ]  
    327331            my $where={}; 
    328             $where->{obj} = $cmd->[1] if ($cmd->[1] and $cmd->[1] ne &any); 
    329             $where->{name}= $cmd->[2] if ($cmd->[2] and $cmd->[2] ne &any); 
    330             $where->{val} = $cmd->[3] if ($cmd->[3] and $cmd->[3] ne &any); 
     332            $where->{obj} = $cmd->[1] if ($cmd->[1] and not &isAny($cmd->[1])); 
     333            $where->{name}= $cmd->[2] if ($cmd->[2] and not &isAny($cmd->[2])); 
     334            $where->{val} = $cmd->[3] if ($cmd->[3] and not &isAny($cmd->[3])); 
    331335            return &exe(["GET", { 
    332336                    from=> $relName,