Ejemplo n.º 1
0
        public structResponse Dashboard()
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "Dashboard";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/dashboard.html", "",
                                             new string[] { "website-title", "page-title", "pageid" });

            scaffold.Data["website-title"] = R.Page.websiteTitle;
            scaffold.Data["page-title"]    = R.Util.Str.GetPageTitle(R.Page.pageTitle);
            scaffold.Data["pageid"]        = R.Page.pageId.ToString();

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
        public async void Can_Import_Config()
        {
            var  model  = Scaffold.ReadFromJsonFile <ImportExportModel>(@"Config.json");
            bool import = await _importExportService.Import(model);

            Assert.True(import);
        }
Ejemplo n.º 3
0
        public Inject Load()
        {
            if (R.isSessionLost() == true) { return lostInject(); }
            Inject response = new Inject();

            //setup response
            response.element = ".winDashboardInterface > .content";

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/interface.html", "",
                new string[] { "website-title", "apps-list", "menu-pages", "menu-photos",
                "menu-analytics", "menu-users", "menu-apps", "menu-settings"});
            scaffold.Data["website-title"] = R.Page.websiteTitle;

            //check security
            //if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == true) { }
            scaffold.Data["menu-pages"] = "true";
            scaffold.Data["menu-photos"] = "true";
            scaffold.Data["menu-analytics"] = "true";
            scaffold.Data["menu-users"] = "true";
            scaffold.Data["menu-apps"] = "true";
            scaffold.Data["menu-settings"] = "true";

            //load list of apps into dashboard menu
            scaffold.Data["apps-list"] = "";

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 4
0
        public WorkflowProcessTests()
        {
            Host.Run(new[] { "install y" }).Wait();
            Scaffold.Tables();

            var _mocker = new ContextMocker();
        }
    private void Awake()
    {
        if (!_moduleIdCounters.ContainsKey(Name))
        {
            _moduleIdCounters[Name] = 1;
        }

        _moduleId = _moduleIdCounters[Name]++;
        _module   = GetComponent <KMBombModule>();

        Scaffold = Instantiate(ScaffoldPrefab, transform);
        var moduleSelectable = GetComponent <KMSelectable>();

        foreach (var btn in Scaffold.Buttons)
        {
            btn.Parent = moduleSelectable;
        }
        moduleSelectable.Children = Scaffold.Buttons;
        moduleSelectable.UpdateChildren();
        for (int i = 0; i < 16; i++)
        {
            Scaffold.Buttons[i].OnInteract = MakeButtonHandler(i);
        }
        Scaffold.SetAllButtonsBlack();
        Scaffold.FixLightSizes(_module.transform.lossyScale.x);
    }
        public void Can_Get_Pending_Workflow_Tasks()
        {
            List <WorkflowTaskViewModel> result = _service.GetPendingTasks(new List <int>
            {
                (int)TaskStatus.PendingApproval
            }, 10, 1);

            Assert.NotNull(result);
            Assert.Empty(result);

            var i = 0;

            while (i < 5)
            {
                IContent node = Scaffold.Node(_contentService);

                Guid guid = Guid.NewGuid();
                _instancesService.InsertInstance(Scaffold.Instance(guid, 1, node.Id));

                _service.InsertTask(Scaffold.Task(guid));
                i += 1;
            }

            List <WorkflowTaskViewModel> result2 = _service.GetPendingTasks(new List <int>
            {
                (int)TaskStatus.PendingApproval
            }, 10, 1);

            Assert.NotNull(result2);
            Assert.Equal(i, result2.Count);
        }
Ejemplo n.º 7
0
        public override Services.Inject LoadSubPage(string path)
        {
            var inject = new Services.Inject();
            if(path != "")
            {
                //load sub page
                switch (path)
                {
                    case "settings":

                        break;
                }
            }else
            {
                //load pages list
                var servePage = new Services.Dashboard.Pages(S);
                var textCreateTitle = (Element.Textbox)page.Elements.Load(ElementType.Textbox);
                var textCreateSummary = (Element.Textbox)page.Elements.Load(ElementType.Textbox);
                var websiteId = page.websiteId;
                if (S.Request.Query.ContainsKey("websiteid")) { websiteId = int.Parse(S.Request.Query["websiteid"]); }
                servePage.page = page;
                scaffold = new Scaffold(S, "/App/Dashboard/Pages/pages.html");
                scaffold.Data["page-list"] = servePage.View(websiteId, 0, 1, 1000, 4, 0, "");
                scaffold.Data["field-create-title"] = textCreateTitle.Render("txtcreatetitle","","", "New Page Title");
                scaffold.Data["field-create-summary"] = textCreateSummary.Render("txtcreatedesc", "", "", "Write a description about your new page", "", Element.Textbox.enumTextType.textarea);
                S.javascriptFiles.Add("dash-pages", "/js/dashboard/pages/pages.js");
                S.javascript.Add("dash-pages", "S.dashboard.pages.current_page=0;");
            }

            inject.html = scaffold.Render();
            return inject;
        }
Ejemplo n.º 8
0
        public override Widget build(BuildContext context)
        {
            TextStyle textStyle = Theme.of(context).textTheme.display1;

            return(new Card(
                       color: Colors.white,
                       child: new Center(
                           child: new Column(
                               mainAxisSize: MainAxisSize.min,
                               crossAxisAlignment: CrossAxisAlignment.center,
                               children: new List <Widget> {
                new Icon(this.choice.icon, size: 128.0f, color: textStyle.color),
                new RaisedButton(
                    child: new Text(this.choice.title, style: textStyle),
                    onPressed: () => {
                    SnackBar snackBar = new SnackBar(
                        content: new Text(this.choice.title + " is chosen !"),
                        action: new SnackBarAction(
                            label: "Ok",
                            onPressed: () => { }));

                    Scaffold.of(context).showSnackBar(snackBar);
                })
            }
                               )
                           )
                       ));
        }
Ejemplo n.º 9
0
        public void Can_Get_Recursive_Permissions_When_Node_Has_No_Permissions()
        {
            Scaffold.ContentType(_contentTypeService);
            IContentType contentType = _contentTypeService.GetContentType("textpage");

            IContent root  = Scaffold.Node(_contentService);
            IContent child = Scaffold.Node(_contentService, root.Id);

            List <UserGroupPermissionsPoco> permissions = _configService.GetRecursivePermissionsForNode(root.ToPublishedContent());

            Assert.Null(permissions);

            permissions = _configService.GetRecursivePermissionsForNode(child.ToPublishedContent());
            Assert.Null(permissions);

            // add a permission so something is returned...
            var poco = new UserGroupPermissionsPoco
            {
                ContentTypeId = contentType.Id,
                GroupId       = 3,
                Permission    = 0
            };

            _configService.UpdateContentTypeConfig(new Dictionary <int, List <UserGroupPermissionsPoco> >
            {
                { 0, new List <UserGroupPermissionsPoco> {
                      poco
                  } }
            });

            permissions = _configService.GetRecursivePermissionsForNode(child.ToPublishedContent());
            Assert.NotNull(permissions);
        }
Ejemplo n.º 10
0
        public structResponse Layers()
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "Layers";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/layers.html", "", new string[] { });

            R.Page.RegisterJS("layers", "R.editor.layers.refresh();");

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 11
0
        public void Can_Count_All(int count)
        {
            Scaffold.Instances(count);
            double result = _service.CountAll();

            Assert.Equal(count, result);
        }
Ejemplo n.º 12
0
        public void Can_Get_All(int count)
        {
            Scaffold.Instances(count);
            IEnumerable <WorkflowInstancePoco> instances = _service.GetAll();

            Assert.Equal(count, instances.Count());
        }
Ejemplo n.º 13
0
        public override string Render(string[] path, string body = "", object metadata = null)
        {
            var html = new StringBuilder();

            if (path.Length > 1)
            {
                //load kanban lists for board
                var boardId  = int.Parse(path[1]);
                var scaffold = new Scaffold("Views/Board/Kanban/kanban.html");
                var htmlists = new StringBuilder();
                foreach (var list in board.lists)
                {
                    htmlists.Append(Common.Platform.List.Kanban.RenderList(list, list.cards) + "\n");
                }

                var colors = new Utility.Colors();

                scaffold.Data["name"] = board.name;
                try
                {
                    scaffold.Data["color-hover"] = colors.FromHexToRgba("#" + board.color, 1);
                }
                catch (Exception)
                {
                }
                scaffold.Data["lists"] = htmlists.ToString();
                html.Append(scaffold.Render());
            }

            return(html.ToString());
        }
Ejemplo n.º 14
0
        public void Can_Get_Populated_Instance(int taskCount, int lastGroupId)
        {
            IContent node = Scaffold.Node(ApplicationContext.Current.Services.ContentService);

            Guid guid = Guid.NewGuid();

            WorkflowInstancePoco instance = Scaffold.Instance(guid, (int)WorkflowType.Publish, node.Id);

            _service.InsertInstance(instance);
            for (var i = 1; i <= taskCount; i += 1)
            {
                _tasksService.InsertTask(Scaffold.Task(guid, DateTime.Now,
                                                       i < taskCount ? i : lastGroupId,
                                                       i,
                                                       i < taskCount ? 1 : 3));
            }

            // this has groups, tasks, everything. Or it should.
            WorkflowInstancePoco populatedInstance = _service.GetPopulatedInstance(guid);

            Assert.Equal(taskCount, populatedInstance.TaskInstances.Count);
            Assert.Equal(0, populatedInstance.TotalSteps);                                        // this shouldn't be set yet
            Assert.Equal(lastGroupId, populatedInstance.TaskInstances.First().UserGroup.GroupId); // tasks are descending by id
            Assert.Equal(WorkflowStatus.PendingApproval, populatedInstance.WorkflowStatus);
        }
Ejemplo n.º 15
0
Archivo: Debug.cs Proyecto: nhtera/Home
        public WebRequest Session()
        {
            WebRequest wr = new WebRequest();

            Scaffold scaffold = new Scaffold(R, "/app/debug/debug.html", "", new string[] { "body" });
            string jsonVs = R.Util.Str.GetString(R.Session["viewstates"]);
            string jsonUser = R.Util.Serializer.WriteObjectAsString(R.User);
            ViewStates vss = (ViewStates)R.Util.Serializer.ReadObject(jsonVs, Type.GetType("Rennder.ViewStates"));
            List<string> body = new List<string>();
            double totalLen = R.Session["viewstates"].Length;
            double len = 0;

            body.Add("<h1>User (" + (jsonUser.Length * 2) + " bytes)</h1>" + jsonUser);
            body.Add("<h1>Viewstates (" + totalLen.ToString("N0") + " bytes)</h1>" + jsonVs);

            foreach(structViewStateInfo item in vss.Views)
            {
                ViewState vssItem = (ViewState)R.Util.Serializer.ReadObject(R.Util.Str.GetString(R.Session["viewstate-" + item.id]), Type.GetType("Rennder.ViewState"));
                len = R.Session["viewstate-" + item.id].Length;
                totalLen += len;
                body.Add("<h1>Viewstate \"" + item.id + "\" (" + len.ToString("N0") + " bytes)</h1>" + R.Util.Serializer.WriteObjectAsString(vssItem));

            }

            body.Add("<h1>Total Memory Used: " + totalLen.ToString("N0") + " bytes");

            scaffold.Data["body"] = ("<pre>" + string.Join("</pre></div><div><pre>", body.ToArray()).Replace("\\\"", "\"").Replace("\\n", "").Replace("},", "},\n").Replace("],", "],\n") + "</pre>");

            //finally, scaffold debug HTML
            wr.html = scaffold.Render();
            return wr;
        }
Ejemplo n.º 16
0
Archivo: Pages.cs Proyecto: nhtera/Home
        public Inject LoadPages()
        {
            if (R.isSessionLost() == true)
            {
                return(lostInject());
            }
            Inject response = new Inject();

            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffold
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/pages.html", "", new string[] { "page-title", "page-list", "help" });

            scaffold.Data["page-title"] = "";
            scaffold.Data["page-list"]  = LoadPagesList();
            scaffold.Data["help"]       = RenderHelpColumn("/App/Help/dashboard/pages.html");

            //setup response
            response.element = ".winWebPages > .content";
            response.html    = scaffold.Render();
            response.js      = CompileJs();

            return(response);
        }
    private void SetInitialState()
    {
        Scaffold.SetAllButtonsBlack();

        // Decide which color is the “neutral” color (the remaining four are the “live” ones)
        var colors = _usefulColors.ToArray().Shuffle();

        _rememberedColors    = colors.Subarray(0, 4);                                      // this array will be reordered as the player presses them
        _rememberedPositions = Enumerable.Range(0, 16).ToArray().Shuffle().Subarray(0, 4); // will be re-populated as the player presses them
        _neutralColor        = colors[4];
        _stage       = 0;
        _subprogress = 0;

        for (int i = 0; i < 16; i++)
        {
            _colors[i] = _neutralColor;
        }
        for (int i = 0; i < 4; i++)
        {
            _colors[_rememberedPositions[i]] = _rememberedColors[i];
        }

        Log("Initial colors are: {0}", _rememberedColors.Select((c, cIx) => string.Format("{0} at {1}", c, coord(_rememberedPositions[cIx]))).Join(", "));
        Scaffold.StartSquareColorsCoroutine(_colors, delay: true);
    }
Ejemplo n.º 18
0
        public static void ScaffoldingExists(string destinationDirectory, string scaffoldFilePath, string roleName = "WebRole")
        {
            Scaffold scaffold = Scaffold.Parse(Path.Combine(Data.TestResultDirectory, scaffoldFilePath, Resources.ScaffoldXml));

            foreach (ScaffoldFile file in scaffold.Files)
            {
                if (file.Copy)
                {
                    string elementPath;
                    if (string.IsNullOrEmpty(file.PathExpression))
                    {
                        elementPath = string.IsNullOrEmpty(file.TargetPath) ? Path.Combine(destinationDirectory, file.Path) : Path.Combine(destinationDirectory, file.TargetPath);
                        elementPath = elementPath.Replace("$RoleName$", roleName);
                        Assert.IsTrue(File.Exists(elementPath));
                    }
                    else
                    {
                        string substring = file.PathExpression.Substring(0, file.PathExpression.LastIndexOf('\\'));
                        elementPath = string.IsNullOrEmpty(file.TargetPath) ? Path.Combine(destinationDirectory, substring) : Path.Combine(destinationDirectory, file.TargetPath);
                        elementPath = elementPath.Replace("$RoleName$", roleName);
                        Assert.IsTrue(Directory.Exists(elementPath));
                    }
                }
            }
        }
Ejemplo n.º 19
0
        public override string Render(string[] path, string body = "", object metadata = null)
        {
            if (User.userId > 0)
            {
                //redirect to dashboard
                return(base.Render(path, Redirect("/boards/")));
            }

            //check for database reset
            var scaffold = new Scaffold("/Views/Login/login.html", Server.Scaffold);

            if (Server.environment == Server.Environment.development && Server.hasAdmin == false)
            {
                //load new administrator form
                scaffold = new Scaffold("/Views/Login/new-admin.html", Server.Scaffold);
                scaffold.Data["title"] = "Create an administrator account";
                scripts.Append("<script src=\"/js/views/login/new-admin.js\"></script>");
            }
            else if (Server.environment == Server.Environment.development && User.resetPass == true)
            {
                //load new password form (for admin only)
                scaffold = new Scaffold("/Views/Login/new-pass.html", Server.Scaffold);
                scaffold.Data["title"] = "Create an administrator password";
                scripts.Append("<script src=\"/js/views/login/new-pass.js\"></script>");
            }
            else
            {
                //load login form (default)
                scripts.Append("<script src=\"/js/views/login/login.js\"></script>");
            }

            //load login page
            return(base.Render(path, scaffold.Render()));
        }
Ejemplo n.º 20
0
        public override string Render(string[] path, string body = "", object metadata = null)
        {
            if (!HasPermissions(Query.Models.LogApi.Names.CampaignDetails))
            {
                return("");
            }
            if (path.Length <= 1)
            {
                context.Response.StatusCode = 500;
                return("URL is missing parameters");
            }
            try
            {
                var campaignId = int.Parse(path[1]);
                var html       = "";

                //load campaign details
                var scaffold = new Scaffold("/Views/Campaign/details.html");
                var campaign = Query.Campaigns.GetInfoByUserId(User.userId, campaignId);
                var message  = Query.CampaignMessages.GetInfo(campaignId);
                scaffold.Bind(new { campaign, message,
                                    recepients = new { total = Query.CampaignQueue.TotalEmails(campaignId) } });
                html = scaffold.Render();

                if (parameters.ContainsKey("nolayout"))
                {
                    return(RenderCORS(html));
                }
                return(base.Render(path, html, metadata));
            }
            catch (Exception)
            {
                return(Error("Error retrieving campaign details (10102). Please report error to " + Settings.ContactInfo.CustomerService.email));
            }
        }
Ejemplo n.º 21
0
        //Determine lowest level point of interest for cell
        private static PointOfInterest EvaluateCell(this Cell cell, Scaffold roomScaffold)
        {
            var result = new PointOfInterest();

            result.cells.Add(cell.position);

            var walls = roomScaffold.wall.main.Where(x => x.root.position == cell.position).ToList();

            switch (walls.Count())
            {
            case 3:
                result.interestType = PointOfInterestType.Endroom;
                break;

            case 2:
                result.interestType = cell.CellWallsAreAdjacent(walls) ? PointOfInterestType.Corner : PointOfInterestType.Hall;
                break;

            case 1:
                result.interestType = PointOfInterestType.Side;
                break;

            default:
                result.interestType = PointOfInterestType.Open_Area;
                break;
            }

            result.hasDoors = cell.doors.Count() > 0;

            return(result);
        }
Ejemplo n.º 22
0
        public structResponse NewPage(int parentId, string title)
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "NewPage";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/newpage.html", "", new string[] { "url", "data-page", "data-pagename" });

            scaffold.Data["url"]           = R.Page.Url.host.Replace("http://", "").Replace("https://", "") + title;
            scaffold.Data["data-page"]     = "";
            scaffold.Data["data-pagename"] = "";

            R.Page.RegisterJS("newpage", "R.editor.pages.add.item.url = '" + scaffold.Data["url"] + "';");

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 23
0
        //Ceiling Parse
        private static void Ceiling_Parse(Room room, ref Scaffold scaffold)
        {
            foreach (var main in scaffold.floor.main)
            {
                var node = new Node_CeilingMain();
                node.position = main.position + (Direction.Up.ToVector());
                node.root     = main;
                node.rootCells.AddRange(main.rootCells);
                scaffold.ceiling.main.Add(node);
            }

            foreach (var connector in scaffold.floor.connectors)
            {
                var node = new Node_CeilingConnector();
                node.position = connector.position + (Direction.Up.ToVector());
                node.root     = connector;
                node.normal   = connector.normal;
                node.rootCells.AddRange(connector.rootCells);
                scaffold.ceiling.connectors.Add(node);
            }

            foreach (var column in scaffold.floor.columns)
            {
                var node = new Node_CeilingColumn();
                node.position = column.position + (Direction.Up.ToVector());
                node.root     = column;
                node.rootCells.AddRange(column.rootCells);
                scaffold.ceiling.columns.Add(node);
            }
        }
    private IEnumerator SetSquareColors(bool delay, bool solve = false)
    {
        if (delay)
        {
            yield return(new WaitForSeconds(Rnd.Range(1.5f, 2f)));
        }

        var sequence = _updateIndices != null?_updateIndices.ToList().Shuffle() : Enumerable.Range(0, 16).ToList().Shuffle();

        for (int i = 0; i < sequence.Count; i++)
        {
            Scaffold.SetButtonColor(sequence[i], _colors[sequence[i]]);
            yield return(new WaitForSeconds(.03f));
        }

        if (solve)
        {
            ModulePassed();
            _activeCoroutine = null;
        }
        else
        {
            _activeCoroutine = StartCoroutine(BlinkLastSquare());
        }

        _updateIndices = null;
    }
    private void SetInitialState()
    {
        for (int i = 0; i < 5; i++)
        {
            _colors[3 * i]       = _colorCandidates[i];
            _colors[(3 * i) + 1] = _colorCandidates[i];
            _colors[(3 * i) + 2] = _colorCandidates[i];
        }

        _firstStageColor = _colorCandidates[Rnd.Range(0, _colorCandidates.Length)];
        _colors[15]      = _firstStageColor;
        _colors.Shuffle();

        _allowedPresses   = new HashSet <int>();
        _currentColor     = _firstStageColor;
        _startingPosition = -1;
        _lastPress        = -1;

        for (int i = 0; i < 16; i++)
        {
            if (_colors[i] == _firstStageColor)
            {
                _allowedPresses.Add(i);
            }
        }

        Log("Initial state: {0}", _colors.Select(c => c.ToString()[0]).JoinString(" "));
        Scaffold.StartSquareColorsCoroutine(_colors, delay: true);
        Log("First color to press is {0}.", _firstStageColor);
    }
        public void Can_Count_Group_Tasks()
        {
            _service.InsertTask(Scaffold.Task());
            _service.InsertTask(Scaffold.Task());

            Assert.Equal(2, _service.CountGroupTasks(1));
        }
Ejemplo n.º 27
0
        public structResponse Components()
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "Components";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/components.html", "", new string[] { "components", "categories" });

            //get a list of components
            scaffold.Data["components"] = GetComponentsList();

            //get a list of categories
            scaffold.Data["categories"] = GetComponentCategories();

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 28
0
        public override string Render(string[] path, string body = "", object metadata = null)
        {
            if (User.userId > 0)
            {
                //redirect to dashboard
                return(base.Render(path, Redirect("/dashboard/")));
            }

            //check for database reset
            var scaffold = new Scaffold("/Views/Login/login.html", Server.Scaffold);

            if (Server.hasAdmin == false)
            {
                //load new administrator form
                scaffold = new Scaffold("/Views/Login/new-user.html", Server.Scaffold);
                scaffold.Data["title"] = "Create a user account";
                scripts.Append("<script src=\"/js/views/login/new-user.js\"></script>");
            }
            else
            {
                //load login form (default)
                scripts.Append("<script src=\"/js/views/login/login.js\"></script>");
            }

            //load login page
            return(base.Render(path, scaffold.Render()));
        }
Ejemplo n.º 29
0
        public structResponse Options()
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "Options";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/options.html", "", new string[]
                                             { "helpicon-grid", "helpicon-dragfrompanel", "helpicon-guidelines" });

            scaffold.Data["helpicon-grid"]          = "";
            scaffold.Data["helpicon-dragfrompanel"] = "";
            scaffold.Data["helpicon-guidelines"]    = "";

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 30
0
Archivo: Apps.cs Proyecto: nhtera/Home
        public Inject Load()
        {
            if (R.isSessionLost() == true)
            {
                return(lostInject());
            }
            Inject response = new Inject();

            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/apps", 0) == false)
            {
                return(response);
            }

            //setup response
            response.element = ".winDashboardApps > .content";

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/apps.html", "", new string[] { "test" });

            scaffold.Data["test"] = R.Page.websiteTitle;

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 31
0
        public structResponse Profile()
        {
            if (R.isSessionLost() == true)
            {
                return(lostResponse());
            }
            structResponse response = new structResponse();

            response.window = "Profile";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false)
            {
                return(response);
            }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/profile.html", "", new string[]
                                             { "websites", "admin" });

            if (R.User.userId == 1)
            {
                scaffold.Data["admin"] = "true";
            }

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js   = CompileJs();

            return(response);
        }
Ejemplo n.º 32
0
 public override void Load()
 {
     if(S.Server.resetPass == true)
     {
         //load new password form (for admin only)
         scaffold = new Scaffold(S, "/App/Components/Login/new-pass.html");
         var txtPass = (Element.Textbox)Page.Elements.Load(ElementType.Textbox);
         var txtPass2 = (Element.Textbox)Page.Elements.Load(ElementType.Textbox);
         var btnLogin = (Element.Button)Page.Elements.Load(ElementType.Button, "button-apply");
         scaffold.Data["title"] = "Create an administrator password";
         scaffold.Data["field-pass"] = txtPass.Render("password", "password", "", "password", "", Element.Textbox.enumTextType.password);
         scaffold.Data["field-pass2"] = txtPass2.Render("password2", "password", "", "retype password", "", Element.Textbox.enumTextType.password);
         scaffold.Data["button-save"] = btnLogin.Render("btnsavepass", "javascript:", "Save");
         AddJavascriptFile("new-pass", "/js/components/login/new-pass.js");
     }
     else
     {
         //load login form (default)
         var txtEmail = (Element.Textbox)Page.Elements.Load(ElementType.Textbox);
         var txtPass = (Element.Textbox)Page.Elements.Load(ElementType.Textbox);
         var btnLogin = (Element.Button)Page.Elements.Load(ElementType.Button, "button-apply");
         scaffold.Data["field-email"] = txtEmail.Render("email", "email", "", "email address");
         scaffold.Data["field-pass"] = txtPass.Render("password", "password", "", "password", "", Element.Textbox.enumTextType.password);
         scaffold.Data["button-login"] = btnLogin.Render("btnlogin", "javascript:", label);
         AddJavascriptFile("component", "/js/components/login/component.js");
     }
 }
Ejemplo n.º 33
0
        // build (为什么应用启动时会build两次
        public override Widget build(BuildContext context)
        {
            Debug.Log("build!");
            // todo 如果不对mlist的内存进行重新分配就不会更页面
            mList = new List <Widget>(mList);
            // Scaffold

            mScaffold = new Scaffold(
                appBar: new AppBar(
                    leading: new Icon(Icons.book),
                    title: new Text("通讯录"),
                    actions: new List <Widget> {
                mPopupMenuButton
            }
                    ),
                body: new ListView(
                    children: mList
                    ),
                floatingActionButton: new FloatingActionButton(
                    child: new Icon(Icons.add, size: 35),
                    backgroundColor: Theme1.themePrimaryColor,
                    onPressed: showEditInfoSheetCallBack
                    )
                );

            return(mScaffold);
        }
Ejemplo n.º 34
0
        public void LoadHeader(ref Scaffold scaffold, bool hasMenu = true)
        {
            if (User.userId > 0)
            {
                scaffold.Child("header").Data["user"]        = "******";
                scaffold.Child("header").Data["boards-menu"] = Common.Platform.Boards.RenderBoardsMenu(this);

                if (User.photo == true)
                {
                    scaffold.Child("header").Data["user-photo"] = "/users/" + FileSystem.DateFolders(User.datecreated) + "/photo.jpg";
                }
                else
                {
                    scaffold.Child("header").Data["no-user"] = "******";
                }

                //apply user settings to UI layout configuration
                if (hasMenu == true)
                {
                    scaffold.Child("header").Data["boards"]   = "1";
                    scaffold.Child("header").Data["boards-2"] = "1";
                    if (User.keepMenuOpen == true)
                    {
                        scripts.Append("<script language=\"javascript\">S.head.boards.show();S.head.boards.alwaysShow(true);</script>");
                    }
                }
            }
            else
            {
                scaffold.Child("header").Data["no-user"] = "******";
            }
        }
Ejemplo n.º 35
0
        public Inject Load()
        {
            if (R.isSessionLost() == true) { return lostInject(); }
            Inject response = new Inject();

            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/timeline", 0) == false) { return response; }

            //setup response
            response.element = ".winDashboardTimeline > .content";

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/timeline.html", "", new string[] { "test" });
            scaffold.Data["test"] = R.Page.websiteTitle;

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 36
0
        public override Services.Inject LoadSubPage(string path)
        {
            var inject = new Services.Inject();
            if(path != "")
            {
                //load sub page
                switch (path)
                {
                    case "???":

                        break;
                }
            }else
            {
                //load settings interface
                scaffold = new Scaffold(S, "/App/Dashboard/Settings/Themes/themes.html");
            }

            inject.html = scaffold.Render();
            return inject;
        }
Ejemplo n.º 37
0
Archivo: Pages.cs Proyecto: nhtera/Home
        public Inject LoadPages()
        {
            if (R.isSessionLost() == true) { return lostInject(); }
            Inject response = new Inject();

            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffold
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/pages.html", "", new string[] { "page-title", "page-list", "help" });
            scaffold.Data["page-title"] = "";
            scaffold.Data["page-list"] = LoadPagesList();
            scaffold.Data["help"] = RenderHelpColumn("/App/Help/dashboard/pages.html");

            //setup response
            response.element = ".winWebPages > .content";
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 38
0
        public override Services.Inject LoadSubPage(string path)
        {
            var inject = new Services.Inject();
            if(path != "")
            {
                //load sub page
                switch (path)
                {
                    case "???":

                        break;
                }
            }else
            {
                //load timeline
                scaffold = new Scaffold(S, "/App/Dashboard/Timeline/timeline.html");
            }

            inject.html = scaffold.Render();
            return inject;
        }
Ejemplo n.º 39
0
        public override Services.Inject LoadSubPage(string path)
        {
            var inject = new Services.Inject();
            if(path != "")
            {
                //load sub page
                switch (path)
                {
                    case "security":

                        break;
                }
            }else
            {
                //load users list
                scaffold = new Scaffold(S, "/App/Dashboard/Users/users.html");
            }

            inject.html = scaffold.Render();
            return inject;
        }
Ejemplo n.º 40
0
        public structResponse Components()
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "Components";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/components.html", "", new string[] { "components", "categories" });

            //get a list of components
            scaffold.Data["components"] = GetComponentsList();

            //get a list of categories
            scaffold.Data["categories"] = GetComponentCategories();

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 41
0
        private void SetupWebRequest()
        {
            host = R.Page.Url.host;

            //setup scaffolding variables
            scaffold  = new Scaffold(R, "/app/components/login/login.html", "", new string[] { "head", "action", "body", "foot", "script" });

            //get Website properties from Request.Query
            arrContent = R.Request.Query["s"].Split(',');
            arrDesign = R.Request.Query["d"].Split(',');
            if (arrDesign.Length <= 1) { arrDesign = new string[] { "", "", "", "", "", "", "", "", "", "", "", "false", "", "", "" }; }
            websiteId = int.Parse(R.Request.Query["w"]);
            themeFolder = "/content/themes/" + R.Request.Query["l"] + "/";
            websiteFolder = "/content/websites/" + websiteId + "/";
            scaffold.Data["head"] = "<link rel=\"Stylesheet\" type=\"text/css\" href=\"/css/rennder.css\"/>" +
                               "<link rel=\"Stylesheet\" type=\"text/css\" href=\"" + themeFolder + "style.css\"/>" +
                               "<link rel=\"Stylesheet\" type=\"text/css\" href=\"" + websiteFolder + "website.css\"/>";

            //set form action
            scaffold.Data["action"] = "/rennder/Login/PostForm" + R.Request.QueryString;

            //set missing Page properties
            R.Page.themeFolder = themeFolder;
            R.Page.websiteId = websiteId;
            R.Elements = new Elements(R, themeFolder);

            //setup scaffold parameters
            scaffold.Data["script"] = "R.ajax.viewstateId = '" + R.ViewStateId + "';";

            if (R.isLocal == true)
            {
                scaffold.Data["foot"] = "<script type=\"text/javascript\" src=\"/scripts/utility/jquery-2.1.3.min.js\"></script>\n" +
                                   "<script type=\"text/javascript\" src=\"/scripts/core/global.js\"></script>\n" +
                                   "<script type=\"text/javascript\" src=\"/scripts/core/fixes.js\"></script>\n" +
                                   "<script type=\"text/javascript\" src=\"/scripts/core/rml.js\"></script>\n" +
                                   "<script type=\"text/javascript\" src=\"/scripts/core/view.js\"></script>\n";
            }
            else
            {
                scaffold.Data["foot"] = "<script type=\"text/javascript\" src=\"/scripts/rennder.js?v=" + R.Version + "\"></script>\n";
            }
        }
Ejemplo n.º 42
0
 public static void AssemblySetup(TestContext testContext) {
     TestScaffold = Scaffold<ISrcMLGlobalService>.Setup(new SrcMLServicePackage(), typeof(SSrcMLGlobalService));
 }
Ejemplo n.º 43
0
 public Element(Core RennderCore, string path, string name = "")
 {
     R = RennderCore;
     scaffold = new Scaffold(R, path, name);
 }
Ejemplo n.º 44
0
 public static void AssemblySetup(TestContext testContext) {
     TestScaffold = Scaffold<ISrcMLGlobalService>.Setup(new SrcMLServicePackage(), typeof(SSrcMLGlobalService));
     TestScaffoldCM = Scaffold<ICursorMonitorService>.Setup(new SrcMLServicePackage(), typeof(SCursorMonitorService));
     TestScaffoldMT = Scaffold<IMethodTrackService>.Setup(new SrcMLServicePackage(), typeof(SMethodTrackService));
     TestScaffoldData = Scaffold<ISrcMLDataService>.Setup(new SrcMLServicePackage(), typeof(SSrcMLDataService));
 }
Ejemplo n.º 45
0
        private string renderMenuItem(Scaffold scaff, structMenuItem item, int level = 0)
        {
            var gutter = "";
            var subs = new StringBuilder();
            for (var x = 0; x < level; x++)
            {
                gutter += "<div class=\"gutter\"></div>";
            }
            if (item.submenu != null)
            {
                if(item.submenu.Count > 0)
                {
                    foreach(var sub in item.submenu)
                    {
                        subs.Append(renderMenuItem(scaff, sub, level + 1));
                    }
                }
            }
            scaff.Data["label"] = item.label;
            scaff.Data["href"] = item.href == "" ? "javascript:" : item.href;
            scaff.Data["icon"] = item.icon;
            scaff.Data["gutter"] = gutter;
            if(subs.Length > 0)
            {
                scaff.Data["target"] = " target=\"_self\"";
                scaff.Data["submenu"] = "<div class=\"row submenu\"><ul class=\"menu\">" + subs.ToString() + "</ul></div>";
            }
            else
            {
                scaff.Data["submenu"] = "";
            }

            return scaff.Render();
        }
Ejemplo n.º 46
0
        public structResponse Profile()
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "Profile";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/profile.html", "", new string[]
            { "websites", "admin" });
            if (R.User.userId == 1) { scaffold.Data["admin"] = "true"; }

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 47
0
        public structResponse Dashboard()
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "Dashboard";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/dashboard.html", "",
                new string[] { "website-title", "page-title", "pageid" });
            scaffold.Data["website-title"] = R.Page.websiteTitle;
            scaffold.Data["page-title"] = R.Util.Str.GetPageTitle(R.Page.pageTitle);
            scaffold.Data["pageid"] = R.Page.pageId.ToString();

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 48
0
        public structResponse Layers()
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "Layers";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/layers.html", "", new string[] { });

            R.Page.RegisterJS("layers", "R.editor.layers.refresh();");

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 49
0
        public structResponse NewPage(int parentId, string title)
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "NewPage";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/newpage.html", "", new string[] { "url", "data-page", "data-pagename" });
            scaffold.Data["url"] = R.Page.Url.host.Replace("http://", "").Replace("https://", "") + title;
            scaffold.Data["data-page"] = "";
            scaffold.Data["data-pagename"] = "";

            R.Page.RegisterJS("newpage", "R.editor.pages.add.item.url = '" + scaffold.Data["url"] + "';");

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 50
0
        public structResponse Options()
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "Options";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/editor/options.html", "", new string[]
            { "helpicon-grid", "helpicon-dragfrompanel", "helpicon-guidelines" });
            scaffold.Data["helpicon-grid"] = "";
            scaffold.Data["helpicon-dragfrompanel"] = "";
            scaffold.Data["helpicon-guidelines"] = "";

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }
Ejemplo n.º 51
0
Archivo: Init.cs Proyecto: Websilk/Home
        private void GeneratePage(string name)
        {
            var P = new Page(S);
            var page = new Page.structPage();
            var scaffold = new Scaffold(S, "/App/Content/themes/default/layout.html");
            var panels = P.loadLayout(scaffold);
            var panelHead = panels[0];
            var panelBody = panels[1];
            var panelFoot = panels[2];

            page.layers = new List<int>();
            page.panels = new List<Panel>();
            page.components = new List<Component>();

            if (name == "home")
            {
                //generate a home page
                P.Url = P.parseUrl("/home");
                P.getPageInfoFromUrl();

            }else if (name == "login")
            {
                //generate login page
                P.Url = P.parseUrl("/login");
                P.getPageInfoFromUrl();
                var cLogin = P.loadComponent(new Websilk.Components.Login(), panelBody, panelBody.cells[0], true);
                var posLogin = cLogin.position[4];
                posLogin.padding.top = 50;
                cLogin.position[4] = posLogin;

            }else if (name == "access-denied")
            {
                //generate login page
                P.Url = P.parseUrl("/access-denied");
                P.getPageInfoFromUrl();
                var cLogin = P.loadComponent(new Websilk.Components.Login(), panelBody, panelBody.cells[0], true);
                var posLogin = cLogin.position[4];
                posLogin.padding.top = 50;
                cLogin.position[4] = posLogin;
            }

            page.pageId = P.pageId;

            //add components from head, body, & foot
            foreach (var component in panelHead.cells[0].components)
            {
                page.components.Add(component);
            }

            foreach (var component in panelBody.cells[0].components)
            {
                page.components.Add(component);
            }

            foreach (var component in panelFoot.cells[0].components)
            {
                page.components.Add(component);
            }

            //save page to file
            S.Util.Serializer.SaveToFile(page, S.Server.MapPath("/App/Content/websites/1/pages/" + page.pageId + "/page.json"), Newtonsoft.Json.Formatting.None);
        }
Ejemplo n.º 52
0
 public Element(Core WebsilkCore, string path, string name = "")
 {
     S = WebsilkCore;
     scaffold = new Scaffold(S, path, "", name);
 }
Ejemplo n.º 53
0
        public override void Load()
        {
            //load the dashboard layout
            scaffold = new Scaffold(S, "/App/Dashboard/dashboard.html");
            S.cssFiles.Add("dashboard", "/css/dashboard/dashboard.css");
            var scaffMenu = new Scaffold(S, "/App/Dashboard/menu-item.html");

            //load user profile
            scaffold.Data["profile-img"] = "";
            scaffold.Data["btn-edit-img"] = "";
            scaffold.Data["profile-name"] = S.User.displayName;

            //load website info
            var domains = page.getDomainsForWebsite();
            var domain = "";
            if(domains.Count > 0)
            {
                domain = domains[0].domain;
                scaffold.Data["has-domain"] = "true";
                scaffold.Data["website-name"] = page.websiteTitle;
                scaffold.Data["website-url"] = "http://www." + domain;
                scaffold.Data["website-url-name"] = "www." + domain;
            }

            //generate menu system
            var menu = new StringBuilder();
            var menus = new List<structMenuItem>()
            {
                menuItem("Timeline", "/dashboard/timeline", "timeline"),
                menuItem("Pages", "/dashboard/pages", "pages"),
                menuItem("Photos", "/dashboard/photos", "photos"),
                menuItem("Downloads", "/dashboard/downloads", "layers"),
                menuItem("Analytics", "/dashboard/analytics", "analytics"),
                menuItem("Users", "/dashboard/users", "users"),
                menuItem("Settings", "/dashboard/settings", "settings",
                    new List<structMenuItem>{
                        menuItem("Domains", "/dashboard/settings/domains", "domains"),
                        menuItem("Themes", "/dashboard/settings/themes", "themes"),
                        menuItem("Color Schemes", "/dashboard/settings/colors", "colors"),
                        menuItem("Cache", "/dashboard/settings/cache", "cache")
                    }
                )
            };

            //TODO: get apps available to the user for this website

            //render menu system
            foreach (var item in menus)
            {
                menu.Append(renderMenuItem(scaffMenu, item, 0));
            }
            scaffold.Data["menu"] = "<ul class=\"menu\">" + menu.ToString() + "</ul>";

            //add js file
            S.javascriptFiles.Add("dashboard", "/js/dashboard/dashboard.js");

            //finally, add content of dashboard section
            var inject = new Inject();
            if (page.Url.path != "dashboard")
            {
                inject = LoadSubPage(page.Url.path.Replace("dashboard/", ""));
            }
            else
            {
                inject = LoadSubPage("pages");
                S.javascript.Add("url", "S.url.push(S.page.title, 'dashboard/pages');");
            }

            //initialize dashboard website info
            S.javascript.Add("dash-init",
                "S.dashboard.website = {" +
                "id:" + page.websiteId + ", title:'" + page.websiteTitle.Replace("'","\\'") + "', domain:'" + domain + "'" +
                "};"
            );

            scaffold.Data["body"] = inject.html;
        }
Ejemplo n.º 54
0
Archivo: App.cs Proyecto: nhtera/Home
        public App(Server server, HttpContext context)
        {
            //the Pipeline.App is simply the first page request for a Rennder website.
            //Scaffold the HTML, load the Rennder Core, then load a web page.

            R = new Core(server, context, "", "app");
            R.App = this;
            R.isFirstLoad = true;

            //setup scaffolding variables
            scaffold = new Scaffold(R, "/app/pipeline/app.html", "", new string[]
            { "title", "description", "facebook", "theme-css", "website-css", "editor-css", "head-css", "favicon", "font-faces", "body-class", "custom-css",
              "background", "editor","webpage-class", "body-sides","body", "scripts", "https-url", "http-url"});

            //default favicon
            scaffold.Data["favicon"] = "/images/favicon.gif";

            //check for web bots such as gogle bot
            string agent = context.Request.Headers["User-Agent"].ToLower();
            if (agent.Contains("bot") | agent.Contains("crawl") | agent.Contains("spider"))
            {
                R.Page.useAJAX = false;
                R.Page.isBot = true;
            }

            //check for mobile agent
            if (agent.Contains("mobile") | agent.Contains("blackberry") | agent.Contains("android") | agent.Contains("symbian") | agent.Contains("windows ce") |
                agent.Contains("fennec") | agent.Contains("phone") | agent.Contains("iemobile") | agent.Contains("iris") | agent.Contains("midp") | agent.Contains("minimo") |
                agent.Contains("kindle") | agent.Contains("opera mini") | agent.Contains("opera mobi") | agent.Contains("ericsson") | agent.Contains("iphone") | agent.Contains("ipad"))
            {
                R.Page.isMobile = true;
            }

            //get browser type
            scaffold.Data["body-class"] = R.Util.GetBrowserType();

            //parse URL
            R.Page.GetPageUrl();
            if(R.isLocal == true)
            {
                scaffold.Data["https-url"] = "http://" + R.Page.Url.host.Replace("/","");
            }else
            {
                scaffold.Data["https-url"] = "https://" + R.Page.Url.host.Replace("/", "");
            }

            //get page Info
            SqlReader reader = R.Page.GetPageInfoFromUrlPath();
            if(reader.Rows.Count > 0)
            {
                //load initial web page
                R.Page.LoadPageInfo(reader);

                if(R.Page.pageId > 0)
                {
                    string js = "";

                    //load page
                    R.Page.LoadPage(R.Page.pageFolder + "page.xml", 1, R.Page.pageId, R.Page.pageTitle);

                    //load website.css
                    scaffold.Data["website-css"] = "/content/websites/" + R.Page.websiteId + "/website.css?v=" + R.Version;

                    //load iframe resize code, so if a Rennder web page is loaded within an iframe, it can communicate
                    //with the parent web page whenever the iframe resizes.
                    if (R.Request.Query[ "ifr"] == "1")
                    {
                        js += "var frameSize = 0;" + "function checkResize(){" + "var wurl = \"" + R.Request.Query["w"] + "\";" + "if(frameHeight != frameSize){" + "parent.postMessage(\"resize|\"+(frameHeight),wurl);" + "}" + "frameSize = frameHeight;" + "setTimeout(\"checkResize();\",1000);" + "}" + "checkResize();";
                        R.Page.isEditable = false;
                    }

                    //register app javascript
                    js += "R.init(" + R.Page.useAJAX.ToString().ToLower() + ",'" + R.ViewStateId + "',R.page.title);";
                    R.Page.RegisterJS("app", js);

                    //display Page Editor
                    if (R.Page.isEditable == true)
                    {
                        Editor editor = new Editor(R);
                        string[] result = editor.LoadEditor();
                        scaffold.Data["editor"] = result[0];
                        R.Page.RegisterJS("editor", result[1]);
                    }

                    //setup scripts
                    string scripts;
                    if(R.isLocal == true)
                    {
                        scripts = "<script type=\"text/javascript\" src=\"/scripts/utility/jquery-2.1.3.min.js\"></script>\n" +
                            "<script type=\"text/javascript\" src=\"/scripts/core/global.js\"></script>\n" +
                            "<script type=\"text/javascript\" src=\"/scripts/core/fixes.js\"></script>\n" +
                            "<script type=\"text/javascript\" src=\"/scripts/core/rml.js\"></script>\n" +
                            "<script type=\"text/javascript\" src=\"/scripts/core/view.js\"></script>\n" +
                            //"<script type=\"text/javascript\" src=\"/scripts/core/responsive.js\"></script>\n" +
                            "<script type=\"text/javascript\" src=\"/scripts/utility.js?v=" + R.Version + "\"></script>";
                        if(R.Page.isEditable == true)
                        {
                            scripts += "<script type=\"text/javascript\" src=\"/scripts/core/editor.js?v=" + R.Version + "\"></script>\n" +
                                "<script type=\"text/javascript\" src=\"/scripts/rangy/rangy-compiled.js?v=" + R.Version + "\"></script>\n" +
                                "<script type=\"text/javascript\" src=\"/scripts/utility/dropzone.js?v=" + R.Version + "\"></script>\n" +
                                "<script type=\"text/javascript\">R.editor.load();</script>";
                        }
                    }
                    else
                    {
                        scripts = "<script type=\"text/javascript\" src=\"/scripts/rennder.js?v=" + R.Version + "\"></script>\n" +
                                "<script type=\"text/javascript\" src=\"/scripts/utility.js?v=" + R.Version + "\"></script>";
                        if (R.Page.isEditable == true)
                        {
                            scripts += "<script type=\"text/javascript\" src=\"/scripts/editor.js?v=" + R.Version + "\"></script>\n" +
                                "<script type=\"text/javascript\">R.editor.load();</script>";
                        }
                    }

                    if(R.Page.postJScode.Length > 0)
                    {
                        R.Page.postJS += string.Join("\n", R.Page.postJScode) + R.Page.postJSLast;
                    }

                    scaffold.Data["scripts"] = scripts + "\n" + "<script type=\"text/javascript\">" + R.Page.postJS + "</script>";

                    //render web page
                    scaffold.Data["body"] = R.Page.Render();
                }
            }

            //finally, scaffold Rennder platform HTML
            R.Response.ContentType = "text/html";
            R.Response.WriteAsync(scaffold.Render());

            //unload the core
            R.Unload();
        }
Ejemplo n.º 55
0
        public structResponse PageSettings(int pageId)
        {
            if (R.isSessionLost() == true) { return lostResponse(); }
            structResponse response = new structResponse();
            response.window = "PageSettings";
            //check security
            if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; }

            //setup scaffolding variables
            Scaffold scaffold = new Scaffold(R, "/app/dashboard/pagesettings.html", "",
                new string[] { "url", "page-title", "description", "secure", "page-type", "type" });

            string parentTitle = "";
            SqlReader reader = R.Page.SqlPage.GetParentInfo(pageId);
            if (reader.Rows.Count > 0)
            {
                reader.Read();
                parentTitle = reader.Get("parenttitle");
                scaffold.Data["page-title"] = R.Util.Str.GetPageTitle(reader.Get("title"));
                if (reader.GetBool("security") == true)
                {
                    scaffold.Data["secure"] = "true";
                }
                scaffold.Data["description"] = reader.Get("description");
            }

            scaffold.Data["url"] = R.Page.Url.host.Replace("http://", "").Replace("https://", "") + scaffold.Data["page-title"].Replace(" ", "-") + "/";

            if (!string.IsNullOrEmpty(parentTitle))
            {
                parentTitle = R.Util.Str.GetPageTitle(parentTitle);
                scaffold.Data["page-type"] = "true";
                scaffold.Data["type"] = "A sub-page for \"" + parentTitle + "\"";
            }

            //finally, scaffold Rennder platform HTML
            response.html = scaffold.Render();
            response.js = CompileJs();

            return response;
        }