Exemple #1
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 #2
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 #3
0
  /*    mail()でも使用							        */
  private void Func_url(boolean mailFncFlg, String t) {
    String statement = "";
    FuncArg fa1 = (FuncArg) this.Args.get(0), fa2, fa3;
    String url, name, type;

    try { // 引数2つ or 3つの場合
      fa2 = (FuncArg) this.Args.get(1);
      url = ((mailFncFlg) ? ("mailto:") : ("")) + fa2.getStr();
      name = fa1.getStr();

      try { // 引数3つの場合
        if (!t.isEmpty()) {
          type = t;
        } else {
          fa3 = (FuncArg) this.Args.get(2);
          type = fa3.getStr();
        }
        // type=1 -> 文字
        if (type.equals("1") || type.equals("text") || type.equals("")) {
          statement = getTextAnchor(url, name);
          // statement = "<a href=\""+url+"\""+transition()+prefetch()+target(url)+">"+name+"</a>";

          // type=2 -> urlモバイルボタン
        } else if (type.equals("3") || type.equals("button") || type.equals("bt")) {
          statement =
              "<a href=\""
                  + url
                  + "\" data-role=\"button\""
                  + className()
                  + transition()
                  + prefetch()
                  + target(url)
                  + ">"
                  + name
                  + "</a>";

          // urlボタン(デスクトップ・モバイル共通)
        } else if (type.equals("dbutton") || type.equals("dbt")) {
          statement =
              "<input type=\"button\" value=\""
                  + name
                  + "\" onClick=\"location.href='"
                  + url
                  + "'\""
                  + className();

          // urlボタン width,height指定時の処理
          if (decos.containsKey("width") || decos.containsKey("height")) {
            statement += " style=\"";
            if (decos.containsKey("width"))
              statement += "WIDTH:" + decos.getStr("width").replace("\"", "") + "; ";
            if (decos.containsKey("height"))
              statement += "HEIGHT:" + decos.getStr("height").replace("\"", "") + "; "; // 100; ";
            statement += "\"";
          }
          statement += ">";

          // type=3 -> url画像
        } else if (type.equals("2") || type.equals("image") || type.equals("img")) {
          statement =
              "<a href=\""
                  + url
                  + "\""
                  + className()
                  + transition()
                  + prefetch()
                  + target(url)
                  + "><img src=\""
                  + name
                  + "\"";

          // url画像 width,height指定時の処理
          if (decos.containsKey("width"))
            statement += " width=" + decos.getStr("width").replace("\"", "");
          //            		else{
          //            	        //added by goto 20130312  "Default width: 100%"
          //            			statement += " width=\"100%\"";
          //            		}
          if (decos.containsKey("height"))
            statement += " height=" + decos.getStr("height").replace("\"", ""); // 100; ";
          statement += "></a>";
        }

      } catch (Exception e) { // 引数2つの場合
        statement = getTextAnchor(url, name);
        // statement = "<a href=\""+url+"\""+transition()+prefetch()+target(url)+">"+name+"</a>";
      }

    } catch (Exception e) { // 引数1つの場合
      url = fa1.getStr();
      statement =
          "<a href=\""
              + ((mailFncFlg) ? ("mailto:") : (""))
              + url
              + "\""
              + transition()
              + prefetch()
              + target(url)
              + ">"
              + url
              + "</a>";
    }

    //    	// 各引数毎に処理した結果をHTMLに書きこむ
    htmlEnv.code.append(statement);
    //    	return statement;
  }