예제 #1
0
        protected void PageLoad()
        {
            var file = new File();

            try
            {
                ShareLink = Request[UrlConstant.DocUrlKey] ?? "";
                WithLink  = !string.IsNullOrEmpty(ShareLink);

                var fileId = WithLink ? (object)-1 : Request[UrlConstant.FileId];
                FileNew = !string.IsNullOrEmpty(Request[UrlConstant.New]) && Request[UrlConstant.New] == "true";

                file = DocumentUtils.EditIframeSrc(fileId, FileNew, ShareLink, out SrcIframe);

                if (SecurityContext.IsAuthenticated)
                {
                    var parent = Global.DaoFactory.GetFolderDao().GetFolder(file.FolderID);
                    if (file.RootFolderType == FolderType.USER &&
                        file.RootFolderCreator != SecurityContext.CurrentAccount.ID &&
                        !Global.GetFilesSecurity().CanRead(parent))
                    {
                        FolderUrl = PathProvider.GetFolderUrl(Global.FolderShare, false, null);
                    }
                    else
                    {
                        FolderUrl = PathProvider.GetFolderUrl(parent);

                        if (string.IsNullOrEmpty(FolderUrl))
                        {
                            FolderUrl = Request.UrlReferrer == null
                                            ? VirtualPathUtility.ToAbsolute(PathProvider.StartURL)
                                            : Request.UrlReferrer.ToString();
                        }

                        if (Global.EnableShare)
                        {
                            CommonContainerHolder.Controls.Add(LoadControl(AccessRights.Location));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Redirect(PathProvider.BaseVirtualPath + "docviewer.aspx" + "?" + Request.QueryString + "#" + UrlConstant.Error + "/" + HttpUtility.UrlEncode(ex.Message));
            }

            Title       = file.Title;
            FileId      = file.ID;
            FileTitle   = file.Title;
            FileVersion = file.Version;

            DocKeyForTrack = DocumentUtils.GetDocKey(file.ID, -1, DateTime.MinValue);

            using (var tagDao = Global.DaoFactory.GetTagDao())
            {
                tagDao.RemoveTags(Tag.New(SecurityContext.CurrentAccount.ID, file));
            }

            FileLocker.Add(file.ID);
        }
예제 #2
0
        protected void PageLoad()
        {
            File file;

            try
            {
                ShareLink = Request[UrlConstant.DocUrlKey] ?? "";
                WithLink  = !string.IsNullOrEmpty(ShareLink);

                var fileId = WithLink ? (object)-1 : Request[UrlConstant.FileId];
                FileNew = !string.IsNullOrEmpty(Request[UrlConstant.New]) && Request[UrlConstant.New] == "true";
                var ver = string.IsNullOrEmpty(Request[UrlConstant.Version]) ? -1 : Convert.ToInt32(Request[UrlConstant.Version]);

                file = DocumentUtils.GetServiceParams(false, fileId, ver, FileNew, ShareLink, out DocParams);
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                return;
                //var urlRedirect = Request.UrlReferrer == null
                //                      ? PathProvider.StartURL
                //                      : Request.UrlReferrer.ToString();

                //Response.Redirect(urlRedirect + "#" + UrlConstant.Error + "/" + HttpUtility.UrlEncode(ex.Message));
            }

            if (!FileUtility.UsingHtml5(file.Title, false))
            {
                Server.Transfer("viewer.aspx", true);
            }

            Title = file.Title;

            DocParams.Type = MobileDetector.IsRequestMatchesMobile(Context) ? "mobile" : "desktop";
            if (MobileDetector.IsRequestMatchesMobile(Context))
            {
                DocParams.FolderUrl = string.Empty;
            }

            DocKeyForTrack = DocumentUtils.GetDocKey(file.ID, -1, DateTime.MinValue);

            Global.DaoFactory.GetTagDao().RemoveTags(Tag.New(SecurityContext.CurrentAccount.ID, file));

            FilesActivityPublisher.OpenEditorFile(file);
        }
예제 #3
0
        protected void PageLoad()
        {
            var file = new File();

            try
            {
                ShareLink = Request[UrlConstant.DocUrlKey] ?? "";
                WithLink  = !string.IsNullOrEmpty(ShareLink);

                var fileId = WithLink ? (object)-1 : Request[UrlConstant.FileId];
                FileNew = !string.IsNullOrEmpty(Request[UrlConstant.New]) && Request[UrlConstant.New] == "true";

                file = DocumentUtils.GetServiceParams(true, fileId, 0, FileNew, ShareLink, out DocParams);
            }
            catch (Exception ex)
            {
                Response.Redirect(PathProvider.BaseVirtualPath + "docviewer.aspx" + "?" + Request.QueryString + "#" + UrlConstant.Error + "/" + HttpUtility.UrlEncode(ex.Message));
            }

            if (!FileUtility.UsingHtml5(file.Title))
            {
                Server.Transfer("editor.aspx", true);
            }

            Title = file.Title;

            DocParams.Type = MobileDetector.IsRequestMatchesMobile(Context) ? "mobile" : "desktop";

            DocKeyForTrack = DocumentUtils.GetDocKey(file.ID, -1, DateTime.MinValue);

            using (var tagDao = Global.DaoFactory.GetTagDao())
            {
                tagDao.RemoveTags(Tag.New(SecurityContext.CurrentAccount.ID, file));
            }

            FilesActivityPublisher.OpenEditorFile(file);

            FileLocker.Add(file.ID);
        }