Changeset 6834
- Timestamp:
- 11/23/15 10:48:31 (8 years ago)
- Location:
- SMC/trunk/SMC/src/web
- Files:
-
- 1 deleted
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/web/index.html
r5299 r6834 1 < !DOCTYPE html>1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 5 <title>CLARIN SMC Browser</title> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 5 <title>CLARIN SMC Browser</title> 6 <link rel="stylesheet" href="scripts/style/jquery/clarindotblue/jquery-ui-1.8.5.custom.css" type="text/css" /> 7 <link href="scripts/style/cmds-ui.css" type="text/css" rel="stylesheet" /> 8 <link href="scripts/style/smc-graph.css" media="screen" rel="stylesheet" type="text/css" /> 6 9 7 <link rel="stylesheet" href="scripts/style/jquery/clarindotblue/jquery-ui-1.8.5.custom.css" type="text/css" /> 8 <link href="scripts/style/cmds-ui.css" type="text/css" rel="stylesheet" /> 9 <link href="scripts/style/smc-graph.css" media="screen" rel="stylesheet" type="text/css" /> 10 11 <script src="scripts/js/d3.v2.js" type="text/javascript" ></script> 12 <script src="scripts/js/jquery/jquery-1.4.2.js" type="text/javascript"></script> 13 <script src="scripts/js/jquery/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script> 14 <!-- 15 <script src="scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script> 16 <script src="scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script> 10 <script src="scripts/js/d3.js" type="text/javascript"></script> 11 <script src="scripts/js/jquery/jquery-1.10.2.js" type="text/javascript"></script> 12 <script src="scripts/js/jquery/jquery-ui-1.10.4.custom.min.js" type="text/javascript"></script> 13 <script src="scripts/js/jquery/jquery.layout-latest.js" type="text/javascript"></script> 14 <script src="scripts/js/mdservice/mdservice_ui_helpers.js" type="text/javascript"></script> 15 <script src="scripts/js/query_input/qi.js" type="text/javascript"></script> 16 <script src="scripts/js/query_input/lib/URI.js" type="text/javascript"></script> 17 17 18 <script src="scripts/jquery/jsTree.v.1.0rc2/jquery.jstree.js" type="text/javascript"></script> 19 <script src="scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script>--> 20 <script src="scripts/js/jquery/jquery.layout-1.3.0.rc29.12.js" type="text/javascript"></script> 21 22 23 <script src="scripts/js/mdservice/mdservice_helpers.js" type="text/javascript"></script> 24 <script src="scripts/js/mdservice/mdservice_ui_helpers.js" type="text/javascript"></script> 25 <script src="scripts/js/query_input/qi.js" type="text/javascript"></script> 26 27 <!--<script src="scripts/js/ui_helpers.js" type="text/javascript"></script>--> 28 <script src="scripts/js/mdservice/mdservice_widgets.js" type="text/javascript"></script> 29 <!-- <script src="scripts/js/mdservice/mdservice_model.js" type="text/javascript"></script>--> 30 31 <!--<script src="scripts/js/mdservice/mdservice_searchclause.js" type="text/javascript"></script> 32 <script src="scripts/js/mdservice/mdservice_pz2.js" type="text/javascript"></script> 33 <script src="scripts/js/mdservice/mdservice_ui_detail.js" type="text/javascript"></script> 34 <script src="scripts/js/mdservice/mdservice_ui_load.js" type="text/javascript"></script> --> 35 36 <script src="scripts/js/smc-graph.js" type="text/javascript"></script> 37 <script src="scripts/js/ui_settings.js" type="text/javascript"></script> 38 <script src="scripts/js/ui.js" type="text/javascript"></script> 39 40 </head> 41 42 <body> 18 <script src="scripts/js/config.js" type="text/javascript"></script> 19 <script src="scripts/js/smc-graph.js" type="text/javascript"></script> 20 <script src="scripts/js/ui_settings.js" type="text/javascript"></script> 21 <script src="scripts/js/main.js" type="text/javascript"></script> 22 </head> 23 <body> 43 24 44 25 <!-- - BLOCK --> 45 <div class="cmds-ui-block" id="header"> 46 <span id="logo"><a href="http://www.clarin.eu"><img 47 src="scripts/style/imgs/clarin-logo.png" alt="CLARIN" /></a> 48 </span> 49 <div id="site-name">SMC Browser</div> 50 <span id="top-menu"> 51 <!-- class="open-in-context" --> 52 <a href="."> home </a> 53 <a target="_blank" href="docs/userdocs.html"> docs</a> 54 <a target="_blank" href="smc_stats.html"> stats</a> 55 <a target="_blank" href="docs/examples.html"> examples</a> 56 <a target="_blank" href="docs/reports.html"> reports</a> 57 </span> 58 59 <div id="notify" class="cmds-elem-plus note"> 60 <div id="notifylist" class="note"> 26 <div class="cmds-ui-block" id="header"><span id="logo"><a href="http://www.clarin.eu"><img src="scripts/style/imgs/clarin-logo.png" alt="CLARIN" /></a></span> 27 <div id="site-name">SMC Browser</div><span id="top-menu"> 28 <!-- class="open-in-context" --><a href="."> home </a><a target="_blank" href="docs/userdocs.html"> docs</a><a target="_blank" href="data/smc_stats_summary1.html"> stats</a><a target="_blank" href="docs/examples.html"> examples</a><a target="_blank" href="docs/reports.html"> reports</a></span> 29 <div id="notify" class="cmds-elem-plus note"> 30 <div id="notifylist" class="note"> 61 31 <!-- class="cmds-elem-plus note" > --> 62 </div> 63 </div> 64 </div> 65 66 <div id="navigate" class="block">navigate 32 </div> 33 </div> 34 </div> 35 <div id="navigate" class="block">navigate 67 36 <!--<label for="input-depth-before">before</label><input type="text" id="input-depth-before" value="1" size="3"/> 68 37 <label for="input-depth-after">after</label><input type="text" id="input-depth-after" value="1" size="3"/> --> 69 </div> 70 71 <div id="index-container" class="block"><h3>Index <input type="text" id="input-filter-index" size="10" /></h3> 72 73 </div> 74 <div id="infovis-wrapper"> 75 <div id="infovis">graph</div> 76 </div> 77 <div id="detail-container" class="block"><h3>Detail</h3></div> 78 <div id="detail-info-holder" class="data"></div> 38 </div> 39 <div id="index-container" class="block"> 40 <h3>Index <input type="text" id="input-filter-index" size="10" /> 41 </h3> 42 </div> 43 <div id="infovis-wrapper"> 44 <div id="infovis">graph</div> 45 </div> 46 <div id="detail-container" class="block"> 47 <h3>Detail</h3> 48 </div> 49 <div id="detail-info-holder" class="data"></div> 79 50 80 51 … … 86 57 <div class="content" id="query-input" > 87 58 --> 88 89 </body> 90 59 </body> 91 60 </html> -
SMC/trunk/SMC/src/web/scripts/js/config.js
r5978 r6834 1 1 2 2 var config ={ 3 "url": {"data_prefix":"data/", 4 "detail":"get.xql" , 3 "url": {// "data_prefix":"data/", 4 "data_prefix":"/graph-data/", 5 //"detail":"get.xql" , 6 "detail":"http://localhost:8082/exist/rest/db/cr-projects/tester/get.xql?key=", 5 7 // "detail":"http://localhost:8580/exist/apps/smc-browser/get.xql" , 6 8 // "detail":"data/smc_stats_detail.html", … … 18 20 19 21 // configuration of the navigation widgets 20 var opts = {"graph": {"value":"smc-graph-basic.js", 21 "values":[{value: "smc-graph-basic.js", label:"SMC graph basic"}, 22 {value: "smc-graph-all.js", label:"SMC graph all"}, 23 {value: "smc-graph-profiles-datcats.js", label:"only profiles + datcats"}, 24 {value: "smc-graph-groups-profiles-datcats-rr.js", label:"profiles+datcats+groups+rr"}, 25 {value: "smc-graph-profiles-similarity.js", label:"profiles similarity"} 26 /*{value: "dbpedia_philosophers_influence_years_graph.json", label:"Philosophers"}, 27 {value: "SC_Persons_120201_cAll_graph.json", label:"Schnitzler Cooccurrences"},*/ 22 var opts = {"graph": {"value":"issues/issues_all_c747_2015-03-20_graph.json", 23 "values":[{value: "smc/smc-graph-basic.js", label:"SMC graph basic"}, 24 {value: "smc/smc-graph-all.js", label:"SMC graph all"}, 25 {value: "smc/smc-graph-profiles-datcats.js", label:"only profiles + datcats"}, 26 {value: "smc/smc-graph-groups-profiles-datcats-rr.js", label:"profiles+datcats+groups+rr"}, 27 {value: "smc/smc-graph-profiles-similarity.js", label:"profiles similarity"}, 28 {value: "philosophers/dbpedia_philosophers_influence_years_graph.json", label:"Philosophers"}, 29 {value: "SC_Persons_120201_cAll_graph.json", label:"Schnitzler Cooccurrences"}, 30 {value: "issues/issues_all_c747_2015-03-20_graph.json", label:"Issues"}, 31 28 32 /*, 29 33 {value: "smc-graph-mdrepo-stats.js", label:"instance data"}*/ -
SMC/trunk/SMC/src/web/scripts/js/main.js
r5978 r6834 1 2 1 /** 3 * @fileOverview This is based on mdservice/mdservice_ui.js, but removed all unused code. 4 * This is the main file, contains main app function (jquery-initialization). 5 * The app main function runs setup functionality, which covers this domains: 6 * <dl> 7 * <dt>the variable initialization<dt> 8 * <dd>functions from mdservice_searchclause.js, mdservice_widget.js, mdservice_ui_helpers.js</dd> 9 * <dt>loadData()</dt> 10 * <dd>loading data from repository and creating particular client-side representations - functions from <a>mdservice_ui_load.js</a></dd> 11 * <dt>creating of ui-layout</dt> 12 * <dd>i.e. split UI to individual panes - functions from mdservice_ui_layout.js</dd> 13 * <dt>addFunctionality()</dt> 14 * <dd>bind handlers to events of ui-elements (function directly in mdservice_ui.js)</dd> 15 * </dl> 16 * @author 2 * @fileOverview 3 * This is the main file. Invokes app initialization on ready() 4 * @author vronk 17 5 * @version 18 6 */ 19 20 7 21 8 var index_container_selector = "#index-container"; … … 24 11 var detail_container_selector = "#detail-container"; 25 12 var detail_info_holder_selector = '#detail-info-holder'; 26 27 13 var graph_container = null; 28 14 var index_container = null; 29 15 30 31 16 $(function(){ 32 // turn on debugging (see jquery.xslTransform.js) 33 var DEBUG = false; 34 17 35 18 // check for jQuery 36 19 try{ … … 41 24 42 25 graph_container = $(graph_container_selector); 43 44 /////// INIT VARIABLE SETTINGS45 url_params = getUrlVars();46 // workspace = new Workspace();47 48 // create widgets49 /* columns_widget = new ListWidget($('#columns-widget'), "columns");50 collections_widget = new ListWidget($('#collections-widget'), "collections");51 listwidgetset.add(columns_widget);52 listwidgetset.add(collections_widget);53 */54 //////////// LOAD DATA55 // loadData();56 57 26 58 27 // loading userdocs as welcome info … … 60 29 61 30 loadDetailInfo (); 62 63 31 64 32 addFunctionality(); … … 69 37 createBlock('base',''); 70 38 createLayouts('base'); 71 72 39 73 40 74 41 }); 75 76 42 77 43 /** … … 81 47 function addFunctionality(){ 82 48 83 $("#input-filter-index").live('change', function(event) { 49 // $("#input-filter-index").live('change', function(event) { 50 $( document ).on( "change", '#input-filter-index', function(event) { 84 51 filterIndex ($(this).val()); 85 52 }); … … 88 55 $("#navigate .slider").slider(); 89 56 */ 90 $("#navigate").QueryInput({params: opts, 91 onValueChanged: renderGraph 92 }); 57 $("#navigate").QueryInput({params: opts, onValueChanged: renderGraph }); 93 58 94 59 /* $('#infovis-wrapper').resizable( { … … 109 74 }); 110 75 */ 111 $('#input-download').live("mousedown", genDownload);112 76 113 $(".detail-caller").live("click", function(event) { 77 //$('#input-download').live("mousedown", genDownload); 78 $( document ).on( "mousedown", '#input-download', genDownload); 79 80 // $(".detail-caller").live("click", function(event) { 81 $( document ).on( "click", '.detail-caller', function(event) { 114 82 //console.log(this); 115 83 event.preventDefault(); … … 117 85 }); 118 86 119 $(".node-item .detail a").live("click", function(event) { 87 // $(".node-item .detail a").live("click", 88 $( document ).on( "click", '.node-item .detail a', function(event) { 120 89 event.preventDefault(); 121 90 key = $(this).attr("data-key"); 122 91 console.log(key); 123 92 selectNodeByKey([key]); 124 125 93 }); 126 94 127 128 $("a.scan").live("click", function(event) {129 95 //$("a.scan").live("click", function(event) { 96 $( document ).on( "click", 'a.scan', function(event) { 97 console.log(this); 130 98 event.preventDefault(); 131 99 url = $(this).attr("href"); … … 133 101 $(this).parent().find('.node-detail').load(url + " div.content"); 134 102 }); 135 136 137 103 } -
SMC/trunk/SMC/src/web/scripts/js/mdservice/mdservice_ui_helpers.js
r2438 r6834 24 24 var settings; 25 25 if (layout_initialisation[name].settings == ""){ 26 settings = new CloneObject(layout_initialisation[name].model_settings); 26 // settings = new CloneObject(layout_initialisation[name].model_settings); 27 settings = jQuery.extend(true, {}, layout_initialisation[name].model_settings ); 27 28 } else { 28 29 settings = layout_initialisation[name].settings; -
SMC/trunk/SMC/src/web/scripts/js/query_input/qi.js
r5302 r6834 1 1 2 // jQuery closure 3 (function($) { 4 5 /** 6 * @class QueryInput 2 // Module QueryInput 3 // provides a jQuery plugin with the same name. 4 !function ($, console) { 5 // could expose the defaults: $.fn.QueryInput.defaults = 6 //{q:{label:"Query", widget:"text"}, submit:{value:"Search", widget:"submit"}} 7 var defaults = { 8 params: {}, 9 input_prefix: "input-", 10 slider_style: {width: "80px", display: "inline-block", "font-size": "70%", margin: "6px 12px 0 2px"}, 11 onValueChanged: function () {}, 12 fcs_source: "http://193.170.82.207:8680/exist/apps/sade/amc/fcs?operation=scan&x-format=json&scanClause=" 13 }; 14 15 var module = {}; 16 17 /** 18 * @class QueryInput 7 19 * generate a customizable query_input UI, a input form with fields/widgets based on settings 8 20 * options: multiple params/fields, … … 15 27 */ 16 28 /* we could make it a class (instead of jQuery plugin) 17 function QueryInput(elem,s) */ 18 $.fn.QueryInput = function (options)29 function QueryInput(elem,s) */ 30 module.QueryInput = function (options) 19 31 { 20 32 /** the dom-element to generate the query input in */ … … 25 37 */ 26 38 var settings = $.extend(true, {}, defaults, options); 27 blendInParams(settings.params, getUrlParams(location.search)) 28 29 // makes the settings publicly available as .data("qi") 39 40 /** gets the current value for a parameter 41 * accepting settings as reliable source of current value 42 * i.e. changes in input have to change the .value in settings. 43 * This is assured by calling setParamValue upon input-change. 44 * public by calling: $(elem).data("qi").getParamValue(param_key); 45 * @public 46 */ 47 settings.getParamValue = function (key) { 48 if (this.params[key]) { 49 return this.params[key].value; 50 } else { 51 return ""; 52 } 53 }; 54 55 /** allow to update the current value in settings from outside */ 56 settings.setParamValue = function (key, value) { 57 58 if (settings.params[key]) { 59 settings.params[key].value = value; 60 } 61 // callback: 62 settings.onValueChanged.call(settings, value); 63 return value; 64 }; 65 66 blendInParams(); 67 68 // makes the settings publicly available as .data("qi") 30 69 elem.data("qi",settings); 31 70 init(settings); … … 45 84 for ( var key in params ) { 46 85 var param = params[key]; 86 console.log("creating widget: " + param.widget + " for: " + key); 47 87 // if input already exists - fill it with the default value 48 88 if ($('#' + settings.input_prefix + key).length) { … … 50 90 } else if (trg_container) { 51 91 var label= param.label ? param.label : key; 52 var new_input_label = param.label=='' ? '' : "<label>" + label+ "</label>"; 53 var new_input=null, new_widget=null; 92 var new_input_label = param.label === '' ? $('') : $( 93 "<label for='" + settings.input_prefix + key + "'>" + label+ "</label>" 94 ); 95 var new_input=null, new_widget=null; 54 96 55 97 switch (param.widget) { … … 57 99 new_input = genText(key, param); 58 100 break; 101 case "checkbox": 102 new_input = genCheckBox(key, param); 103 break; 104 case "hidden": 105 new_input = genHidden(key, param); 106 break; 59 107 case "submit": 60 108 new_input = genSubmit (key, param); … … 63 111 new_input = genCombo(key, param); 64 112 break; 65 case "autocomplete": 113 case "multiselect": 114 var elems = genMultiselect(key, param); 115 new_input = elems[0]; 116 new_widget = elems[1]; 117 break; 118 case "autocomplete": 66 119 new_input = genAutocomplete (key, param); 67 120 break; 68 121 case "cql": 69 var cql_elems = genCQLInput(key, param);122 var cql_elems = QueryInput_CQL.genCQLInput(key, param); 70 123 new_input = cql_elems[0]; 71 124 new_widget = cql_elems[1]; 72 125 break; 73 case "link": 126 case "vkb-cql": 127 var cql_elems = QueryInput_CQL.genCQLInput(key, param); 128 new_input = genVKBCombo(key, param, cql_elems[0]); 129 new_widget = cql_elems[1]; 130 break; 131 case "link": 74 132 new_input = genLink (key, param); 75 133 break; … … 80 138 break; 81 139 default: 82 console.log("no such widget: " + param.widget );140 console.log("no such widget: " + param.widget + " for: " + key); 83 141 } 84 142 85 143 if (new_input) { 86 $(new_input).data("key", key) 87 .addClass("type-" + param.widget) 88 .attr("id", settings.input_prefix + key) 144 var new_input = $(new_input); 145 new_input.data("key", key) 146 .addClass("type-" + param.widget + (param.additional_classes === undefined ? '' : ' ' + param.additional_classes)) 147 .attr("id", settings.input_prefix + key) 89 148 .data("param-object", param); 90 149 91 if (param.widget!="link") { 150 if (param.data !== undefined) { 151 for (var k in param.data) { 152 new_input.attr("data-" + k, param.data[k]); 153 } 154 } 155 156 if (param.widget !== "link") { 92 157 // set initial valuelink 93 158 $(new_input).val(param.value); … … 96 161 new_input.change(function () { 97 162 setParamValue(this); 98 }); 99 } 100 101 $(form).append(new_input_label, new_input, new_widget); 102 // inputs.push(key, new_input_label, new_input, new_widget]); 103 } 104 } 105 } // end for 163 }); 164 } 165 166 if (new_input_label !== undefined) { 167 new_input_label.attr('for', settings.input_prefix + key); 168 if (param.additional_label_classes !== undefined) { 169 new_input_label.addClass(param.additional_label_classes); 170 } 171 } 172 if (settings.params[key].label_after_input === true) { 173 $(form).append(new_input, new_input_label, new_widget); 174 } else { 175 $(form).append(new_input_label, new_input, new_widget); 176 } 177 } 178 } 179 } // end for 106 180 107 181 … … 121 195 $(input).attr("name",key); 122 196 123 return input; 124 } 125 126 function genLink(key, param_settings) { 127 128 var a = $("<a>" + key + "</a>"); 197 if (param_settings.size) 198 $(input).attr("size", param_settings.size); 199 200 return input; 201 } 202 203 function genCheckBox(key, param_settings) { 204 205 var input = $("<input type='checkbox'/>"); 206 $(input).attr("name", key); 207 if (param_settings.checked !== undefined) 208 $(input).attr("checked", param_settings.checked); 209 210 return input; 211 } 212 213 function genVKBCombo(key, param_settings, preconfigured_input) { 214 preconfigured_input.attr("data-context", param_settings.cql_config.settings.context); 215 preconfigured_input.addClass("virtual-keyboard-input"); 216 var input = $('<span class="virtual-keyboard-input-combo virtual-keyboard-input-above">' + 217 $('<div>').append(preconfigured_input).html() + 218 '<input type="checkbox" value="unused" class="virtual-keyboard-toggle" id="vkbt' + key + '"/>' + 219 '<label for="vkbt' + key + '" class="virtual-keyboard-first-three">ÀöÌ</label>'); 220 221 return input; 222 } 223 224 function genHidden(key, unused) { 225 226 var input = $("<input type='hidden' />"); 227 $(input).attr("name", key); 228 229 return input; 230 } 231 232 function genLink(key, unused) { 233 234 var a = $("<a>" + key + "</a>"); 129 235 a.attr("href", generateLink()); 130 236 … … 152 258 if (param_settings.static_source) { 153 259 //var scanURL = settings.fcs_source + param_settings.index 154 var source_url = param_settings.static_source.replace(/&/g, '&');155 // if static source - try to retrieve the data260 var source_url = param_settings.static_source.replace(/&/g, '&'); 261 // if static source - try to retrieve the data 156 262 $.getJSON(source_url, function(data) { 157 param_settings.values = data.terms 158 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v.value + "' >" + v.label + "</option>") });263 param_settings.values = data.terms; 264 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v.value + "' >" + v.label + "</option>") }); 159 265 //console.log($(input).autocomplete().source); 160 266 }); … … 184 290 if (param_settings.static_source) { 185 291 //var scanURL = settings.fcs_source + param_settings.index 186 var source_url = param_settings.static_source.replace(/&/g, '&');187 // if static source - try to retrieve the data292 var source_url = param_settings.static_source.replace(/&/g, '&'); 293 // if static source - try to retrieve the data 188 294 $.getJSON(source_url, function(data) { 189 295 param_settings.source = data.terms … … 198 304 199 305 return input; 200 } 201 202 203 function fcsScan(request, response) { 204 response( $.ui.autocomplete.filter( 205 scan.terms, request.term ) ); 206 // extractLast( request.term ) 306 } 307 308 /** generate a multiselect*/ 309 function genMultiselect(key, param_settings) { 310 311 var parent = $("<div/>"); 312 var select = $("<select multiple='multiple' id='widget-" + key + "' />"); 313 select.attr("name", key); 314 //select.attr("id", settings.input_prefix + key) 315 parent.append(select); 316 317 if (param_settings.static_source) { 318 //var scanURL = settings.fcs_source + param_settings.index 319 var source_url = param_settings.static_source.replace(/&/g, '&'); 320 // if static source - try to retrieve the data 321 $.getJSON(source_url, function (data) { 322 param_settings.values = data.terms 323 param_settings.values.forEach(function (v) { 324 $(select).append("<option value='" + v.value + "' >" + v.label + "</option>") 325 }); 326 //console.log($(input).autocomplete().source); 327 }); 328 329 //param_settings.source = fcsScan; 330 } 331 332 333 else if (param_settings.values) { 334 // $(input).autocomplete(param_settings); 335 param_settings.values.forEach(function (v) { 336 $(select).append("<option value='" + v + "' >" + v + "</option>") 337 }); 338 } else { /* if no values, rather make a textbox out of it? */ 339 //select = 340 } 341 342 select.attr("id", settings.input_prefix + key) 343 select.chosen(param_settings); 344 return [select, parent.find("#input_context_chosen")]; 345 } 346 347 348 function fcsScan(request, response) { 349 response($.ui.autocomplete.filter( 350 scan.terms, request.term)); 351 // extractLast( request.term ) 207 352 } 208 353 … … 226 371 .data("related-widget",new_widget); 227 372 228 new_widget.bind( 373 new_widget.bind("slidechange", function(event, ui) { 229 374 $(this).data("related-input-field").val(ui.value); 230 375 // update the settings-object, but with the (updated) value of the related input-field … … 235 380 new_input.bind("change", function () { 236 381 var related_widget = $(this).data("related-widget"); 237 if ( $(related_widget).hasClass("widget-slider")) {$(related_widget).slider("option", "value", $(this).val()); } 382 if ($(related_widget).hasClass("widget-slider")) { 383 $(related_widget).slider("option", "value", $(this).val()); } 238 384 }); 239 385 … … 241 387 } 242 388 243 244 /** gets the current value for a parameter245 accepting settings as reliable source of current value246 i.e. changes in input have to change the .value in settings.247 This is assured by calling setParamValue upon input-change.248 public by calling: $(elem).data("qi").getParamValue(param_key);249 @public250 */251 settings.getParamValue = function(key) {252 if (this.params[key]) {253 return this.params[key].value254 } else {255 return ""256 }257 }258 259 /** allow to update the current value in settings from outside */260 settings.setParamValue = function(key, value) {261 262 if (settings.params[key]) {263 settings.params[key].value = value264 }265 // callback:266 settings.onValueChanged.call( settings,value );267 return value268 }269 389 270 390 /** update the current value in settings */ … … 277 397 // callback: 278 398 settings.onValueChanged.call( input_object,value ); 279 return value 280 } 281 282 283 /** get params from the uri */ 284 function getUrlParams(url) 285 { 286 var urlParams = {}; 287 if (url != undefined) 288 { 289 var match; 290 var pl = /\+/g; // Regex for replacing addition symbol with a space 291 var search = /([^&=]+)=?([^&]*)/g; 292 var decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }; 293 294 var query = ""; 295 var qmPos = url.indexOf('?'); 296 if (qmPos != -1) 297 query = url.substr(qmPos + 1); 298 else 299 query = url; 300 301 while (match = search.exec(query)) 302 urlParams[decode(match[1])] = decode(match[2]); 303 } 304 305 return urlParams; 306 } 307 308 function blendInParams(settings_params, params) { 309 310 for ( var key in settings_params ) { 311 if (params[key]) {settings_params[key].value=params[key]; } 312 } 313 } 314 315 /** generate a query-link out of the current values of the params */ 399 return value; 400 } 401 402 /** generate a query-link out of the current values of the params */ 316 403 function generateLink() 317 404 { 318 var url ="?";319 320 for ( var key in settings.params) {405 var url = "?"; 406 407 for ( var key in settings.params) { 321 408 if (settings.params[key].value) { 322 409 url += key + "=" + settings.params[key].value + "&"; 323 410 } 411 } 412 413 return url; 324 414 } 325 326 return url; 327 } 328 329 330 // } 331 332 } // end $.fn.QueryInput 333 334 335 // could expose the defaults: $.fn.QueryInput.defaults = 336 //{q:{label:"Query", widget:"text"}, submit:{value:"Search", widget:"submit"}} 337 var defaults = {params: {}, 338 input_prefix:"input-", 339 slider_style:{width:"80px", display:"inline-block", "font-size": "70%", margin: "6px 12px 0 2px"}, 340 onValueChanged : function() {}, 341 fcs_source: "http://193.170.82.207:8680/exist/apps/sade/amc/fcs?operation=scan&x-format=json&scanClause=" 342 }; 343 415 416 /** overwrite settings with param-values from the URL-search string if available 417 not using $.extend(), because we still want only known/defined params overriden, not adding new params that might be in the url (?) */ 418 function blendInParams() { 419 var params= getUrlParams(); 420 for ( var key in settings.params ) { 421 if (params[key]) {settings.params[key].value=params[key]; } 422 } 423 } 424 425 /** get params from the uri */ 426 function getUrlParams() { 427 var currentURI = new URI(); 428 var params = currentURI.search(true); 429 return params; 430 } 431 432 433 434 }; // end $.fn.QueryInput 435 436 344 437 /* TODO: add defaults for widgets, like: 345 438 widgets: {slider: {style:{width:"80px", display:"inline-block", "font-size": "70%", margin: "6px 12px 0 2px"}}}, 346 */ 347 348 })(jQuery, this); 349 439 */ 440 441 // publish; 442 // this.QueryInput = module; 443 $.fn.QueryInput = module.QueryInput; 444 445 }(jQuery, console); 446 -
SMC/trunk/SMC/src/web/scripts/js/smc-graph.js
r5978 r6834 73 73 if (json==null) { notifyUser("source data missing: " + graph_source ); return null} 74 74 data_all = json; 75 data_all.nodes_index = {}; 76 data_all.nodes.forEach(function(d){ 77 data_all.nodes_index[d.key] = d; 78 }); 79 75 80 data_all.links.forEach(function(d) { 76 81 //resolve numeric index to node references 77 82 src_ix = d.source; 78 d.source = data_all.nodes [src_ix];79 d.source.index = src_ix;83 d.source = data_all.nodes_index[src_ix]; 84 //d.source.index = src_ix; 80 85 trg_ix = d.target; 81 d.target = data_all.nodes[trg_ix]; 82 d.target.index = trg_ix; 83 src_key = d.source.key; 84 trg_key = d.target.key; 86 d.target = data_all.nodes_index[trg_ix]; 87 //d.target.index = trg_ix; 88 // src_key = d.source.key; 89 // trg_key = d.target.key; 90 if (d.target == null | d.source == null) { 91 notifyUser("nodes for link missing: " + src_ix + " - " + trg_ix); 92 } 93 85 94 }); 95 // remove links for which nodes are missing! 96 data_all.links = data_all.links.filter(function(d){return (d.source !=null & d.target != null ) } ) 97 86 98 // generate lookup hashes for neighbours; 87 99 add_lookups(data_all); … … 185 197 .enter().append("div") 186 198 .attr("id", function (d) { return "detail-" + d.key }) 187 .classed("node-detail cmds-ui-block ", 1)199 .classed("node-detail cmds-ui-block init-show", 1) 188 200 // collapse groups in index, but expand right away in detail view 189 .classed("init-show", (target_container_selector != index_container_selector));201 //.classed("init-show", (target_container_selector != index_container_selector)); 190 202 191 203 var group_headers = group_divs.append("div").classed("header", 1) … … 449 461 gnodes.append("svg:circle") 450 462 /* .attr("r", 6)*/ 451 .on("click", function(d) {d.selected= d.selected ? 0 : 1; updateSelected() }) 463 .on("click", function(d) {d.selected= d.selected ? 0 : 1; 464 console.log("click:" + d.key); 465 updateSelected(); }) 452 466 .on("mouseover", highlight()).on("mouseout", unhighlight()) 453 467 .attr("r", function(d) { if (opt("node-size")=="count") … … 756 770 if (opt("layout")!='freeze') { 757 771 nodes_sel = data_all.nodes.filter(function (d) { return d.selected }); 758 772 console.log("updateSelected:" + nodes_sel); 759 773 // update param 760 774 var selected = []; … … 967 981 */ 968 982 function neighbouring(a, b) { 969 console.log("neighbouring: " +a.key + "," + b.key );983 //console.log("neighbouring: " +a.key + "," + b.key ); 970 984 return data_all.links_index[a.key + "," + b.key]; 971 985 } … … 983 997 data = typeof data !== 'undefined' ? data : data_all; 984 998 weight_threshold = parseInt(opt("weight")) / 100; 985 console.log("weight_threshold:" + weight_threshold); 999 //console.log("weight_threshold:" + weight_threshold + "; depth:" + depth + "; key: " + n.key); 986 1000 if (depth==0) { return {nodes:[], links:[]};} 987 1001 … … 1049 1063 return result; 1050 1064 } 1065 1066 function notifyUser (msg) { 1067 $("#notifylist").append(msg); 1068 } -
SMC/trunk/SMC/src/web/scripts/style/cmds-ui.css
r5303 r6834 85 85 /* .cmds-elem-plus .detail { display: none; border: 1px solid #A6C9E2;} */ 86 86 .node-detail td.number .detail {position:relative; } 87 88 li.node-item .node-detail {max-height:400px; overflow:auto;} 87 89 88 90 .cmds-elem-prop {} -
SMC/trunk/SMC/src/web/scripts/style/smc-graph.css
r3631 r6834 113 113 } 114 114 115 /* persons (m/w) */ 116 .type-m circle { fill: #339; } 117 .type-f circle { fill: #393; } 118 115 119 116 120 .highlight circle,
Note: See TracChangeset
for help on using the changeset viewer.