|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x2.RecordViewWidgetManager = (function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
function RecordViewWidgetManager (argsDict) { |
|
var defaultArgs = { |
|
cssSelectorPrefix: '', |
|
widgetType: 'recordView', |
|
connectedContainerSelector: '', |
|
modelId: null, |
|
modelType: null |
|
}; |
|
|
|
auxlib.applyArgs (this, defaultArgs, argsDict); |
|
TwoColumnSortableWidgetManager.call (this, argsDict); |
|
} |
|
|
|
RecordViewWidgetManager.prototype = auxlib.create (TwoColumnSortableWidgetManager.prototype); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RecordViewWidgetManager.prototype.addWidgetToHiddenWidgetsMenu = function (widgetSelector) { |
|
SortableWidgetManager.prototype.addWidgetToHiddenWidgetsMenu.call (this, widgetSelector); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RecordViewWidgetManager.prototype._afterShowWidgetContents = function (widget$) { |
|
|
|
|
|
hideShowHiddenWidgetSubmenuDividers (); |
|
widget$.data ('x2-widget').afterRefresh (); |
|
}; |
|
|
|
|
|
|
|
|
|
RecordViewWidgetManager.prototype._getShowWidgetContentsData = function (widgetClass) { |
|
var that = this; |
|
var data = { |
|
widgetClass: widgetClass, |
|
widgetType: that.widgetType, |
|
modelId: that.modelId, |
|
modelType: that.modelType |
|
}; |
|
|
|
|
|
var widgetClassName = widgetClass.replace (/_$/, ''); |
|
if (x2[widgetClassName] && x2[widgetClassName] instanceof x2.TransactionalViewWidget) { |
|
data.relationships = x2.TransactionalViewWidget.relationships ? 1 : 0; |
|
} |
|
return data; |
|
}; |
|
|
|
RecordViewWidgetManager.prototype._setUpRecordViewTypeToggleBehavior = function () { |
|
var menuItem$ = $('#view-record-action-menu-item'); |
|
var that = this; |
|
menuItem$.find ('.journal-view-checkbox').click (function () { |
|
var enable = $(this).is (':checked') ? 1 : 0; |
|
var publisher$ = $('#PublisherWidget-widget-container-'); |
|
if (enable) { |
|
if (!publisher$.children ().length) { |
|
that._showWidgetContents (publisher$.data ('x2-widget').getWidgetKey ()); |
|
} else { |
|
publisher$.show (); |
|
} |
|
} else { |
|
$('#PublisherWidget-widget-container-').hide (); |
|
} |
|
auxlib.saveMiscLayoutSetting ('enableJournalView', enable); |
|
}); |
|
menuItem$.find ('.transactional-view-checkbox').click (function () { |
|
var enable = $(this).is (':checked') ? 1 : 0; |
|
if (enable) { |
|
$('.transactional-view-widget').each (function () { |
|
if (!$(this).children ().length) { |
|
if ($(this).data ('x2-widget')) |
|
that._showWidgetContents ($(this).data ('x2-widget').getWidgetKey ()); |
|
} else { |
|
$(this).show (); |
|
} |
|
}); |
|
} else { |
|
$('.transactional-view-widget').hide (); |
|
} |
|
auxlib.saveMiscLayoutSetting ( |
|
'enableTransactionalView', enable); |
|
}); |
|
|
|
var prevMode = $('#record-view-type-menu').is (':visible'); |
|
$('#view-record-action-menu-item > span').click (function () { |
|
auxlib.saveMiscLayoutSetting ('viewModeActionSubmenuOpen', !prevMode ? 1 : 0); |
|
prevMode = !prevMode; |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
RecordViewWidgetManager.prototype._activate = function () { |
|
$(this._widgetsBoxSelector + ',' + this._widgetsBoxSelector2).addClass ('sortable-widget-drag'); |
|
TwoColumnSortableWidgetManager.prototype._activate.apply (this, arguments); |
|
}; |
|
|
|
RecordViewWidgetManager.prototype._deactivate = function () { |
|
$(this._widgetsBoxSelector + ',' + this._widgetsBoxSelector2). |
|
removeClass ('sortable-widget-drag'); |
|
TwoColumnSortableWidgetManager.prototype._activate.apply (this, arguments); |
|
}; |
|
|
|
RecordViewWidgetManager.prototype._init = function () { |
|
|
|
|
|
|
|
this._hiddenWidgetsMenuSelector = '#x2-hidden-recordView-widgets-menu'; |
|
this._hiddenWidgetsMenuItemSelector = |
|
'.x2-hidden-widgets-menu-item.' + this.widgetType + '-widget'; |
|
this._setUpRecordViewTypeToggleBehavior (); |
|
this._widgetsBoxSelector = '#' + this.cssSelectorPrefix + 'widgets-container-2'; |
|
this._widgetsBoxSelector2 = '#' + this.cssSelectorPrefix + 'widgets-container-inner'; |
|
|
|
SortableWidgetManager.prototype._init.call (this); |
|
}; |
|
|
|
return RecordViewWidgetManager; |
|
|
|
}) (); |
|
|