Пример #1
0
 internal InformationNode()
 {
     deepLink = new DeepLink()
     {
         NodeType = NodeType.Info
     };
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Panel1.Text  = ui.Text("stylesheet", "editstylesheet", UmbracoUser);
            pp_name.Text = ui.Text("name", UmbracoUser);
            pp_path.Text = ui.Text("path", UmbracoUser);

            var stylesheet = Services.FileService.GetStylesheetByName(filename);

            if (stylesheet == null) // not found
            {
                throw new FileNotFoundException("Could not find file '" + filename + "'.");
            }

            lttPath.Text      = "<a id=\"" + lttPath.ClientID + "\" target=\"_blank\" href=\"" + stylesheet.VirtualPath + "\">" + stylesheet.VirtualPath + "</a>";
            editorSource.Text = stylesheet.Content;
            TreeSyncPath      = DeepLink.GetTreePathFromFilePath(filename).TrimEnd(".css");

            // name derives from path, without the .css extension, clean for xss
            NameTxt.Text = stylesheet.Path.TrimEnd(".css").CleanForXss('\\', '/');

            if (IsPostBack == false)
            {
                ClientTools
                .SetActiveTreeType(Constants.Trees.Stylesheets)
                .SyncTree(TreeSyncPath, false);
            }
        }
Пример #3
0
        internal DeepLinkViewModel(Action <DeepLink> navigate)
        {
            this.navigate = navigate;
            HtmlLocation location = HtmlWindow.Current.Location;
            string       hash     = location.Hash;

            localStorageKey = UriUtility.GetServerRelativeUrl(UriUtility.GetAbsolutePath(location.Href)) + "?deepLink";
            if (!string.IsNullOrEmpty(hash))
            {
                try
                {
                    lastReceived = JsonDeserializer.Deserialize <DeepLink>(hash.Substring(1)); // ignore #
                }
                catch
                {
                }
            }

            if (lastReceived == null && HtmlWindow.Current.LocalStorage != null)
            {
                hash = HtmlWindow.Current.LocalStorage[localStorageKey];
                if (!string.IsNullOrEmpty(hash))
                {
                    try
                    {
                        lastReceived = JsonDeserializer.Deserialize <DeepLink>(hash); // ignore #
                    }
                    catch
                    {
                    }
                }
            }

            HtmlWindow.Current.AdviseHash(HashChanged);
        }
 void Start()
 {
     DeepLink.OnOpenURL((string URL, string sourceApplicationBundleID) =>
     {
         elements.URLlabel.text         = URL;
         elements.sourceAppIDlabel.text = sourceApplicationBundleID;
     });
 }
Пример #5
0
        NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
        {
            if (DeepLink.WebUrl.Length < deepLink.WebUrl.Length)
            {
                return(NavigateDisposition.Expand);
            }

            return(DeepLink.NodeType == deepLink.NodeType ? NavigateDisposition.Complete : NavigateDisposition.Next);
        }
Пример #6
0
        NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
        {
            if ((deepLink.WebUrl + '/').StartsWith(DeepLink.WebUrl + '/', StringComparison.InvariantCultureIgnoreCase))
            {
                return(deepLink.NodeType == DeepLink.NodeType && deepLink.WebUrl.Length == deepLink.WebUrl.Length
                    ? NavigateDisposition.Complete : NavigateDisposition.Expand);
            }

            return(NavigateDisposition.Next);
        }
Пример #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string file = Request.QueryString["file"];
         string path = DeepLink.GetTreePathFromFilePath(file);
         ClientTools
         .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadXslt>().Tree.Alias)
         .SyncTree(path, false);
     }
 }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string file = Request.QueryString["file"];
         string path = DeepLink.GetTreePathFromFilePath(file, false, true);
         ClientTools
         .SetActiveTreeType(Constants.Trees.Xslt)
         .SyncTree(path, false);
     }
 }
Пример #9
0
        public JsonResult SaveStylesheet(string filename, string oldName, string contents)
        {
            // sanitize input - stylesheet names have no extension
            var svce = (FileService)Services.FileService;

            filename = CleanFilename(filename.CleanForXss());
            oldName  = CleanFilename(oldName);

            if (filename != oldName)
            {
                var stylesheetExists = svce.GetStylesheetByName(filename);
                if (stylesheetExists != null)
                {
                    return(Failed(ui.Text("speechBubbles", "cssErrorText"), "A file named '" + filename + ".css' already exists."));
                }
            }

            var stylesheet = svce.GetStylesheetByName(oldName);

            if (stylesheet == null)
            {
                stylesheet = new Stylesheet(filename);
            }
            else
            {
                stylesheet.Path = filename;
            }
            stylesheet.Content = contents;

            try
            {
                if (svce.ValidateStylesheet(stylesheet) == false)
                {
                    return(Failed(ui.Text("speechBubbles", "cssErrorText"), ui.Text("speechBubbles", "cssErrorHeader"),
                                  new FileSecurityException("File '" + filename + "' is not a valid stylesheet file.")));
                }

                svce.SaveStylesheet(stylesheet);
            }
            catch (Exception e)
            {
                return(Failed(ui.Text("speechBubbles", "cssErrorText"), ui.Text("speechBubbles", "cssErrorHeader"), e));
            }

            return(Success(ui.Text("speechBubbles", "cssSavedText"), ui.Text("speechBubbles", "cssSavedHeader"),
                           new
            {
                path = DeepLink.GetTreePathFromFilePath(stylesheet.Path),
                name = stylesheet.Path,
                url = stylesheet.VirtualPath,
                contents = stylesheet.Content
            }));
        }
Пример #10
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            UmbracoPanel1.hasMenu = true;

            if (!IsPostBack)
            {
                string file = Request.QueryString["file"];
                string path = DeepLink.GetTreePathFromFilePath(file);
                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadPython>().Tree.Alias)
                .SyncTree(path, false);
            }
        }
Пример #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            UmbracoPanel1.hasMenu = true;

            if (!IsPostBack)
            {
                string file = Request.QueryString["file"];
                string path = DeepLink.GetTreePathFromFilePath(file);
                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadPython>().Tree.Alias)
                .SyncTree(path, false);
            }
        }
Пример #12
0
 /// <summary>
 /// Get hash code.
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ProjectName != null ? ProjectName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RuleName != null ? RuleName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Severity;
         hashCode = (hashCode * 397) ^ (FilePath != null ? FilePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Line;
         hashCode = (hashCode * 397) ^ (DeepLink != null ? DeepLink.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Status;
         hashCode = (hashCode * 397) ^ FalsePositive.GetHashCode();
         return(hashCode);
     }
 }
Пример #13
0
        NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
        {
            if ((deepLink.FolderUrl + '/').StartsWith(Url + '/', StringComparison.InvariantCultureIgnoreCase))
            {
                if (Url.Length == deepLink.FolderUrl.Length)
                {
                    FolderItems.Navigate(deepLink);
                    return(NavigateDisposition.Complete);
                }

                return(NavigateDisposition.Expand);
            }

            return(NavigateDisposition.Next);
        }
Пример #14
0
        NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
        {
            if (deepLink.ListId == ID)
            {
                if (string.IsNullOrEmpty(deepLink.FolderUrl))
                {
                    ((FolderNode)RootFolder).FolderItems.Navigate(deepLink);
                    return(NavigateDisposition.Complete);
                }

                return(NavigateDisposition.Expand);
            }

            return(NavigateDisposition.Next);
        }
Пример #15
0
        void Apply()
        {
            string hash = null;

            deepLink = null;
            if (lastReceived != null)
            {
                deepLink = new DeepLink(lastReceived);
                hash     = JsonSerializer.Serialize <DeepLink>(deepLink);
            }

            HtmlWindow.Current.Location.Hash = hash;
            if (HtmlWindow.Current.LocalStorage != null)
            {
                HtmlWindow.Current.LocalStorage[localStorageKey] = hash;
            }
        }
Пример #16
0
        void Load()
        {
            screen = new Screen(webPart.Outer);
            user   = HtmlWindow.Current.Get <JObject>("_spPageContextInfo")?.Get <string>("userLoginName")?.Replace(".", "_")?.Replace("@", "_");
            LoadConfiguration();
            this.deepLink = new DeepLinkViewModel(Navigate);
            DeepLink deepLink = DeepLink;

            mainPane = new MainPane(this)
            {
                Element = screen.Outer
            };
            if (deepLink != null)
            {
                Navigate(new DeepLink(deepLink));
            }
        }
Пример #17
0
        NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
        {
            if (deepLink.WebUrl.Length == DeepLink.WebUrl.Length)
            {
                if (deepLink.NodeType == DeepLink.NodeType)
                {
                    return(NavigateDisposition.Complete);
                }

                if (deepLink.ListId != null)
                {
                    return(NavigateDisposition.Expand);
                }
            }

            return(NavigateDisposition.Next);
        }
        public JsonResult SaveStylesheet(string filename, string oldName, string contents)
        {
            // sanitize input - stylesheet names have no extension
            filename = filename
                       .Replace('\\', '/')
                       .TrimStart('/')
                       .EnsureEndsWith(".css");

            var svce       = (FileService)Services.FileService;
            var stylesheet = svce.GetStylesheetByName(oldName);

            if (stylesheet == null)
            {
                stylesheet = new Stylesheet(filename);
            }
            else
            {
                stylesheet.Path = filename;
            }
            stylesheet.Content = contents;

            try
            {
                if (svce.ValidateStylesheet(stylesheet) == false)
                {
                    return(Failed(ui.Text("speechBubbles", "cssErrorText"), ui.Text("speechBubbles", "cssErrorHeader"),
                                  new FileSecurityException("File '" + filename + "' is not a valid stylesheet file.")));
                }

                svce.SaveStylesheet(stylesheet);
            }
            catch (Exception e)
            {
                return(Failed(ui.Text("speechBubbles", "cssErrorText"), ui.Text("speechBubbles", "cssErrorHeader"), e));
            }

            return(Success(ui.Text("speechBubbles", "cssSavedText"), ui.Text("speechBubbles", "cssSavedHeader"),
                           new
            {
                path = DeepLink.GetTreePathFromFilePath(stylesheet.Path),
                name = stylesheet.Path,
                url = stylesheet.VirtualPath,
                contents = stylesheet.Content
            }));
        }
Пример #19
0
    public static void Init()
    {
        if (instance != null)
        {
            return;
        }
        instance = new GameObject("_DeepLinkReceiver").AddComponent <DeepLink>();
        DontDestroyOnLoad(instance.gameObject);

#if UNITY_ANDROID
        instance.handler = new AndroidDeepLinkHandler();
#elif UNITY_IOS
        instance.handler = new IosDeeplinkHandler();
#else
        instance.handler = new DummyDeepLinkHandler();
#endif

        instance.handler.Init(instance);
    }
Пример #20
0
        internal void Navigate(DeepLink deepLink)
        {
            if (!string.IsNullOrEmpty(deepLink.ContentTypeId))
            {
                ParentFolder.ParentList.ContentTypes.Get(
                    delegate(ObservableList <ListContentType> contentTypes){
                    ListContentType contentType = contentTypes.FirstOrDefault(delegate(ListContentType ct)
                    {
                        return(ct.ID == deepLink.ContentTypeId);
                    });

                    if (contentType != null)
                    {
                        ContentType = contentType;
                    }
                },
                    Dummies.Action);
            }
        }
Пример #21
0
        public JsonResult SaveScript(string filename, string oldName, string contents)
        {
            // sanitize input - script names have an extension
            filename = CleanFilename(filename);

            var svce   = (FileService)Services.FileService;
            var script = svce.GetScriptByName(oldName);

            if (script == null)
            {
                script = new Script(filename);
            }
            else
            {
                script.Path = filename;
            }
            script.Content = contents;

            try
            {
                if (svce.ValidateScript(script) == false)
                {
                    return(Failed(ui.Text("speechBubbles", "scriptErrorText"), ui.Text("speechBubbles", "scriptErrorHeader"),
                                  new FileSecurityException("File '" + filename + "' is not a valid script file.")));
                }

                svce.SaveScript(script);
            }
            catch (Exception e)
            {
                return(Failed(ui.Text("speechBubbles", "scriptErrorText"), ui.Text("speechBubbles", "scriptErrorHeader"), e));
            }

            return(Success(ui.Text("speechBubbles", "scriptSavedText"), ui.Text("speechBubbles", "scriptSavedHeader"),
                           new
            {
                path = DeepLink.GetTreePathFromFilePath(script.Path),
                name = script.Path,
                url = script.VirtualPath,
                contents = script.Content
            }));
        }
Пример #22
0
        internal void Navigate(DeepLink deepLink)
        {
            TreeView.Selection.Navigate(
                delegate(IExplorerNode node)
            {
                return(node.Navigate(deepLink));
            },
                delegate(JArray <long> path, bool complete)
            {
                if (complete || TreeView.Selection.Data == null)
                {
                    TreeView.Selection.Select(path);
                    if (complete)
                    {
                        IExplorerNode node          = TreeView.Selection.Data;
                        node.DeepLink.ContentTypeId = deepLink.ContentTypeId;
                        node.DeepLink.TabItemIndex  = deepLink.TabItemIndex;
                        switch (deepLink.NodeType)
                        {
                        case NodeType.Info:
                        case NodeType.Lists:
                        case NodeType.Webs:
                            InfoTabStrip.Selection.Data = InfoTabStrip.TabItems[Math.Max(deepLink.TabItemIndex, 0)];
                            break;

                        case NodeType.List:
                            ListNodePane.Data = (ListNode)node;
                            // ListNodePane.Navigate(deepLink);
                            break;

                        case NodeType.Folder:
                            FolderNodePane.Data = (FolderNode)node;
                            // FolderNodePane.Navigate(deepLink);
                            break;
                        }
                    }
                }
            });
        }
Пример #23
0
        void HashChanged()
        {
            string hash = HtmlWindow.Current.Location.Hash;

            if (!string.IsNullOrEmpty(hash) && hash.Length > 1)
            {
                DeepLink deepLink;
                try
                {
                    deepLink = JsonDeserializer.Deserialize <DeepLink>(hash.Substring(1));
                }
                catch
                {
                    return;
                }

                if (deepLink != null && !this.deepLink.Equals(deepLink))
                {
                    navigate(deepLink);
                }
            }
        }
Пример #24
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // get the script, ensure it exists (not null) and validate (because
            // the file service ensures that it loads scripts from the proper location
            // but does not seem to validate extensions?) - in case of an error,
            // throw - that's what we did anyways.

            // also scrapping the code that added .cshtml and .vbhtml extensions, and
            // ~/Views directory - we're not using editScript.aspx for views anymore.

            var svce   = ApplicationContext.Current.Services.FileService;
            var script = svce.GetScriptByName(filename);

            if (script == null) // not found
            {
                throw new FileNotFoundException("Could not find file '" + filename + "'.");
            }

            lttPath.Text       = "<a id=\"" + lttPath.ClientID + "\" target=\"_blank\" href=\"" + script.VirtualPath + "\">" + script.VirtualPath + "</a>";
            editorSource.Text  = script.Content;
            ScriptTreeSyncPath = DeepLink.GetTreePathFromFilePath(filename);

            // name derives from filename, clean for xss
            NameTxt.Text = filename.CleanForXss('\\', '/');

            Panel1.Text  = ui.Text("editscript", base.getUser());
            pp_name.Text = ui.Text("name", base.getUser());
            pp_path.Text = ui.Text("path", base.getUser());

            if (IsPostBack == false)
            {
                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadScripts>().Tree.Alias)
                .SyncTree(ScriptTreeSyncPath, false);
            }
        }
Пример #25
0
    public void Init(DeepLink receiver)
    {
#if !UNITY_EDITOR && UNITY_IOS
        UnityDeeplinks_init(receiver.gameObject.name, "HandleDeeplink");
#endif
    }
Пример #26
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            NameTxt.Text = file;

            string path = "";

            if (file.StartsWith("~/"))
            {
                path = Umbraco.Core.IO.IOHelper.ResolveUrl(file);
            }
            else
            {
                path = Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Scripts + "/" + file);
            }


            lttPath.Text = "<a target='_blank' href='" + path + "'>" + path + "</a>";

            var exts = UmbracoSettings.ScriptFileTypes.Split(',').ToList();

            if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
            {
                exts.Add("cshtml");
                exts.Add("vbhtml");
            }

            var dirs = Umbraco.Core.IO.SystemDirectories.Scripts;

            if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
            {
                dirs += "," + Umbraco.Core.IO.SystemDirectories.MvcViews;
            }

            // validate file
            Umbraco.Core.IO.IOHelper.ValidateEditPath(Umbraco.Core.IO.IOHelper.MapPath(path), dirs.Split(','));

            // validate extension
            Umbraco.Core.IO.IOHelper.ValidateFileExtension(Umbraco.Core.IO.IOHelper.MapPath(path), exts);


            StreamReader SR;
            string       S;

            SR = File.OpenText(Umbraco.Core.IO.IOHelper.MapPath(path));
            S  = SR.ReadToEnd();
            SR.Close();

            editorSource.Text = S;

            Panel1.Text  = ui.Text("editscript", base.getUser());
            pp_name.Text = ui.Text("name", base.getUser());
            pp_path.Text = ui.Text("path", base.getUser());

            if (!IsPostBack)
            {
                string sPath = DeepLink.GetTreePathFromFilePath(file);
                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadScripts>().Tree.Alias)
                .SyncTree(sPath, false);
            }
        }
Пример #27
0
 NavigateDisposition IExplorerNode.Navigate(DeepLink deepLink)
 {
     return(deepLink.NodeType == NodeType.Info ? NavigateDisposition.Complete : NavigateDisposition.Next);
 }
Пример #28
0
 public override string ToString()
 {
     return("Price: " + ActualPrice + " from: " + OriginStation + " to: " + DestinationStation + " at: " + DepartureTime.ToString() + " Link: " + DeepLink.ToString());
 }
Пример #29
0
 public NavigateDisposition Navigate(DeepLink deepLink)
 {
     return(((IExplorerNode)WebNode).Navigate(deepLink));
 }
Пример #30
0
 public void Init(DeepLink receiver)
 {
 }