Exemple #1
0
  private void Func_invoke() {

    /*
     * Invoke function : <td> <a
     * href="${server_path}/supersql.invoke.InvokeServlet?
     * ${dbname}+${query_filename}+${added_condition}"> TFE </a> </td>
     */

    String path = this.getAtt("path", ".");
    if (!GlobalEnv.getFileDirectory().equals(".")) {
      path = GlobalEnv.getFileDirectory();
    }
    String filename = this.getAtt("filename");
    if (!filename.startsWith("/") && (path != null)) {
      filename = path + "/" + filename;
    }

    Log.out("invoke filename:" + filename);

    // start tk/////////////////////////////////
    /*
     * html_env.linkurl = this.getAtt("server_path", GlobalEnv
     * .getInvokeServletPath()) + "?" + this.getAtt("dbname",
     * GlobalEnv.getdbname()) + "+" + filename + "+" +
     * this.getAtt("condition");
     */
    /*
     * html_env.linkurl =
     * "http://localhost:8080/invoke/servlet/supersql.invoke.InvokeServlet2"
     * + "?" + "config=http://localhost:8080/invoke/config.ssql" + "&" +
     * "query=" + filename + "&" + "cond=" + this.getAtt("condition");
     */
    // change chie
    htmlEnv.linkUrl =
        this.getAtt("server_path", GlobalEnv.getInvokeServletPath())
            + "?"
            + "config="
            + path
            + "/config.ssql"
            + "&"
            + "query="
            + filename
            + "&"
            + "cond="
            + this.getAtt("condition");
    // end tk//////////////////////////////////////////////////

    htmlEnv.linkFlag = 1;
    this.workAtt("default");
    htmlEnv.linkFlag = 0;

    return;
  }
Exemple #2
0
  // G1��work�᥽�å�
  @Override
  public String work(ExtList data_info) {
    Mobile_HTML5.preProcess(getSymbol(), decos, html_env); // Pre-process (前処理)

    // 20131001 tableDivHeader
    Mobile_HTML5G2.tableDivHeader = "";
    Mobile_HTML5G2.tableDivHeader_codeBuf = "";
    Mobile_HTML5G2.tableDivHeader_Count1 = 0;
    Mobile_HTML5G2.tableDivHeader_Count2 = 0;

    int panelFlg = 0; // 20130503  Panel

    // 1行ごとのカラム数 (range: 2〜)
    boolean columnFlg = false;
    if (tableFlg) numberOfColumns = -1; // @{table}時のDefault	//20130917  [ ],10@{table}
    else numberOfColumns = data_info.size(); // div
    //    	Log.e(data_info.contain_itemnum()+" "+tfe.countconnectitem()+" "+data_info.size());
    if (decos.containsKey("column") && !Mobile_HTML5.dynamicDisplay) {
      try {
        numberOfColumns = Integer.parseInt(decos.getStr("column").replace("\"", ""));
        if (numberOfColumns < 2) {
          Log.err("<<Warning>> column指定の範囲は、2〜です。指定された「column=" + numberOfColumns + "」は使用できません。");
          if (tableFlg) numberOfColumns = -1; // 20130917  [ ],10@{table}
          else numberOfColumns = data_info.size(); // div
        } else columnFlg = true;
      } catch (Exception e) {
      }
    }

    // added by goto 20130413  "row Prev/Next"
    // 1ページごとの行数指定 (Default: 1, range: 1〜)
    String parentfile = null;
    String parentnextbackfile = null;
    StringBuffer parentcode = null;
    StringBuffer parentcss = null;
    StringBuffer parentheader = null;
    StringBuffer parentfooter = null;
    if (decos.containsKey("row") && columnFlg && !Mobile_HTML5.dynamicDisplay) {
      row = Integer.parseInt(decos.getStr("row").replace("\"", ""));
      if (row < 1) { // 範囲外のとき
        Log.err("<<Warning>> row指定の範囲は、1〜です。指定された「row=" + row + "」は使用できません。");
      } else {
        parentfile = html_env.filename;
        parentnextbackfile = html_env.nextbackfile;
        parentcode = html_env.code;
        parentcss = html_env.css;
        parentheader = html_env.header;
        parentfooter = html_env.footer;
        html_env.css = new StringBuffer();
        html_env.header = new StringBuffer();
        html_env.footer = new StringBuffer();
        rowFlg = true;
      }
    }

    Log.out("------- G1 -------");
    this.setDataList(data_info);

    // tk start///////////////////////////////////////////////////
    html_env.append_css_def_td(Mobile_HTML5Env.getClassID(this), this.decos);

    // 20130309
    G1Flg = true;

    // ☆重要★
    gridInt = 0;
    // HTMLG1.jj = 0;
    // HTMLG1.gridInt = 0;

    // 20130325  table0
    if (decos.containsKey("table0")) table0Flg = true;
    else table0Flg = false;
    // 20130314  table
    // if(decos.containsKey("table") || !decos.containsKey("div") || table0Flg){
    //        if(decos.containsKey("table") || table0Flg){
    if (decos.containsKey("table")
        || table0Flg
        || Mobile_HTML5C1.tableFlg
        || Mobile_HTML5C2.tableFlg
        || Mobile_HTML5G2.tableFlg) {
      // if(decos.containsKey("table") || HTMLC1.tableFlg || HTMLC2.tableFlg){
      //    		Log.info("C1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
      //    		Log.info("C1 tableFlg = true !!");
      tableFlg = true;
    } // else	tableFlg = false;

    // 20130326  div
    // if(decos.containsKey("div") || HTMLC1.divFlg || HTMLC2.divFlg || HTMLG1.divFlg ||
    // HTMLG2.divFlg){
    if (decos.containsKey("div")) {
      divFlg = true;
      tableFlg = false;
    } // else divFlg = false;

    //        //20130529
    //        if(decos.containsKey("dynamic")){
    //        	if(!Mobile_HTML5Env.dynamicFlg)	Mobile_HTML5Env.staticBuf = html_env.code;
    //        	Mobile_HTML5Env.dynamicFlg = true;
    //        	Log.i("※G1 HTMLEnv.staticBuf: "+Mobile_HTML5Env.staticBuf);
    //        }

    // 20130914  "text"
    //      	Log.e("	decosC2 = "+decos);
    if (decos.containsKey("text")) {
      //        	Log.e("	G2in!");
      Mobile_HTML5Function.textFlg2 = true;
    }

    if (!GlobalEnv.isOpt()) {
      // 20130503  Panel
      panelFlg = Mobile_HTML5C1.panelProcess1(decos, html_env);

      //        	//20130205
      //        	html_env.code.append("<div id=\"fisheye\" class=\"fisheye\">\n" +
      //        			"<div class=\"fisheyeContainter\">\n");

      // 20130330 tab
      // tab1
      if (decos.containsKey("tab1")) {
        //        		//,で結合(水平結合)した際
        //        		//replace: 不要な「<div class=〜」をカット
        //    			String[] s = {"a","b","c","d","e"};
        //    			int j=0;
        //    			while(!HTMLManager.replaceCode(html_env, "<div class=\"ui-block-"+s[j]+"
        // "+HTMLEnv.getClassID(this)+"\">", "")){
        //    				j++;
        //    				if(j>4) break;
        //    			}

        html_env.code.append("<div data-role=\"content\"> <div id=\"tabs\">\n<ul>\n");
        html_env.code.append("	<li><a href=\"#tabs-" + Mobile_HTML5Env.tabCount + "\">");
        if (!decos.getStr("tab1").equals("")) html_env.code.append(decos.getStr("tab1"));
        else html_env.code.append("tab1");
        html_env.code.append("</a></li>\n");
        html_env.code.append("</ul>\n<div id=\"tabs-" + Mobile_HTML5Env.tabCount + "\">\n");
        //            	HTMLEnv.tabFlg = true;
      }
      // tab2〜tab15
      //        	else if(HTMLEnv.tabFlg){
      else {
        int i = 2;
        while (i <= Mobile_HTML5Env.maxTab) { // HTMLEnv.maxTab=15
          // Log.info("i="+i+" !!");
          if (decos.containsKey("tab" + i) || (i == 2 && decos.containsKey("tab"))) {
            // replace: </ul>の前に<li>〜</li>を付加
            String a = "</ul>";
            String b = "	<li><a href=\"#tabs-" + Mobile_HTML5Env.tabCount + "\">";
            if (decos.containsKey("tab" + i))
              if (!decos.getStr("tab" + i).equals("")) b += decos.getStr("tab" + i);
              else b += "tab" + i;
            else if (!decos.getStr("tab").equals("")) b += decos.getStr("tab");
            else b += "tab";
            b += "</a></li>\n";
            Mobile_HTML5Manager.replaceCode(html_env, a, b + a);

            // replace: 最後の</div></div></div>カット
            Mobile_HTML5Manager.replaceCode(html_env, "</div></div></div>", "");

            // replace: 不要な「<div class=〜」をカット
            Mobile_HTML5Manager.replaceCode(
                html_env, "<div class=\"" + Mobile_HTML5Env.getClassID(this) + " \">", "");
            // String cutClass="class=\""+HTMLEnv.getClassID(this)+" \"";
            // if(!HTMLManager.replaceCode(html_env, "<div "+cutClass+">", ""))	cutClass="";
            //    	        		if(!HTMLManager.replaceCode(html_env, "<div
            // class=\""+HTMLEnv.getClassID(this)+" \">", "")){
            //    	        			//Log.info("Cannot cut. "+HTMLEnv.getClassID(this));
            //    	        			String[] s = {"a","b","c","d","e"};
            //    	        			int j=0;
            //    	        			while(!HTMLManager.replaceCode(html_env, "<div
            // class=\"ui-block-"+s[j]+" "+HTMLEnv.getClassID(this)+"\">", "")){
            //    	        				//,で結合(水平結合)した際に、このwhileに入る(レアケース)
            //    	        				j++;
            //    	        				if(j>4) break;
            //    	        			}
            //    	        		}

            html_env.code.append("<div id=\"tabs-" + Mobile_HTML5Env.tabCount + "\">\n");
            //// 上記でカットしたcutClassをappend
            // html_env.code.append("<div id=\"tabs-"+HTMLEnv.tabCount+"\" "+cutClass+">\n");
            break;
          }
          i++;
          //        			if(i>HTMLEnv.maxTab)	HTMLEnv.tabFlg =false;
        }
      }

      // 20130312 collapsible
      if (decos.containsKey("collapse")) {
        html_env.code.append(
            "<DIV data-role=\"collapsible\" data-content-theme=\"c\" style=\"padding: 0px 12px;\">\n");

        // header
        if (!decos.getStr("collapse").equals(""))
          html_env.code.append("	<h1>" + decos.getStr("collapse") + "</h1>\n");
        else html_env.code.append("<h1>Contents</h1>\n");
      }
      //        	else{
      // 20130309
      //        	//uncommented
      // if(!tableFlg) 	html_env.code.append("	<DIV Class=\"ui-grid-a\">");
      if (!tableFlg) {
        if (html_env.written_classid.contains(Mobile_HTML5Env.getClassID(this)))
          html_env.code.append(
              "\n<DIV Class=\"ui-grid ##"
                  + Mobile_HTML5Env.uiGridCount2
                  + " "
                  + Mobile_HTML5Env.getClassID(this)
                  + "\"");
        //	        		html_env.code.append("\n<DIV Class=\"ui-grid-a ##"+HTMLEnv.uiGridCount2+"
        // "+HTMLEnv.getClassID(this)+"\"");
        else
          html_env.code.append("\n<DIV Class=\"ui-grid ##" + Mobile_HTML5Env.uiGridCount2 + "\"");
        //        			html_env.code.append("\n<DIV Class=\"ui-grid-a ##"+HTMLEnv.uiGridCount2+"\"");
        html_env.code.append(">\n");
        Mobile_HTML5Env.uiGridCount2++;
      }

      // 20130314  table
      if (tableFlg) {
        // added by goto 20130318  横スクロール
        if (numberOfColumns < 0)
          html_env.code.append("<div style=\"overflow:auto;\">\n"); // 20130917  [ ],10@{table}
        // html_env.code.append("<div style=\"height:60px; width:0px; overflow:auto;\">\n");

        if (row > 1 && tableFlg)
          Mobile_HTML5G2.tableStartTag =
              Mobile_HTML5C1.getTableStartTag(html_env, decos, this) + "<TR>";
        else html_env.code.append(Mobile_HTML5C1.getTableStartTag(html_env, decos, this) + "<TR>");
      }
    }
    //        Log.out("<TABLE class=\""+HTMLEnv.getClassID(this) + "\"><TR>");

    // html_env2.code.append("<tfe type=\"connect\" dimension=\"1\" >");

    Mobile_HTML5.beforeWhileProcess(getSymbol(), decos, html_env);
    int i = 0;
    while (this.hasMoreItems()) {
      Mobile_HTML5Function.glvl = html_env.glevel; // added by goto 20130914  "SEQ_NUM"

      if (decos.containsKey("table0")
          || Mobile_HTML5C1.table0Flg
          || Mobile_HTML5C2.table0Flg
          || Mobile_HTML5G2.table0Flg) table0Flg = true;
      if (decos.containsKey("table")
          || Mobile_HTML5C1.tableFlg
          || Mobile_HTML5C2.tableFlg
          || Mobile_HTML5G2.tableFlg
          || table0Flg) tableFlg = true;
      // if(decos.containsKey("div") || HTMLC1.divFlg || HTMLC2.divFlg || HTMLG1.divFlg ||
      // HTMLG2.divFlg){
      if (decos.containsKey("div")) {
        divFlg = true;
        tableFlg = false;
      }

      html_env.glevel++;

      // added by goto 20130413  "row Prev/Next"
      if (rowFlg) {
        html_env.code = new StringBuffer();
        html_env.countfile++;
        html_env.filename =
            html_env.outfile + "_row" + Mobile_HTML5G2.rowFileNum + "_" + j + ".html";
        html_env.nextbackfile =
            html_env.linkoutfile + "_row" + Mobile_HTML5G2.rowFileNum + "_" + j + ".html";
        html_env.setOutlineMode();
      }

      // 20130309
      //            Count = ( ((gridInt>=jj)&&(!HTMLG1.G1Flg))? jj:gridInt );
      Count = (((gridInt >= jj) && (Mobile_HTML5G1.G1Flg)) ? jj : gridInt);

      //            //20130312 collapsible
      //        	if(decos.containsKey("collapse")){
      //            	Log.info("★  [],2");
      ////            	html_env.code.append("	<DIV data-role=\"collapsible\">");
      ////            	html_env.code.append("	<h1>ヘッダ[],</h1>");
      //
      //            //20130309
      //            //if(Count > 4 && Count%5==0){

      //			//☆G1のみ↓ 必要?不要? 無くても問題ない。あった場合、最終行が個数に合わせて変化
      //        	if(Count > pic_column-1 && Count%pic_column==0 && !tableFlg){
      //        		if(html_env.written_classid.contains(HTMLEnv.getClassID(this)))
      //        			html_env.code.append("\n	</DIV>\n	<DIV Class=\"ui-grid-a
      // ##"+HTMLEnv.uiGridCount2+" "+HTMLEnv.getClassID(this)+"\"");
      //        		else
      //        			html_env.code.append("\n	</DIV>\n	<DIV Class=\"ui-grid-a
      // ##"+HTMLEnv.uiGridCount2+"\"");
      //        		html_env.code.append(">\n");
      //        		HTMLEnv.uiGridCount2++;
      //        	}
      //			//☆G1のみ↑

      // Log.info("★G1★"+gridInt+" "+ii+" "+jj+"  "+Count+"  "+Count%5+"	"+HTMLG1.G1Flg);
      //            Count %= 5;
      // Log.info("	☆★"+gridInt+" "+ii+" "+jj+"  "+Count+"  "+Count%pic_column+"	"+HTMLG1.G1Flg);
      Count %= numberOfColumns;

      // 20130917  [ ],10@{table}
      if (tableFlg && numberOfColumns > 1 && Count == 0) {
        if (table_column_num > 0) html_env.code.append("</TR><TR>\n");
        else table_column_num++;
      }

      // html_env.code.append("	<div>");
      // html_env.code.append("	<div class=\"ui-block-a\">");

      //            //20130312 collapsible
      //        	if(decos.containsKey("collapse")){
      //            	Log.info("★  [],3");
      //    	        html_env.code.append("	<p>\n");
      //        	}else{
      // 20130309
      if (!tableFlg) {
        // 20131002
        String divWidth =
            Mobile_HTML5.getDivWidth(
                decos, numberOfColumns - Mobile_HTML5Function.func_null_count); // null()
        //            	tfe.addDeco("width", divWidth);	//☆HTMLEnvで行うように変更した <=
        // この方法は、widthが上書き?されるためNG

        if (Count != 0)
          html_env.code.append(
              "\n<div class=\"ui-block"
                  + " "
                  + Mobile_HTML5Env.getClassID(tfe)
                  + "\" style=\"width:"
                  + divWidth
                  + "\">\n");
        else
          html_env.code.append(
              "\n<div class=\"ui-block"
                  + " "
                  + Mobile_HTML5Env.getClassID(tfe)
                  + "\" style=\"width:"
                  + divWidth
                  + "; clear:left;\">\n");
        //            	if(Count!=0)	html_env.code.append("\n<div class=\"ui-block"+"
        // "+Mobile_HTML5Env.getClassID(tfe)+" \">\n");
        //            	else			html_env.code.append("\n<div class=\"ui-block"+"
        // "+Mobile_HTML5Env.getClassID(tfe)+"\" style=\"clear:left;\">\n");

        //    	    	float divWidth = (float)Math.floor((double)(100.0/numberOfColumns)* 1000) /
        // 1000;
        //    	    	if(Count!=0)	html_env.code.append("\n	<div class=\"ui-block"+"
        // "+HTMLEnv.getClassID(tfe)+"\" style=\"width:"+divWidth+"%;\">\n");
        //    	    	else			html_env.code.append("\n	<div class=\"ui-block"+"
        // "+HTMLEnv.getClassID(tfe)+"\" style=\"width:"+divWidth+"%; clear:left;\">\n");
      }
      //    	    if(!tableFlg)   html_env.code.append("\n	<div
      // class=\"ui-block-"+gridString[Count]+" "+HTMLEnv.getClassID(tfe)+"\">\n");
      // 20130314  table
      else {
        html_env.code.append("<TD class=\"" + Mobile_HTML5Env.getClassID(tfe) + " nest\">\n");
      }
      // String classid = HTMLEnv.getClassID(tfe);
      classid = Mobile_HTML5Env.getClassID(tfe);
      // classid0 = HTMLEnv.getClassID(tfe);

      // Log.out("<TD class=\"" + HTMLEnv.getClassID(tfe) + " nest\">");
      // Log.info("tfe : " + tfe);
      // Log.info("tfe : " + this.tfes);
      // Log.info("tfe : " + this.tfeItems);

      //    	    if(Mobile_HTML5Env.dynamicFlg){	//20130529 dynamic
      //	      		//☆★
      //	      		Log.info("★★G1-1 tfe : " + tfe);
      //	    		//☆★            Log.info("G1 tfe : " + tfe);
      //	            //☆★            Log.info("G1 tfes : " + this.tfes);
      //	            //☆★            Log.info("G1 tfeItems : " + this.tfeItems);
      //	      	}

      Mobile_HTML5.whileProcess1(getSymbol(), decos, html_env, data, data_info, tfe, null, -1);

      this.worknextItem();

      Mobile_HTML5.whileProcess2(getSymbol(), decos, html_env, data, data_info, tfe, null, -1);

      if (decos.containsKey("table0")
          || Mobile_HTML5C1.table0Flg
          || Mobile_HTML5C2.table0Flg
          || Mobile_HTML5G2.table0Flg) table0Flg = true;
      if (decos.containsKey("table")
          || Mobile_HTML5C1.tableFlg
          || Mobile_HTML5C2.tableFlg
          || Mobile_HTML5G2.tableFlg
          || table0Flg) tableFlg = true;
      // if(decos.containsKey("div") || HTMLC1.divFlg || HTMLC2.divFlg || HTMLG1.divFlg ||
      // HTMLG2.divFlg){
      if (decos.containsKey("div")) {
        divFlg = true;
        tableFlg = false;
      }

      //            //20130529
      //            if(decos.containsKey("dynamic"))	Mobile_HTML5Env.dynamicFlg = true;

      //    	    if(Mobile_HTML5Env.dynamicFlg){	//20130529 dynamic
      //	      		//☆★
      //	      		Log.info("★★G1-2 tfe : " + tfe);
      //	    		//☆★            Log.info("G1 tfe : " + tfe);
      //	            //☆★            Log.info("G1 tfes : " + this.tfes);
      //	            //☆★            Log.info("G1 tfeItems : " + this.tfeItems);
      //	      	}
      // 20130309
      // 20130314  table
      if (tableFlg) {
        if (html_env.not_written_classid.contains(classid)) {
          html_env.code.delete(
              html_env.code.indexOf(classid),
              html_env.code.indexOf(classid) + classid.length() + 1);
        }
      }

      // html_env2.code.append("</tfe>"); //おそらくXML

      //            //20130312 collapsible
      //        	if(decos.containsKey("collapse")){
      //
      //            //20130309
      ////            if(Count>1/* && HTMLG1.G1Flg*/){
      //        	}else

      //        	//TODO 必要?不要? → おそらく不要?
      //            if(Count>1 && HTMLG1.G1Flg && /* !HTMLG2.G2Flg &&*/ !tableFlg){
      //        		String rep="ui-grid ##"+(HTMLEnv.uiGridCount2-1);
      ////        		String rep="ui-grid-"+gridString[Count-2]+" ##"+(HTMLEnv.uiGridCount2-1);
      //            	try{
      //	            	html_env.code.replace(
      //	            			html_env.code.lastIndexOf(rep),
      //	            			html_env.code.lastIndexOf(rep)+rep.length(),
      //	            			"ui-grid ##"+(HTMLEnv.uiGridCount2++));
      ////	            			"ui-grid-"+gridString[Count-1]+" ##"+(HTMLEnv.uiGridCount2++));
      //            	}catch(Exception e){ /*Log.info("G1 Catch exception.");*/ }
      //            }
      ii++;
      jj++;
      gridInt++;
      // HTMLEnv.uiGridCount++;

      //            //20130312 collapsible
      //        	if(decos.containsKey("collapse")){
      //            	Log.info("★  [],5");
      //    	        html_env.code.append("	</p>\n");
      //        	}else{

      if (!tableFlg) html_env.code.append("</div>"); // 20130309
      else html_env.code.append("</TD>\n"); // 20130314 table
      // Log.out("</TD>");
      //            if(HTMLFunction.textFlg){					//20130914  "text"
      //	      		Log.e("G1 text!");
      //	      		html_env.code.append(HTMLFunction.text);
      //	      		HTMLFunction.text = "";
      //	      		HTMLFunction.textFlg = false;
      //	      	}

      i++;
      // Log.info("	html_env.glevel = "+html_env.glevel);
      //            if(html_env.glevel == 0){
      //            	jj = 0;
      //            	gridInt = 0;
      //            	//Count = 0;
      //            }
      html_env.glevel--;

      Mobile_HTML5G2.tableDivHeader_Count1++; // 20131001 tableDivHeader

      // added by goto 20130413  "row Prev/Next"
      if (rowFlg) {
        codeBuf.append(html_env.code);
        if ((rowNum + 1) % (row * numberOfColumns) == 0) {
          Mobile_HTML5G2.createHTMLfile_ForPrevNext(html_env, codeBuf);
          j++;
          codeBuf = new StringBuffer();
        }
        rowNum++;
      }
    } // /while
    Mobile_HTML5.afterWhileProcess(getSymbol(), decos, html_env);

    // added by goto 20130413  "row Prev/Next"
    if (rowFlg) {
      if (rowNum % (row * numberOfColumns) != 0) { // 最後の child HTML を create
        Mobile_HTML5G2.createHTMLfile_ForPrevNext(html_env, codeBuf);
      }
      // ファイル名・コード等をparent HTMLのものへ戻す
      html_env.filename = parentfile;
      html_env.code = parentcode;
      html_env.css = parentcss;
      html_env.header = parentheader;
      html_env.footer = parentfooter;
      html_env.nextbackfile = parentnextbackfile;
      Log.out("TFEId = " + Mobile_HTML5Env.getClassID(this));
      html_env.append_css_def_td(Mobile_HTML5Env.getClassID(this), this.decos);

      int first = 1,
          last =
              ((rowNum % (row * numberOfColumns) != 0)
                  ? (rowNum / (row * numberOfColumns) + 1)
                  : (rowNum / (row * numberOfColumns))); // for G1
      Mobile_HTML5G2.PrevNextProcess(html_env, rowNum, row, first, last, numberOfColumns);
    }

    ////        //TOOD 必要?不要? → 不要のような気がするけど??? → あると余計な部分が消されることがあるので無い方が良い(2013.09.26)
    ////        //[重要] For [ [], ]! || [],
    ////        //[],内が1つの値のみだったとき -> 直近のui-grid-aとui-block-aをカット
    //    	if(HTMLG1.gridInt == 1){
    //        //if(HTMLG1.jj == 1 && HTMLG1.gridInt == 1 /*&& HTMLG2.G2Flg*/){
    //        	//Log.i("			HTMLG1.jj = "+HTMLG1.jj+"	HTMLG1.gridInt = "+HTMLG1.gridInt+"
    //	HTMLG1.classid = "+HTMLG1.classid+"		!!");
    //        	//Log.i("			"+HTMLManager.replaceCode(html_env, "ui-grid-a
    // ##"+(HTMLEnv.uiGridCount2-1), "##"+(HTMLEnv.uiGridCount2-1)));
    //        	HTMLManager.replaceCode(html_env, "ui-grid ##"+(HTMLEnv.uiGridCount2-1),
    // "##"+(HTMLEnv.uiGridCount2-1));	//TODO
    ////        	HTMLManager.replaceCode(html_env, "ui-grid-a ##"+(HTMLEnv.uiGridCount2-1),
    // "##"+(HTMLEnv.uiGridCount2-1));
    //    		HTMLManager.replaceCode(html_env, "ui-block "+HTMLG1.classid, "### "+HTMLG1.classid);
    //	//TODO
    ////    		HTMLManager.replaceCode(html_env, "ui-block-a "+HTMLG1.classid, "###
    // "+HTMLG1.classid);
    //    	}

    //        Log.i("	"+jj+"	"+gridInt);
    /*
    //    		//,で結合(水平結合)した際
    //    		//replace: 不要な「<div class=〜」をカット
    //			String[] s = {"a","b","c","d","e"};
    //			int j=0;
    //			while(!HTMLManager.replaceCode(html_env, "<div class=\"ui-block-"+s[j]+" "+HTMLEnv.getClassID(this)+"\">", "")){
    //				j++;
    //				if(j>4) break;
    //			}
        	 */

    if (Mobile_HTML5Env.getFormItemFlg()) {
      Mobile_HTML5Env.incrementFormPartsNumber();
    }

    // html_env2.code.append("</tfe>");

    if (!tableFlg) html_env.code.append("\n</DIV>\n"); // 20130309
    else {
      if (!(row > 1 && tableFlg)) html_env.code.append("</TR></TABLE>\n"); // 20130314  table
      tableFlg = false;
      table0Flg = false; // 20130325 table0
      if (numberOfColumns < 0)
        html_env.code.append(
            "</div>\n"); // added by goto 20130318  横スクロール		//20130917  [ ],10@{table}
    }

    if (divFlg) divFlg = false; // 20130326  div

    //        if(Mobile_HTML5Env.dynamicFlg)	Mobile_HTML5Env.dynamicFlg = false;		//20130529 dynamic

    G1Flg = false;
    Log.out("</TR></TABLE>");

    // 20130312 collapsible
    if (decos.containsKey("collapse")) {
      html_env.code.append("</DIV>");
    }

    // 20130330 tab
    //    	if(HTMLEnv.tabFlg){
    int a = 1;
    while (a <= Mobile_HTML5Env.maxTab) {
      // Log.info("a="+a);
      if (decos.containsKey("tab" + a) || (a == 1 && decos.containsKey("tab"))) {
        html_env.code.append("</div></div></div>\n");
        Mobile_HTML5Env.tabCount++;
        break;
      }
      a++;
    }
    //    	}

    // 20130503  Panel
    Mobile_HTML5C1.panelProcess2(decos, html_env, panelFlg);

    // added by goto 20130413  "row Prev/Next"
    if (rowFlg) {
      Mobile_HTML5G2.rowFileNum++;
      rowFlg = false;
      Mobile_HTML5G2.tableStartTag = "";
    }

    Mobile_HTML5.postProcess(getSymbol(), decos, html_env); // Post-process (後処理)

    // added by goto 20130914  "SEQ_NUM"
    Mobile_HTML5Function.Func_seq_num_initialization(html_env.glevel);

    Log.out("TFEId = " + Mobile_HTML5Env.getClassID(this));
    // html_env.append_css_def_td(HTMLEnv.getClassID(this), this.decos);
    return null;
  }
Exemple #3
0
  private void Func_sinvoke(ExtList data_info) {
    String file = this.getAtt("file");
    String action = this.getAtt("action");
    int attNo = 1;
    String att = new String();
    Log.out("sinvoke file 3: " + file);

    // tk start/////////////////////////////////////////////////////////////
    /*
     * if (file.indexOf("/") > 0) { file =
     * file.substring(file.lastIndexOf("/") + 1); }
     */
    // tk end//////////////////////////////////////////////////////////////
    Log.out("1 att:" + att + " attNo:" + attNo + " att1:" + this.getAtt("att1"));

    while (!this.getAtt("att" + attNo).equals("")) {
      att = att + "_" + this.getAtt("att" + attNo);
      attNo++;
      Log.out("att:" + att + " attNo:" + attNo);
      // System.out.println(att);
    }
    try {
      att = URLEncoder.encode(att, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    if (this.getAtt("action").equals("")) {
      try {
        if (file.toLowerCase().contains(".sql")) {
          file = file.substring(0, file.indexOf(".sql"));
        } else if (file.toLowerCase().contains(".ssql")) {
          file = file.substring(0, file.indexOf(".ssql"));
        } else if (file.toLowerCase().contains(".html")) {
          file = file.substring(0, file.indexOf(".html"));
        }
      } catch (Exception e) {
        GlobalEnv.addErr("Error[HTMLFunction]: filename is invalid.");
        //				System.err.println("Error[HTMLFunction]: filename is invalid.");
        Log.err("Error[HTMLFunction]: filename is invalid.");
        //				GlobalEnv.errorText += "Error[HTMLFunction]: filename is invalid.";
      }

      String filename = new String();
      if (!this.getAtt("att").equals("")) {
        if (this.getAtt("att").toLowerCase().startsWith("http://")) filename = this.getAtt("att");
        else if (this.getAtt("att").toLowerCase().endsWith(".html")) filename = this.getAtt("att");
        else filename = file + "_" + this.getAtt("att") + ".html";
      } else {
        filename = file + att + ".html";
      }

      filename.replace("\\\\", "\\");
      htmlEnv.linkUrl = filename;
      htmlEnv.sinvokeFlag = true;

    } else {
      String filename = new String();
      if (!this.getAtt("att").equals("")) filename = action + "/" + this.getAtt("att");
      else filename = action + att;

      filename.replace("\\\\", "\\");
      htmlEnv.linkUrl = filename;
      htmlEnv.sinvokeFlag = true;
    }

    // tk to make hyper link to
    // image///////////////////////////////////////////////////
    // tk to ajax
    if (GlobalEnv.isAjax()) {
      htmlEnv.linkUrl = file + ".html";
      htmlEnv.ajaxQuery = file + ".sql";
      // html_env.ajaxatt = this.getAtt("att");
      htmlEnv.ajaxCond = this.getAtt("ajaxcond") + "=" + this.getAtt("att");

      Date d2 = new Date();
      SimpleDateFormat sdf2 = new SimpleDateFormat("yyyymmddHHmmss");
      String today2 = sdf2.format(d2);

      htmlEnv.dragDivId = htmlEnv.ajaxQuery + "+" + htmlEnv.ajaxCond + "&" + today2;

      if (decos.containsKey("in")) {
        String effect = decos.getStr("in");

        if (effect.equalsIgnoreCase("blind")) htmlEnv.inEffect = 1;
        if (effect.equalsIgnoreCase("fade")) htmlEnv.inEffect = 2;
      }
      if (decos.containsKey("out")) {
        String effect = decos.getStr("out");

        if (effect.equalsIgnoreCase("blind")) htmlEnv.outEffect = 1;
        if (effect.equalsIgnoreCase("fade")) htmlEnv.outEffect = 2;
      }

      if (decos.containsKey("panel")) {
        htmlEnv.isPanel = true;
      }
      if (decos.containsKey("dispdiv")) {
        String dispdiv = decos.getStr("dispdiv");
        if (dispdiv.contains("+")) {
          String tmp2 = dispdiv.substring(0, dispdiv.lastIndexOf("+"));
          String tmp3 = dispdiv.substring(dispdiv.lastIndexOf("+") + 1, dispdiv.length());

          if (tmp3.compareTo("att") == 0) {
            htmlEnv.ajaxtarget = tmp2 + "_" + this.getAtt("att");
          } else htmlEnv.ajaxtarget = dispdiv;
        } else {
          htmlEnv.ajaxtarget = dispdiv;
        }
        htmlEnv.hasDispDiv = true;
        Log.out("html_env.ajaxtarget:" + htmlEnv.ajaxtarget);
      } else if (decos.containsKey("dragto")) {
        Log.out("draggable = ture");
        htmlEnv.draggable = true;

        // drag to
        String value = decos.getStr("dragto");
        String[] droptarget = new String[100];
        int targetnum = 0;

        if (value.contains("+")) {
          while (true) {
            if (!value.contains("+")) {
              droptarget[targetnum] = value;
              targetnum++;
              break;
            }
            droptarget[targetnum] = value.substring(0, value.indexOf("+"));
            value = value.substring(value.indexOf("+") + 1, value.length());

            targetnum++;
          }
        } else droptarget[0] = value;

        // script ����
        Date d1 = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyymmddHHmmss");
        String today = sdf.format(d1);

        String scriptname = "drop" + today + htmlEnv.scriptNum;
        htmlEnv.script.append(
            scriptname
                + " = new DragDrop(\""
                + htmlEnv.dragDivId
                + "\", \""
                + droptarget[0]
                + "\");\n");

        Log.out(
            scriptname
                + " = new DragDrop(\""
                + htmlEnv.dragDivId
                + "\", \""
                + droptarget[0]
                + "\");\n");

        // for tab
        htmlEnv.script.append(scriptname + ".addToGroup(\"myTab\");\n");

        for (int i = 1; i < targetnum; ++i) {
          htmlEnv.script.append(scriptname + ".addToGroup(\"" + droptarget[i] + "\");\n");
        }

        htmlEnv.scriptNum++;
      }
    }
    if (this.Args.get(0) instanceof FuncArg) {
      Log.out("ARGS are function");
      FuncArg fa = this.Args.get(0);
      fa.workAtt();
    } else this.workAtt("default");
    // tk//////////////////////////////////////////////////

    htmlEnv.sinvokeFlag = false;
    return;
  }
Exemple #4
0
  public static String createForm(DecorateList decos) {
    new String();
    String path = new String();
    String form = new String();
    // System.out.println(this.getAtt("label"));
    if (decos.containsKey("path")) {
      path = decos.getStr("path").replaceAll("\"", "");
    } else {
      path = ".";
    }

    form =
        "<form method=\"POST\" action=\""
            + path
            + "/supersql.form.FormServlet\" "
            + "name=\""
            + HTMLEnv.getFormName()
            + "\" "
            + ">";

    form +=
        "<input type=\"hidden\" name=\"configfile\" value=\""
            + GlobalEnv.getFileDirectory()
            + "/config.ssql\" />";

    if (decos.containsKey("link")) {
      opt(decos.getStr("link"));
      form +=
          "<input type=\"hidden\" name=\"sqlfile\" value=\""
              + path
              + "/"
              + decos.getStr("link").replaceAll("\"", "")
              + "\" />";
    }

    if (decos.containsKey("cond")) {
      form +=
          "<input type=\"hidden\" name=\"cond1\" value=\""
              + decos.getStr("cond").replaceAll("\"", "")
              + "\" />";
    }

    if (decos.containsKey("updatefile")) {
      String tmp = opt(decos.getStr("updatefile"));
      updateFile =
          "<input type=\"hidden\" name=\"updatefile\" value=\"" + path + "/" + tmp + "\" />";
      form += updateFile;
    }
    if (decos.containsKey("linkfile")) {
      opt(decos.getStr("linkfile"));
      form +=
          "<input type=\"hidden\" name=\"linkfile\" value=\""
              + path
              + "/"
              + decos.getStr("linkfile").replaceAll("\"", "")
              + "\" />";
    }
    if (decos.containsKey("cond")) {
      form +=
          "<input type=\"hidden\" name=\"linkcond\" value=\""
              + decos.getStr("cond").replaceAll("\"", "")
              + "\" />";
    }
    Log.out(form);
    HTMLEnv.setFormDetail(form);
    return form;
  }
Exemple #5
0
  private void Func_FormCommon(String s) {
    String form = new String();

    boolean openFormInThis = false;

    if (!HTMLEnv.getFormItemFlg()) {
      form = createForm();
      openFormInThis = true;
    }

    HTMLEnv.setFormItemFlg(true, s);

    String att = new String();
    Integer attNo = 1;
    while (!this.getAtt("att" + attNo).equals("")) {
      if (attNo > 1) att += ",";
      att += this.getAtt("att" + attNo);
      Log.out("att:" + att + " attNo:" + attNo);
      attNo++;
    }
    if (attNo == 1 && !this.getAtt("att").equals("")) {
      att += this.getAtt("att");
      Log.out("att:" + att + " attNo:" + attNo);
    }

    if (!this.getAtt("name").equals("")) {
      HTMLEnv.setFormPartsName(this.getAtt("name"));
      HTMLEnv.exFormName();
    } else {
      HTMLEnv.setFormPartsName(null);
    }

    if (!this.getAtt("id").equals("")) {
      HTMLEnv.nameId = this.getAtt("id");
    }

    if (!this.getAtt("cond_name").equals("")) {
      HTMLEnv.condName = this.getAtt("cond_name");
    }
    if (!this.getAtt("cond").equals("")) {
      HTMLEnv.cond = this.getAtt("cond");
    }

    htmlEnv.code.append(form);

    if (this.Args.get(0) instanceof FuncArg) {
      // HTMLEnv.setSelectFlg(true,(String)this.decos.get("select"));
      HTMLEnv.setFormValueString(att);
      Log.out("ARGS are function");
      FuncArg fa = this.Args.get(0);
      fa.workAtt();
    } else {
      this.workAtt("default");
    }

    if (openFormInThis == true) {
      htmlEnv.code.append("</form>");
      HTMLEnv.setFormItemFlg(false, null);
      openFormInThis = false;
    } else {
      HTMLEnv.setFormItemFlg(true, null);
    }
    return;
  }
Exemple #6
0
  // tk
  // start//////////////////////////////////////////////////////////////////////////////
  private void Func_embed(ExtList data_info) {
    String file = this.getAtt("file");
    String where = this.getAtt("where");
    String att = this.getAtt("att");
    this.getAtt("border");
    String att2 = this.getAtt("attString");
    String condition = new String();
    this.getAtt("defcond");

    Log.out("function embed");
    Log.out("isNewEmbed:" + GlobalEnv.isNewEmbed());

    boolean is_hidden = false;

    if (decos.containsKey("status"))
      if (decos.getStr("status").compareTo("hidden") == 0) is_hidden = true;

    // for tab
    if (decos.containsKey("tab")) {
      htmlEnv.code.append("<div id=\"myTab\" ");

      if (decos.containsKey("class"))
        htmlEnv.code.append("class=\"" + decos.getStr("class") + "\"");

      htmlEnv.code.append(">\n");
      htmlEnv.code.append("<div id=\"mTab\" class=\"yui-navset\">\n");

      htmlEnv.code.append("</div></div>\n");

      htmlEnv.script.append("var mTab = new YAHOO.widget.TabView(\"mTab\");");
      htmlEnv.script.append("new YAHOO.util.DDTarget(\"myTab\", \"myTab\");");

      return;
    }

    if (!is_hidden) {
      htmlEnv.code.append("<table class=\"att " + htmlEnv.getOutlineModeAtt() + " ");

      if (decos.containsKey("class")) htmlEnv.code.append(decos.getStr("class"));
      else htmlEnv.code.append(HTMLEnv.getClassID(this));

      htmlEnv.code.append("\"");
      htmlEnv.code.append("><tr><td>");
    }

    // for ajax div id
    // //////////////////////////////////////////////////////

    String divname = new String();
    boolean has_divid = false;

    if (decos.containsKey("divid")) {
      has_divid = true;
      Log.out("embed contains decos with divid");
      String tmpdivid = decos.getStr("divid");
      String tmp;
      String ans;

      if (tmpdivid.contains("+")) {
        ans = tmpdivid.substring(0, tmpdivid.indexOf("+"));
        tmp = tmpdivid.substring(tmpdivid.indexOf("+") + 1, tmpdivid.length());

        if (tmp.compareTo("att") == 0) {
          tmp = att;
        }
        divname = ans + "_" + tmp;
        Log.out("ans :" + ans + " tmp:" + tmp + " divname:" + divname);
      } else {
        divname = decos.getStr("divid");
      }
    } /*
       * else { //online file if(file.contains("/")) { divname =
       * file.substring(file.lastIndexOf("/")+1,file.indexOf(".sql")); }
       * //ofline file else if(file.contains("\\")) {
       * Log.out(" // index"+file.indexOf(".sql")); divname =
       * file.substring(file.lastIndexOf("\\")+1,file.indexOf(".sql")); }
       * //only file name else { divname =
       * file.substring(0,file.indexOf(".sql")); }
       *
       * }
       */
    if (GlobalEnv.isAjax() && decos.containsKey("droppable")) {
      htmlEnv.script.append("new YAHOO.util.DDTarget(\"" + divname + "\", \"" + divname + "\");");
    }
    // ajax & decos contains status=hidden
    if (is_hidden && GlobalEnv.isAjax()) {

      htmlEnv.code.append("<div id=\"" + divname + "\" ");

      if (decos.containsKey("class"))
        htmlEnv.code.append("class=\"" + decos.getStr("class") + "\" ");

      htmlEnv.code.append("></div>");
      Log.out("<div id=" + divname + "></div>");

      return;
    }
    // end ajax divname ////////////////////////////////////////////////

    /*
     * if(border.compareTo("1") == 0) {} else html_env.css.append(
     * ".embed { vertical-align : text-top; padding : 0px ; margin : 0px; border: 0px,0px,0px,0px; width: 100%;}"
     * );
     */
    if (att.compareTo("") != 0) {
      condition = condition + where + att;
    } else if (att2.compareTo("") != 0) {
      condition = condition + where + "'" + att2 + "'";
    }
    // store original config
    Hashtable tmphash = GlobalEnv.getEnv();

    // set new config for embed
    // String[] args = {"-f",file,"-cond",condition,"-debug"};
    // Log.out("cond:"+condition);
    String[] args;
    if (GlobalEnv.isAjax()) {
      if (condition.equals("")) {
        args = new String[3];
        args[0] = "-f";
        args[1] = file;
        args[2] = "-ajax";
        // args[3] = "-debug";

      } else {
        args = new String[5];
        args[0] = "-f";
        args[1] = file;
        args[2] = "-cond";
        args[3] = condition;
        args[4] = "-ajax";
        // args[5] = "-debug";
      }
    } else {
      if (GlobalEnv.isOpt()) {
        args = new String[5];
        args[0] = "-f";
        args[1] = file;
        args[2] = "-cond";
        args[3] = condition;
        args[4] = "-optimizer";
        // args[5] = "-debug";
      } else {
        args = new String[4];
        args[0] = "-f";
        args[1] = file;
        args[2] = "-cond";
        args[3] = condition;
        // args[4] = "-debug";
      }
    }

    htmlEnv.embedCount++;

    if (file.contains(".sql") || file.contains(".ssql")) {

      String makedfilename = file.substring(file.lastIndexOf("\\") + 1, file.indexOf("."));

      if (att.compareTo("") != 0) makedfilename = makedfilename.concat("_" + att);
      if (att2.compareTo("") != 0) makedfilename = makedfilename.concat("_" + att2);

      makedfilename = makedfilename.concat(".html");

      Log.out("embed tmpfilename:" + makedfilename + " option:" + GlobalEnv.getEmbedOption());

      File makedfile = new File(GlobalEnv.getEmbedTmp(), makedfilename);

      if (makedfile.exists() && GlobalEnv.isNewEmbed() == 1) {
        Log.out("[Enter new Embed]");
        Log.out("embed read tmp file");
        BufferedReader dis;
        String line = new String();
        try {
          dis = new BufferedReader(new FileReader(makedfile));

          try {
            while (!line.equalsIgnoreCase(" ")) {
              Log.out("line : " + line);
              line = dis.readLine();
              if (line != null) htmlEnv.code.append(line);
            }
          } catch (NullPointerException e) {
            Log.out("no more lines");
          }

          dis.close();
        } catch (IOException ioe) {
          System.out.println("IOException: " + ioe);
        }
      } else {
        Log.out("embed make file");

        GlobalEnv.setGlobalEnvEmbed(args);

        SSQLparser parser;
        if (file.contains("http")) {
          parser = new SSQLparser("online");
        } else {
          parser = new SSQLparser(10000 * (htmlEnv.embedCount + 1));
        }

        CodeGenerator codegenerator = parser.getcodegenerator();
        DataConstructor dc = new DataConstructor(parser);

        StringBuffer returnedcode = codegenerator.generateCode2(parser, dc.getData());

        // ajax add div
        // tag////////////////////////////////////////////////////////////////////
        if (GlobalEnv.isAjax()) {
          // TODO 20140619_masato
          if (!has_divid) {
            int x = 0;
            if (file.indexOf(".sql") > 0) {
              x = file.indexOf(".sql");
            } else if (file.indexOf(".ssql") > 0) {
              x = file.indexOf(".ssql");
            }
            // online file
            if (file.contains("/")) {
              divname = file.substring(file.lastIndexOf("/") + 1, x);
            }
            // ofline file
            else if (file.contains("\\")) {
              divname = file.substring(file.lastIndexOf("\\") + 1, x);
            }
            // only file name
            else {
              divname = file.substring(0, x);
            }
          }

          htmlEnv.code.append("<div id=\"" + divname + "\" ");

          if (decos.containsKey("class"))
            htmlEnv.code.append("class=\"" + decos.getStr("class") + "\" ");

          htmlEnv.code.append(">");
          // html_env.code.append("<br><a href=\"close.html\" class=\"bottom_close_"+divname+"\"
          // onClick=\"return closeDiv('"+divname+"')\">close</a><br>");
          Log.out("<div id=" + divname + ">");
        }

        // xml�����
        if (!is_hidden) {
          htmlEnv2.code.append("<EMBED>");
          htmlEnv.code.append(returnedcode);
          htmlEnv2.code.append(returnedcode);
          htmlEnv2.code.append("</EMBED>");
        }

        if (GlobalEnv.isAjax()) htmlEnv.code.append("</div>");
        // end ajax
        // /////////////////////////////////////////////////////////////////

        if (htmlEnv.embedCount >= 1) {
          htmlEnv.css.append(codegenerator.generateCode3(parser, dc.getData()));
          htmlEnv.cssFile.append(codegenerator.generateCssfile(parser, dc.getData()));
        }

        // restore original config
        GlobalEnv.setEnv(tmphash);

        // writing tmpfile
        Log.out("embed hogehoge:" + GlobalEnv.isNewEmbed());
        Log.out("enb:" + GlobalEnv.getEnv());

        if (GlobalEnv.isNewEmbed() == 1) {
          GlobalEnv.addEmbedFile(makedfilename);
          Log.out("embed start writing");
          String filename = GlobalEnv.getEmbedTmp();

          if (filename.endsWith("/") || filename.endsWith("\\"))
            filename = filename + makedfilename;
          else filename = filename + "/" + makedfilename;

          try {
            OutputStream fout = new FileOutputStream(filename);
            OutputStream bout = new BufferedOutputStream(fout);
            OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");

            out.write(htmlEnv.header.toString());
            out.write(returnedcode.toString());
            out.write(htmlEnv.footer.toString());

            out.close();
            /*
             * PrintWriter pw = new PrintWriter(new
             * BufferedWriter(new FileWriter( filename)));
             * Log.out("filename:"+filename);
             * pw.println(html_env.header);
             * pw.println(returnedcode);
             * pw.println(html_env.footer); pw.close();
             */
          } catch (FileNotFoundException fe) {

            fe.printStackTrace();
            System.err.println(
                "Error: specified embedtmp outdirectory \""
                    + GlobalEnv.getEmbedTmp()
                    + "\" is not found to write "
                    + htmlEnv.fileName);

            GlobalEnv.addErr(
                "Error: specified embedtmp outdirectory \""
                    + GlobalEnv.getEmbedTmp()
                    + "\" is not found to write "
                    + htmlEnv.fileName);
            // comment out by chie
            // System.exit(-1);
          } catch (IOException e) {
            System.err.println("Error[HTMLManager]: File IO Error in HTMLManager at embed");
            e.printStackTrace();
            GlobalEnv.addErr("Error[HTMLManager]: File IO Error in HTMLManager at embed");
            // comment out by chie
            // System.exit(-1);
          }
        }
      }
    }
    // embed html file
    else if (file.contains(".html")) {
      String line = new String();

      if (decos.containsKey("divid")) divname = decos.getStr("divid");
      else if (file.contains("\\"))
        divname = file.substring(file.lastIndexOf("\\") + 1, file.indexOf(".html"));
      else if (file.contains("/"))
        divname = file.substring(file.lastIndexOf("/") + 1, file.indexOf(".html"));
      else divname = file.substring(0, file.indexOf(".html"));

      BufferedReader dis;
      try {
        if (file.contains("http://")) {
          URL fileurl = new URL(file);

          URLConnection fileurlConnection = fileurl.openConnection();
          dis = new BufferedReader(new InputStreamReader(fileurlConnection.getInputStream()));
        } else {
          try {
            Log.out("embed file (html):" + file);
            dis = new BufferedReader(new FileReader(new File(file)));
          } catch (IOException ioe) {
            String path = htmlEnv.outFile;
            if (path.contains("\\")) path = path.substring(0, path.lastIndexOf("\\") + 1);
            else if (path.contains("/")) path = path.substring(0, path.lastIndexOf("/") + 1);
            if (file.startsWith("./")) {
              file = file.substring(1, file.length());
            }
            Log.out("embed file (html):" + path + file);
            if (path.startsWith("http:")) {
              URL fileurl = new URL(path + file);
              URLConnection fileurlConnection = fileurl.openConnection();
              dis = new BufferedReader(new InputStreamReader(fileurlConnection.getInputStream()));
            } else {
              dis = new BufferedReader(new FileReader(new File(path + file)));
            }
          }
        }
        /*
         * DataInputStream dis = new
         * DataInputStream(fileurlConnection.getInputStream());
         */
        line = dis.readLine(); // read <BODY> and/or <HEAD>
        if (line.contains("<head>")) {
        } else {
          line = dis.readLine(); // read <HEAD>
        }

        while (!line.equalsIgnoreCase("</head>")) {
          line = dis.readLine();
          if (!line.equalsIgnoreCase("</head>")) htmlEnv.header.append(line + "\n");
        }
        line = dis.readLine(); // read <body>

        htmlEnv.code.append("<div id=\"" + divname + "\" ");

        if (decos.containsKey("class"))
          htmlEnv.code.append("class=\"" + decos.getStr("class") + "\" ");

        htmlEnv.code.append(">");

        htmlEnv2.code.append("<EMBED>");
        while (!line.equalsIgnoreCase("</body>")) {
          Log.out("line : " + line);
          line = dis.readLine();
          if (!line.equalsIgnoreCase("</body>")) {
            htmlEnv.code.append(line);
            if (line.contains("&")) line = line.replace("&", "&amp;");
            if (line.contains("<")) ;
            line = line.replace("<", "&lt;");
            if (line.contains(">")) line = line.replace(">", "&gt;");
            if (line.contains("���")) line = line.replace("���", "&#65374;");
            htmlEnv2.code.append(line);
          }
        }
        htmlEnv2.code.append("</EMBED>");
        // html_env.code.append("<br><a href=\"close.html\" class=\"bottom_close_"+divname+"\"
        // onClick=\"return closeDiv('"+divname+"')\">close</a><br>");

        htmlEnv.code.append("</div>");
        dis.close();

      } catch (MalformedURLException me) {
        System.out.println("MalformedURLException: " + me);
      } catch (IOException ioe) {
        System.out.println("HTMLFuncEmbed:IOException: " + ioe);
      }
    }
    if (!is_hidden) htmlEnv.code.append("</td></tr></table>");

    htmlEnv.embedCount += 1;
  }
Exemple #7
0
  private String createForm() {
    String path = new String();
    String form = new String();
    if (this.getAtt("path") != null && !this.getAtt("path").isEmpty()) {
      path = this.getAtt("path").replaceAll("\"", "");
    } else {
      path = ".";
    }

    form += "<form method=\"POST\" action=\"" + path + "/servlet/supersql.form.FormServlet\"" + ">";

    form += "<input type=\"hidden\" name=\"configfile\" value=\"" + path + "/config.ssql\" />";

    if (this.getAtt("link") != null && !this.getAtt("link").isEmpty()) {
      form +=
          "<input type=\"hidden\" name=\"sqlfile\" value=\""
              + path
              + "/"
              + this.getAtt("link").replaceAll("\"", "")
              + "\" />";
    } else if (this.getAtt("linkfile") != null && !this.getAtt("linkfile").isEmpty()) {
      form +=
          "<input type=\"hidden\" name=\"sqlfile\" value=\""
              + path
              + "/"
              + this.getAtt("linkfile").replaceAll("\"", "")
              + "\" />";
    }
    /*
     * if(!this.getAtt("default").equals(null)){ form +=
     * "<input type=\"hidden\" name=\"value1\" value=\""
     * +this.getAtt("default").replaceAll("\"", "")+"\" />"; }
     */

    if (this.getAtt("cond") != null && !this.getAtt("cond").isEmpty()) {
      if (!this.getAtt("cond").replaceAll("\"", "").isEmpty())
        form +=
            "<input type=\"hidden\" name=\"cond1\" value=\""
                + this.getAtt("cond").replaceAll("\"", "")
                + "\" />";
    }

    String att = new String();
    Integer attNo = 1;
    while (!this.getAtt("att" + attNo).equals("")) {
      if (attNo > 1) att += ",";
      att += this.getAtt("att" + attNo);
      attNo++;
      Log.out("att:" + att + " attNo:" + attNo);
    }

    if (attNo == 1 && !this.getAtt("att").equals("")) {
      att += this.getAtt("att");
      Log.out("att:" + att + " attNo:" + attNo);
    }

    if (this.getAtt("update") != null && !this.getAtt("update").isEmpty()) {
      form +=
          "<input type=\"hidden\" name=\"updatefile\" value=\""
              + path
              + "/"
              + this.getAtt("update").replaceAll("\"", "")
              + "("
              + att
              + ")\" />";
    } else if (this.getAtt("updatefile") != null && !this.getAtt("updatefile").isEmpty()) {
      form +=
          "<input type=\"hidden\" name=\"updatefile\" value=\""
              + path
              + "/"
              + this.getAtt("updatefile").replaceAll("\"", "")
              + "("
              + att
              + ")\" />";
    }

    Log.out(form);
    return form;
  }
Exemple #8
0
  // Function��work�᥽�å�
  @Override
  public String work(ExtList data_info) {
    this.setDataList(data_info);
    // Log.out("FuncName= " + this.getFuncName());
    // Log.out("filename= " + this.getAtt("filename"));
    // Log.out("condition= " + this.getAtt("condition"));

    String FuncName = this.getFuncName();

    if (FuncName.equalsIgnoreCase("imagefile") || FuncName.equalsIgnoreCase("image")) {
      Func_imagefile();
    } else if (FuncName.equalsIgnoreCase("invoke")) {
      Func_invoke();
    } else if (FuncName.equalsIgnoreCase("foreach")) {
      try {
        Func_foreach(data_info);
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }
    } else if (FuncName.equalsIgnoreCase("sinvoke") || FuncName.equalsIgnoreCase("link")) {
      Func_sinvoke(data_info);
    } else if (FuncName.equalsIgnoreCase("null")) {
      Func_null();
    }
    // // for practice
    // else if(FuncName.equalsIgnoreCase("button")){
    // Func_button();
    // }
    // chie
    else if (FuncName.equalsIgnoreCase("submit")) {
      Func_submit();
    } else if (FuncName.equalsIgnoreCase("select")) {
      Func_select();
    } else if (FuncName.equalsIgnoreCase("checkbox")) {
      Func_checkbox();
    } else if (FuncName.equalsIgnoreCase("radio")) {
      Func_radio();
    } else if (FuncName.equalsIgnoreCase("inputtext")) {
      Func_inputtext();
    } else if (FuncName.equalsIgnoreCase("textarea")) {
      Func_textarea();
    } else if (FuncName.equalsIgnoreCase("hidden")) {
      Func_hidden();
    } else if (FuncName.equalsIgnoreCase("session")) {
      // Func_session(); not use
    }
    // tk start//////////////////////////////////
    else if (FuncName.equalsIgnoreCase("embed")) {
      Log.out("[enter embed]");
      Func_embed(data_info);
    }
    // tk end////////////////////////////////////
    else if (FuncName.equalsIgnoreCase("anchor") || FuncName.equalsIgnoreCase("a")) {
      Func_url(false, "");
    } else if (FuncName.equalsIgnoreCase("image_anchor")
        || FuncName.equalsIgnoreCase("img_anchor")
        || FuncName.equalsIgnoreCase("img_a")
        || FuncName.equalsIgnoreCase("image_a")) {
      Func_url(false, "image");
    }

    Log.out("TFEId = " + HTMLEnv.getClassID(this));
    htmlEnv.append_css_def_td(HTMLEnv.getClassID(this), this.decos);
    return null;
  }
Exemple #9
0
  protected void Func_imagefile() {

    /*
     * ImageFile function : <td> <img src="${imgpath}/"+att /> </td>
     */

    String path = this.getAtt("path", ".");
    if (!path.startsWith("/")) {
      String basedir = GlobalEnv.getBaseDir();
      if (basedir != null && basedir != "") {
        path = GlobalEnv.getBaseDir() + "/" + path;
      }
    }
    if (GlobalEnv.isServlet()) {
      path = GlobalEnv.getFileDirectory() + path;
    }

    // System.out.println(GlobalEnv.isServlet());

    // tk to make hyper link to
    // image//////////////////////////////////////////////////////////////////////////////////
    if (htmlEnv.linkFlag > 0 || htmlEnv.sinvokeFlag) {
      // added by goto 20121222 start
      // �ʲ��ϡ�-f�Υե�����̾���꤬���Хѥ��ˤʤäƤ�����ν���(?)
      // [%Ϣ���] href�λ�������Хѥ���������Хѥ������פ��ѹ�
      // 20120622�ν������ȡ���-f �ե�ѥ��ե�����̾�פ��Ѥ��Ƥ����硢���Хѥ������ˤʤ�ʤ�
      String fileDir = new File(htmlEnv.linkUrl).getAbsoluteFile().getParent();

      if (fileDir.length() < htmlEnv.linkUrl.length()
          && fileDir.equals(htmlEnv.linkUrl.substring(0, fileDir.length()))) {
        String relative_path = htmlEnv.linkUrl.substring(fileDir.length() + 1);
        htmlEnv.code.append("<A href=\"" + relative_path + "\" ");
      } else htmlEnv.code.append("<A href=\"" + htmlEnv.linkUrl + "\" ");

      // html_env.code.append("<A href=\"" + html_env.linkurl + "\" ");
      // added by goto 20121222 end

      if (decos.containsKey("target"))
        htmlEnv.code.append(" target=\"" + decos.getStr("target") + "\" ");
      if (decos.containsKey("class"))
        htmlEnv.code.append(" class=\"" + decos.getStr("class") + "\" ");
      htmlEnv.code.append(">\n");

      Log.out("<A href=\"" + htmlEnv.linkUrl + "\">");
    }
    // tk/////////////////////////////////////////////////////////////////////////////////

    if (decos.containsKey("lightbox")) {
      Date d1 = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyymmddHHmmss");
      String today = sdf.format(d1);

      htmlEnv.code.append(
          "<a href=\""
              + path
              + "/"
              + this.Args.get(0).getStr()
              + "\" rel=\"lightbox[lb"
              + today
              + "]\">");

      if (decos.getStr("lightbox").compareTo("root") == 0
          || decos.getStr("lightbox").compareTo("thumb") == 0) {
        htmlEnv.code.append("<img class=\"" + HTMLEnv.getClassID(this) + " ");

        if (decos.containsKey("class")) htmlEnv.code.append(decos.getStr("class"));

        htmlEnv.code.append(
            " \" src=\""
                + path
                + "/"
                + this.Args.get(0).getStr()
                + "\" onLoad=\"initLightbox()\"/>");
      }
      htmlEnv.code.append("</a>");
    } else {
      htmlEnv.code.append("<img class=\"" + HTMLEnv.getClassID(this) + " ");
      htmlEnv2.code.append("<VALUE type=\"img\" class=\"" + HTMLEnv.getClassID(this) + " ");
      if (decos.containsKey("class")) htmlEnv.code.append(decos.getStr("class"));

      htmlEnv.code.append(" \" src=\"" + path + "/" + this.Args.get(0).getStr() + "\"/>");
      htmlEnv2.code.append(" \" src=\"" + path + "/" + this.Args.get(0).getStr() + "\" ");
      if (decos.containsKey("width")) {
        htmlEnv2.code.append("width=\"" + decos.getStr("width").replace("\"", "") + "\" ");
      }
      if (decos.containsKey("height")) {
        htmlEnv2.code.append("height=\"" + decos.getStr("height").replace("\"", "") + "\" ");
      }
      htmlEnv2.code.append(" ></VALUE>");
    }
    // tk to make hyper link to
    // image///////////////////////////////////////////////////////////////////////////////////
    if (htmlEnv.linkFlag > 0 || htmlEnv.sinvokeFlag) {
      htmlEnv.code.append("</a>");
    }
    // tk///////////////////////////////////////////////////////////////////////////////////
    return;
  }
Exemple #10
0
  @Override
  public String work(ExtList data_info) {

    int width = 0;
    int height = 0;
    int tmp_height = 0;
    int tmp_width = 0;

    swf_env.level++;

    System.out.println("------- C4 -------");
    System.out.println("[SWFC4:work]tfe_info = " + makele0());
    System.out.println("[SWFC4:work]data_info = " + data_info);

    value = new SWFValue("C4");

    this.setDataList(data_info);

    int i = 0;
    int dx = 0;
    int dy = 0;

    while (this.hasMoreItems()) {
      ITFE tfe = (ITFE) tfes.get(i);

      // int tmp = 0;
      def_x = swf_env.def_x;
      def_y = swf_env.def_y;

      this.worknextItem();

      SWFValue myvalue = ((SWFTFE) tfe).getInstance();

      System.out.println("[SWFC4:work]++++ C4��Att��set���ޤ�");
      value.inList.add(myvalue);

      tmp_height = swf_env.tmp_height;
      tmp_width = swf_env.tmp_width;
      if (tmp_width > width) {
        width = tmp_width;
      }
      if (tmp_height > height) {
        height = tmp_height;
      }

      i++;
    } // while

    value.width = width;
    value.height = height;

    swf_env.tmp_width = width;
    swf_env.tmp_height = height;

    swf_env.level--;

    if (swf_env.level == 0) swf_env.final_value = value;

    Log.out("value.inList.size()= " + value.inList.size());
    Log.out("C4: value.width = " + value.width);
    Log.out("C4: value.height = " + value.height);
    return null;
  }