Esempio n. 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;
  }
Esempio n. 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;
  }