diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 7e3cfb73..fff1cfd5 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -215,6 +215,7 @@ $(function(){ 'ui-partial-ribbons', 'ui-ribbon-align-to-order', 'ui-single-image-view', + 'fs-loader', // ui elements... 'image-marks', diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index f5d3aa3a..c5eae256 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -1185,6 +1185,10 @@ var FeatureProto = module.FeatureProto = { tag: null, + isApplicable: function(actions){ + return true + }, + getPriority: function(){ var res = this.priority || 0 return res == 'high' ? 99 @@ -1282,10 +1286,9 @@ Feature.prototype.constructor = Feature // XXX if this works out might be a good idea to organize everything as // a feature... including the Client and Viewer // ...needs more thought... -// XXX add a standard doc set... var FeatureSet = module.FeatureSet = { - buildFeatureList: function(lst){ + buildFeatureList: function(obj, lst){ lst = lst.constructor !== Array ? [lst] : lst var that = this @@ -1298,12 +1301,25 @@ module.FeatureSet = { }) // sort features via dependencies... + var unapplicable = [] var conflicts = {} lst = lst.filter(function(n, i){ var e = that[n] - if(e == null || e.depends == null ){ + if(e == null){ return true } + + // check applicability... + if(!e.isApplicable(obj)){ + unapplicable.push(n) + return false + } + + // no dependencies... + if(e.depends == null ){ + return true + } + // keep only conflicting... var deps = e.depends.filter(function(dep){ dep = lst.indexOf(dep) @@ -1350,13 +1366,14 @@ module.FeatureSet = { return { features: lst, excluded: excluded, - conflicts: conflicts + conflicts: conflicts, + unapplicable: unapplicable, } }, setup: function(obj, lst){ lst = lst.constructor !== Array ? [lst] : lst - var features = this.buildFeatureList(lst) + var features = this.buildFeatureList(obj, lst) lst = features.features // check for conflicts... @@ -1377,6 +1394,12 @@ module.FeatureSet = { features.excluded.join(', ')) } + // report unapplicable features... + if(features.unapplicable.length > 0){ + console.log('Features not applicable in current context:', + features.unapplicable.join(', ')) + } + // do the setup... var that = this var setup = FeatureProto.setup @@ -2434,6 +2457,21 @@ module.ImageBookmarks = Feature({ +//--------------------------------------------------------------------- +var FileSystemLoader = +module.FileSystemLoader = Feature({ + title: '', + doc: '', + + tag: 'fs-loader', + + isApplicable: function(){ + return window.nodejs != null + }, +}) + + + /********************************************************************** * vim:set ts=4 sw=4 : */