Skip to content

Commit

Permalink
Merge pull request #225 from Open-MBEE/feature/omgoptions
Browse files Browse the repository at this point in the history
add options to config for view link
  • Loading branch information
dlamoris authored May 21, 2024
2 parents dd76518 + 66f9cf5 commit 25c66a3
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 93 deletions.
1 change: 1 addition & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.json
!omg.json
!example.json
!config.js
6 changes: 6 additions & 0 deletions config/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
"labels": ["opensource"]
},
"loginTimout": 600000,
"viewLink": {
"sectionPrefix": "Section ",
"appendixPrefix": "Appendix ",
"hidePrefixForSections": false,
"alwaysKeepCurrentDoc": false
},
"experimental": [
{
"id": "experimental-magic",
Expand Down
42 changes: 42 additions & 0 deletions config/omg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"apiUrl": "https://mms4.openmbee.org",
"printUrl": "https://mms4.openmbee.org/convert",
"basePath": "",
"enableDebug": false,
"customLabels": {
"pi": "PROPRIETARY: Proprietary Information",
"export_ctrl": "EXPORT WARNING: No export controlled documents allowed on this server",
"no_public_release": "Not for Public Release or Redistribution",
"unclassified": "CLASSIFICATION: This system is UNCLASSIFIED"
},
"loginBanner": {
"labels": [["opensource"]],
"separator": " ",
"background": "#0D47A1",
"color": "#e8e8e8"
},
"loginWarning": {
"message": [
"By accessing and using this information system, you acknowledge and consent to the following:\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
]
},
"banner": {
"labels": []
},
"footer": {
"labels": ["opensource"]
},
"loginTimout": 600000,
"viewLink": {
"sectionPrefix": "Clause ",
"appendixPrefix": "Annex ",
"hidePrefixForSections": true,
"alwaysKeepCurrentDoc": true
},
"experimental": [
{
"id": "experimental-magic",
"name": "Content Magic"
}
]
}
76 changes: 19 additions & 57 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Visualizations
----------------------------------------

For TomSawyer diagrams or plots, please see the DocGen Manual.

Temporal Diff Tag
-------------------------------------------

Expand Down Expand Up @@ -227,7 +227,7 @@ table[border='0'], table[border='0'] th, table[border='0'] td {border:
0px;}
table, th > p, td > p {margin: 0px; padding: 0px;}
table, th > div > p, td > div > p {margin: 0px; padding: 0px;}
table mms-transclude-doc p {margin: 0 0 5px;}
table transclude-doc p {margin: 0 0 5px;}
th {background-color: #f2f3f2;}
/\*------------------------------------------------------------------
3. Typography
Expand Down Expand Up @@ -263,16 +263,16 @@ line-through;}
/\*------------------------------------------------------------------
3.2 Errors
------------------------------------------------------------------\*/
.mms-error {background: repeating-linear-gradient(45deg,#fff,#fff
.ve-error {background: repeating-linear-gradient(45deg,#fff,#fff
10px,#fff2e4 10px,#fff2e4 20px);}
/\*------------------------------------------------------------------
4. Figure Captions
------------------------------------------------------------------\*/
caption, figcaption, .mms-equation-caption {text-align: center;
caption, figcaption, .caption-type-equation {text-align: center;
font-weight: bold;}
table, figure {margin-bottom: 10px;}
.mms-equation-caption {float: right;}
mms-view-equation, mms-view-figure, mms-view-image {page-break-inside:
.caption-type-equation {float: right;}
present-equation, present-figure, present-image {page-break-inside:
avoid;}
/\*------------------------------------------------------------------
5. Table of Contents
Expand Down Expand Up @@ -318,15 +318,15 @@ p, div {widows: 2; orphans: 2;}
/\*------------------------------------------------------------------
9. Bookmark Level
------------------------------------------------------------------\*/
.h1 {bookmark-level: 1;}
.h2 {bookmark-level: 2;}
.h3 {bookmark-level: 3;}
.h4 {bookmark-level: 4;}
.h5 {bookmark-level: 5;}
.h6 {bookmark-level: 6;}
.h7 {bookmark-level: 7;}
.h8 {bookmark-level: 8;}
.h9 {bookmark-level: 9;}`
.bm-level-1 {bookmark-level: 1;}
.bm-level-2 {bookmark-level: 2;}
.bm-level-3 {bookmark-level: 3;}
.bm-level-4 {bookmark-level: 4;}
.bm-level-5 {bookmark-level: 5;}
.bm-level-6 {bookmark-level: 6;}
.bm-level-7 {bookmark-level: 7;}
.bm-level-8 {bookmark-level: 8;}
.bm-level-9 {bookmark-level: 9;}`

For page related css, see Paged Media
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -347,8 +347,8 @@ Available Classes
| .fir | first view |
| st-chapter | |
+------------+---------------------------------------------------------+
| .h1, .h2, | corresponds to view or section titles at that level |
| .h3, etc | (title of view/section 1.2.3 would have class of .h3) |
| .bm-level-1, .bm-level-2, | corresponds to view or section titles at that level |
| .bm-level-3, etc | (title of view/section 1.2.3 would have class of .bm-level-3) |
+------------+---------------------------------------------------------+
| .v | the h1 title of a view or section |
| iew-title, | |
Expand Down Expand Up @@ -377,8 +377,8 @@ Change font size of titles based on level:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:mark:`//smaller sizes for nested titles
.h1 {font-size: 18pt;} .h2 {font-size: 14pt;} .h3 {font-size: 12pt;}
.h4 {font-size: 10pt;} .h5, .h6, .h7, .h8, .h9 {font-size: 9pt;}
.bm-level-1 {font-size: 18pt;} .bm-level-2 {font-size: 14pt;} .bm-level-3 {font-size: 12pt;}
.bm-level-4 {font-size: 10pt;} .bm-level-5, .bm-level-6, .bm-level-7, .bm-level-8, .bm-level-9 {font-size: 9pt;}
//start top level sections on odd pages
.chapter {page-break-before: right;}`

Expand Down Expand Up @@ -424,41 +424,3 @@ element's, then 'master' for refId and 'latest' for commitId.

The attributes can be added manually via the text editor's html editing
tab if desired.

View Editor User Guide: 10 Run XLR
----------------------------------

There's a custom tag one can add to trigger an XLR release from any
view.

To add the button, go into source mode of a text field and add the
following:

<run-xlr template-id="{templateId}" xlr-task-name="Run XLR"
xlr-release-name="release name">ignore</run-xlr>

Where the template-id is the string in the url for the xlr design
template, with '/' instead of '-'.

Ex, if the url in xlr for your template is this:

https://cae-xlrelease.jpl.nasa.gov/#/templates/Folder898892011-Folder521642095-Folder47c1077774ae4cf69d499daa260b3904-Release619d801931384eae9a25ba8baff2,

the template-id would be

Folder898892011/Folder521642095/Folder47c1077774ae4cf69d499daa260b3904/Release619d801931384eae9a25ba8baff2

The xlr-task-name attribute is just the name of the button that will
display.

The xlr-release-name is what the release will be called in xlr.

Once a user clicks the button, a login popup will appear, this is for
logging into xlrelease using jpl username/pass and permission to create
a release based on the template is controlled by xlr.

Currently will send the following as variables in the release:

"contentEditor": jpl username

"editorEmail": jpl email
9 changes: 8 additions & 1 deletion src/lib/ckeditor/contents.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@ a > img {
background-color: rgba(255, 0, 0, 0.05);
margin: 10px;
}

table {
border: 1px solid #ddd;
border-collapse: collapse;
}
table th, table td {
border: 1px solid #ddd;
padding: 5px;
}
.image-clean
{
border: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ thead td,
table caption {
font-weight: bold;
}

view table, spec-inspector table {
border-collapse: collapse;
border: 1px solid #ddd;
}
view table td, view table th, spec-inspector table td, spec-inspector table th {
border: 1px solid #ddd;
padding: 5px;
}
.table {
tr {
@include globals.transition(globals.$background-hover-transition);
Expand Down
12 changes: 6 additions & 6 deletions src/ve-app/pane-left/left-pane.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { left_default_buttons } from './left-buttons.config';

import { VeComponentOptions, VePromise, VeQService } from '@ve-types/angular';
import {
DocumentObject,
ElementObject,
ElementsRequest,
ElementsResponse,
Expand Down Expand Up @@ -355,9 +356,8 @@ class LeftPaneController implements angular.IComponentController {
projectId: this.treeApi.projectId,
};
this.elementSvc.getElement<ViewObject>(reqOb).then((root) => {
// TODO this call is taking a long time that keeps the tree from being visible, need
// to see if it can be moved to a resolve or faster
/*if (this.apiSvc.isDocument(root) && this.$state.includes('**.present.**')) {
// TODO this call may take a long time that keeps the tree from being visible?
if (this.apiSvc.isDocument(root) && this.$state.includes('**.present.**')) {
this.viewSvc
.getDocumentMetadata({
elementId: root.id,
Expand All @@ -367,20 +367,20 @@ class LeftPaneController implements angular.IComponentController {
.then((result) => {
this.treeApi.numberingDepth = result.numberingDepth
this.treeApi.numberingSeparator = result.numberingSeparator
this.treeApi.startChapter = (root as DocumentObject)._startChapter
this.treeApi.startChapter = Number.isInteger((root as DocumentObject)._startChapter)
? (root as DocumentObject)._startChapter
: 1

if (!(root as DocumentObject)._childViews)
(root as DocumentObject)._childViews = []
resolve(root)
}, reject)
} else {*/
} else {
this.treeApi.numberingDepth = 0;
this.treeApi.numberingSeparator = '.';
this.treeApi.startChapter = 1;
resolve(root);
//}
}
}, reject);
} else {
resolve(null);
Expand Down
26 changes: 24 additions & 2 deletions src/ve-components/presentations/mms-view-link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { veComponents } from '@ve-components';

import { VeComponentOptions } from '@ve-types/angular';
import { ElementObject, ElementsRequest } from '@ve-types/mms';
import {VeConfig} from "@ve-types/config";
import {StateService} from "@uirouter/angularjs";

/**
* @ngdoc directive
Expand Down Expand Up @@ -64,6 +66,7 @@ class ViewLinkController implements angular.IComponentController {
'$scope',
'$element',
'$compile',
'$state',
'growl',
'ElementService',
'ApiService',
Expand All @@ -77,18 +80,22 @@ class ViewLinkController implements angular.IComponentController {
private docid: string;
showNum: boolean;
vid: string;
private veConfig: VeConfig;

constructor(
private $scope: angular.IScope,
private $element: JQuery<HTMLElement>,
private $compile: angular.ICompileService,
private $state: StateService,
private growl: angular.growl.IGrowlService,
private elementSvc: ElementService,
private apiSvc: ApiService,
private viewSvc: ViewService,
private applicationSvc: ApplicationService,
private extensionSvc: ExtensionService
) {}
) {
this.veConfig = window.__env;
}

$onInit(): void {
this.target = this.linkTarget ? this.linkTarget : '_self';
Expand Down Expand Up @@ -146,7 +153,7 @@ class ViewLinkController implements angular.IComponentController {
(data: ElementObject) => {
this.element = data;
this.elementName = data.name;
this.type = 'Section ';
this.type = this.veConfig.viewLink.sectionPrefix;
this.suffix = '';
this.hash = '#' + data.id;
if (this.mmsPeId && this.mmsPeId !== '') {
Expand All @@ -168,6 +175,8 @@ class ViewLinkController implements angular.IComponentController {
} else if (this.viewSvc.isEquation(pe)) {
this.type = 'Eq. (';
this.suffix = ')';
} else if (this.viewSvc.isSection(pe) && this.veConfig.viewLink.hidePrefixForSections) {
this.type = '';
}
if (this.applicationSvc.getState().fullDoc) {
this.href = `main.project.ref.view.present.document({ projectId: $ctrl.projectId, refId: $ctrl.refId, documentId: $ctrl.docid, viewId: $ctrl.vid })`;
Expand All @@ -179,6 +188,15 @@ class ViewLinkController implements angular.IComponentController {
this.growl.warning(`Unable to retrieve element: ${reason.message}`);
}
);
} else {
if (data._veNumber) {
let numbers = data._veNumber.split('.');
if (numbers.length > 1 && this.veConfig.viewLink.hidePrefixForSections) {
this.type = '';
} else if (isNaN(parseInt(numbers[0]))) {
this.type = this.veConfig.viewLink.appendixPrefix;
}
}
}
if (this.apiSvc.isDocument(data)) {
docid = data.id;
Expand All @@ -193,6 +211,10 @@ class ViewLinkController implements angular.IComponentController {
} else {
this.$element.html('<span class="ve-error">view link doesn\'t refer to a view</span>');
}
if (this.veConfig.viewLink.alwaysKeepCurrentDoc && this.applicationSvc.getState().currentDoc &&
this.$state.includes('**.present.**')) {
this.docid = this.applicationSvc.getState().currentDoc;
}
if (this.applicationSvc.getState().fullDoc) {
this.href = `main.project.ref.view.present.document({ projectId: $ctrl.projectId, refId: $ctrl.refId, documentId: $ctrl.docid, viewId: $ctrl.vid })`;
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/ve-core/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ export class EditorController implements IComponentController {
return (
el.name == 'img' &&
el.attributes['data-cke-saved-src'] &&
el.attributes['data-cke-saved-src'].indexOf(this.veConfig.apiUrl) > -1
(el.attributes['data-cke-saved-src'].indexOf(this.veConfig.apiUrl) > -1 ||
el.attributes['data-cke-saved-src'].indexOf('http') < 0)
);
}, true)
.forEach((el: CKEDITOR.htmlParser.element) => {
Expand Down
6 changes: 6 additions & 0 deletions src/ve-types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export interface VeConfig {
banner?: BrandingStyle;
footer?: BrandingStyle;
loginTimeout?: number;
viewLink: {
sectionPrefix: string;
appendixPrefix: string;
hidePrefixForSections: boolean;
alwaysKeepCurrentDoc: boolean;
}
experimental?: VeExperimentDescriptor[];
expConfig?: VeExperimentConfig;
}
Loading

0 comments on commit 25c66a3

Please sign in to comment.