Добавление/удаление деталей раздела

Добавляю деталь в разделе при помощи мастера, добавляется, все хорошо.
Удаляю ненужные детали, меняю порядок деталей...ничего не меняется. Чистил кэш, ничего не помогает.
Где управлять порядком и видимостью деталей?

Нравится

13 комментариев

Дело в том, что каждый пользователь может сам управлять видимостью и порядком деталей. Чтобы управлять надо в TSClient щелкнуть правой кнопкой на названии детали -> Параметры.

Это хорошо, но почему если я деталь удаляю, а она все равно остается?!
В частности "Веб", "Запросы" и "Графики". Я догадываюсь, что это какие то наследованные системные прибамбасы.....но они то мне не нужны в данном конкретном случае.

Удаляете с помощью мастера?
Тогда попробуйте удалить напрямую из Администратора.
Найдите окно раздела (должно быть что-то типа wnd_...Workspace) слева найдите pcDetails там расположены все страницы деталей, удалите ненужные.

Это я в первую очередь посмотрел......
НО ИХ ТАМ НЕТ!

UPD: сорри, не туда смотрел, есть такое, сделал им False на все что можно....

1) В базовом окне раздела (wnd_BaseWorkspace) найти деталь «Графики» (pgGraphsDetail) и установить ей свойство IsAccessible равным true.
2) Если текст функции ниже – это то, что есть на данный момент у Вас, её необходимо также изменить. Должно быть так (установите коммент и добавьте строки):

function PrepareCommonDetails(ParentItemFieldName, DontShowGraphs, 
       CustomGridTable, ParentItemIDName, DontShowWebAndQueries) {
       PrepareChangesLogDetail(ParentItemFieldName, CustomGridTable, ParentItemIDName);
       if (DontShowWebAndQueries != null) {
              pgWebInfoDetail.IsVisible = !DontShowWebAndQueries;
              pgQueryDetail.IsVisible = !DontShowWebAndQueries;
       }
       pgWebInfoDetail.IsAccessible = !DontShowWebAndQueries;
       pgQueryDetail.IsAccessible = !DontShowWebAndQueries;
       if (!!DontShowWebAndQueries) {
              PrepareWebInfoDetail(CustomGridTable);
       }
       var ShowGraphs = !DontShowGraphs;
       if (ShowGraphs) {
              ShowGraphs = PrepareGraphsDetail();
       }
      // pgGraphsDetail.IsAccessible = ShowGraphs;
      //   pgGraphsDetail.IsVisible = ShowGraphs;
 
       if (DontShowGraphs != null) {
              pgGraphsDetail.IsVisible = ShowGraphs;
       }
       pgGraphsDetail.IsAccessible = ShowGraphs;
       pgGraphs.IsAccessible = ShowGraphs;
       pgGraphs.IsVisible = ShowGraphs;
 
       var CallsDetail = Self.ComponentsByName('pgCallsDetail');
       if (CallsDetail) {
              var HasCallLicense = System.GetHasLicense('Call');
              pgCallsDetail.IsVisible = HasCallLicense && pgCallsDetail.IsVisible;
              pgCallsDetail.IsAccessible = HasCallLicense && pgCallsDetail.IsAccessible;
       }
       BaseWorkspace.DetailsControlSizeOld = pcDetails.Size;
}

Что касается детали «Журнал изменений» - для исправления необходимо внести следующие изменения в функцию PrepareChangesLogDetail скрипта scr_BaseWorkspace

function PrepareChangesLogDetail(ParentItemFieldName, CustomGridTable, 
                ParentItemIDName) {
                if (!System.GetHasLicense('DatabaseLog') || (!ParentItemFieldName)) {
                    BaseWorkspace.ShowChangesLogDetail = false;
                } else {
                    BaseWorkspace.ParentItemFieldName = ParentItemFieldName;
                               BaseWorkspace.ShowChangesLogDetail = 
                                               DoShowChangesLogDetail(CustomGridTable);
                }
                pgChangesLogDetail.IsAccessible = BaseWorkspace.ShowChangesLogDetail;
//    if (BaseWorkspace.ShowChangesLogDetail) {
//            pgChangesLogDetail.IsVisible = true;
//            } else {
//        return;
//            }
                pgChangesLogDetail.IsVisible = !!BaseWorkspace.ShowChangesLogDetail &&
                               pgChangesLogDetail.IsVisible;
if (!BaseWorkspace.ShowChangesLogDetail) {
                                return;
                }
                BaseWorkspace.ChangesLogWindow = wndChangesLogDetail.Window;
                if (!ParentItemIDName) {
                               BaseWorkspace.ParentItemIDName = 'ID';
                } else {
                               BaseWorkspace.ParentItemIDName = ParentItemIDName;
                }
                BaseWorkspace.InitializeChangesLogFlag = false;
}

Так же, запросите у поддержки последние исполняемые файлы Ваше версии.
Запросы и Веб

Ничего не помогает.... поменял функции, сделал False на IsEnabled и IsVisible у деталей в workspace.....
Воз и ныне там, ноль реакции системы
Что примечательно, даже если от пользователя настраиваю видимость и порядок деталей, то тоже по барабану, при следующем входе все возвращается на круги своя

А профиль (рядом с кэшем) чистили?

кэш чистил, профиль нет, сейчас попробую...

UPD: Не помогло ни разу.

выложите, пожалуйста, сервис scr_BaseWorkspace, я посмотрю.

// ----------------------------------------------------------------------------
// scr_BaseWorkspace
// ----------------------------------------------------------------------------

var BaseWorkspace = new Object();

var QueryString = "Запрос";
var QueryDetailPageTagValue = 'QueryDetail';

BaseWorkspace.LastGroupIsFiltered = false;
BaseWorkspace.DisableRefreshDetailCounter = 0;
BaseWorkspace.GroupsWereInitialized = false;
BaseWorkspace.ReportsWerePrepared = false;
BaseWorkspace.ActionsWerePrepared = false;
BaseWorkspace.OpenGroupDatasetInBaseScript = true;
BaseWorkspace.GroupsWereLocated = false;

function GetIsInSingleRowMode() {
return Boolean(GetAttribute(Self, IsInSingleRowModeAttrName));
}

function CanNotRefreshDetail() {
if (!Assigned(BaseWorkspace.GridDataset)) {
return true;
}
var DetailsPages = Self.ComponentsByName('pcDetails');
if ((DetailsPages) && (DetailsPages.Size == 0)) {
return true;
}
var Result = (BaseWorkspace.DisableRefreshDetailCounter > 0) ||
(BaseWorkspace.GridDataset.State == dstInactive);
return Result;
}

function ApplyFilters() {
var Dataset = fbcFilters.DatasetLink.Dataset;
try {
fbcFilters.ApplyFilter();
} catch (e) {
ShowErrorDialog(e.message);
return false;
}
if (BaseWorkspace.GridDataset) {
RefreshWorkspace();
} else {
if (Dataset.State != dstInactive) {
Dataset.Close();
}
Dataset.Open();
}
}

function SaveFilters() {
var FilterDataset = fbcFilters.FilterDatasetLink.Dataset;
if (!CurrentGroupIsFiltered(FilterDataset)) {
return;
}
FilterDataset.Edit();
fbcFilters.Save();
FilterDataset.Post();
}

function ClearFilters() {
var Dataset = fbcFilters.DatasetLink.Dataset;
fbcFilters.ClearFilter();
if (!Assigned(Dataset)) {
return;
}
if (BaseWorkspace.GridDataset) {
RefreshWorkspace();
} else {
if (Dataset.State != dstInactive) {
Dataset.Close();
}
Dataset.Open();
}
}

function PrepareFiltersBuilder(GroupsDataset, SupportsDynamicGroups) {
var IsFiltered = false;
if (SupportsDynamicGroups) {
IsFiltered = CurrentGroupIsFiltered(GroupsDataset);
}
if (IsFiltered) {
fbcFilters.Load();
} else {
if (BaseWorkspace.LastGroupIsFiltered) {
fbcFilters.ClearFilter();
}
}
amiFilterApplyAndSave.IsEnabled = IsFiltered;
BaseWorkspace.LastGroupIsFiltered = IsFiltered;
}

function OpenGroupsDataset() {
var Dataset = dlGroups.Dataset;
OpenDatasetWithDisabledEvents(Dataset);
BaseWorkspace.GroupsWereInitialized = true;
LocateToRootGroup(Dataset, BaseWorkspace.GroupParentIDFieldName,
BaseWorkspace.SavedGroupID);
ExpandCurrentNode(BaseWorkspace.GroupsTreeGrid);
BaseWorkspace.GroupsWereLocated = true;
}

function GetDatePeriodMemoryDataset(PeriodTypeValue) {
var Dataset = Services.GetNewItemByUSI('mds_DatePeriod');
Dataset.Open();
Dataset.Edit();
Dataset.Values('PeriodType') = PeriodTypeValue;
return Dataset;
}

function ApplyStandardWorkspaceFilter() {
EnableDatasetFilters(BaseWorkspace.GridDataset, false);
fbcFilters.ApplyFilter();
ApplyDatasetGroupIDFilter(BaseWorkspace.GroupsDataset,
BaseWorkspace.GridDataset);
var Grid = BaseWorkspace.Grid;
ApplyGridViewFilter(Grid.ActiveView);
}

function RefreshWorkspace() {
var GridDataset = BaseWorkspace.GridDataset;
if (!GridDataset) {
return;
}
try {
GridDataset.Close();
GridDataset.Open();
} catch (E) {
System.MessageDialog(E.message, mdtWarning, mdbOK, 0);
}
if (pcData.ActivePage.Name == pgGraphs.Name) {
System.ProcessMessages();
RefreshGraphs();
}
}

function CreateQueriesDetails() {
if (BaseWorkspace.IsQueriesDetailsBuilt) {
return;
}
BaseWorkspace.IsQueriesDetailsBuilt = true;
var QueriesDataset = BaseWorkspace.QueriesDataset;
if (!QueriesDataset) {
QueriesDataset = Services.GetNewItemByUSI('ds_Query');
if (!QueriesDataset) {
return;
}
var DataFields = QueriesDataset.DataFields;
EnableDatasetDataFields(QueriesDataset, false, true);
EnableDatasetFields(QueriesDataset, true,
['ID', 'Name', 'SeparateDetail']);
BaseWorkspace.QueriesDataset = QueriesDataset;
}
var WorkspaceCode = System.ExtractUSICode(Self.USI);
ApplyDatasetFilter(QueriesDataset, 'WorkspaceCode', WorkspaceCode, true);
QueriesDataset.FetchRecordsCount = -1;
QueriesDataset.Close();
QueriesDataset.Open();
if (IsDatasetEmpty(QueriesDataset)) {
return;
}
var Pages = Self.ComponentsByName('pcDetails');
var SeparateQueriesCount = 0;
//Self.BeginUpdate();
try {
while (!QueriesDataset.IsEOF) {
if (QueriesDataset('SeparateDetail') == 1) {
CreateQueryDetail(Pages, QueriesDataset);
SeparateQueriesCount++;
}
QueriesDataset.GoToNext();
}
var CommonQueriesCount =
QueriesDataset.RecordsCount - SeparateQueriesCount;
var QueriesDetail = Self.ComponentsByName('pgQueryDetail');
QueriesDetail.IsVisible = (CommonQueriesCount > 0);
}
finally {
// Self.EndUpdate();
}
}

function CreateQueryDetail(PageControl, QueriesDataset) {
var QueryName = QueriesDataset('Name');
var PageName = 'pgQueryDetail' + GUIDtoUID(QueriesDataset('ID'));
if (Assigned(Self.ComponentsByName(PageName))) {
return;
}
var Page = Self.CreateComponent('Page', PageName);
if (!Assigned(Page)) {
return;
}
Page.Caption = QueryString + ': ' + QueryName;
Page.Tag = QueryDetailPageTagValue;
Page.UID = QueriesDataset('ID');
var WindowContainer = Self.CreateComponent('WindowContainer',
'wnd' + PageName);
WindowContainer.AlignVertical = alvClient;
WindowContainer.AlignHorizontal = alhClient;
WindowContainer.Window = Services.GetNewItemByUSI('wnd_QueriesDetail');
var fmControlsComponent =
WindowContainer.Window.ComponentsByName('fmControls');
fmControlsComponent.IsVisible = false;
WindowContainer.Window.Attributes('QueryID') = QueriesDataset('ID');
var QueryResultsComponent =
WindowContainer.Window.ComponentsByName('grdQueryResults');
QueryResultsComponent.OffsetTop = 5;
Page.Add(WindowContainer);
PageControl.Add(Page);
}

function PrepareGridWindow(Window, Datalink) {
var WorkspaceWindowUSI = ExtractUSICodeEx(Self.USI);
if ((WorkspaceWindowUSI == 'wnd_MailWorkspace') ||
(WorkspaceWindowUSI == 'wnd_PipeLineWorkspace') ||
(WorkspaceWindowUSI == 'wnd_OLAPWorkspace') ||
(WorkspaceWindowUSI == 'wnd_UsersWorkspace') ||
(WorkspaceWindowUSI == 'wnd_PlanningView') ||
(WorkspaceWindowUSI == 'wnd_AnalysisWorkspace')) {
amiExcludeFromTheGroup.IsVisible = false;
} else {
amiExcludeFromTheGroup.IsVisible = true;
}
BaseWorkspace.GridWindow = Window;
BaseWorkspace.Grid = Window.ComponentsByName('grdData');
BaseWorkspace.GridDatalink = Datalink;
SetAttribute(Window, 'WorkspaceWindow', Self);
SetAttribute(Window, 'AddActionsMenu', Self);
Window.Prepare();
BaseWorkspace.GridDataset = GetDatasetFromWindow(Window,
DefDatasetLinkName);
Datalink.Dataset = BaseWorkspace.GridDataset;
SetDatasetAttributesForCall(BaseWorkspace.GridDataset);

}

function InitializeGroups(GroupTableUSI, ItemInGroupDatasetUSI,
ParentItemFieldName, GroupDatasetUSI , ParentIDFieldName) {
var GroupsWindow = wndGroups.Window;
BaseWorkspace.GroupsWindow = GroupsWindow;
if (IsEmptyValue(GroupDatasetUSI)) {
GroupDatasetUSI = 'ds_ItemGroup';
}
if (IsEmptyValue(ParentIDFieldName)) {
ParentIDFieldName = 'ParentGroupID';
}
SetAttribute(GroupsWindow, 'DatasetUSI', GroupDatasetUSI);
BaseWorkspace.GroupParentIDFieldName = ParentIDFieldName;
SetAttribute(GroupsWindow, 'TableUSI', GroupTableUSI);
SetAttribute(GroupsWindow, 'IDFieldName', 'ID');
SetAttribute(GroupsWindow, 'ParentIDFieldName', ParentIDFieldName);
SetAttribute(GroupsWindow, 'NameFieldName', 'Name');
SetAttribute(GroupsWindow, 'ItemInGroupDatasetUSI', ItemInGroupDatasetUSI);
SetAttribute(GroupsWindow, 'ParentItemFieldName', ParentItemFieldName);
SetAttribute(GroupsWindow, 'WorkspaceWindow', Self);
GroupsWindow.Prepare();
var Dataset = GetDatasetFromWindow(GroupsWindow, DefDatasetLinkName);
BaseWorkspace.GroupsDataset = Dataset;
BaseWorkspace.GroupsTreeGrid = GroupsWindow.ComponentsByName('grdData');
dlGroups.Dataset = Dataset;
}

function ReportMenuItemOnExecute(ActionMenuItem){
var GridDataset = BaseWorkspace.GridDataset;
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');
ReportMenuItemExecute(ActionMenuItem, GridDataset, DataGrid,
ExtractUSICodeEx(Self.USI));
}

function PrepareChangesLogDetail(ParentItemFieldName, CustomGridTable,
ParentItemIDName) {
if (!System.GetHasLicense('DatabaseLog') || (!ParentItemFieldName)) {
BaseWorkspace.ShowChangesLogDetail = false;
} else {
BaseWorkspace.ParentItemFieldName = ParentItemFieldName;
BaseWorkspace.ShowChangesLogDetail =
DoShowChangesLogDetail(CustomGridTable);
}
pgChangesLogDetail.IsAccessible = BaseWorkspace.ShowChangesLogDetail;

// if (BaseWorkspace.ShowChangesLogDetail) {
// pgChangesLogDetail.IsVisible = true;
// } else {
// return;
// }

pgChangesLogDetail.IsVisible = !!BaseWorkspace.ShowChangesLogDetail && pgChangesLogDetail.IsVisible;
if (!BaseWorkspace.ShowChangesLogDetail) {
return;
}
BaseWorkspace.ChangesLogWindow = wndChangesLogDetail.Window;
if (!ParentItemIDName) {
BaseWorkspace.ParentItemIDName = 'ID';
} else {
BaseWorkspace.ParentItemIDName = ParentItemIDName;
}
BaseWorkspace.InitializeChangesLogFlag = false;
}

function PrepareWebInfoDetail(CustomGridTable) {
BaseWorkspace.WebInfoWindow = wndWebInfoDetail.Window;
}

function PrepareGraphsDetail() {
if (!System.GetHasLicense('Graphs')) {
return false;
}
if (!Connector.CurrentUser.GetCanReadTableGroup(GraphTableGroup)) {
return false;
}
var WorkspaceCode = System.ExtractUSICode(Self.USI);
if (pcData.ActivePage.Name == pgGraphs.Name) {
pcData.ActivePage = pgGridData;
}
var GraphsDetailWindow = wndGraphsDetail.Window;
GraphsDetailWindow.Attributes('IsWorkspace') = false;
GraphsDetailWindow.Attributes('WorkspaceCode') = WorkspaceCode;
var GraphsWindow = wndGraphs.Window;
GraphsWindow.Attributes('IsWorkspace') = true;
GraphsWindow.Attributes('WorkspaceCode') = WorkspaceCode;
return true;
}

function PrepareCommonDetails(ParentItemFieldName, DontShowGraphs,
CustomGridTable, ParentItemIDName, DontShowWebAndQueries) {
PrepareChangesLogDetail(ParentItemFieldName, CustomGridTable, ParentItemIDName);
pgWebInfoDetail.IsVisible = !DontShowWebAndQueries;
pgWebInfoDetail.IsAccessible = !DontShowWebAndQueries;
pgQueryDetail.IsVisible = !DontShowWebAndQueries;
pgQueryDetail.IsAccessible = !DontShowWebAndQueries;
if (!!DontShowWebAndQueries) {
PrepareWebInfoDetail(CustomGridTable);
}
var ShowGraphs = !DontShowGraphs;
if (ShowGraphs) {
ShowGraphs = PrepareGraphsDetail();
}
// pgGraphsDetail.IsAccessible = ShowGraphs;
// pgGraphsDetail.IsVisible = ShowGraphs;

if (DontShowGraphs != null) {
pgGraphsDetail.IsVisible = ShowGraphs;
}
pgGraphsDetail.IsAccessible = ShowGraphs;
pgGraphs.IsAccessible = ShowGraphs;
pgGraphs.IsVisible = ShowGraphs;

var CallsDetail = Self.ComponentsByName('pgCallsDetail');
if (CallsDetail) {
var HasCallLicense = System.GetHasLicense('Call');
pgCallsDetail.IsVisible = HasCallLicense && pgCallsDetail.IsVisible;
pgCallsDetail.IsAccessible = HasCallLicense && pgCallsDetail.IsAccessible;
}
BaseWorkspace.DetailsControlSizeOld = pcDetails.Size;
}

function DoShowChangesLogDetail(CustomGridTable) {
if (Assigned(CustomGridTable)) {
BaseWorkspace.GridTable = CustomGridTable;
return true;
}
var ShowChangesLogDetail = false;
try {
try {
BaseWorkspace.GridTable =
BaseWorkspace.GridDataset.SelectQuery.Items(0).FromTable;
ShowChangesLogDetail = BaseWorkspace.GridTable.IsTrackChanges;
} catch(e) {
}
} finally {
return ShowChangesLogDetail;
}
}

function RefreshChangesLogDetail() {
if (!BaseWorkspace.ShowChangesLogDetail) {
return;
}
var ChangesLogWindow = BaseWorkspace.ChangesLogWindow;
var ParentItemID = null;
if (BaseWorkspace.GridDataset.IsActive) {
ParentItemID = BaseWorkspace.GridDataset.
ValAsGUID(BaseWorkspace.ParentItemIDName);
}
if (BaseWorkspace.InitializeChangesLogFlag != true) {
BaseWorkspace.InitializeChangesLogFlag = true;
var IsBuildChangesLogWindow = BuildChangesLogWindow(
BaseWorkspace.GridTable, BaseWorkspace.GridDataset,
BaseWorkspace.ParentItemFieldName, ParentItemID, ChangesLogWindow);
if (!IsBuildChangesLogWindow) {
BaseWorkspace.ShowChangesLogDetail = false;
Log.Write(2, "Ошибка при попытке показать журнал изменений");
}
} else {
var ChangesLogDataset =
BaseWorkspace.ChangesLogWindow.ComponentsByName('dlData').Dataset;
RefreshDetailData(BaseWorkspace.GridDataset,
BaseWorkspace.ParentItemIDName, ChangesLogDataset, 'RecordID');
}
var btnOperations = ChangesLogWindow.ComponentsByName('btnOperations');
btnOperations.IsEnabled = !IsEmptyGUID(ParentItemID);
}

function RefreshGraphsDetail() {
if (BaseWorkspace.InitializeGraphsDetailFlag != true) {
BaseWorkspace.GraphsDetail = wndGraphsDetail.Window;
SetAttribute(BaseWorkspace.GraphsDetail, 'GridDataset',
BaseWorkspace.GridDataset);
BaseWorkspace.InitializeGraphsDetailFlag = true;
BaseWorkspace.GraphsDetail.Prepare();
} else {
BaseWorkspace.GraphsDetail.Notify(Self, MSG_REFRESHDATA, 0);
}
}

function RefreshWebInfoDetail() {
if (BaseWorkspace.InitializeWebInfoFlag != true) {
BaseWorkspace.WebInfoWindow = wndWebInfoDetail.Window;
SetAttribute(BaseWorkspace.WebInfoWindow, 'WorkspaceUSI',
System.ExtractUSICode(Self.USI));
SetAttribute(BaseWorkspace.WebInfoWindow, 'WorkspaceDataset',
BaseWorkspace.GridDataset);
BaseWorkspace.InitializeWebInfoFlag = true;
BaseWorkspace.WebInfoWindow.Prepare();
BaseWorkspace.WebInfoWindow.Notify(Self, MSG_REFRESHDATA, 0);
} else {
BaseWorkspace.WebInfoWindow.Notify(Self, MSG_REFRESHDATA, 0);
}
}

function RefreshQueriesDetail(Page) {
if (!Page.IsVisible) {
return;
}
if (Page.Tag == QueryDetailPageTagValue) {
var ContainerName = 'wnd' + Page.Name;
} else {
var ContainerName = 'wndQueriesDetail';
}
var QueriesContainer = Self.ComponentsByName(ContainerName);
if (!Assigned(QueriesContainer)) {
return;
}
BaseWorkspace.QueriesDetail = QueriesContainer.Window;
if (!Assigned(BaseWorkspace.QueriesDetail)) {
return;
}
if (!Assigned(BaseWorkspace.InitializationQueriesDetail)) {
BaseWorkspace.InitializationQueriesDetail = GetNewDictionary();
}
if (BaseWorkspace.InitializationQueriesDetail(Page.Name) != true) {
if (!Assigned(BaseWorkspace.QueriesDetail)) {
return;
}
SetAttribute(BaseWorkspace.QueriesDetail, 'GridDataset',
BaseWorkspace.GridDataset);
BaseWorkspace.InitializationQueriesDetail(Page.Name) = true;
BaseWorkspace.QueriesDetail.Prepare();
} else {
BaseWorkspace.QueriesDetail.Notify(Self, MSG_REFRESHDATA, 0);
}
}

function RefreshCommonDetails() {
if (pcDetails.ActivePage.Name == pgChangesLogDetail.Name) {
RefreshChangesLogDetail();
} else
if (pcDetails.ActivePage.Name == pgGraphsDetail.Name) {
RefreshGraphsDetail();
} else
if (pcDetails.ActivePage.Name == pgWebInfoDetail.Name) {
RefreshWebInfoDetail();
} else
if ((pcDetails.ActivePage.Name == pgQueryDetail.Name)
|| (pcDetails.ActivePage.Tag == QueryDetailPageTagValue)) {
RefreshQueriesDetail(pcDetails.ActivePage);
}
}

function RefreshDetails() {
if (CanNotRefreshDetail()) {
return false;
} else {
RefreshCommonDetails();
}
return true;
}

function RefreshGraphs() {
if (BaseWorkspace.InitializeGraphsFlag != true) {
BaseWorkspace.Graphs = wndGraphs.Window;
SetAttribute(BaseWorkspace.Graphs, 'GridDataset',
BaseWorkspace.GridDataset);
BaseWorkspace.InitializeGraphsFlag = true;
BaseWorkspace.Graphs.Prepare();
} else {
BaseWorkspace.Graphs.Notify(Self, MSG_REFRESHDATA, 0);
}
}

function CopyFilters() {
if (!Assigned(BaseWorkspace.FiltersCopyBuffer)) {
BaseWorkspace.FiltersCopyBuffer = GetNewXMLStorage();
}
var FiltersCopyBuffer = BaseWorkspace.FiltersCopyBuffer;
GetFilterBuilderXMLDataEx(fbcFilters, FiltersCopyBuffer);
}

function PasteFilters() {
var FiltersCopyBuffer = BaseWorkspace.FiltersCopyBuffer;
if (!Assigned(FiltersCopyBuffer)) {
return;
}
if ((fbcFilters.FiltersBuilder.RootItems.Count != 0) &&
ShowConfirmationDialog("Вы действительно хотите заменить существующий фильтр?")
!= wmrYes) {
return
}
SetFilterBuilderXMLDataEx(fbcFilters, FiltersCopyBuffer);
}

function BeforeFilterWorkspace() {
var GridWindow = wndGridData.Window;
if (!GridWindow) {
return;
}
GridWindow.ScriptControl.CodeObject.grdData.CancelQuickFilter();
}

function SaveDescription() {
var DescriptionDetail = Self.ComponentsByName('wndDescriptionDetail');
if (DescriptionDetail) {
var DataseLink = DescriptionDetail.Window.ComponentsByName('dlData');
if (DataseLink.Dataset.IsActive) {
DataseLink.Dataset.Close();
}
}
}

function ExcludeFromTheGroup() {
var GroupsDataset = BaseWorkspace.GroupsDataset;
var GroupsWindow = BaseWorkspace.GroupsWindow;
if (!Assigned(GroupsDataset)) {
return;
}
if (!Assigned(GroupsWindow)) {
return;
}
if (IsEmptyGUID(GroupsDataset('ParentGroupID'))) {
ShowInformationDialog("Нельзя исключить запись(и) из корневой группы");
return;
}
if (GroupsDataset.ValAsBool('IsFiltered')) {
ShowInformationDialog("Нельзя исключить запись(и) из динамической группы");
return;
}
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');
var GridDataset = BaseWorkspace.GridDataset;
var SelectedIDs = DataGrid.SelectedIDs;
var GroupID = GroupsDataset('ID');
var ItemInGroupDatasetUSI = GetAttribute(GroupsWindow,
'ItemInGroupDatasetUSI');
var ParentItemFieldName = GetAttribute(GroupsWindow, 'ParentItemFieldName');
if (IsEmptyValue(ItemInGroupDatasetUSI)) {
return;
}
var ItemInGroupDataset = GetSingleItemByCode(ItemInGroupDatasetUSI,
'BaseWorkspace' + ItemInGroupDatasetUSI);
var DeleteRecordCount = 0;
for (var i = 0; i < SelectedIDs.Count; i++) {
EnableDatasetFilters(ItemInGroupDataset, false);
ApplyDatasetFilter(ItemInGroupDataset, 'GroupID', GroupID, true);
ApplyDatasetFilter(ItemInGroupDataset, ParentItemFieldName,
SelectedIDs(i), true);
ItemInGroupDataset.Open();
if (!ItemInGroupDataset.IsEmptyPage) {
if (GetCanDeleteData(ItemInGroupDataset)) {
DeleteRecordCount++;
ItemInGroupDataset.Delete();
}
}
ItemInGroupDataset.Close();
}
ShowInformationDialog(FormatStr("Исключено %1 записей", DeleteRecordCount));
RefreshDataset(GridDataset);
}

function ClearAllWorkspaceFilters() {
var Message = "Действие может занять некоторое время. Вы действительно хотите продолжить?";
if (ShowConfirmationDialog(Message) != wmrYes) {
return;
}
System.BeginProcessing();
LocateToRootGroup(dlGroups.Dataset, BaseWorkspace.GroupParentIDFieldName);
pcData.ActivePage = pgGridData;
var GridWindow = wndGridData.Window;
if (!IsEmptyValue(GridWindow)) {
for (var i = 0; i < GridWindow.ComponentCount; i++) {
var WindowItem = GridWindow.Components(i);
if ((WindowItem.TypeCode == 'DataGridView') &&
!WindowItem.FilterSetCode) {
break;
}
}
var GridData = GridWindow.ComponentsByName('grdData');
GridData.ActiveView = WindowItem;
GridData.CancelQuickFilter();
}
ClearFrameComponents(fmGroupsWindow);
ClearFilters();
System.EndProcessing();
}

function ClearFrameComponents(FrameComponent) {
for (var i = 0; i < FrameComponent.Count; i++) {
var FrameItem = FrameComponent.Items(i);
switch (FrameItem.TypeCode) {
case 'Frame':
case 'FrameGroup':
ClearFrameComponents(FrameItem);
break;
case 'CheckBox':
FrameItem.IsChecked = false;
break;
case 'EnumControl':
FrameItem.Value = System.EmptyValue;
break;
case 'Edit':
FrameItem.Value = '';
break;
default:
if (FrameItem.TypeCode.indexOf('DataControl') != -1) {
FrameItem.DataField.Value = null;
} else {
if (FrameItem.Value) {
FrameItem.Value = null;
}
}
}
}
}

function AddDuplicatesMergeAction() {
if (!BaseWorkspace.GridTable) {
return;
}
if (!BaseWorkspace.GridTable.IsDuplicateSearching) {
return;
}
if (!DuplicateUtils.HasDuplicatesSearchRights) {
return;
}
if (amiActions.Count > 1) {
CreateActionMenuSeparatorItem(amiActions);
}
AddActionMenuItem(amiActions, "Объединить выделенные записи", '',
'amiDuplicatesMergeOnExecute', 'amiDuplicatesMerge');
BaseWorkspace.MergeDuplicatesActionCreated = true;
}

function MergeDuplicates() {
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');
MergeSelectedDuplicates(Self, DataGrid,
BaseWorkspace.GridDataset.USI);
}

// ----------------------------------------------------------------------------
// Event handlers
// ----------------------------------------------------------------------------

function amiFilterApplyOnExecute(ActionMenuItem) {
ApplyFilters();
}

function amiFilterClearOnExecute(ActionMenuItem) {
ClearFilters();
}

function amiFilterSaveOnExecute(ActionMenuItem) {
SaveFilters();
}

function dlGroupsOnDatasetAfterPositionChange(Dataset) {
if (BaseWorkspace.GroupsWereLocated) {
System.ProcessMessages();
}
PrepareFiltersBuilder(Dataset, true);
}

function dlGroupsOnDatasetAfterOpen(Dataset) {
System.ProcessMessages();
PrepareFiltersBuilder(Dataset, true);
}

function dlGroupsOnDatasetRefreshRecord(Dataset, KeyValue, AddNewRecordOnPage) {
PrepareFiltersBuilder(Dataset, true);
}

function wnd_BaseWorkspaceOnNotify(ScriptableService, Sender, Message, Data) {
if (Message == MSG_ENABLEREFRESHDETAIL) {
if (BaseWorkspace.DisableRefreshDetailCounter > 0) {
BaseWorkspace.DisableRefreshDetailCounter =
BaseWorkspace.DisableRefreshDetailCounter - 1;
if (BaseWorkspace.DisableRefreshDetailCounter == 0) {
Self.ScriptControl.Run('RefreshDetails');
}
}
return;
}
if (Message == MSG_DISABLEREFRESHDETAIL) {
BaseWorkspace.DisableRefreshDetailCounter =
BaseWorkspace.DisableRefreshDetailCounter + 1;
return;
}
if (Message == MSG_QUERYFILTERWINDOW_EXCELMODE_OK) {
var QueryBuilderData = Sender.Attributes('QueryBuilderData');
ShowExcelReport(QueryBuilderData, null, Self);
return;
}
if (Message == MSG_QUERYFILTERWINDOW_WORDMODE_OK) {
var QueryBuilderData = Sender.Attributes('QueryBuilderData');
ShowWordReport(QueryBuilderData, null, Self);
return;
}
if (Message == MSG_SENDEMAIL) {
var Service = Services.GetSingleItemByUSI('scr_MailUtils');
Service.ScriptControl.CodeObject.SendEmailByTemplate(Data);
return;
}
if (Message == MSG_DUPLICATESMERGED) {
RefreshDataset(BaseWorkspace.GridDataset);
BaseWorkspace.GridDataset.Locate('ID', Data);
}
if (Message == MSG_REMOVEPARENTCONTAINERPAGE) {
Self.RemoveComponent(Data);
}
}

function wnd_BaseWorkspaceOnShow(Window) {
if (!BaseWorkspace.WasShowed){
if (BaseWorkspace.OpenGroupDatasetInBaseScript){
OpenGroupsDataset();
}
BaseWorkspace.WasShowed = true;
}
CreateQueriesDetails();
}

function amiReportsOnPrepare(ActionMenuItem) {
if (!BaseWorkspace.ReportsWerePrepared){
BaseWorkspace.ReportsWerePrepared = true;
var ReportMenuCustom = GetNewDictionary();
PrepareReportsMenu(Self, amiReports, ExtractUSICodeEx(Self.USI),
ReportMenuCustom);
BaseWorkspace.ReportMenuCustom = ReportMenuCustom;
amiReportFake.Caption = "Нет отчетов";
}
var RootMenuItem = amiReports;
var SelectQuery = Services.GetNewItemByUSI('sq_ReportCustomTypes');
for (var i = 0; i < RootMenuItem.Count; i++) {
var MenuItem = RootMenuItem.Items(i);
var ReportID = MenuItem.Tag;
var FilterFieldName = BaseWorkspace.ReportMenuCustom(ReportID);
var MenuIsVisible = true;
if (!IsEmptyValue(FilterFieldName)) {
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');
var Dataset = DataGrid.DatasetLink.Dataset;
var FilterFieldValues = [];
Dataset.DisableEvents();
try {
var ID = Dataset.Values('ID');
for (var j = 0; j < DataGrid.SelectedIDs.Count; j++) {
if (Dataset.Locate('ID', DataGrid.SelectedIDs(j))) {
var FilterFieldValue =
GetFieldValueFromDisabledField(Dataset, FilterFieldName);
FilterFieldValues.push(FilterFieldValue);
}
}
Dataset.Locate('ID', ID);
} finally {
Dataset.EnableEvents();
}
if (FilterFieldValues.length == 0) {
MenuIsVisible = false;
} else {
ApplySelectQueryFilter(SelectQuery, 'ReportID', ReportID, true);
ApplySelectQueryIncludeFilter(SelectQuery, 'ValueIDs', FilterFieldValues, true);
var ReportCustomTypesDataset = SelectQuery.Open();
MenuIsVisible = (!IsDatasetEmpty(ReportCustomTypesDataset));
ReportCustomTypesDataset.Close();
}
}
if (MenuItem.TypeCode != 'ActionMenuSeparator') {
MenuItem.IsVisible = MenuIsVisible;
}
}
var VisibleItemsCount = GetAccessibleReportsCount(amiReports);
amiReportFake.IsVisible = (VisibleItemsCount <= 1);
}

function GetAccessibleReportsCount(RootItem) {
var Result = 0;
for (var i = 0; i < RootItem.Count; i++) {
if (RootItem.Items(i).IsVisible) {
Result++;
}
}
return Result;
}

function SendEmailByTemplateOnExecute(ActionMenuItem) {
var TemplateID = ActionMenuItem.Tag;
var GridDataset = BaseWorkspace.GridDataset;
if (IsEmptyValue(BaseWorkspace.GridWindow)) {
ShowInformationDialog("Из этого раздела нельзя отправлять письма");
return;
}
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');

var IDs = new Array();
if ((DataGrid) && (DataGrid.DatasetLink.Dataset == GridDataset)) {
var Items = DataGrid.SelectedIDs;
for (var i = 0; i < Items.Count; i++) {
IDs.push(Items(i));
}
} else {
if (!IsDatasetEmpty(GridDataset)) {
var IDField = GridDataset.DataFields.ItemsByName('ID');
if (IDField && IDField.IsEnabled) {
IDs.push(IDField.Value);
}
}
}
if (IDs.length == 0) {
ShowInformationDialog("В основном реестре не выбрано ни одной записи");
return;
}

var MailParams = new Object();
MailParams.TemplateID = TemplateID;
MailParams.IDs = IDs;
if (Self.Script.GetIsMethodExists('SendEmailByTemplateFromWorkspace')) {
if (!SendEmailByTemplateFromWorkspace(TemplateID, MailParams)) {
return;
}
}
var Service = Services.GetSingleItemByUSI('scr_MailUtils');
Service.ScriptControl.CodeObject.SendEmailByTemplate(MailParams.TemplateID,
MailParams);
}

function amiActionsOnPrepare(ActionMenuItem) {
ActionMenuItem.ParentCollection = amMainMenu;
if (!BaseWorkspace.ActionsWerePrepared){
BaseWorkspace.ActionsWerePrepared = true;
BuildActionMenu(Self, amiActions, ExtractUSICodeEx(Self.USI));
AddDuplicatesMergeAction();
var VisibleActionsCount = 0;
for (var i = 0; i < amiActions.Count; i++) {
if (amiActions.Items(i).IsVisible) {
VisibleActionsCount++;
}
}
if (VisibleActionsCount > 1){
amiActions.RemoveItem(amiActionFake);
} else {
amiActionFake.Caption = "Нет действий";
}
} else {
if (BaseWorkspace.MergeDuplicatesActionCreated) {
var Item = amiActions.CoreItemsByKey('amiDuplicatesMerge');
var DataGrid = BaseWorkspace.GridWindow.Attributes('DataGrid');
Item.IsEnabled = (DataGrid.SelectedIDs.Count > 1);
}
}
amiExcludeFromTheGroup.IsEnabled =
!IsDatasetEmpty(BaseWorkspace.GridDataset);
}

function wnd_BaseWorkspaceOnClose(Window) {
}

function pcDataOnChangedActivePage(Pages) {
var GridDataset = BaseWorkspace.GridDataset;
if (!GridDataset) {
return;
}
if (pcData.ActivePage.Name == pgGraphs.Name) {
RefreshGraphs();
pcDetails.IsVisible = false;
} else {
pcDetails.IsVisible = true;
}
}

function SendNotifyToMainWindow(GotoWorkspaceUSI, Sender, Message, Data) {
var MainWindow = Connector.Attributes('MainWindow');
var MainWindowScript = Connector.Attributes('MainWindowScript');
MainWindowScript.NewItemWorkspaceWindowUSI = GotoWorkspaceUSI;
if (Assigned(MainWindow)) {
Sender.Attributes('WorkspaceWindowCode') =
MainWindowScript.NewItemWorkspaceWindowUSI;
MainWindow.Notify(Sender, Message, Data);
}
}

function SendNotifyToDetailWindow(DetailWindow, Sender, Message, Data) {
if (Assigned(DetailWindow)) {
DetailWindow.Notify(Sender, Message, Data);
}
}

function ProcessNotifyMessage(GotoWorkspaceUSI, DetailWindow, Sender,
Message, Data){
if (!!Sender.Attributes('AddNewRecordOnPage')) {
SendNotifyToMainWindow(GotoWorkspaceUSI, Sender, Message, Data);
}
SendNotifyToDetailWindow(DetailWindow, Sender, Message, Data);
}

function pcDetailsOnChangedActivePage(Pages) {
//fmDetail.HeaderCaption = Pages.ActivePage.Caption;
}

function amFiltersOnPrepare(ActionMenu, Control) {
var FilterDataset = fbcFilters.FilterDatasetLink.Dataset;
var IsFiltered = CurrentGroupIsFiltered(FilterDataset);
amiFilterSave.IsEnabled = IsFiltered;
amiFilterPaste.IsEnabled = IsFiltered && Assigned(BaseWorkspace.FiltersCopyBuffer)
}

function amiFilterCopyOnExecute(ActionMenuItem, Sender) {
CopyFilters();
}

function amiFilterPasteOnExecute(ActionMenuItem, Sender) {
PasteFilters();
}

function fmClientOnFrameExpand(FrameSet, FrameName) {
if (FrameName != 'pcDetails') {
return;
}
if (!Self.Script.GetIsMethodExists('RefreshDetails')) {
return;
}
Self.ScriptControl.CodeObject.RefreshDetails();
}

function amiFilterApplyAndSaveOnExecute(ActionMenuItem, Sender) {
ApplyFilters();
SaveFilters();
}

function wnd_BaseWorkspaceOnProfileDeserialize(Window, Node) {
BaseWorkspace.SavedGroupID = Node.GetAttributeAsStr('SavedGroupID', '');
CreateQueriesDetails();
}

function wnd_BaseWorkspaceOnProfileSerialize(Window, Node) {
Node.SetAttributeAsStr('SavedGroupID', dlGroups.Dataset('ID'), '');
SaveDescription();
}

function amiFiltersApplyOnExecute(ActionMenuItem, Sender) {
ApplyFilters();
}

function amiExcludeFromTheGroupOnExecute(ActionMenuItem, Sender) {
ExcludeFromTheGroup();
}

function amiWorkspaceClearOnExecute(ActionMenuItem, Sender) {
ClearAllWorkspaceFilters();
}

function amiDuplicatesMergeOnExecute(ActionMenuItem, Sender) {
MergeDuplicates();
}

Спасибо! проанализирую, сообщу результат.

Сравните свой сервис, и сервис который я прикрепил, (можете использовать araxis merge или аналог),
И еще, пожалуйста, не выгружайте весь сервис в тело письма, сложно читать переписку, просто сохраните его и прикрепите к ответу :) scr_baseworkspace.rar

сорри, на автомате руки сработали...
больше не буду :smile:

Показать все комментарии