private void comboSection_SelectedValueChanged(object sender, EventArgs e) { string sectionName = comboSection.Text; IResource section = RStore.FindUniqueResource(DocumentSectionResource.DocSectionResName, "Name", sectionName); if (section.HasProp(DocumentSectionResource.SectionHelpDescription)) { resTypeToolTip.SetToolTip(comboSection, section.GetStringProp(DocumentSectionResource.SectionHelpDescription)); } else { resTypeToolTip.SetToolTip(comboSection, ""); } }
public EditRuleForm(string ruleName) : base("IsActionRuleLinked", true, true, true) { #region Preconditions if (String.IsNullOrEmpty(ruleName)) { throw new ArgumentNullException("ruleName", "EditRuleForm -- Input rule name is NULL"); } #endregion Preconditions Initialize("Edit Action Rule", ruleName); BaseResource = RStore.FindUniqueResource(FilterManagerProps.RuleResName, "Name", ruleName); ArrayList parameters = new ArrayList(); ArrayList actions = CollectResourcesAndTemplates(BaseResource, parameters, Core.FilterRegistry.Props.LinkedActions); AddConditions(_panelActions, actions, parameters); InitializeBasePanels(BaseResource); InitializeEventsList(BaseResource); }
public EditExpirationRuleForm(string ruleName) : base("IsExpirationRuleLinked", false, true, true) { #region Preconditions if (String.IsNullOrEmpty(ruleName)) { throw new ArgumentNullException("ruleName", "EditExpirationRuleForm -- Input rule name is NULL"); } #endregion Preconditions BaseResource = RStore.FindUniqueResource(FilterManagerProps.RuleResName, "Name", ruleName); IResourceList linked = BaseResource.GetLinksOfType(null, "ExpirationRuleLink"); if (linked.Count == 0) { linked = BaseResource.GetLinksOfType(null, "ExpirationRuleOnDeletedLink"); if (linked.Count == 1 && linked[0].Type == "ResourceType") { _isForDeletedItems = true; _baseResType = linked[0]; } else { throw new ApplicationException("EditExpirationRule -- Contract violation - No linkage between rule and related resources"); } } else if (linked.Count == 1 && linked[0].Type == "ResourceType") { _baseResType = linked[0]; } Initialize((_baseResType == null) ? linked : null); InitializeActions(BaseResource); InitializeBasePanels(BaseResource); if (_baseResType != null) { ConstructLinkText(_baseResType); resourceTypesLink.Enabled = false; } else { ConstructLinkText(linked); } }
protected void AddActionClicked(object sender, EventArgs e) { ArrayList usedResources = CollectResourcesInControls(_panelActions.Controls); IResourceList actions = RStore.GetAllResources(FilterManagerProps.RuleActionResName); actions = actions.Minus(RStore.FindResources(FilterManagerProps.RuleActionResName, "Invisible", true)); actions = actions.Union(RStore.GetAllResources(FilterManagerProps.RuleActionTemplateResName)); foreach (IResource res in usedResources) { actions = actions.Minus(res.ToResourceList()); } //----------------------------------------------------------------- // Remove those actions and templates which are applicable to the // resource types not supported by the corresponding plugins (if // e.g. they are not loaded). Decision is made using the fact that // actions are ALWAYS implemented as classes (not internal logic), // so if plugin is not loaded, then all of its actions are not // instantiated. //----------------------------------------------------------------- IResourceList auxList = RStore.EmptyResourceList; foreach (IResource res in actions) { if (Core.FilterRegistry.IsActionInstantiated(res)) { auxList = auxList.Union(res.ToResourceList()); } } actions = auxList; //----------------------------------------------------------------- IResourceList choosenActions = RStore.EmptyResourceList; if (CurrentResTypeDeep != null) { foreach (IResource res in actions) { if (isTypeConforms(CurrentResTypeDeep, res)) { choosenActions = choosenActions.Union(res.ToResourceList()); } } } else { choosenActions = actions; } //----------------------------------------------------------------- choosenActions.Sort(new SortSettings(Core.Props.Name, true)); IResourceList selected = Core.UIManager.SelectResourcesFromList(this, choosenActions, "Select Rule Action(s)", "/reference/select_rule_actions.html"); if ((selected != null) && (selected.Count > 0)) { ArrayList emptyParams = CreateEmptyList(selected.Count, -1); AddConditions(_panelActions, selected, emptyParams); } actions.Dispose(); CheckFormConsistency(); }
private void PerformSearch() { string query = _editHeading.Text.Trim(); IResource[][] conditions = Controls2Resources(panelConditions.Controls); if (query.Length > 0) { IResource queryCondition = ((FilterRegistry)FMgr).CreateQueryConditionAux(null, query, comboSection.Text); FilterRegistry.ReferCondition2Template(queryCondition, FMgr.Std.BodyMatchesSearchQueryXName); // Copy query condition to every subgroup or create the single one. if (conditions != null && conditions.Length > 0) { for (int i = 0; i < conditions.Length; i++) { IResource[] group = conditions[i]; IResource[] newGroup = new IResource[group.Length + 1]; for (int j = 0; j < group.Length; j++) { newGroup[j] = group[j]; } newGroup[newGroup.Length - 1] = queryCondition; conditions[i] = newGroup; } } else { conditions = FilterRegistry.Convert2Group(queryCondition); } UpdateStoredQueriesList(query); } IResource[] exceptions = ConvertTemplates2Conditions(panelExceptions.Controls); //----------------------------------------------------------------- // need to remove existing basic View? // NB: it removes all underlying AUX conditions including query search //----------------------------------------------------------------- IResource view = RStore.FindUniqueResource(FilterManagerProps.ViewResName, "DeepName", FMgr.ViewNameForSearchResults); string[] formTypes = ReformatTypes(CurrentResTypeDeep); if (view != null) { BaseResource = view; FMgr.ReregisterView(view, FMgr.ViewNameForSearchResults, formTypes, conditions, exceptions); } else { BaseResource = FMgr.RegisterView(FMgr.ViewNameForSearchResults, formTypes, conditions, exceptions); } //----------------------------------------------------------------- bool showContext = (query.Length > 0) && Core.SettingStore.ReadBool("Resources", "ShowSearchContext", true); ResourceProxy proxy = new ResourceProxy(BaseResource); proxy.BeginUpdate(); proxy.SetProp(Core.Props.Name, SearchViewPrefix + query); proxy.SetProp(Core.Props.ShowDeletedItems, true); proxy.SetProp("ForceExec", true); proxy.SetProp("ShowContexts", showContext); if (BaseResource.HasProp(Core.Props.ContentType) || BaseResource.HasProp("ContentLinks")) { proxy.DeleteProp("ShowInAllTabs"); } else { proxy.SetProp("ShowInAllTabs", true); } proxy.EndUpdate(); // if search is done specifically for the particular resource // type - set the focus onto that tab. Core.ResourceTreeManager.LinkToResourceRoot(BaseResource, 1); if ((CurrentResTypeDeep != null) && (CurrentResTypeDeep.IndexOf('|') == -1) && (CurrentResTypeDeep.IndexOf('#') == -1)) { Core.TabManager.SelectResourceTypeTab(CurrentResTypeDeep); } else { Core.TabManager.SelectResourceTypeTab(""); } Core.UIManager.BeginUpdateSidebar(); Core.LeftSidebar.ActivateViewPane(StandardViewPanes.ViewsCategories); Core.UIManager.EndUpdateSidebar(); Core.LeftSidebar.DefaultViewPane.SelectResource(BaseResource); BringToFront(); }