private void BindTree() { TreeView1.MultipleSelectEnabled = false; TreeView1.DragAndDropEnabled = false; TreeView1.KeyboardEnabled = true; TreeView1.NodeEditingEnabled = false; TreeView1.KeyboardCutCopyPasteEnabled = false; TreeView1.ShowLines = true; TreeView1.DisplayMargin = false; TreeViewNode rootNode = new TreeViewNode(); rootNode.Text = "Projects"; rootNode.Selectable = false; rootNode.CssClass = "TreeNodeGray"; rootNode.HoverCssClass = "TreeNodeGray"; DataTable dt = Project.GetListActiveProjectsByUserDataTable(); // ActiveProjectsByUserOnlyDataTable(); foreach (DataRow dr in dt.Rows) { string ContainerKey = Mediachase.IBN.Business.UserRoleHelper.CreateProjectContainerKey((int)dr["ProjectId"]); bic = BaseIbnContainer.Create("FileLibrary", ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); ProcessFolderNode(rootNode, ContainerKey, fs.Root.Id, dr["Title"].ToString(), true); } TreeView1.Nodes.Add(rootNode); TreeView1.ExpandAll(); }
protected void Page_Load(object sender, System.EventArgs e) { UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css"); UtilHelper.RegisterScript(Page, "~/Scripts/browser.js"); UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js"); if (Request["PrimaryKeyId"] != null) { string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); FolderId = int.Parse(elem[1]); ContainerName = elem[2]; ContainerKey = elem[3]; } bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); rfTitle.ErrorMessage = LocRM.GetString("Required"); cvTitle.ErrorMessage = LocRM.GetString("tDuplicateName"); if (!IsPostBack) { BindValues(); } btnSave.Text = LocRM.GetString("Save"); btnCancel.Text = LocRM.GetString("Cancel"); btnSave.Attributes.Add("onclick", "DisableButtons(this);"); btnCancel.Attributes.Add("onclick", "window.close()"); btnSave.CustomImage = this.Page.ResolveUrl("~/layouts/images/saveitem.gif"); }
public FileInfo(FileStorage ownerFileStorage, IDataReader reader) : this(reader) { _ownerFileStorage = ownerFileStorage; if(ownerFileStorage!=null && ownerFileStorage.OwnerContainer!=null) _containerKey = ownerFileStorage.OwnerContainer.Key; }
public ArrayList DeleteAttachment(string _guid, string _id) { string sFiles = ""; ArrayList values = new ArrayList(); string _containerName = "FileLibrary"; string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(_containerName, _containerKey); CS.FileStorage fs = (CS.FileStorage)bic.LoadControl("FileStorage"); fs.DeleteFile(int.Parse(_id)); CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, _guid, false); if (di != null) { CS.FileInfo[] _fi = fs.GetFiles(di); foreach (CS.FileInfo fi in _fi) { sFiles += String.Format(CultureInfo.InvariantCulture, "<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'> {1} <img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>", CHelper.GetAbsolutePath("/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId), Util.CommonHelper.GetShortFileName(fi.Name, 40), CHelper.GetAbsolutePath("/Layouts/Images/delete.gif"), fi.Id, LocRM.GetString("Delete")); } } values.Add(sFiles); return(values); }
void grdMain_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Select") { int selId = int.Parse(e.Item.Cells[0].Text); string containerKey = "EMailAttach"; CS.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(ContainerName, containerKey); CS.FileStorage fs2 = (CS.FileStorage)bic2.LoadControl("FileStorage"); CS.DirectoryInfo di = fs2.GetDirectory(fs2.Root.Id, guid, true); try { fs.CopyFile(selId, di.Id); } catch { } string sFiles = ""; CS.FileInfo[] _fi = fs2.GetFiles(di); foreach (CS.FileInfo fi in _fi) { sFiles += String.Format("<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'/> {1} <img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>", ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId), Util.CommonHelper.GetShortFileName(fi.Name, 40), ResolveUrl("~/Layouts/Images/delete.gif"), fi.Id, LocRM.GetString("tDelete")); } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\");", sFiles), true); } }
public ArrayList GetFileExistence(string fName, string ContainerName, string ContainerKey, string ParentFolderId) { ArrayList values = new ArrayList(); string sFName = fName; if (sFName.LastIndexOf("\\") >= 0) { sFName = sFName.Substring(sFName.LastIndexOf("\\") + 1); } Mediachase.IBN.Business.ControlSystem.BaseIbnContainer bic = Mediachase.IBN.Business.ControlSystem.BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); if (fs.FileExist(sFName, int.Parse(ParentFolderId))) { if (fs.GetFile(int.Parse(ParentFolderId), sFName).AllowHistory) { values.Add(2); } else { values.Add(1); } } else { values.Add(0); } return(values); }
protected void Page_Load(object sender, System.EventArgs e) { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage"); ApplyLocalization(); if (!Page.IsPostBack) { if (_pc["fl_Sort_" + _containerKey] == null) { _pc["fl_Sort_" + _containerKey] = "sortName"; } if (_pc["fs_List_ViewStyle"] == null) { _pc["fs_List_ViewStyle"] = "ListView"; } if (Top <= 0) { BindDefaultValues(); } else { trFilter.Visible = false; } } if (Top <= 0) { BindSavedValues(); BindInfoTable(); } BindList(); BindToolbar(); }
private void GetCurrentFolder() { _fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(_containerName, _containerKey); if (!IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) { _folderId = int.Parse(Request["FolderId"]); } else if (_folderId < 0 && _pc["fs_FolderId_" + _containerKey] != null) { int iFolder = int.Parse(_pc["fs_FolderId_" + _containerKey]); DirectoryInfo di = _fs.GetDirectory(iFolder); if (di != null) { _folderId = iFolder; } else { _folderId = _fs.Root.Id; } } else { _folderId = _fs.Root.Id; } _rootId = _fs.Root.Id; _pc["fs_FolderId_" + _containerKey] = _folderId.ToString(); }
private void BindJsTree() { string containerName = Request["ContainerName"]; string containerKey = Request["ContainerKey"]; string folderId = Request["FolderId"]; Mediachase.IBN.Business.ControlSystem.FileStorage fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(containerName, containerKey); ArrayList parentList = new ArrayList(); if (!String.IsNullOrEmpty(folderId)) { int iFolder = int.Parse(folderId); while (true) { DirectoryInfo diEx = fs.GetDirectory(iFolder); parentList.Add(diEx.Id); if (iFolder == fs.Root.Id) { break; } iFolder = diEx.ParentDirectoryId; } } BindNode(fs.Root.Id.ToString(), parentList); }
private void BindToolBarAndButtons() { tbView.AddText(LocRM.GetString("QuickTracking")); // O.R. [2009-05-25]: DisableButtons function doesn't work with CausesValidation property /* * btnComplete.Attributes.Add("onclick","DisableButtons(this);"); * btnSuspend.Attributes.Add("onclick","DisableButtons(this);"); * btnUncomplete.Attributes.Add("onclick","DisableButtons(this);"); * btnResume.Attributes.Add("onclick","DisableButtons(this);"); * btnDecline.Attributes.Add("onclick","DisableButtons(this);"); * btnAccept.Attributes.Add("onclick","DisableButtons(this);"); * btnActivate.Attributes.Add("onclick","DisableButtons(this);"); */ string ContainerKey = "DocumentVers_" + DocumentID.ToString(); string ContainerName = "FileLibrary"; BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); string commandLink = (Security.CurrentUser.IsExternal) ? "~/External/FileUpload.aspx" : "~/FileStorage/FileUpload.aspx"; string link = String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}{4}', 470, 270);return false;", ResolveUrl(commandLink), fs.Root.Id, ContainerKey, ContainerName, (Security.CurrentUser.IsExternal) ? ("&ExternalId=" + Security.CurrentUser.UserID) : ""); btnNewVersion.Attributes.Add("onclick", link); }
private void GetCurrentFolder() { ContainerKey = ViewState["ContainerKey"].ToString(); bic = CS.BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (CS.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) { FolderId = int.Parse(Request["FolderId"]); } else if (FolderId < 0 && pc["fs_FolderId_" + ContainerKey] != null) { int iFolder = int.Parse(pc["fs_FolderId_" + ContainerKey]); CS.DirectoryInfo di = fs.GetDirectory(iFolder); if (di != null) { FolderId = iFolder; } else { FolderId = fs.Root.Id; } } else { FolderId = fs.Root.Id; } RootId = fs.Root.Id; pc["fs_FolderId_" + ContainerKey] = FolderId.ToString(); }
private void GetCurrentFolderAndMoveObjects() { bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); string sFolders = Request["Folders"].ToString(); string sFiles = Request["Files"].ToString(); while (sFolders.Length > 0) { alFolders.Add(sFolders.Substring(0, sFolders.IndexOf(","))); sFolders = sFolders.Remove(0, sFolders.IndexOf(",") + 1); } while (sFiles.Length > 0) { alFiles.Add(sFiles.Substring(0, sFiles.IndexOf(","))); sFiles = sFiles.Remove(0, sFiles.IndexOf(",") + 1); } if (alFolders.Count > 0) { ParentFolderId = fs.GetDirectory(int.Parse(alFolders[0].ToString())).ParentDirectoryId; } else if (alFiles.Count > 0) { int i = int.Parse(alFiles[0].ToString()); FileInfo fi = fs.GetFile(i); ParentFolderId = fi.ParentDirectoryId; } ctrlDirTree.DisFolderId = ParentFolderId; }
protected void grdMain_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Select") { int selId = int.Parse(e.Item.Cells[0].Text); string sText = ""; string sTitle = ""; using (IDataReader reader = Mediachase.IBN.Business.Common.GetArticle(selId)) { if (reader.Read()) { sTitle = reader["Question"].ToString(); sText = String.Format("<div style='border-top: solid 1px #95B7F3; padding:0px;background-color:ffffe1;'>" + "<div style='padding:5px; cursor:default;background-color:#FFD275;'><b>{0}</b></div>" + "<div style='padding:5px;'>{1}</div>" + "</div>", reader["Question"].ToString(), reader["AnswerHTML"].ToString()); } } Common.AddHistory(ObjectTypes.KnowledgeBase, selId, sTitle); Common.IncreaseArticleCounter(selId); string sFiles = ""; string containerName = "FileLibrary"; string containerKey = UserRoleHelper.CreateArticleContainerKey(selId); CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(containerName, containerKey); CS.FileStorage fs = (CS.FileStorage)bic.LoadControl("FileStorage"); CS.FileInfo[] _fi = fs.Root.GetFiles(); if (_fi.Length > 0) { string _containerName = "FileLibrary"; string _containerKey = "EMailAttach"; CS.BaseIbnContainer _bic = CS.BaseIbnContainer.Create(_containerName, _containerKey); CS.FileStorage _fs = (CS.FileStorage)_bic.LoadControl("FileStorage"); CS.DirectoryInfo di = _fs.GetDirectory(_fs.Root.Id, guid, true); foreach (CS.FileInfo fi in _fi) { fs.CopyFile(fi.Id, di.Id, true); } _fi = _fs.GetFiles(di); foreach (CS.FileInfo fi in _fi) { sFiles += String.Format("<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'> {1} <img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>", ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId), Util.CommonHelper.GetShortFileName(fi.Name, 40), ResolveUrl("~/Layouts/Images/delete.gif"), fi.Id, LocRM2.GetString("tDelete")); } } sText = sText.Replace("\r\n", ""); sText = sText.Replace("\t", ""); sText = sText.Replace("\\", "\\\\"); sText = sText.Replace("\"", "\\\""); Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\", \"{1}\");", sFiles, sText), true); } }
private void BindValues() { BaseIbnContainer bic = BaseIbnContainer.Create("FileLibrary", "Workspace"); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); ctrlDirTree.DisFolderId = fs.Root.Id; }
private void GetCurrentFolderAndMoveObjects() { fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(ContainerName, ContainerKey); if (Request["ParentFolderId"] != null) { ctrlDirTree.DisFolderId = int.Parse(Request["ParentFolderId"]); } }
private void BindDGFiles(string Keyword) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Id", typeof(int))); dt.Columns.Add(new DataColumn("Title", typeof(string))); dt.Columns.Add(new DataColumn("_Href", typeof(string))); dt.Columns.Add(new DataColumn("_New", typeof(int))); dt.Columns.Add(new DataColumn("Location", typeof(string))); DataRow dr; FileInfo[] _fi = Mediachase.IBN.Business.ControlSystem.FileStorage.SearchFiles(Security.CurrentUser.UserID, -1, -1, Keyword, -1, DateTime.MinValue, DateTime.MinValue, -1, -1); foreach (FileInfo fi in _fi) { dr = dt.NewRow(); dr["Id"] = fi.Id; dr["Title"] = Util.CommonHelper.GetShortFileName(fi.Name, 40); string sLink = ""; if (fi.FileBinaryContentType.ToLower().IndexOf("url") >= 0) { sLink = GetLinkText(fi); } if (sLink == "") { //sLink = Util.CommonHelper.GetAbsolutePath(Mediachase.IBN.Business.ControlSystem.WebDavFileUserTicket.GetDownloadPath(fi.Id, fi.Name)); sLink = WebDavUrlBuilder.GetFileStorageWebDavUrl(fi, true); } dr["_Href"] = sLink; dr["_New"] = Common.OpenInNewWindow(fi.FileBinaryContentType) ? 1 : 0; string containerKey = fi.ContainerKey; BaseIbnContainer bic = BaseIbnContainer.Create("FileLibrary", containerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); string parentName = ""; string parentLink = ""; Util.CommonHelper.GetParentContainer(containerKey, fi.ParentDirectory, out parentName, out parentLink); dr["Location"] = parentName; dt.Rows.Add(dr); } dgFiles.DataSource = dt.DefaultView; dgFiles.DataBind(); int RowCount = dgFiles.Items.Count; if (RowCount == 0) { Sep6.Visible = false; Pan6.Visible = false; } else { Sep6.Title = String.Format("{0} ({1})", LocRM.GetString("Files"), RowCount); } }
protected void Page_Load(object sender, System.EventArgs e) { int iIconId = -1; if (CTypeId > 0) { using (IDataReader reader = Mediachase.IBN.Business.ContentType.GetContentType(CTypeId)) { if (reader.Read()) { if (Big && reader["BigIconFileId"] != DBNull.Value) { iIconId = (int)reader["BigIconFileId"]; } if (!Big && reader["IconFileId"] != DBNull.Value) { iIconId = (int)reader["IconFileId"]; } } } } Response.ContentType = "image/jpeg"; if (Big && Request["ContainerKey"] != null && Request["FileId"] != null) { string CKey = Request["ContainerKey"].ToString(); int FId = int.Parse(Request["FileId"].ToString()); Size sz = new Size(90, 90); if (Mediachase.IBN.Business.ImageThumbnail.Create(ImageThumbnailMode.SaveProportion | ImageThumbnailMode.SkipSmallImage, CKey, FId, sz, System.Drawing.Imaging.ImageFormat.Jpeg, Response.OutputStream)) { return; } } if (iIconId > 0) { string ContainerName = "FileLibrary"; string ContainerKey = "ContentType"; BaseIbnContainer bic = BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); FileInfo fi = fs.GetFile(iIconId); Response.AddHeader("content-disposition", String.Format("inline; filename=\"{0}\"", GetNameForCurrentBrowser(fi.Name))); Mediachase.IBN.Business.ControlSystem.FileStorage.LightLoadFile(fi, Response.OutputStream); } else { if (Big) { Response.Redirect("~/Layouts/Images/filetypes/unknown48.gif"); } else { Response.Redirect("~/Layouts/Images/filetypes/unknown16.gif"); } } }
private void ApplyValues() { if (Request["PrimaryKeyId"] != null) { string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); FileId = int.Parse(elem[1]); ContainerName = elem[2]; ContainerKey = elem[3]; } bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); }
public FileHistoryInfo(FileStorage ownerFileStorage, IDataReader reader) { _ownerFileStorage = ownerFileStorage; _Id = (int)reader["Id"]; _fileId = (int)reader["FileId"]; _name = (string)reader["Name"]; _modifierId = (int)reader["ModifierId"]; _modified = (DateTime)reader["Modified"]; _filebinaryId = (reader["FileBinaryId"]==DBNull.Value) ? 0 : (int)reader["FileBinaryId"]; _length = (reader["Length"]==DBNull.Value) ? 0 : (int)reader["Length"]; _contentType = (reader["ContentTypeString"]==DBNull.Value ? String.Empty : (string)reader["ContentTypeString"]); _contentTypeId = (reader["ContentTypeId"]==DBNull.Value ? 0 : (int)reader["ContentTypeId"]); }
/// <summary> /// Initializes a new instance of the <see cref="T:DirectoryInfo"/> class. /// </summary> /// <param name="ownerFileStorage">The owner file storage.</param> /// <param name="reader">The reader.</param> public DirectoryInfo(FileStorage ownerFileStorage, IDataReader reader) { _ownerFileStorage = ownerFileStorage; _id = (int)reader["DirectoryId"]; _name = (string)reader["Name"]; _creatorId = (int)SqlHelper.DBNull2Null(reader["CreatorId"],0); _created = (DateTime)SqlHelper.DBNull2Null(reader["Created"], DateTime.Now); _modifierId = (int)SqlHelper.DBNull2Null(reader["ModifierId"],0); _modified = (DateTime)SqlHelper.DBNull2Null(reader["Modified"], DateTime.Now); _parentDirectoryId = (int)SqlHelper.DBNull2Null(reader["ParentDirectoryId"],-1); }
private void btnPublish_ServerClick(object sender, EventArgs e) { int iDestFolder = -1; try { iDestFolder = ctrlDirTree.FolderId; } catch { } if (iDestFolder == -1) { lblNotValid.Visible = true; return; } BaseIbnContainer sourceBic = BaseIbnContainer.Create(ContainerName, ContainerKey); Mediachase.IBN.Business.ControlSystem.FileStorage sourceFS = (Mediachase.IBN.Business.ControlSystem.FileStorage)sourceBic.LoadControl("FileStorage"); FileInfo sourceFi = sourceFS.GetFile(FileId); string cKey = DirectoryInfo.GetContainerKey(iDestFolder); if (String.IsNullOrEmpty(cKey)) { cKey = "Workspace"; } BaseIbnContainer destBic = BaseIbnContainer.Create("FileLibrary", cKey); Mediachase.IBN.Business.ControlSystem.FileStorage destFS = (Mediachase.IBN.Business.ControlSystem.FileStorage)destBic.LoadControl("FileStorage"); DirectoryInfo destDi = destFS.GetDirectory(iDestFolder); try { destFS.CopyFile(sourceFi, destDi); } catch (SqlException exception) { if (exception.Number == 2627 || exception.Number == 50000) { lblErrorMessage.Text = LocRM.GetString("tDuplicateName"); trError.Visible = true; return; } } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "try {window.opener.location.href=window.opener.location.href;window.close();}" + "catch (e){}", true); }
private void BindData() { string ContainerKey = "Workspace"; bic = BaseIbnContainer.Create("FileLibrary", ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); TreeViewNode rootNode = new TreeViewNode(); rootNode.Text = LocRM.GetString("tRoot"); ProcessFolderNode(rootNode, ContainerKey, fs.Root.Id, LocRM.GetString("tRoot"), false); TreeView1.Nodes.Add(rootNode); }
protected void Page_Load(object sender, System.EventArgs e) { UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css"); UtilHelper.RegisterScript(Page, "~/Scripts/browser.js"); UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js"); Response.Cache.SetNoStore(); bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack) { BindDG(); } }
private void GetDocumentId() { if (DocumentId <= 0 && ToDoId > 0) { using (IDataReader reader = Mediachase.IBN.Business.ToDo.GetToDo(ToDoId, false)) { if (reader.Read()) { if (reader["DocumentId"] != DBNull.Value) { DocumentId = (int)reader["DocumentId"]; } } } } ContainerKey = "DocumentVers_" + DocumentId.ToString(); _bic = BaseIbnContainer.Create(ContainerName, ContainerKey); _fs = (FileStorage)_bic.LoadControl("FileStorage"); }
protected void Page_Load(object sender, System.EventArgs e) { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage"); if (!Page.IsPostBack) { BindLists(); ViewState["fls_Sort"] = _sort; if (_pc["fs_Search_ViewStyle"] == null) { _pc["fs_Search_ViewStyle"] = "ListView"; } } else { BindSavedValues(); BindDG(); } }
private void grdMain_ItemDataBound(object sender, DataGridItemEventArgs e) { if (Top > 0) { return; } else { DataGridItem item = e.Item; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.EditItem) { string containerKey1 = item.Cells[1].Text; BaseIbnContainer bic = BaseIbnContainer.Create("FileLibrary", containerKey1); Mediachase.IBN.Business.ControlSystem.FileStorage fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); DirectoryInfo di = fs.GetDirectory(int.Parse(item.Cells[2].Text)); string parentName = ""; string parentLink = ""; Util.CommonHelper.GetParentContainer(containerKey1, di, out parentName, out parentLink); item.Cells[5].Text = parentLink; } } }
private void ApplyValues() { if (Request["PrimaryKeyId"] != null) { string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); FileId = int.Parse(elem[1]); ContainerName = elem[2]; ContainerKey = elem[3]; } bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); btnSave.Text = LocRM.GetString("Save"); btnCancel.Text = LocRM.GetString("Cancel"); btnSave.Attributes.Add("onclick", "DisableButtons(this);"); btnCancel.Attributes.Add("onclick", "window.close()"); btnSave.CustomImage = this.Page.ResolveUrl("~/layouts/images/saveitem.gif"); rfTitle.ErrorMessage = LocRM.GetString("Required"); cvTitle.ErrorMessage = LocRM.GetString("tDuplicateName"); cvInvalidChars.ErrorMessage = "*"; cbKeepHistory.Text = LocRM.GetString("tKeepHistory"); if (LinkId == 0 && ParentFolderId >= 0) { trLink.Visible = true; } else { trLink.Visible = false; } if (!ShowHistory) { cbKeepHistory.Visible = false; } }
private void ApplyAttributes() { if (Request["PrimaryKeyId"] != null) { string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); FolderId = int.Parse(elem[1]); ContainerName = elem[2]; ContainerKey = elem[3]; } bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); btnSave.Attributes.Add("onclick", "DisableButtons(this);DisableCheck();"); btnAdd.InnerText = LocRM.GetString("tAdd"); dgMembers.Columns[1].HeaderText = LocRM.GetString("tName"); dgMembers.Columns[2].HeaderText = LocRM.GetString("Rights"); dgMembers.Columns[3].HeaderText = LocRM.GetString("tAllow"); //dgMembers.Columns[4].HeaderText = LocRM.GetString("tDeny"); lgdPModal.InnerText = LocRM.GetString("Security"); lgdLostRights.InnerText = LocRM.GetString("tAttention"); }
private void Process() { string _containerName = "FileLibrary"; string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(_containerName, _containerKey); CS.FileStorage fs = (CS.FileStorage)bic.LoadControl("FileStorage"); CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, guid, true); for (int Index = 0; Index < Request.Files.Count; Index++) { if (!String.IsNullOrEmpty(Request.Files[Index].FileName)) { using (McHttpPostedFile PostedFile = new McHttpPostedFile(Request.Files[Index])) { if (PostedFile.InputStream != null) { fs.SaveFile(di.Id, PostedFile.FileName, PostedFile.InputStream); } } } } }
void lbSelectChecked_Click(object sender, EventArgs e) { string sIds = hidForSelect.Value; ArrayList alIds = new ArrayList(); while (sIds.Length > 0) { alIds.Add(sIds.Substring(0, sIds.IndexOf(","))); sIds = sIds.Remove(0, sIds.IndexOf(",") + 1); } string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(ContainerName, _containerKey); CS.FileStorage fs2 = (CS.FileStorage)bic2.LoadControl("FileStorage"); CS.DirectoryInfo di = fs2.GetDirectory(fs2.Root.Id, guid, true); foreach (string scId in alIds) { int assetID = int.Parse(scId); try { fs.CopyFile(assetID, di.Id); } catch { } } string sFiles = ""; CS.FileInfo[] _fi = fs2.GetFiles(di); foreach (CS.FileInfo fi in _fi) { sFiles += String.Format("<div style='padding-bottom:1px;'><img align='absmiddle' src='{0}' width='16' height='16'/> {1} <img src='{2}' align='absmiddle' width='16' height='16' style='cursor:pointer;' onclick='_deleteFile({3})' title='{4}' /></div>", ResolveUrl("~/Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId), Util.CommonHelper.GetShortFileName(fi.Name, 40), ResolveUrl("~/Layouts/Images/delete.gif"), fi.Id, LocRM.GetString("tDelete")); } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), String.Format("CloseAll(\"{0}\");", sFiles), true); }
private void BindFiles() { dgFiles.Columns[1].HeaderText = LocRM.GetString("Title"); dgFiles.Columns[2].HeaderText = LocRM.GetString("Size"); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("FileId", typeof(int))); dt.Columns.Add(new DataColumn("FileName", typeof(string))); dt.Columns.Add(new DataColumn("Icon", typeof(string))); dt.Columns.Add(new DataColumn("Size", typeof(string))); Mediachase.IBN.Business.ControlSystem.FileStorage fileStorage = IssueRequest.GetFileStorage(RequestId); foreach (Mediachase.IBN.Business.ControlSystem.FileInfo fi in fileStorage.GetFiles(fileStorage.Root)) { dr = dt.NewRow(); dr["FileId"] = fi.Id; dr["Icon"] = "../Common/ContentIcon.aspx?IconID=" + fi.FileBinaryContentTypeId; dr["FileName"] = String.Format("<a href=\"../FileStorage/DownloadFile.aspx?Id={0}&CName=Pop3MailRequest&CKey=Pop3MailRequestId_{1}\">{2}</a>", fi.Id, RequestId, fi.Name); dr["Size"] = Mediachase.UI.Web.Util.CommonHelper.ByteSizeToStr(fi.Length); dt.Rows.Add(dr); } dgFiles.DataSource = new DataView(dt); dgFiles.DataBind(); /* foreach (DataGridItem dgi in dgFiles.Items) * { * ImageButton ib = (ImageButton)dgi.FindControl("ibDelete"); * if (ib!=null) * ib.Attributes.Add("onclick","return confirm('"+ LocRM.GetString("Warning") +"')"); * } */ }
void BindDefaultValues() { txtFolder.Text = ""; int iFolderId = -1; try{ iFolderId = int.Parse(txtFolderId.Value); } catch { return; } string ContainerKey = txtContainerKey.Value; //if(ContainerKey == "") // return; bic = BaseIbnContainer.Create("FileLibrary", ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); string name = "unknown"; if (iFolderId == fs.Root.Id) { if (ContainerKey.LastIndexOf("_") > 0) { int ProjectId = -1; try { ProjectId = int.Parse(ContainerKey.Substring(ContainerKey.LastIndexOf("_") + 1)); } catch {} if (ProjectId != -1) { using (IDataReader reader = Project.GetProject(ProjectId)) { reader.Read(); if (reader["Title"] != null) { name = reader["Title"].ToString(); } } } } else { name = LocRM.GetString("tRoot"); } } else { DirectoryInfo di = fs.GetDirectory(iFolderId); if (di != null) { name = di.Name; } else { ContainerKey = ""; FolderId = -1; return; } } // name = fs.GetDirectory(iFolderId).Name; System.IO.StringWriter writer = new System.IO.StringWriter(); Server.HtmlDecode(name, writer); string decoded = writer.ToString(); txtFolder.Text = decoded; }
private void GetDocumentId() { if (DocumentId <= 0 && ToDoId > 0) { using (IDataReader reader = Mediachase.IBN.Business.ToDo.GetToDo(ToDoId, false)) { if (reader.Read()) { if (reader["DocumentId"] != DBNull.Value) DocumentId = (int)reader["DocumentId"]; } } } ContainerKey = "DocumentVers_" + DocumentId.ToString(); _bic = BaseIbnContainer.Create(ContainerName, ContainerKey); _fs = (FileStorage)_bic.LoadControl("FileStorage"); }
private void BindTree() { TreeView1.MultipleSelectEnabled = false; TreeView1.DragAndDropEnabled = false; TreeView1.KeyboardEnabled = true; TreeView1.NodeEditingEnabled = false; TreeView1.KeyboardCutCopyPasteEnabled = false; TreeView1.ShowLines = true; TreeView1.DisplayMargin = false; TreeViewNode rootNode = new TreeViewNode(); rootNode.Text = "Projects"; rootNode.Selectable = false; rootNode.CssClass = "TreeNodeGray"; rootNode.HoverCssClass = "TreeNodeGray"; DataTable dt = Project.GetListActiveProjectsByUserDataTable();// ActiveProjectsByUserOnlyDataTable(); foreach (DataRow dr in dt.Rows) { string ContainerKey = Mediachase.IBN.Business.UserRoleHelper.CreateProjectContainerKey((int)dr["ProjectId"]); bic = BaseIbnContainer.Create("FileLibrary", ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); ProcessFolderNode(rootNode, ContainerKey, fs.Root.Id, dr["Title"].ToString(), true); } TreeView1.Nodes.Add(rootNode); TreeView1.ExpandAll(); }
protected void UploadMsgFile(FileStorage storage, int FolderId, int UserId, Pop3Message message) { System.Reflection.Assembly asm = typeof(FileExtendedPop3MessageHandler).Assembly; using (Stream stream = asm.GetManifestResourceStream("Mediachase.IBN.Business.Resources.template.msg")) { using(MemoryStream memStream = new MemoryStream()) { using (MsgHelper helper = new MsgHelper(stream)) { //helper.SetHtmlBody(message.From.Email); helper.SetSubject(message.Subject); helper.SetBody(message.BodyText); if (message.BodyHtml==null || message.BodyHtml.Trim()==String.Empty) { helper.SetHtmlBody(message.BodyText); } else helper.SetHtmlBody(message.BodyHtml); MailAddress from = message.Sender; if (from == null) from = message.From; helper.SetSenderEmail(from.Address); helper.SetSenderName(from.DisplayName); helper.SetReceiverName(message.To); helper.SetDisplayTo(message.To); helper.SetCreationTimes(DateTime.UtcNow); helper.Commit(); helper.createMSG(memStream); memStream.Flush(); memStream.Seek(0,SeekOrigin.Begin); string FileName = "Original_Message.msg"; int index = 0; while (storage.FileExist(FileName, FolderId)) { FileName = String.Format("Original_Message{0}.msg", index++); } storage.SaveFile(FolderId, FileName, string.Empty, UserId, DateTime.Now, memStream); } } } }
protected void UploadMhtFile(FileStorage storage, int FolderId, int UserId, Pop3Message message) { MHTHelper helper = new MHTHelper(message); using(MemoryStream memStream = new MemoryStream()) { using (StreamWriter writer = new StreamWriter(memStream)) { helper.CreateMHT(writer); writer.Flush(); memStream.Seek(0,SeekOrigin.Begin); string FileName = "Original_Message.mht"; int index = 0; while (storage.FileExist(FileName, FolderId)) { FileName = String.Format("Original_Message{0}.mht", index++); } storage.SaveFile(FolderId, FileName, string.Empty, UserId, DateTime.Now, memStream); } } }
protected void Page_Load(object sender, System.EventArgs e) { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage"); ApplyLocalization(); if (!Page.IsPostBack) { if (_pc["fl_Sort_" + _containerKey] == null) _pc["fl_Sort_" + _containerKey] = "sortName"; if (_pc["fs_List_ViewStyle"] == null) _pc["fs_List_ViewStyle"] = "ListView"; if (Top <= 0) BindDefaultValues(); else trFilter.Visible = false; } if (Top <= 0) { BindSavedValues(); BindInfoTable(); } BindList(); BindToolbar(); }
private void BindValues() { ddlPriority.DataSource = Incident.GetListPriorities(); ddlPriority.DataTextField = "PriorityName"; ddlPriority.DataValueField = "PriorityId"; ddlPriority.DataBind(); ddlProjects.DataSource = Incident.GetListProjects(); ddlProjects.DataTextField = "Title"; ddlProjects.DataValueField = "ProjectId"; ddlProjects.DataBind(); ListItem liNew = new ListItem(LocRM.GetString("ProjectNotSet"), "-1"); ddlProjects.Items.Insert(0, liNew); ddlProjects.DataSource = null; ddlProjects.DataBind(); ClearMHTCache(Server.MapPath(CommonHelper.ChartPath)); /// Pop3MailRequestId, Sender, SenderIbnUserId, FirstName, LastName, Subject, InnerText, /// Priority, PriorityName, Pop3BoxId, Received, MhtFileId, SenderType, Pop3BoxName using (IDataReader rdr = IssueRequest.Get(RequestId)) { if (rdr.Read()) { txtSubject.Text = rdr["Subject"].ToString(); txtDescription.Text = rdr["InnerText"].ToString(); Pop3BoxId = (int)rdr["Pop3BoxId"]; CommonHelper.SafeSelect(ddlPriority, rdr["Priority"].ToString()); if (rdr["SenderIbnUserId"] != DBNull.Value) { lblSender.Text = CommonHelper.GetUserStatus((int)rdr["SenderIbnUserId"]); lblText.Text = LocRM.GetString("ADText"); btnApproveCrete.Visible = false; } else { if (rdr["FirstName"].ToString() != String.Empty || rdr["LastName"].ToString() != String.Empty) { lblSender.Text = String.Format("<a href='mailto:{0}'>{1} {2}</a> ({3})", rdr["Sender"].ToString(), rdr["LastName"].ToString(), rdr["FirstName"].ToString(), LocRM.GetString("Unknown")); } else { lblSender.Text = String.Format("<a href='mailto:{0}'>{0}</a> ({1})", rdr["Sender"].ToString(), LocRM.GetString("Unknown")); } lblText.Text = LocRM.GetString("ADTextExternal"); } lblReceived.Text = ((DateTime)rdr["Received"]).ToShortDateString(); lnkMailBox.Text = rdr["Pop3BoxName"].ToString(); lnkMailBox.NavigateUrl = String.Format("~/Incidents/default.aspx?BTab=MailIncidents&MailBoxId={0}", rdr["Pop3BoxId"].ToString()); int mhtFileId = -1; if (rdr["MhtFileId"] != DBNull.Value) { mhtFileId = (int)rdr["MhtFileId"]; } if (mhtFileId > 0) { string wwwpath = CommonHelper.ChartPath + Guid.NewGuid().ToString() + ".mht"; Mediachase.IBN.Business.ControlSystem.FileStorage fileStorage = IssueRequest.GetFileStorage(RequestId); using (Stream sw = File.Create(Server.MapPath(wwwpath))) { fileStorage.LoadFile(mhtFileId, sw); } iSrc = ResolveUrl(wwwpath); } else { trMHT.Visible = false; } } else { Response.Redirect("~/common/NotExistingId.aspx?IncidentId=" + RequestId); } } }
/// <summary> /// Loads the file library acl. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> private bool LoadFileLibraryAcl(WorkflowInstanceEntity entity, out FileStorage fs, out AccessControlList acl) { acl = null; fs = null; // Resolve ContainerKey string containerName = "FileLibrary"; string containerKey = string.Empty; if (entity.OwnerDocumentId.HasValue) containerKey = UserRoleHelper.CreateDocumentContainerKey(entity.OwnerDocumentId.Value); //else // TODO: Extend Owner Processing // Check ContainerKey if (string.IsNullOrEmpty(containerKey)) return false; // Open ACL BaseIbnContainer bic = BaseIbnContainer.Create(containerName, containerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); acl = AccessControlList.GetACL(fs.Root.Id); return true; }
private void GetCurrentFolder() { _fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(_containerName, _containerKey); if (!IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) _folderId = int.Parse(Request["FolderId"]); else if (_folderId < 0 && _pc["fs_FolderId_" + _containerKey] != null) { int iFolder = int.Parse(_pc["fs_FolderId_" + _containerKey]); DirectoryInfo di = _fs.GetDirectory(iFolder); if (di != null) _folderId = iFolder; else _folderId = _fs.Root.Id; } else _folderId = _fs.Root.Id; _rootId = _fs.Root.Id; _pc["fs_FolderId_" + _containerKey] = _folderId.ToString(); }
protected void UploadEmlFile(FileStorage storage, int FolderId, int UserId, Pop3Message message) { message.InputStream.Position = 0; string FileName = "Original_Message.eml"; int index = 0; while (storage.FileExist(FileName, FolderId)) { FileName = String.Format("Original_Message{0}.eml", index++); } storage.SaveFile(FolderId, FileName, string.Empty, UserId, DateTime.Now, message.InputStream); }
protected void Page_Load(object sender, System.EventArgs e) { UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css"); UtilHelper.RegisterScript(Page, "~/Scripts/browser.js"); UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js"); if (Request["PrimaryKeyId"] != null) { string[] elem = Request["PrimaryKeyId"].Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); FolderId = int.Parse(elem[1]); ContainerName = elem[2]; ContainerKey = elem[3]; } bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); rfTitle.ErrorMessage = LocRM.GetString("Required"); cvTitle.ErrorMessage = LocRM.GetString("tDuplicateName"); if (!IsPostBack) BindValues(); btnSave.Text = LocRM.GetString("Save"); btnCancel.Text = LocRM.GetString("Cancel"); btnSave.Attributes.Add("onclick", "DisableButtons(this);"); btnCancel.Attributes.Add("onclick", "window.close()"); btnSave.CustomImage = this.Page.ResolveUrl("~/layouts/images/saveitem.gif"); }
protected void AddAttachments(FileStorage storage, int FolderId, Pop3Message message, int userId) { ArrayList Attachments = new ArrayList(); ExtractAttachments(Attachments, message.MimeEntries); UploadAttachments(storage, FolderId, Attachments, userId); }
protected void UploadAttachments(FileStorage storage, int FolderId, ArrayList attach, int UserId) { foreach(MimeEntry entry in attach ) { string FileName = entry.FileName; if (FileName == null) { if (entry.ContentType != null) { if(entry.ContentType.StartsWith("text/html")) continue; Hashtable parametrs = new Hashtable(); Regex contentParser = new Regex("(?<type>[^;]+)(;(\\s)*(?<parameter>((?<attribute>[^=]+)=(?<value>((\"[^\"]*\")?[^;]*)))))*"); Match match = contentParser.Match(entry.ContentType); string Type = match.Groups["type"].Value; int CaptureLen = match.Groups["parameter"].Captures.Count; for(int iIndex=0;iIndex<CaptureLen;iIndex++) { parametrs[match.Groups["attribute"].Captures[iIndex].Value.ToLower()] = match.Groups["value"].Captures[iIndex].Value.Replace("\"",""); } FileName = (string)parametrs["name"]; } if(FileName==null) FileName = string.Format("{0}.dat",(new Random()).Next()); } using(MemoryStream memStream = new MemoryStream(entry.Body)) { storage.SaveFile(FolderId, FileName, string.Empty, UserId, DateTime.Now, memStream); } } }
void BindDefaultValues() { txtFolder.Text = ""; int iFolderId = -1; try{iFolderId = int.Parse(txtFolderId.Value);} catch{return;} string ContainerKey = txtContainerKey.Value; //if(ContainerKey == "") // return; bic = BaseIbnContainer.Create("FileLibrary", ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); string name = "unknown"; if(iFolderId==fs.Root.Id) { if(ContainerKey.LastIndexOf("_") > 0) { int ProjectId = -1; try { ProjectId = int.Parse(ContainerKey.Substring(ContainerKey.LastIndexOf("_")+1)); } catch{} if(ProjectId != -1) { using(IDataReader reader = Project.GetProject(ProjectId)) { reader.Read(); if(reader["Title"] != null) name = reader["Title"].ToString(); } } } else name = LocRM.GetString("tRoot"); } else { DirectoryInfo di = fs.GetDirectory(iFolderId); if(di != null) name = di.Name; else { ContainerKey = ""; FolderId = -1; return; } } // name = fs.GetDirectory(iFolderId).Name; System.IO.StringWriter writer = new System.IO.StringWriter(); Server.HtmlDecode(name, writer); string decoded = writer.ToString(); txtFolder.Text = decoded; }
private void GetCurrentFolder() { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (FileStorage)_bic.LoadControl("FileStorage"); if (Request["FolderId"] != null && Request["FolderId"] != String.Empty) _folderId = int.Parse(Request["FolderId"]); else if (_folderId < 0 && _pc["fs_FolderId_" + _containerKey] != null) { int iFolder = int.Parse(_pc["fs_FolderId_" + _containerKey]); DirectoryInfo di = _fs.GetDirectory(iFolder); if (di != null) _folderId = iFolder; else _folderId = _fs.Root.Id; } else _folderId = _fs.Root.Id; _rootId = _fs.Root.Id; _pc["fs_FolderId_" + _containerKey] = _folderId.ToString(); }
protected void Page_Load(object sender, System.EventArgs e) { UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/windows.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/Theme.css"); UtilHelper.RegisterCssStyleSheet(Page, "~/Styles/IbnFramework/mcCalendClient.css"); UtilHelper.RegisterScript(Page, "~/Scripts/browser.js"); UtilHelper.RegisterScript(Page, "~/Scripts/buttons.js"); Response.Cache.SetNoStore(); bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack) BindDG(); }
protected void Page_Load(object sender, System.EventArgs e) { _bic = BaseIbnContainer.Create(_containerName, _containerKey); _fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)_bic.LoadControl("FileStorage"); if (!Page.IsPostBack) { BindLists(); ViewState["fls_Sort"] = _sort; if (_pc["fs_Search_ViewStyle"] == null) _pc["fs_Search_ViewStyle"] = "ListView"; } else { BindSavedValues(); BindDG(); } }
private void PreparePage() { secHeader.Title = LocRM.GetString("tArticleView"); secHeader.AddImageLink("../Layouts/Images/edit.gif", LocRM2.GetString("tEdit"), String.Format("../Incidents/ArticleEdit.aspx?ArticleId={0}", ArticleId)); ContainerKey = UserRoleHelper.CreateArticleContainerKey(ArticleId); bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (FileStorage)bic.LoadControl("FileStorage"); RootFolderId = fs.Root.Id; secHeader.AddImageLink("../Layouts/Images/icons/newfile.gif", LocRM3.GetString("tAddD"), String.Format("javascript:ShowWizard('{0}?ParentFolderId={1}&ContainerKey={2}&ContainerName={3}', 470, 270);", ResolveUrl("~/FileStorage/FileUpload.aspx"), RootFolderId, ContainerKey, ContainerName)); secHeader.AddImageLink("../Layouts/Images/cancel.gif", LocRM.GetString("atclBackToList"), ResolveClientUrl("~/Apps/HelpDeskManagement/Pages/ArticleListMain.aspx")); }
private void GetCurrentFolderAndMoveObjects() { fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(ContainerName, ContainerKey); if(Request["ParentFolderId"] != null) ctrlDirTree.DisFolderId = int.Parse(Request["ParentFolderId"]); }
/// <summary> /// Gets the web dav URL by WebDavTicket. /// </summary> /// <param name="ticket">The ticket.</param> /// <returns></returns> public static string GetWebDavUrl(string ticket) { string retVal = string.Empty; WebDavTicket webDavTicket = WebDavTicket.Parse(ticket); //Попытаемся определить имя файла if (String.IsNullOrEmpty(webDavTicket.AbsolutePath.FileName)) { if (webDavTicket.AbsolutePath.StorageType == ObjectTypes.File_FileStorage) { FileStorageAbsolutePath fsAbsPath = webDavTicket.AbsolutePath as FileStorageAbsolutePath; if (fsAbsPath != null) { FileStorage fs = new FileStorage(); Mediachase.IBN.Business.ControlSystem.FileInfo fileInfo = fs.GetFile(fsAbsPath.UniqueId); if (fileInfo != null) { webDavTicket.AbsolutePath.FileName = fileInfo.Name; } } } else if (webDavTicket.AbsolutePath.StorageType == ObjectTypes.File_MetaData) { MetaDataAbsolutePath mdAbsPath = webDavTicket.AbsolutePath as MetaDataAbsolutePath; if (mdAbsPath != null) { Mediachase.Ibn.Data.Meta.FileInfo fileInfo = new Mediachase.Ibn.Data.Meta.FileInfo(mdAbsPath.FileUID); webDavTicket.AbsolutePath.FileName = fileInfo.Name; } } else if (webDavTicket.AbsolutePath.StorageType == ObjectTypes.File_MetaDataPlus) { MetaDataPlusAbsolutePath mdpAbsPath = webDavTicket.AbsolutePath as MetaDataPlusAbsolutePath; if (mdpAbsPath != null) { Mediachase.MetaDataPlus.MetaObject obj = MetaDataWrapper.LoadMetaObject(mdpAbsPath.MetaObjectId, mdpAbsPath.MetaObjectType); MetaFile mf = obj[mdpAbsPath.MetaFieldName] as MetaFile; if (mf != null) { webDavTicket.AbsolutePath.FileName = mf.Name; } } } else if (webDavTicket.AbsolutePath.StorageType == ObjectTypes.File_Incident) { EmailStorageAbsolutePath emlAbsPath = webDavTicket.AbsolutePath as EmailStorageAbsolutePath; if (emlAbsPath != null) { EMailMessageInfo emlInfo = EMailMessageInfo.Load(emlAbsPath.EmailMsgId); AttachmentInfo attachInfo = emlInfo.Attachments[emlAbsPath.EmailAttachmentIndex]; webDavTicket.AbsolutePath.FileName = attachInfo.FileName; } } } retVal = GetWebDavUrl(webDavTicket.AbsolutePath, true); return retVal; }
private void SetSecurity() { Dictionary<int, string> dirs = new Dictionary<int, string>(); using (IDataReader reader = _dbHelper.RunTextDataReader("SELECT [DirectoryId], [ContainerKey] FROM [fsc_Directories]")) { while (reader.Read()) { int id = (int)reader["DirectoryId"]; dirs[id] = reader["ContainerKey"].ToString(); } } FileStorage fs = new FileStorage(); foreach (int dirId in dirs.Keys) { string containerKey = dirs[dirId]; BaseIbnContainer baseCont = BaseIbnContainer.Create("FileLibrary", containerKey); DefaultAccessControlList defAcl = baseCont.Info.Controls["FileStorage"].DefaultAccessControlList; AccessControlList acl = AccessControlList.GetACL(dirId); foreach (AccessControlEntry ace in defAcl.GetACL(containerKey)) acl.Add(ace); AccessControlList.SetACL(fs, acl, false); } }
private void GetCurrentFolderAndMoveObjects() { bic = BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (Mediachase.IBN.Business.ControlSystem.FileStorage)bic.LoadControl("FileStorage"); string sFolders = Request["Folders"].ToString(); string sFiles = Request["Files"].ToString(); while (sFolders.Length > 0) { alFolders.Add(sFolders.Substring(0, sFolders.IndexOf(","))); sFolders = sFolders.Remove(0, sFolders.IndexOf(",") + 1); } while (sFiles.Length > 0) { alFiles.Add(sFiles.Substring(0, sFiles.IndexOf(","))); sFiles = sFiles.Remove(0, sFiles.IndexOf(",") + 1); } if (alFolders.Count > 0) ParentFolderId = fs.GetDirectory(int.Parse(alFolders[0].ToString())).ParentDirectoryId; else if (alFiles.Count > 0) { int i = int.Parse(alFiles[0].ToString()); FileInfo fi = fs.GetFile(i); ParentFolderId = fi.ParentDirectoryId; } ctrlDirTree.DisFolderId = ParentFolderId; }
private void GetCurrentFolder() { ContainerKey = ViewState["ContainerKey"].ToString(); bic = CS.BaseIbnContainer.Create(ContainerName, ContainerKey); fs = (CS.FileStorage)bic.LoadControl("FileStorage"); if (!Page.IsPostBack && Request["FolderId"] != null && Request["FolderId"] != String.Empty) FolderId = int.Parse(Request["FolderId"]); else if (FolderId < 0 && pc["fs_FolderId_" + ContainerKey] != null) { int iFolder = int.Parse(pc["fs_FolderId_" + ContainerKey]); CS.DirectoryInfo di = fs.GetDirectory(iFolder); if (di != null) FolderId = iFolder; else FolderId = fs.Root.Id; } else FolderId = fs.Root.Id; RootId = fs.Root.Id; pc["fs_FolderId_" + ContainerKey] = FolderId.ToString(); }
private void BindData() { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>" + "ChColl=document.getElementsByTagName('input');" + "for(j=0;j<ChColl.length;j++){" + "obj = ChColl[j];" + "_obj_id = obj.id;" + "if(_obj_id.indexOf('cbAutoApprove')>=0)" + "obj.disabled=true;" + "if(_obj_id.indexOf('cbAutoDelete')>=0)" + "obj.disabled=true;" + "if(_obj_id.indexOf('cbUseExternal')>=0)" + "obj.disabled=true;}" + "</script>"); ddFolder.Items.Clear(); bic = BaseIbnContainer.Create("FileLibrary", "Workspace"); fs = (FileStorage)bic.LoadControl("FileStorage"); ProcessFolder(fs.Root.Id); /*using (IDataReader reader1 = Folder.GetFolderList(0)) { while (reader1.Read()) { ProcessFolder((int)reader1["FolderId"]); } }*/ //using (IDataReader reader = Mailbox.Get(MailBoxId, false)) //{ // if(reader.Read()) if (MailBoxId > 0) { txtMBTitle.Text = Pop3Manager.Current.SelectedPop3Box.Name; if (Pop3Manager.Current.SelectedPop3Box.IsActive) { cbUseMailIncs.Checked = true; txtPeriod.Disabled = false; //int iPeriod = (int)reader["Period"]; int iPeriod = Pop3Manager.Current.SelectedPop3Box.Interval; foreach (ListItem li in txtPeriod.Items) { if (li.Value == iPeriod.ToString()) { li.Selected = true; break; } else li.Selected = false; } txtServer.Disabled = false; txtServer.Value = Pop3Manager.Current.SelectedPop3Box.Server; txtPort.Disabled = false; txtPort.Value = Pop3Manager.Current.SelectedPop3Box.Port.ToString(); txtUser.Disabled = false; txtUser.Value = Pop3Manager.Current.SelectedPop3Box.Login; txtPass.Disabled = false; ViewState["_Pass"] = Pop3Manager.Current.SelectedPop3Box.Password; txtPass.Value = Pop3Manager.Current.SelectedPop3Box.Password; if (mbType == MailboxType.Folder) { ddFolder.Disabled = false; ListItem liItem = ddFolder.Items.FindByValue(Pop3Manager.Current.SelectedPop3Box.Parameters["FolderId"]); if (liItem != null) liItem.Selected = true; } Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>" + "ChColl=document.getElementsByTagName('input');" + "for(j=0;j<ChColl.length;j++){" + "obj = ChColl[j];" + "_obj_id = obj.id;" + "if(_obj_id.indexOf('cbAutoApprove')>=0)" + "obj.disabled=false;" + "if(_obj_id.indexOf('cbAutoDelete')>=0)" + "obj.disabled=false;" + "if(_obj_id.indexOf('cbUseExternal')>=0)" + "obj.disabled=false;}" + "</script>"); cbAutoApprove.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoApproveForKnown"] == "1"; cbAutoDelete.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoKillForUnknown"] == "1"; cbUseExternal.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["OnlyExternalSenders"] == "1"; visCheck.Disabled = false; } else { // if(reader["Period"]!=DBNull.Value) // { int iPeriod = Pop3Manager.Current.SelectedPop3Box.Interval; foreach (ListItem li in txtPeriod.Items) { if (li.Value == iPeriod.ToString()) { li.Selected = true; break; } } // } //if(reader["Server"]!=DBNull.Value) txtServer.Value = Pop3Manager.Current.SelectedPop3Box.Server; //if(reader["Port"]!=DBNull.Value) txtPort.Value = Pop3Manager.Current.SelectedPop3Box.Port.ToString(); //if(reader["User"]!=DBNull.Value) txtUser.Value = Pop3Manager.Current.SelectedPop3Box.Login; //if(reader["Password"]!=DBNull.Value) //{ ViewState["_Pass"] = Pop3Manager.Current.SelectedPop3Box.Password; txtPass.Value = Pop3Manager.Current.SelectedPop3Box.Password; //} if (mbType == MailboxType.Folder) { ddFolder.Disabled = false; ListItem liItem = ddFolder.Items.FindByValue(Pop3Manager.Current.SelectedPop3Box.Parameters["FolderId"]); if (liItem != null) liItem.Selected = true; ddFolder.Disabled = true; } //if(reader["AutoApproveForKnown"]!=DBNull.Value) // cbAutoApprove.Checked=(bool)reader["AutoApproveForKnown"]; //if(reader["AutoKillForUnknown"]!=DBNull.Value) // cbAutoDelete.Checked=(bool)reader["AutoKillForUnknown"]; //if(reader["OnlyExternalSenders"]!=DBNull.Value) // cbUseExternal.Checked=(bool)reader["OnlyExternalSenders"]; cbAutoApprove.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoApproveForKnown"] == "1"; cbAutoDelete.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["AutoKillForUnknown"] == "1"; cbUseExternal.Checked = Pop3Manager.Current.SelectedPop3Box.Parameters["OnlyExternalSenders"] == "1"; } // } } }