Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
6201e64b
Commit
6201e64b
authored
Sep 03, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input settings: allow choosing servermenu AND urlparam file
parent
738ac326
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
main.js
twmain/main.js
+26
-19
No files found.
twmain/main.js
View file @
6201e64b
...
...
@@ -221,16 +221,25 @@ function syncRemoteGraphData () {
// sourcemode == "serverfile" or "servermenu"
// cases (2) and (3) : read a file from server
else
{
console
.
log
(
"input case: server-side file, using TW.conf.paths.sourceMenu
or getUrlParam.file or TW.conf.paths.source
File"
)
console
.
log
(
"input case: server-side file, using TW.conf.paths.sourceMenu
and/or TW.
File"
)
// -> @mode is servermenu, files are listed in db.json file (preRes ajax)
// --> if @file also in url, choose the db.json one matching
// --> otherwise, choose the "first_file" from db.json list
// -> @mode is serverfile
// -> gexf file path is in the urlparam @file
// -> gexf file path is already specified in TW.conf.paths.sourceFile
// both modes (2) and (3) need a direct file
// a) file path is in the urlparam @file (overrides any defaults)
if
(
!
isUndef
(
getUrlParam
.
file
)
)
{
TW
.
File
=
getUrlParam
.
file
}
// b) default case: specified file path in settings_explorer
else
if
(
TW
.
conf
.
paths
.
sourceFile
)
{
console
.
log
(
"no @file arg: trying TW.conf.sourceFile from settings"
)
TW
.
File
=
TW
.
conf
.
paths
.
sourceFile
;
}
// 2) @mode is servermenu, files are listed in db.json file (preRes ajax)
// --> if @file also in url, choose the db.json one matching
// --> otherwise, choose the "first_file" from db.json list
// menufile case : a list of source files in ./db.json
if
(
sourcemode
==
'servermenu'
)
{
console
.
log
(
"using entire FILEMENU TW.conf.paths.sourceMenu"
)
...
...
@@ -239,27 +248,26 @@ function syncRemoteGraphData () {
var
files_selector
=
'<select onchange="openGraph(this.options[this.selectedIndex].dataset.fullpath)">'
for
(
let
fullPath
in
TW
.
gmenuInfos
)
{
let
shortname
=
graphPathToLabel
(
fullPath
)
files_selector
+=
`<option data-fullpath="
${
fullPath
}
">`
+
shortname
+
'</option>'
let
preSelected
=
(
fullPath
==
TW
.
File
)
files_selector
+=
`<option
${
preSelected
?
"selected"
:
""
}
data-fullpath="
${
fullPath
}
">`
+
shortname
+
'</option>'
}
files_selector
+=
"</select>"
$
(
"#network"
).
html
(
files_selector
)
//
in this case we keep the TW.File that was already set
from readMenu
//
NB if TW.File was not in the list we keep the first one
from readMenu
}
// direct urlparam file case
else
if
(
!
isUndef
(
getUrlParam
.
file
)
)
{
TW
.
File
=
getUrlParam
.
file
}
// direct file fallback case: specified file in settings_explorer
else
if
(
TW
.
conf
.
paths
.
sourceFile
&&
linkCheck
(
TW
.
conf
.
paths
.
sourceFile
))
{
console
.
log
(
"no @file arg: trying TW.conf.sourceFile from settings"
)
TW
.
File
=
TW
.
conf
.
paths
.
sourceFile
;
// 3) @mode is serverfile a or b (default)
else
if
(
TW
.
File
)
{
if
(
!
linkCheck
(
TW
.
File
))
{
console
.
error
(
`Specified file
${
TW
.
File
}
is absent.`
)
}
}
else
{
console
.
error
(
`No specified input and n
either db.json nor TW.conf.paths.sourceFile
${
TW
.
conf
.
paths
.
sourceFile
}
are present
`
)
console
.
error
(
`No specified input and n
o servermenu.
`
)
}
// finally: read the chosen file
var
finalRes
=
AjaxSync
({
url
:
TW
.
File
});
inData
=
finalRes
[
"data"
]
inFormat
=
finalRes
[
"format"
]
...
...
@@ -275,7 +283,6 @@ function syncRemoteGraphData () {
}
return
[
inFormat
,
inData
,
inConfKey
,
mapLabel
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment