image

  • フォト Amazonギフト券
    ※この時計の時刻は、閲覧しているパソコンのものであり、必ずしも正確な時間とは限りません

検索

最近のトラックバック

無料ブログはココログ

« 2008-08-16 | トップページ | 2008-08-18 »

2008-08-17

2008-08-17

xfy リスト表示コンポーネントで Drag & Drop (その2)

- https://www.xfytec.com/community/modules/newbb/viewtopic.php?topic_id=245&forum=8
> xfy コミュニティ - Generated Link from XML file for Blog
この記事の中でこんなコードが示されていた。

            <xvcd:action event="event:drop-target">
                <inst:param name="event:event" />
                <inst:if test="$event:event/event:drop-target/@type = 'drop'">
                    <inst:variable name="url" select="$event:event//lsp:url"/>
                    <inst:variable name="fragment" select="function:synchronous-document($url)"/>
                    <xvcd:insert ref="//d2l:dropped-xml" position="last-child" select="$fragment/*"/>
                </inst:if>
            </xvcd:action>

$event:event//lsp:url として、 Desktop や ファイルエクスプローラから File などを xfy の画面に drop したときの URL を取得できるようだ。

- https://www.xfytec.com/community/modules/mydownloads/singlefile.php?lid=184&lang=ja
> xfy コミュニティ - ImageEasy for Blog Editor
のデモ画像でも、xfy の外から image ファイルを deop して取り込んでいる様子が示されている。
down load したzip ファイルを展開して、blog-imageeasy.xvcd を眺めると、やはり
$event:event//lsp:url を利用していることがわかった。

そこで先の List での drag & drop に 外部からの drap 対応を追加してみた。

Xfyuserdata02
          <list:list type="{xvcd:user-data('type')}">

の直後に以下のコードを追加した。

              <xvcd:action event="event:drop-target">
                <instruction:param name="event:event" />
                <instruction:if test="$event:event/event:drop-target/@type = 'drop'">

                  <instruction:variable name = "url" select="function:url-decode($event:event//lsp:url)"/>
                  <instruction:choose>
                    <instruction:when test="function:ends-with($url, '/')">
                      <xvcd:insert ref="." position="last-child" caret-move="none">
                        <simple:folder name="{$url}" />
                      </xvcd:insert>
                    </instruction:when>
                    <instruction:otherwise>
                      <xvcd:insert ref="." position="last-child" caret-move="none">
                        <simple:file name="{$url}" />
                      </xvcd:insert>
                    </instruction:otherwise>
                  </instruction:choose>
                </instruction:if>
              </xvcd:action>

xfy 外部から File を drop したとき、その URL さえ取得できれば、その後はアプリケーションに即した様々な処理が可能だろう。

P.S.
windows や Mac でのターミナル画面でも、File/Folder をドロップするとファイルパスがコマンドライン行に追加される。
cd と打ってから、Folder を drop して、長い文字列をタイプすることなく directory 移動することができる。

« 2008-08-16 | トップページ | 2008-08-18 »

mokuji

2013年12月
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

google

  • twitter
  • __
  • _
    Googleボットチェッカー

合わせて読む

  • 合わせて読む
    フィードメーター - katoy: cocolog あわせて読みたい

リンク