예제 #1
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                if (base.SPObject != null)
                {
                    OpenActionResult oar = new OpenActionResult();
                    oar.Source   = this.SPObject.ToString();
                    oar.Language = "csharp";
                    return(oar);
                }
                else
                {
                    return(null);
                }

            case NodeActions.ExternalOpen:
                if (!string.IsNullOrEmpty(base.Url))
                {
                    return(base.RootNode.NodeConnector.Endpoint + base.Url);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #2
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                OpenActionResult oar = new OpenActionResult();
                oar.Source = File.ReadAllText(this.Url);
                oar.Url    = this.Url;
                var els = this.Url.Split('.');
                oar.Language = els[els.Length - 1];
                return(oar);

            case NodeActions.ExternalOpen:
                //for this we only need the path
                return(this.Url);

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (_file != null)
                {
                    return(_file);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #3
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            GithubConnector connector = (GithubConnector)this.RootNode.NodeConnector;

            switch (actionItem.Action)
            {
            case NodeActions.Open:
                OpenActionResult oar = new OpenActionResult();
                oar.Source = connector.GetSource(this.Url);
                var els = this.Url.Split('.');
                oar.Language = els[els.Length - 1];
                return(oar);

            case NodeActions.Save:

                return(connector.GetSource(this.Url));

            case NodeActions.Copy:
                if (actionItem.Name == "Copy link")
                {
                    return(this._file.html_url);
                }
                else
                {
                    return(null);
                }


            default:
                return(null);
            }
        }
예제 #4
0
파일: WebNode.cs 프로젝트: tomdam/spcoder
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = GetRealSPObject();
            Web realWeb = realObj as Web;

            realWeb.EnsureProperties(w => w.Url);

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    return(realWeb.Url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    string url = realWeb.Url;
                    return(url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Refresh:

                Site site = RootNode.SPObject as Site;
                Web  web  = site.OpenWeb(base.Url);
                web.Context.Load(web);
                web.Context.ExecuteQuery();
                realObject = web;
                return(this);

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #5
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:
                return(this.Url);

            default:
                return(null);
            }
        }
예제 #6
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = GetRealSPObject();

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    Web  objWeb = (Web)base.ParentNode.SPObject;
                    List list   = (List)realObj;
                    list.EnsureProperties(l => l.DefaultView.ServerRelativeUrl);

                    return(WebUtils.MakeAbsoluteUrl(objWeb, list.DefaultView.ServerRelativeUrl));
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    Web objWeb = (Web)base.ParentNode.SPObject;

                    List list = (List)realObj;
                    list.EnsureProperties(l => l.DefaultView.ServerRelativeUrl);

                    return(WebUtils.MakeAbsoluteUrl(objWeb, list.DefaultView.ServerRelativeUrl));
                }
                else
                {
                    return(null);
                }

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #7
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = GetRealSPObject();

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    SPWeb objWeb = (SPWeb)base.ParentNode.SPObject;

                    string url = objWeb.Url.Replace(objWeb.ServerRelativeUrl, ((SPList)realObj).DefaultView.ServerRelativeUrl);
                    return(url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    SPWeb objWeb = (SPWeb)base.ParentNode.SPObject;

                    string url = objWeb.Url.Replace(objWeb.ServerRelativeUrl, ((SPList)realObj).DefaultView.ServerRelativeUrl);
                    return(url);
                }
                else
                {
                    return(null);
                }

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #8
0
파일: SiteNode.cs 프로젝트: tomdam/spcoder
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObject != null)
                {
                    return(((Site)realObject).Url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObject != null && actionItem.Name == "Copy link")
                {
                    string url = ((Site)realObject).Url;
                    return(url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Refresh:

                //Site site = realObject;
                realObject.Context.Load(realObject);
                realObject.Context.ExecuteQuery();

                return(this);

            case NodeActions.Close:
                //clean
                //this.NodeConnector.
                Clean();
                return(this);

            default:
                return(null);
            }
        }
예제 #9
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = this.realObject;

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    return(realObj.Context.Url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    return(realObj.Context.Url);
                }
                else
                {
                    return(null);
                }

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #10
0
파일: SPWebNode.cs 프로젝트: tomdam/spcoder
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = GetRealSPObject();

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    return(((SPWeb)realObj).Url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    string url = ((SPWeb)realObj).Url;
                    return(url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Refresh:
                //check this
                SPSite site = RootNode.SPObject as SPSite;
                SPWeb  web  = site.OpenWeb(base.Url);

                realObject = web;
                return(this);

            default:
                return(null);
            }
        }
예제 #11
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                return(this._folder.html_url);

            case NodeActions.Copy:
                if (actionItem.Name == "Copy link")
                {
                    return(this._folder.html_url);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #12
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            switch (actionItem.Action)
            {
            case NodeActions.Open:
                if (base.SPObject != null)
                {
                    HtmlNode         node = (HtmlNode)base.SPObject;
                    OpenActionResult oar  = new OpenActionResult();
                    oar.Source   = node.OuterHtml;
                    oar.Language = "html";
                    return(oar);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #13
0
파일: FileNode.cs 프로젝트: tomdam/spcoder
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var  realObj  = this.SPObject;
            File thisFile = ((File)realObj);

            thisFile.EnsureProperties(f => f.ServerRelativeUrl);

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    Web objWeb = (Web)base.ParentNode.SPObject;

                    string url = objWeb.Url.Replace(objWeb.ServerRelativeUrl, thisFile.ServerRelativeUrl);
                    return(url);
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    if (base.ParentNode.SPObject is Folder)
                    {
                        // Parent is a folder
                        Folder parentFolder = (Folder)base.ParentNode.SPObject;
                        Web    objWeb       = parentFolder.ListItemAllFields.ParentList.ParentWeb;

                        return(WebUtils.MakeAbsoluteUrl(objWeb, thisFile.ServerRelativeUrl));
                    }
                    else if (base.ParentNode.SPObject is List)
                    {
                        // Parent list a list
                        List          parentList = (List)base.ParentNode.SPObject;
                        ClientContext ctx        = parentList.Context as ClientContext;

                        File file = parentList.RootFolder.GetFile(this.Title);
                        file.EnsureProperties(f => f.ServerRelativeUrl);

                        return(WebUtils.MakeAbsoluteUrl(ctx.Web, file.ServerRelativeUrl));
                    }
                    else
                    {
                        // Parent is a web
                        Web objParent = (Web)base.ParentNode.SPObject;
                        return(WebUtils.MakeAbsoluteUrl(objParent, thisFile.ServerRelativeUrl));
                    }
                }
                else
                {
                    return(null);
                }

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #14
0
 public AbortRequestItem(Item innerItem)
     : base(innerItem)
 {
     _BaseActionItem = new BaseActionItem(innerItem);
 }
예제 #15
0
 public virtual object ExecuteAction(BaseActionItem actionItem)
 {
     return(null);
 }
예제 #16
0
 public CustomResponseItem(Item innerItem)
     : base(innerItem)
 {
     _BaseActionItem = new BaseActionItem(innerItem);
 }
예제 #17
0
        public override object ExecuteAction(BaseActionItem actionItem)
        {
            var realObj = GetRealSPObject();

            switch (actionItem.Action)
            {
            case NodeActions.ExternalOpen:

                if (realObj != null)
                {
                    Web objWeb = (Web)base.ParentNode.SPObject;

                    return(WebUtils.MakeAbsoluteUrl(objWeb, ((Folder)realObj).ServerRelativeUrl));
                }
                else
                {
                    return(null);
                }

            case NodeActions.Copy:
                if (realObj != null && actionItem.Name == "Copy link")
                {
                    Folder thisfolder = (Folder)realObj;
                    thisfolder.EnsureProperties(f => f.ServerRelativeUrl);

                    if (base.ParentNode.SPObject is List)
                    {
                        // Parent is a List
                        List objList   = (List)base.ParentNode.SPObject;
                        Web  parentWeb = objList.ParentWeb;
                        return(WebUtils.MakeAbsoluteUrl(parentWeb, thisfolder.ServerRelativeUrl));
                    }
                    else if (base.ParentNode.SPObject is Web)
                    {
                        // Parent is a web
                        Web objParent = (Web)base.ParentNode.SPObject;
                        return(WebUtils.MakeAbsoluteUrl(objParent, thisfolder.ServerRelativeUrl));
                    }
                    else
                    {
                        // Parent is a folder
                        Folder parentFolder = (Folder)base.ParentNode.SPObject;
                        Web    objWeb       = parentFolder.ListItemAllFields.ParentList.ParentWeb;
                        return(WebUtils.MakeAbsoluteUrl(objWeb, thisfolder.ServerRelativeUrl));
                    }
                }
                else
                {
                    return(null);
                }

            //for plugins always return the real object
            case NodeActions.Plugin:
                if (realObj != null)
                {
                    return(realObj);
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }