public static DialogResult Run(BaseLibraryLink link, LinkSettingsType settingsType)
		{
			var dilogResult = DialogResult.Cancel;
			link.PerformTransaction(link.ParentLibrary.Context,
				linkCopy =>
				{
					var editForm = ObjectIntendHelper.GetObjectInstances(typeof(ILinkSettingsEditForm), null, linkCopy)
						.OfType<ILinkSettingsEditForm>()
						.FirstOrDefault(form => form.EditableSettings.Any(st => st == settingsType));
					if (editForm != null)
					{
						editForm.InitForm<ILinkSettingsEditControl>(settingsType);
						dilogResult = ((Form)editForm).ShowDialog(MainController.Instance.MainForm);
						((Form)editForm).Dispose();
						if (dilogResult == DialogResult.OK)
							linkCopy.MarkAsModified();
						return dilogResult == DialogResult.OK;
					}
					return dilogResult == DialogResult.Cancel;
				},
				copyMethod => MainController.Instance.ProcessManager.Run("Preparing Data...", cancelationToken => copyMethod()),
				(context, original, current) => MainController.Instance.ProcessManager.Run("Saving Changes...",
					cancelationToken =>
					{
						original.Save(context, current, false);
					}));
			return dilogResult;
		}
		public FormResetLinkSettings(BaseLibraryLink targetLink) : this()
		{
			Text = "Reset this Link";
			labelControlTitle.Text = String.Format(labelControlTitle.Text,
				targetLink.LinkInfoDisplayName,
				(targetLink as LibraryFileLink)?.NameWithExtension ?? (targetLink as LibraryObjectLink)?.RelativePath ?? String.Empty);

			LoadSettingsGroups(GetLinkCustomizedSettings(targetLink));
		}
		public virtual void LoadLink(BaseLibraryLink targetLink)
		{
			PopulateContextMenu();
			_linkLoader = CreateLoader(targetLink);
			_linkLoader.OnSettingsChanged += (o, e) =>
			{
				_isEditValueChanged = true;
			};
			_linkLoader.LoadLink();
			_isEditValueChanged = false;
		}
		public FormEditLinkSettingsEmbedded(BaseLibraryLink sourceLink, LibraryFolderLink parentFolderLink)
		{
			_parentFolderLink = parentFolderLink;
			_sourceLink = (LibraryFileLink)sourceLink;
			InitializeComponent();
			if ((CreateGraphics()).DpiX > 96)
			{
				xtraTabControl.AppearancePage.HeaderActive.Font = new Font(xtraTabControl.AppearancePage.HeaderActive.Font.FontFamily, xtraTabControl.AppearancePage.HeaderActive.Font.Size - 2, xtraTabControl.AppearancePage.HeaderActive.Font.Style);
				xtraTabControl.AppearancePage.Header.Font = new Font(xtraTabControl.AppearancePage.Header.Font.FontFamily, xtraTabControl.AppearancePage.Header.Font.Size - 2, xtraTabControl.AppearancePage.Header.Font.Style);
				xtraTabControl.AppearancePage.HeaderDisabled.Font = new Font(xtraTabControl.AppearancePage.HeaderDisabled.Font.FontFamily, xtraTabControl.AppearancePage.HeaderDisabled.Font.Size - 2, xtraTabControl.AppearancePage.HeaderDisabled.Font.Style);
				xtraTabControl.AppearancePage.HeaderHotTracked.Font = new Font(xtraTabControl.AppearancePage.HeaderHotTracked.Font.FontFamily, xtraTabControl.AppearancePage.HeaderHotTracked.Font.Size - 2, xtraTabControl.AppearancePage.HeaderHotTracked.Font.Style);
			}
		}
		public SecurityOptions(BaseLibraryLink data)
		{
			InitializeComponent();
			_data = data;

			gridViewSecurityGroups.MasterRowEmpty += OnGroupChildListIsEmpty;
			gridViewSecurityGroups.MasterRowGetRelationCount += OnGetGroupRelationCount;
			gridViewSecurityGroups.MasterRowGetRelationName += OnGetGroupRelationName;
			gridViewSecurityGroups.MasterRowGetChildList += OnGetGroupChildList;
			if ((base.CreateGraphics()).DpiX > 96)
			{
				rbSecurityAllowed.Font = new Font(rbSecurityAllowed.Font.FontFamily, rbSecurityAllowed.Font.Size - 2, rbSecurityAllowed.Font.Style);
				rbSecurityForbidden.Font = new Font(rbSecurityForbidden.Font.FontFamily, rbSecurityForbidden.Font.Size - 2, rbSecurityForbidden.Font.Style);
				rbSecurityDenied.Font = new Font(rbSecurityDenied.Font.FontFamily, rbSecurityDenied.Font.Size - 2, rbSecurityDenied.Font.Style);
				rbSecurityWhiteList.Font = new Font(rbSecurityWhiteList.Font.FontFamily, rbSecurityWhiteList.Font.Size - 2, rbSecurityWhiteList.Font.Style);
				rbSecurityBlackList.Font = new Font(rbSecurityBlackList.Font.FontFamily, rbSecurityBlackList.Font.Size - 2, rbSecurityBlackList.Font.Style);
				ckSecurityShareLink.Font = new Font(ckSecurityShareLink.Font.FontFamily, ckSecurityShareLink.Font.Size - 2, ckSecurityShareLink.Font.Style);
			}
		}
		public ResetSettingsSchedulerOptions(BaseLibraryLink data)
		{
			InitializeComponent();
			_data = data;

			Text = "Link RESET Timer";

			dateEditExpirationDate.Properties.NullDate = DateTime.MinValue;
			if ((CreateGraphics()).DpiX > 96)
			{
				var font = new Font(styleController.Appearance.Font.FontFamily, styleController.Appearance.Font.Size - 2,
					styleController.Appearance.Font.Style);
				styleController.Appearance.Font = font;
				styleController.AppearanceDisabled.Font = font;
				styleController.AppearanceDropDown.Font = font;
				styleController.AppearanceDropDownHeader.Font = font;
				styleController.AppearanceFocused.Font = font;
				styleController.AppearanceReadOnly.Font = font;
			}
		}
		protected override ILinkLoader CreateLoader(BaseLibraryLink targetLink)
		{
			return new LineBreakTextFormatLoader(this, (LineBreak)targetLink);
		}
		private IList<LinkSettingsGroupType> GetLinkCustomizedSettings(BaseLibraryLink targetLink)
		{
			return GetLinksCustomizedSettings(new[] { targetLink });
		}
		public virtual void ApplyValues(BaseLibraryLink link)
		{
			Type = link.Type;
			Order = link.Order;
			Name = link.Name;
			AddDate = link.AddDate;
			SettingsEncoded = link.SettingsEncoded;
			SecurityEncoded = link.SecurityEncoded;
			TagsEncoded = link.TagsEncoded;
			WidgetEncoded = link.WidgetEncoded;
			BannerEncoded = link.BannerEncoded;
			ResetSettingsSchedulerEncoded = link.ResetSettingsSchedulerEncoded;
			MarkAsModified();
			AfterSave();
		}
		protected override ILinkLoader CreateLoader(BaseLibraryLink targetLink)
		{
			return new LibraryObjectNotesLoader(this, (LibraryObjectLink)targetLink);
		}
Exemplo n.º 11
0
		public override void ApplyValues(BaseLibraryLink link)
		{
			IsDead = ((LibraryFileLink)link).IsDead;
			DataSourceId = ((LibraryFileLink)link).DataSourceId;
			base.ApplyValues(link);
		}
		protected abstract ILinkLoader CreateLoader(BaseLibraryLink targetLink);
Exemplo n.º 13
0
		protected LinkRow InsertLinkRow(BaseLibraryLink source, int position = -1)
		{
			if (position == -1)
				position = grFiles.Rows.Add();
			else
				grFiles.Rows.Insert(position);
			var row = (LinkRow)grFiles.Rows[position];
			row.Init(source, this);
			row.Info.Recalc();
			row.InfoChanged += OnLinkRowInfoChanged;
			return row;
		}
Exemplo n.º 14
0
		public void Init(BaseLibraryLink source, BaseFolderBox folderBox)
		{
			Source = source;
			FolderBox = folderBox;
		}
Exemplo n.º 15
0
		private void LoadLinkIntoContextMenuEditors(BaseLibraryLink link)
		{
			_contextMenuEditors.ForEach(e => e.LoadLink(link));
		}
		public override void ApplyValues(BaseLibraryLink link)
		{
			RelativePath = ((LibraryObjectLink)link).RelativePath;
			ExpirationEncoded = ((LibraryObjectLink)link).ExpirationEncoded;
			QuickLinkEncoded = ((LibraryObjectLink)link).QuickLinkEncoded;
			base.ApplyValues(link);
		}
		public override void LoadLink(BaseLibraryLink targetLink)
		{
			if (!(targetLink is DocumentLink || targetLink is PowerPointLink)) return;
			base.LoadLink(targetLink);
		}
		public override void LoadLink(BaseLibraryLink targetLink)
		{
			if(!(targetLink is LibraryObjectLink)) return;
			base.LoadLink(targetLink);
		}
		protected override ILinkLoader CreateLoader(BaseLibraryLink targetLink)
		{
			return new DocumentSettingsLoader(this, (LibraryObjectLink)targetLink);
		}
		private static void ImportData(
			this SoapLibraryLink target,
			BaseLibraryLink source)
		{
			var imageConverter = TypeDescriptor.GetConverter(typeof(Bitmap));
			target.id = source.ExtId.ToString();
			target.folderId = source.ParentFolder.ExtId.ToString();
			target.libraryId = source.ParentLibrary.ExtId.ToString();
			target.parentLinkId = source.ExtId != source.TopLevelLink.ExtId ? source.TopLevelLink.ExtId.ToString() : null;
			target.name = source.Name;
			target.originalFormat = source.WebFormat;
			target.searchFormat = source.WebFormat;
			target.order = source.Order;
			target.type = (int)source.Type;
			target.widgetType = (Int32)source.Widget.WidgetType;
			target.widget = source.Widget.Enabled ? Convert.ToBase64String((byte[])imageConverter.ConvertTo(source.Widget.DisplayedImage, typeof(byte[]))) : null;

			target.banner = new SoapBanner();
			target.banner.libraryId = source.ParentLibrary.ExtId.ToString();
			target.banner.ImportData(source.Banner);

			target.dateAdd = source.AddDate.ToString("MM/dd/yyyy hh:mm:ss tt");
			target.dateModify = source.LastModified.ToString("MM/dd/yyyy hh:mm:ss tt");

			switch (source.Type)
			{
				case FileTypes.Video:
					target.extendedProperties = new VideoLinkSettings();
					((VideoLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.VideoLinkSettings)source.Settings);
					break;
				case FileTypes.PowerPoint:
					target.extendedProperties = new PowerPointLinkSettings();
					((PowerPointLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.PowerPointLinkSettings)source.Settings);
					break;
				case FileTypes.Word:
				case FileTypes.Pdf:
					target.extendedProperties = new DocumentLinkSettings();
					((DocumentLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.DocumentLinkSettings)source.Settings);
					break;
				case FileTypes.Excel:
					target.extendedProperties = new ExcelLinkSettings();
					((ExcelLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.ExcelLinkSettings)source.Settings);
					break;
				case FileTypes.Url:
				case FileTypes.YouTube:
				case FileTypes.QPageLink:
				case FileTypes.Html5:
					if (source is QuickSiteLink)
					{
						target.extendedProperties = new QPageLinkSettings();
						((QPageLinkSettings)target.extendedProperties).ImportData(
							(QuickSiteSettings)source.Settings);
					}
					else
					{
						target.extendedProperties = new HyperLinkSettings();
						((HyperLinkSettings)target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.HyperLinkSettings)source.Settings);
					}
					break;
				case FileTypes.AppLink:
					target.extendedProperties = new AppLinkSettings();
					((AppLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.AppLinkSettings)source.Settings);
					break;
				case FileTypes.InternalLink:
					if (source is InternalWallbinLink)
					{
						target.extendedProperties = new InternalWallbinLinkSettings();
						((InternalWallbinLinkSettings) target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.InternalWallbinLinkSettings) source.Settings);
					}
					else if (source is InternalLibraryPageLink)
					{
						target.extendedProperties = new InternalLibraryPageLinkSettings();
						((InternalLibraryPageLinkSettings) target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.InternalLibraryPageLinkSettings)
								source.Settings);
					}
					else if (source is InternalLibraryFolderLink)
					{
						target.extendedProperties = new InternalLibraryFolderLinkSettings();
						((InternalLibraryFolderLinkSettings)target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.InternalLibraryFolderLinkSettings)
								source.Settings);
					}
					else if (source is InternalLibraryObjectLink)
					{
						target.extendedProperties = new InternalLibraryObjectLinkSettings();
						((InternalLibraryObjectLinkSettings)target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.InternalLibraryObjectLinkSettings)
								source.Settings);
					}
					else if (source is InternalShortcutLink)
					{
						target.extendedProperties = new InternalShortcutLinkSettings();
						((InternalShortcutLinkSettings)target.extendedProperties).ImportData(
							(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.InternalShortcutLinkSettings)
								source.Settings);
					}
					break;
				case FileTypes.LinkBundle:
					target.extendedProperties = new LinkBundleLinkSettings();
					target.searchFormat =
						((SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.LinkBundleLinkSettings) source.Settings)
							.CustomWebFormat;
					((LinkBundleLinkSettings)target.extendedProperties).ImportData(
						(SalesLibraries.Business.Entities.Wallbin.NonPersistent.LinkSettings.LinkBundleLinkSettings)source.Settings);
					break;
				default:
					target.extendedProperties = new BaseLinkSettings();
					target.extendedProperties.ImportData(source.Settings);
					break;
			}
			target.extendedProperties.ImportData(source.Security);

			if (source is LibraryFileLink)
			{
				var sourceFile = (LibraryFileLink)source;
				target.fileName = sourceFile.NameWithExtension;
				target.fileExtension = sourceFile.Extension.Replace(".", String.Empty).ToLower();
				target.fileDate = File.GetLastWriteTime(sourceFile.FullPath).ToString("MM/dd/yyyy hh:mm:ss tt");
				target.isDead = sourceFile.CheckIfDead();
				if (!sourceFile.IsFolder)
					target.fileSize = (Int32)new FileInfo(sourceFile.FullPath).Length;
			}
			if (source is LibraryObjectLink)
			{
				var sourceObject = (LibraryObjectLink)source;
				target.fileRelativePath = sourceObject.WebPath;
				target.fileDate =
					((LibraryObjectLinkSettings)sourceObject.Settings)
						.FakeFileDate?.ToString("MM/dd/yyyy hh:mm:ss tt") ?? target.fileDate ?? target.dateAdd;

				target.extendedProperties.ImportData(sourceObject.QuickLinkSettings);
			}
			if (source is PreviewableLink)
			{
				var sourcePreviewObject = (PreviewableLink)source;
				var previewContainer = source.ParentLibrary.GetPreviewContainerBySourcePath(sourcePreviewObject.FullPath);
				if (previewContainer != null)
				{
					target.previewId = previewContainer.ExtId.ToString();
					target.contentPath = previewContainer
						.GetPreviewLinksByFormat(PreviewFormats.Text)
						.Select(path => path.Replace(source.ParentLibrary.Path, String.Empty))
						.FirstOrDefault();
				}
			}
			if (source is SalesLibraries.Business.Entities.Wallbin.Persistent.Links.LineBreak)
			{
				target.lineBreakProperties = new LineBreak();
				target.lineBreakProperties.id = source.ExtId.ToString();
				target.lineBreakProperties.libraryId = source.ParentLibrary.ExtId.ToString();
				target.lineBreakProperties.ImportData((LineBreakSettings)source.Settings);
			}

			#region Tags
			var fileSuperFilters = new List<LinkSuperFilter>();
			foreach (var superFilter in source.Tags.SuperFilters.Union(source.TopLevelLink.Tags.SuperFilters).Distinct())
			{
				var linkSuperFilter = new LinkSuperFilter();
				linkSuperFilter.libraryId = source.ParentLibrary.ExtId.ToString();
				linkSuperFilter.linkId = source.ExtId.ToString();
				linkSuperFilter.value = superFilter;
				fileSuperFilters.Add(linkSuperFilter);
			}
			if (fileSuperFilters.Any())
				target.superFilters = fileSuperFilters.ToArray();

			var fileCategories = new List<LinkCategory>();
			foreach (var searchGroup in source.Tags.Categories.Union(source.TopLevelLink.Tags.Categories))
				foreach (var tag in searchGroup.Tags)
				{
					var category = new LinkCategory();
					category.libraryId = source.ParentLibrary.ExtId.ToString();
					category.linkId = source.ExtId.ToString();
					category.category = searchGroup.Name;
					category.tag = tag.Name;
					fileCategories.Add(category);
				}
			if (fileCategories.Count > 0)
				target.categories = fileCategories.ToArray();

			var keywords = source.Tags.Keywords.Union(source.Tags.Keywords).ToList();
			if (keywords.Any())
				target.tags = String.Join(" ", keywords.Select(x => x.Name).ToArray());
			#endregion
		}
Exemplo n.º 21
0
		public TagsOptions(BaseLibraryLink link) : this()
		{
			_links.Add(link);
		}