CopyViewLocal() public static method

public static CopyViewLocal ( string listPath, string viewPath ) : ViewBase
listPath string
viewPath string
return SenseNet.Portal.UI.ContentListViews.Handlers.ViewBase
示例#1
0
        public static void CopyViewLocal(Content content, string listPath, string viewPath, string back)
        {
            if (string.IsNullOrEmpty(listPath))
            {
                throw new ArgumentNullException(nameof(listPath));
            }
            if (string.IsNullOrEmpty(viewPath))
            {
                throw new ArgumentNullException(nameof(viewPath));
            }

            ViewManager.CopyViewLocal(listPath, viewPath, true);
            HttpContext.Current.Response.Redirect(back, true);
        }
        public ActionResult CopyViewLocal(string listPath, string viewPath, string back)
        {
            if (string.IsNullOrEmpty(listPath))
            {
                throw new ArgumentNullException("listPath");
            }
            if (string.IsNullOrEmpty(viewPath))
            {
                throw new ArgumentNullException("viewPath");
            }

            listPath = HttpUtility.UrlDecode(listPath);
            viewPath = HttpUtility.UrlDecode(viewPath);
            back     = HttpUtility.UrlDecode(back);

            ViewManager.CopyViewLocal(listPath, viewPath, true);

            return(Redirect(HttpUtility.UrlDecode(back)));
        }
示例#3
0
        public static void AddToDefaultView(FieldSetting fieldSetting, ContentList contentList)
        {
            if (fieldSetting == null || contentList == null)
            {
                return;
            }

            var iv = LoadDefaultView(contentList) as IView;

            if (iv == null)
            {
                return;
            }

            var viewNode = iv as Node;

            if (viewNode == null)
            {
                return;
            }

            //if the view is global, create local copy first
            if (!viewNode.Path.StartsWith(contentList.Path))
            {
                viewNode = ViewManager.CopyViewLocal(contentList.Path, viewNode.Path, true);
                iv       = viewNode as IView;
            }

            fieldSetting.Owner = ContentType.GetByName("ContentList");

            iv.AddColumn(new Column
            {
                FullName    = fieldSetting.FullName,
                BindingName = fieldSetting.BindingName,
                Title       = fieldSetting.DisplayName,
                Index       = iv.GetColumns().Count() + 1
            });

            viewNode.Save();
        }