2007年4月20日金曜日

dhtmlxGridの使い方(2)

最新版ではXML渡しによるリンク表示が可能となったけど、
旧バージョンでもそれが使える。
下手にバージョンアップしたく無ければ、最新パッケージをダウンロードし、

dhtmlXGrid_excell_link.js

というファイルをjsディレクトリにコピーし、
読み込ませ、

<script src="librarys/scand/js/dhtmlXGrid_excell_link.js"></script>

設定をlinkにし、

mygrid.setColTypes("link,ro,ro");

XML出力で、

<cell>ラベル^リンク先^ターゲット</cell>

としてやることで、サンプルページみたいなリンクが実現する。
出来れば、<![CDATA[]]>でくくって出力したほうがよい。

ちなみに、この手法でjavascriptを記述するのは難しい。
自動でonclickが付与されてしまう為、
リンク先にjavascriptを書いてもまともに動作しない。

dhtmlXGrid_excell_link.js を dhtmlXGrid_excell_locallink.js 
などというファイルでコピーし、



function eXcell_link(cell){
this.cell = cell;
this.grid = this.cell.parentNode.grid;
this.edit = function(){}
this.getValue = function(){
if(this.cell.firstChild.getAttribute)
return this.cell.firstChild.innerHTML+"^"+this.cell.firstChild.getAttribute("href")
else
return "";
}
this.setValue = function(val){
var valsAr = val.split("^");
this.setCValue("<a href="'#'" onclick="'(isIE()?event:arguments[0]).cancelBubble="true;">"+valsAr[0]+"</a>");
}
}



修正後は、

<cell><![CDATA[リンク名^スクリプト]]></cell>

でjavascriptをonclickで実行出来る。

2007年4月19日木曜日

svnserveプロトコル解析:delete (delete-entry)

svn delete svn://localhost/var/svn/repos/phpacc/svn-commit.2.tmp -m "DelDel"

( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline ) ) )
( 2 ( edit-pipeline ) 36:svn://localhost/var/svn/repos/phpacc )
( success ( ( ANONYMOUS ) 0: ) )
( ANONYMOUS ( 0: ) )
( success ( ) )
( check-path ( 16:svn-commit.2.tmp ( ) ) )
( success ( 36:28ddee6e-6324-0410-859d-a2726facb31c 29:svn://localhost/var/svn/repos ) )
( commit ( 6:DelDel ( ) true ) )
( success ( ( ) 0: ) )
( open-root ( ( ) 2:d0 ) )
( success ( file ) )
( success ( ( ) 0: ) )
( delete-entry ( 16:svn-commit.2.tmp ( ) 2:d0 ) )
( success ( ) )
( close-dir ( 2:d0 ) )
( success ( ) )
( close-edit ( ) )
( success ( ( ) 0: ) ) ( 5 ( 27:2007-04-18T03:07:34.681376Z ) ( ) )

2007年4月18日水曜日

svnserveプロトコル解析:co (finish-report)

svnコマンド相当:
svn co svn://localhost/var/svn/repos/phpacc/

( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline ) ) )
( 2 ( edit-pipeline ) 36:svn://localhost/var/svn/repos/phpacc )
( success ( ( ANONYMOUS ) 0: ) )
( ANONYMOUS ( 0: ) )
( success ( ) ) ( success ( 36:28ddee6e-6324-0410-859d-a2726facb31c 29:svn://localhost/var/svn/repos ) )
( get-latest-rev ( ) )
( success ( ( ) 0: ) )
( success ( 8 ) )
( update ( ( 8 ) 0: true ) )
( success ( ( ) 0: ) )
( set-path ( 0: 8 true ( ) ) )
( finish-report ( ) )
( success ( ( ) 0: ) )
( target-rev ( 8 ) )
( open-root ( ( 8 ) 2:d0 ) )
( change-dir-prop ( 2:d0 23:svn:entry:committed-rev ( 1:8 ) ) )
( change-dir-prop ( 2:d0 24:svn:entry:committed-date ( 27:2007-04-18T03:10:38.376703Z ) ) )
( change-dir-prop ( 2:d0 14:svn:entry:uuid ( 36:28ddee6e-6324-0410-859d-a2726facb31c ) ) )
( add-file ( 10:index.html 2:d0 2:c1 ( ) ) )
( change-file-prop ( 2:c1 23:svn:entry:committed-rev ( 1:2 ) ) )
( change-file-prop ( 2:c1 24:svn:entry:committed-date ( 27:2007-04-17T09:05:25.943015Z ) ) )
( change-file-prop ( 2:c1 21:svn:entry:last-author ( 4:root ) ) )
( change-file-prop ( 2:c1 14:svn:entry:uuid ( 36:28ddee6e-6324-0410-859d-a2726facb31c ) ) )
( apply-textdelta ( 2:c1 ( ) ) )
( textdelta-chunk ( 2:c1 4:SVN ) )
( textdelta-chunk ( 2:c1 5:d
L ) )
( textdelta-chunk ( 2:c1 11:BP#D#D ) )
( textdelta-chunk ( 2:c1 76:form method="post" action="svn.php"
input name="ssssss" type="text"

) )
( textdelta-end ( 2:c1 ) )
( close-file ( 2:c1 ( 32:3bbb8bf02e6d2087ab1ad7dba1d625ad ) ) )
( add-file ( 7:svn.php 2:d0 2:c2 ( ) ) )
( change-file-prop ( 2:c2 23:svn:entry:committed-rev ( 1:2 ) ) )
( change-file-prop ( 2:c2 24:svn:entry:committed-date ( 27:2007-04-17T09:05:25.943015Z ) ) )
( change-file-prop ( 2:c2 21:svn:entry:last-author ( 4:root ) ) )
( change-file-prop ( 2:c2 14:svn:entry:uuid ( 36:28ddee6e-6324-0410-859d-a2726facb31c ) ) )
( apply-textdelta ( 2:c2 ( ) ) )
( textdelta-chunk ( 2:c2 4:SVN ) )
( textdelta-chunk ( 2:c2 5: ) )
( textdelta-chunk ( 2:c2 1: ) )
( textdelta-chunk ( 2:c2 25:
) )
( textdelta-end ( 2:c2 ) )
( close-file ( 2:c2 ( 32:7a61383013893c2d4ed6ca266a17b772 ) ) )
( close-dir ( 2:d0 ) )
( close-edit ( ) )
( success ( ) )
( success ( ) )

svnserveプロトコル解析:ls (get-dir)

svnコマンド相当:
svn ls svn://localhost/var/svn/repos/phpacc


( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline ) ) )
( 2 ( edit-pipeline ) 36:svn://localhost/var/svn/repos/phpacc )
( success ( ( ANONYMOUS ) 0: ) )
( ANONYMOUS ( 0: ) )
( success ( ) ) ( success ( 36:28ddee6e-6324-0410-859d-a2726facb31c 29:svn://localhost/var/svn/repos ) )
( check-path ( 0: ( 2 ) ) )
( success ( ( ) 0: ) ) ( success ( dir ) )
( get-dir ( 0: ( 2 ) false true ) )
( success ( ( ) 0: ) ) ( success ( 2 ( ) ( ( 10:index.html file 100 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ( 16:svn-commit.2.tmp file 49 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ( 14:svn-commit.tmp file 43 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ( 16:svn-commit.3.tmp file 48 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ( 7:svn.php file 25 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ( 16:svn-commit.4.tmp file 47 false 2 ( 27:2007-04-17T09:05:25.943015Z ) ( 4:root ) ) ) ) )

2007年4月17日火曜日

svnserveプロトコル実装 (1)解析

SVNのクライアントをPHPで実装する必要が出来たので、
数日で頑張って必要な機能だけ実装しようと思う。

必要な機能としては、
・ディレクトリ作成
・ディレクトリ削除
・ファイルインポート
・ファイルチェックアウト
・ファイルコミット
・ファイルチェックアウト&圧縮
である。基本的に全部なんだが、例外等は後回しにしよう。


( success ( 1 2 ( ANONYMOUS EXTERNAL ) ( edit-pipeline ) ) )
( 1 ANONYMOUS ( ) ( ) )
( success ( ) )
( 29:svn://localhost/var/svn/repos )
( success ( 36:28ddee6e-6324-0410-859d-a2726facb31c 29:svn://localhost/var/svn/repos ) )
( get-dir ( 0: ( 1 ) false true ) )

( success ( 1 ( ) ( ( 6:phpacc dir 0 false 1 ( 27:2007-04-17T08:58:05.164880Z ) ( 4:root ) ) ) ) )


基本的な動作として、上記のような処理となる。
上記はROOTディレクトリの内容を出力させるもの。
赤文字部分がこちらから出力するコマンド。

以降のトピックで必要機能のプロトコルを解析していく。

2007年4月13日金曜日

FlashLite with KDDI

シャープ製(特にW41SHは糞だと言ったけど、これはFlashのせいなのだろうか)

stat = fscommand2("RetrieveFocus");
if(stat==-1){
 trace("Use default cursor=" add _root._defezcursor);
 _root._cursor=_root._defezcursor;
}else{
 // 他機種向け復元処理
}

これは間違い。

if(_root._cli="W41SH"){ // しっかり機種分けを
 stat = fscommand2("RetrieveFocus");
 if(stat<0){
  // 読込失敗
  trace("Use default cursor=" add _root._defezcursor);
  _root._cursor=カーソルの初期値;
 }else{
  // 読込成功
  成功時処理
 }
}

で、注意しなければいけないのは、
このRetrieveFocus機能を呼び出したフレームが終了すると、
保存されたフレームにジャンプします。

決して、fscommand2コマンドが呼ばれたタイミングで、
内部的にgotoAndPlayが呼ばれる訳じゃない。
なのでこのフレームの描画とかも終わってから呼ばれる。

後は、更に癌なのは、fscommand2が呼ばれた場合、
読込失敗すると、フレームの最後にstop()があっても、
次のフレームに推移(next())してしまう。

なので、デフォルトカーソル処理はfscommand2コマンド発行の次フレームに、
それ以外は各フレームに書くようにする必要がある。

まったく糞だ。

2007年4月12日木曜日

FlashLite with KDDI(2)

メインメニューと、EZメニューではカーソルの保存方法が違うみたい。

保存方法

W51T/W52T
 メインメニュー:fscommand2("Set","Mainmenu","Position",cursor);
 EZメニュー:一緒

W51H/W51CA/MEDIASKIN/W51K/W52K
 メインメニュー:FSCommand2("Set","Mainmenu","Position",cursor);
 EZメニュー:一緒

W51S
 メインメニュー:FSCommand2("Set","EZMenu","Position",cursor);
 EZメニュー:一緒

W51SA/W43SA
 メインメニュー:Launchした文字列が保存される
 EZメニュー:一緒
 読み出した時、初回読み出しの時、まれにゴミ文字("m4")などが入るので、
 文字列チェック等をちゃんとやったほうがいい。

W51SH
 メインメニュー:FSCommand2("Set","Mainmenu","Position",cursor);
 EZメニュー:FSCommand2("Set","SH_Ezmenu","Position",cursor);

ほんと、面倒くさい仕様。
シャープが一番糞仕様です。

2007年4月10日火曜日

FlashLite with KDDI

端末毎にメニュー位置の記憶方法が異なり、非常に難儀したので、チラシの裏保存。

// 変数参照用のprefix
str=String(_root._submenuid) add "_" add String(_root._cursor);
// メニュー位置保存コード(00とか25とか)
cursor=String(_root._submenuid) add String(_root._cursor);

switch(_root._tC){
case "W51T":
case "W52T":
// T系は3byteしか保存出来ないので注意
fscommand2("Set","Mainmenu","Position",cursor);
fscommand("launch",eval("/:_ezmenuLaunch" add str));
break;
case "W51H":
case "W51CA":
FSCommand2("Set","Mainmenu","Position",cursor);
fscommand("launch",eval("/:_ezmenuLaunch" add str));
break;
case "MEDIASKIN":
case "W51K":
case "W52K":
FSCommand2("Set","Mainmenu","Position",cursor);
fscommand("launch",eval("/:_ezmenuLaunch" add str));
break;
case "W51S":
FSCommand2("Set","EZMenu","Position",cursor);
fscommand("launch",eval("/:_ezmenuLaunch" add str));
break;
case "W51SA":
case "W43SA":
// 一応呼び出し機能名に変換し保存
cursor=eval("/:_ezmenuLaunch" add str);
FSCommand2("Set","MainMenu","Position",cursor);
// 仕様上ではLaunchした時の文字列が保存されるらしいが…
fscommand("Launch",eval("/:_ezmenuLaunch" add str));
break;
case "W51SH":
FSCommand2("Set","Mainmenu","Position",cursor);
fscommand("Launch",eval("/:_ezmenuLaunch" add str));
break;
}

上記以外にW41SHは非常に癌で、実行中のフレームを記憶し、その時のフレームに戻される。

FRAME1の初期処理:
if(_root._tC eq "W41SH"){
_root._submenuid=0;
_root._luanchflg=false;
// 復元開始
stat = fscommand2("RetrieveFocus");
if(stat==-1){
trace("Use default cursor=" add _root._defezcursor);
_root._cursor=_root._defezcursor;
}
}else{
// 他機種向け復元処理
}

各FRAME:
if(_root._launchflg==true){
// カレントフレームを保存
FSCommand2("SaveFocus");
str="0_" add String(_root._cursor);
// 機能呼び出し
fscommand("launch",eval("/:_ezmenuLaunch" add str));
}else{
// メニュー位置を算出
_root._cursor=_currentframe-2;
_root._launchflg=true;
}