11import config from '/sitemedia/js/bccm-config.js' ;
22
3- console . log ( `bccm-customizations.js executing` )
3+ console . log ( `bccm-customizations.js executing` )
44
55var filterdUserGroup = config . ruleButtonPlugin . userGroups . filter ( filterUserGroups ) ;
66
@@ -11,6 +11,18 @@ fetch('/API/v2/items/' + manualRulePluginContext.item_id + '/metadata/').then(re
1111//generates Button and adds EventListener
1212
1313function addManualRuleButton ( ) {
14+
15+ if ( manualRulePluginContext . user_groups . includes ( "Admin" ) ) {
16+ let manualRuleButton = document . createElement ( "button" ) ;
17+ manualRuleButton . innerHTML = "Temportal Export" ;
18+ manualRuleButton . type = "button" ;
19+ manualRuleButton . setAttribute ( "class" , "green" ) ;
20+ document . getElementById ( "ManualRuleButtonDIV" ) . appendChild ( manualRuleButton ) ;
21+ manualRuleButton . onclick = function ( ) {
22+ window . open ( 'https://export.lan.bcc.media/vx-export?id=' + manualRulePluginContext . item_id , '_blank' ) ;
23+ }
24+ }
25+
1426 for ( var i = 0 ; i < filterdUserGroup . length ; i ++ ) {
1527 for ( var x = 0 ; x < filterdUserGroup [ i ] . buttons . length ; x ++ ) {
1628
@@ -21,7 +33,7 @@ function addManualRuleButton() {
2133 manualRuleButton . innerHTML = buttonConfig . label ;
2234 manualRuleButton . type = "button" ;
2335 manualRuleButton . setAttribute ( "class" , buttonConfig . button_colour ) ;
24- document . getElementById ( "ManualRuleButtonDIV" ) . appendChild ( manualRuleButton ) ;
36+ document . getElementById ( "ManualRuleButtonDIV" ) . appendChild ( manualRuleButton ) ;
2537
2638 manualRuleButton . onclick = function ( ) {
2739 this . innerHTML = "working..."
@@ -47,7 +59,7 @@ function addManualRuleButton() {
4759 }
4860 } ) ;
4961 }
50- }
62+ }
5163 }
5264}
5365
@@ -58,7 +70,7 @@ function filterUserGroups(userGroup) {
5870 if ( userGroup . name == manualRulePluginContext . user_groups [ i ] ) {
5971 return true
6072 }
61- }
73+ }
6274}
6375
6476
@@ -112,4 +124,4 @@ function waitForElm(selector, callback) {
112124
113125waitForElm ( '#ManualRuleButtonDIV' , function ( ) {
114126 addManualRuleButton ( ) ;
115- } ) ;
127+ } ) ;
0 commit comments