Exemplo n.º 1
0
        // Function from file: html_interface.dm
        public void _renderLayout(dynamic hclient = null, int?ignore_loaded = null)
        {
            ignore_loaded = ignore_loaded ?? GlobalVars.FALSE;

            string  html = null;
            dynamic id   = null;


            if (Lang13.Bool(hclient) && (Lang13.Bool(ignore_loaded) || Lang13.Bool(hclient.is_loaded)))
            {
                html = this.layout;

                if (html != hclient.layout)
                {
                    hclient.layout = html;
                    Interface13.Output(hclient.client, String13.MakeUrlParams(new ByTable(new object [] { html })), new Txt("browser_").Ref(this).str(".browser:updateLayout").ToString());

                    foreach (dynamic _a in Lang13.Enumerate(this.content_elements))
                    {
                        id = _a;

                        this._renderContent(id, hclient, null, ignore_loaded);
                    }
                }
            }
            return;
        }
Exemplo n.º 2
0
        // Function from file: html_interface.dm
        public void executeJavaScript(dynamic jscript = null, dynamic hclient = null)
        {
            dynamic client = null;


            if (Lang13.Bool(hclient))
            {
                hclient = this.getClient(hclient);

                if (hclient is HtmlInterfaceClient)
                {
                    if (Lang13.Bool(hclient.is_loaded))
                    {
                        Interface13.Output(hclient.client, String13.MakeUrlParams(new ByTable(new object [] { jscript })), new Txt("browser_").Ref(this).str(".browser:eval").ToString());
                    }
                }
            }
            else
            {
                foreach (dynamic _a in Lang13.Enumerate(this.clients))
                {
                    client = _a;


                    if (Lang13.Bool(this.clients[client]))
                    {
                        this.executeJavaScript(jscript, this.clients[client]);
                    }
                }
            }
            return;
        }
Exemplo n.º 3
0
        // Function from file: html_interface.dm
        public void show(dynamic hclient = null)
        {
            hclient = this.getClient(hclient, GlobalVars.TRUE);

            if (hclient is HtmlInterfaceClient)
            {
                if (GlobalVars.asset_list.Contains(this.type) && GlobalVars.asset_list[this.type] is ByTable)
                {
                    GlobalFuncs.send_asset_list(hclient.client, GlobalVars.asset_list[this.type], GlobalVars.TRUE);
                }

                if (!Interface13.WindowExists(hclient.client, new Txt("browser_").Ref(this).ToString()))
                {
                    this.createWindow(hclient);
                }
                hclient.is_loaded = GlobalVars.FALSE;
                Interface13.Output(hclient.client, GlobalFuncs.replacetextEx(GlobalFuncs.replacetextEx(File13.Read("html_interface.html"), "[hsrc]", new Txt().Ref(this).ToString()), "</head>", "" + this.head + "</head>"), new Txt("browser_").Ref(this).str(".browser").ToString());
                Interface13.WindowShow(hclient.client, new Txt("browser_").Ref(this).ToString(), GlobalVars.TRUE);

                while (Lang13.Bool(hclient.client) && Lang13.Bool(hclient.active) && !Lang13.Bool(hclient.is_loaded))
                {
                    Task13.Sleep(2);
                }
            }
            return;
        }
Exemplo n.º 4
0
        // Function from file: tgui.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string  action  = null;
            ByTable _params = null;


            if (this.user != Task13.User)
            {
                return(null);
            }
            action  = href_list["action"];
            _params = href_list;
            _params.Remove("action");

            switch ((string)(action))
            {
            case "tgui:initialize":
                Interface13.Output(this.user, String13.UrlEncode(this.get_json(this.initial_data), false), "" + this.window_id + ".browser:initialize");
                this.initialized = GlobalVars.TRUE;
                break;

            case "tgui:view":

                if (Lang13.Bool(_params["screen"]))
                {
                    this.src_object.ui_screen = _params["screen"];
                }
                GlobalVars.SStgui.update_uis(this.src_object);
                break;

            case "tgui:link":
                Interface13.Link(this.user, _params["url"]);
                break;

            case "tgui:fancy":
                this.user.client.prefs.tgui_fancy = GlobalVars.TRUE;
                break;

            case "tgui:nofrills":
                this.user.client.prefs.tgui_fancy = GlobalVars.FALSE;
                break;

            default:
                this.update_status(false);

                if (Lang13.Bool(this.src_object.ui_act(action, _params, this, this.state)))
                {
                    GlobalVars.SStgui.update_uis(this.src_object);
                }
                break;
            }
            return(null);
        }
Exemplo n.º 5
0
        // Function from file: html_interface.dm
        public void _renderTitle(dynamic hclient = null, int?ignore_cache = null, int?ignore_loaded = null)
        {
            ignore_cache  = ignore_cache ?? GlobalVars.FALSE;
            ignore_loaded = ignore_loaded ?? GlobalVars.FALSE;


            if (Lang13.Bool(hclient) && (Lang13.Bool(ignore_loaded) || Lang13.Bool(hclient.is_loaded)))
            {
                if (Lang13.Bool(ignore_cache) || this.title != hclient.title)
                {
                    hclient.title = this.title;
                    this.specificRenderTitle(hclient);
                    Interface13.Output(hclient.client, String13.MakeUrlParams(new ByTable(new object [] { this.title })), new Txt("browser_").Ref(this).str(".browser:setTitle").ToString());
                }
            }
            return;
        }
Exemplo n.º 6
0
        // Function from file: tgui.dm
        public void push_data(ByTable data = null, bool?force = null)
        {
            force = force ?? false;

            this.update_status(false);

            if (!Lang13.Bool(this.initialized))
            {
                return;
            }

            if (this.status <= 0 && !(force == true))
            {
                return;
            }
            Interface13.Output(this.user, String13.UrlEncode(this.get_json(data), false), "" + this.window_id + ".browser:update");
            return;
        }
Exemplo n.º 7
0
        // Function from file: html_interface.dm
        public void _renderContent(dynamic id = null, dynamic hclient = null, int?ignore_cache = null, int?ignore_loaded = null)
        {
            ignore_cache  = ignore_cache ?? GlobalVars.FALSE;
            ignore_loaded = ignore_loaded ?? GlobalVars.FALSE;

            dynamic html = null;


            if (Lang13.Bool(hclient) && (Lang13.Bool(ignore_loaded) || Lang13.Bool(hclient.is_loaded)))
            {
                html = this.content_elements[id];

                if (Lang13.Bool(ignore_cache) || !Lang13.Bool(hclient.content_elements.Contains(id)) || html != hclient.content_elements[id])
                {
                    hclient.content_elements[id] = html;
                    Interface13.Output(hclient.client, String13.MakeUrlParams(new ByTable(new object [] { id, html })), new Txt("browser_").Ref(this).str(".browser:updateContent").ToString());
                }
            }
            return;
        }
Exemplo n.º 8
0
        // Function from file: tooltip.dm
        public bool show(Obj_Screen thing = null, string _params = null, string title = null, string content = null, string theme = null, string special = null)
        {
            theme   = theme ?? "default";
            special = special ?? "none";


            if (!(thing != null) || !Lang13.Bool(_params) || !Lang13.Bool(title) && !Lang13.Bool(content) || !(this.owner != null) || !Lang13.Bool(Lang13.IsNumber(Game13.icon_size)))
            {
                return(false);
            }

            if (!this.init)
            {
                this.init = true;
                Interface13.Output(this.owner, String13.MakeUrlParams(new ByTable(new object [] { Game13.icon_size, this.control })), "" + this.control + ":tooltip.init");
            }
            this.showing = true;

            if (Lang13.Bool(title) && Lang13.Bool(content))
            {
                title   = "<h1>" + title + "</h1>";
                content = "<p>" + content + "</p>";
            }
            else if (Lang13.Bool(title) && !Lang13.Bool(content))
            {
                title = "<p>" + title + "</p>";
            }
            else if (!Lang13.Bool(title) && Lang13.Bool(content))
            {
                content = "<p>" + content + "</p>";
            }
            _params = "{ \"cursor\": \"" + _params + "\", \"screenLoc\": \"" + thing.screen_loc + "\" }";
            Interface13.Output(this.owner, String13.MakeUrlParams(new ByTable(new object [] { _params, this.owner.view, "" + title + content, theme, special })), "" + this.control + ":tooltip.update");
            this.showing = false;

            if (this.queueHide)
            {
                this.hide();
            }
            return(true);
        }
Exemplo n.º 9
0
        // Function from file: html_interface.dm
        public void callJavaScript(string func = null, ByTable arguments = null, dynamic hclient = null)
        {
            dynamic client = null;


            if (!(arguments != null))
            {
                arguments = new ByTable();
            }

            if (Lang13.Bool(hclient))
            {
                hclient = this.getClient(hclient);

                if (hclient is HtmlInterfaceClient)
                {
                    if (Lang13.Bool(hclient.is_loaded))
                    {
                        Interface13.Output(hclient.client, String13.MakeUrlParams(arguments), new Txt("browser_").Ref(this).str(".browser:").item(func).ToString());
                    }
                }
            }
            else
            {
                foreach (dynamic _a in Lang13.Enumerate(this.clients))
                {
                    client = _a;


                    if (Lang13.Bool(this.clients[client]))
                    {
                        this.callJavaScript(func, arguments, this.clients[client]);
                    }
                }
            }
            return;
        }