diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..1cca31f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,50 @@ + +2009-8-15 1.2.0 + * エージェントエディタを一新 + - 複数のエージェントや共有ライブラリをタブで同時に編集できるようになりました。 + - エージェントや共有ライブラリをディレクトリで分類できるようになりました。 + + * 標準ライブラリの追加 + 標準添付の共有ライブラリとして、以下を追加。 + - 移動平均などの各種シグナル算出クラス + - ロスカットやトレーリングストップを容易に実現するPositionManager + - クロスアップ、クロスダウンを判定するためのユーティリティ + + * バックテストの再実行機能を追加 + - バックテストを1クリックで再実行できるようになりました。 + + * グラフ出力の不具合修正 + - エージェントを削除するとそのグラフも表示できなくなる問題を改修しました。 + - この変更でリアルトレードでは古いグラフが蓄積されていくようになったため、 + 不要なグラフを破棄する機能も追加しました。 + +2009-8-8 1.1.4 + * クリック証券デモ取引Webサービスの提供終了にあわせて、デモ取引接続プラグインを + 無効化 + +2009-7-5 1.1.3 + * クリック証券のデモ取引に接続する場合に、設定でプロキシを空のまま確定すると + 接続エラーになる不具合を改修。 + +2009-6-29 1.1.2 + * クリック証券プラグインを標準添付 + +2009-6-20 1.1.1 + * uuidtools 2.0.0 との組み合わせで動作しなかった問題を改修 + * クリック証券デモトレードにアクセスする際に使用するプロキシを指定できるようにした。 + +2009-5-6 1.1.0 + * 証券会社へのアクセスロジックを、プラグインで後から追加できるように修正。 + +2009-4-19 1.0.3 + * グラフの色を変更してもリロードすると元に戻る不具合を修正。 + +2009-4-14 1.0.2 + * 以下の不具合を修正。 + - システムを再起動すると、動作中のエージェントが全て停止状態となる。 + - リアルトレードで建玉にエージェント名が設定されない場合がある。 + - リアルトレードで追加したエージェントのグラフ設定ができない。 + - 月の初めに、取引一覧の範囲絞込みの初期値が不正な値になる。 + +2009-3-29 1.0.0 + * 初版リリース \ No newline at end of file diff --git a/base/agents/moving_average_agent.rb b/base/agents/moving_average_agent.rb new file mode 100644 index 0000000..4f88fde --- /dev/null +++ b/base/agents/moving_average_agent.rb @@ -0,0 +1,78 @@ +# +# 移動平均を使うエージェント。 +# -ゴールデンクロスで買い。 +# -デッドクロスで売り。 +# +class MovingAverageAgent < JIJI::PeriodicallyAgent + + # エージェントの説明 + def description + <<-STR +移動平均を使うエージェントです。 + -ゴールデンクロスで買い&売り建て玉をコミット。 + -デッドクロスで売り&買い建て玉をコミット。 + STR + end + + # エージェントを初期化する。 + def init + # 移動平均の算出クラス + # 共有ライブラリのクラスを利用。(JIJI::Agent::Sharedモジュールに定義される。) + @mvs = [ + JIJI::Agent::Shared::MovingAverage.new(@short), + JIJI::Agent::Shared::MovingAverage.new(@long) + ] + @prev_state = nil + + # 移動平均をグラフで表示するためのOutput + @out = output.get( "移動平均線", :graph, { + :column_count=>2, # データ数は2 + :graph_type=>:rate, # レートにあわせる形式で表示 + :colors=>["#779999","#557777"] # デフォルトのグラフの色 + } ) + end + + # 次のレートを受け取る + def next_period_rates( rates ) + + # 移動平均を計算 + res = @mvs.map{|mv| mv.next_rate( rates[:EURJPY].bid ) } + + return if ( !res[0] || !res[1]) + + # グラフに出力 + @out.put( *res ) + + # ゴールデンクロス/デッドクロスを判定 + state = res[0] > res[1] ? :high : :low + if ( @prev_state && @prev_state != state ) + if state == :high + # ゴールデンクロス + # 売り建玉があれば全て決済 + operator.positions.each_pair {|k,p| + operator.commit(p) if p.sell_or_buy == JIJI::Position::SELL + } + # 新規に買い + operator.buy 1 + else + # デッドクロス + # 買い建玉があれば全て決済 + operator.positions.each_pair {|k,p| + operator.commit(p) if p.sell_or_buy == JIJI::Position::BUY + } + # 新規に売り + operator.sell 1 + end + end + @prev_state = state + end + + # UIから設定可能なプロパティの一覧を返す。 + def property_infos + super().concat [ + Property.new( "short", "短期移動平均線", 25, :number ), + Property.new( "long", "長期移動平均線", 75, :number ) + ] + end + +end \ No newline at end of file diff --git a/base/shared_lib/moving_average.rb b/base/shared_lib/moving_average.rb new file mode 100644 index 0000000..33cc265 --- /dev/null +++ b/base/shared_lib/moving_average.rb @@ -0,0 +1,35 @@ + +# 一定期間の移動平均を得る +class MovingAverage + def initialize( range=25 ) + @rates = [] # レートを記録するバッファ + @range = range + end + + def next_rate( rate ) + # バッファのデータを更新 + @rates.push rate + @rates.shift if @rates.length > @range + + # バッファサイズが十分でなければ、nilを返す。 + return nil if @rates.length != @range + + # 移動平均を算出 + return MovingAverage.get_moving_average(@rates) + end + + # 前の結果(引数で指定した件数だけ記録。) + attr :prev, true + +private + # 移動平均値を計算する。 + def self.get_moving_average( rates ) + total = 0 + rates.each {|s| + total += s.end + total += s.max + total += s.min + } + return total / ( rates.length * 3 ) + end +end \ No newline at end of file diff --git a/base/shared_lib/system/cross.rb b/base/shared_lib/system/cross.rb new file mode 100644 index 0000000..03e668c --- /dev/null +++ b/base/shared_lib/system/cross.rb @@ -0,0 +1,76 @@ + +#===交差状態を判定するユーティリティ +#先行指標と遅行指標を受け取って、クロスアップ/クロスダウンを判定するユーティリティです。 +# +# require 'cross' +# +# cross = Cross.new +# +# # 先行指標、遅行指標を受け取って状態を返す。 +# # :cross .. クロスアップ、クロスダウン状態かどうかを返す。 +# # - クロスアップ(:up) +# # - クロスダウン(:down) +# # - どちらでもない(:none) +# # :trend .. 現在の指標が上向きか下向きかを返す。 +# # 「先行指標 <=> 遅行指標」した値。 +# # trend >= 1なら上向き、trned <= -1なら下向き +# p cross.next_data( 100, 90 ) # {:trend=>1, :cross=>:none} +# p cross.next_data( 110, 100 ) # {:trend=>1, :cross=>:none} +# p cross.next_data( 100, 100 ) # {:trend=>0, :cross=>:none} +# p cross.next_data( 90, 100 ) # {:trend=>-1, :cross=>:down} +# p cross.next_data( 80, 90 ) # {:trend=>-1, :cross=>:none} +# p cross.next_data( 90, 90 ) # {:trend=>0, :cross=>:none} +# p cross.next_data( 100, 100 ) # {:trend=>0, :cross=>:none} +# p cross.next_data( 110, 100 ) # {:trend=>1, :cross=>:up} +# +class Cross + + #コンストラクタ + def initialize + @cross_prev = nil + @cross = :none + @trend = 0 + end + + #===次の値を渡し状態を更新します。 + #fast:: 先行指標 + #lazy:: 遅行指標 + def next_data( fast, lazy ) + return unless fast && lazy + # 交差状態を算出 + @trend = fast <=> lazy + if @cross_prev && @trend != @cross_prev && @trend != 0 + @cross = @trend > @cross_prev ? :up : :down + else + @cross = :none + end + @cross_prev = @trend + return {:cross=>@cross,:trend=>@trend} + end + + #===クロスアップ状態かどうか判定します。 + #戻り値:: 「先行指標 < 遅行指標」 から 「先行指標 > 遅行指標」 になったらtrue + def cross_up? + @cross == :up + end + #===クロスダウン状態かどうか判定します。 + #戻り値:: 「先行指標 > 遅行指標」 から 「先行指標 < 遅行指標」 になったらtrue + def cross_down? + @cross == :down + end + #===上昇トレンド中かどうか判定します。 + #戻り値:: 「先行指標 > 遅行指標」 ならtrue + def up? + @trend > 0 + end + #===下降トレンド中かどうか判定します。 + #戻り値:: 「先行指標 < 遅行指標」 ならtrue + def down? + @trend < 0 + end + + #交差状態( :up, :down, :none ) + attr_reader :cross + #トレンド ( 直近の falst <=> lazy 値。) + attr_reader :trend +end \ No newline at end of file diff --git a/base/shared_lib/system/position_manager.rb b/base/shared_lib/system/position_manager.rb new file mode 100644 index 0000000..927e429 --- /dev/null +++ b/base/shared_lib/system/position_manager.rb @@ -0,0 +1,160 @@ + +#===ポジションマネージャ +#以下の機能を提供するユーティリティクラスです。 +#- 条件にマッチするポジションを探す。 +#- すべてのor条件にマッチするポジションを決済する。 +#- 指定したポジションを損切りorトレーリングストップで決済する。 +class PositionManager + include Enumerable + + #====コンストラクタ + #operator:: オペレータ + def initialize( operator ) + raise "illegal argument." unless operator + @operator = operator + @marked = {} + end + + #====ポジションを列挙します。 + def each( &block ) + @operator.positions.each_pair {|k,v| + yield v + } + end + + #====条件にマッチするポジションを決済します。 + #&block:: 決済するポジションを判定するブロック。JIJI::Positionが引数として渡され、trueが返された場合決済されます。 + def commit_by + each {|p| + @operator.commit( p ) if yield p + } + end + + #====すべてのポジションを決済します。 + def commit_all + commit_by{|p| true } + end + + #====現在保有しているポジションの損益合計を取得します。 + #※決済済みポジションの損益は含まれません。 + #戻り値:: 現在保有しているポジションの損益合計 + def total_profit_or_loss + inject(0.0) {|t, p| + t += p.profit_or_loss + } + end + + #====ポジションに損切りロジックを登録します。 + #損切りロジックが登録されたポジションはcheckが実行される度に損益がチェックされ、 + #PositionManager::StopStrategy.close?がtrueになれば決済されます。 + #1つのポジションに対して複数のロジックを設定可能。いずれかのロジックがtrueを返せば損切りされます。 + #position_id:: ポジションID + #stop_strategy:: 損切りルール(PositionManager::StopStrategy) + def register( position_id, stop_strategy ) + @marked[position_id] ||= [] + @marked[position_id] << stop_strategy + end + + #====ポジションをロスカットの対象としてマークします。 + #マークされたポジションはcheckが実行される度に損益がチェックされ、 + #損失がdissipationで設定した値以下になっていれば決済されます。 + # + #position_id:: ポジションID + #dissipation:: 許容しうる損失 + def register_loss_cut( position_id, dissipation ) + register(position_id,LossCut.new( dissipation )) + end + + #====ポジションをトレーリングストップの対象としてマークします。 + #マークされたポジションはcheckが実行される度に損益がチェックされ、 + #「今までの最高損益-現在の損益」がdissipationで設定した値以下になっていれば決済されます。 + # + #position_id:: ポジションID + #dissipation:: 許容しうる損失 + def register_trailing_stop( position_id, dissipation ) + register(position_id,TrailingStop.new( dissipation )) + end + + #====ポジションに損切りロジックが登録されているかどうか評価します。 + #position_id:: ポジションID + #return:: 損切りの対象であればtrue + def registered?( position_id ) + @marked.key?(position_id) + end + + #====ポジションに登録されている損切りロジックの一覧を取得します。 + #position_id:: ポジションID + #return:: ポジションに登録されている損切りロジックの配列 + def get_registered_strategy( position_id ) + @marked[position_id] || [] + end + + #====ポジションに登録された損切りロジックを解除します。 + #position_id:: ポジションID + #strategy:: 削除する損切りロジック + def unregister(position_id, strategy) + list = get_registered_strategy(position_id) + list.delete(strategy) + end + + #====ポジションに登録された損切りロジックを全て解除します。 + #position_id:: ポジションID + def unregister_all(position_id) + @marked.delete( position_id ) + end + + + #====監視対象のポジションが閾値を越えていないかチェックし、必要があれば決済します。 + #定期的に実行してください。 + #戻り値:: 決済したポジションの配列 + def check + commited = [] + @marked.each_pair {|k,v| + p = @operator.positions[k] + if !p || p.state != JIJI::Position::STATE_START + @marked.delete p.position_id + else + v.each {|strategy| + next unless strategy.close?(p) + @operator.commit( p ) + commited << p + unregister_all( p.position_id ) + break + } + end + } + commited + end + + #===手じまい戦略 + module StopStrategy + #====決済すべきか評価する。 + #position:: ポジション(JIJI::Position) + def close?(position) + return false + end + end + #===トレーリングストップ + class TrailingStop + include StopStrategy + def initialize( dissipation ) + @dissipation=dissipation + end + def close?(position) + @max=0 if !@max + result = (@max - position.profit_or_loss)*-1 <= @dissipation + @max = [position.profit_or_loss, @max].max + return result + end + end + #===ロスカット + class LossCut + include StopStrategy + def initialize( dissipation ) + @dissipation=dissipation + end + def close?(position) + position.profit_or_loss <= @dissipation + end + end +end diff --git a/base/shared_lib/system/signal.rb b/base/shared_lib/system/signal.rb new file mode 100644 index 0000000..e96a8d9 --- /dev/null +++ b/base/shared_lib/system/signal.rb @@ -0,0 +1,347 @@ + +module Signal + + #===一定期間のレートデータを元に値を算出するシグナルの基底クラス + class RangeSignal + include Signal + #====コンストラクタ + #range:: 集計期間 + def initialize( range=25 ) + @datas = [] # レートを記録するバッファ + @range = range + end + #====次のデータを受け取って指標を返します。 + #data:: 次のデータ + #戻り値:: 指標。十分なデータが蓄積されていない場合nil + def next_data( data ) + # バッファのデータを更新 + @datas.push data + @datas.shift if @datas.length > @range + + # バッファサイズが十分でなければ、nilを返す。 + return nil if @datas.length != @range + + # 算出 + return calculate(@datas) + end + # + def calculate(datas); end #:nodoc: + #集計期間 + attr_reader :range + end + + #===移動平均 + class MovingAverage < RangeSignal + def calculate(datas) #:nodoc: + ma( datas ) + end + end + + #===加重移動平均 + class WeightedMovingAverage < RangeSignal + def calculate(datas) #:nodoc: + wma( datas ) + end + end + + #===指数移動平均 + class ExponentialMovingAverage < RangeSignal + #====コンストラクタ + #range:: 集計期間 + #smoothing_coefficient:: 平滑化係数 + def initialize( range=25, smoothing_coefficient=0.1 ) + super(range) + @sc = smoothing_coefficient + end + def calculate(datas) #:nodoc: + ema( datas, @sc ) + end + end + + #===ボリンジャーバンド + class BollingerBands < RangeSignal + #====コンストラクタ + #range:: 集計期間 + #pivot:: ピボット + def initialize( range=25, pivot=[0,1,2], &block ) + super(range) + @pivot = pivot + @block = block + end + def calculate(datas) #:nodoc: + bollinger_bands( datas, @pivot, &@block ) + end + end + + #===傾き + class Momentum < RangeSignal + def calculate(datas) #:nodoc: + momentum( datas ) + end + end + + #===傾き(最小二乗法を利用) + class Vector < RangeSignal + def calculate(datas) + vector( datas ) + end + end + + #===MACD + class MACD < RangeSignal + #====コンストラクタ + #short_range:: 短期EMAの集計期間 + #long_range:: 長期EMAの集計期間 + #signal_range:: シグナルの集計期間 + #smoothing_coefficient:: 平滑化係数 + def initialize( short_range=12, long_range=26, + signal_range=9, smoothing_coefficient=0.1 ) + raise "illegal arguments." if short_range > long_range + super(long_range) + @short_range = short_range + @smoothing_coefficient = smoothing_coefficient + @signal = ExponentialMovingAverage.new( + signal_range, smoothing_coefficient ) + end + def next_data( data ) #:nodoc: + macd = super + return nil unless macd + signal = @signal.next_data( macd ) + return nil unless signal + return { :macd=>macd, :signal=>signal } + end + def calculate(datas) #:nodoc: + macd( datas, @short_range, range, @smoothing_coefficient ) + end + end + + #===RSI + class RSI < RangeSignal + #====コンストラクタ + #range:: 集計期間 + def initialize( range=14 ) + super(range) + end + def calculate(datas) #:nodoc: + rsi( datas ) + end + end + + #===DMI + class DMI < RangeSignal + #====コンストラクタ + #range:: 集計期間 + def initialize( range=14 ) + super(range) + @dxs = [] + end + def calculate(datas) #:nodoc: + dmi = dmi( datas ) + return nil unless dmi + @dxs.push dmi[:dx] + @dxs.shift if @dxs.length > range + return nil if @dxs.length != range + dmi[:adx] = ma( @dxs ) + return dmi + end + end + + #===ROC + class ROC < RangeSignal + #====コンストラクタ + #range:: 集計期間 + def initialize( range=14 ) + super(range) + end + def calculate(datas) #:nodoc: + roc( datas ) + end + end + +module_function + + #===移動平均値を計算します。 + #datas:: 値の配列。 + #戻り値:: 移動平均値 + def ma( datas ) + total = datas.inject {|t,s| + t += s; t + } + return total / datas.length + end + + #===加重移動平均値を計算します。 + #datas:: 値の配列。 + #戻り値:: 加重移動平均値 + def wma( datas ) + weight = 1 + total = datas.inject(0.0) {|t,s| + t += s * weight + weight += 1 + t + } + return total / ( datas.length * (datas.length+1) /2 ) + end + + #===指数移動平均値を計算します。 + #datas:: 値の配列。 + #smoothing_coefficient:: 平滑化係数 + #戻り値:: 加重移動平均値 + def ema( datas, smoothing_coefficient=0.1 ) + datas[1..-1].inject( datas[0] ) {|t,s| + t + smoothing_coefficient * (s - t) + } + end + + # + #===ボリンジャーバンドを計算します。 + # + # +2σ=移動平均+標準偏差×2 + # +σ=移動平均+標準偏差 + # -σ=移動平均-標準偏差 + # -2σ=移動平均-標準偏差×2 + # 標準偏差=√((各値-値の期間中平均値)の2乗を期間分全部加えたもの)/ 期間 + # (√は式全体にかかる) + # + #datas:: 値の配列 + #pivot:: 標準偏差の倍数。初期値[0,1,2] + #block:: 移動平均を算出するロジック。指定がなければ移動平均を使う。 + #戻り値:: ボリンジャーバンドの各値の配列。例) [+2σ, +1σ, TP, -1σ, -2σ] + # + def bollinger_bands( datas, pivot=[0,1,2], &block ) + ma = block_given? ? yield( datas ) : ma( datas ) + total = datas.inject(0.0) {|t,s| + t+= ( s - ma ) ** 2 + t + } + sd = Math.sqrt(total / datas.length) + res = [] + pivot.each { |r| + res.unshift( ma + sd * r ) + res.push( ma + sd * r * -1 ) if r != 0 + } + return res + end + + #===一定期間の値の傾きを計算します。 + #datas:: 値の配列 + #戻り値:: 傾き。0より大きければ上向き。小さければ下向き。 + def momentum( datas ) + (datas.last - datas.first) / datas.length + end + + #===最小二乗法で、一定期間の値の傾きを計算します。 + #datas:: 値の配列 + #戻り値:: 傾き。0より大きければ上向き。小さければ下向き。 + def vector( datas ) + # 最小二乗法を使う。 + total = {:x=>0.0,:y=>0.0,:xx=>0.0,:xy=>0.0,:yy=>0.0} + datas.each_index {|i| + total[:x] += i + total[:y] += datas[i] + total[:xx] += i*i + total[:xy] += i*datas[i] + total[:yy] += datas[i] * datas[i] + } + n = datas.length + d = total[:xy] + c = total[:y] + e = total[:x] + b = total[:xx] + return (n*d - c*e) / (n*b - e*e) + end + + #===MACDを計算します。 + #MACD = 短期(short_range日)の指数移動平均 - 長期(long_range日)の指数移動平均 + #datas:: 値の配列 + #smoothing_coefficient:: 平滑化係数 + #戻り値:: macd値 + def macd( datas, short_range, long_range, smoothing_coefficient ) + ema( datas[ short_range*-1 .. -1], smoothing_coefficient ) \ + - ema( datas[ long_range*-1 .. -1], smoothing_coefficient ) + end + + #===RSIを計算します。 + #RSI = n日間の値上がり幅合計 / (n日間の値上がり幅合計 + n日間の値下がり幅合計) * 100 + #nとして、14や9を使うのが、一般的。30以下では売られすぎ70以上では買われすぎの水準。 + # + #datas:: 値の配列 + #戻り値:: RSI値 + def rsi( datas ) + prev = nil + tmp = datas.inject( [0.0,0.0] ) {|r,i| + r[ i > prev ? 0 : 1 ] += (i - prev).abs if prev + prev = i + r + } + (tmp[0] + tmp[1] ) == 0 ? 0.0 : tmp[0] / (tmp[0] + tmp[1]) * 100 + end + + #===DMIを計算します。 + # + # 高値更新 ... 前日高値より当日高値が高かった時その差 + # 安値更新 ... 前日安値より当日安値が安かった時その差 + # DM ... 高値更新が安値更新より大きかった時高値更新の値。逆の場合は0 + # DM ... 安値更新が高値更新より大きかった時安値更新の値。逆の場合は0 + # TR ... 次の3つの中で一番大きいもの + # 当日高値-当日安値 + # 当日高値-前日終値 + # 前日終値-当日安値 + # AV(+DM) ... +DMのn日間移動平均値 + # AV(-DM) ... -DMのn日間移動平均値 + # AV(TR) ... TRのn日間移動平均値 + # +DI ... AV(+DM)/AV(TR) + # -DI ... AV(-DM)/AV(TR) + # DX ... (+DIと-DIの差額) / (+DIと-DIの合計) + # ADX ... DXのn日平均値 + # + #datas:: 値の配列(4本値を指定すること!) + #戻り値:: {:pdi=pdi, :mdi=mdi, :dx=dx } + def dmi( datas ) + prev = nil + tmp = datas.inject( [[],[],[]] ) {|r,i| + if prev + dm = _dmi( i, prev ) + r[0] << dm[0] # TR + r[1] << dm[1] # +DM + r[2] << dm[2] # -DM + end + prev = i + r + } + atr = ma( tmp[0] ) + pdi = ma( tmp[1] ) / atr * 100 + mdi = ma( tmp[2] ) / atr * 100 + dx = ( pdi-mdi ).abs / ( pdi+mdi ) * 100 + return {:pdi=>pdi, :mdi=>mdi, :dx=>dx } + end + + #TR,+DM,-DMを計算します。 + #戻り値:: [ tr, +DM, -DM ] + def _dmi( rate, rate_prev ) #:nodoc: + pdm = rate.max > rate_prev.max ? rate.max - rate_prev.max : 0 + mdm = rate.min < rate_prev.min ? rate_prev.min - rate.min : 0 + + if ( pdm > mdm ) + mdm = 0 + elsif ( pdm < mdm ) + pdm = 0 + end + + a = rate.max - rate.min + b = rate.max - rate_prev.end + c = rate_prev.end - rate.min + tr = [a,b,c].max + + return [tr, pdm, mdm] + end + + #===ROCを計算します。 + #Rate of Change。変化率。正なら上げトレンド、負なら下げトレンド。 + # + #datas:: 値の配列 + #戻り値:: 値 + def roc( datas ) + (datas.first - datas.last) / datas.last * 100 + end +end \ No newline at end of file diff --git a/bin/jiji b/bin/jiji new file mode 100644 index 0000000..4183916 --- /dev/null +++ b/bin/jiji @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require 'rubygems' +require 'jiji/command' +JIJI::Command.new.run( ARGV ) \ No newline at end of file diff --git a/html/css/calendar.css b/html/css/calendar.css new file mode 100644 index 0000000..9b06c6d --- /dev/null +++ b/html/css/calendar.css @@ -0,0 +1,432 @@ +/* +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.6.0 +*/ +.yui-calcontainer { + position: relative; + float: left; + _overflow: hidden; +} + +.yui-calcontainer iframe { + position: absolute; + border: none; + margin: 0; + padding: 0; + z-index: 0; + width: 100%; + height: 100%; + left: 0px; + top: 0px; +} + +.yui-calcontainer iframe.fixedsize { + width: 50em; + height: 50em; + top: -1px; + left: -1px; +} + +.yui-calcontainer.multi .groupcal { + z-index: 1; + float: left; + position: relative; +} + +.yui-calcontainer .title { + position: relative; + z-index: 1; +} + +.yui-calcontainer .close-icon { + position: absolute; + z-index: 1; + text-indent: -10000em; + overflow: hidden; +} + +.yui-calendar { + position: relative; +} + +.yui-calendar .calnavleft { + position: absolute; + z-index: 1; + text-indent: -10000em; + overflow: hidden; +} + +.yui-calendar .calnavright { + position: absolute; + z-index: 1; + text-indent: -10000em; + overflow: hidden; +} + +.yui-calendar .calheader { + position: relative; + width: 100%; + text-align: center; +} + +.yui-calcontainer .yui-cal-nav-mask { + position: absolute; + z-index: 2; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + _width: 0; + _height: 0; + left: 0; + top: 0; + display: none; +} + +.yui-calcontainer .yui-cal-nav { + position: absolute; + z-index: 3; + top: 0; + display: none; +} + +.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn { + display: -moz-inline-box; + display: inline-block; +} + +.yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button { + display: block; * + display: inline-block; * + overflow: visible; + border: none; + background-color: transparent; + cursor: pointer; +} + +.yui-calendar .calbody a:hover { + background: inherit; +} + +p#clear { + clear: left; + padding-top: 10px; +} + +.yui-skin-sam .yui-calcontainer { + background-color: #E8E8E8; + border: 1px solid #BBBBBB; + padding: 10px; +} + +.yui-skin-sam .yui-calcontainer.multi { + padding: 0 5px 0 5px; +} + +.yui-skin-sam .yui-calcontainer.multi .groupcal { + background-color: transparent; + border: none; + padding: 10px 5px 10px 5px; + margin: 0; +} + +.yui-skin-sam .yui-calcontainer .title { + background: url(../img/sprite.png) repeat-x 0 0; + border-bottom: 1px solid #cccccc; + font: 100% sans-serif; + color: #333; + font-weight: bold; + height: auto; + padding: .4em; + margin: 0 -10px 10px -10px; + top: 0; + left: 0; + text-align: left; +} + +.yui-skin-sam .yui-calcontainer.multi .title { + margin: 0 -5px 0 -5px; +} + +.yui-skin-sam .yui-calcontainer.withtitle { + padding-top: 0; +} + +.yui-skin-sam .yui-calcontainer .calclose { + background: url(../img/sprite.png) no-repeat 0 -300px; + width: 25px; + height: 15px; + top: .4em; + right: .4em; + cursor: pointer; +} + +.yui-skin-sam .yui-calendar { + border-spacing: 0; + border-collapse: collapse; + font: 100% sans-serif; + text-align: center; + margin: 0; +} + +.yui-skin-sam .yui-calendar .calhead { + background: transparent; + border: none; + vertical-align: middle; + padding: 0; +} + +.yui-skin-sam .yui-calendar .calheader { + background: transparent; + font-weight: bold; + padding: 0 0 .6em 0; + text-align: center; +} + +.yui-skin-sam .yui-calendar .calheader img { + border: none; +} + +.yui-skin-sam .yui-calendar .calnavleft { + background: url(../img/sprite.png) no-repeat 0 -450px; + width: 25px; + height: 15px; + top: 0; + bottom: 0; + left: -10px; + margin-left: .4em; + cursor: pointer; +} + +.yui-skin-sam .yui-calendar .calnavright { + background: url(../img/sprite.png) no-repeat 0 -500px; + width: 25px; + height: 15px; + top: 0; + bottom: 0; + right: -10px; + margin-right: .4em; + cursor: pointer; +} + +.yui-skin-sam .yui-calendar .calweekdayrow { + height: 2em; +} + +.yui-skin-sam .yui-calendar .calweekdayrow th { + padding: 0; + border: none; +} + +.yui-skin-sam .yui-calendar .calweekdaycell { + color: #333; + font-weight: bold; + text-align: center; + width: 2em; +} + +.yui-skin-sam .yui-calendar .calfoot { + background-color: #E8E8E8; +} + +.yui-skin-sam .yui-calendar .calrowhead,.yui-skin-sam .yui-calendar .calrowfoot + { + color: #a6a6a6; + font-size: 85%; + font-style: normal; + font-weight: normal; + border: none; +} + +.yui-skin-sam .yui-calendar .calrowhead { + text-align: right; + padding: 0 2px 0 0; +} + +.yui-skin-sam .yui-calendar .calrowfoot { + text-align: left; + padding: 0 0 0 2px; +} + +.yui-skin-sam .yui-calendar td.calcell { + /*border: 1px solid #BBBBBB;*/ + background: #f2f2f2; + padding: 1px; + height: 1.6em; + line-height: 1.6em; + text-align: center; + white-space: nowrap; +} + +.yui-skin-sam .yui-calendar td.calcell a { + color: #0066cc; + display: block; + height: 100%; + text-decoration: none; +} + +.yui-skin-sam .yui-calendar td.calcell.today { + background-color: #000; +} + +.yui-skin-sam .yui-calendar td.calcell.today a { + background-color: #fff; + border: 1px solid #cccccc; +} + +.yui-skin-sam .yui-calendar td.calcell.oom { + background-color: #cccccc; + color: #a6a6a6; + cursor: default; +} + +.yui-skin-sam .yui-calendar td.calcell.selected { + background-color: #fff; + color: #000; +} + +.yui-skin-sam .yui-calendar td.calcell.selected a { + background-color: #b3d4ff; + color: #000; +} + +.yui-skin-sam .yui-calendar td.calcell.calcellhover { + background-color: #426fd9; + color: #fff; + cursor: pointer; +} + +.yui-skin-sam .yui-calendar td.calcell.calcellhover a { + background-color: #426fd9; + color: #fff; +} + +.yui-skin-sam .yui-calendar td.calcell.previous { + color: #e0e0e0; +} + +.yui-skin-sam .yui-calendar td.calcell.restricted { + text-decoration: line-through; +} + +.yui-skin-sam .yui-calendar td.calcell.highlight1 { + background-color: #ccff99; +} + +.yui-skin-sam .yui-calendar td.calcell.highlight2 { + background-color: #99ccff; +} + +.yui-skin-sam .yui-calendar td.calcell.highlight3 { + background-color: #ffcccc; +} + +.yui-skin-sam .yui-calendar td.calcell.highlight4 { + background-color: #ccff99; +} + +.yui-skin-sam .yui-calendar a.calnav { + border: 1px solid #f2f2f2; + padding: 0 4px; + text-decoration: none; + color: #000; + zoom: 1; +} + +.yui-skin-sam .yui-calendar a.calnav:hover { + background: url(../img/sprite.png) repeat-x 0 0; + border-color: #A0A0A0; + cursor: pointer; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-mask { + background-color: #000; + opacity: 0.25; * + filter: alpha(opacity = 25); +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav { + font-family: arial, helvetica, clean, sans-serif; + font-size: 93%; + border: 1px solid #808080; + left: 50%; + margin-left: -7em; + width: 14em; + padding: 0; + top: 2.5em; + background-color: #f2f2f2; +} + +.yui-skin-sam .yui-calcontainer.withtitle .yui-cal-nav { + top: 4.5em; +} + +.yui-skin-sam .yui-calcontainer.multi .yui-cal-nav { + width: 16em; + margin-left: -8em; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-y,.yui-skin-sam .yui-calcontainer .yui-cal-nav-m,.yui-skin-sam .yui-calcontainer .yui-cal-nav-b + { + padding: 5px 10px 5px 10px; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-b { + text-align: center; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-e { + margin-top: 5px; + padding: 5px; + background-color: #EDF5FF; + border-top: 1px solid black; + display: none; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav label { + display: block; + font-weight: bold; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-mc { + width: 100%; + _width: auto; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-y input.yui-invalid { + background-color: #FFEE69; + border: 1px solid #000; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav-yc { + width: 4em; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn { + border: 1px solid #808080; + background: url(../img/sprite.png) repeat-x 0 0; + background-color: #ccc; + margin: auto .15em; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn button { + padding: 0 8px; + font-size: 93%; + line-height: 2; * + line-height: 1.7; + min-height: 2em; * + min-height: auto; + color: #000; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default { + border: 1px solid #304369; + background-color: #426fd9; + background: url(../img/sprite.png) repeat-x 0 -1400px; +} + +.yui-skin-sam .yui-calcontainer .yui-cal-nav .yui-cal-nav-btn.yui-default button { + color: #fff; +} \ No newline at end of file diff --git a/html/css/datatable.css b/html/css/datatable.css new file mode 100644 index 0000000..76af7dd --- /dev/null +++ b/html/css/datatable.css @@ -0,0 +1,299 @@ +/* +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.5.2 +*/ +/* basic skin styles */ +.yui-dt table { line-height:120%; margin:0;padding:0;font-family:arial;font-size:inherit;border-collapse:separate;*border-collapse:collapse;border-spacing:0;} +.yui-dt thead {border-spacing:0;} /* for safari bug */ +.yui-dt caption {padding-bottom:1em;text-align:left;} + +/*outer border */ +.yui-dt-hd table { + border-left:1px solid #7F7F7F; + border-top:1px solid #7F7F7F; + border-right:1px solid #7F7F7F; + border-bottom:1px solid #FFFFFF; +} +.yui-dt-bd table { + border-left:1px solid #FFFFFF; + border-top:1px solid #FFFFFF; + border-bottom:1px solid #FFFFFF; +} + +.yui-dt th { + background:#D8D8DA url(../img/thead.gif) repeat-x 0 0; /* header gradient */ +} +.yui-dt th, +.yui-dt th a { + font-weight:bold;text-decoration:none;color:#333; /* header text */ + vertical-align:bottom; +} +.yui-dt th { + margin:0;padding:0; + border:none; + border-right:1px solid #FFFFFF;/* inner column border */ + border-bottom:1px solid #FFFFFF; +} +.yui-dt th .yui-dt-liner{ + white-space:nowrap; +} +.yui-dt-liner { + margin:0;padding:0; + padding:2px 5px 2px 5px; /* cell padding */ +} +.yui-dt-coltarget { + width: 5px; + background-color: red; +} +.yui-dt td { + margin:0;padding:0; + border:none; + border-right:1px solid #FFFFFF; /* inner column border */ + text-align:left; +} +.yui-dt-list td { + border-right:none; /* disable inner column border in list mode */ +} +.yui-dt-resizer { + width:6px; +} + +/* messaging */ +tbody.yui-dt-msg td { + border:none; +} + +.yui-dt-loading { + background-color:#FFF; +} +.yui-dt-empty { + background-color:#FFF; +} +.yui-dt-error { + background-color:#FFF; +} + +/* scrolling */ +.yui-dt-scrollable .yui-dt-hd table {border:0px;} +.yui-dt-scrollable .yui-dt-bd table {border:0px;} +.yui-dt-scrollable .yui-dt-hd { + /*border-left:1px solid #7F7F7F;border-top:1px solid #7F7F7F;border-right:1px solid #7F7F7F;*/ +} +.yui-dt-scrollable .yui-dt-bd { + /*border-left:1px solid #7F7F7F;border-bottom:1px solid #7F7F7F;border-right:1px solid #7F7F7F;background-color:#FFF;*/ +} + +/* sortable columns */ +thead .yui-dt-sortable { + cursor:pointer; +} +th.yui-dt-asc, +th.yui-dt-desc { + background:#D8D8DA url(../img/thead.gif) repeat-x 0 0px; /* sorted header gradient */ +} +th.yui-dt-sortable .yui-dt-label { + margin-right:10px; +} +th.yui-dt-asc .yui-dt-liner { + background:url(../img/dt-arrow-up.png) no-repeat right; /* sorted header gradient */ +} +th.yui-dt-desc .yui-dt-liner { + background:url(../img/dt-arrow-dn.png) no-repeat right; /* sorted header gradient */ +} + +/* editing */ +.yui-dt-editable { + cursor:pointer; +} +.yui-dt-editor { + text-align:left; + background-color:#E8E8E8; + border:1px solid #808080; + padding:6px; +} +.yui-dt-editor label { + padding-left:4px;padding-right:6px; +} +.yui-dt-editor .yui-dt-button { + padding-top:6px;text-align:right; +} +.yui-dt-editor .yui-dt-button button { + background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0; + border:1px solid #999; + width:4em;height:1.8em; + margin-left:6px; +} +.yui-dt-editor .yui-dt-button button.yui-dt-default { + background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1400px; + background-color: #5584E0; + border:1px solid #304369; + color:#FFF +} +.yui-dt-editor .yui-dt-button button:hover { + background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1300px; + color:#000; +} +.yui-dt-editor .yui-dt-button button:active { + background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1700px; + color:#000; +} + +/* striping */ +tr.yui-dt-even { background-color:#E8E8E8; } /* white */ +tr.yui-dt-odd { background-color:#d2d2d0; } /* light blue */ +tr.yui-dt-even td.yui-dt-asc, +tr.yui-dt-even td.yui-dt-desc { background-color:#E8E8E8; } /* light blue sorted */ +tr.yui-dt-odd td.yui-dt-asc, +tr.yui-dt-odd td.yui-dt-desc { background-color:#d2d2d0; } /* dark blue sorted */ + +/* disable striping in list mode */ +.yui-dt-list tr.yui-dt-even { background-color:#E8E8E8; } /* white */ +.yui-dt-list tr.yui-dt-odd { background-color:#E8E8E8; } /* white */ +.yui-dt-list tr.yui-dt-even td.yui-dt-asc, +.yui-dt-list tr.yui-dt-even td.yui-dt-desc { background-color:#d2d2d0; } /* light blue sorted */ +.yui-dt-list tr.yui-dt-odd td.yui-dt-asc, +.yui-dt-list tr.yui-dt-odd td.yui-dt-desc { background-color:#d2d2d0;} /* light blue sorted */ + +/* highlighting */ +th.yui-dt-highlighted, +th.yui-dt-highlighted a { + background: #E8E8E8 url(../img/td_over.gif) repeat-y 0 0px; +} +tr.yui-dt-highlighted, +tr.yui-dt-highlighted td.yui-dt-asc, +tr.yui-dt-highlighted td.yui-dt-desc, +tr.yui-dt-even td.yui-dt-highlighted, +tr.yui-dt-odd td.yui-dt-highlighted { + cursor:pointer; +} +tr.yui-dt-even td.yui-dt-highlighted { + background: #E8E8E8 url(../img/td_over.gif) repeat-y 0 0px; +} +tr.yui-dt-odd td.yui-dt-highlighted { + background: #d2d2d0 url(../img/td_over_d.gif) repeat-y 0 0px; +} + +/* enable highlighting in list mode */ +.yui-dt-list th.yui-dt-highlighted, +.yui-dt-list th.yui-dt-highlighted a { +} +.yui-dt-list tr.yui-dt-highlighted, +.yui-dt-list tr.yui-dt-highlighted td.yui-dt-asc, +.yui-dt-list tr.yui-dt-highlighted td.yui-dt-desc, +.yui-dt-list tr.yui-dt-even td.yui-dt-highlighted, +.yui-dt-list tr.yui-dt-odd td.yui-dt-highlighted { + cursor:pointer; +} +.yui-dt-list tr.yui-dt-even td.yui-dt-highlighted { + background: #E8E8E8 url(../img/td_over.gif) repeat-y 0 0px; +} +.yui-dt-list tr.yui-dt-odd td.yui-dt-highlighted { + background: #d2d2d0 url(../img/td_over_d.gif) repeat-y 0 0px; +} +/* selection */ +th.yui-dt-selected, +th.yui-dt-selected a { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ +} +tr.yui-dt-selected td, +tr.yui-dt-selected td.yui-dt-asc, +tr.yui-dt-selected td.yui-dt-desc { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ + color:#11116F; +} +tr.yui-dt-even td.yui-dt-selected, +tr.yui-dt-odd td.yui-dt-selected { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ + color:#11116F; +} + +/* enable selection in list mode */ +.yui-dt-list th.yui-dt-selected, +.yui-dt-list th.yui-dt-selected a { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ +} +.yui-dt-list tr.yui-dt-selected td, +.yui-dt-list tr.yui-dt-selected td.yui-dt-asc, +.yui-dt-list tr.yui-dt-selected td.yui-dt-desc { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ + color:#11116F; +} +.yui-dt-list tr.yui-dt-even td.yui-dt-selected, +.yui-dt-list tr.yui-dt-odd td.yui-dt-selected { + background-color: #FFFFFF; + background-image: none; + /*background: #E8E8E8 url(../img/td_selected.gif) repeat-y 0 0px;*/ + color:#11116F; +} + +/* pagination */ +.yui-pg-container, +.yui-dt-paginator { + display:block;margin:6px 0;white-space:nowrap; +} +.yui-pg-first, +.yui-pg-last, +.yui-pg-current-page, +.yui-dt-paginator .yui-dt-first, +.yui-dt-paginator .yui-dt-last, +.yui-dt-paginator .yui-dt-selected { + padding:2px 6px; +} +a.yui-pg-first, +a.yui-pg-previous, +a.yui-pg-next, +a.yui-pg-last, +a.yui-pg-page, +.yui-dt-paginator a.yui-dt-first, +.yui-dt-paginator a.yui-dt-last { + text-decoration:none; +} +.yui-dt-paginator .yui-dt-previous, +.yui-dt-paginator .yui-dt-next { + display:none; +} +a.yui-pg-page, +a.yui-dt-page { + border:1px solid #FFFFFF; + padding:2px 6px; + text-decoration:none; + background-color:#fff +} +.yui-pg-current-page, +.yui-dt-paginator .yui-dt-selected { + border:1px solid #fff; + background-color:#fff; +} +.yui-pg-pages { + margin-left:1ex; + margin-right:1ex; +} +.yui-pg-page { + margin-right:1px; + margin-left:1px; +} +.yui-pg-first, +.yui-pg-previous { + margin-right:3px; +} +.yui-pg-next, +.yui-pg-last { + margin-left:3px; +} +.yui-pg-current, +.yui-pg-rpp-options { + margin-right:1em; + margin-left:1em; +} diff --git a/html/css/default.css b/html/css/default.css new file mode 100644 index 0000000..e32b4bb --- /dev/null +++ b/html/css/default.css @@ -0,0 +1,616 @@ + +* { + margin: 0px; + padding: 0px; + font-size: 12px; +} + +body { + margin: 0px; + background-color: #88888B; + color: #444444; + font-size: small; + font-family: verdana, 'trebuchet ms', sans-serif; + text-align: center; + line-height: 140%; +} +img { + border: 0px; + margin: 0px; + padding: 0px; +} + +div.breaker { + clear: both; + height: 1px; + width: 100%; +} + +div.separator { + display:block; + background-image: url("../img/separator.gif") ; + background-repeat: repeat-x; + height:2px; + margin: 10px 0px; +} + +span.error { + color: #FF3366; + font-weight: bold; +} + +.accesskey { + text-decoration: underline; +} + +a { + color:#313d7a; + text-decoration:underline; +} +a:link { + color:#313d7a; + text-decoration:underline; +} +a:active { + color:#313d7a; + text-decoration:underline; +} +a:visited { + color:#761d7a; + text-decoration:underline; +} +a:hover { + color:#111d6a; + text-decoration:underline; +} + +/* �w�i -------------------------------------------------------------- */ +#margin_top, #main, #margin_bottom { + width:1000px; + position: relative; + margin: 0px auto; + text-align: left; + background-repeat: repeat; +} +#margin_top, #margin_bottom { + height:10px; + padding: 0px 10px; + background-repeat: no-repeat; +} +#margin_top { + background-image: url("../img/back_top.gif"); +} +#main { + padding: 1px 10px 0px 10px; + background-image: url("../img/back_middle.gif"); + background-repeat: repeat-y; + z-index: 10; +} +#margin_bottom { + background-image: url("../img/back_bottom.gif"); +} + +/* �w�b�_/�t�b�_ -------------------------------------------------------------- */ +#hesder { + width:1000px; + height : 50px; + background-image: url("../img/head.jpg"); + background-repeat: no-repeat; +} +#footer { + width:1000px; + height : 30px; + background-image: url("../img/foot.jpg"); + background-repeat: no-repeat; + text-align: center; + color: #e8e8e8; + padding-top: 20px; +} +#footer a { + color: #ccc; +} +#footer a:hover { + color: #fff; +} +#footer span.separator { + padding: 0px 3px; + color : #666; +} +/* main -------------------------------------------------------------- */ +#left { + /*margin-left: 0px;*/ + width:180px; + float: left; +} +#right { + margin-right: 10px; + width:810px; + float: right; +} + +/* page -------------------------------------------------------------- */ +div.page { + display: none; +} +div.desc { + color: #777777; +} +div.page_msg { + float: left; + height: 25px; + line-height: 23px; + /*border: 1px solid #FFFFFF; + padding: 0px 10px;*/ + color: #FF3366; +} +div.page_msg * { + vertical-align: middle; +} + +/* panel -------------------------------------------------------------- */ +div.panel_middle { + background-repeat: repeat-y; +} +div.panel_top, div.panel_bottom { + height: 10px; + background-repeat: no-repeat; +} + +/* 260 */ +div.panel_260 > div.panel_top, div.panel_260 > div.panel_bottom, div.panel_260 > div.panel_middle { + width: 280px; +} +div.panel_260 > div.panel_top { + background-image: url("../img/panel_260_t.gif"); +} +div.panel_260 > div.panel_middle { + background-image: url("../img/panel_260_m.gif"); +} +div.panel_260 > div.panel_bottom { + background-image: url("../img/panel_260_b.gif"); +} + +/* 300 */ +div.panel_300 > div.panel_top, div.panel_300 > div.panel_bottom, div.panel_300 > div.panel_middle { + width: 320px; +} +div.panel_300 > div.panel_top { + background-image: url("../img/panel_300_t.gif"); +} +div.panel_300 > div.panel_middle { + background-image: url("../img/panel_300_m.gif"); +} +div.panel_300 > div.panel_bottom { + background-image: url("../img/panel_300_b.gif"); +} + +/* 360 */ +div.panel_360 > div.panel_top, div.panel_360 > div.panel_bottom, div.panel_360 > div.panel_middle { + width: 380px; +} +div.panel_360 > div.panel_top { + background-image: url("../img/panel_360_t.gif"); +} +div.panel_360 > div.panel_middle { + background-image: url("../img/panel_360_m.gif"); +} +div.panel_360 > div.panel_bottom { + background-image: url("../img/panel_360_b.gif"); +} + +/* 380 */ +div.panel_380 > div.panel_top, div.panel_380 > div.panel_bottom, div.panel_380 > div.panel_middle { + width: 400px; +} +div.panel_380 > div.panel_top { + background-image: url("../img/panel_380_t.gif"); +} +div.panel_380 > div.panel_middle { + background-image: url("../img/panel_380_m.gif"); +} +div.panel_380 > div.panel_bottom { + background-image: url("../img/panel_380_b.gif"); +} + +/* 500 */ +div.panel_500 > div.panel_top, div.panel_500 > div.panel_bottom, div.panel_500 > div.panel_middle { + width: 520px; +} +div.panel_500 > div.panel_top { + background-image: url("../img/panel_500_t.gif"); +} +div.panel_500 > div.panel_middle { + background-image: url("../img/panel_500_m.gif"); +} +div.panel_500 > div.panel_bottom { + background-image: url("../img/panel_500_b.gif"); +} + +/* 620 */ +div.panel_620 > div.panel_top, div.panel_620 > div.panel_bottom, div.panel_620 > div.panel_middle { + width: 640px; +} +div.panel_620 > div.panel_top { + background-image: url("../img/panel_620_t.gif"); +} +div.panel_620 > div.panel_middle { + background-image: url("../img/panel_620_m.gif"); +} +div.panel_620 > div.panel_bottom { + background-image: url("../img/panel_620_b.gif"); +} + +/* 780 */ +div.panel_780 > div.panel_top, div.panel_780 > div.panel_bottom, div.panel_780 > div.panel_middle { + width: 800px; +} +div.panel_780 > div.panel_top { + background-image: url("../img/panel_780_t.gif"); +} +div.panel_780 > div.panel_middle { + background-image: url("../img/panel_780_m.gif"); +} +div.panel_780 > div.panel_bottom { + background-image: url("../img/panel_780_b.gif"); +} + +/* 140_660 */ +div.panel_140_660 > div.panel_top, div.panel_140_660 > div.panel_bottom, div.panel_140_660 > div.panel_middle { + width: 810px; +} +div.panel_140_660 > div.panel_top { + background-image: url("../img/panel_140_660_t.gif"); +} +div.panel_140_660 > div.panel_middle { + background-image: url("../img/panel_140_660_m.gif"); +} +div.panel_140_660 > div.panel_bottom { + background-image: url("../img/panel_140_660_b.gif"); +} + + +/* button -------------------------------------------------------------- */ +div.button { + height:25px; + float: left; + margin-right: 10px; +} +div.button * { font-size: 0px; } + +/* white line -------------------------------------------------------------- */ +div.wl { + height:3px; + background-image: url("../img/line_white.gif"); + background-repeat: repeat; +} + + +/* agent-editor -------------------------------------------------------------- */ +#agent-editor-file-name { + font-size: 12px; + padding-left: 15px; + background-image: url("../img/circle.gif"); + background-repeat: no-repeat; + background-position: 0px 3px; + margin-bottom: 5px; +} +#agent_edit_msg { + padding: 10px; + border: 1px dotted #999999; + width:480px; +} + +div.agent-property-editor { + padding: 10px 10px 10px 20px; + text-align:left; +} +div.agent-property-editor div.title { + margin-top: 5px; + color: #444444; + font-weight: bold; + padding-left: 15px; + /*background: #E2E2E2 url(../img/td_selected.gif) repeat-y 0 0px;*/ + background-image: url("../img/circle.gif"); + background-repeat: no-repeat; + background-position: 0px 3px; +} +div.agent-property-editor div.value { + margin-left: 10px; + margin-top: 3px; +} +div.agent-property-editor input { + width: 350px; +} +div.agent-property-editor div.value pre { + overflow: scroll; + margin-top: 5px; +} +div.agent-property-editor div.value pre, div.agent-property-editor div.value div.property-container { + border: 1px solid #bbbbbb; + margin-right: 10px; + padding: 10px; +} +div.agent-property-editor div.property-description { + margin-top: 3px; +} +div.agent-property-editor input.property-input { + width: 320px; + margin-left: 10px; +} +div.agent-property-editor div.property-value { + margin-left: 10px; +} +div.agent-property-editor .property-problem { + display : none; + color:#FF3366; + font-weight: bold; + margin: 2px 10px 5px 10px; +} + + +.problem { + color:#FF3366; + font-weight: bold; +} +#agent-file-list { + overflow: scroll; + width: 260px; +} +#agent-file-list div.node { + background-repeat: no-repeat; + background-position: 2px 1px; + padding: 0px 4px 0px 21px; + margin: 0px; +} +#agent-file-list div.directory { + background-image: url("../img/folder.png"); +} +#agent-file-list div.file { + background-image: url("../img/page_white_ruby.png"); +} +#agent-file-list div.agents { + background-image: url("../img/folder_user.png"); + font-weight: bold; +} +#agent-file-list div.shared_lib { + background-image: url("../img/folder_brick.png"); + font-weight: bold; +} +#agent-file-list div.selected { + background-color: #FFF; + color: #11116F; +} +/** side bar --------------------------------------------------------------------- */ +div.menu-1 { + margin-top: 15px; + margin-bottom: 2px; +} + +div.menu-2 { + margin-left: 1px; + line-height: 100%; +} + +div.process { + padding: 5px 0px 5px 28px; + line-height: 110%; + width:148px; +} +div.process *, div.process_selected * { + vertical-align: middle; +} +div.process_selected { + padding: 5px 0px 5px 28px; + line-height: 110%; + width:148px; + border:1px solid #339999; + background-image: url("../img/sidebar_back.gif"); + background-repeat: no-repeat; + background-color: #080808; + background-position: -10px 0px 0px 0px; +} +div.process div.name span.name { +} +div.process_selected div.name span a { + color: #F5F5F5; +} +div.process div.date, div.process div.state, div.process_selected div.date, div.process_selected div.state { + margin-top: 1px; + font-size: 10px; + color: #888885; +} +div.process div.detail, div.process_selected div.detail { + margin:2px 1px 2px 1px; + padding-left: 5px; +} +div.process div.detail { + border-left: 2px solid #ADADAA; +} +div.process_selected div.detail { + border-left: 2px solid #339999; +} + +div.progress { + margin-top: 1px; +} +span.process_delete, span.process_restart { + font-size: 10px; +} + +div.progress_bar { + margin-top: 1px; + float:left; + border: 1px solid #66CCFF; + width: 100px; + height: 8px; + background-image: url("../img/progressbar.gif"); + background-repeat: repeat-y; + background-position: -180px 0px; +} +div.progress_value { + float:left; + font-size: 10px; + margin-left: 3px; +} + +div.process_restart { + visibility: hidden; +} + +/** topic_path --------------------------------------------------------------------- */ +ul#topic_path{ + margin: 0px 0px 10px 20px; +} +ul#topic_path li { + display : inline; + padding: 0px 8px 0px 15px; + list-style: none; + background-image: url("../img/delta.gif"); + background-repeat: no-repeat; + background-position: 0px 2px; +} + +/** trade --------------------------------------------------------------------- */ +div#subpage-trade_summary div.category { + /*font-weight: bold;*/ + margin: 10px 0px 5px 0px; + padding-left: 15px; + background-image: url("../img/circle.gif"); + background-repeat: no-repeat; + background-position: 0px 3px; +} +table.values { + border-top: 1px solid #C5C5C5; + border-left: 1px solid #C5C5C5; + border-right: 1px solid #C5C5C5; +} +table.values td.label { + background-color: #D5D5D5; + vertical-align: middle; + padding: 3px 0px 3px 5px; + border-bottom: 1px solid #C5C5C5; + border-right: 1px solid #C5C5C5; +} +table.values td.value { + vertical-align: middle; + text-align: right; + padding: 3px 5px 3px 0px; + border-bottom: 1px solid #C5C5C5; +} +table.large { + width: 620px; +} +table.values td.large { + width: 200px; +} +table.small { + width: 300px; +} +table.values td.small { + width: 110px; +} + +span.win { + color : #FE4B7E; +} +span.lose { + color : #4B7EFF; +} +span.draw { + color : #978CD0; +} + +/** log --------------------------------------------------------------------- */ +div.log { + overflow:scroll; + font-size: 10px; + width: 620px; + height:500px; + margin-top: 10px; +} + +/** graph-setting --------------------------------------------------------------------- */ +div#subpage-graph_list { +} +div#subpage-graph_list div.agent { + margin: 10px 0px 5px 0px; + padding-left: 15px; + background-image: url("../img/circle.gif"); + background-repeat: no-repeat; + background-position: 0px 3px; +} +div#subpage-graph_list div.agent * { + /*vertical-align: middle;*/ +} +div#subpage-graph_list div.agent span.output_delete { + font-size: 10px; + padding-left: 5px; +} +div#subpage-graph_list table.graphs { + margin-left: 20px; +} +div#subpage-graph_list table.graphs input { + height:12px; + vertical-align:middle; +} +div#subpage-graph_list table.graphs label { + padding-left:3px; + line-height:12px; + vertical-align:middle; + font-size:12px; +} +div#subpage-graph_list table.graphs td.color { + padding-left: 10px; + width: 200px; +} + + +/** color picker --------------------------------------------------------------------- */ +div.picker { + margin-right: 5px; + float: left; + border:1px solid #BBBBBB; +} +div.picker_thumb { + width:12px; + height:12px; + border:1px solid #FFFFFF; +} +div.picker_picker { + border: 1px solid #BBBBBB; + background-color: #E2E2E2; + padding:10px; + visibility: hidden; + position: absolute; + z-index: 100; +} +table.picker { + border: 1px solid #FFFFFF; +} +table.picker div.block { + width:8px; + height: 8px; +} + + +/** dateinput --------------------------------------------------------------------- */ +div.dateinput_panel { + border: 1px solid #BBBBBB; + background-color: #E2E2E2; + padding:10px; + visibility: hidden; + position: absolute; + z-index: 100; +} + +/** date-select --------------------------------------------------------------------- */ +div#bt-create__range-summary { + padding: 10px; +} + + + +#debug { + text-align:left; + color:#FFFFFF; +} diff --git a/html/css/dialog.css b/html/css/dialog.css new file mode 100644 index 0000000..c0c3e5b --- /dev/null +++ b/html/css/dialog.css @@ -0,0 +1,77 @@ + +#dialog { + position:absolute; + width:400px; + z-index:200; + background-color : #E2E2E2; + background-repeat: no-repeat; + border: 1px solid #FFFFFF; +} +#dialog-body { + padding:20px; + display:block; +} +#dialog-header { + display:block; + position:relative; + width:400px; + padding:3px 6px 7px; + height:14px; + font-weight:bold +} +#dialog-title { + float:left +} +#dialog-close { + float:right; + cursor:pointer; + margin:3px 3px 0 0; + height:11px; + width:11px; + background:url("../img/dialog_close.gif") no-repeat; +} +#dialog-content { + margin-top: 10px; + text-align: left; +} +#dialog-content div.warn_msg{ + font-weight:bold; + color:#CC2222; + margin-bottom:10px; +} + +#dialog-separator { + display:block; + background-image: url("../img/separator.gif") ; + background-repeat: repeat-x; + height:2px; + width: 360px; + margin: 10px 0px; +} +#dialog-mask { + position:absolute; + top:0; + left:0; + min-height:100%; + width:100%; + background:#222222; + opacity:.80; + filter:alpha(opacity=80); + z-index:100 +} +#dialog-buttons { + float: right; +} +#dialog-buttons default { + border: 1px solid #FFFFFF; +} + +div.warn { + background:url("../img/dialog_warn.jpg") no-repeat; +} +div.info { + background:url("../img/dialog_info.jpg") no-repeat; +} +div.input { + background:url("../img/dialog_input.jpg") no-repeat; +} \ No newline at end of file diff --git a/html/css/treeview.css b/html/css/treeview.css new file mode 100644 index 0000000..98fe624 --- /dev/null +++ b/html/css/treeview.css @@ -0,0 +1,205 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +.ygtvitem { + +} + +.ygtvitem table { + margin-bottom: 0; + border: none; +} + +.ygtvrow td { + border: none; + padding: 0; +} + +.ygtvrow td a { + text-decoration: none; +} + +.ygtvtn { + width: 18px; + height: 20px; + background: url(../img/yui/treeview-sprite.gif) 0 -5600px no-repeat; +} + +.ygtvtm { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -4000px no-repeat; +} + +.ygtvtmh,.ygtvtmhh { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -4800px no-repeat; +} + +.ygtvtp { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -6400px no-repeat; +} + +.ygtvtph,.ygtvtphh { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -7200px no-repeat; +} + +.ygtvln { + width: 18px; + height: 20px; + background: url(../img/yui/treeview-sprite.gif) 0 -1600px no-repeat; +} + +.ygtvlm { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 0px no-repeat; +} + +.ygtvlmh,.ygtvlmhh { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -800px no-repeat; +} + +.ygtvlp { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -2400px no-repeat; +} + +.ygtvlph,.ygtvlphh { + width: 18px; + height: 20px; + cursor: pointer; + background: url(../img/yui/treeview-sprite.gif) 0 -3200px no-repeat; +} + +.ygtvloading { + width: 18px; + height: 20px; + background: url(../img/loading.gif) 0 0 no-repeat; +} + +.ygtvdepthcell { + width: 18px; + height: 20px; + background: url(../img/yui/treeview-sprite.gif) 0 -8000px no-repeat; +} + +.ygtvblankdepthcell { + width: 18px; + height: 20px; +} + +.ygtvchildren { + +} + +* html .ygtvchildren { + height: 2%; +} + +.ygtvlabel,.ygtvlabel:link,.ygtvlabel:visited,.ygtvlabel:hover { + margin-left: 2px; + text-decoration: none; + background-color: white; + cursor: pointer; +} + +.ygtvcontent { + cursor: default; +} + +.ygtvspacer { + height: 20px; + width: 18px; +} + +.ygtvfocus { + background-color: #c0e0e0; + border: none; +} + +.ygtvfocus .ygtvlabel,.ygtvfocus .ygtvlabel:link,.ygtvfocus .ygtvlabel:visited,.ygtvfocus .ygtvlabel:hover + { + background-color: #c0e0e0; +} + +.ygtvfocus a,.ygtvrow td a { + outline-style: none; +} + +.ygtvok { + width: 18px; + height: 20px; + background: url(../img/yui/treeview-sprite.gif) 0 -8800px no-repeat; +} + +.ygtvok:hover { + background: url(../img/yui/treeview-sprite.gif) 0 -8844px no-repeat; +} + +.ygtvcancel { + width: 18px; + height: 20px; + background: url(../img/yui/treeview-sprite.gif) 0 -8822px no-repeat; +} + +.ygtvcancel:hover { + background: url(../img/yui/treeview-sprite.gif) 0 -8866px no-repeat; +} + +.ygtv-label-editor { + background-color: #f2f2f2; + border: 1px solid silver; + position: absolute; + display: none; + overflow: hidden; + margin: auto; + z-index: 9000; +} + +.ygtv-edit-TextNode { + width: 190px; +} + +.ygtv-edit-TextNode .ygtvcancel,.ygtv-edit-TextNode .ygtvok { + border: none; +} + +.ygtv-edit-TextNode .ygtv-button-container { + float: right; +} + +.ygtv-edit-TextNode .ygtv-input input { + width: 140px; +} + +.ygtv-edit-DateNode .ygtvcancel { + border: none; +} + +.ygtv-edit-DateNode .ygtvok { + display: none; +} + +.ygtv-edit-DateNode .ygtv-button-container { + text-align: right; + margin: auto; +} \ No newline at end of file diff --git a/html/img/auto_trade_off.gif b/html/img/auto_trade_off.gif new file mode 100644 index 0000000..d94a3ee Binary files /dev/null and b/html/img/auto_trade_off.gif differ diff --git a/html/img/auto_trade_on.gif b/html/img/auto_trade_on.gif new file mode 100644 index 0000000..396d8c6 Binary files /dev/null and b/html/img/auto_trade_on.gif differ diff --git a/html/img/back_bottom.gif b/html/img/back_bottom.gif new file mode 100644 index 0000000..4edaf67 Binary files /dev/null and b/html/img/back_bottom.gif differ diff --git a/html/img/back_middle.gif b/html/img/back_middle.gif new file mode 100644 index 0000000..0e2b7eb Binary files /dev/null and b/html/img/back_middle.gif differ diff --git a/html/img/back_top.gif b/html/img/back_top.gif new file mode 100644 index 0000000..767ca61 Binary files /dev/null and b/html/img/back_top.gif differ diff --git a/html/img/bin_closed.png b/html/img/bin_closed.png new file mode 100644 index 0000000..afe22ba Binary files /dev/null and b/html/img/bin_closed.png differ diff --git a/html/img/bin_empty.png b/html/img/bin_empty.png new file mode 100644 index 0000000..375b8bf Binary files /dev/null and b/html/img/bin_empty.png differ diff --git a/html/img/bt-create-title-1.gif b/html/img/bt-create-title-1.gif new file mode 100644 index 0000000..13cf3d4 Binary files /dev/null and b/html/img/bt-create-title-1.gif differ diff --git a/html/img/bt-create-title-2.gif b/html/img/bt-create-title-2.gif new file mode 100644 index 0000000..dfb4caf Binary files /dev/null and b/html/img/bt-create-title-2.gif differ diff --git a/html/img/bt-create-title-3.gif b/html/img/bt-create-title-3.gif new file mode 100644 index 0000000..0c56bc1 Binary files /dev/null and b/html/img/bt-create-title-3.gif differ diff --git a/html/img/button_add.gif b/html/img/button_add.gif new file mode 100644 index 0000000..f04fc05 Binary files /dev/null and b/html/img/button_add.gif differ diff --git a/html/img/button_add_gray.gif b/html/img/button_add_gray.gif new file mode 100644 index 0000000..49fe01b Binary files /dev/null and b/html/img/button_add_gray.gif differ diff --git a/html/img/button_add_over.gif b/html/img/button_add_over.gif new file mode 100644 index 0000000..8ca58b7 Binary files /dev/null and b/html/img/button_add_over.gif differ diff --git a/html/img/button_add_small.gif b/html/img/button_add_small.gif new file mode 100644 index 0000000..31c76f8 Binary files /dev/null and b/html/img/button_add_small.gif differ diff --git a/html/img/button_add_small_gray.gif b/html/img/button_add_small_gray.gif new file mode 100644 index 0000000..33a4710 Binary files /dev/null and b/html/img/button_add_small_gray.gif differ diff --git a/html/img/button_add_small_over.gif b/html/img/button_add_small_over.gif new file mode 100644 index 0000000..ab955fc Binary files /dev/null and b/html/img/button_add_small_over.gif differ diff --git a/html/img/button_apply.gif b/html/img/button_apply.gif new file mode 100644 index 0000000..f31ead2 Binary files /dev/null and b/html/img/button_apply.gif differ diff --git a/html/img/button_apply_gray.gif b/html/img/button_apply_gray.gif new file mode 100644 index 0000000..c0b0042 Binary files /dev/null and b/html/img/button_apply_gray.gif differ diff --git a/html/img/button_apply_over.gif b/html/img/button_apply_over.gif new file mode 100644 index 0000000..e3025b0 Binary files /dev/null and b/html/img/button_apply_over.gif differ diff --git a/html/img/button_calendar.gif b/html/img/button_calendar.gif new file mode 100644 index 0000000..85f6869 Binary files /dev/null and b/html/img/button_calendar.gif differ diff --git a/html/img/button_calendar_over.gif b/html/img/button_calendar_over.gif new file mode 100644 index 0000000..1354692 Binary files /dev/null and b/html/img/button_calendar_over.gif differ diff --git a/html/img/button_cancel.gif b/html/img/button_cancel.gif new file mode 100644 index 0000000..b06b90f Binary files /dev/null and b/html/img/button_cancel.gif differ diff --git a/html/img/button_cancel.jpg b/html/img/button_cancel.jpg new file mode 100644 index 0000000..916d7f9 Binary files /dev/null and b/html/img/button_cancel.jpg differ diff --git a/html/img/button_cancel_gray.gif b/html/img/button_cancel_gray.gif new file mode 100644 index 0000000..f6e41e9 Binary files /dev/null and b/html/img/button_cancel_gray.gif differ diff --git a/html/img/button_cancel_over.gif b/html/img/button_cancel_over.gif new file mode 100644 index 0000000..3ce1d69 Binary files /dev/null and b/html/img/button_cancel_over.gif differ diff --git a/html/img/button_cancel_over.jpg b/html/img/button_cancel_over.jpg new file mode 100644 index 0000000..d4cba9e Binary files /dev/null and b/html/img/button_cancel_over.jpg differ diff --git a/html/img/button_close.gif b/html/img/button_close.gif new file mode 100644 index 0000000..3d75ea4 Binary files /dev/null and b/html/img/button_close.gif differ diff --git a/html/img/button_close_gray.gif b/html/img/button_close_gray.gif new file mode 100644 index 0000000..8041a20 Binary files /dev/null and b/html/img/button_close_gray.gif differ diff --git a/html/img/button_close_over.gif b/html/img/button_close_over.gif new file mode 100644 index 0000000..6e543e9 Binary files /dev/null and b/html/img/button_close_over.gif differ diff --git a/html/img/button_mkcol.gif b/html/img/button_mkcol.gif new file mode 100644 index 0000000..34d11ac Binary files /dev/null and b/html/img/button_mkcol.gif differ diff --git a/html/img/button_mkcol_gray.gif b/html/img/button_mkcol_gray.gif new file mode 100644 index 0000000..9ef358d Binary files /dev/null and b/html/img/button_mkcol_gray.gif differ diff --git a/html/img/button_mkcol_over.gif b/html/img/button_mkcol_over.gif new file mode 100644 index 0000000..a34b066 Binary files /dev/null and b/html/img/button_mkcol_over.gif differ diff --git a/html/img/button_no.gif b/html/img/button_no.gif new file mode 100644 index 0000000..902464e Binary files /dev/null and b/html/img/button_no.gif differ diff --git a/html/img/button_no_gray.gif b/html/img/button_no_gray.gif new file mode 100644 index 0000000..e8008a9 Binary files /dev/null and b/html/img/button_no_gray.gif differ diff --git a/html/img/button_no_over.gif b/html/img/button_no_over.gif new file mode 100644 index 0000000..8923765 Binary files /dev/null and b/html/img/button_no_over.gif differ diff --git a/html/img/button_ok.gif b/html/img/button_ok.gif new file mode 100644 index 0000000..805b87a Binary files /dev/null and b/html/img/button_ok.gif differ diff --git a/html/img/button_ok_gray.gif b/html/img/button_ok_gray.gif new file mode 100644 index 0000000..ceaf7d8 Binary files /dev/null and b/html/img/button_ok_gray.gif differ diff --git a/html/img/button_ok_over.gif b/html/img/button_ok_over.gif new file mode 100644 index 0000000..4c005ce Binary files /dev/null and b/html/img/button_ok_over.gif differ diff --git a/html/img/button_remove.gif b/html/img/button_remove.gif new file mode 100644 index 0000000..88d5fa1 Binary files /dev/null and b/html/img/button_remove.gif differ diff --git a/html/img/button_remove_gray.gif b/html/img/button_remove_gray.gif new file mode 100644 index 0000000..2eff8c6 Binary files /dev/null and b/html/img/button_remove_gray.gif differ diff --git a/html/img/button_remove_over.gif b/html/img/button_remove_over.gif new file mode 100644 index 0000000..f6476bf Binary files /dev/null and b/html/img/button_remove_over.gif differ diff --git a/html/img/button_remove_small.gif b/html/img/button_remove_small.gif new file mode 100644 index 0000000..7e8a073 Binary files /dev/null and b/html/img/button_remove_small.gif differ diff --git a/html/img/button_remove_small_gray.gif b/html/img/button_remove_small_gray.gif new file mode 100644 index 0000000..133a35e Binary files /dev/null and b/html/img/button_remove_small_gray.gif differ diff --git a/html/img/button_remove_small_over.gif b/html/img/button_remove_small_over.gif new file mode 100644 index 0000000..9b1b9e5 Binary files /dev/null and b/html/img/button_remove_small_over.gif differ diff --git a/html/img/button_rename.gif b/html/img/button_rename.gif new file mode 100644 index 0000000..54d6220 Binary files /dev/null and b/html/img/button_rename.gif differ diff --git a/html/img/button_rename_gray.gif b/html/img/button_rename_gray.gif new file mode 100644 index 0000000..8e6c48e Binary files /dev/null and b/html/img/button_rename_gray.gif differ diff --git a/html/img/button_rename_over.gif b/html/img/button_rename_over.gif new file mode 100644 index 0000000..2fc0150 Binary files /dev/null and b/html/img/button_rename_over.gif differ diff --git a/html/img/button_save.gif b/html/img/button_save.gif new file mode 100644 index 0000000..8697ba9 Binary files /dev/null and b/html/img/button_save.gif differ diff --git a/html/img/button_save_gray.gif b/html/img/button_save_gray.gif new file mode 100644 index 0000000..c6b3ef7 Binary files /dev/null and b/html/img/button_save_gray.gif differ diff --git a/html/img/button_save_over.gif b/html/img/button_save_over.gif new file mode 100644 index 0000000..9d5fa3c Binary files /dev/null and b/html/img/button_save_over.gif differ diff --git a/html/img/button_start.gif b/html/img/button_start.gif new file mode 100644 index 0000000..e99b79c Binary files /dev/null and b/html/img/button_start.gif differ diff --git a/html/img/button_start_over.gif b/html/img/button_start_over.gif new file mode 100644 index 0000000..4fa2e46 Binary files /dev/null and b/html/img/button_start_over.gif differ diff --git a/html/img/button_update.gif b/html/img/button_update.gif new file mode 100644 index 0000000..94b4699 Binary files /dev/null and b/html/img/button_update.gif differ diff --git a/html/img/button_update_gray.gif b/html/img/button_update_gray.gif new file mode 100644 index 0000000..a748246 Binary files /dev/null and b/html/img/button_update_gray.gif differ diff --git a/html/img/button_update_over.gif b/html/img/button_update_over.gif new file mode 100644 index 0000000..920625e Binary files /dev/null and b/html/img/button_update_over.gif differ diff --git a/html/img/button_update_s.gif b/html/img/button_update_s.gif new file mode 100644 index 0000000..c4aef1d Binary files /dev/null and b/html/img/button_update_s.gif differ diff --git a/html/img/button_update_s_gray.gif b/html/img/button_update_s_gray.gif new file mode 100644 index 0000000..2489e48 Binary files /dev/null and b/html/img/button_update_s_gray.gif differ diff --git a/html/img/button_update_s_over.gif b/html/img/button_update_s_over.gif new file mode 100644 index 0000000..aa99a61 Binary files /dev/null and b/html/img/button_update_s_over.gif differ diff --git a/html/img/button_yes.gif b/html/img/button_yes.gif new file mode 100644 index 0000000..e5a9068 Binary files /dev/null and b/html/img/button_yes.gif differ diff --git a/html/img/button_yes_gray.gif b/html/img/button_yes_gray.gif new file mode 100644 index 0000000..18f8a5b Binary files /dev/null and b/html/img/button_yes_gray.gif differ diff --git a/html/img/button_yes_over.gif b/html/img/button_yes_over.gif new file mode 100644 index 0000000..2981612 Binary files /dev/null and b/html/img/button_yes_over.gif differ diff --git a/html/img/circle.gif b/html/img/circle.gif new file mode 100644 index 0000000..f1aa160 Binary files /dev/null and b/html/img/circle.gif differ diff --git a/html/img/control_play.png b/html/img/control_play.png new file mode 100644 index 0000000..0846555 Binary files /dev/null and b/html/img/control_play.png differ diff --git a/html/img/control_play_blue.png b/html/img/control_play_blue.png new file mode 100644 index 0000000..f8c8ec6 Binary files /dev/null and b/html/img/control_play_blue.png differ diff --git a/html/img/delta.gif b/html/img/delta.gif new file mode 100644 index 0000000..9d6ac04 Binary files /dev/null and b/html/img/delta.gif differ diff --git a/html/img/dialog_info.jpg b/html/img/dialog_info.jpg new file mode 100644 index 0000000..b349054 Binary files /dev/null and b/html/img/dialog_info.jpg differ diff --git a/html/img/dialog_input.jpg b/html/img/dialog_input.jpg new file mode 100644 index 0000000..c17529e Binary files /dev/null and b/html/img/dialog_input.jpg differ diff --git a/html/img/dialog_warn.jpg b/html/img/dialog_warn.jpg new file mode 100644 index 0000000..28f1a13 Binary files /dev/null and b/html/img/dialog_warn.jpg differ diff --git a/html/img/dt-arrow-dn.png b/html/img/dt-arrow-dn.png new file mode 100644 index 0000000..85fda0b Binary files /dev/null and b/html/img/dt-arrow-dn.png differ diff --git a/html/img/dt-arrow-up.png b/html/img/dt-arrow-up.png new file mode 100644 index 0000000..1c67431 Binary files /dev/null and b/html/img/dt-arrow-up.png differ diff --git a/html/img/folder.png b/html/img/folder.png new file mode 100644 index 0000000..784e8fa Binary files /dev/null and b/html/img/folder.png differ diff --git a/html/img/folder_brick.png b/html/img/folder_brick.png new file mode 100644 index 0000000..5dea976 Binary files /dev/null and b/html/img/folder_brick.png differ diff --git a/html/img/folder_user.png b/html/img/folder_user.png new file mode 100644 index 0000000..f021c3e Binary files /dev/null and b/html/img/folder_user.png differ diff --git a/html/img/foot.jpg b/html/img/foot.jpg new file mode 100644 index 0000000..b54125b Binary files /dev/null and b/html/img/foot.jpg differ diff --git a/html/img/h3_bt-create_0.gif b/html/img/h3_bt-create_0.gif new file mode 100644 index 0000000..4a08a95 Binary files /dev/null and b/html/img/h3_bt-create_0.gif differ diff --git a/html/img/h3_bt-create_1.gif b/html/img/h3_bt-create_1.gif new file mode 100644 index 0000000..d21c8e4 Binary files /dev/null and b/html/img/h3_bt-create_1.gif differ diff --git a/html/img/h3_bt-create_2.gif b/html/img/h3_bt-create_2.gif new file mode 100644 index 0000000..d692a94 Binary files /dev/null and b/html/img/h3_bt-create_2.gif differ diff --git a/html/img/h3_result_0.gif b/html/img/h3_result_0.gif new file mode 100644 index 0000000..e85acb8 Binary files /dev/null and b/html/img/h3_result_0.gif differ diff --git a/html/img/h3_result_1.gif b/html/img/h3_result_1.gif new file mode 100644 index 0000000..41c20b8 Binary files /dev/null and b/html/img/h3_result_1.gif differ diff --git a/html/img/h3_result_2.gif b/html/img/h3_result_2.gif new file mode 100644 index 0000000..c33c128 Binary files /dev/null and b/html/img/h3_result_2.gif differ diff --git a/html/img/h3_result_3.gif b/html/img/h3_result_3.gif new file mode 100644 index 0000000..2757137 Binary files /dev/null and b/html/img/h3_result_3.gif differ diff --git a/html/img/h3_result_4.gif b/html/img/h3_result_4.gif new file mode 100644 index 0000000..d692a94 Binary files /dev/null and b/html/img/h3_result_4.gif differ diff --git a/html/img/h3_result_5.gif b/html/img/h3_result_5.gif new file mode 100644 index 0000000..c7d2d8f Binary files /dev/null and b/html/img/h3_result_5.gif differ diff --git a/html/img/h3_result_6.gif b/html/img/h3_result_6.gif new file mode 100644 index 0000000..3f8f707 Binary files /dev/null and b/html/img/h3_result_6.gif differ diff --git a/html/img/h3_rt-setting_0.gif b/html/img/h3_rt-setting_0.gif new file mode 100644 index 0000000..406e55d Binary files /dev/null and b/html/img/h3_rt-setting_0.gif differ diff --git a/html/img/h3_rt-setting_1.gif b/html/img/h3_rt-setting_1.gif new file mode 100644 index 0000000..d692a94 Binary files /dev/null and b/html/img/h3_rt-setting_1.gif differ diff --git a/html/img/head.jpg b/html/img/head.jpg new file mode 100644 index 0000000..d74f391 Binary files /dev/null and b/html/img/head.jpg differ diff --git a/html/img/line-numbers.png b/html/img/line-numbers.png new file mode 100644 index 0000000..5e4a2ea Binary files /dev/null and b/html/img/line-numbers.png differ diff --git a/html/img/line_white.gif b/html/img/line_white.gif new file mode 100644 index 0000000..cb13f65 Binary files /dev/null and b/html/img/line_white.gif differ diff --git a/html/img/loading.gif b/html/img/loading.gif new file mode 100644 index 0000000..4cce7e4 Binary files /dev/null and b/html/img/loading.gif differ diff --git a/html/img/page_white_ruby.png b/html/img/page_white_ruby.png new file mode 100644 index 0000000..f59b7c4 Binary files /dev/null and b/html/img/page_white_ruby.png differ diff --git a/html/img/panel_100_bottom.gif b/html/img/panel_100_bottom.gif new file mode 100644 index 0000000..d05de9a Binary files /dev/null and b/html/img/panel_100_bottom.gif differ diff --git a/html/img/panel_100_middle.gif b/html/img/panel_100_middle.gif new file mode 100644 index 0000000..7bbfeaf Binary files /dev/null and b/html/img/panel_100_middle.gif differ diff --git a/html/img/panel_100_top.gif b/html/img/panel_100_top.gif new file mode 100644 index 0000000..71b0617 Binary files /dev/null and b/html/img/panel_100_top.gif differ diff --git a/html/img/panel_140_650_b.gif b/html/img/panel_140_650_b.gif new file mode 100644 index 0000000..2586391 Binary files /dev/null and b/html/img/panel_140_650_b.gif differ diff --git a/html/img/panel_140_650_m.gif b/html/img/panel_140_650_m.gif new file mode 100644 index 0000000..c9746fc Binary files /dev/null and b/html/img/panel_140_650_m.gif differ diff --git a/html/img/panel_140_650_t.gif b/html/img/panel_140_650_t.gif new file mode 100644 index 0000000..98dced4 Binary files /dev/null and b/html/img/panel_140_650_t.gif differ diff --git a/html/img/panel_140_660_b.gif b/html/img/panel_140_660_b.gif new file mode 100644 index 0000000..1b6e7ea Binary files /dev/null and b/html/img/panel_140_660_b.gif differ diff --git a/html/img/panel_140_660_m.gif b/html/img/panel_140_660_m.gif new file mode 100644 index 0000000..32dcba4 Binary files /dev/null and b/html/img/panel_140_660_m.gif differ diff --git a/html/img/panel_140_660_t.gif b/html/img/panel_140_660_t.gif new file mode 100644 index 0000000..9353d5c Binary files /dev/null and b/html/img/panel_140_660_t.gif differ diff --git a/html/img/panel_140_b.gif b/html/img/panel_140_b.gif new file mode 100644 index 0000000..96e68cc Binary files /dev/null and b/html/img/panel_140_b.gif differ diff --git a/html/img/panel_140_m.gif b/html/img/panel_140_m.gif new file mode 100644 index 0000000..2caa445 Binary files /dev/null and b/html/img/panel_140_m.gif differ diff --git a/html/img/panel_140_t.gif b/html/img/panel_140_t.gif new file mode 100644 index 0000000..40bf3f6 Binary files /dev/null and b/html/img/panel_140_t.gif differ diff --git a/html/img/panel_260_b.gif b/html/img/panel_260_b.gif new file mode 100644 index 0000000..089aacb Binary files /dev/null and b/html/img/panel_260_b.gif differ diff --git a/html/img/panel_260_m.gif b/html/img/panel_260_m.gif new file mode 100644 index 0000000..72057d7 Binary files /dev/null and b/html/img/panel_260_m.gif differ diff --git a/html/img/panel_260_t.gif b/html/img/panel_260_t.gif new file mode 100644 index 0000000..fb57f15 Binary files /dev/null and b/html/img/panel_260_t.gif differ diff --git a/html/img/panel_300_b.gif b/html/img/panel_300_b.gif new file mode 100644 index 0000000..f4ce758 Binary files /dev/null and b/html/img/panel_300_b.gif differ diff --git a/html/img/panel_300_m.gif b/html/img/panel_300_m.gif new file mode 100644 index 0000000..10faae3 Binary files /dev/null and b/html/img/panel_300_m.gif differ diff --git a/html/img/panel_300_t.gif b/html/img/panel_300_t.gif new file mode 100644 index 0000000..1fa360e Binary files /dev/null and b/html/img/panel_300_t.gif differ diff --git a/html/img/panel_320_b.gif b/html/img/panel_320_b.gif new file mode 100644 index 0000000..61ef553 Binary files /dev/null and b/html/img/panel_320_b.gif differ diff --git a/html/img/panel_320_m.gif b/html/img/panel_320_m.gif new file mode 100644 index 0000000..e657b4a Binary files /dev/null and b/html/img/panel_320_m.gif differ diff --git a/html/img/panel_320_t.gif b/html/img/panel_320_t.gif new file mode 100644 index 0000000..f5bcb04 Binary files /dev/null and b/html/img/panel_320_t.gif differ diff --git a/html/img/panel_360_b.gif b/html/img/panel_360_b.gif new file mode 100644 index 0000000..8106ab8 Binary files /dev/null and b/html/img/panel_360_b.gif differ diff --git a/html/img/panel_360_m.gif b/html/img/panel_360_m.gif new file mode 100644 index 0000000..0354d72 Binary files /dev/null and b/html/img/panel_360_m.gif differ diff --git a/html/img/panel_360_t.gif b/html/img/panel_360_t.gif new file mode 100644 index 0000000..188406a Binary files /dev/null and b/html/img/panel_360_t.gif differ diff --git a/html/img/panel_380_b.gif b/html/img/panel_380_b.gif new file mode 100644 index 0000000..c32d80e Binary files /dev/null and b/html/img/panel_380_b.gif differ diff --git a/html/img/panel_380_m.gif b/html/img/panel_380_m.gif new file mode 100644 index 0000000..97bdf29 Binary files /dev/null and b/html/img/panel_380_m.gif differ diff --git a/html/img/panel_380_t.gif b/html/img/panel_380_t.gif new file mode 100644 index 0000000..9a15003 Binary files /dev/null and b/html/img/panel_380_t.gif differ diff --git a/html/img/panel_500_b.gif b/html/img/panel_500_b.gif new file mode 100644 index 0000000..bafbf7b Binary files /dev/null and b/html/img/panel_500_b.gif differ diff --git a/html/img/panel_500_m.gif b/html/img/panel_500_m.gif new file mode 100644 index 0000000..5ba4aaa Binary files /dev/null and b/html/img/panel_500_m.gif differ diff --git a/html/img/panel_500_t.gif b/html/img/panel_500_t.gif new file mode 100644 index 0000000..981bd0c Binary files /dev/null and b/html/img/panel_500_t.gif differ diff --git a/html/img/panel_620_b.gif b/html/img/panel_620_b.gif new file mode 100644 index 0000000..1320402 Binary files /dev/null and b/html/img/panel_620_b.gif differ diff --git a/html/img/panel_620_m.gif b/html/img/panel_620_m.gif new file mode 100644 index 0000000..5f5bf04 Binary files /dev/null and b/html/img/panel_620_m.gif differ diff --git a/html/img/panel_620_t.gif b/html/img/panel_620_t.gif new file mode 100644 index 0000000..ff21359 Binary files /dev/null and b/html/img/panel_620_t.gif differ diff --git a/html/img/panel_780_b.gif b/html/img/panel_780_b.gif new file mode 100644 index 0000000..6a9fc80 Binary files /dev/null and b/html/img/panel_780_b.gif differ diff --git a/html/img/panel_780_m.gif b/html/img/panel_780_m.gif new file mode 100644 index 0000000..c44ba7e Binary files /dev/null and b/html/img/panel_780_m.gif differ diff --git a/html/img/panel_780_t.gif b/html/img/panel_780_t.gif new file mode 100644 index 0000000..1a7d1f0 Binary files /dev/null and b/html/img/panel_780_t.gif differ diff --git a/html/img/problem.gif b/html/img/problem.gif new file mode 100644 index 0000000..a95f05a Binary files /dev/null and b/html/img/problem.gif differ diff --git a/html/img/progressbar.gif b/html/img/progressbar.gif new file mode 100644 index 0000000..2d3692f Binary files /dev/null and b/html/img/progressbar.gif differ diff --git a/html/img/result-title-1-1.gif b/html/img/result-title-1-1.gif new file mode 100644 index 0000000..dec2696 Binary files /dev/null and b/html/img/result-title-1-1.gif differ diff --git a/html/img/result-title-1-2.gif b/html/img/result-title-1-2.gif new file mode 100644 index 0000000..c9acdbd Binary files /dev/null and b/html/img/result-title-1-2.gif differ diff --git a/html/img/result-title-2-1.gif b/html/img/result-title-2-1.gif new file mode 100644 index 0000000..dcc5356 Binary files /dev/null and b/html/img/result-title-2-1.gif differ diff --git a/html/img/result-title-2-2.gif b/html/img/result-title-2-2.gif new file mode 100644 index 0000000..7c40676 Binary files /dev/null and b/html/img/result-title-2-2.gif differ diff --git a/html/img/result-title-3-1.gif b/html/img/result-title-3-1.gif new file mode 100644 index 0000000..24a20f0 Binary files /dev/null and b/html/img/result-title-3-1.gif differ diff --git a/html/img/result-title-4-1.gif b/html/img/result-title-4-1.gif new file mode 100644 index 0000000..08e5bf0 Binary files /dev/null and b/html/img/result-title-4-1.gif differ diff --git a/html/img/rt-setting-title-1.gif b/html/img/rt-setting-title-1.gif new file mode 100644 index 0000000..5547fd1 Binary files /dev/null and b/html/img/rt-setting-title-1.gif differ diff --git a/html/img/rt-setting-title-2.gif b/html/img/rt-setting-title-2.gif new file mode 100644 index 0000000..0c56bc1 Binary files /dev/null and b/html/img/rt-setting-title-2.gif differ diff --git a/html/img/s.gif b/html/img/s.gif new file mode 100644 index 0000000..8434136 Binary files /dev/null and b/html/img/s.gif differ diff --git a/html/img/scroll.gif b/html/img/scroll.gif new file mode 100644 index 0000000..285d7f7 Binary files /dev/null and b/html/img/scroll.gif differ diff --git a/html/img/separator.gif b/html/img/separator.gif new file mode 100644 index 0000000..daf32e6 Binary files /dev/null and b/html/img/separator.gif differ diff --git a/html/img/sidebar_agent.png b/html/img/sidebar_agent.png new file mode 100644 index 0000000..78b33ae Binary files /dev/null and b/html/img/sidebar_agent.png differ diff --git a/html/img/sidebar_agent_edit.png b/html/img/sidebar_agent_edit.png new file mode 100644 index 0000000..817c3b9 Binary files /dev/null and b/html/img/sidebar_agent_edit.png differ diff --git a/html/img/sidebar_agent_edit_agent.png b/html/img/sidebar_agent_edit_agent.png new file mode 100644 index 0000000..b65dc6e Binary files /dev/null and b/html/img/sidebar_agent_edit_agent.png differ diff --git a/html/img/sidebar_agent_edit_agent_over.png b/html/img/sidebar_agent_edit_agent_over.png new file mode 100644 index 0000000..2bad05c Binary files /dev/null and b/html/img/sidebar_agent_edit_agent_over.png differ diff --git a/html/img/sidebar_agent_edit_agent_s.png b/html/img/sidebar_agent_edit_agent_s.png new file mode 100644 index 0000000..37bb45a Binary files /dev/null and b/html/img/sidebar_agent_edit_agent_s.png differ diff --git a/html/img/sidebar_agent_edit_over.png b/html/img/sidebar_agent_edit_over.png new file mode 100644 index 0000000..9c2ff39 Binary files /dev/null and b/html/img/sidebar_agent_edit_over.png differ diff --git a/html/img/sidebar_agent_edit_s.png b/html/img/sidebar_agent_edit_s.png new file mode 100644 index 0000000..2a1e40b Binary files /dev/null and b/html/img/sidebar_agent_edit_s.png differ diff --git a/html/img/sidebar_agent_edit_shared_lib.png b/html/img/sidebar_agent_edit_shared_lib.png new file mode 100644 index 0000000..ce20312 Binary files /dev/null and b/html/img/sidebar_agent_edit_shared_lib.png differ diff --git a/html/img/sidebar_agent_edit_shared_lib_over.png b/html/img/sidebar_agent_edit_shared_lib_over.png new file mode 100644 index 0000000..1dedea6 Binary files /dev/null and b/html/img/sidebar_agent_edit_shared_lib_over.png differ diff --git a/html/img/sidebar_agent_edit_shared_lib_s.png b/html/img/sidebar_agent_edit_shared_lib_s.png new file mode 100644 index 0000000..7fffcd1 Binary files /dev/null and b/html/img/sidebar_agent_edit_shared_lib_s.png differ diff --git a/html/img/sidebar_back.gif b/html/img/sidebar_back.gif new file mode 100644 index 0000000..91804a6 Binary files /dev/null and b/html/img/sidebar_back.gif differ diff --git a/html/img/sidebar_bt.png b/html/img/sidebar_bt.png new file mode 100644 index 0000000..4b8a770 Binary files /dev/null and b/html/img/sidebar_bt.png differ diff --git a/html/img/sidebar_bt_create.png b/html/img/sidebar_bt_create.png new file mode 100644 index 0000000..a59c0d2 Binary files /dev/null and b/html/img/sidebar_bt_create.png differ diff --git a/html/img/sidebar_bt_create_over.png b/html/img/sidebar_bt_create_over.png new file mode 100644 index 0000000..34d2bb6 Binary files /dev/null and b/html/img/sidebar_bt_create_over.png differ diff --git a/html/img/sidebar_bt_create_s.png b/html/img/sidebar_bt_create_s.png new file mode 100644 index 0000000..0559360 Binary files /dev/null and b/html/img/sidebar_bt_create_s.png differ diff --git a/html/img/sidebar_bt_result.png b/html/img/sidebar_bt_result.png new file mode 100644 index 0000000..ade447a Binary files /dev/null and b/html/img/sidebar_bt_result.png differ diff --git a/html/img/sidebar_bt_result_over.png b/html/img/sidebar_bt_result_over.png new file mode 100644 index 0000000..30ba3df Binary files /dev/null and b/html/img/sidebar_bt_result_over.png differ diff --git a/html/img/sidebar_bt_result_s.png b/html/img/sidebar_bt_result_s.png new file mode 100644 index 0000000..5c7178e Binary files /dev/null and b/html/img/sidebar_bt_result_s.png differ diff --git a/html/img/sidebar_result_rmt.png b/html/img/sidebar_result_rmt.png new file mode 100644 index 0000000..14af3b2 Binary files /dev/null and b/html/img/sidebar_result_rmt.png differ diff --git a/html/img/sidebar_result_rmt_over.png b/html/img/sidebar_result_rmt_over.png new file mode 100644 index 0000000..e808c99 Binary files /dev/null and b/html/img/sidebar_result_rmt_over.png differ diff --git a/html/img/sidebar_result_rmt_s.png b/html/img/sidebar_result_rmt_s.png new file mode 100644 index 0000000..1b22e49 Binary files /dev/null and b/html/img/sidebar_result_rmt_s.png differ diff --git a/html/img/sidebar_rt.png b/html/img/sidebar_rt.png new file mode 100644 index 0000000..1cbbcbe Binary files /dev/null and b/html/img/sidebar_rt.png differ diff --git a/html/img/sidebar_rt_setting.png b/html/img/sidebar_rt_setting.png new file mode 100644 index 0000000..435133d Binary files /dev/null and b/html/img/sidebar_rt_setting.png differ diff --git a/html/img/sidebar_rt_setting_over.png b/html/img/sidebar_rt_setting_over.png new file mode 100644 index 0000000..9d95cc3 Binary files /dev/null and b/html/img/sidebar_rt_setting_over.png differ diff --git a/html/img/sidebar_rt_setting_s.png b/html/img/sidebar_rt_setting_s.png new file mode 100644 index 0000000..816525e Binary files /dev/null and b/html/img/sidebar_rt_setting_s.png differ diff --git a/html/img/sprite.png b/html/img/sprite.png new file mode 100644 index 0000000..73634d6 Binary files /dev/null and b/html/img/sprite.png differ diff --git a/html/img/submenu_agents.png b/html/img/submenu_agents.png new file mode 100644 index 0000000..e822fd3 Binary files /dev/null and b/html/img/submenu_agents.png differ diff --git a/html/img/submenu_agents_over.png b/html/img/submenu_agents_over.png new file mode 100644 index 0000000..e63d198 Binary files /dev/null and b/html/img/submenu_agents_over.png differ diff --git a/html/img/submenu_agents_s.png b/html/img/submenu_agents_s.png new file mode 100644 index 0000000..51b85d0 Binary files /dev/null and b/html/img/submenu_agents_s.png differ diff --git a/html/img/submenu_graph.png b/html/img/submenu_graph.png new file mode 100644 index 0000000..1224199 Binary files /dev/null and b/html/img/submenu_graph.png differ diff --git a/html/img/submenu_graph_over.png b/html/img/submenu_graph_over.png new file mode 100644 index 0000000..c7755ac Binary files /dev/null and b/html/img/submenu_graph_over.png differ diff --git a/html/img/submenu_graph_s.png b/html/img/submenu_graph_s.png new file mode 100644 index 0000000..5c866e1 Binary files /dev/null and b/html/img/submenu_graph_s.png differ diff --git a/html/img/submenu_info.png b/html/img/submenu_info.png new file mode 100644 index 0000000..dae03cd Binary files /dev/null and b/html/img/submenu_info.png differ diff --git a/html/img/submenu_info_over.png b/html/img/submenu_info_over.png new file mode 100644 index 0000000..9a9fea5 Binary files /dev/null and b/html/img/submenu_info_over.png differ diff --git a/html/img/submenu_info_s.png b/html/img/submenu_info_s.png new file mode 100644 index 0000000..7d3af96 Binary files /dev/null and b/html/img/submenu_info_s.png differ diff --git a/html/img/submenu_log.png b/html/img/submenu_log.png new file mode 100644 index 0000000..1a93bb1 Binary files /dev/null and b/html/img/submenu_log.png differ diff --git a/html/img/submenu_log_over.png b/html/img/submenu_log_over.png new file mode 100644 index 0000000..740dad0 Binary files /dev/null and b/html/img/submenu_log_over.png differ diff --git a/html/img/submenu_log_s.png b/html/img/submenu_log_s.png new file mode 100644 index 0000000..09ffd41 Binary files /dev/null and b/html/img/submenu_log_s.png differ diff --git a/html/img/submenu_operation.png b/html/img/submenu_operation.png new file mode 100644 index 0000000..694afb1 Binary files /dev/null and b/html/img/submenu_operation.png differ diff --git a/html/img/submenu_operation_over.png b/html/img/submenu_operation_over.png new file mode 100644 index 0000000..111be23 Binary files /dev/null and b/html/img/submenu_operation_over.png differ diff --git a/html/img/submenu_operation_s.png b/html/img/submenu_operation_s.png new file mode 100644 index 0000000..b75d4e8 Binary files /dev/null and b/html/img/submenu_operation_s.png differ diff --git a/html/img/submenu_trade.png b/html/img/submenu_trade.png new file mode 100644 index 0000000..ffe8a39 Binary files /dev/null and b/html/img/submenu_trade.png differ diff --git a/html/img/submenu_trade_over.png b/html/img/submenu_trade_over.png new file mode 100644 index 0000000..ae775ed Binary files /dev/null and b/html/img/submenu_trade_over.png differ diff --git a/html/img/submenu_trade_s.png b/html/img/submenu_trade_s.png new file mode 100644 index 0000000..d13db35 Binary files /dev/null and b/html/img/submenu_trade_s.png differ diff --git a/html/img/td_over.gif b/html/img/td_over.gif new file mode 100644 index 0000000..91f17b3 Binary files /dev/null and b/html/img/td_over.gif differ diff --git a/html/img/td_over_d.gif b/html/img/td_over_d.gif new file mode 100644 index 0000000..db19acf Binary files /dev/null and b/html/img/td_over_d.gif differ diff --git a/html/img/td_selected.gif b/html/img/td_selected.gif new file mode 100644 index 0000000..92fab96 Binary files /dev/null and b/html/img/td_selected.gif differ diff --git a/html/img/thead.gif b/html/img/thead.gif new file mode 100644 index 0000000..0aaa068 Binary files /dev/null and b/html/img/thead.gif differ diff --git a/html/img/transparent.gif b/html/img/transparent.gif new file mode 100644 index 0000000..099c95f Binary files /dev/null and b/html/img/transparent.gif differ diff --git a/html/img/yui/treeview-sprite.gif b/html/img/yui/treeview-sprite.gif new file mode 100644 index 0000000..ad213f8 Binary files /dev/null and b/html/img/yui/treeview-sprite.gif differ diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..2908441 --- /dev/null +++ b/html/index.html @@ -0,0 +1,492 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jiji + + +
+
+ +
+
+ +
+ +
+ 自動取引 +
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/html/js/agent-editor/agent-editor-page.js b/html/js/agent-editor/agent-editor-page.js new file mode 100644 index 0000000..ee77c97 --- /dev/null +++ b/html/js/agent-editor/agent-editor-page.js @@ -0,0 +1,324 @@ +// ネームスペース +namespace( "fx.ui" ) +namespace( "fx.ui.pages" ) + +// エージェント追加/編集UI +fx.ui.pages.AgentEditorPage = function() { + this.elementId = null; + this.editorElementId = null; + this.agentEditor = container.Inject; + this.agentFileListTree = container.Inject; + this.dialog = container.Inject; + this.topicPath = container.Inject; + + // ボタン + var self = this; + this.addButton = new util.Button("agent-edit_add", "add_small", function() { + self.add("file"); + }, fx.template.Templates.common.button.fileAdd); + this.addButton.setEnable( false ); + + this.removeButton = new util.Button("agent-edit_remove", "remove_small", function() { + self.remove(); + }, fx.template.Templates.common.button.del); + this.removeButton.setEnable( false ); + + this.mkcolButton = new util.Button("agent-edit_mkcol", "mkcol", function() { + self.add("directory"); + }, fx.template.Templates.common.button.mkcol); + this.mkcolButton.setEnable( false ); + + this.renameButton = new util.Button("agent-edit_rename", "rename", function() { + self.add("rename"); + }, fx.template.Templates.common.button.rename); + this.renameButton.setEnable( false ); +} +fx.ui.pages.AgentEditorPage.prototype = { + + /** + * このページから画面を移動する際に呼び出される。 + * 戻り値としてfalseを返すと遷移をキャンセルする。 + */ + from : function(toId) { + // ページを非表示 + document.getElementById(this.elementId).style.display = "none"; + this.topicPath.set(""); + return true; + }, + /** + * このページに画面を移動すると呼び出される。 + */ + to : function( fromId, param ) { + // ページを表示 + document.getElementById(this.elementId).style.display = "block"; + this.topicPath.set( fx.template.Templates.agentEditor.topicPath ); + document.getElementById("agent_edit_desc").innerHTML = + fx.template.Templates.agentEditor.desc + this.initialize(); + }, + + initialize: function( ) { + var self = this; + if ( this.initializeed ) return; + + this.agentFileListTree.init(); + + // ファイルのダブルクリックで編集開始 + this.agentFileListTree.tree.subscribe( "dblClickEvent", function(ev, node) { + self.startEdit( ev.node.data.data ); + } ); + + // 編集領域を初期化 + editAreaLoader.init({ + id : this.editorElementId, + syntax: "ruby", + start_highlight: true, + language: "ja", + allow_toggle: false, + allow_resize: "y", + font_size: 10, + toolbar: "save, |, search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, help ", + is_multi_files: true, + save_callback: "fx.ui.pages.AgentEditorPage.EditAreaCallBacks.saved", + EA_file_close_callback: "fx.ui.pages.AgentEditorPage.EditAreaCallBacks.closed" + }); + + // コールバック関数 + fx.ui.pages.AgentEditorPage.EditAreaCallBacks = { + // データが保存されると呼び出されるコールバック関数 + saved : function( editor_id, content ) { + var file = editAreaLoader.getCurrentFile(editor_id); + var editorPage = fx.ui.pages.AgentEditorPage.EditAreaCallBacks.findEditorPage(); + editorPage.save( {path:file.id,name:file.name,type:"file"}, file.text); + // 保存に成功したら、編集状態を解除(タイトルの「*」を消す) + editAreaLoader.setFileEditedMode(editor_id, file.id, false); + }, + // タブがクローズされると呼び出されるコールバック関数。 + closed : function(file) { + // 未保存であれば保存を確認 + if (!file['edited']) return true; + fx.container.get("dialog").show( "input", { + message : fx.template.Templates.agentEditor.dosave, + buttons : [ + { type:"yes", + alt: fx.template.Templates.common.button.yes, + key: "Enter", + action: function(dialog){ + var editorPage = fx.ui.pages.AgentEditorPage.EditAreaCallBacks.findEditorPage(); + editorPage.save( {path:file.id,name:file.name,type:"file"}, file.text); + return true; + }}, + { type:"no", + alt: fx.template.Templates.common.button.no, + key: "Esc", + action: function(dialog){ return true;} + } + ] + }); + return true; + }, + findEditorPage : function() { + var pages = fx.container.gets("pages"); + for ( var i=0; i 0 ) { + var body = fx.template.Templates.agentEditor.remove.error.evaluate( {error:str} ); + self.showError( body ); + } + }, function(ex) { + var body = fx.template.Templates.agentEditor.remove.error.evaluate( {error:ex.msg} ); + self.showError( body ); + } ); + } finally { + self.enableEditor(); + } + return true; + } + }, + { type:"cancel", + alt: fx.template.Templates.common.button.cancel, + key: "Esc", + action: function(dialog){ + self.enableEditor(); + return true; + } + } + ] + }); + }, + // エラーを表示する。 + showError : function( msg ) { + // 確認 + var self = this; + this.dialog.show( "warn", { + message : msg, + init: function() { self.enableEditor(); }, + buttons : [ + { type:"ok", + alt: fx.template.Templates.common.button.ok, + key: "Enter", + action: function(dialog){ + self.enableEditor(); + return true; + } + } + ] + }); + }, + + // データを保存する。 + save: function( editingFile, newData ){ + var self = this; + this.agentEditor.put( editingFile.path, newData, function(result){ + document.getElementById("agent_edit_msg").innerHTML = + fx.template.Templates.agentEditor.saved.success.evaluate({ "now" : util.formatDate( new Date() ) }); + }, function(result, detail) { + document.getElementById("agent_edit_msg").innerHTML = + fx.template.Templates.agentEditor.saved.error.evaluate({ "now" : util.formatDate( new Date() ), "result":result.escapeHTML()} ); + } ); + }, + + // 編集を開始する。 + startEdit : function( file ) { + var self = this; + this.agentEditor.get( file.path, function(body) { + editAreaLoader.openFile(self.editorElementId, { + id : file.path, + title : file.name, + text : body + }); + }, function(){}); // TODO + } +} \ No newline at end of file diff --git a/html/js/agent-editor/agent-editor.js b/html/js/agent-editor/agent-editor.js new file mode 100644 index 0000000..c396578 --- /dev/null +++ b/html/js/agent-editor/agent-editor.js @@ -0,0 +1,363 @@ +// ネームスペース +namespace( "fx" ); + +// エージェントエディタコントローラ +fx.AgentEditor = function() { + this.agentServiceStub = container.Inject; + this.selections = new Hash({}); + this.listeners = new util.Listener(); + + this.agentChangeListeners = container.Injects( + container.types.has( "onAgentChanged" ) ); + this.selectionChangeListeners = container.Injects( + container.types.has( "onAgentSelectionChanged" ) ); +} +fx.AgentEditor.prototype = { + + EVENTS : { + // 特定のパス配下の一覧が更新された + CHANGED : "changed", + // 選択が変更された + SELECTION_CHANGED : "selection_changed" + }, + + /** + * インスタンスを初期化する + */ + init : function() { + for (var i=0;i 300 && diff < 600 ) { +// // リネーム開始 +// if ( data.path == "agents" || data.path == "shared_lib" ) return false; +// this.agentEditor.clear(); +// this.agentEditor.select(data); +// editNode(); +// return false; +// } +// this.prevSelect = null; +// } + + // 選択変更 + // 選択がない + if ( ev.event.ctrlKey ) { + // CTRL + クリック + if ( this.agentEditor.isSelected( data.path ) ) { + this.agentEditor.unselect(data); + } else { + this.agentEditor.select(data); + } + this.rangeSelectStart = null; + } else if ( ev.event.shiftKey ) { + // SHIFT + クリック + var selections = this.agentEditor.getSelections(); + // 基点が決まっていない場合、基点を決める + if ( !this.rangeSelectStart ) { + if ( selections.size() > 0 ) { + // 選択されているアイテムの中で一番上のものを範囲選択の基点とする。 + selections = this.sortByIndex(selections); + this.rangeSelectStart = selections[0]; + } else { + // 選択がなければ、クリックと同じ動作 + this.agentEditor.clear(); + this.agentEditor.select(data); + this.rangeSelectStart = null; + } + } + // 基点から、クリックした位置までの要素を選択。 + this.agentEditor.clear(); + var range = this.sortByIndex([this.rangeSelectStart,data]); + var current = this.findNodeByPath( range[0].path ); + var end = this.findNodeByPath( range[1].path ); + while( current && current != end ) { + var tmp = current.data.data; + if (!tmp.index) tmp.index = this.createIndex( current, [] ); + this.agentEditor.select(tmp); + if ( current.expanded && current.children.length > 0 ) { + current = current.children[0]; + continue; + } + if (current.nextSibling) { + current = current.nextSibling; + continue; + } + tmp = current.parent; + current = null; + while ( tmp ) { + if ( tmp.nextSibling ) { + current = tmp.nextSibling; + break; + } else { + tmp = tmp.parent; + } + } + } + if ( current ) { + var tmp = current.data.data; + if (!tmp.index) tmp.index = this.createIndex( current,[] ); + this.agentEditor.select(tmp); + } + } else { + this.agentEditor.clear(); + this.agentEditor.select(data); + this.rangeSelectStart = null; + } + return false; + }, + + sortByIndex : function( array ) { + return array.sort( function( a,b ) { + var n = Math.min( a.index.length, b.index.length ); + for ( var i=0; i 0 ) { + self.agentClassListTable.table.selectRow(0); + } + }, null ); // TODO + }, + buttons : [ + { type:"ok", + alt: fx.template.Templates.common.button.ok, + key: "Enter", action: function(dialog){ + + var selectedRowIds = self.agentClassListTable.table.getSelectedRows(); + var error = null; + if ( selectedRowIds <= 0 ) { + error = fx.template.Templates.common.errorMsg.notSelected; + } + if ( !error ) { + var agents = []; + for ( var i = 0; i < selectedRowIds.length; i++ ) { + var record = self.agentClassListTable.table.getRecord( selectedRowIds[i] ); + agents.push( record.getData() ); + } + } + + if (error) { + dialog.content.innerHTML = fx.template.Templates.agentSelector.error.evaluate({ + error: error.escapeHTML(), + msg: msg.escapeHTML() + }); + self.agentClassListTable.elementId = "agent_class_list"; + self.agentClassListTable.initialize(); + self.agentClassListTable.setData(self.agentClasses); + return false; + } else { + self._add( agents ); + } + } }, + { type:"cancel", alt: fx.template.Templates.common.button.cancel, key: "Esc" } + ] + } ); + + + }, + // 追加 + _add: function( newAgents ){ + + // 利用されている名前 + var set = {}; + var rs = this.agentListTable.table.getRecordSet().getRecords( 0, + this.agentListTable.table.getRecordSet().getLength() ); + for ( var j=0,s=rs.length;j"; + }} + ]; + self.ds = new YAHOO.util.DataSource([]); + self.ds.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; + self.ds.responseSchema = { + fields: ["class_name","description", "file_name", "properties"] + }; + self.table = new YAHOO.widget.ScrollingDataTable( self.elementId, + columnDefs, self.ds, { + selectionMode:"single", + scrollable: true, + width: "360px", + height: "250px" + } + ); + this.setBasicActions(); + } +}); +// エージェント一覧テーブル +fx.agent.ui.AgentListTable = function(elementId, tableWidth) { + this.elementId = elementId; // @Inject + this.tableWidth = tableWidth; + this.table = null; + this.ds = null; +} +fx.agent.ui.AgentListTable.prototype = util.merge( util.BasicTable, { + initialize: function() { + var self = this; + var columnDefs = [ + {key:"name", label:"名前", sortable:true, resizeable:true, width:100, formatter: function( cell, record, column, data){ + var str = data.escapeHTML(); + if ( record.getData().state === "error" || record.getData().duplicate_name_error ) { + str = '
' + String(str).escapeHTML() + '
'; + } + cell.innerHTML = str; + }}, + {key:"class_name", label:"クラス", sortable:true, resizeable:true, formatter: function( cell, record, column, data){ + cell.innerHTML = String(data).escapeHTML(); + }, width:80 }, + {key:"file_name", label:"ファイル", sortable:true, resizeable:true, formatter: function( cell, record, column, data){ + cell.innerHTML = String(data).escapeHTML(); + }, width:80 }, + {key:"properties", label:"プロパティ", sortable:true, resizeable:true, width:250, formatter: function( cell, record, column, data){ + var str = ""; + for( var k in data ) { + str += String(record.getData().property_def[k].name).escapeHTML() + "=" + String(data[k]).escapeHTML() + ", "; + if ( str.length > 500 ) { break; } + } + cell.innerHTML = str; + }} + ]; + self.ds = new YAHOO.util.DataSource([]); + self.ds.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; + self.ds.responseSchema = { + fields: ["name", "class_name", "description", "file_name", "properties", "state"] + }; + self.table = new YAHOO.widget.DataTable(self.elementId, + columnDefs, self.ds, { + selectionMode:"standard", + scrollable: true, + width: (this.tableWidth || 380) + "px" + } + ); + this.setBasicActions(); + } +}); + +// エージェントプロパティエディタ +fx.agent.ui.AgentPropertyEditor = function( elementId, agentsSelector ) { + this.elementId = elementId; // @Inject + this.agentsSelector = agentsSelector; + this.editing = null; +} +fx.agent.ui.AgentPropertyEditor.prototype = { + + initialize: function() { + document.getElementById( this.elementId ).innerHTML = + fx.template.Templates.agentPropertyEditor.none.evaluate({}); + this.editing = null; + }, + // 名前の制約条件 + NAME_RESTRICT : { + type: "name", + restrict: { nullable:false, length:100, format: /[^\r\n\t\\\/\|\;]/ } + }, + /** + * プロパティ編集UIを表示する。 + * @param {Object} properties + */ + set : function( agent ) { + var self = this; + this.editing = util.merge({}, agent); + var props = ""; + for ( var i in agent.property_def ) { + props += fx.template.Templates.agentPropertyEditor.property.evaluate({ + "name": agent.property_def[i].name.escapeHTML(), + "id": agent.property_def[i].id, + "default": agent.properties[agent.property_def[i].id] != null + ? agent.properties[agent.property_def[i].id] : agent.property_def[i]["default"] + }); + } + var info = { + "id": this.elementId, + "class_name":agent.class_name.escapeHTML(), + "name": agent.name.escapeHTML(), + "desc": agent.description.escapeHTML(), + "properties":props + }; + document.getElementById( this.elementId ).innerHTML = + fx.template.Templates.agentPropertyEditor.selected.evaluate(info); + + // 値のチェック処理を追加 + this.validators = {}; + this.setValidator( "agent_name", this.NAME_RESTRICT ); + for ( var i in agent.property_def ) { + var id = "property_" + agent.property_def[i].id; + this.setValidator( id, agent.property_def[i] ); + } + }, + // フォーカスロストでのバリデータを仕込む + setValidator : function( id, def ) { + this.validators[id] = def; // getでの取得時に評価するため記録しておく。 + var self = this; + var input = document.getElementById( id ); + var f = function() { + var value = input.value; + var error = self.validate[def.type].call( + self, value, def.restrict ); + var el = document.getElementById( id+"_problem" ); + if ( error ) { + el.innerHTML = "※"+error; + el.style.display = "block"; + } else { + el.innerHTML = ""; + el.style.display = "none"; + } + } + // 初期値のチェック + f(); + input.onblur = f; + }, + + /** + * 編集されたプロパティを取得する。 + */ + get : function() { + if ( !this.editing ) { return null; } + var error = null; + var form = document.forms["agent-property-editor-form_" + this.elementId]; + for ( var i=0; i 0 && value.length >= restrict.length ) { + error = fx.template.Templates.common.errorMsg.tooLong; + } + if ( util.CONTROLL_CODE.test( value ) ) { + error = fx.template.Templates.common.errorMsg.illegalChar; + } + if ( restrict.format && !new RegExp( restrict.format ).test( value ) ) { + error = fx.template.Templates.common.errorMsg.illegalFormat; + } + } + return error; + }, + number : function( value, restrict ) { + restrict = restrict || {}; + var error = this.validate.nullable( value, restrict ); + if ( value ) { + if ( (restrict.max != null && Number( value ) > restrict.max ) + || ( restrict.min != null && Number( value ) < restrict.min ) ) { + error = fx.template.Templates.common.errorMsg.outOfRange; + } + if ( !/^[\-\.\d]+$/.test( value ) ) { + error = fx.template.Templates.common.errorMsg.notNumber; + } + } + return error; + }, + nullable : function( value, restrict ) { + if ( !value && !restrict.nullable ) { + return fx.template.Templates.common.errorMsg.notInput; + } else { + return null; + } + } + } +} + + +//エージェントプロパティエディタ(読み込み専用) +fx.agent.ui.AgentPropertyEditorReadOnly = function( elementId, agentsSelector ) { + this.elementId = elementId; // @Inject + this.agentsSelector = agentsSelector; + this.editing = null; +} +fx.agent.ui.AgentPropertyEditorReadOnly.prototype = { + + initialize: function() { + document.getElementById( this.elementId ).innerHTML = + fx.template.Templates.agentPropertyEditor.none.evaluate({}); + this.editing = null; + }, + /** + * プロパティ編集UIを表示する。 + * @param {Object} properties + */ + set : function( agent ) { + var self = this; + this.editing = util.merge({}, agent); + var props = ""; + for ( var i in agent.property_def ) { + var value = agent.properties[agent.property_def[i].id] || agent.property_def[i]["default"]; + if (value && Object.isFunction(value.escapeHTML )) { value = value.escapeHTML(); } + props += fx.template.Templates.agentPropertyEditor.propertyReadOnly.evaluate({ + "name": agent.property_def[i].name.escapeHTML(), + "id": agent.property_def[i].id, + "default": value + }); + } + var info = { + "id": this.elementId, + "class_name":agent.class_name.escapeHTML(), + "name": agent.name.escapeHTML(), + "desc": agent.description.escapeHTML(), + "properties":props + }; + document.getElementById( this.elementId ).innerHTML = + fx.template.Templates.agentPropertyEditor.selectedReadOnly.evaluate(info); + }, + /** + * 編集されたプロパティを取得する。 + */ + get : function() { + return null; + }, + end : function() { + this.editing = null; + }, + /** + * 何も編集していない状態にする。 + */ + clear : function (str) { + var str = str || ""; + document.getElementById( this.elementId ).innerHTML =str; + } +} \ No newline at end of file diff --git a/html/js/app.js b/html/js/app.js new file mode 100644 index 0000000..a0b1b8d --- /dev/null +++ b/html/js/app.js @@ -0,0 +1,198 @@ + +// ネームスペース +namespace( "fx" ); + + +// 定数 +fx.constants = { + SERVICE_URI : "./json", + AGENTS_DIR : "agents", + SHARED_LIB_DIR : "shared_lib" +} + +// モジュール +fx.modules = { + // UIモジュール + ui : function(binder) { + // App + binder.bind( fx.Application ).to( "app" ); + + // page manager + binder.bind( util.PageManager ).to( "pageManager" ).initialize( function( obj, container ) { + obj.init( container.gets("pages")); + }); + + // pages + binder.bind( fx.ui.pages.RtSettingPage ).to( "pages" ).inject({ + id : "rt_setting", + elementId : "page-rt-setting" + }).initialize("initialize"); + binder.bind( fx.ui.pages.AgentEditorPage ).to( "pages" ).inject({ + id : "agent_edit", + elementId : "page-agent-edit", + editorElementId : "agent_editor" + }); + binder.bind( fx.ui.pages.BtCreatePage ).to( "pages" ).inject({ + id : "bt_create", + elementId : "page-bt-create" + }).initialize("initialize"); + binder.bind( fx.ui.pages.ResultPage ).to( "pages" ).inject({ + id : "result", + elementId : "page-result" + }).initialize("initialize"); + + // page manager (結果一覧ページ用) + binder.bind( util.PageManager ).to( "resultPageManager" ).initialize( function( obj, container ) { + obj.init( container.gets("result_pages")); + }); + binder.bind( fx.ui.pages.LogResultPage ).to( "result_pages" ).inject({ + id : "log", + elementId : "subpage-log" + }); + binder.bind( fx.ui.pages.TradeResultPage ).to( "result_pages" ).inject({ + id : "trade", + elementId : "subpage-trade" + }); + binder.bind( fx.ui.pages.InfoResultPage ).to( "result_pages" ).inject({ + id : "info", + elementId : "subpage-info" + }).initialize("initialize"); + binder.bind( fx.ui.pages.GraphSettingResultPage ).to( "result_pages" ).inject({ + id : "graph", + elementId : "subpage-graph" + }); + + // agent editor + binder.bind( fx.agent.ui.AgentSelector ).to( "rtSettingAgentSelector" ).inject({ + id: "rt-setting_as" + }); + binder.bind( fx.agent.ui.AgentSelector ).to( "btCreateAgentSelector" ).inject({ + id: "bt-create_as" + }); + binder.bind( fx.agent.ui.AgentSelector ).to( "subpageInfoAgentSelector" ).inject({ + id: "subpage-info_as" + }); + + // agent-edit + binder.bind( fx.ui.AgentFileListTree ).to( "agentFileListTree" ).inject({ + elementId : "agent-file-list" + }); + + // side-bar + binder.bind( fx.ui.SideBar ).to( "sideBar" ).inject({ + elementId : "back-tests" + }); + + // topicPath + binder.bind( util.TopicPath ).to( "topicPath" ).inject({ + elementId : "topic_path" + }); + + // tradeEnable + binder.bind( fx.ui.TradeEnable ).to( "tradeEnable" ).inject({ + elementId : "head_trade_enable" + }).initialize("init"); + + // dialog + binder.bind( util.Dialog ).to( "dialog" ); + }, + + // 非UI + core : function( binder ) { + + // ctrl + binder.bind( fx.AgentEditor ).to( "agentEditor" ).initialize("init"); + + // stub + binder.bindProvider( function() { + return JSONBrokerClientFactory.createFromList( + fx.constants.SERVICE_URI + "/agent", + ["list_agent_class", + "put_file", "add_file", "mkcol", + "remove", + "move", "rename", + "list_agent", + "add_agent", + "remove_agent", + "off", "on", + "list_files", + "get_file"] ); + } ).to("agentServiceStub"); + + binder.bindProvider( function() { + return JSONBrokerClientFactory.createFromList( + fx.constants.SERVICE_URI + "/process", + ["list_test", + "get", + "set", + "new_test", + "status", + "delete_test", + "stop", + "restart"] ); + } ).to("processServiceStub"); + binder.bindProvider( function() { + return JSONBrokerClientFactory.createFromList( + fx.constants.SERVICE_URI + "/output", + [ "get_log", "list_outputs", "set_properties", "delete_output" ] ); + } ).to("outputServiceStub"); + binder.bindProvider( function() { + return JSONBrokerClientFactory.createFromList( + fx.constants.SERVICE_URI + "/trade_result", + [ "list" ] ); + } ).to("tradeResultServiceStub"); + binder.bindProvider( function() { + return JSONBrokerClientFactory.createFromList( + fx.constants.SERVICE_URI + "/rate", + [ "range" ] ); + } ).to("rateServiceStub"); + } +} + +fx.initialize = function(){ + fx.container = new container.Container( function( binder ){ + fx.modules.ui( binder ); + fx.modules.core( binder ); + }); + fx.app = fx.container.get( "app" ); + fx.app.initialize(); +} + + +fx.Application = function() { + this.pageManager = container.Inject; + this.sideBar = container.Inject; +} +fx.Application.prototype = { + + /** + * 初期化 + */ + initialize : function ( ) { + var self = this; + this.sideBar.initialize(); + this.sideBar.to("sidebar_result_rmt"); + }, + + /** + * エラーがあれば表示する。 + * @param {Object} arg1 パラメータ + * @param {Object} arg2 パラメータ + */ + showError: function(arg1, arg2){ + alert("error:" + arg1 + " " +arg2 ); + } +} + +function debug(obj) { + var out = document.getElementById('debug'); + if ( typeof obj == "string" ) { + out.innerHTML += obj + "
"; + } else { + out.innerHTML += "---
"; + out.innerHTML += obj + "
"; + for ( var i in obj ) { + out.innerHTML += i + " : " + obj[i] + "
"; + } + } +} diff --git a/html/js/bt-create-page.js b/html/js/bt-create-page.js new file mode 100644 index 0000000..b84b266 --- /dev/null +++ b/html/js/bt-create-page.js @@ -0,0 +1,205 @@ + +// ネームスペース +namespace( "fx.ui.pages" ) + +// バックテスト作成画面 +fx.ui.pages.BtCreatePage = function() { + this.elementId = null // @Inject + this.processServiceStub = container.Inject; + this.rateServiceStub = container.Inject; + + this.agentSelector = container.Inject("btCreateAgentSelector"); + this.dialog = container.Inject; + this.topicPath = container.Inject; + this.sideBar = container.Inject; + + // ボタン + var self = this; + this.startButton = new util.Button("bt-create__start", "start", function() { + self.start(); + }, fx.template.Templates.common.button.start); + this.startButton.setEnable( true ); + + // カレンダー + this.startCalendar = new util.DateInput( "bt-create_range-start", + fx.template.Templates.btcreate.calendar.start ); + this.startCalendar.initialize(); + this.endCalendar = new util.DateInput( "bt-create_range-end", + fx.template.Templates.btcreate.calendar.end ); + this.endCalendar.initialize(); +} +fx.ui.pages.BtCreatePage.prototype = { + + /** + * このページから画面を移動する際に呼び出される。 + * 戻り値としてfalseを返すと遷移をキャンセルする。 + */ + from : function(toId) { + // ページを非表示 + document.getElementById(this.elementId).style.display = "none"; + this.topicPath.set( "" ); + return true; + }, + /** + * このページに画面を移動すると呼び出される。 + */ + to : function( fromId ) { + // ページを表示 + document.getElementById(this.elementId).style.display = "block"; + + var msg = document.getElementById("bt-create_msg"); + msg.innerHTML = ""; + msg.style.display = "none"; + + this.topicPath.set( "バックテスト:新規作成" ); + + // 日付の設定パネルを初期化 + var el = document.getElementById("bt-create__range-summary"); + el.innerHTML = fx.template.Templates.btcreate.dateSummary.notSelect; + + // 利用可能な日時 + var self = this; + if ( this.startCalendar ) this.startCalendar.destroy(); + if ( this.endCalendar ) this.endCalendar.destroy(); + document.getElementById("bt-create_range-start").innerHTML = + fx.template.Templates.common.loading; + + this.rateServiceStub.range( "EURJPY", function(range) { + self.startCalendar = new util.DateInput( "bt-create_range-start", + fx.template.Templates.btcreate.calendar.start, + range.first*1000, range.last*1000 ); + self.startCalendar.initialize(); + var f = function(){ self.dateChanged();}; + self.startCalendar.listener.addListener( "selected", f ); + self.startCalendar.listener.addListener( "blur", f ); + self.endCalendar = new util.DateInput( "bt-create_range-end", + fx.template.Templates.btcreate.calendar.end, + range.first*1000, range.last*1000 ); + self.endCalendar.initialize(); + self.endCalendar.listener.addListener( "selected", f ); + self.endCalendar.listener.addListener( "blur", f ); + }, null ); // TODO + + // セレクタを初期化。 + this.agentSelector.setAgents([]); + }, + /** + * ページを初期化する。 + * インスタンス生成時に1度だけ実行すること。 + */ + initialize: function( ) { + + // + // エージェント + this.agentSelector.initialize(); + }, + start: function(){ + + // エラーチェック + if ( this.agentSelector.hasError() ) { + this.dialog.show( "warn", { + message : fx.template.Templates.common.errorMsg.illegalAgentSetting, + buttons : [ + { type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" } + ] + } ); + return; + } + + // 名前 + var name = document.getElementById("bt-create_name").value; + if ( !name ) { + this.dialog.show( "warn", { + message : fx.template.Templates.common.errorMsg.emptyName, + buttons : [ { type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }] + } ); + return; + } + + // 開始日時、終了日時 + var startDate = this.startCalendar.getDate(); + if ( !startDate ) { + this.dialog.show( "warn", { + message : fx.template.Templates.common.errorMsg.illegalStartDate, + buttons : [ { type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }] + } ); + return; + } + + var endDate = this.endCalendar.getDate(); + if ( !endDate ) { + this.dialog.show( "warn", { + message : fx.template.Templates.common.errorMsg.illegalEndDate, + buttons : [{ type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }] + } ); + return; + } + if ( endDate.getTime() <= startDate.getTime() ) { + this.dialog.show( "warn", { + message : fx.template.Templates.common.errorMsg.illegalDate, + buttons : [{ type:"ok", alt: fx.template.Templates.common.button.ok, key: "Enter" }] + } ); + return; + } + var agents = this.agentSelector.getAgents(); + + // ダイアログを開く + var self = this; + this.dialog.show( "input", { + message : fx.template.Templates.btcreate.start.msg, + buttons : [ + { type:"ok", + alt: fx.template.Templates.common.button.ok, + key: "Enter", + action: function(dialog){ + var memo = document.getElementById("bt-create_memo").value; + self.processServiceStub.new_test( name, memo, + startDate.getTime()/1000, endDate.getTime()/1000, agents, function(info) { + + // サイドバーに追加 + self.sideBar.add(info.id); + + // 更新時刻を表示 + var dateStr = util.formatDate( new Date(info.create_date*1000) ); + var msg = document.getElementById("bt-create_msg"); + msg.innerHTML = fx.template.Templates.btcreate.start.success.evaluate( {dateStr:dateStr} ); + msg.style.display = "block"; + }, function(error,detail){ + self.dialog.show( "warn", { + message : fx.template.Templates.btcreate.start.error.evaluate({ + "error":(String(error) + "\n" + String(detail["backtrace"])).escapeHTML()}) + }); + }); + } }, + { type:"cancel", alt: fx.template.Templates.common.button.cancel, key: "Esc" } + ] + } ); + }, + /** + * 日時の要約パネルを更新する + */ + dateChanged: function( ){ + var el = document.getElementById("bt-create__range-summary"); + var s = this.startCalendar.getDate(); + var e = this.endCalendar.getDate(); + if ( !s || !e ) { + el.innerHTML = fx.template.Templates.btcreate.dateSummary.notSelect; + return; + } + if ( s.getTime() >= e.getTime() ) { + el.innerHTML = fx.template.Templates.btcreate.dateSummary.error; + return; + } + var day = Math.floor( (e.getTime() - s.getTime()) / 1000 / 60 / 60 / 24 ); + var time = day * 5; + var str = ""; + var h = Math.floor(time/60); + if ( h > 0 ) str = h + fx.template.Templates.common.date.h; + str += (time%60) + fx.template.Templates.common.date.mm ; + el.innerHTML = fx.template.Templates.btcreate.dateSummary.selected.evaluate( { + range : day + fx.template.Templates.common.date.d, + time: str + } ); + + } +} diff --git a/html/js/container-min.js b/html/js/container-min.js new file mode 100644 index 0000000..befc28d --- /dev/null +++ b/html/js/container-min.js @@ -0,0 +1 @@ +if(typeof container=="undefined"){container={}}container.VERSION="0.4.0";container.Container=function(B){var A=new container.Binder({});B(A);this.defs=A.defs;this.creating=[];this.typeCache={};this.nameCache={};var C=this;this.eachComponentDef(function(E){if(E&&E[container.Annotation.Container]&&E[container.Annotation.Container][container.Annotation.Scope]==container.Scope.EagerSingleton){C.create(E)}if(E&&E[container.Annotation.Container]&&E[container.Annotation.Container][container.Annotation.Name]){var D=E[container.Annotation.Container][container.Annotation.Name];if(!C.nameCache[D]){C.nameCache[D]=[]}C.nameCache[D].push(E)}})};container.Container.prototype={get:function(A){if(A instanceof container.Type){if(!this.typeCache[A]){this._createTypeCahce(A)}if(this.typeCache[A].length>0){return this.create(this.typeCache[A][0])}else{throw container.createError(new Error(),container.ErrorCode.ComponentNotFound,"component not found.",{"type":A})}}else{if(this.nameCache[A]&&this.nameCache[A].length>0){return this.create(this.nameCache[A][0])}else{throw container.createError(new Error(),container.ErrorCode.ComponentNotFound,"component not found.",{"name":A})}}},gets:function(D){var C=[];if(D instanceof container.Type){if(!this.typeCache[D]){this._createTypeCahce(D)}var A=this.typeCache[D];for(var B=0;B= 3 ) { + var fn = this.recipe[i]; + var component = c.get( result[1] ); + var listeners = c.gets( container.types.has( fn ) ); + if ( component && listeners && result[2]) { + this.addListeners( component, result[2], listeners, fn ); + } + } + } + }, + + /** + * 更新リスナを追加する。 + * @param {Object} target リスナを追加するモデル + * @param {String} key イベントキー + * @param {Function} listener リスナ関数の配列 + * @param {String} functionName 関数名 + */ + addListeners: function ( target, key, listeners, functionName ) { + if ( !target.__listeners ) { + + // ターゲットを拡張する。 + target.__listeners = {}; // リスナの記録先を確保。 + var org = target.set; + + // setを上書き。変更を受けてリスナをキックする関数にする。 + target.set = function( key, value, opt ) { + opt = opt ? opt : {}; + opt.value = value; + var result = null; + if ( org ) { + result = org.apply( target, [key, value, opt] ); + } else { + this[key] = value; + } + if ( this.__listeners[key] ) { + var fn = this.__listeners[key]["function"]; + for (var i=0; i < this.__listeners[key]["lis"].length; i++ ) { + this.__listeners[key]["lis"][i][fn]( opt ); + } + } + return result; + } + } + // リスナをターゲットの属性として追加。 + target.__listeners[key] = {"lis":listeners, "function": functionName}; + } +} diff --git a/html/js/container.js b/html/js/container.js new file mode 100644 index 0000000..9e33288 --- /dev/null +++ b/html/js/container.js @@ -0,0 +1,944 @@ +// ネームスペース +if ( typeof container == "undefined" ) { + container = {}; +} + +container.VERSION = "0.4.0"; + +/** + * コンテナ + * @param {Function} module コンポーネント定義を行う関数。 + */ +container.Container = function ( module ) { + var binder = new container.Binder( {} ); + module( binder ); + this.defs = binder.defs; + + // 循環生成防止用のフィールド。作成中のモジュールの一覧が入る。 + this.creating = []; + + // 名前でキャッシュを作っておく。 + // EagerSingletonなオブジェクトがあれば生成。 + this.typeCache = {}; + this.nameCache = {}; + var thiz = this; + this.eachComponentDef( function( def ) { + if ( def && def[container.Annotation.Container] + && def[container.Annotation.Container][container.Annotation.Scope] == container.Scope.EagerSingleton ) { + thiz.create( def ); + } + // 名前でキャッシュ + if ( def && def[container.Annotation.Container] + && def[container.Annotation.Container][container.Annotation.Name] ) { + var name = def[container.Annotation.Container][container.Annotation.Name]; + if ( !thiz.nameCache[name] ) { + thiz.nameCache[name] = [] + } + thiz.nameCache[name].push( def ); + } + }); +} +container.Container.prototype = { + /** + * コンポーネント名またはcontainer.Typeに対応するオブジェクトを取得します。 + * + * @param {String or container.Type} nameOrType コンポーネント名またはcontainer.Type + * @return 対応するオブジェクト。複数のコンポーネントがマッチした場合、最初の1つを返します。 + */ + get: function( nameOrType ){ + if ( nameOrType instanceof container.Type ) { + // キャッシュがなければスキャン + if ( !this.typeCache[nameOrType] ) { + this._createTypeCahce( nameOrType ); + } + if ( this.typeCache[nameOrType].length > 0 ) { + return this.create( this.typeCache[nameOrType][0]); + } else { + throw container.createError( new Error(), + container.ErrorCode.ComponentNotFound, + "component not found.name=" + nameOrType, {"nameOrType":nameOrType} ); + } + } else { + if ( this.nameCache[nameOrType] && this.nameCache[nameOrType].length > 0 ) { + return this.create( this.nameCache[nameOrType][0]); + } else { + throw container.createError( new Error(), + container.ErrorCode.ComponentNotFound, + "component not found.name=" + nameOrType, {"nameOrType":nameOrType} ); + } + } + }, + /** + * コンポーネント名またはcontainer.Typeに対応するオブジェクトをすべて取得します。 + * + * @param {String or container.Type} nameOrType コンポーネント名またはcontainer.Type + * @return 対応するオブジェクトの配列 + */ + gets: function( nameOrType ){ + var objects = []; + if ( nameOrType instanceof container.Type ) { + // キャッシュがなければスキャン + if ( !this.typeCache[nameOrType] ) { + this._createTypeCahce( nameOrType ); + } + var defs = this.typeCache[nameOrType] + for ( var i=0; i < defs.length; i++ ) { + objects.push( this.create( defs[i]) ); + } + } else { + if ( this.nameCache[nameOrType] ) { + var defs = this.nameCache[nameOrType]; + for ( var i=0; i < defs.length; i++ ) { + objects.push( this.create( defs[i]) ); + } + } + } + return objects; + }, + /** + * コンテナを破棄します。 + */ + destroy: function( ) { + var thiz = this; + this.eachComponentDef( function( def ) { + if ( !def.instance ){ return; } + var obj = def.instance; + var config = def[container.Annotation.Container]; + if ( !config || !config[container.Annotation.Destroy] ) { return; } + var destroy = config[container.Annotation.Destroy]; + if ( typeof destroy == "string" ) { + obj[destroy].apply( obj, [this] ); + } else if ( typeof destroy == "function" ) { + destroy( obj, thiz ); + } else { + throw container.createError( new Error(), + container.ErrorCode.IllegalDefinition, + "illegal destroy method. string or function is supported.", {"def":def} ); + } + def.instance = null; + }); + }, + + /** + * コンポーネント定義からコンポーネントを生成する。 + * @param {Hash} def コンポーネント定義 + */ + create: function( def ) { + + // 既に作成済みのインスタンスがあればそれを返す。 + if ( def.instance ) { return def.instance; } + + // 循環チェック + if ( this._isCreating(def) ) { + throw container.createError( new Error(), + container.ErrorCode.CircularReference, + "circulative component creation.", {"def":def} ); + } + + try { + this.creating.push( def ); + + var obj = def.constractor( this ); // 生成 + def.instance = obj; // キャッシュ + + // アノーテョンで指定した設定とコンテナのコンポーネント設定をマージ + var config = def[container.Annotation.Container] || {}; + + // 自動インジェクション + if ( config[container.Annotation.AutoInjection] != false ) { + for ( var property in obj ) { + if ( obj[property] instanceof container.inner.Component ) { + obj[property] = this.get( obj[property].name ); + } else if ( obj[ property] instanceof container.inner.Components ) { + obj[property] = this.gets( obj[property].name ); + } else if ( obj[ property] === container.Inject ) { + obj[property] = this.get( property ); + } else if ( obj[ property] === container.Injects ) { + obj[property] = this.gets( property ); + } + } + } + + // プロパティインジェクション + if ( config[container.Annotation.Inject] ) { + var inject = config[container.Annotation.Inject]; + for ( var f in inject ) { + if ( inject[f] instanceof container.inner.Component ) { + obj[f] = this.get( inject[f].name ); + } else if ( inject[f] instanceof container.inner.Components ) { + obj[f] = this.gets( inject[f].name ); + } else if ( inject[f] instanceof container.inner.Provider ) { + obj[f] = inject[f].func( obj, this ); + } else { + obj[f] = inject[f]; + } + } + } + + // 初期化関数の実行 + if ( config[container.Annotation.Initialize] ) { + var initialize = config[container.Annotation.Initialize]; + if ( typeof initialize == "string" ) { + obj[initialize].apply( obj, [this] ); + } else if ( typeof initialize == "function" ) { + initialize( obj, this ); + } else { + throw container.createError( new Error(), + container.ErrorCode.IllegalDefinition, + "illegal initialize method. string or function is supported.", {"def":def} ); + } + } + + // インターセプタの設定 + if ( config[container.Annotation.Intercept] ) { + var interceptors = config[container.Annotation.Intercept]; + for ( var i=0; i < interceptors.length; i++ ) { + this.applyInterceptor( obj, interceptors[i][0], interceptors[i][1] ); + } + } + + // グローバルインターセプタの設定 + if ( this.defs.interceptors && def.componentType != "function" ) { // バインドメソッドには適用しない。 + for ( var i=0; i < this.defs.interceptors.length; i++ ) { + var insterceptor = this.defs.interceptors[i]; + if ( !insterceptor.nameMatcher) { continue; } + if ( insterceptor.nameMatcher instanceof container.Type + && insterceptor.nameMatcher.isImplementor(obj) ) { + this.applyInterceptor( obj, insterceptor.interceptor, insterceptor.methodMatcher ); + } else if ( insterceptor.nameMatcher instanceof container.Matcher + && config[container.Annotation.Name] + && insterceptor.nameMatcher.match( config[container.Annotation.Name] )) { + this.applyInterceptor( obj, insterceptor.interceptor, insterceptor.methodMatcher ); + } + } + } + + // シングルトンの場合、次回同じインスタンスを返すのでコンポーネント定義にキャッシュしたままにしておく。 + // プロトタイプの場合破棄 + if ( config[container.Annotation.Scope] == container.Scope.Prototype ) { + def.instance = undefined; + } + return obj; + } catch ( error ) { + def.instance = undefined; // エラーの場合破棄 + throw error; + } finally { + this.creating.pop(); + } + }, + /** + * インターセプターを適用する。 + * @param {Object} target 適用対象のオブジェクト + */ + applyInterceptor: function( target, interceptor, matcher ) { + if ( !interceptor || !matcher ) { return; } + for ( var f in target ) { + if ( typeof target[f] == "function" && matcher.match( f ) ) { + (function() { // f をローカル化するため関数で。 + var x = f; + var original = target[x]; + target[x] = function( ) { + // インターセプターを実行する関数に置き換える。 + var mi = new container.MethodInvocation( x, original, target, arguments ); + return interceptor( mi ); + } + })(); + } + } + }, + /** + * コンポーネント定義を列挙する。 + * @param {Function} block 列挙先。第1引数でコンポーネント定義が渡される。 + */ + eachComponentDef : function( block ) { + for ( var i = 0; i < this.defs.objects.length; i++ ) { + if ( block ) { + block.apply( null, [this.defs.objects[i]] ); + } + } + }, + _createTypeCahce: function( nameOrType ) { + var list = []; + var self = this; + this.eachComponentDef( function( def ){ + // 循環する場合は対象に含めない。 + if ( self._isCreating(def) && !def.instance ) { return } + var obj = self.create( def ); + if ( nameOrType.isImplementor( obj ) ) { + list.push( def ); + } + }); + this.typeCache[nameOrType] = list; + }, + _isCreating: function(def) { + for ( var i=0; i < this.creating.length; i++ ) { + if ( def === this.creating[i] ) { + return true; + } + } + return false; + } +} + +/** + * バインダー + * @param {Hash} defs コンポーネント定義 + * @param {String} namespace ネームスペース + */ +container.Binder = function( defs, namespace ){ + this.defs = defs; + this.namespace = namespace; +} +container.Binder.prototype = { + + /** + * コンポーネントを登録する + * @param {Function} clazz コンポーネントクラス + * @return コンポーネント定義オブジェクト + */ + bind: function( clazz ) { + return this._bind( "object", clazz.prototype.meta, function() { + return new clazz(); + }); + }, + + /** + * 条件にマッチするコンポーネントメソッドを登録する。 + * + * - Typeまたは名前にマッチするコンポーネントの指定したメソッドをコンポーネントとして登録する。 + * - 複数のコンポーネントがある場合、最初に見つかったTypeまたは名前にマッチするコンポーネントのメソッドが登録される。 + * + * @param {String or container.Type} nameOrType コンポーネント名またはcontainer.Type + * @param {String} methodName メソッド名 + * @return コンポーネント定義オブジェクト + */ + bindMethod: function( nameOrType, methodName ) { + var self = this; + return this._bind( "function", null, function( container ) { + var obj = container.get( nameOrType ); + if (!obj) { + throw container.createError( new Error(), + container.ErrorCode.ComponentNotFound, + "component not found.name=" + nameOrType, {"nameOrType":nameOrType} ); + } + return self._createBindMethod( obj, methodName ); + }); + }, + + + /** + * 条件にマッチするコンポーネントメソッドの配列を登録する。 + * + * - Typeまたは名前にマッチするコンポーネントの指定したメソッドをコンポーネントとして登録する。 + * - 複数のコンポーネントがある場合、Typeまたは名前にマッチするコンポーネントメソッドの配列が登録される。 + * + * @param {String or container.Type} nameOrType コンポーネント名またはcontainer.Type + * @param {String} methodName メソッド名 + * @return コンポーネント定義オブジェクト + */ + bindMethods: function( nameOrType, methodName ) { + var self = this; + return this._bind( "function", null, function( container ) { + var objs = container.gets( nameOrType ); + var list = []; + for ( var i=0; i} or {Function} includes + * マッチ条件。 + * 正規表現、正規表現の配列、または関数で指定する。 + * -正規表現 .. 値が正規表現にマッチするか + * -正規表現の配列 .. 値が正規表現のいずれかにマッチするか + * -関数 .. 関数の実行結果がtrueであるか。(引数として評価対象の値が渡される。) + * @param {RegExp} or {Array} or {Function} excludes + * マッチ対象外を指定する条件。includeに含まれていてもexcludeにマッチする場合、マッチしないと見なされる。 + * 正規表現、正規表現の配列、または関数で指定する。 + * -正規表現 .. 値が正規表現にマッチするか + * -正規表現の配列 .. 値が正規表現のいずれかにマッチするか + * -関数 .. 関数の実行結果がtrueであるか。(引数として評価対象の値が渡される。) + */ +container.Matcher = function ( includes, excludes ){ + + if ( includes && !(includes instanceof Array + || includes instanceof RegExp + || includes instanceof Function )){ + throw container.createError( new Error(), + container.ErrorCode.IllegalArgument, + "Illegal includes.", {} ); + } + if ( excludes && !(excludes instanceof Array + || excludes instanceof RegExp + || excludes instanceof Function )){ + throw container.createError( new Error(), + container.ErrorCode.IllegalArgument, + "Illegal excludes.", {} ); + } + this.excludes = excludes; + this.includes = includes; +} +container.Matcher.prototype = { + + /** + * 評価値が条件にマッチするか評価する。 + * @param {String} value 評価値 + * @return マッチする場合true + */ + match: function( value ){ + if ( this.excludes && this.getEvaluator( this.excludes)(value) ) { + return false; + } + if ( this.includes && this.getEvaluator( this.includes)(value) ) { + return true; + } + return false + }, + getEvaluator: function( includes ) { + if ( includes instanceof Array ){ + return function( value ) { + for (var i=0; i" + + "
" + + "
" + + "" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
"; + document.body.appendChild(this.dialog); + this.header = document.getElementById("dialog-header"); + this.title = document.getElementById("dialog-title"); + this.content = document.getElementById("dialog-content"); + this.buttons = document.getElementById("dialog-buttons"); + + var self = this; + this.close = document.getElementById("dialog-close"); + this.close.onclick = function() { + self.hideDialog(); + }; + this.mask = document.createElement('div'); + this.mask.id = 'dialog-mask'; + document.body.appendChild(this.mask); + + this.dialog.style.visibility = "hidden"; + this.mask.style.visibility = "hidden"; + this.keybind = new util.KeyBind( {}, this.dialog ) ; +} +util.Dialog.prototype = { + TIME : 10, + SPEED : 25, + WRAPPER : 'content', + + show : function( type, params ) { + if(!type) { + type = 'input'; + } + + // ダイアログを初期化 + this.content.innerHTML = params.message; + if ( params.headerVisible ) { + if ( params.title ) { + this.title.innerHTML = params.title; + } + this.close.style.display = "block"; + } else { + this.header.style.display = "none"; + } + + var bind = { "Tab" : function(){} }; + this.buttons.innerHTML = ""; + if ( params.buttons ) { + for ( var i = 0; i < params.buttons.length ; i++ ) { + this.createButton( params.buttons[i], bind ); + } + } else { + this.createButton( { + id : "close", + type : "close", + accesskey: "C", + key: "Enter"}, bind); + } + this.keybind.binding = bind; + + // ダイアログを表示 + this.mask.style.visibility = "visible"; + this.dialog.style.visibility = "visible"; + + this.dialog.style.opacity = .00; + this.dialog.style.filter = 'alpha(opacity=0)'; + this.dialog.alpha = 0; + + var width = this.pageWidth(); + var height = this.pageHeight(); + var left = this.leftPosition(); + var top = this.topPosition(); + + var dialogwidth = this.dialog.offsetWidth; + var dialogheight = this.dialog.offsetHeight; + var topposition = top + (height / 3) - (dialogheight / 2); + var leftposition = left + (width / 2) - (dialogwidth / 2); + + this.dialog.style.top = topposition + "px"; + this.dialog.style.left = leftposition + "px"; + this.dialog.className = type + " dialog"; + + var content = document.getElementById(this.WRAPPER); + this.mask.style.height = content.offsetHeight + 'px'; + var self = this; + // すでに変化中であれば一旦停止 + if ( this.timer != null ) { + clearInterval(this.timer); + // コントロールの無効化はすでにされているので行わない。 + } else { + // リンクとコントロールを無効化 + this.cache = []; + var f = function( elms ) { + for( var i = 0 ; i < elms.length; i++ ) { + var old = { + target: elms[i], + disabled: elms[i].disabled, + accesskey: elms[i].accessKey, + tabIndex : elms[i].tabIndex + }; + elms[i].disabled = true; + elms[i].accessKey = null; + elms[i].tabIndex = -1; + self.cache.push( old ); + } + } + this.eachElements( "input", f); + this.eachElements( "textarea", f); + this.eachElements( "a", f); + this.eachElements( "object", function(elms){ + for( var i = 0 ; i < elms.length; i++ ) { + elms[i].style.visibility = "hidden"; + } + }); + } + this.timer = setInterval(function(){ self.fadeDialog(1); }, this.TIME); + var as = this.buttons.getElementsByTagName( "a" ); + if ( as && as[0] ) { as[0].focus(); } + if ( params.init ) { + params.init.call( null, this ); + } + }, + + createButton: function( params, keybind ) { + + var type = params["type"]; + var a = params["action"]; + var action = function() { + if ( a ) { + if ( a.call( null, self ) == false ){ + return; + } + } + self.hideDialog(); + }; + var b = document.createElement('div'); + b.className= params["key"] == "Enter" ? "button default " + type : "button " + type; + b.id = "dialog_" + type; + this.buttons.appendChild(b); + + var self = this; + var button = new util.Button("dialog_" + type, + type, action, params["alt"], params["accesskey"]); + button.setEnable( true ); + + if(params["key"]) keybind[params["key"]] = action; + }, + + //ダイアログを非表示にする。 + hideDialog : function () { + clearInterval(this.timer); + var self = this; + this.timer = setInterval( function(){ self.fadeDialog(0); } , this.TIME); + }, + + fadeDialog : function (flag) { + if(flag == null) { + flag = 1; + } + var value; + if(flag == 1) { + value = this.dialog.alpha + this.SPEED; + } else { + value = this.dialog.alpha - this.SPEED; + } + this.dialog.alpha = value; + this.dialog.style.opacity = (value / 100); + this.dialog.style.filter = 'alpha(opacity=' + value + ')'; + if(value >= 99) { + clearInterval(this.timer); + this.timer = null; + } else if(value <= 1) { + // リンクとコントロールを有効化 + for( var i = 0 ; i < this.cache.length; i++ ) { + var c = this.cache[i]; + c.target.accesskey = c.accesskey; + c.target.tabIndex = c.tabIndex; + c.target.disabled = c.disabled; + } + + this.eachElements( "object", function(elms){ + for( var i = 0 ; i < elms.length; i++ ) { + elms[i].style.visibility = "visible"; + } + }); + + this.keybind.binding = {}; + + this.dialog.style.visibility = "hidden"; + this.mask.style.visibility = "hidden"; + clearInterval(this.timer); + this.timer = null; + } + }, + + eachElements: function ( tag, f ) { + var elements = document.body.childNodes; + for( var i = 0; i < elements.length; i++ ) { + if ( elements[i] != this.dialog && elements[i].getElementsByTagName ) { + var elms = elements[i].getElementsByTagName( tag ); + f(elms); + } + } + }, + + /** + * ウインドウの幅 + */ + pageWidth: function pageWidth() { + if ( window.innerWidth != null ) { + return window.innerWidth; + } else if ( document.documentElement && document.documentElement.clientWidth ) { + return document.documentElement.clientWidth; + } else if ( document.body != null ) { + return document.body.clientWidth; + } + return null; + }, + + /** + * ウインドウの高さ + */ + pageHeight: function () { + if ( window.innerHeight != null ) { + return window.innerHeight; + } else if ( document.documentElement && document.documentElement.clientHeight ) { + return document.documentElement.clientHeight; + } else if ( document.body != null ) { + return document.body.clientHeight; + } + return null; + }, + + /** + * 縦方向スクロールの位置 + */ + topPosition: function() { + if ( typeof window.pageYOffset != 'undefined') { + return window.pageYOffset; + } else if ( document.documentElement && document.documentElement.scrollTop ) { + return document.documentElement.scrollTop; + } else if ( document.body.scrollTop ) { + return document.body.scrollTop; + } + return 0; + }, + + /** + * 横方向スクロールの位置 + */ + leftPosition: function() { + if ( typeof window.pageXOffset != 'undefined') { + return window.pageXOffset; + } else if ( document.documentElement && document.documentElement.scrollLeft ) { + return document.documentElement.scrollLeft; + } else if ( document.body.scrollLeft ) { + return document.body.scrollLeft; + } + return 0; + } +} \ No newline at end of file diff --git a/html/js/edit_area/autocompletion.js b/html/js/edit_area/autocompletion.js new file mode 100644 index 0000000..c5d646a --- /dev/null +++ b/html/js/edit_area/autocompletion.js @@ -0,0 +1,491 @@ +/** + * Autocompletion class + * + * An auto completion box appear while you're writing. It's possible to force it to appear with Ctrl+Space short cut + * + * Loaded as a plugin inside editArea (everything made here could have been made in the plugin directory) + * But is definitly linked to syntax selection (no need to do 2 different files for color and auto complete for each syntax language) + * and add a too important feature that many people would miss if included as a plugin + * + * - init param: autocompletion_start + * - Button name: "autocompletion" + */ + +var EditArea_autocompletion= { + + /** + * Get called once this file is loaded (editArea still not initialized) + * + * @return nothing + */ + init: function(){ + // alert("test init: "+ this._someInternalFunction(2, 3)); + + if(editArea.settings["autocompletion"]) + this.enabled= true; + else + this.enabled= false; + this.current_word = false; + this.shown = false; + this.selectIndex = -1; + this.forceDisplay = false; + this.isInMiddleWord = false; + this.autoSelectIfOneResult = false; + this.delayBeforeDisplay = 100; + this.checkDelayTimer = false; + this.curr_syntax_str = ''; + + this.file_syntax_datas = {}; + } + /** + * Returns the HTML code for a specific control string or false if this plugin doesn't have that control. + * A control can be a button, select list or any other HTML item to present in the EditArea user interface. + * Language variables such as {$lang_somekey} will also be replaced with contents from + * the language packs. + * + * @param {string} ctrl_name: the name of the control to add + * @return HTML code for a specific control or false. + * @type string or boolean + */ + /*,get_control_html: function(ctrl_name){ + switch( ctrl_name ){ + case 'autocompletion': + // Control id, button img, command + return parent.editAreaLoader.get_button_html('autocompletion_but', 'autocompletion.gif', 'toggle_autocompletion', false, this.baseURL); + break; + } + return false; + }*/ + /** + * Get called once EditArea is fully loaded and initialised + * + * @return nothing + */ + ,onload: function(){ + if(this.enabled) + { + var icon= document.getElementById("autocompletion"); + if(icon) + editArea.switchClassSticky(icon, 'editAreaButtonSelected', true); + } + + this.container = document.createElement('div'); + this.container.id = "auto_completion_area"; + editArea.container.insertBefore( this.container, editArea.container.firstChild ); + + // add event detection for hiding suggestion box + parent.editAreaLoader.add_event( document, "click", function(){ editArea.plugins['autocompletion']._hide();} ); + parent.editAreaLoader.add_event( editArea.textarea, "blur", function(){ editArea.plugins['autocompletion']._hide();} ); + + } + + /** + * Is called each time the user touch a keyboard key. + * + * @param (event) e: the keydown event + * @return true - pass to next handler in chain, false - stop chain execution + * @type boolean + */ + ,onkeydown: function(e){ + if(!this.enabled) + return true; + + if (EA_keys[e.keyCode]) + letter=EA_keys[e.keyCode]; + else + letter=String.fromCharCode(e.keyCode); + // shown + if( this._isShown() ) + { + // if escape, hide the box + if(letter=="Esc") + { + this._hide(); + return false; + } + // Enter + else if( letter=="Entrer") + { + var as = this.container.getElementsByTagName('A'); + // select a suggested entry + if( this.selectIndex >= 0 && this.selectIndex < as.length ) + { + as[ this.selectIndex ].onmousedown(); + return false + } + // simply add an enter in the code + else + { + this._hide(); + return true; + } + } + else if( letter=="Tab" || letter=="Down") + { + this._selectNext(); + return false; + } + else if( letter=="Up") + { + this._selectBefore(); + return false; + } + } + // hidden + else + { + + } + + // show current suggestion list and do autoSelect if possible (no matter it's shown or hidden) + if( letter=="Space" && CtrlPressed(e) ) + { + //parent.console.log('SHOW SUGGEST'); + this.forceDisplay = true; + this.autoSelectIfOneResult = true; + this._checkLetter(); + return false; + } + + // wait a short period for check that the cursor isn't moving + setTimeout("editArea.plugins['autocompletion']._checkDelayAndCursorBeforeDisplay();", editArea.check_line_selection_timer +5 ); + this.checkDelayTimer = false; + return true; + } + /** + * Executes a specific command, this function handles plugin commands. + * + * @param {string} cmd: the name of the command being executed + * @param {unknown} param: the parameter of the command + * @return true - pass to next handler in chain, false - stop chain execution + * @type boolean + */ + ,execCommand: function(cmd, param){ + switch( cmd ){ + case 'toggle_autocompletion': + var icon= document.getElementById("autocompletion"); + if(!this.enabled) + { + if(icon != null){ + editArea.restoreClass(icon); + editArea.switchClassSticky(icon, 'editAreaButtonSelected', true); + } + this.enabled= true; + } + else + { + this.enabled= false; + if(icon != null) + editArea.switchClassSticky(icon, 'editAreaButtonNormal', false); + } + return true; + } + return true; + } + ,_checkDelayAndCursorBeforeDisplay: function() + { + this.checkDelayTimer = setTimeout("if(editArea.textarea.selectionStart == "+ editArea.textarea.selectionStart +") EditArea_autocompletion._checkLetter();", this.delayBeforeDisplay - editArea.check_line_selection_timer - 5 ); + } + // hide the suggested box + ,_hide: function(){ + this.container.style.display="none"; + this.selectIndex = -1; + this.shown = false; + this.forceDisplay = false; + this.autoSelectIfOneResult = false; + } + // display the suggested box + ,_show: function(){ + if( !this._isShown() ) + { + this.container.style.display="block"; + this.selectIndex = -1; + this.shown = true; + } + } + // is the suggested box displayed? + ,_isShown: function(){ + return this.shown; + } + // setter and getter + ,_isInMiddleWord: function( new_value ){ + if( typeof( new_value ) == "undefined" ) + return this.isInMiddleWord; + else + this.isInMiddleWord = new_value; + } + // select the next element in the suggested box + ,_selectNext: function() + { + var as = this.container.getElementsByTagName('A'); + + // clean existing elements + for( var i=0; i= as.length || this.selectIndex < 0 ) ? 0 : this.selectIndex; + as[ this.selectIndex ].className += " focus"; + } + // select the previous element in the suggested box + ,_selectBefore: function() + { + var as = this.container.getElementsByTagName('A'); + + // clean existing elements + for( var i=0; i= as.length || this.selectIndex < 0 ) ? as.length-1 : this.selectIndex; + as[ this.selectIndex ].className += " focus"; + } + ,_select: function( content ) + { + cursor_forced_position = content.indexOf( '{@}' ); + content = content.replace(/{@}/g, '' ); + editArea.getIESelection(); + + // retrive the number of matching characters + var start_index = Math.max( 0, editArea.textarea.selectionEnd - content.length ); + + line_string = editArea.textarea.value.substring( start_index, editArea.textarea.selectionEnd + 1); + limit = line_string.length -1; + nbMatch = 0; + for( i =0; i 0 ) + parent.editAreaLoader.setSelectionRange(editArea.id, editArea.textarea.selectionStart - nbMatch , editArea.textarea.selectionEnd); + + parent.editAreaLoader.setSelectedText(editArea.id, content ); + range= parent.editAreaLoader.getSelectionRange(editArea.id); + + if( cursor_forced_position != -1 ) + new_pos = range["end"] - ( content.length-cursor_forced_position ); + else + new_pos = range["end"]; + parent.editAreaLoader.setSelectionRange(editArea.id, new_pos, new_pos); + this._hide(); + } + + + /** + * Parse the AUTO_COMPLETION part of syntax definition files + */ + ,_parseSyntaxAutoCompletionDatas: function(){ + //foreach syntax loaded + for(var lang in parent.editAreaLoader.load_syntax) + { + if(!parent.editAreaLoader.syntax[lang]['autocompletion']) // init the regexp if not already initialized + { + parent.editAreaLoader.syntax[lang]['autocompletion']= {}; + // the file has auto completion datas + if(parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION']) + { + // parse them + for(var i in parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION']) + { + datas = parent.editAreaLoader.load_syntax[lang]['AUTO_COMPLETION'][i]; + tmp = {}; + if(datas["CASE_SENSITIVE"]!="undefined" && datas["CASE_SENSITIVE"]==false) + tmp["modifiers"]="i"; + else + tmp["modifiers"]=""; + tmp["prefix_separator"]= datas["REGEXP"]["prefix_separator"]; + tmp["match_prefix_separator"]= new RegExp( datas["REGEXP"]["prefix_separator"] +"$", tmp["modifiers"]); + tmp["match_word"]= new RegExp("(?:"+ datas["REGEXP"]["before_word"] +")("+ datas["REGEXP"]["possible_words_letters"] +")$", tmp["modifiers"]); + tmp["match_next_letter"]= new RegExp("^("+ datas["REGEXP"]["letter_after_word_must_match"] +")$", tmp["modifiers"]); + tmp["keywords"]= {}; + //console.log( datas["KEYWORDS"] ); + for( var prefix in datas["KEYWORDS"] ) + { + tmp["keywords"][prefix]= { + prefix: prefix, + prefix_name: prefix, + prefix_reg: new RegExp("(?:"+ parent.editAreaLoader.get_escaped_regexp( prefix ) +")(?:"+ tmp["prefix_separator"] +")$", tmp["modifiers"] ), + datas: [] + }; + for( var j=0; j it's valid + if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 ) + { + if( ! before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) + hasMatch = true; + } + // we still need to check the prefix if there is one + else if( this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 ) + { + if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) + hasMatch = true; + } + + if( hasMatch ) + results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ]; + } + } + } + } + // it doesn't match any possible word but we want to display something + // we'll display to list of all available words + else if( this.forceDisplay || match_prefix_separator ) + { + for(var prefix in this.curr_syntax[i]["keywords"]) + { + for(var j=0; j it's valid + if( !match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length == 0 ) + { + hasMatch = true; + } + // we still need to check the prefix if there is one + else if( match_prefix_separator && this.curr_syntax[i]["keywords"][prefix]['prefix'].length > 0 ) + { + var before = last_chars; //.substr( 0, last_chars.length ); + if( before.match( this.curr_syntax[i]["keywords"][prefix]['prefix_reg'] ) ) + hasMatch = true; + } + + if( hasMatch ) + results[results.length]= [ this.curr_syntax[i]["keywords"][prefix], this.curr_syntax[i]["keywords"][prefix]['datas'][j] ]; + } + } + } + } + } + + // there is only one result, and we can select it automatically + if( results.length == 1 && this.autoSelectIfOneResult ) + { + // console.log( results ); + this._select( results[0][1]['replace_with'] ); + } + else if( results.length == 0 ) + { + this._hide(); + } + else + { + // build the suggestion box content + var lines=[]; + for(var i=0; i"+ results[i][1]['comment']; + if(results[i][0]['prefix_name'].length>0) + line+=''+ results[i][0]['prefix_name'] +''; + line+=''; + lines[lines.length]=line; + } + // sort results + this.container.innerHTML = '
    '+ lines.sort().join('') +'
'; + + var cursor = _$("cursor_pos"); + this.container.style.top = ( cursor.cursor_top + editArea.lineHeight ) +"px"; + this.container.style.left = ( cursor.cursor_left + 8 ) +"px"; + this._show(); + } + + this.autoSelectIfOneResult = false; + time=new Date; + t2= time.getTime(); + + //parent.console.log( begin_word +"\n"+ (t2-t1) +"\n"+ html ); + } + } +}; + +// Load as a plugin +editArea.settings['plugins'][ editArea.settings['plugins'].length ] = 'autocompletion'; +editArea.add_plugin('autocompletion', EditArea_autocompletion); \ No newline at end of file diff --git a/html/js/edit_area/edit_area.css b/html/js/edit_area/edit_area.css new file mode 100644 index 0000000..daf01c3 --- /dev/null +++ b/html/js/edit_area/edit_area.css @@ -0,0 +1,546 @@ +body, html{ + margin: 0; + padding: 0; + height: 100%; + border: none; + overflow: hidden; + background-color: #D0D0D0; +} + +body, html, table, form, textarea{ + font: 12px monospace, sans-serif; +} + +#editor{ + /*border: solid #888 1px;*/ + overflow: hidden; +} + +#result{ + z-index: 4; + overflow-x: auto; + overflow-y: scroll; + border-top: solid #FFF 1px; + border-bottom: solid #FFF 1px; + position: relative; + clear: both; + background-color: #e8e8e8; +} + +#result.empty{ + overflow: hidden; +} + +#container{ + overflow: hidden; + border: solid blue 0; + position: relative; + z-index: 10; + padding: 0 5px 0 45px; +} + +#textarea{ + position: relative; + top: 0; + left: 0; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; + z-index: 7; + border-width: 0; + /*background-color: transparent;*/ + resize: none; + color: #333; + background-color: #E8E8E8; +} + +#textarea, #textarea:hover{ + outline: none; /* safari outline fix */ + color: #333; +} + +#content_highlight{ + white-space: pre; + margin: 0; + padding: 0; + position : absolute; + z-index: 4; + overflow: visible; +} + + +#selection_field, #selection_field_text{ + margin: 0; + background-color: #FFF; +/* height: 1px; */ + position: absolute; + z-index: 5; + top: -100px; + padding: 0; + white-space: pre; + overflow: hidden; +} + +#selection_field.show_colors { + z-index: 3; + background-color:#FFF; + +} + +#selection_field strong{ + font-weight:normal; +} + +#selection_field.show_colors *, #selection_field_text * { + visibility: hidden; +} + +#selection_field_text{ + background-color:transparent; +} + +#selection_field_text strong{ + font-weight:normal; + background-color:#3399FE; + color: #FFF; + visibility:visible; +} + +#container.word_wrap #content_highlight, +#container.word_wrap #selection_field, +#container.word_wrap #selection_field_text, +#container.word_wrap #test_font_size{ + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + width: 99%; +} + +#line_number{ + position: absolute; + overflow: hidden; + border-right: solid #999999 1px; + z-index:8; + width: 38px; + padding: 0 5px 0 0; + margin: 0 0 0 -45px; + text-align: right; + color: #999999; +} + +#test_font_size{ + padding: 0; + margin: 0; + visibility: hidden; + position: absolute; + white-space: pre; +} + +pre{ + margin: 0; + padding: 0; +} + +.hidden{ + opacity: 0.6; + filter:alpha(opacity=60); + background-color: #E8E8E8; +} + +#result .edit_area_cursor{ + position: absolute; + z-index:6; + background-color: #FF6633; + top: -100px; + margin: 0; +} + +#result .edit_area_selection_field .overline{ + background-color: #996600; +} + + +/* area popup */ +.editarea_popup{ + border: solid 1px #888888; + background-color: #D0D0D0; + width: 250px; + padding: 4px; + position: absolute; + visibility: hidden; + z-index: 15; + top: -500px; +} + +.editarea_popup, .editarea_popup table{ + font-family: sans-serif; + font-size: 10pt; +} + +.editarea_popup img{ + border: 0; +} + +.editarea_popup .close_popup{ + float: right; + line-height: 16px; + border: 0; + padding: 0; +} + +.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{ + margin: 0; + padding: 0; +} + +.editarea_popup .copyright{ + text-align: right; +} + +/* Area_search */ +div#area_search_replace{ + /*width: 250px;*/ +} + +div#area_search_replace img{ + border: 0; +} + +div#area_search_replace div.button{ + text-align: center; + line-height: 1.7em; +} + +div#area_search_replace .button a{ + cursor: pointer; + border: solid 1px #888888; + background-color: #DEDEDE; + text-decoration: none; + padding: 0 2px; + color: #000000; + white-space: nowrap; +} + +div#area_search_replace a:hover{ + /*border: solid 1px #888888;*/ + background-color: #EDEDED; +} + +div#area_search_replace #move_area_search_replace{ + cursor: move; + border: solid 1px #888; +} + +div#area_search_replace #close_area_search_replace{ + text-align: right; + vertical-align: top; + white-space: nowrap; +} + +div#area_search_replace #area_search_msg{ + height: 18px; + overflow: hidden; + border-top: solid 1px #888; + margin-top: 3px; +} + +/* area help */ +#edit_area_help{ + width: 350px; +} + +#edit_area_help div.close_popup{ + float: right; +} + +/* area_toolbar */ +#toolbar_1 { + padding-left : 10px; + height: 22px; +} +#toolbar_2 { + height: 22px; +} +.area_toolbar{ + /*font: 11px sans-serif;*/ + width: 100%; + margin: 0; + padding: 0px 0px 0px 0px; + background-color: #D0D0D0; + /*text-align: center;*/ +} + +.area_toolbar, .area_toolbar table{ + font: 11px sans-serif; +} + +.area_toolbar img{ + border: 0; + vertical-align: middle; +} + +.area_toolbar input{ + margin: 0; + padding: 0; +} + +.area_toolbar select{ + font-family: 'MS Sans Serif',sans-serif,Verdana,Arial; + font-size: 7pt; + font-weight: normal; + margin: 2px 0 0 0 ; + padding: 0; + vertical-align: top; + background-color: #F0F0EE; +} + +table.statusbar{ + width: 100%; + height: 22px; +} +table.statusbar td{ + padding-top: 5px; +} +.area_toolbar td.infos{ + text-align: center; + width: 130px; + border-right: solid 1px #FFF; + border-width: 0 1px 0 0; + padding: 0; +} + +.area_toolbar td.total{ + text-align: right; + width: 50px; + padding: 0; +} + +.area_toolbar td.resize{ + text-align: right; +} +/* +.area_toolbar span{ + line-height: 1px; + padding: 0; + margin: 0; +}*/ + +.area_toolbar span#resize_area{ + cursor: nw-resize; + visibility: hidden; +} + +/* toolbar buttons */ +.editAreaButtonNormal, .editAreaButtonOver, .editAreaButtonDown, .editAreaSeparator, .editAreaSeparatorLine, .editAreaButtonDisabled, .editAreaButtonSelected { + border: 0; margin: 0; padding: 0; background: transparent; + margin-top: 0; + margin-left: 1px; + padding: 0; +} + +.editAreaButtonNormal { + border: 1px solid #D0D0D0 !important; + cursor: pointer; +} + +.editAreaButtonOver { + border: 1px solid #0A246A !important; + cursor: pointer; + background-color: #B6BDD2; +} + +.editAreaButtonDown { + cursor: pointer; + border: 1px solid #0A246A !important; + background-color: #8592B5; +} + +.editAreaButtonSelected { + border: 1px solid #C0C0BB !important; + cursor: pointer; + background-color: #D0D0D0; +} + +.editAreaButtonDisabled { + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); + -moz-opacity:0.3; + opacity: 0.3; + border: 1px solid #D0D0D0 !important; + cursor: pointer; +} + +.editAreaSeparatorLine { + margin: 1px 5px; + background-color: #B0B0B0; + width: 2px; + height: 18px; +} + +/* waiting screen */ +#processing{ + display: none; + background-color:#D0D0D0; + border: solid #888 1px; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 100; + text-align: center; +} + +#processing_text{ + position:absolute; + left: 50%; + top: 50%; + width: 200px; + height: 20px; + margin-left: -100px; + margin-top: -10px; + text-align: center; +} +/* end */ + + +/**** tab browsing area ****/ +#tab_browsing_area{ + display: none; + background-color: #C5C5C5; + border-top: 1px solid #FFF; + text-align: left; + margin: 0; + padding: 0px 0px 0px 0px; + background-image: url("../../img/thead.gif"); + background-repeat: repeat-x; +} + +#tab_browsing_list { + padding: 0; + margin: 0; + list-style-type: none; + white-space: nowrap; +} +#tab_browsing_list li { + float: left; + margin: -1px; +} +#tab_browsing_list a { + position: relative; + display: block; + text-decoration: none; + float: left; + cursor: pointer; + line-height:14px; +} + +#tab_browsing_list a span { + display: block; + color: #000; + background: #D0D0D0; + border: 1px solid #FFF; + border-width: 1px 1px 0; + text-align: center; + padding: 2px 2px 1px 4px; + position: relative; /*IE 6 hack */ +} + +#tab_browsing_list a b { + display: block; + border-bottom: 1px solid #346667; +} + +#tab_browsing_list a .edited { + display: none; +} + +#tab_browsing_list a.edited .edited { + display: inline; +} + +#tab_browsing_list a img{ + margin-left: 7px; +} + +#tab_browsing_list a.edited img{ + margin-left: 3px; +} + +#tab_browsing_list a:hover span { + background: #D0D0D0; + border-color: #66CDCC; +} + +#tab_browsing_list .selected a span{ + background: #112933; + color: #FFF; +} + + +#no_file_selected{ + height: 100%; + width: 150%; /* Opera need more than 100% */ + background: #CCC; + display: none; + z-index: 20; + position: absolute; +} + + +/*** Non-editable mode ***/ +.non_editable #editor +{ + border-width: 0 1px; +} + +.non_editable .area_toolbar +{ + display: none; +} + +/*** Auto completion ***/ +#auto_completion_area +{ + background: #FFF; + border: solid 1px #888; + position: absolute; + z-index: 15; + width: 280px; + height: 180px; + overflow: auto; + display:none; +} + +#auto_completion_area a, #auto_completion_area a:visited +{ + display: block; + padding: 0 2px 1px; + color: #000; + text-decoration:none; +} + +#auto_completion_area a:hover, #auto_completion_area a:focus, #auto_completion_area a.focus +{ + background: #D6E1FE; + text-decoration:none; +} + +#auto_completion_area ul +{ + margin: 0; + padding: 0; + list-style: none inside; +} +#auto_completion_area li +{ + padding: 0; +} +#auto_completion_area .prefix +{ + font-style: italic; + padding: 0 3px; +} \ No newline at end of file diff --git a/html/js/edit_area/edit_area.js b/html/js/edit_area/edit_area.js new file mode 100644 index 0000000..8119f9d --- /dev/null +++ b/html/js/edit_area/edit_area.js @@ -0,0 +1,539 @@ +/****** + * + * EditArea + * Developped by Christophe Dolivet + * Released under LGPL, Apache and BSD licenses (use the one you want) + * +******/ + + function EditArea(){ + var t=this; + t.error= false; // to know if load is interrrupt + + t.inlinePopup= [{popup_id: "area_search_replace", icon_id: "search"}, + {popup_id: "edit_area_help", icon_id: "help"}]; + t.plugins= {}; + + t.line_number=0; + + parent.editAreaLoader.set_browser_infos(t); // navigator identification + // fix IE8 detection as we run in IE7 emulate mode through X-UA tag + if( t.isIE >= 8 ) + t.isIE = 7; + + t.last_selection={}; + t.last_text_to_highlight=""; + t.last_hightlighted_text= ""; + t.syntax_list= []; + t.allready_used_syntax= {}; + t.check_line_selection_timer= 50; // the timer delay for modification and/or selection change detection + + t.textareaFocused= false; + t.highlight_selection_line= null; + t.previous= []; + t.next= []; + t.last_undo=""; + t.files= {}; + t.filesIdAssoc= {}; + t.curr_file= ''; + //t.loaded= false; + t.assocBracket={}; + t.revertAssocBracket= {}; + // bracket selection init + t.assocBracket["("]=")"; + t.assocBracket["{"]="}"; + t.assocBracket["["]="]"; + for(var index in t.assocBracket){ + t.revertAssocBracket[t.assocBracket[index]]=index; + } + t.is_editable= true; + + + /*t.textarea=""; + + t.state="declare"; + t.code = []; // store highlight syntax for languagues*/ + // font datas + t.lineHeight= 16; + /*t.default_font_family= "monospace"; + t.default_font_size= 10;*/ + t.tab_nb_char= 8; //nb of white spaces corresponding to a tabulation + if(t.isOpera) + t.tab_nb_char= 6; + + t.is_tabbing= false; + + t.fullscreen= {'isFull': false}; + + t.isResizing=false; // resize var + + // init with settings and ID (area_id is a global var defined by editAreaLoader on iframe creation + t.id= area_id; + t.settings= editAreas[t.id]["settings"]; + + if((""+t.settings['replace_tab_by_spaces']).match(/^[0-9]+$/)) + { + t.tab_nb_char= t.settings['replace_tab_by_spaces']; + t.tabulation=""; + for(var i=0; i0) + t.syntax_list= t.settings["syntax_selection_allow"].replace(/ /g,"").split(","); + + if(t.settings['syntax']) + t.allready_used_syntax[t.settings['syntax']]=true; + + + }; + EditArea.prototype.debug = function (obj) { + var out = document.getElementById('debug'); + if ( typeof obj == "string" ) { + out.innerHTML += obj + "
"; + } else { + out.innerHTML += "---
"; + out.innerHTML += obj + "
"; + for ( var i in obj ) { + out.innerHTML += i + " : " + obj[i] + "
"; + } + } + }; + EditArea.prototype.init= function(){ + //try { + var t=this, a, s=t.settings; + t.textarea = _$("textarea"); + t.container = _$("container"); + t.result = _$("result"); + t.content_highlight = _$("content_highlight"); + t.selection_field = _$("selection_field"); + t.selection_field_text= _$("selection_field_text"); + t.processing_screen = _$("processing"); + t.editor_area = _$("editor"); + t.tab_browsing_area = _$("tab_browsing_area"); + t.test_font_size = _$("test_font_size"); + a = t.textarea; + + if(!s['is_editable']) + t.set_editable(false); + + t.set_show_line_colors( s['show_line_colors'] ); + + if(syntax_selec= _$("syntax_selection")) + { + // set up syntax selection lsit in the toolbar + for(var i=0; i= '3' ) { + t.content_highlight.style.paddingLeft= "1px"; + t.selection_field.style.paddingLeft= "1px"; + t.selection_field_text.style.paddingLeft= "1px"; + } + + if(t.isIE && t.isIE < 8 ){ + a.style.marginTop= "-1px"; + } + /* + if(t.isOpera){ + t.editor_area.style.position= "absolute"; + }*/ + + if( t.isSafari ){ + t.editor_area.style.position = "absolute"; + a.style.marginLeft ="-3px"; + if( t.isSafari < 3.2 ) // Safari 3.0 (3.1?) + a.style.marginTop ="1px"; + } + + // si le textarea n'est pas grand, un click sous le textarea doit provoquer un focus sur le textarea + parent.editAreaLoader.add_event(t.result, "click", function(e){ if((e.target || e.srcElement)==editArea.result) { editArea.area_select(editArea.textarea.value.length, 0);} }); + + if(s['is_multi_files']!=false) + t.open_file({'id': t.curr_file, 'text': ''}); + + t.set_word_wrap( s['word_wrap'] ); + + setTimeout("editArea.focus();editArea.manage_size();editArea.execCommand('EA_load');", 10); + //start checkup routine + t.check_undo(); + t.check_line_selection(true); + t.scroll_to_view(); + + for(var i in t.plugins){ + if(typeof(t.plugins[i].onload)=="function") + t.plugins[i].onload(); + } + if(s['fullscreen']==true) + t.toggle_full_screen(true); + + parent.editAreaLoader.add_event(window, "resize", editArea.update_size); + parent.editAreaLoader.add_event(parent.window, "resize", editArea.update_size); + parent.editAreaLoader.add_event(top.window, "resize", editArea.update_size); + parent.editAreaLoader.add_event(window, "unload", function(){ + // in case where editAreaLoader have been already cleaned + if( parent.editAreaLoader ) + { + parent.editAreaLoader.remove_event(parent.window, "resize", editArea.update_size); + parent.editAreaLoader.remove_event(top.window, "resize", editArea.update_size); + } + if(editAreas[editArea.id] && editAreas[editArea.id]["displayed"]){ + editArea.execCommand("EA_unload"); + } + }); + + //} catch ( e ) { debug(e); } + /*date= new Date(); + alert(date.getTime()- parent.editAreaLoader.start_time);*/ + }; + + + + //called by the toggle_on + EditArea.prototype.update_size= function(){ + var d=document,pd=parent.document,height,width,popup,maxLeft,maxTop; + + if( typeof editAreas != 'undefined' && editAreas[editArea.id] && editAreas[editArea.id]["displayed"]==true){ + if(editArea.fullscreen['isFull']){ + pd.getElementById("frame_"+editArea.id).style.width = pd.getElementsByTagName("html")[0].clientWidth + "px"; + pd.getElementById("frame_"+editArea.id).style.height = pd.getElementsByTagName("html")[0].clientHeight + "px"; + } + + if(editArea.tab_browsing_area.style.display=='block' && ( !editArea.isIE || editArea.isIE >= 8 ) ) + { + editArea.tab_browsing_area.style.height = "0px"; + editArea.tab_browsing_area.style.height = (editArea.result.offsetTop - editArea.tab_browsing_area.offsetTop -1)+"px"; + } + + height = d.body.offsetHeight - editArea.get_all_toolbar_height() - 4; + editArea.result.style.height = Math.max(height, 0) +"px"; + + width = d.body.offsetWidth -2; + editArea.result.style.width = Math.max(width, 0)+"px"; + //alert("result h: "+ height+" w: "+width+"\ntoolbar h: "+this.get_all_toolbar_height()+"\nbody_h: "+document.body.offsetHeight); + + // check that the popups don't get out of the screen + for( i=0; i < editArea.inlinePopup.length; i++ ) + { + popup = _$(editArea.inlinePopup[i]["popup_id"]); + maxLeft = d.body.offsetWidth - popup.offsetWidth; + maxTop = d.body.offsetHeight - popup.offsetHeight; + if( popup.offsetTop > maxTop ) + popup.style.top = maxTop+"px"; + if( popup.offsetLeft > maxLeft ) + popup.style.left = maxLeft+"px"; + } + + editArea.manage_size( true ); + editArea.fixLinesHeight( editArea.textarea.value, 0,-1); + } + }; + + + EditArea.prototype.manage_size= function(onlyOneTime){ + if(!editAreas[this.id]) + return false; + + if(editAreas[this.id]["displayed"]==true && this.textareaFocused) + { + var area_height,resized= false; + + //1) Manage display width + //1.1) Calc the new width to use for display + if( !this.settings['word_wrap'] ) + { + var area_width= this.textarea.scrollWidth; + area_height= this.textarea.scrollHeight; + // bug on old opera versions + if(this.isOpera && this.isOpera < 9.6 ){ + area_width=10000; + } + //1.2) the width is not the same, we must resize elements + if(this.textarea.previous_scrollWidth!=area_width) + { + this.container.style.width= area_width+"px"; + this.textarea.style.width= area_width+"px"; + this.content_highlight.style.width= area_width+"px"; + this.textarea.previous_scrollWidth=area_width; + resized=true; + } + } + // manage wrap width + if( this.settings['word_wrap'] ) + { + newW=this.textarea.offsetWidth; + if( this.isFirefox || this.isIE ) + newW-=2; + if( this.isSafari ) + newW-=6; + this.content_highlight.style.width=this.selection_field_text.style.width=this.selection_field.style.width=this.test_font_size.style.width=newW+"px"; + } + + //2) Manage display height + //2.1) Calc the new height to use for display + if( this.isOpera || this.isFirefox || this.isSafari ) { + area_height= this.getLinePosTop( this.last_selection["nb_line"] + 1 ); + } else { + area_height = this.textarea.scrollHeight; + } + //2.2) the width is not the same, we must resize elements + if(this.textarea.previous_scrollHeight!=area_height) + { + this.container.style.height= (area_height+2)+"px"; + this.textarea.style.height= area_height+"px"; + this.content_highlight.style.height= area_height+"px"; + this.textarea.previous_scrollHeight= area_height; + resized=true; + } + + //3) if there is new lines, we add new line numbers in the line numeration area + if(this.last_selection["nb_line"] >= this.line_number) + { + var newLines= '', destDiv=_$("line_number"), start=this.line_number, end=this.last_selection["nb_line"]+100; + for( i = start+1; i < end; i++ ) + { + newLines+='
'+i+"
"; + this.line_number++; + } + destDiv.innerHTML= destDiv.innerHTML + newLines; + + this.fixLinesHeight( this.textarea.value, start, -1 ); + } + + //4) be sure the text is well displayed + this.textarea.scrollTop="0px"; + this.textarea.scrollLeft="0px"; + if(resized==true){ + this.scroll_to_view(); + } + } + + if(!onlyOneTime) + setTimeout("editArea.manage_size();", 100); + }; + + EditArea.prototype.execCommand= function(cmd, param){ + + for(var i in this.plugins){ + if(typeof(this.plugins[i].execCommand)=="function"){ + if(!this.plugins[i].execCommand(cmd, param)) + return; + } + } + //debug( "exec: " + cmd ); + switch(cmd){ + case "save": + if(this.settings["save_callback"].length>0) + eval("parent."+this.settings["save_callback"]+"('"+ this.id +"', editArea.textarea.value);"); + break; + case "load": + if(this.settings["load_callback"].length>0) + eval("parent."+this.settings["load_callback"]+"('"+ this.id +"');"); + break; + case "onchange": + if(this.settings["change_callback"].length>0) + eval("parent."+this.settings["change_callback"]+"('"+ this.id +"');"); + break; + case "EA_load": + if(this.settings["EA_load_callback"].length>0) + eval("parent."+this.settings["EA_load_callback"]+"('"+ this.id +"');"); + break; + case "EA_unload": + if(this.settings["EA_unload_callback"].length>0) + eval("parent."+this.settings["EA_unload_callback"]+"('"+ this.id +"');"); + break; + case "toggle_on": + if(this.settings["EA_toggle_on_callback"].length>0) + eval("parent."+this.settings["EA_toggle_on_callback"]+"('"+ this.id +"');"); + break; + case "toggle_off": + if(this.settings["EA_toggle_off_callback"].length>0) + eval("parent."+this.settings["EA_toggle_off_callback"]+"('"+ this.id +"');"); + break; + case "re_sync": + if(!this.do_highlight) + break; + case "file_switch_on": + if(this.settings["EA_file_switch_on_callback"].length>0) + eval("parent."+this.settings["EA_file_switch_on_callback"]+"(param);"); + break; + case "file_switch_off": + if(this.settings["EA_file_switch_off_callback"].length>0) + eval("parent."+this.settings["EA_file_switch_off_callback"]+"(param);"); + break; + case "file_close": + if(this.settings["EA_file_close_callback"].length>0) + return eval("parent."+this.settings["EA_file_close_callback"]+"(param);"); + break; + + default: + if(typeof(eval("editArea."+cmd))=="function") + { + if(this.settings["debug"]) + eval("editArea."+ cmd +"(param);"); + else + try{eval("editArea."+ cmd +"(param);");}catch(e){}; + } + } + }; + + EditArea.prototype.get_translation= function(word, mode){ + if(mode=="template") + return parent.editAreaLoader.translate(word, this.settings["language"], mode); + else + return parent.editAreaLoader.get_word_translation(word, this.settings["language"]); + }; + + EditArea.prototype.add_plugin= function(plug_name, plug_obj){ + for(var i=0; i"); + } + }; + + EditArea.prototype.load_script= function(url){ + try{ + script = document.createElement("script"); + script.type = "text/javascript"; + script.src = url; + script.charset= "UTF-8"; + head = document.getElementsByTagName("head"); + head[0].appendChild(script); + }catch(e){ + document.write("\";\n", $sub_scripts); + + + // add the script and use a last compression + if( $this->param['compress'] ) + { + $last_comp = array( 'Á' => 'this', + 'Â' => 'textarea', + 'Ã' => 'function', + 'Ä' => 'prototype', + 'Å' => 'settings', + 'Æ' => 'length', + 'Ç' => 'style', + 'È' => 'parent', + 'É' => 'last_selection', + 'Ê' => 'value', + 'Ë' => 'true', + 'Ì' => 'false' + /*, + 'Î' => '"', + 'Ï' => "\n", + 'À' => "\r"*/); + } + else + { + $last_comp = array(); + } + + $js_replace= ''; + foreach( $last_comp as $key => $val ) + $js_replace .= ".replace(/". $key ."/g,'". str_replace( array("\n", "\r"), array('\n','\r'), $val ) ."')"; + + $this->datas.= sprintf("editAreaLoader.iframe_script= \"\"%s;\n", + str_replace( array_values($last_comp), array_keys($last_comp), $sub_scripts ), + $js_replace); + + if($this->load_all_plugins) + $this->datas.="editAreaLoader.all_plugins_loaded=true;\n"; + + + // load the template + $this->datas.= sprintf("editAreaLoader.template= \"%s\";\n", $this->get_html_content("template.html")); + // load the css + $this->datas.= sprintf("editAreaLoader.iframe_css= \"\";\n", $this->get_css_content("edit_area.css")); + + // $this->datas= "function editArea(){};editArea.prototype.loader= function(){alert('bouhbouh');} var a= new editArea();a.loader();"; + + } + + function send_datas() + { + if($this->param['debug']){ + $header=sprintf("/* USE PHP COMPRESSION\n"); + $header.=sprintf("javascript size: based files: %s => PHP COMPRESSION => %s ", $this->file_loaded_size, strlen($this->datas)); + if($this->use_gzip){ + $gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); + $header.=sprintf("=> GZIP COMPRESSION => %s", strlen($gzip_datas)); + $ratio = round(100 - strlen($gzip_datas) / $this->file_loaded_size * 100.0); + }else{ + $ratio = round(100 - strlen($this->datas) / $this->file_loaded_size * 100.0); + } + $header.=sprintf(", reduced by %s%%\n", $ratio); + $header.=sprintf("compression time: %s\n", $this->get_microtime()-$this->start_time); + $header.=sprintf("%s\n", implode("\n", $this->infos)); + $header.=sprintf("*/\n"); + $this->datas= $header.$this->datas; + } + $mtime= time(); // ensure that the 2 disk files will have the same update time + // generate gzip file and cahce it if using disk cache + if($this->use_gzip){ + $this->gzip_datas= gzencode($this->datas, 9, FORCE_GZIP); + if($this->param['use_disk_cache']) + $this->file_put_contents($this->gzip_cache_file, $this->gzip_datas, $mtime); + } + + // generate full js file and cache it if using disk cache + if($this->param['use_disk_cache']) + $this->file_put_contents($this->full_cache_file, $this->datas, $mtime); + + // generate output + if($this->use_gzip) + echo $this->gzip_datas; + else + echo $this->datas; + +// die; + } + + + function get_content($end_uri) + { + $end_uri=preg_replace("/\.\./", "", $end_uri); // Remove any .. (security) + $file= $this->path.$end_uri; + if(file_exists($file)){ + $this->infos[]=sprintf("'%s' loaded", $end_uri); + /*$fd = fopen($file, 'rb'); + $content = fread($fd, filesize($file)); + fclose($fd); + return $content;*/ + return $this->file_get_contents($file); + }else{ + $this->infos[]=sprintf("'%s' not loaded", $end_uri); + return ""; + } + } + + function get_javascript_content($end_uri) + { + $val=$this->get_content($end_uri); + + $this->compress_javascript($val); + $this->prepare_string_for_quotes($val); + return $val; + } + + function compress_javascript(&$code) + { + if($this->param['compress']) + { + // remove all comments + // (\"(?:[^\"\\]*(?:\\\\)*(?:\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\]*(?:\\\\)*(?:\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$)) + $code= preg_replace("/(\"(?:[^\"\\\\]*(?:\\\\\\\\)*(?:\\\\\"?)?)*(?:\"|$))|(\'(?:[^\'\\\\]*(?:\\\\\\\\)*(?:\\\\\'?)?)*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code); + // remove line return, empty line and tabulation + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code); + // add line break before "else" otherwise navigators can't manage to parse the file + $code= preg_replace('/(\b(else)\b)/', "\n$1", $code); + // remove unnecessary spaces + $code= preg_replace('/( |\t|\r)*(;|\{|\}|=|==|\-|\+|,|\(|\)|\|\||&\&|\:)( |\t|\r)*/', "$2", $code); + } + } + + function get_css_content($end_uri){ + $code=$this->get_content($end_uri); + // remove comments + $code= preg_replace("/(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "", $code); + // remove spaces + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', "", $code); + // remove spaces + $code= preg_replace('/( |\t|\r)?(\:|,|\{|\})( |\t|\r)+/', "$2", $code); + + $this->prepare_string_for_quotes($code); + return $code; + } + + function get_html_content($end_uri){ + $code=$this->get_content($end_uri); + //$code= preg_replace('/(\"(?:\\\"|[^\"])*(?:\"|$))|' . "(\'(?:\\\'|[^\'])*(?:\'|$))|(?:\/\/(?:.|\r|\t)*?(\n|$))|(?:\/\*(?:.|\n|\r|\t)*?(?:\*\/|$))/s", "$1$2$3", $code); + $code= preg_replace('/(( |\t|\r)*\n( |\t)*)+/s', " ", $code); + $this->prepare_string_for_quotes($code); + return $code; + } + + function prepare_string_for_quotes(&$str){ + // prepare the code to be putted into quotes + /*$pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\\\n"$1+"');*/ + $pattern= array("/(\\\\)?\"/", '/\\\n/' , '/\\\r/' , "/(\r?\n)/"); + if($this->param['compress']) + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , '\n'); + else + $replace= array('$1$1\\"', '\\\\\\n', '\\\\\\r' , "\\n\"\n+\""); + $str= preg_replace($pattern, $replace, $str); + } + + function replace_scripts($var, $param1, $param2) + { + $this->$var=stripslashes($param2); + return $param1."[];"; + } + + /* for php version that have not thoses functions */ + function file_get_contents($file) + { + $fd = fopen($file, 'rb'); + $content = fread($fd, filesize($file)); + fclose($fd); + $this->file_loaded_size+= strlen($content); + return $content; + } + + function file_put_contents($file, &$content, $mtime=-1) + { + if($mtime==-1) + $mtime=time(); + $fp = @fopen($file, "wb"); + if ($fp) { + fwrite($fp, $content); + fclose($fp); + touch($file, $mtime); + return true; + } + return false; + } + + function get_microtime() + { + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); + } + } +?> diff --git a/html/js/edit_area/edit_area_full.gz b/html/js/edit_area/edit_area_full.gz new file mode 100644 index 0000000..8cfc846 Binary files /dev/null and b/html/js/edit_area/edit_area_full.gz differ diff --git a/html/js/edit_area/edit_area_full.js b/html/js/edit_area/edit_area_full.js new file mode 100644 index 0000000..db136a8 --- /dev/null +++ b/html/js/edit_area/edit_area_full.js @@ -0,0 +1,38 @@ + function EAL(){var t=this;t.version="0.8.1.1";date=new Date();t.start_time=date.getTime();t.win="loading";t.error=false;t.baseURL="";t.template="";t.lang={};t.load_syntax={};t.syntax={};t.loadedFiles=[];t.waiting_loading={};t.scripts_to_load=[];t.sub_scripts_to_load=[];t.resize=[];t.hidden={};t.default_settings={debug:false,smooth_selection:true,font_size:"10",font_family:"monospace",start_highlight:false,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,word_wrap,|,help",begin_toolbar:"",end_toolbar:"",is_multi_files:false,allow_resize:"both",show_line_colors:false,min_width:400,min_height:125,replace_tab_by_spaces:false,allow_toggle:true,language:"en",syntax:"",syntax_selection_allow:"basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml",display:"onload",max_undo:30,browsers:"known",plugins:"",gecko_spellcheck:false,fullscreen:false,is_editable:true,cursor_position:"begin",word_wrap:false,autocompletion:false,load_callback:"",save_callback:"",change_callback:"",submit_callback:"",EA_init_callback:"",EA_delete_callback:"",EA_load_callback:"",EA_unload_callback:"",EA_toggle_on_callback:"",EA_toggle_off_callback:"",EA_file_switch_on_callback:"",EA_file_switch_off_callback:"",EA_file_close_callback:""};t.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false],['word_wrap','word_wrap.gif','toggle_word_wrap',true],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];t.set_browser_infos(t);if(t.isIE>=6||t.isGecko||(t.isWebKit&&!t.isSafari<3)||t.isOpera>=9||t.isCamino)t.isValidBrowser=true; +else t.isValidBrowser=false;t.set_base_url();for(var i=0;i0)s["toolbar"]=s["begin_toolbar"]+","+s["toolbar"];if(s["end_toolbar"].length>0)s["toolbar"]=s["toolbar"]+","+s["end_toolbar"];s["tab_toolbar"]=s["toolbar"].replace(/ /g,"").split(",");s["plugins"]=s["plugins"].replace(/ /g,"").split(",");for(i=0;i0){s["syntax"]=s["syntax"].toLowerCase();t.load_script(t.baseURL+"reg_syntax/"+s["syntax"]+".js");}eAs[s["id"]]={"settings":s};eAs[s["id"]]["displayed"]=false;eAs[s["id"]]["hidden"]=false;t.start(s["id"]);},delete_instance:function(id){var d=document,fs=window.frames,span,iframe;eAL.execCommand(id,"EA_delete");if(fs["frame_"+id]&&fs["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");fs["frame_"+id].editArea.execCommand("EA_unload");}span=d.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);iframe=d.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete fs["frame_"+id];}catch(e){}}delete eAs[id];},start:function(id){var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;if(t.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(i in t.waiting_loading){if(t.waiting_loading[i]!="loaded"&&typeof(t.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!t.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!t.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)t.init_syntax_regexp();if(!d.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){span=d.createElement("span");span.id="EditAreaArroundInfos_"+id;if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked='checked'":"";html+="
";html+="";html+="
";}if(eAs[id]["settings"]["debug"])html+="
";html=t.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;father=d.getElementById(id).parentNode;next=d.getElementById(id).nextSibling;if(next==null)father.appendChild(span); +else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){t.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(t.isIE){t.init_ie_textarea(id);}area=eAs[id];for(i=0;i';}for(i=0;i';t.iframe_script+='';}if(!t.iframe_css){t.iframe_css="";}template=t.template.replace(/\[__BASEURL__\]/g,t.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=t.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",t.iframe_css);template=template.replace("[__JSCODE__]",t.iframe_script);template=template.replace("[__EA_VERSION__]",t.version);area.textarea=d.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];father=area.textarea.parentNode;content=d.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";next=area.textarea.nextSibling;if(next==null)father.appendChild(content); +else father.insertBefore(content,next);f=window.frames["frame_"+area["settings"]["id"]];f.document.open();f.eAs=eAs;f.area_id=area["settings"]["id"];f.document.area_id=area["settings"]["id"];f.document.write(template);f.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true&&toggle_to=="off"){this.toggle_off(id);} +else if(eAs[id]["displayed"]==false&&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];if(f.editArea.fullscreen['isFull'])f.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;t.wrap="off";setAttribute(t,"wrap","off");parNod=t.parentNode;nxtSib=t.nextSibling;parNod.removeChild(t);parNod.insertBefore(t,nxtSib);t.value=f.editArea.textarea.value;selStart=f.editArea.last_selection["selectionStart"];selEnd=f.editArea.last_selection["selectionEnd"];scrollTop=f.document.getElementById("result").scrollTop;scrollLeft=f.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';t.style.display="inline";try{t.focus();}catch(e){};if(this.isIE){t.selectionStart=selStart;t.selectionEnd=selEnd;t.focused=true;set_IE_selection(t);} +else{if(this.isOpera&&this.isOpera < 9.6){t.setSelectionRange(0,0);}try{t.setSelectionRange(selStart,selEnd);}catch(e){};}t.scrollTop=scrollTop;t.scrollLeft=scrollLeft;f.editArea.execCommand("toggle_off");}},toggle_on:function(id){var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];area=f.editArea;area.textarea.value=t.value;curPos=eAs[id]["settings"]["cursor_position"];if(t.use_last==true){selStart=t.last_selectionStart;selEnd=t.last_selectionEnd;scrollTop=t.last_scrollTop;scrollLeft=t.last_scrollLeft;t.use_last=false;} +else if(curPos=="auto"){try{selStart=t.selectionStart;selEnd=t.selectionEnd;scrollTop=t.scrollTop;scrollLeft=t.scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));t.style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");f.document.getElementById("result").scrollTop=scrollTop;f.document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");} +else{elem=document.getElementById(id);elem.last_selectionStart=elem.selectionStart;elem.last_selectionEnd=elem.selectionEnd;elem.last_scrollTop=elem.scrollTop;elem.last_scrollLeft=elem.scrollLeft;elem.use_last=true;eAL.start(id);}},set_editarea_size_from_textarea:function(id,frame){var elem,width,height;elem=document.getElementById(id);width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";height=Math.max(eAs[id]["settings"]["min_height"],elem.offsetHeight)+"px";if(elem.style.width.indexOf("%")!=-1)width=elem.style.width;if(elem.style.height.indexOf("%")!=-1)height=elem.style.height;frame.style.width=width;frame.style.height=height;},set_base_url:function(){var t=this,elems,i,docBasePath;if(!this.baseURL){elems=document.getElementsByTagName('script');for(i=0;i';html+='';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); +else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); +else{alert("XMLHTTPRequest not supported. EditArea not loaded");return;}xhr_object.open("GET",this.baseURL+"template.html",false);xhr_object.send(null);if(xhr_object.readyState==4)this.template=xhr_object.responseText; +else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang); +else if(mode="template"){eAL.current_language=lang;text=text.replace(/\{\$([^\}]+)\}/gm,eAL.translate_template);}return text;},translate_template:function(){return eAL.get_word_translation(EAL.prototype.translate_template.arguments[1],eAL.current_language);},get_word_translation:function(val,lang){var i;for(i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){var t=this,d=document,script,head;if(t.loadedFiles[url])return;try{script=d.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";d.getElementsByTagName("head")[0].appendChild(script);}catch(e){d.write('');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);} +else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler); +else obj.removeEventListener(name,handler,false);}catch(e){}},reset:function(e){var formObj,is_child,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); +else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){var fs=window.frames,d=document,t=this,scrollTop,scrollLeft,span;if(d.getElementById(id)&&!t.hidden[id]){t.hidden[id]={};t.hidden[id]["selectionRange"]=t.getSelectionRange(id);if(d.getElementById(id).style.display!="none"){t.hidden[id]["scrollTop"]=d.getElementById(id).scrollTop;t.hidden[id]["scrollLeft"]=d.getElementById(id).scrollLeft;}if(fs["frame_"+id]){t.hidden[id]["toggle"]=eAs[id]["displayed"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;} +else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}t.hidden[id]["scrollTop"]=scrollTop;t.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}d.getElementById(id).style.display="none";}},show:function(id){var fs=window.frames,d=document,t=this,span;if((elem=d.getElementById(id))&&t.hidden[id]){elem.style.display="inline";elem.scrollTop=t.hidden[id]["scrollTop"];elem.scrollLeft=t.hidden[id]["scrollLeft"];span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(fs["frame_"+id]){elem.style.display="inline";if(t.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=t.hidden[id]["scrollTop"];scrollLeft=t.hidden[id]["scrollLeft"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;} +else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=t.hidden[id]["selectionRange"];t.setSelectionRange(id,sel["start"],sel["end"]);delete t.hidden[id];}},getCurrentFile:function(id){return this.execCommand(id,'get_file',this.execCommand(id,'curr_file'));},getFile:function(id,file_id){return this.execCommand(id,'get_file',file_id);},getAllFiles:function(id){return this.execCommand(id,'get_all_files()');},openFile:function(id,file_infos){return this.execCommand(id,'open_file',file_infos);},closeFile:function(id,file_id){return this.execCommand(id,'close_file',file_id);},setFileEditedMode:function(id,file_id,to){var reg1,reg2;reg1=new RegExp('\\\\','g');reg2=new RegExp('"','g');return this.execCommand(id,'set_file_edited_mode("'+file_id.replace(reg1,'\\\\').replace(reg2,'\\"')+'",'+to+')');},execCommand:function(id,cmd,fct_param){switch(cmd){case "EA_init":if(eAs[id]['settings']["EA_init_callback"].length>0)eval(eAs[id]['settings']["EA_init_callback"]+"('"+id+"');");break;case "EA_delete":if(eAs[id]['settings']["EA_delete_callback"].length>0)eval(eAs[id]['settings']["EA_delete_callback"]+"('"+id+"');");break;case "EA_submit":if(eAs[id]['settings']["submit_callback"].length>0)eval(eAs[id]['settings']["submit_callback"]+"('"+id+"');");break;}if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(fct_param!=undefined)return eval('window.frames["frame_'+id+'"].editArea.'+cmd+'(fct_param);'); +else return eval('window.frames["frame_'+id+'"].editArea.'+cmd+';');}return false;}};var eAL=new EAL();var eAs={}; function getAttribute(elm,aName){var aValue,taName,i;try{aValue=elm.getAttribute(aName);}catch(exept){}if(! aValue){for(i=0;i < elm.attributes.length;i++){taName=elm.attributes[i] .name.toLowerCase();if(taName==aName){aValue=elm.attributes[i] .value;return aValue;}}}return aValue;};function setAttribute(elm,attr,val){if(attr=="class"){elm.setAttribute("className",val);elm.setAttribute("class",val);} +else{elm.setAttribute(attr,val);}};function getChildren(elem,elem_type,elem_attribute,elem_attribute_match,option,depth){if(!option)var option="single";if(!depth)var depth=-1;if(elem){var children=elem.childNodes;var result=null;var results=[];for(var x=0;x0){results=results.concat(result);}} +else if(result!=null){return result;}}}}if(option=="all")return results;}return null;};function isChildOf(elem,parent){if(elem){if(elem==parent)return true;while(elem.parentNode !='undefined'){return isChildOf(elem.parentNode,parent);}}return false;};function getMouseX(e){if(e!=null&&typeof(e.pageX)!="undefined"){return e.pageX;} +else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} +else{return(e!=null?e.y:event.y)+document.documentElement.scrollTop;}};function calculeOffsetLeft(r){return calculeOffset(r,"offsetLeft")};function calculeOffsetTop(r){return calculeOffset(r,"offsetTop")};function calculeOffset(element,attr){var offset=0;while(element){offset+=element[attr];element=element.offsetParent}return offset;};function get_css_property(elem,prop){if(document.defaultView){return document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop);} +else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];} +else return null;}var _mCE;function start_move_element(e,id,frame){var elem_id=(e.target||e.srcElement).id;if(id)elem_id=id;if(!frame)frame=window;if(frame.event)e=frame.event;_mCE=frame.document.getElementById(elem_id);_mCE.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);_mCE.start_pos_x=mouse_x-(_mCE.style.left.replace("px","")||calculeOffsetLeft(_mCE));_mCE.start_pos_y=mouse_y-(_mCE.style.top.replace("px","")||calculeOffsetTop(_mCE));return false;};function end_move_element(e){_mCE.frame.document.onmousemove="";_mCE.frame.document.onmouseup="";_mCE=null;};function move_element(e){var newTop,newLeft,maxLeft;if(_mCE.frame&&_mCE.frame.event)e=_mCE.frame.event;newTop=getMouseY(e)-_mCE.start_pos_y;newLeft=getMouseX(e)-_mCE.start_pos_x;maxLeft=_mCE.frame.document.body.offsetWidth-_mCE.offsetWidth;max_top=_mCE.frame.document.body.offsetHeight-_mCE.offsetHeight;newTop=Math.min(Math.max(0,newTop),max_top);newLeft=Math.min(Math.max(0,newLeft),maxLeft);_mCE.style.top=newTop+"px";_mCE.style.left=newLeft+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return{"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(t,start,end){t.focus();start=Math.max(0,Math.min(t.value.length,start));end=Math.max(start,Math.min(t.value.length,end));if(this.isOpera&&this.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(isIE)set_IE_selection(t);};function get_IE_selection(t){var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;if(t&&t.focused){if(!t.ea_line_height){div=d.createElement("div");div.style.fontFamily=get_css_property(t,"font-family");div.style.fontSize=get_css_property(t,"font-size");div.style.visibility="hidden";div.innerHTML="0";d.body.appendChild(div);t.ea_line_height=div.offsetHeight;d.body.removeChild(div);}range=d.selection.createRange();try{stored_range=range.duplicate();stored_range.moveToElementText(t);stored_range.setEndPoint('EndToEnd',range);if(stored_range.parentElement()==t){elem=t;scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}relative_top=range.offsetTop-calculeOffsetTop(t)+scrollTop;line_start=Math.round((relative_top / t.ea_line_height)+1);line_nb=Math.round(range.boundingHeight / t.ea_line_height);range_start=stored_range.text.length-range.text.length;tab=t.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;t.selectionStart=range_start;range_end=t.selectionStart+range.text.length;tab=t.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;t.selectionEnd=range_end;}}catch(e){}}setTimeout("get_IE_selection(document.getElementById('"+t.id+"'));",50);};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(t){var nbLineStart,nbLineStart,nbLineEnd,range;if(!window.closed){nbLineStart=t.value.substr(0,t.selectionStart).split("\n").length-1;nbLineEnd=t.value.substr(0,t.selectionEnd).split("\n").length-1;try{range=document.selection.createRange();range.moveToElementText(t);range.setEndPoint('EndToStart',range);range.moveStart('character',t.selectionStart-nbLineStart);range.moveEnd('character',t.selectionEnd-nbLineEnd-(t.selectionStart-nbLineStart));range.select();}catch(e){}}};eAL.waiting_loading["elements_functions.js"]="loaded"; + EAL.prototype.start_resize_area=function(){var d=document,a,div,width,height,father;d.onmouseup=eAL.end_resize_area;d.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);a=eAs[eAL.resize["id"]]["textarea"];div=d.getElementById("edit_area_resize");if(!div){div=d.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}width=a.offsetWidth-2;height=a.offsetHeight-2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";father=a.parentNode;father.insertBefore(div,a);a.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){var d=document,div,a,width,height;d.onmouseup="";d.onmousemove="";div=d.getElementById("edit_area_resize");a=eAs[eAL.resize["id"]]["textarea"];width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.isIE==6){width-=2;height-=2;}a.style.width=width+"px";a.style.height=height+"px";div.style.display="none";a.style.display="inline";a.selectionStart=eAL.resize["selectionStart"];a.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow,newHeight,newWidth;allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){newHeight=Math.max(20,getMouseY(e)-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=newHeight+"px";}if(allow=="both"||allow=="x"){newWidth=Math.max(20,getMouseX(e)-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=newWidth+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; + EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.toString().replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style={};for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]={};this.syntax[lang]["keywords_reg_exp"]={};this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function")continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp(this.load_syntax[lang]['KEYWORDS'][i]),param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0)this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0)this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=[];this.syntax[lang]["quotes"]={};var quote_tab=[];if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(\\\\.|[^"+x+"])*(?:"+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]={};if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function")continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0)this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0)this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+syntax_trace.join("|")+"|$))","gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]={};for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function")continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]={};if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function")continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']])this.syntax[lang]["custom_regexp"][val['execute']]={};this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp':new RegExp(val['search'],val['modifiers']),'class':val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]={};for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function")continue;if(typeof(this.load_syntax[lang]['STYLES'][i])!="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}} +else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+lang+" ."+i.toLowerCase()+" span{"+lang_style[lang][i]+"}\n";style+="."+lang+" ."+i.toLowerCase()+"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded"; +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false'); +editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
[__TOOLBAR__]
 
 
{$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
{$processing}
{$search} {$close_popup}
{$replace} {$move_popup}

{$find_next} {$replace} {$replace_all}
{$close_popup}

Editarea [__EA_VERSION__]


{$shortcuts}:

{$tab}: {$add_tab}
{$shift}+{$tab}: {$remove_tab}
{$ctrl}+f: {$search_command}
{$ctrl}+r: {$replace_command}
{$ctrl}+h: {$highlight}
{$ctrl}+g: {$go_to_line}
{$ctrl}+z: {$undo}
{$ctrl}+y: {$redo}
{$ctrl}+e: {$help}
{$ctrl}+q, {$esc}: {$close_popup}
{$accesskey} E: {$toggle}

{$about_notice}
"; +editAreaLoader.iframe_css= ""; diff --git a/html/js/edit_area/edit_area_full_with_plugins.gz b/html/js/edit_area/edit_area_full_with_plugins.gz new file mode 100644 index 0000000..19cd98c Binary files /dev/null and b/html/js/edit_area/edit_area_full_with_plugins.gz differ diff --git a/html/js/edit_area/edit_area_full_with_plugins.js b/html/js/edit_area/edit_area_full_with_plugins.js new file mode 100644 index 0000000..4e21810 --- /dev/null +++ b/html/js/edit_area/edit_area_full_with_plugins.js @@ -0,0 +1,39 @@ + function EAL(){var t=this;t.version="0.8.1.1";date=new Date();t.start_time=date.getTime();t.win="loading";t.error=false;t.baseURL="";t.template="";t.lang={};t.load_syntax={};t.syntax={};t.loadedFiles=[];t.waiting_loading={};t.scripts_to_load=[];t.sub_scripts_to_load=[];t.resize=[];t.hidden={};t.default_settings={debug:false,smooth_selection:true,font_size:"10",font_family:"monospace",start_highlight:false,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,word_wrap,|,help",begin_toolbar:"",end_toolbar:"",is_multi_files:false,allow_resize:"both",show_line_colors:false,min_width:400,min_height:125,replace_tab_by_spaces:false,allow_toggle:true,language:"en",syntax:"",syntax_selection_allow:"basic,brainfuck,c,coldfusion,cpp,css,html,java,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml",display:"onload",max_undo:30,browsers:"known",plugins:"",gecko_spellcheck:false,fullscreen:false,is_editable:true,cursor_position:"begin",word_wrap:false,autocompletion:false,load_callback:"",save_callback:"",change_callback:"",submit_callback:"",EA_init_callback:"",EA_delete_callback:"",EA_load_callback:"",EA_unload_callback:"",EA_toggle_on_callback:"",EA_toggle_off_callback:"",EA_file_switch_on_callback:"",EA_file_switch_off_callback:"",EA_file_close_callback:""};t.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false],['word_wrap','word_wrap.gif','toggle_word_wrap',true],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];t.set_browser_infos(t);if(t.isIE>=6||t.isGecko||(t.isWebKit&&!t.isSafari<3)||t.isOpera>=9||t.isCamino)t.isValidBrowser=true; +else t.isValidBrowser=false;t.set_base_url();for(var i=0;i0)s["toolbar"]=s["begin_toolbar"]+","+s["toolbar"];if(s["end_toolbar"].length>0)s["toolbar"]=s["toolbar"]+","+s["end_toolbar"];s["tab_toolbar"]=s["toolbar"].replace(/ /g,"").split(",");s["plugins"]=s["plugins"].replace(/ /g,"").split(",");for(i=0;i0){s["syntax"]=s["syntax"].toLowerCase();t.load_script(t.baseURL+"reg_syntax/"+s["syntax"]+".js");}eAs[s["id"]]={"settings":s};eAs[s["id"]]["displayed"]=false;eAs[s["id"]]["hidden"]=false;t.start(s["id"]);},delete_instance:function(id){var d=document,fs=window.frames,span,iframe;eAL.execCommand(id,"EA_delete");if(fs["frame_"+id]&&fs["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");fs["frame_"+id].editArea.execCommand("EA_unload");}span=d.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);iframe=d.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete fs["frame_"+id];}catch(e){}}delete eAs[id];},start:function(id){var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;if(t.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(i in t.waiting_loading){if(t.waiting_loading[i]!="loaded"&&typeof(t.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!t.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!t.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)t.init_syntax_regexp();if(!d.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){span=d.createElement("span");span.id="EditAreaArroundInfos_"+id;if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked='checked'":"";html+="
";html+="";html+="
";}if(eAs[id]["settings"]["debug"])html+="
";html=t.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;father=d.getElementById(id).parentNode;next=d.getElementById(id).nextSibling;if(next==null)father.appendChild(span); +else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){t.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(t.isIE){t.init_ie_textarea(id);}area=eAs[id];for(i=0;i';}for(i=0;i';t.iframe_script+='';}if(!t.iframe_css){t.iframe_css="";}template=t.template.replace(/\[__BASEURL__\]/g,t.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=t.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",t.iframe_css);template=template.replace("[__JSCODE__]",t.iframe_script);template=template.replace("[__EA_VERSION__]",t.version);area.textarea=d.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];father=area.textarea.parentNode;content=d.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";next=area.textarea.nextSibling;if(next==null)father.appendChild(content); +else father.insertBefore(content,next);f=window.frames["frame_"+area["settings"]["id"]];f.document.open();f.eAs=eAs;f.area_id=area["settings"]["id"];f.document.area_id=area["settings"]["id"];f.document.write(template);f.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true&&toggle_to=="off"){this.toggle_off(id);} +else if(eAs[id]["displayed"]==false&&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){var fs=window.frames,f,t,parNod,nxtSib,selStart,selEnd,scrollTop,scrollLeft;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];if(f.editArea.fullscreen['isFull'])f.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;t.wrap="off";setAttribute(t,"wrap","off");parNod=t.parentNode;nxtSib=t.nextSibling;parNod.removeChild(t);parNod.insertBefore(t,nxtSib);t.value=f.editArea.textarea.value;selStart=f.editArea.last_selection["selectionStart"];selEnd=f.editArea.last_selection["selectionEnd"];scrollTop=f.document.getElementById("result").scrollTop;scrollLeft=f.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';t.style.display="inline";try{t.focus();}catch(e){};if(this.isIE){t.selectionStart=selStart;t.selectionEnd=selEnd;t.focused=true;set_IE_selection(t);} +else{if(this.isOpera&&this.isOpera < 9.6){t.setSelectionRange(0,0);}try{t.setSelectionRange(selStart,selEnd);}catch(e){};}t.scrollTop=scrollTop;t.scrollLeft=scrollLeft;f.editArea.execCommand("toggle_off");}},toggle_on:function(id){var fs=window.frames,f,t,selStart=0,selEnd=0,scrollTop=0,scrollLeft=0,curPos,elem;if(fs["frame_"+id]){f=fs["frame_"+id];t=eAs[id]["textarea"];area=f.editArea;area.textarea.value=t.value;curPos=eAs[id]["settings"]["cursor_position"];if(t.use_last==true){selStart=t.last_selectionStart;selEnd=t.last_selectionEnd;scrollTop=t.last_scrollTop;scrollLeft=t.last_scrollLeft;t.use_last=false;} +else if(curPos=="auto"){try{selStart=t.selectionStart;selEnd=t.selectionEnd;scrollTop=t.scrollTop;scrollLeft=t.scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id,document.getElementById("frame_"+id));t.style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");f.document.getElementById("result").scrollTop=scrollTop;f.document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart,selEnd-selStart);area.execCommand("toggle_on");} +else{elem=document.getElementById(id);elem.last_selectionStart=elem.selectionStart;elem.last_selectionEnd=elem.selectionEnd;elem.last_scrollTop=elem.scrollTop;elem.last_scrollLeft=elem.scrollLeft;elem.use_last=true;eAL.start(id);}},set_editarea_size_from_textarea:function(id,frame){var elem,width,height;elem=document.getElementById(id);width=Math.max(eAs[id]["settings"]["min_width"],elem.offsetWidth)+"px";height=Math.max(eAs[id]["settings"]["min_height"],elem.offsetHeight)+"px";if(elem.style.width.indexOf("%")!=-1)width=elem.style.width;if(elem.style.height.indexOf("%")!=-1)height=elem.style.height;frame.style.width=width;frame.style.height=height;},set_base_url:function(){var t=this,elems,i,docBasePath;if(!this.baseURL){elems=document.getElementsByTagName('script');for(i=0;i';html+='';return html;},get_control_html:function(button_name,lang){var t=this,i,but,html,si;for(i=0;i";case "|":case "separator":return '';case "select_font":html="";return html;case "syntax_selection":html="";return html;}return "["+button_name+"]";},get_template:function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest)xhr_object=new XMLHttpRequest(); +else if(window.ActiveXObject)xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); +else{alert("XMLHTTPRequest not supported. EditArea not loaded");return;}xhr_object.open("GET",this.baseURL+"template.html",false);xhr_object.send(null);if(xhr_object.readyState==4)this.template=xhr_object.responseText; +else this.has_error();}},translate:function(text,lang,mode){if(mode=="word")text=eAL.get_word_translation(text,lang); +else if(mode="template"){eAL.current_language=lang;text=text.replace(/\{\$([^\}]+)\}/gm,eAL.translate_template);}return text;},translate_template:function(){return eAL.get_word_translation(EAL.prototype.translate_template.arguments[1],eAL.current_language);},get_word_translation:function(val,lang){var i;for(i in eAL.lang[lang]){if(i==val)return eAL.lang[lang][i];}return "_"+val;},load_script:function(url){var t=this,d=document,script,head;if(t.loadedFiles[url])return;try{script=d.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";d.getElementsByTagName("head")[0].appendChild(script);}catch(e){d.write('');}t.loadedFiles[url]=true;},add_event:function(obj,name,handler){try{if(obj.attachEvent){obj.attachEvent("on"+name,handler);} +else{obj.addEventListener(name,handler,false);}}catch(e){}},remove_event:function(obj,name,handler){try{if(obj.detachEvent)obj.detachEvent("on"+name,handler); +else obj.removeEventListener(name,handler,false);}catch(e){}},reset:function(e){var formObj,is_child,i,x;formObj=eAL.isIE ? window.event.srcElement:e.target;if(formObj.tagName!='FORM')formObj=formObj.form;for(i in eAs){is_child=false;for(x=0;x old_sel["start"])this.setSelectionRange(id,new_sel["end"],new_sel["end"]); +else this.setSelectionRange(id,old_sel["start"]+open_tag.length,old_sel["start"]+open_tag.length);},hide:function(id){var fs=window.frames,d=document,t=this,scrollTop,scrollLeft,span;if(d.getElementById(id)&&!t.hidden[id]){t.hidden[id]={};t.hidden[id]["selectionRange"]=t.getSelectionRange(id);if(d.getElementById(id).style.display!="none"){t.hidden[id]["scrollTop"]=d.getElementById(id).scrollTop;t.hidden[id]["scrollLeft"]=d.getElementById(id).scrollLeft;}if(fs["frame_"+id]){t.hidden[id]["toggle"]=eAs[id]["displayed"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){scrollTop=fs["frame_"+id].document.getElementById("result").scrollTop;scrollLeft=fs["frame_"+id].document.getElementById("result").scrollLeft;} +else{scrollTop=d.getElementById(id).scrollTop;scrollLeft=d.getElementById(id).scrollLeft;}t.hidden[id]["scrollTop"]=scrollTop;t.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true)eAL.toggle_off(id);}span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}d.getElementById(id).style.display="none";}},show:function(id){var fs=window.frames,d=document,t=this,span;if((elem=d.getElementById(id))&&t.hidden[id]){elem.style.display="inline";elem.scrollTop=t.hidden[id]["scrollTop"];elem.scrollLeft=t.hidden[id]["scrollLeft"];span=d.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(fs["frame_"+id]){elem.style.display="inline";if(t.hidden[id]["toggle"]==true)eAL.toggle_on(id);scrollTop=t.hidden[id]["scrollTop"];scrollLeft=t.hidden[id]["scrollLeft"];if(fs["frame_"+id]&&eAs[id]["displayed"]==true){fs["frame_"+id].document.getElementById("result").scrollTop=scrollTop;fs["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;} +else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=t.hidden[id]["selectionRange"];t.setSelectionRange(id,sel["start"],sel["end"]);delete t.hidden[id];}},getCurrentFile:function(id){return this.execCommand(id,'get_file',this.execCommand(id,'curr_file'));},getFile:function(id,file_id){return this.execCommand(id,'get_file',file_id);},getAllFiles:function(id){return this.execCommand(id,'get_all_files()');},openFile:function(id,file_infos){return this.execCommand(id,'open_file',file_infos);},closeFile:function(id,file_id){return this.execCommand(id,'close_file',file_id);},setFileEditedMode:function(id,file_id,to){var reg1,reg2;reg1=new RegExp('\\\\','g');reg2=new RegExp('"','g');return this.execCommand(id,'set_file_edited_mode("'+file_id.replace(reg1,'\\\\').replace(reg2,'\\"')+'",'+to+')');},execCommand:function(id,cmd,fct_param){switch(cmd){case "EA_init":if(eAs[id]['settings']["EA_init_callback"].length>0)eval(eAs[id]['settings']["EA_init_callback"]+"('"+id+"');");break;case "EA_delete":if(eAs[id]['settings']["EA_delete_callback"].length>0)eval(eAs[id]['settings']["EA_delete_callback"]+"('"+id+"');");break;case "EA_submit":if(eAs[id]['settings']["submit_callback"].length>0)eval(eAs[id]['settings']["submit_callback"]+"('"+id+"');");break;}if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(fct_param!=undefined)return eval('window.frames["frame_'+id+'"].editArea.'+cmd+'(fct_param);'); +else return eval('window.frames["frame_'+id+'"].editArea.'+cmd+';');}return false;}};var eAL=new EAL();var eAs={}; function getAttribute(elm,aName){var aValue,taName,i;try{aValue=elm.getAttribute(aName);}catch(exept){}if(! aValue){for(i=0;i < elm.attributes.length;i++){taName=elm.attributes[i] .name.toLowerCase();if(taName==aName){aValue=elm.attributes[i] .value;return aValue;}}}return aValue;};function setAttribute(elm,attr,val){if(attr=="class"){elm.setAttribute("className",val);elm.setAttribute("class",val);} +else{elm.setAttribute(attr,val);}};function getChildren(elem,elem_type,elem_attribute,elem_attribute_match,option,depth){if(!option)var option="single";if(!depth)var depth=-1;if(elem){var children=elem.childNodes;var result=null;var results=[];for(var x=0;x0){results=results.concat(result);}} +else if(result!=null){return result;}}}}if(option=="all")return results;}return null;};function isChildOf(elem,parent){if(elem){if(elem==parent)return true;while(elem.parentNode !='undefined'){return isChildOf(elem.parentNode,parent);}}return false;};function getMouseX(e){if(e!=null&&typeof(e.pageX)!="undefined"){return e.pageX;} +else{return(e!=null?e.x:event.x)+document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null&&typeof(e.pageY)!="undefined"){return e.pageY;} +else{return(e!=null?e.y:event.y)+document.documentElement.scrollTop;}};function calculeOffsetLeft(r){return calculeOffset(r,"offsetLeft")};function calculeOffsetTop(r){return calculeOffset(r,"offsetTop")};function calculeOffset(element,attr){var offset=0;while(element){offset+=element[attr];element=element.offsetParent}return offset;};function get_css_property(elem,prop){if(document.defaultView){return document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop);} +else if(elem.currentStyle){var prop=prop.replace(/-\D/gi,function(sMatch){return sMatch.charAt(sMatch.length-1).toUpperCase();});return elem.currentStyle[prop];} +else return null;}var _mCE;function start_move_element(e,id,frame){var elem_id=(e.target||e.srcElement).id;if(id)elem_id=id;if(!frame)frame=window;if(frame.event)e=frame.event;_mCE=frame.document.getElementById(elem_id);_mCE.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);_mCE.start_pos_x=mouse_x-(_mCE.style.left.replace("px","")||calculeOffsetLeft(_mCE));_mCE.start_pos_y=mouse_y-(_mCE.style.top.replace("px","")||calculeOffsetTop(_mCE));return false;};function end_move_element(e){_mCE.frame.document.onmousemove="";_mCE.frame.document.onmouseup="";_mCE=null;};function move_element(e){var newTop,newLeft,maxLeft;if(_mCE.frame&&_mCE.frame.event)e=_mCE.frame.event;newTop=getMouseY(e)-_mCE.start_pos_y;newLeft=getMouseX(e)-_mCE.start_pos_x;maxLeft=_mCE.frame.document.body.offsetWidth-_mCE.offsetWidth;max_top=_mCE.frame.document.body.offsetHeight-_mCE.offsetHeight;newTop=Math.min(Math.max(0,newTop),max_top);newLeft=Math.min(Math.max(0,newLeft),maxLeft);_mCE.style.top=newTop+"px";_mCE.style.left=newLeft+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return{"start":textarea.selectionStart,"end":textarea.selectionEnd};};function setSelectionRange(t,start,end){t.focus();start=Math.max(0,Math.min(t.value.length,start));end=Math.max(start,Math.min(t.value.length,end));if(this.isOpera&&this.isOpera < 9.6){t.selectionEnd=1;t.selectionStart=0;t.selectionEnd=1;t.selectionStart=0;}t.selectionStart=start;t.selectionEnd=end;if(isIE)set_IE_selection(t);};function get_IE_selection(t){var d=document,div,range,stored_range,elem,scrollTop,relative_top,line_start,line_nb,range_start,range_end,tab;if(t&&t.focused){if(!t.ea_line_height){div=d.createElement("div");div.style.fontFamily=get_css_property(t,"font-family");div.style.fontSize=get_css_property(t,"font-size");div.style.visibility="hidden";div.innerHTML="0";d.body.appendChild(div);t.ea_line_height=div.offsetHeight;d.body.removeChild(div);}range=d.selection.createRange();try{stored_range=range.duplicate();stored_range.moveToElementText(t);stored_range.setEndPoint('EndToEnd',range);if(stored_range.parentElement()==t){elem=t;scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}relative_top=range.offsetTop-calculeOffsetTop(t)+scrollTop;line_start=Math.round((relative_top / t.ea_line_height)+1);line_nb=Math.round(range.boundingHeight / t.ea_line_height);range_start=stored_range.text.length-range.text.length;tab=t.value.substr(0,range_start).split("\n");range_start+=(line_start-tab.length)*2;t.selectionStart=range_start;range_end=t.selectionStart+range.text.length;tab=t.value.substr(0,range_start+range.text.length).split("\n");range_end+=(line_start+line_nb-1-tab.length)*2;t.selectionEnd=range_end;}}catch(e){}}setTimeout("get_IE_selection(document.getElementById('"+t.id+"'));",50);};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(t){var nbLineStart,nbLineStart,nbLineEnd,range;if(!window.closed){nbLineStart=t.value.substr(0,t.selectionStart).split("\n").length-1;nbLineEnd=t.value.substr(0,t.selectionEnd).split("\n").length-1;try{range=document.selection.createRange();range.moveToElementText(t);range.setEndPoint('EndToStart',range);range.moveStart('character',t.selectionStart-nbLineStart);range.moveEnd('character',t.selectionEnd-nbLineEnd-(t.selectionStart-nbLineStart));range.select();}catch(e){}}};eAL.waiting_loading["elements_functions.js"]="loaded"; + EAL.prototype.start_resize_area=function(){var d=document,a,div,width,height,father;d.onmouseup=eAL.end_resize_area;d.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);a=eAs[eAL.resize["id"]]["textarea"];div=d.getElementById("edit_area_resize");if(!div){div=d.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}width=a.offsetWidth-2;height=a.offsetHeight-2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";father=a.parentNode;father.insertBefore(div,a);a.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){var d=document,div,a,width,height;d.onmouseup="";d.onmousemove="";div=d.getElementById("edit_area_resize");a=eAs[eAL.resize["id"]]["textarea"];width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.isIE==6){width-=2;height-=2;}a.style.width=width+"px";a.style.height=height+"px";div.style.display="none";a.style.display="inline";a.selectionStart=eAL.resize["selectionStart"];a.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow,newHeight,newWidth;allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){newHeight=Math.max(20,getMouseY(e)-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=newHeight+"px";}if(allow=="both"||allow=="x"){newWidth=Math.max(20,getMouseX(e)-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=newWidth+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; + EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.toString().replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style={};for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]={};this.syntax[lang]["keywords_reg_exp"]={};this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function")continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp(this.load_syntax[lang]['KEYWORDS'][i]),param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0)this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0)this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=[];this.syntax[lang]["quotes"]={};var quote_tab=[];if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(\\\\.|[^"+x+"])*(?:"+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]={};if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function")continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0)this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0)this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+syntax_trace.join("|")+"|$))","gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]={};for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function")continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]={};if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function")continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']])this.syntax[lang]["custom_regexp"][val['execute']]={};this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp':new RegExp(val['search'],val['modifiers']),'class':val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]={};for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function")continue;if(typeof(this.load_syntax[lang]['STYLES'][i])!="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}} +else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+lang+" ."+i.toLowerCase()+" span{"+lang_style[lang][i]+"}\n";style+="."+lang+" ."+i.toLowerCase()+"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded"; +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false'); +editAreaLoader.all_plugins_loaded=true; +editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
[__TOOLBAR__]
 
 
{$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
{$processing}
{$search} {$close_popup}
{$replace} {$move_popup}

{$find_next} {$replace} {$replace_all}
{$close_popup}

Editarea [__EA_VERSION__]


{$shortcuts}:

{$tab}: {$add_tab}
{$shift}+{$tab}: {$remove_tab}
{$ctrl}+f: {$search_command}
{$ctrl}+r: {$replace_command}
{$ctrl}+h: {$highlight}
{$ctrl}+g: {$go_to_line}
{$ctrl}+z: {$undo}
{$ctrl}+y: {$redo}
{$ctrl}+e: {$help}
{$ctrl}+q, {$esc}: {$close_popup}
{$accesskey} E: {$toggle}

{$about_notice}
"; +editAreaLoader.iframe_css= ""; diff --git a/html/js/edit_area/edit_area_functions.js b/html/js/edit_area/edit_area_functions.js new file mode 100644 index 0000000..82ec3c9 --- /dev/null +++ b/html/js/edit_area/edit_area_functions.js @@ -0,0 +1,1205 @@ + //replace tabulation by the good number of white spaces + EditArea.prototype.replace_tab= function(text){ + return text.replace(/((\n?)([^\t\n]*)\t)/gi, editArea.smartTab); // slower than simple replace... + }; + + // call by the replace_tab function + EditArea.prototype.smartTab= function(){ + val=" "; + return EditArea.prototype.smartTab.arguments[2] + EditArea.prototype.smartTab.arguments[3] + val.substr(0, editArea.tab_nb_char - (EditArea.prototype.smartTab.arguments[3].length)%editArea.tab_nb_char); + }; + + EditArea.prototype.show_waiting_screen= function(){ + width = this.editor_area.offsetWidth; + height = this.editor_area.offsetHeight; + if( !(this.isIE && this.isIE<6) ) + { + width -= 2; + height -= 2; + } + this.processing_screen.style.display= "block"; + this.processing_screen.style.width = width+"px"; + this.processing_screen.style.height = height+"px"; + this.waiting_screen_displayed = true; + }; + + EditArea.prototype.hide_waiting_screen= function(){ + this.processing_screen.style.display="none"; + this.waiting_screen_displayed= false; + }; + + EditArea.prototype.add_style= function(styles){ + if(styles.length>0){ + newcss = document.createElement("style"); + newcss.type="text/css"; + newcss.media="all"; + if(newcss.styleSheet){ // IE + newcss.styleSheet.cssText = styles; + } else { // W3C + newcss.appendChild(document.createTextNode(styles)); + } + document.getElementsByTagName("head")[0].appendChild(newcss); + } + }; + + EditArea.prototype.set_font= function(family, size){ + var t=this, a=this.textarea, s=this.settings, elem_font, i, elem; + // list all elements concerned by font changes + var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"]; + + if(family && family!="") + s["font_family"]= family; + if(size && size>0) + s["font_size"] = size; + if( t.isOpera && t.isOpera < 9.6 ) // opera<9.6 can't manage non monospace font + s['font_family']="monospace"; + + // update the select tag + if( elem_font = _$("area_font_size") ) + { + for( i = 0; i < elem_font.length; i++ ) + { + if( elem_font.options[i].value && elem_font.options[i].value == s["font_size"] ) + elem_font.options[i].selected=true; + } + } + + /* + * somethimes firefox has rendering mistake with non-monospace font for text width in textarea vs in div for changing font size (eg: verdana change between 11pt to 12pt) + * => looks like a browser internal random bug as text width can change while content_highlight is updated + * we'll check if the font-size produce the same text width inside textarea and div and if not, we'll increment the font-size + * + * This is an ugly fix + */ + if( t.isFirefox ) + { + var nbTry = 3; + do { + var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' ); + var styles = { + width: '40px', + overflow: 'scroll', + zIndex: 50, + visibility: 'hidden', + fontFamily: s["font_family"], + fontSize: s["font_size"]+"pt", + lineHeight: t.lineHeight+"px", + padding: '0', + margin: '0', + border: 'none', + whiteSpace: 'nowrap' + }; + var diff, changed = false; + for( i in styles ) + { + div1.style[ i ] = styles[i]; + text1.style[ i ] = styles[i]; + } + // no wrap for this text + text1.wrap = 'off'; + text1.setAttribute('wrap', 'off'); + t.container.appendChild( div1 ); + t.container.appendChild( text1 ); + // try to make FF to bug + div1.innerHTML = text1.value = 'azertyuiopqsdfghjklm'; + div1.innerHTML = text1.value = text1.value+'wxcvbn^p*ù$!:;,,'; + diff = text1.scrollWidth - div1.scrollWidth; + + // firefox return here a diff of 1 px between equals scrollWidth (can't explain) + if( Math.abs( diff ) >= 2 ) + { + s["font_size"]++; + changed = true; + } + t.container.removeChild( div1 ); + t.container.removeChild( text1 ); + nbTry--; + }while( changed && nbTry > 0 ); + } + + + // calc line height + elem = t.test_font_size; + elem.style.fontFamily = ""+s["font_family"]; + elem.style.fontSize = s["font_size"]+"pt"; + elem.innerHTML = "0"; + t.lineHeight = elem.offsetHeight; + + // update font for all concerned elements + for( i=0; i tags + t.add_style("pre{font-family:"+s["font_family"]+"}"); + + // old opera and IE>=8 doesn't update font changes to the textarea + if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 ) + { + var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd; + parNod.removeChild(a); + parNod.insertBefore(a, nxtSib); + t.area_select(start, end-start); + } + + // force update of selection field + this.focus(); + this.update_size(); + this.check_line_selection(); + }; + + EditArea.prototype.change_font_size= function(){ + var size=_$("area_font_size").value; + if(size>0) + this.set_font("", size); + }; + + + EditArea.prototype.open_inline_popup= function(popup_id){ + this.close_all_inline_popup(); + var popup= _$(popup_id); + var editor= _$("editor"); + + // search matching icon + for(var i=0; i lines.length) + start= this.textarea.value.length; + else{ + for(var i=0; i0){ + //alert(miss_top); + zone.scrollTop= zone.scrollTop + miss_top; + }else if( zone.scrollTop > cursor_pos_top){ + // when erase all the content -> does'nt scroll back to the top + //alert("else: "+cursor_pos_top); + zone.scrollTop= cursor_pos_top; + } + + // manage left scroll + //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px","")); + var cursor_pos_left= _$("cursor_pos").cursor_left; + var max_width_visible= zone.clientWidth + zone.scrollLeft; + var miss_left= cursor_pos_left + 10 - max_width_visible; + if(miss_left>0){ + zone.scrollLeft= zone.scrollLeft + miss_left + 50; + }else if( zone.scrollLeft > cursor_pos_left){ + zone.scrollLeft= cursor_pos_left ; + }else if( zone.scrollLeft == 45){ + // show the line numbers if textarea align to it's left + zone.scrollLeft=0; + } + }; + + EditArea.prototype.check_undo= function(only_once){ + if(!editAreas[this.id]) + return false; + if(this.textareaFocused && editAreas[this.id]["displayed"]==true){ + var text=this.textarea.value; + if(this.previous.length<=1) + this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true); + + if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){ + this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd}); + if(this.previous.length > this.settings["max_undo"]+1) + this.previous.shift(); + + } + if(this.previous.length >= 2) + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); + } + + if(!only_once) + setTimeout("editArea.check_undo()", 3000); + }; + + EditArea.prototype.undo= function(){ + //alert("undo"+this.previous.length); + if(this.previous.length > 0) + { + this.getIESelection(); + // var pos_cursor=this.textarea.selectionStart; + this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } ); + var prev= this.previous.pop(); + if( prev["text"] == this.textarea.value && this.previous.length > 0 ) + prev =this.previous.pop(); + this.textarea.value = prev["text"]; + this.last_undo = prev["text"]; + this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]); + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); + this.resync_highlight(true); + //alert("undo"+this.previous.length); + this.check_file_changes(); + } + }; + + EditArea.prototype.redo= function(){ + if(this.next.length > 0) + { + /*this.getIESelection();*/ + //var pos_cursor=this.textarea.selectionStart; + var next= this.next.pop(); + this.previous.push(next); + this.textarea.value= next["text"]; + this.last_undo= next["text"]; + this.area_select(next["selStart"], next["selEnd"]-next["selStart"]); + this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false); + this.resync_highlight(true); + this.check_file_changes(); + } + if( this.next.length == 0) + this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); + }; + + EditArea.prototype.check_redo= function(){ + if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){ + editArea.next= []; // undo the ability to use "redo" button + editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true); + } + else + { + this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false); + } + }; + + + // functions that manage icons roll over, disabled, etc... + EditArea.prototype.switchClass = function(element, class_name, lock_state) { + var lockChanged = false; + + if (typeof(lock_state) != "undefined" && element != null) { + element.classLock = lock_state; + lockChanged = true; + } + + if (element != null && (lockChanged || !element.classLock)) { + element.oldClassName = element.className; + element.className = class_name; + } + }; + + EditArea.prototype.restoreAndSwitchClass = function(element, class_name) { + if (element != null && !element.classLock) { + this.restoreClass(element); + this.switchClass(element, class_name); + } + }; + + EditArea.prototype.restoreClass = function(element) { + if (element != null && element.oldClassName && !element.classLock) { + element.className = element.oldClassName; + element.oldClassName = null; + } + }; + + EditArea.prototype.setClassLock = function(element, lock_state) { + if (element != null) + element.classLock = lock_state; + }; + + EditArea.prototype.switchClassSticky = function(element, class_name, lock_state) { + var lockChanged = false; + if (typeof(lock_state) != "undefined" && element != null) { + element.classLock = lock_state; + lockChanged = true; + } + + if (element != null && (lockChanged || !element.classLock)) { + element.className = class_name; + element.oldClassName = class_name; + } + }; + + //make the "page up" and "page down" buttons works correctly + EditArea.prototype.scroll_page= function(params){ + var dir= params["dir"], shift_pressed= params["shift"]; + var lines= this.textarea.value.split("\n"); + var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0; + var toScrollAmount = _$("result").clientHeight -30; + var nbLineToScroll = 0, diff= 0; + + if(dir=="up"){ + nbLineToScroll = Math.ceil( toScrollAmount / this.lineHeight ); + + // fix number of line to scroll + for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- ) + { + if( elem = _$('line_'+ i) ) + { + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); + } + } + nbLineToScroll -= diff; + + if(this.last_selection["selec_direction"]=="up"){ + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){ + new_pos+= lines[line_nb].length + 1; + } + char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); + if(shift_pressed) + length=this.last_selection["selectionEnd"]-new_pos-char_left; + this.area_select(new_pos+char_left, length); + view="top"; + }else{ + view="bottom"; + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){ + new_pos+= lines[line_nb].length + 1; + } + char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1); + if(shift_pressed){ + //length=this.last_selection["selectionEnd"]-new_pos-char_left; + start= Math.min(this.last_selection["selectionStart"], new_pos+char_left); + length= Math.max(new_pos+char_left, this.last_selection["selectionStart"] )- start ; + if(new_pos+char_left < this.last_selection["selectionStart"]) + view="top"; + }else + start=new_pos+char_left; + this.area_select(start, length); + + } + } + else + { + var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight ); + // fix number of line to scroll + for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ ) + { + if( elem = _$('line_'+ i) ) + { + diff += Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight ); + } + } + nbLineToScroll -= diff; + + if(this.last_selection["selec_direction"]=="down"){ + view="bottom"; + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){ + if(line_nb==this.last_selection["line_start"]-1) + char_left= this.last_selection["selectionStart"] -new_pos; + new_pos+= lines[line_nb].length + 1; + + } + if(shift_pressed){ + length=Math.abs(this.last_selection["selectionStart"]-new_pos); + length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]); + //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left); + this.area_select(Math.min(this.last_selection["selectionStart"], new_pos), length); + }else{ + this.area_select(new_pos+char_left, 0); + } + + }else{ + view="top"; + for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){ + if(line_nb==this.last_selection["line_start"]-1) + char_left= this.last_selection["selectionStart"] -new_pos; + new_pos+= lines[line_nb].length + 1; + } + if(shift_pressed){ + length=Math.abs(this.last_selection["selectionEnd"]-new_pos-char_left); + length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"])- char_left-1; + //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left); + this.area_select(Math.min(this.last_selection["selectionEnd"], new_pos+char_left), length); + if(new_pos+char_left > this.last_selection["selectionEnd"]) + view="bottom"; + }else{ + this.area_select(new_pos+char_left, 0); + } + + } + } + //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh ); + this.check_line_selection(); + this.scroll_to_view(view); + }; + + EditArea.prototype.start_resize= function(e){ + parent.editAreaLoader.resize["id"] = editArea.id; + parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft; + parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop; + if(editArea.isIE) + { + editArea.textarea.focus(); + editArea.getIESelection(); + } + parent.editAreaLoader.resize["selectionStart"] = editArea.textarea.selectionStart; + parent.editAreaLoader.resize["selectionEnd"] = editArea.textarea.selectionEnd; + parent.editAreaLoader.start_resize_area(); + }; + + EditArea.prototype.toggle_full_screen= function(to){ + var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon; + if(typeof(to)=="undefined") + to= !t.fullscreen['isFull']; + old = t.fullscreen['isFull']; + t.fullscreen['isFull']= to; + icon = _$("fullscreen"); + selStart = t.textarea.selectionStart; + selEnd = t.textarea.selectionEnd; + html = p.document.getElementsByTagName("html")[0]; + frame = p.document.getElementById("frame_"+t.id); + + if(to && to!=old) + { // toogle on fullscreen + + t.fullscreen['old_overflow'] = p.get_css_property(html, "overflow"); + t.fullscreen['old_height'] = p.get_css_property(html, "height"); + t.fullscreen['old_width'] = p.get_css_property(html, "width"); + t.fullscreen['old_scrollTop'] = html.scrollTop; + t.fullscreen['old_scrollLeft'] = html.scrollLeft; + t.fullscreen['old_zIndex'] = p.get_css_property(frame, "z-index"); + if(t.isOpera){ + html.style.height = "100%"; + html.style.width = "100%"; + } + html.style.overflow = "hidden"; + html.scrollTop = 0; + html.scrollLeft = 0; + + frame.style.position = "absolute"; + frame.style.width = html.clientWidth+"px"; + frame.style.height = html.clientHeight+"px"; + frame.style.display = "block"; + frame.style.zIndex = "999999"; + frame.style.top = "0px"; + frame.style.left = "0px"; + + // if the iframe was in a div with position absolute, the top and left are the one of the div, + // so I fix it by seeing at witch position the iframe start and correcting it + frame.style.top = "-"+p.calculeOffsetTop(frame)+"px"; + frame.style.left = "-"+p.calculeOffsetLeft(frame)+"px"; + + // parent.editAreaLoader.execCommand(t.id, "update_size();"); + // var body=parent.document.getElementsByTagName("body")[0]; + // body.appendChild(frame); + + t.switchClassSticky(icon, 'editAreaButtonSelected', false); + t.fullscreen['allow_resize']= t.resize_allowed; + t.allow_resize(false); + + //t.area_select(selStart, selEnd-selStart); + + + // opera can't manage to do a direct size update + if(t.isFirefox){ + p.editAreaLoader.execCommand(t.id, "update_size();"); + t.area_select(selStart, selEnd-selStart); + t.scroll_to_view(); + t.focus(); + }else{ + p.editAreaLoader.execCommand(t.id, "update_size();"); + setTimeout("editArea.focus();", 10); + //setTimeout("p.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10); + } + + + } + else if(to!=old) + { // toogle off fullscreen + frame.style.position="static"; + frame.style.zIndex= t.fullscreen['old_zIndex']; + + if(t.isOpera) + { + html.style.height = "auto"; + html.style.width = "auto"; + html.style.overflow = "auto"; + } + else if(t.isIE && p!=top) + { // IE doesn't manage html overflow in frames like in normal page... + html.style.overflow = "auto"; + } + else + { + html.style.overflow = t.fullscreen['old_overflow']; + } + html.scrollTop = t.fullscreen['old_scrollTop']; + html.scrollLeft = t.fullscreen['old_scrollLeft']; + + p.editAreaLoader.hide(t.id); + p.editAreaLoader.show(t.id); + + t.switchClassSticky(icon, 'editAreaButtonNormal', false); + if(t.fullscreen['allow_resize']) + t.allow_resize(t.fullscreen['allow_resize']); + if(t.isFirefox){ + t.area_select(selStart, selEnd-selStart); + setTimeout("editArea.scroll_to_view();", 10); + } + + //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size); + } + + }; + + EditArea.prototype.allow_resize= function(allow){ + var resize= _$("resize_area"); + if(allow){ + + resize.style.visibility="visible"; + parent.editAreaLoader.add_event(resize, "mouseup", editArea.start_resize); + }else{ + resize.style.visibility="hidden"; + parent.editAreaLoader.remove_event(resize, "mouseup", editArea.start_resize); + } + this.resize_allowed= allow; + }; + + + EditArea.prototype.change_syntax= function(new_syntax, is_waiting){ + // alert("cahnge to "+new_syntax); + // the syntax is the same + if(new_syntax==this.settings['syntax']) + return true; + + // check that the syntax is one allowed + var founded= false; + for(var i=0; i"; + elem.innerHTML= "*"+ this.files[id]['title'] + close +""; + _$('tab_browsing_list').appendChild(elem); + var elem= document.createElement('text'); + this.update_size(); + } + + // open file callback (for plugin) + if(id!="") + this.execCommand('file_open', this.files[id]); + + this.switch_to_file(id, true); + return true; + } + else + return false; + }; + + // close the given file + EditArea.prototype.close_file= function(id){ + if(this.files[id]) + { + this.save_file(id); + + // close file callback + if(this.execCommand('file_close', this.files[id])!==false) + { + // remove the tab in the toolbar + var li= _$(this.files[id]['html_id']); + li.parentNode.removeChild(li); + // select a new file + if(id== this.curr_file) + { + var next_file= ""; + var is_next= false; + for(var i in this.files) + { + if( is_next ) + { + next_file = i; + break; + } + else if( i == id ) + is_next = true; + else + next_file = i; + } + // display the next file + this.switch_to_file(next_file); + } + // clear datas + delete (this.files[id]); + this.update_size(); + } + } + }; + + // backup current file datas + EditArea.prototype.save_file= function(id){ + var t= this, save, a_links, a_selects, save_butt, img, i; + if(t.files[id]) + { + var save= t.files[id]; + save['last_selection'] = t.last_selection; + save['last_text_to_highlight'] = t.last_text_to_highlight; + save['last_hightlighted_text'] = t.last_hightlighted_text; + save['previous'] = t.previous; + save['next'] = t.next; + save['last_undo'] = t.last_undo; + save['smooth_selection'] = t.smooth_selection; + save['do_highlight'] = t.do_highlight; + save['syntax'] = t.settings['syntax']; + save['text'] = t.textarea.value; + save['scroll_top'] = t.result.scrollTop; + save['scroll_left'] = t.result.scrollLeft; + save['selection_start'] = t.last_selection["selectionStart"]; + save['selection_end'] = t.last_selection["selectionEnd"]; + save['font_size'] = t.settings["font_size"]; + save['font_family'] = t.settings["font_family"]; + save['word_wrap'] = t.settings["word_wrap"]; + save['toolbar'] = {'links':{}, 'selects': {}}; + + // save toolbar buttons state for fileSpecific buttons + a_links= _$("toolbar_1").getElementsByTagName("a"); + for( i=0; i