예제 #1
0
    private void Wizards()
    {
        if (useAJAX)
        {
            string       txt                  = "";
            Smarty.Table tableInfo            = null;
            Smarty.Field fieldInfo            = null;
            List <Smarty.LookupField> lookups = null;

            if (inlineedit)
            {
                linkdata = linkdata.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");

                smarty.Add("linkdata", linkdata);
            }
            else
            {
                linkdata = "<script type=\"text/javascript\">\r\n" +
                           "$(document).ready(function(){ \r\n" +
                           linkdata +
                           "});</script>";
            }
        }
        else
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string field       = (string)Request["searchField"];
        string value       = (string)Request["searchFor"];
        string lookupValue = (string)Request["lookupValue"];

        Builder builder = Factory.CreateBuilder();

        Smarty.Table tableInfo = builder.Tables[strTableName];
        Smarty.Field fieldInfo = tableInfo.Fields[field] as Field;

        CheckSecurity();

        if (fieldInfo.LookupFields.Count == 0)
        {
            func.PopulateLookupFields(fieldInfo);
        }

        for (int i = 0; i < fieldInfo.LookupFields.Count && i < 40; ++i)
        {
            if (fieldInfo.LookupFields[i].Display.StartsWith(value, StringComparison.CurrentCultureIgnoreCase))
            {
                output.Append(fieldInfo.LookupFields[i].Link + "\n" + fieldInfo.LookupFields[i].Display + "\n");
            }
        }


        this.Response.Write(output.ToString());
        this.Response.End();
    }
    protected void BuildBody()
    {
        string linkdata = "";

        linkdata += "<script type=\"text/javascript\">\r\n";
        object value = null;

        if (Asearchfor.ContainsKey(""))
        {
            value = Asearchfor[""];
        }
        object fvalue = null;

        if (Asearchfor.ContainsKey("NIP"))
        {
            fvalue = Asearchfor["NIP"];
        }

        if (useAJAX)
        {
            Smarty.Table tableInfo            = null;
            Smarty.Field fieldInfo            = null;
            List <Smarty.LookupField> lookups = null;
            string txt = "";
        }
        else
        {
        }
        linkdata += "</script>\r\n";


        IDictionary <string, object> body = new Dictionary <string, object>();

        body["begin"] = GetIncludes();
        body["end"]   = linkdata + "<script>ShowHideControls()</script>";
        smarty.Add("body", body);

        IDictionary <string, object> contents_block = new Dictionary <string, object>();

        contents_block["begin"]  = "<form method=\"POST\"";
        contents_block["begin"] += "action=\"JENISKEGIATAN_list.aspx\"";
        contents_block["begin"] += "name=\"editform\"><input type=\"hidden\" id=\"a\" name=\"a\" value=\"advsearch\">";
        contents_block["end"]    = "</form>";
        smarty.Add("contents_block", contents_block);

        smarty.Add("searchbutton_attrs", "name=\"SearchButton\" onclick=\"javascript:document.forms.editform.submit();\"");
        smarty.Add("resetbutton_attrs", "onclick=\"return ResetControls();\"");
        smarty.Add("backbutton_attrs", "onclick=\"javascript: document.forms.editform.a.value='return'; document.forms.editform.submit();\"");
        smarty.Add("conditions_block", true);
        smarty.Add("search_button", true);
        smarty.Add("reset_button", true);
        smarty.Add("back_button", true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string field = (string)Request["field"];
        string value = (string)Request["value"];

        Builder builder = Factory.CreateBuilder();

        Smarty.Table tableInfo = builder.Tables[strTableName];
        Smarty.Field fieldInfo = tableInfo.Fields[field] as Field;


        List <LookupField> dependentFields = func.LoadSelectContent(fieldInfo, value, "");

        for (int i = 0; i < dependentFields.Count && i < 40; ++i)
        {
            output.Append(dependentFields[i].Link + "\n" + dependentFields[i].Display + "\n");
        }
        this.Response.Write(output.ToString());
        this.Response.End();
    }
    private void Wizards()
    {
        record_id = Request["recordID"];
        object value = null;

        if (defvalues.ContainsKey(""))
        {
            value = defvalues[""];
        }
        object fvalue = null;

        if (defvalues.ContainsKey("NIP"))
        {
            fvalue = defvalues["NIP"];
        }
        if (useAJAX)
        {
            if (inlineedit == ADD_MODE.ADD_ONTHEFLY)
            {
                record_id = Request["id"];
            }
            Smarty.Table tableInfo            = null;
            Smarty.Field fieldInfo            = null;
            string       txt                  = "";
            List <Smarty.LookupField> lookups = null;

            if (inlineedit == ADD_MODE.ADD_INLINE)
            {
                linkdata = linkdata.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
            }
            else
            {
                linkdata += "SetToFirstControl('" + formname + "');";
                if (inlineedit == ADD_MODE.ADD_SIMPLE)
                {
                    linkdata = "<script type=\"text/javascript\">\r\n" +
                               "$(document).ready(function(){ \r\n" +
                               linkdata +
                               "});</script>";
                }
                else
                {
                    linkdata = GetIncludes() + "\r\n" + linkdata;
                    string includes = "var s;";
                    foreach (string file in arr_includes)
                    {
                        includes += "s = document.createElement('script');s.src = '" + file + @"';\r\n" +
                                    "document.getElementsByTagName('HEAD')[0].appendChild(s);\r\n";
                    }
                    linkdata = includes + "\r\n" + linkdata;

                    if (RequestAction != "added")
                    {
                        linkdata = linkdata.Replace("\\", "\\\\").Replace("\r", "\\r").Replace("\n", "\\n");
                        Response.Write(linkdata);
                        Response.Write("\n");
                    }
                    else if (RequestAction == "added" && (error_happened || status == "DECLINED"))
                    {
                        Response.Write("<textarea id=\"data\">decli");
                        Response.Write(Control.HTMLEncodeSpecialChars(linkdata));
                        Response.Write("</textarea>");
                    }
                }
            }
        }
        else
        {
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        field = (string)Request["field"];
        id    = (string)Request["id"];

        if (!CheckSecurity())
        {
            return;
        }

        if (!string.IsNullOrEmpty(categoryField))
        {
            categoryvalue = (string)Request["category"];
        }

        Builder builder = Factory.CreateBuilder();

        Smarty.Table tableInfo = builder.Tables[strTableName];
        Smarty.Field fieldInfo = tableInfo.Fields[field] as Field;

        smarty.Add("add_new_item", true);

        fastType = fieldInfo.FastType;
        useAjax  = true;

        if (!CheckAddNewItemAllowed(field))
        {
            return;
        }

        if (Request["newitem"] != null)
        {
            obj = Control.GoodFieldName(field);
        }

        mode = Control.FromString((string)Request["mode"]);

        if (fastType && useAjax)
        {
            smarty.Add("fastTypeNAjax", true);
            if (mode == MODE.MODE_INLINE_EDIT || mode == MODE.MODE_INLINE_ADD)
            {
                element     = "window.opener.document.getElementById('" + id + "')";
                dispelement = "window.opener.document.getElementById('display_" + id + "')";
            }
            else
            {
                element     = "window.opener.document.forms.editform.value_" + obj;
                dispelement = "window.opener.document.forms.editform.display_value_" + obj;
            }
            smarty.Add("dispelement", dispelement);
            smarty.Add("element", element);
            smarty.Add("data1", data1);
            smarty.Add("data2", data2);
        }
        else
        {
            smarty.Add("notfastTypeNAjax", true);
            if (mode == MODE.MODE_INLINE_EDIT || mode == MODE.MODE_INLINE_ADD)
            {
                element = "window.opener.document.getElementById('" + id + "')";
            }
            else
            {
                element = "window.opener.document.forms.editform.value_" + obj;
            }

            if (!string.IsNullOrEmpty(categoryField) && !useAjax)
            {
                smarty.Add("notAjaxcategoryField", true);
            }

            smarty.Add("dispelement", dispelement);
            smarty.Add("element", element);
            smarty.Add("data1", data1);
            smarty.Add("data2", data2);
            smarty.Add("data0", data0);
            smarty.Add("obj", obj);
            smarty.Add("category", category);
        }

        smarty.Add("save_msg", saveMsg);
        smarty.Add("close_window_msg", closeWindowMsg);

        this.Response.Write(func.BuildOutput(this, @"~\KELENGKAPAN_addnewitem.aspx", smarty));
        this.Response.End();
    }