/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); EditButton.Visible = !(FileManager.SingleSelectedFile is NativeFile) && FileSystemUtility.CanEdit(FileManager.SingleSelectedFile); linkedPagesList.DataBind(); SetupMetaData(); }
private bool IsRenameAllowed() { if (!IsDefaultView() || FileManager.SingleSelectedItem == null) { return(false); } return(FileSystemUtility.CanEdit(FileManager.SingleSelectedItem)); }
private bool IsChangeAllowed() { if (!IsDefaultView() || FileManager.SelectedItems.Count == 0) { return(false); } return(!FileManager.SelectedItems.Any(vf => !FileSystemUtility.CanEdit(vf))); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBackView && FileManager.SingleSelectedFile != null) { PopulateFormFields(FileManager.SingleSelectedFile.Summary); } if (!FileSystemUtility.CanEdit(FileManager.SingleSelectedFile)) { SaveButton.Enabled = false; Page.Validators.Add(new StaticValidator(Translate("/filemanager/errormessage/cannotchange"))); return; } }
private bool IsCheckInAllowed() { if (!IsDefaultView() || FileManager.SelectedItems.Count == 0) { return(false); } foreach (var file in FileManager.SelectedItems) { IVersioningFile versioningFile = file as IVersioningFile; // If any selected file isn't a checked out versioned file with edit permissions check in is disabled if (versioningFile == null || !versioningFile.IsCheckedOut || !FileSystemUtility.CanEdit(file)) { return(false); } } return(true); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); UnifiedFile selectedFile = FileManager.SingleSelectedFile; // Init the XForm. SerializableXmlDocument rawFile = new SerializableXmlDocument(); VirtualFile vf = HostingEnvironment.VirtualPathProvider.GetFile(selectedFile.Parent.CustomFileSummaryVirtualPath); using (Stream stream = vf.Open()) { rawFile.Load(stream); } XForm form = new XForm(); form.Document = rawFile; _data = form.CreateFormData(); // Populate the XForm. IDictionary dict = selectedFile.Summary.Dictionary; foreach (DictionaryEntry entry in dict) { if (entry.Value != null) { _data.SetValue(entry.Key.ToString(), entry.Value.ToString()); } } XFormCtrl.Data = _data; XFormCtrl.FormDefinition = form; if (!FileSystemUtility.CanEdit(selectedFile)) { SaveButton.Enabled = false; Page.Validators.Add(new StaticValidator(Translate("/filemanager/errormessage/cannotchange"))); } }