Skip to content

Commit

Permalink
fixed issue with cloudpoodlltoken and a general code tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhunt committed Jul 18, 2019
1 parent 74e56da commit 4ec659d
Show file tree
Hide file tree
Showing 24 changed files with 1,499 additions and 1,481 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Change List
=========

Version 1.4.10(Build 2019071300)
-Fixed cloud poodll token fetch [again]

Version 1.4.09(Build 2019061400)
-Fixed cloud poodll token fetch (had been requiring Poodll)
-Added cloud poodll refresh
Expand Down
177 changes: 89 additions & 88 deletions amd/src/generico_amd.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,92 @@
/* jshint ignore:start */
define(['jquery','core/log'], function($, log) {

"use strict"; // jshint ;_;

log.debug('Filter Generico initialising');

return {

allopts: {},

extscripts: {},

csslinks: Array(),

jslinks: Array(),

appendjspath: function(jslink, theprefix){
require.config({
paths: {
theprefix: jslink
}});
},

injectcss: function(csslink){
var link = document.createElement("link");
link.href = csslink;
if(csslink.toLowerCase().lastIndexOf('.html')==csslink.length-5){
link.rel = 'import';
}else{
link.type = "text/css";
link.rel = "stylesheet";
}
document.getElementsByTagName("head")[0].appendChild(link);
},

// load all generico stuff and stash all our variables
loadgenerico: function(opts) {


//pick up opts from html
var theid = '#filter_generico_amdopts_' + opts['AUTOID'];
var optscontrol = $(theid).get(0);
if(optscontrol){
opts = JSON.parse(optscontrol.value);
//remove the hidden form element, in case it is really part of a form
$(theid).remove();
}
log.debug(opts);

//load our css in head if required
//only do it once per extension though
if(opts['CSSLINK']){
if (this.csslinks.indexOf(opts['CSSLINK'])<0){
this.csslinks.push(opts['CSSLINK']);
this.injectcss(opts['CSSLINK']);
}
}
//load our css in head if required
//only do it once per extension though
if(opts['CSSUPLOAD']){
if (this.csslinks.indexOf(opts['CSSUPLOAD'])<0){
this.csslinks.push(opts['CSSUPLOAD']);
this.injectcss(opts['CSSUPLOAD']);
}
}

//load our css in head if required
//only do it once per extension though
if(opts['CSSCUSTOM']){
if (this.csslinks.indexOf(opts['CSSCUSTOM'])<0){
this.csslinks.push(opts['CSSCUSTOM']);
this.injectcss(opts['CSSCUSTOM']);
}
}

//if we did get a template id then proceed
//we might not get one if the html was generated, but never sent to
//the page. Sometimes this happens in the assignment and probably
//elsewhere
if(typeof opts['TEMPLATEID'] != 'undefined'){
//here require, then load the template scripts and js
require(['filter_generico_d' + opts['TEMPLATEID']],function(d){
d(opts);
});
}
}//end of function

}
define(['jquery', 'core/log'], function ($, log) {

"use strict"; // jshint ;_;

log.debug('Filter Generico initialising');

return {

allopts: {},

extscripts: {},

csslinks: Array(),

jslinks: Array(),

appendjspath: function (jslink, theprefix) {
require.config({
paths: {
theprefix: jslink
}
});
},

injectcss: function (csslink) {
var link = document.createElement("link");
link.href = csslink;
if (csslink.toLowerCase().lastIndexOf('.html') == csslink.length - 5) {
link.rel = 'import';
} else {
link.type = "text/css";
link.rel = "stylesheet";
}
document.getElementsByTagName("head")[0].appendChild(link);
},

// load all generico stuff and stash all our variables
loadgenerico: function (opts) {


//pick up opts from html
var theid = '#filter_generico_amdopts_' + opts['AUTOID'];
var optscontrol = $(theid).get(0);
if (optscontrol) {
opts = JSON.parse(optscontrol.value);
//remove the hidden form element, in case it is really part of a form
$(theid).remove();
}
log.debug(opts);

//load our css in head if required
//only do it once per extension though
if (opts['CSSLINK']) {
if (this.csslinks.indexOf(opts['CSSLINK']) < 0) {
this.csslinks.push(opts['CSSLINK']);
this.injectcss(opts['CSSLINK']);
}
}
//load our css in head if required
//only do it once per extension though
if (opts['CSSUPLOAD']) {
if (this.csslinks.indexOf(opts['CSSUPLOAD']) < 0) {
this.csslinks.push(opts['CSSUPLOAD']);
this.injectcss(opts['CSSUPLOAD']);
}
}

//load our css in head if required
//only do it once per extension though
if (opts['CSSCUSTOM']) {
if (this.csslinks.indexOf(opts['CSSCUSTOM']) < 0) {
this.csslinks.push(opts['CSSCUSTOM']);
this.injectcss(opts['CSSCUSTOM']);
}
}

//if we did get a template id then proceed
//we might not get one if the html was generated, but never sent to
//the page. Sometimes this happens in the assignment and probably
//elsewhere
if (typeof opts['TEMPLATEID'] != 'undefined') {
//here require, then load the template scripts and js
require(['filter_generico_d' + opts['TEMPLATEID']], function (d) {
d(opts);
});
}
}//end of function

}
});
/* jshint ignore:end */
Loading

0 comments on commit 4ec659d

Please sign in to comment.