001    /*
002     * Copyright (c) 2009 The openGion Project.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013     * either express or implied. See the License for the specific language
014     * governing permissions and limitations under the License.
015     */
016    package org.opengion.hayabusa.taglib;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.resource.GUIInfo;
020    import org.opengion.hayabusa.resource.RoleMode ;
021    import org.opengion.hayabusa.db.DBLastSql;
022    import org.opengion.fukurou.util.Attributes;
023    import org.opengion.fukurou.util.XHTMLTag;
024    import org.opengion.fukurou.util.StringUtil ;
025    
026    import static org.opengion.fukurou.util.StringUtil.nval ;
027    
028    /**
029     * ファイルアãƒ??ローãƒ?ãƒ?‚¦ンロードリンクを作æ?するタグでã�?通常は result_info.jsp にçµ?¾¼み)ã€?
030     *
031     * 画面検索した結果をã?ãƒ?‚¦ンロードしたり、アãƒ??ロードする機è?は、画面リソースの
032     * ロール制御で管ç�?�—てã�?�¾すã?
033     * ただしã?ãƒ?ƒ•ォルトで、以下ã?制限が掛かってã�?�¾すã?
034     *
035     * ファイルãƒ?‚¦ンローãƒ?
036     *   ・command="NEW|RENEW|FIRST|LAST|PREV|NEXT|VIEW|RESET" のみ
037     * ファイルアãƒ??ローãƒ?
038     *   ・command="COPY|INSERT" のみ
039     *
040     * 5.7.8.1 (2014/07/18)
041     *  addDownCmnd と、addUpldCmnd を指定すれã?、ダウンロードã?アãƒ??ロードできる
042     *  command を増やすことが可能ですã?
043     *
044     * またã?typeDownload="true" にするとDownload 処ç�?‚’行う為の前å?ç�?‚’実施しますã?
045     * Download 処ç�?‚’行うには、指定ã?画面(呼び出しå?)と、抜きå?した時ã?
046     * DBTableModel がã?ãƒ?ƒ�してã�?‚‹か判定しますã?
047     * またã?DBTableModel が存在しなã�??またã?、不備な場å�?オーバã?フロー)はã€?
048     * æœ?µ‚SQLを実行するå¿?¦�があり、そもそもã?抜å?処ç�?�Œ出来なã�?ж態ではã€?
049     * エラーを返すå¿?¦�がありますã?
050     * それらã?ä¸??のDownload 処ç�?‚’行うかどã�?�‹を指定しますã?
051     * true の場合ã?session の HybsSystem.DB_LAST_SQL_KEY に格納された
052     * DBLastSql オブジェクトを取得し、scope ã�?request またã?、overflow ã�?
053     * true の場合に、BODY部を実行しますã?(通常、queryタグを記述しますã?)
054     * query の出力å?は、scope ã‚?request にしますã?
055     * それ以外ã?、tableId から取り出した DBTableModel をã?scope = "request"
056     * に(アドレスのみ)コピã?しますã?
057     * writeTable タグでは、scope = "request" から、DBTableModel を取りå?しますã?
058    
059     * @og.formSample
060     * ●形式:ä¸?ˆ¬ユーザーが直接çµ?�¿込ã‚?�“とはありませんã€?
061     * ●body?šあã‚?EVAL_BODY_BUFFERED:BODYを評価しã?{@XXXX} を解析しまã�?
062     *
063     * ●Tag定義??
064     *   <og:fileUD
065     *       command            【TAG】command を指定しまã�?
066     *       downloadImg        【TAG】ダウンロード時のアイコンを指定しまã�?初期値:"{@SYS.JSP}/image/fileDownload.gif")
067     *       downloadJsp        【TAG】ダウンロード時の呼び出しJSPを指定しまã�?初期値:"{@SYS.JSP}/common/fileDownload.jsp")
068     *       uploadImg          【TAG】アãƒ??ロード時のアイコンを指定しまã�?初期値:"{@SYS.JSP}/image/fileUpload.gif")
069     *       uploadJsp          【TAG】アãƒ??ロード時の呼び出しJSPを指定しまã�?初期値:"{@SYS.JSP}/common/fileUpload.jsp")
070     *       imgWidth           【TAG】アイコンå¹?‚µイズ(px)を指定しまã�?初期値:20px)
071     *       imgHeight          【TAG】アイコン高さサイズ(px)を指定しまã�?初期値:20px)
072     *       filename           【TAG】ダウンロード時ファイル名をæŒ?®šしまã�?初期値:"{@GUI.LABEL}.xls")
073     *       addDownCmnd        【TAG】ダウンロード時のコマンドを追åŠ?Œ‡定できまã�?初期値:null)
074     *       addUpldCmnd        【TAG】アãƒ??ロード時のコマンドを追åŠ?Œ‡定できまã�?初期値:null)
075     *       roles              【TAG】ロールズをセãƒ?ƒˆしまã�?
076     *       target             【TAG】ダウンロード文書を表示させるフレーãƒ??またã?ウィンドウの名前を指定しまã�?
077     *       errorMsg           【TAG】ダウンロードå?来なã�??合ã?エラーメãƒ?‚»ージIDを指定しまã�?初期値:ERR0028)
078     *       typeDownload       【TAG】Download 処ç�?‚’行うかどã�?�‹を指定しまã�?初期値:false)
079     *       useEditLink        【TAG】編é›?ƒªンク自体を出すかどã�?�‹どã�?�‹(初期値:true)
080     *       editImg            【TAG】編é›?‚¢イコンを指定しまã�?初期値:"{@SYS.JSP}/image/edit.png")
081     *       clmEdit            【TAG】編é›?™‚にカラãƒ?·¨é›?‚¿ブを表示するかどã�?�‹(初期値:true)
082     *       debug              【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
083     *   >   ... Body ...
084     *   </og:fileUD>
085     *
086     * ●使用ä¾?
087     *     <og:fileUD command="{@command}" />
088     *
089     *     <og:fileUD
090     *         command        = command設å®?(ãƒ?‚¦ンローãƒ?"NEW|RENEW|FIRST|LAST|PREV|NEXT|VIEW" ã€?  アãƒ??ローãƒ?"COPY|INSERT")
091     *       [ downloadImg ]  = "{@SYS.JSP}/image/fileDownload.gif"   ãƒ?‚¦ンロード時のアイコン
092     *       [ downloadJsp ]  = "{@SYS.JSP}/common/fileDownload.jsp"  ãƒ?‚¦ンロード時の呼び出しJSP
093     *       [ uploadImg   ]  = "{@SYS.JSP}/image/fileUpload.gif"     アãƒ??ロード時のアイコン
094     *       [ uploadJsp   ]  = "{@SYS.JSP}/common/filePopup.jsp"     アãƒ??ロード時の呼び出しJSP
095     *       [ imgWidth    ]  = "20px"                                アイコンå¹?‚µイズ(px)
096     *       [ imgHeight   ]  = "20px"                                アイコン高さサイズ(px)
097     *       [ filename    ]  = "{@GUI.LABEL}.xls"               ãƒ?‚¦ンロード時ファイルå�?
098     *       [ roles       ]  = "GE|DOC"                              アクセスロールズ
099     *       [ target      ]  = "_blank"                              ãƒ?‚¦ンロードファイルを開くターゲãƒ?ƒˆ
100     *       [ errorMsg    ]  = "ERR0042"                             エラーメãƒ?‚»ージID
101     *       [ typeDownload]  = "false/true"                          Download 処ç�?‚’行うかどã�?�‹(初期値:false)
102     *     />
103     *
104     * @og.group ファイルアãƒ??ローãƒ?ãƒ?‚¦ンローãƒ?
105     *
106     * @og.rev 4.3.0.0 (2008/07/04) 新規追åŠ?
107     * @og.rev 5.7.4.1 (2014/03/15) エラーメãƒ?‚»ージ変更
108     *
109     * @version  4.0
110     * @author       Kazuhiko Hasegawa
111     * @since    JDK5.0,
112     */
113    public class FileUDTag extends CommonTagSupport {
114            //* こã?プログラãƒ??VERSIONæ–?­—å?を設定しますã?       {@value} */
115            private static final String VERSION = "5.7.8.1 (2014/07/18)" ;
116    
117            private static final long serialVersionUID = 578120140718L ;
118    
119            private String  sysJsp                  = HybsSystem.sys( "JSP" );
120    
121            private String  command                 = null;         // ãƒ?‚¦ンローãƒ?"NEW|RENEW" 、アãƒ??ローãƒ?"COPY|INSERT"
122            private String  downloadImg             = sysJsp + "/image/fileDownload.gif";   // ãƒ?‚¦ンロード時のアイコン
123            private String  downloadJsp             = sysJsp + "/common/fileDownload.jsp";  // ãƒ?‚¦ンロード時の呼び出しJSP
124            private String  uploadImg               = sysJsp + "/image/fileUpload.gif";             // アãƒ??ロード時のアイコン
125            private String  uploadJsp               = sysJsp + "/common/filePopup.jsp";             // アãƒ??ロード時の呼び出しJSP
126            private String  imgWidth                = "20px";                                               // アイコンå¹?‚µイズ(px)
127            private String  imgHeight               = "20px";                                               // アイコン高さサイズ(px)
128            private String  filename                = null;                                                 // ãƒ?‚¦ンロード時ファイルå�?"{@GUI.LABEL}.xls")
129            private String  roles                   = null;                                                 // アクセスロールズ
130            private String  target                  = null;                                                 // ãƒ?‚¦ンロードファイルを開くターゲãƒ?ƒˆ
131            private String  errorMsg                = "ERR0042";                                    // 出力対象ãƒ??タが見つかりませんでした。å?度検索して下さã�?? 5.7.4.1 (2014/03/15)
132            private boolean isError                 = false;
133            private boolean typeDownload    = false;                                                // Download 処ç�?‚’行うかどã�?�‹(初期値:false)
134            private boolean isEdit                  = true;                                                 // 5.6.0.2 (2013/01/19) ロールのisEditとほぼ同等ã?clmEdit用ã€?
135            private boolean useEditLink             = true;                                                 // 5.7.5.0 (2014/04/04) 編é›?ƒªンク自体を出すかどã�?�‹どã�?�‹(初期値:true)
136    
137            private String  addDownCmnd             = null;                                                 // 5.7.8.1 (2014/07/18) ãƒ?‚¦ンロード時のコマンドを追åŠ?
138            private String  addUpldCmnd             = null;                                                 // 5.7.8.1 (2014/07/18) アãƒ??ロード時のコマンドを追åŠ?
139    
140            private static final String     EDIT_GAMENID= "14_EDIT";                                        // 編é›?”»面の画面ID
141            private String                          editImg         = sysJsp + "/image/edit.png";   // 編é›?™‚のアイコン
142    
143            /**
144             * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
145             *
146             * @og.rev 5.1.6.0 (2010/05/01) 画面é ?›®並べ替え対å¿?
147             *
148             * @return      後続å?ç�??æŒ?¤º(SKIP_BODY)
149             */
150            @Override
151            public int doStartTag() {
152    
153                    if( typeDownload ) {
154                            DBLastSql lastSql = (DBLastSql)getSessionAttribute( HybsSystem.DB_LAST_SQL_KEY );
155                            if( lastSql != null ) {
156                                    String guikey = getRequest().getParameter( "gamenId" );
157                                    if( lastSql.isGuiMatch( guikey ) ) {
158                                            // view タグで仕込んだ clmNames をã?Request 変数に設定しますã?
159                                            setRequestAttribute( "DB.CLM_NAMES" , lastSql.getClmNames() );
160                                            // 5.1.6.0 (2010/05/01) 画面é ?›®並べ替え対å¿?
161                                            setRequestAttribute( "DB.VIEW_CLM_NAMES" , lastSql.getViewClmNames() );
162                                            setRequestAttribute( "DB.VIEW_EDITABLE" , Boolean.toString( lastSql.isViewEditable() ) );
163    
164            //                              if( lastSql.isRequest() || lastSql.isOverflow() ) {
165                                            if( lastSql.isRequest() ) {
166                                                    // 5.1.6.0 (2010/05/01)
167                                                    String sql = getUserInfo( "LASTSQL" );
168                                                    if( sql != null ) {
169                                                            return EVAL_BODY_BUFFERED ;     // Body を評価するã€? extends BodyTagSupport æ™?
170                                                    }
171                                            }
172                                            String tableId = lastSql.getTableId();
173                                            setRequestAttribute( HybsSystem.TBL_MDL_KEY, getSessionAttribute( tableId ) );
174                                            return SKIP_BODY ;                              // Body を評価しなã�?
175                                    }
176                            }
177    
178                            // 処ç�?�Œ実行できなã�??合ã?エラーをå?力しますã?
179                            jspPrint( getResource().getLabel( errorMsg ) );
180                            isError = true;
181                    }
182    
183                    return SKIP_BODY ;                              // Body を評価しなã�?
184            }
185    
186            /**
187             * Taglibの終äº?‚¿グが見つかったときに処ç�?�™ã‚?doEndTag() ã‚?オーバã?ライドしますã?
188             *
189             * @og.rev 4.3.0.1 (2008/08/11) callBack パラメータの設定漏れ修正、引数から見直ã�?
190             * @og.rev 5.1.6.0 (2010/05/01) 帳票画面定義機è?対å¿?
191             * @og.rev 5.1.7.0 (2010/06/01) 進ã‚??戻るã?タンでã‚?xcel出力ã?タンをå?ã�?
192             * @og.rev 5.3.6.0 (2011/06/01) Edit機è?見直ã�?
193             * @og.rev 5.3.7.0 (2011/07/01) Excel取込で画面IDとアドレスが異なるå?合にエラーとなるバグを修正
194             * @og.rev 5.3.7.0 (2011/07/01) 編é›?”»面をリサイズできるように対応しますã?
195             * @og.rev 5.3.7.0 (2011/07/01) PL/SQLを利用した検索でファイルãƒ?‚¦ンロードが出来るよã�?�«対応しますã?
196             * @og.rev 5.4.2.0 (2011/12/01) 画面リソースで画面編é›?©Ÿè?のON/OFFを設定できるようにするã€?
197             * @og.rev 5.5.2.4 (2012/05/16) nullに対する冗長な比è¼?
198             * @og.rev 5.5.5.2 (2012/08/20) 画面リソースのoモード対å¿?
199             * @og.rev 5.5.6.2 (2012/09/24) makeTagのtarget対å¿?
200             * @og.rev 5.6.0.2 (2013/01/19) editモードã?isEditコントロール対å¿?
201             * @og.rev 5.7.5.0 (2014/04/04) 編é›?ƒªンク自体を出すかどã�?�‹どã�?�‹(初期値:true)
202             * @og.rev 5.7.8.1 (2014/07/18) command="RESET" 時に、ダウンロードリンクを表示
203             * @og.rev 5.7.8.1 (2014/07/18) addDownCmnd , addUpldCmndを追åŠ?
204             *
205             * @return      後続å?ç�??æŒ?¤º
206             */
207            @Override
208            public int doEndTag() {
209                    debugPrint();
210    
211                    if( isError      ) { return SKIP_PAGE ; }               // ペã?ジの残りの処ç�?‚’行わなã�??
212                    if( typeDownload ) { return EVAL_PAGE ; }               // ペã?ジの残りを評価するã€?
213    
214                    boolean isDownload ;
215                    // 5.7.8.1 (2014/07/18) command="RESET" 時に、ダウンロードリンクを表示
216                    if(    "NEW".equals(   command ) || "RENEW".equals( command )
217                            || "FIRST".equals( command ) || "LAST".equals(  command )
218                            || "PREV".equals(  command ) || "NEXT".equals(  command )
219                            || "VIEW".equals(  command ) || "RESET".equals( command ) ) {
220                            isDownload = true;
221                    }
222                    else if( "COPY".equals( command ) || "INSERT".equals( command ) ) {
223                            isDownload = false;
224                    }
225                    // 5.7.8.1 (2014/07/18) addDownCmnd , addUpldCmndを追åŠ?
226                    else if( addDownCmnd != null && addDownCmnd.equals( command ) ) {
227                            isDownload = true;
228                    }
229                    else if( addUpldCmnd != null && addUpldCmnd.equals( command ) ) {
230                            isDownload = false;
231                    }
232                    else {
233                            return EVAL_PAGE ;
234                    }
235    
236                    byte bitMode ;
237                    if( roles != null ) {
238                            RoleMode roleMode = RoleMode.newInstance( roles );
239                            RoleMode userRoleMode = getUser().getRoleMode();
240                            bitMode = userRoleMode.getAccessBitMode( roleMode );
241                    }
242                    else {
243                            GUIInfo guiInfo = (GUIInfo)getSessionAttribute( HybsSystem.GUIINFO_KEY );
244                            bitMode = guiInfo.getBitMode();
245                    }
246    
247                    if( filename == null ) {
248                            filename = getGUIInfoAttri( "LABEL" ) + ".xls" ;
249                    }
250                    String guikey = getGUIInfoAttri( "KEY" );       // 4.3.0.1 (2008/08/11)
251                    if( isDownload ) {
252                            if( RoleMode.isDownload( bitMode ) ) {
253                                    // 4.3.0.1 (2008/08/11) callBack パラメータの設定漏れ修正、引数から見直ã�?
254                                    // <og:link href="{@SYS.JSP}/common/fileDownload.jsp" target="_blank" useGamenId="false"
255                                    //              keys="filename,h_clms" vals="{@GUI.LABEL}.xls,{@h_clms}" >
256    
257                                    // 5.3.7.0 (2011/07/01) PL/SQLを利用した検索でファイルãƒ?‚¦ンロードが出来るよã�?�«対応しますã?
258                                    String href = downloadJsp + "?command=RENEW&gamenId=" + guikey + "&GAMENID=" + guikey + "&filename=" + StringUtil.urlEncode( filename ) ;
259    
260                                    jspPrint( makeTag( downloadImg,href,"Download File", target ) ); // 5.5.6.2 (2012/09/24)
261    
262                                    // 5.1.6.0 (2010/05/01) 帳票画面定義機è?対å¿?
263                                    // 5.3.6.0 (2011/06/01) Edit機è?見直ã�?
264                                    GUIInfo editGui = getUser().getGUIInfo( EDIT_GAMENID );
265                                    // 5.7.5.0 (2014/04/04) 編é›?ƒªンク自体を出すかどã�?�‹どã�?�‹(初期値:true)
266                                    if( editGui != null && useEditLink ) {
267                                            String hrefEdit = sysJsp + "/" + editGui.getAddress() + "/"
268                                                                                    + "?command=NEW&gamenId=" + guikey + "&GAMENID=" + guikey;
269    
270                                            String editName = getRequestValue( "editName" );
271                                            // 5.5.2.4 (2012/05/16) nullに対する冗長な比è¼?
272                                            if( editName != null ) {
273                                                    hrefEdit += "&editName=" + editName;
274                                            }
275    
276                                            // 5.4.2.0 (2011/12/01) 画面リソースで画面編é›?©Ÿè?のON/OFFを設定できるようにするã€?
277                                            if( RoleMode.isEdit( bitMode ) && isEdit ) { // 5.6.0.2(2013/01/09)
278                                                    hrefEdit += "&edit=true";
279                                            }
280                                            
281                                            // 5.5.5.2 (2012/08/10) 画面リソースで、画面編é›?©Ÿè?の制限を行えるよã�?�«する
282                                            if( RoleMode.isFullEdit( bitMode ) ) {
283                                                    hrefEdit += "&fullEdit=true";
284                                            }
285                                            else{
286                                                    hrefEdit += "&fullEdit=false";
287                                            }
288    
289                                            // 5.3.7.0 (2011/07/01) 編é›?”»面をリサイズできるように対応しますã?
290                                            hrefEdit = "javascript:ogOpen('" + hrefEdit + "',null,null,'width=800px,height=330px,top=350,left=100,resizable=yes',false);";
291                                            jspPrint( makeTag (editImg,hrefEdit,"Edit",null) ); // 5.5.6.2 (2012/09/24)
292                                    }
293                            }
294                    }
295                    else {
296                            if( RoleMode.isUpload( bitMode ) ) {
297                                    // 4.3.0.1 (2008/08/11) callBack パラメータの設定漏れ修正、引数から見直ã�?
298                                    // <og:link href="{@SYS.JSP}/common/filePopup.jsp" keys="callBack" vals="{@GUI.KEY}/{@SESSION.JSPID}" >
299    
300                                    String jspId  = (String)getSessionAttribute( "JSPID" );
301                                    // 5.3.7.0 (2011/07/01) Excel取込で画面IDとアドレスが異なるå?合にエラーとなるバグを修正
302                                    String callBack = getGUIInfoAttri( "ADDRESS" ) + "/" + jspId + "?GAMENID=" + guikey;
303                                    callBack = StringUtil.urlEncode( callBack );
304                                    String href = uploadJsp + "?callBack=" +  callBack;
305    
306                                    jspPrint( makeTag( uploadImg,href,"Upload File",target ) ); // 5.5.6.2 (2012/09/24)
307                            }
308                    }
309    
310                    return EVAL_PAGE ;
311            }
312    
313            /**
314             * タグリブオブジェクトをリリースしますã?
315             * キャãƒ?‚·ュされて再利用されるã?で、フィールドã?初期設定を行いますã?
316             *
317             * @og.rev 5.7.4.1 (2014/03/15) エラーメãƒ?‚»ージ変更
318             * @og.rev 5.7.5.0 (2014/04/04) useEditLink 追åŠ?
319             * @og.rev 5.7.8.1 (2014/07/18) addDownCmnd,addUpldCmnd 追åŠ?
320             */
321            @Override
322            protected void release2() {
323                    super.release2();
324                    sysJsp                  = HybsSystem.sys( "JSP" );
325                    command                 = null;         // ãƒ?‚¦ンローãƒ?"NEW|RENEW|FIRST|LAST|PREV|NEXT|VIEW|RESET" 、アãƒ??ローãƒ?"COPY|INSERT"
326                    downloadImg             = sysJsp + "/image/fileDownload.gif";   // ãƒ?‚¦ンロード時のアイコン
327                    downloadJsp             = sysJsp + "/common/fileDownload.jsp";  // ãƒ?‚¦ンロード時の呼び出しJSP
328                    uploadImg               = sysJsp + "/image/fileUpload.gif";             // アãƒ??ロード時のアイコン
329                    uploadJsp               = sysJsp + "/common/filePopup.jsp";             // アãƒ??ロード時の呼び出しJSP
330                    imgWidth                = "20px";                                               // アイコンå¹?‚µイズ(px)
331                    imgHeight               = "20px";                                               // アイコン高さサイズ(px)
332                    filename                = null;                                                 // ãƒ?‚¦ンロード時ファイルå�?"{@GUI.LABEL}.xls")
333                    roles                   = null;                                                 // アクセスロールズ
334                    target                  = null;                                                 // ãƒ?‚¦ンロードファイルを開くターゲãƒ?ƒˆ
335                    errorMsg                = "ERR0042";                                    // 出力対象ãƒ??タが見つかりませんでした。å?度検索して下さã�?? 5.7.4.0 (2014/03/15)
336                    typeDownload    = false;                                                // Download 処ç�?‚’行うかどã�?�‹(初期値:false)
337                    isError                 = false;
338                    editImg                 = sysJsp + "/image/edit.png";   // 編é›?™‚のアイコン
339                    isEdit                  = true;                                                 // 5.6.0.2 (2013/01/19)
340                    useEditLink             = true;                                                 // 5.7.5.0 (2014/04/04) 追åŠ?
341                    addDownCmnd             = null;                                                 // 5.7.8.1 (2014/07/18) ãƒ?‚¦ンロード時のコマンドを追åŠ?
342                    addUpldCmnd             = null;                                                 // 5.7.8.1 (2014/07/18) アãƒ??ロード時のコマンドを追åŠ?
343            }
344    
345            /**
346             * リンクを作æ?しますã?
347             *
348             * @og.rev 4.3.0.1 (2008/08/11) callBack パラメータの設定漏れ修正、引数から見直ã�?
349             * @og.rev 5.5.6.2 (2012/09/24) tgt引数追åŠ?
350             *
351             * @param       imgsrc  イメージソース
352             * @param       href    リンクのURL
353             * @param       alt             イメージの説明文書
354             * @param       tgt             HTMLのtarget
355             *
356             * @return      リンクæ–?­—å?
357             */
358            private String makeTag( final String imgsrc, final String href,  final String alt, final String tgt ) { // 5.5.6.2 (2012/09/24)
359                    // linkのBODY部にセãƒ?ƒˆするイメージタグの作æ?
360                    Attributes imgAttri = new Attributes();
361                    imgAttri.set( "width"   , imgWidth );
362                    imgAttri.set( "height"  , imgHeight );
363                    imgAttri.set( "src"             , imgsrc );
364                    imgAttri.set( "alt"             , alt );
365    
366                    String img = XHTMLTag.img( imgAttri );
367    
368                    // 4.3.0.1 (2008/08/11) callBack パラメータの設定漏れ修正、引数から見直ã�?
369                    // linkタグの作æ?
370                    Attributes linkAttri = new Attributes();
371                    linkAttri.set( "href"   , href );
372                    linkAttri.set( "body"   , img );
373                    linkAttri.set( "target" , tgt ); // 5.5.6.2 (2012/09/24)
374    
375                    return XHTMLTag.link( linkAttri );
376            }
377    
378            /**
379             * 【TAG】command を指定しますã?
380             *
381             * @og.tag
382             * command を指定しますã?
383             * ãƒ?‚¦ンロードã?ã€?NEW|RENEW|FIRST|LAST|PREV|NEXT|VIEW|RESET" のみ有効ですã?
384             * アãƒ??ロードã?ã€?COPY|INSERT" のみ有効ですã?
385             * それ以外ã?コマンドでは、アイコンは表示されませんã€?
386             * 例えば、NEXT/PREV などã€?
387             *
388             * @param       cmd コマンド[NEW/RENEW/FIRST/LAST/PREV/NEXT/VIEW/RESET/COPY/INSERT]
389             * @see         #setAddDownCmnd( String )
390             * @see         #setAddUpldCmnd( String )
391             * @see         #setCommand( String )
392             */
393            public void setCommand( final String cmd ) {
394                    command = nval( getRequestParameter( cmd ),command );
395            }
396    
397            /**
398             * 【TAG】ダウンロード時のアイコンを指定しまã�?初期値:"{&#064;SYS.JSP}/image/fileDownload.gif")ã€?
399             *
400             * @og.tag
401             * ãƒ?‚¦ンロード時に表示されるアイコンを指定しますã?
402             * 初期値:"{&#064;SYS.JSP}/image/fileDownload.gif" ですã?
403             *
404             * @param       img ãƒ?‚¦ンロード時のアイコン
405             */
406            public void setDownloadImg( final String img ) {
407                    downloadImg = nval( getRequestParameter( img ),downloadImg );
408            }
409    
410            /**
411             * 【TAG】ダウンロード時の呼び出しJSPを指定しまã�?初期値:"{&#064;SYS.JSP}/common/fileDownload.jsp")ã€?
412             *
413             * @og.tag
414             * ãƒ?‚¦ンロード時に呼び出されるJSPファイル名をæŒ?®šしますã?
415             * 初期値:"{&#064;SYS.JSP}/common/fileDownload.jsp" ですã?
416             *
417             * @param       file ãƒ?‚¦ンロード時の呼び出しJSP
418             */
419            public void setDownloadJsp( final String file ) {
420                    downloadJsp = nval( getRequestParameter( file ),downloadJsp );
421            }
422    
423            /**
424             * 【TAG】アãƒ??ロード時のアイコンを指定しまã�?初期値:"{&#064;SYS.JSP}/image/fileUpload.gif")ã€?
425             *
426             * @og.tag
427             * アãƒ??ロード時に表示されるアイコンを指定しますã?
428             * 初期値:"{&#064;SYS.JSP}/image/fileUpload.gif" ですã?
429             *
430             * @param       img アãƒ??ロード時のアイコン
431             */
432            public void setUploadImg( final String img ) {
433                    uploadImg = nval( getRequestParameter( img ),uploadImg );
434            }
435    
436            /**
437             * 【TAG】アãƒ??ロード時の呼び出しJSPを指定しまã�?初期値:"{&#064;SYS.JSP}/common/fileUpload.jsp")ã€?
438             *
439             * @og.tag
440             * アãƒ??ロード時に呼び出されるJSPファイル名をæŒ?®šしますã?
441             * 初期値:"{&#064;SYS.JSP}/common/fileUpload.jsp" ですã?
442             *
443             * @param       file アãƒ??ロード時の呼び出しJSP
444             */
445            public void setUploadJsp( final String file ) {
446                    uploadJsp = nval( getRequestParameter( file ),uploadJsp );
447            }
448    
449            /**
450             * 【TAG】アイコンå¹?‚µイズ(px)を指定しまã�?初期値:20px)ã€?
451             *
452             * @og.tag
453             * アãƒ??ローãƒ?ãƒ?‚¦ンロードã?アイコンを表示する際ã?å¹?‚µイズ(px)を指定しますã?
454             * ファイルサイズは、アãƒ??ローãƒ?ãƒ?‚¦ンロードå?通ですã?
455             * 初期値はã€?0px ですã?
456             *
457             * @param       width   アイコンå¹?‚µイズ(px)
458             */
459            public void setImgWidth( final String width ) {
460                    imgWidth = nval( getRequestParameter( width ),imgWidth );
461            }
462    
463            /**
464             * 【TAG】アイコン高さサイズ(px)を指定しまã�?初期値:20px)ã€?
465             *
466             * @og.tag
467             * アãƒ??ローãƒ?ãƒ?‚¦ンロードã?アイコンを表示する際ã?高さサイズ(px)を指定しますã?
468             * ファイルサイズは、アãƒ??ローãƒ?ãƒ?‚¦ンロードå?通ですã?
469             * 初期値はã€?0px ですã?
470             *
471             * @param       height  アイコン高さサイズ(px)
472             */
473            public void setImgHeight( final String height ) {
474                    imgHeight = nval( getRequestParameter( height ),imgHeight );
475            }
476    
477            /**
478             * 【TAG】ダウンロード時ファイル名をæŒ?®šしまã�?初期値:"{&#064;GUI.LABEL}.xls")ã€?
479             *
480             * @og.tag
481             * ãƒ?‚¦ンロード時のファイル名をæŒ?®šしまã�?
482             * 通常は、画面のラベル(è¨?ªž対å¿??‹XLS拡張子ですã?
483             * 初期値はã€?{&#064;GUI.LABEL}.xls" ですã?
484             *
485             * @param       file    ãƒ?‚¦ンロード時ファイルå�?"{&#064;GUI.LABEL}.xls")
486             */
487            public void setFilename( final String file ) {
488                    filename = nval( getRequestParameter( file ),filename );
489            }
490    
491            /**
492             * 【TAG】ロールズをセãƒ?ƒˆしますã?
493             *
494             * @og.tag
495             * ここでæŒ?®šしたロールをå?に、ユーザー毎ã?アクセス許可がチェãƒ?‚¯されますã?
496             * アクセス許可されなã�?�¨、表示されませんã€?
497             * こã?ロールを指定しなã�??合ã?、画面のロールが使用されますã?
498             *
499             * @param       rls パラメータ
500             */
501            public void setRoles( final String rls ) {
502                    roles = nval( getRequestParameter( rls ),roles );
503            }
504    
505            /**
506             * 【TAG】ダウンロード文書を表示させるフレーãƒ??またã?ウィンドウの名前を指定しますã?
507             *
508             * @og.tag フレーãƒ?��(ターゲãƒ?ƒˆ属æ?)を設定しますã?
509             *
510             * @param       flag ãƒ?‚¦ンロード文書のフレーãƒ?��(ターゲãƒ?ƒˆ属æ?)
511             */
512            public void setTarget( final String flag ) {
513                    target = nval( getRequestParameter( flag ),target );
514            }
515    
516            /**
517             * 【TAG】Download 処ç�?‚’行うかどã�?�‹を指定しまã�?初期値:false)ã€?
518             *
519             * @og.tag
520             * Download 処ç�?‚’行うには、指定ã?画面(呼び出しå?)と、抜きå?した時ã?
521             * DBTableModel がã?ãƒ?ƒ�してã�?‚‹か判定しますã?
522             * またã?DBTableModel が存在しなã�??またã?、不備な場å�?オーバã?フロー)はã€?
523             * æœ?µ‚SQLを実行するå¿?¦�があり、そもそもã?抜å?処ç�?�Œ出来なã�?ж態ではã€?
524             * エラーを返すå¿?¦�がありますã?
525             * それらã?ä¸??のDownload 処ç�?‚’行うかどã�?�‹を指定しますã?
526             * true の場合ã?session の HybsSystem.DB_LAST_SQL_KEY に格納された
527             * DBLastSql オブジェクトを取得し、scope ã�?request またã?、overflow ã�?
528             * true の場合に、BODY部を実行しますã?(通常、queryタグを記述しますã?)
529             * query の出力å?は、scope ã‚?request にしますã?
530             * それ以外ã?、tableId から取り出した DBTableModel をã?scope = "request"
531             * に(アドレスのみ)コピã?しますã?
532             * writeTable タグでは、scope = "request" から、DBTableModel を取りå?しますã?
533             *
534             * 初期値は、false(抜き出しでは無くリンク作æ?) ですã?
535             *
536             * @param       type    Download 処ç�?‚’行うかどã�?�‹(初期値:false)
537             */
538            public void setTypeDownload( final String type ) {
539                    typeDownload = nval( getRequestParameter( type ),typeDownload );
540            }
541    
542            /**
543             * 【TAG】ダウンロードå?来なã�??合ã?エラーメãƒ?‚»ージIDを指定しまã�?初期値:ERR0042)ã€?
544             *
545             * @og.tag
546             * DBTableModel がã?æœ?¾Œに作æ?された画面と、メモリ中の DBLastSql オブジェクトが
547             * 管ç�?�—てã�?‚‹æƒ??が異なるå?合ã?、ダウンロードå?来ませんã€?
548             * 同様に、DBLastSql オブジェクãƒ?自身が作æ?されてã�?�ªã�??合も出来ませんã€?
549             * そã?ようなケースに表示するエラーメãƒ?‚»ージのメãƒ?‚»ージIDを指定しますã?
550             * 引数は、指定できませんã€?
551             * 初期値は、ã?ERR0042?šå?力対象ãƒ??タが見つかりませんでした。å?度検索して下さã�??ã€?ですã?
552             *
553             * @param       msg ãƒ?‚¦ンロード文書のフレーãƒ?��(ターゲãƒ?ƒˆ属æ?)
554             */
555            public void setErrorMsg( final String msg ) {
556                    errorMsg = nval( getRequestParameter( msg ),errorMsg );
557            }
558    
559            /**
560             * 【TAG】編é›?‚¢イコンを指定しまã�?初期値:"{&#064;SYS.JSP}/image/edit.png")ã€?
561             *
562             * @og.tag
563             * 編é›?‚¢イコンを指定しますã?
564             * 初期値:"{&#064;SYS.JSP}/image/edit.png" ですã?
565             *
566             * @og.rev 5.1.6.0 (2010/05/01) 新規追åŠ?
567             *
568             * @param       img アãƒ??ロード時のアイコン
569             */
570            public void setEditImg( final String img ) {
571                    editImg = nval( getRequestParameter( img ),editImg );
572            }
573            
574            /**
575             * 【TAG】Edit画面でカラãƒ?·¨é›?‚¿ブを出すかどã�?�‹(初期値?štrue)
576             *
577             * @og.tag
578             * falseを指定するとカラãƒ?·¨é›?‚¿ブを出さなã�??
579             *
580             * @param       type    カラãƒ?·¨é›?‚¿ブを出すかどã�?�‹(初期値:true)
581             */
582            public void setClmEdit( final String type ) {
583                    isEdit = nval( getRequestParameter( type ),isEdit );
584            }
585    
586            /**
587             * 【TAG】Edit画面でカラãƒ?·¨é›?ƒªンクをå?力するかどã�?�‹(初期値?štrue)
588             *
589             * @og.tag
590             * falseを指定するとカラãƒ?·¨é›?ƒªンクをå?さなã�??
591             * 従来は、カラãƒ?·¨é›?”»面のå†??【表示é ?›®設定ã?タブを表示しなã�?� けでしたã€?
592             * こã?設定ã?、RWMODE をã? ##d , ##u , ##f の場合にも同様ã?設定が可能ですã?
593             * カラãƒ?·¨é›?ƒªンク自体を出さなã�?©Ÿè?は、現時点ではリソース設定できなã�?�Ÿめã?
594             * タグのパラメータとしてæŒ?®šできるようにしますã?
595             * 基本çš?�«は、このパラメータはほとんど使われてã�?�ªã�?ƒ�ズなのでã€?
596             * 機è?を置き換えますã?
597             * 初期値は、カラãƒ?·¨é›?ƒªンクをå?力すã‚?=true)ですã?
598             *
599             * @og.rev 5.7.5.0 (2014/04/04) 新規追åŠ?
600             *
601             * @param       flag    カラãƒ?·¨é›?ƒªンクをå?力するかどã�?�‹(初期値:true)
602             * @see         org.opengion.hayabusa.taglib.QueryButtonTag#setUseEditMenu(String)
603             */
604            public void setUseEditLink( final String flag ) {
605                    useEditLink = nval( getRequestParameter( flag ),useEditLink );
606            }
607    
608            /**
609             * 【TAG】ダウンロード時のコマンドを追åŠ?Œ‡定できまã�?初期値:null)
610             *
611             * @og.tag
612             * ãƒ?‚¦ンロードリンクが表示されã‚?command はã€?
613             * "NEW|RENEW|FIRST|LAST|PREV|NEXT|VIEW|RESET" のみですã?
614             * これ以外ã? command で、ダウンロードリンクを表示させたい場合ã?ã€?
615             * こã?、addDownCmnd に、記述しますã?
616             * 初期値は、null(追åŠ?‚³マンドã?なã�?ですã?
617             *
618             * @og.rev 5.7.8.1 (2014/07/18) 新規追åŠ?
619             *
620             * @param       cmd     ãƒ?‚¦ンロード時のコマンドを追åŠ?Œ‡å®?
621             * @see         #setCommand( String )
622             */
623            public void setAddDownCmnd( final String cmd ) {
624                    addDownCmnd = nval( getRequestParameter( cmd ),addDownCmnd );
625            }
626    
627            /**
628             * 【TAG】アãƒ??ロード時のコマンドを追åŠ?Œ‡定できまã�?初期値:null)
629             *
630             * @og.tag
631             * アãƒ??ロードリンクが表示されã‚?command はã€?COPY|INSERT" のみですã?
632             * これ以外ã? command で、アãƒ??ロードリンクを表示させたい場合ã?ã€?
633             * こã?、addUpldCmnd に、記述しますã?
634             * 初期値は、null(追åŠ?‚³マンドã?なã�?ですã?
635             *
636             * @og.rev 5.7.8.1 (2014/07/18) 新規追åŠ?
637             *
638             * @param       cmd     アãƒ??ロード時のコマンドを追åŠ?Œ‡å®?
639             * @see         #setCommand( String )
640             */
641            public void setAddUpldCmnd( final String cmd ) {
642                    addUpldCmnd = nval( getRequestParameter( cmd ),addUpldCmnd );
643            }
644    
645            /**
646             * こã?オブジェクトã?æ–?­—å?表現を返しますã?
647             * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
648             *
649             * @return こã?クラスのæ–?­—å?表現
650             */
651            @Override
652            public String toString() {
653                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
654                                    .println( "VERSION"             ,VERSION                )
655                                    .println( "command"             ,command                )
656                                    .println( "downloadImg" ,downloadImg    )
657                                    .println( "downloadJsp" ,downloadJsp    )
658                                    .println( "uploadImg"   ,uploadImg              )
659                                    .println( "uploadJsp"   ,uploadJsp              )
660                                    .println( "imgWidth"    ,imgWidth               )
661                                    .println( "imgHeight"   ,imgHeight              )
662                                    .println( "filename"    ,filename               )
663                                    .println( "roles"               ,roles                  )
664                                    .println( "target"              ,target                 )
665                                    .println( "Other..."    ,getAttributes().getAttribute() )
666                                    .fixForm().toString() ;
667            }
668    }