Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
72e104ea
Commit
72e104ea
authored
Jan 12, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] in ngrams table, new maplist/stoplist checkboxes
parent
a6ed6fa6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
323 additions
and
317 deletions
+323
-317
jquery.dynatable.css
static/css/jquery.dynatable.css
+1
-1
NGrams_dyna_chart_and_table.js
static/js/NGrams_dyna_chart_and_table.js
+297
-252
terms.html
templates/corpus/terms.html
+25
-64
No files found.
static/css/jquery.dynatable.css
View file @
72e104ea
...
@@ -69,4 +69,4 @@ th a:hover {
...
@@ -69,4 +69,4 @@ th a:hover {
.dynatable-disabled-page
:hover
{
.dynatable-disabled-page
:hover
{
background
:
none
;
background
:
none
;
color
:
#999
;
color
:
#999
;
}
}
\ No newline at end of file
static/js/NGrams_dyna_chart_and_table.js
View file @
72e104ea
/**
* @fileoverview
* Manages behavior of the terms view (at: project/PID/corpus/CID/terms)
* - the ngrams table with normal/keep/delete states
* - the ngrams groupings
* - the score chart
*
* Main_test() is the entry point. A dynatable is the main UI element.
*
* Dynatable uses <thead> for columns and ulWriter() for row formatting.
*
* Here, the user can modify DB lists by toggling Ngrams states and
* save to DB via the API in the functions SaveLocalChanges() and CRUD()
*
* Local persistence of states is in AjaxRecord[tableId].state
* (access by table ids, *not* ngram ids)
*
* Their values are initialized in the functions AfterAjax() and Refresh().
*
* The stateIds are described by the System object.
* - columns use stateId [0..2] (miam aka normal, map aka keep, stop aka delete)
* - stateId 3 is for grouped items (TODO clarify use)
*
* @author
* Samuel Castillo (original 2015 work)
* Romain Loth (minor 2016 modifications + doc)
*
* @version 1.0 beta
*
* @requires jquery.dynatable
* @requires d3
*/
function
pr
(
msg
)
{
function
pr
(
msg
)
{
// rl dbg
console
.
log
(
"
\n
FUN pr()"
)
console
.
log
(
msg
)
console
.
log
(
msg
)
}
}
function
getCookie
(
name
)
{
function
getCookie
(
name
)
{
// rl dbg
console
.
log
(
"
\n
FUN getCookie()"
)
var
cookieValue
=
null
;
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
var
cookies
=
document
.
cookie
.
split
(
';'
);
var
cookies
=
document
.
cookie
.
split
(
';'
);
...
@@ -54,7 +81,7 @@ var System = {
...
@@ -54,7 +81,7 @@ var System = {
// },
// },
0
:
{
0
:
{
"states"
:
[
"normal"
,
"keep"
,
"delete"
,
"group"
]
,
"states"
:
[
"normal"
,
"keep"
,
"delete"
,
"group"
]
,
"statesD"
:
{}
,
"statesD"
:
{}
,
// will be inverted map of states
"dict"
:
{
"dict"
:
{
"normal"
:
{
"normal"
:
{
"id"
:
"normal"
,
"id"
:
"normal"
,
...
@@ -81,11 +108,19 @@ var System = {
...
@@ -81,11 +108,19 @@ var System = {
}
}
// States : [ "normal" , "keep" , "delete"]
/**
* inverted mapping useful for state_id lookup
*
* System[GState]["statesD"] = {'normal':0,'keep':1,'delete':2,'group':3}
*/
for
(
var
i
in
System
[
GState
][
"states"
]
)
{
for
(
var
i
in
System
[
GState
][
"states"
]
)
{
System
[
GState
][
"statesD"
][
System
[
GState
][
"states"
][
i
]
]
=
Number
(
i
)
System
[
GState
][
"statesD"
][
System
[
GState
][
"states"
][
i
]
]
=
Number
(
i
)
}
}
var
FlagsBuffer
=
{}
var
FlagsBuffer
=
{}
for
(
var
i
in
System
[
GState
][
"states"
])
{
for
(
var
i
in
System
[
GState
][
"states"
])
{
FlagsBuffer
[
System
[
GState
][
"states"
][
i
]]
=
{}
FlagsBuffer
[
System
[
GState
][
"states"
][
i
]]
=
{}
...
@@ -103,8 +138,6 @@ var volumeChart = dc.barChart("#monthly-volume-chart");
...
@@ -103,8 +138,6 @@ var volumeChart = dc.barChart("#monthly-volume-chart");
// Get all projects and corpuses of the user
// Get all projects and corpuses of the user
function
GetUserPortfolio
()
{
function
GetUserPortfolio
()
{
// rl dbg
console
.
log
(
"
\n
FUN GetUserPortfolio()"
)
//http://localhost:8000/api/corpusintersection/1a50317a50145
//http://localhost:8000/api/corpusintersection/1a50317a50145
var
project_id
=
getIDFromURL
(
"project"
)
var
project_id
=
getIDFromURL
(
"project"
)
var
corpus_id
=
getIDFromURL
(
"corpus"
)
var
corpus_id
=
getIDFromURL
(
"corpus"
)
...
@@ -175,8 +208,6 @@ function GetUserPortfolio() {
...
@@ -175,8 +208,6 @@ function GetUserPortfolio() {
//Getting a corpusB-list and intersecting it with current corpusA-miamlist.
//Getting a corpusB-list and intersecting it with current corpusA-miamlist.
function
printCorpuses
()
{
function
printCorpuses
()
{
// rl dbg
console
.
log
(
"
\n
FUN printCorpuses()"
)
console
.
log
(
"!!!!!!!! in printCorpuses() !!!!!!!! "
)
console
.
log
(
"!!!!!!!! in printCorpuses() !!!!!!!! "
)
pr
(
corpusesList
)
pr
(
corpusesList
)
...
@@ -247,8 +278,6 @@ function printCorpuses() {
...
@@ -247,8 +278,6 @@ function printCorpuses() {
function
Push2Buffer
(
NewVal
)
{
function
Push2Buffer
(
NewVal
)
{
// rl dbg
console
.
log
(
"
\n
FUN Push2Buffer()"
)
if
(
TheBuffer
==
false
)
{
if
(
TheBuffer
==
false
)
{
if
(
!
NewVal
)
{
if
(
!
NewVal
)
{
var
limits
=
[
oldest
,
latest
];
var
limits
=
[
oldest
,
latest
];
...
@@ -285,8 +314,8 @@ function Push2Buffer( NewVal ) {
...
@@ -285,8 +314,8 @@ function Push2Buffer( NewVal ) {
}
}
function
Final_UpdateTable
(
action
)
{
function
Final_UpdateTable
(
action
)
{
//
rl db
g
//
debu
g
console
.
log
(
"
\n
FUN Final_UpdateTable()"
)
//
console.log("\nFUN Final_UpdateTable()")
// (1) Identifying if the button is collapsed:
// (1) Identifying if the button is collapsed:
var
isCollapsed
=
false
;
var
isCollapsed
=
false
;
var
accordiontext
=
$
(
"#collapseOne"
).
attr
(
"class"
)
var
accordiontext
=
$
(
"#collapseOne"
).
attr
(
"class"
)
...
@@ -297,8 +326,8 @@ function Final_UpdateTable( action ) {
...
@@ -297,8 +326,8 @@ function Final_UpdateTable( action ) {
var
UpdateTable
=
false
var
UpdateTable
=
false
if
(
(
action
==
"click"
&&
!
isCollapsed
)
||
(
action
==
"changerange"
&&
isCollapsed
)
)
{
if
(
(
action
==
"click"
&&
!
isCollapsed
)
||
(
action
==
"changerange"
&&
isCollapsed
)
)
{
UpdateTable
=
true
;
UpdateTable
=
true
;
$
(
"#corpusdisplayer"
).
html
(
"Close
Folder
"
)
$
(
"#corpusdisplayer"
).
html
(
"Close
Term List
"
)
}
else
$
(
"#corpusdisplayer"
).
html
(
"
Open Folder
"
)
}
else
$
(
"#corpusdisplayer"
).
html
(
"
Show Term List
"
)
pr
(
"update table??: "
+
UpdateTable
)
pr
(
"update table??: "
+
UpdateTable
)
...
@@ -343,21 +372,15 @@ function Final_UpdateTable( action ) {
...
@@ -343,21 +372,15 @@ function Final_UpdateTable( action ) {
}
}
function
getRecord
(
rec_id
)
{
function
getRecord
(
rec_id
)
{
// rl dbg
console
.
log
(
"
\n
FUN getRecord()"
)
return
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
originalRecords
[
rec_id
];
return
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
originalRecords
[
rec_id
];
// return AjaxRecords[rec_id]
// return AjaxRecords[rec_id]
}
}
function
getRecords
()
{
function
getRecords
()
{
// rl dbg
console
.
log
(
"
\n
FUN getRecords()"
)
return
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
originalRecords
;
return
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
originalRecords
;
}
}
function
save_groups
()
{
function
save_groups
()
{
// rl dbg
console
.
log
(
"
\n
FUN save_groups()"
)
var
groupdiv
=
"#group_box"
var
groupdiv
=
"#group_box"
var
gcontent
=
groupdiv
+
"_content"
var
gcontent
=
groupdiv
+
"_content"
var
count
=
0
var
count
=
0
...
@@ -394,8 +417,6 @@ function save_groups() {
...
@@ -394,8 +417,6 @@ function save_groups() {
}
}
function
cancel_groups
()
{
function
cancel_groups
()
{
// rl dbg
console
.
log
(
"
\n
FUN cancel_groups()"
)
var
groupdiv
=
"#group_box"
var
groupdiv
=
"#group_box"
var
gcontent
=
groupdiv
+
"_content"
var
gcontent
=
groupdiv
+
"_content"
$
(
gcontent
).
children
(
'span'
).
each
(
function
()
{
$
(
gcontent
).
children
(
'span'
).
each
(
function
()
{
...
@@ -411,8 +432,6 @@ function cancel_groups() {
...
@@ -411,8 +432,6 @@ function cancel_groups() {
}
}
function
add2groupdiv
(
elem_id
)
{
function
add2groupdiv
(
elem_id
)
{
// rl dbg
console
.
log
(
"
\n
FUN add2groupdiv()"
)
$
(
'<span/>'
,
{
$
(
'<span/>'
,
{
"data-id"
:
AjaxRecords
[
elem_id
].
id
,
"data-id"
:
AjaxRecords
[
elem_id
].
id
,
"data-stuff"
:
elem_id
,
"data-stuff"
:
elem_id
,
...
@@ -440,9 +459,6 @@ function add2groupdiv( elem_id ) {
...
@@ -440,9 +459,6 @@ function add2groupdiv( elem_id ) {
}
}
// new
// new
function
add2group
(
elem
)
{
function
add2group
(
elem
)
{
// rl dbg
console
.
log
(
"
\n
FUN add2group()"
)
if
(
$
(
"#group_box"
).
length
==
0
)
{
if
(
$
(
"#group_box"
).
length
==
0
)
{
var
div_name
=
"#my-ajax-table > thead > tr > th:nth-child(1)"
var
div_name
=
"#my-ajax-table > thead > tr > th:nth-child(1)"
var
prctg
=
$
(
div_name
).
width
()
// / $(div_name).parent().width() * 100;
var
prctg
=
$
(
div_name
).
width
()
// / $(div_name).parent().width() * 100;
...
@@ -469,90 +485,135 @@ function add2group ( elem ) {
...
@@ -469,90 +485,135 @@ function add2group ( elem ) {
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
}
}
// new
/**
// click red, click keep, click normal...
* click red, click keep, click normal...
*
* @param elem - the table row that contains the term cell
*/
function
clickngram_action
(
elem
)
{
function
clickngram_action
(
elem
)
{
// rl dbg
// local id
console
.
log
(
"
\n
FUN clickngram_action() !!!!"
)
var
elem_id
=
$
(
elem
).
data
(
"stuff"
)
;
var
elem_id
=
$
(
elem
).
data
(
"stuff"
)
console
.
log
(
"click: state before: "
+
AjaxRecords
[
elem_id
].
state
)
;
// cycle the statuses (omitting status 3 = group)
AjaxRecords
[
elem_id
].
state
=
(
AjaxRecords
[
elem_id
].
state
==
(
System
[
0
][
"states"
].
length
-
2
))?
0
:(
AjaxRecords
[
elem_id
].
state
+
1
);
AjaxRecords
[
elem_id
].
state
=
(
AjaxRecords
[
elem_id
].
state
==
(
System
[
0
][
"states"
].
length
-
2
))?
0
:(
AjaxRecords
[
elem_id
].
state
+
1
);
// State <=> term color <=> checked colums
console
.
log
(
"
\n\n
RECORD visible on click --- "
+
JSON
.
stringify
(
AjaxRecords
[
elem_id
]))
;
var
ngramId
=
AjaxRecords
[
elem_id
].
id
;
console
.
log
(
"click: state after: "
+
AjaxRecords
[
elem_id
].
state
)
;
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
}
}
// modified
/**
/**
* @param rec_id - an id to an ngram record in AjaxRecords
* Works for ulWriter. Connects a record's state with table UI outcome.
*
* @param rec_id - the local id for this ngram record in AjaxRecords
*/
*/
function
transformContent
(
rec_id
)
{
function
transformContent
(
rec_id
)
{
//
rl db
g
//
debu
g
console
.
log
(
"
\n
FUN transformContent() !!!!"
)
//
console.log("\nFUN transformContent() !!!!")
var
elem
=
AjaxRecords
[
rec_id
];
var
ngram_info
=
AjaxRecords
[
rec_id
];
// ex:
elem
= {
// ex:
ngram_info
= {
// "id":2349,"name":"failure","score":1,"flag":false,
// "id":2349,"name":"failure","score":1,"flag":false,
// "group_plus":true,"group_blocked":false,"state":0
// "group_plus":true,"group_blocked":false,"state":0
// }
// }
//~ console.log(
//~ "transformContent got elem no " + rec_id + ": "
// console.log(
//~ + JSON.stringify(elem)
// "transformContent got ngram_info no " + rec_id + ": "
//~ )
// + JSON.stringify(ngram_info)
// )
// result {} contains instanciated column html for dynatables
var
result
=
{}
var
result
=
{}
var
atts
=
System
[
0
][
"dict"
][
System
[
0
][
"states"
][
elem
.
state
]
]
var
atts
=
System
[
0
][
"dict"
][
System
[
0
][
"states"
][
ngram_info
.
state
]
]
var
plus_event
=
""
var
plus_event
=
""
if
(
GState
==
0
&&
elem
.
state
!=
System
[
0
][
"statesD"
][
"delete"
]
)
// if deleted, no + button
// GState = 1 if previously had add_group
// it influences state lookup
if
(
GState
==
0
&&
ngram_info
.
state
!=
System
[
0
][
"statesD"
][
"delete"
]
)
// if deleted, no + button
plus_event
=
" <a class=
\"
plusclass
\"
onclick=
\"
add2group(this.parentNode.parentNode)
\"
>(+)</a>"
plus_event
=
" <a class=
\"
plusclass
\"
onclick=
\"
add2group(this.parentNode.parentNode)
\"
>(+)</a>"
if
(
GState
==
1
)
{
if
(
GState
==
1
)
{
if
(
elem
.
state
!=
System
[
0
][
"statesD"
][
"delete"
]
&&
elem
.
state
!=
System
[
0
][
"statesD"
][
"group"
])
{
// if deleted and already group, no Up button
if
(
ngram_info
.
state
!=
System
[
0
][
"statesD"
][
"delete"
]
&&
ngram_info
.
state
!=
System
[
0
][
"statesD"
][
"group"
])
{
// if deleted and already group, no Up button
plus_event
=
" <a class=
\"
plusclass
\"
onclick=
\"
add2group(this.parentNode.parentNode)
\"
>(▲)</a>"
plus_event
=
" <a class=
\"
plusclass
\"
onclick=
\"
add2group(this.parentNode.parentNode)
\"
>(▲)</a>"
}
}
}
}
result
[
"id"
]
=
elem
[
"id"
]
// rl simple tests for additional columns ----
// uncomment if column tableId
result
[
"add_to_map"
]
=
elem
[
"add_to_map"
]
// result['rec_id'] = rec_id ;
result
[
"add_to_stop"
]
=
elem
[
"add_to_stop"
]
// -------------------------------------------
// uncomment if column ngramId
result
[
"score"
]
=
'<span class="'
+
atts
.
id
+
'">'
+
elem
[
"score"
]
+
'</span>'
// result["ngramId"] = ngram_info["id"] ;
// uncomment if column state
// result["state"] = AjaxRecords[rec_id].state
// -------------------------------------------
// check box state columns 'will_be_map' and 'will_be_stop'
map_flag
=
(
AjaxRecords
[
rec_id
].
state
==
1
)
;
// 1 = System[0]["statesD"]["keep"]
stop_flag
=
(
AjaxRecords
[
rec_id
].
state
==
2
)
;
// 2 = System[0]["statesD"]["delete"]
result
[
"will_be_map"
]
=
'<input type="checkbox" onclick="checkBox(
\'
keep
\'
,this.parentNode.parentNode)" '
+
(
map_flag
?
'checked'
:
''
)
+
'></input>'
result
[
"will_be_stop"
]
=
'<input type="checkbox" onclick="checkBox(
\'
delete
\'
, this.parentNode.parentNode)" '
+
(
stop_flag
?
'checked'
:
''
)
+
'></input>'
// possible todo: 3 way switch ??
// par exemple http://codepen.io/pamgriffith/pen/zcntm
// -------------------------------------------
result
[
"score"
]
=
'<span class="'
+
atts
.
id
+
'">'
+
ngram_info
[
"score"
]
+
'</span>'
result
[
"name"
]
=
"<span class=
\"
"
+
atts
.
id
+
result
[
"name"
]
=
"<span class=
\"
"
+
atts
.
id
+
"
\"
onclick=
\"
clickngram_action(this.parentNode.parentNode)
\"
>"
+
elem
[
"name"
]
+
"</span>"
+
"
\"
onclick=
\"
clickngram_action(this.parentNode.parentNode)
\"
>"
+
ngram_info
[
"name"
]
+
"</span>"
+
plus_event
plus_event
return
result
;
return
result
;
}
}
// to delete
// Affecting the tr element somehow
function
overRide
(
elem
)
{
// rl dbg
console
.
log
(
"
\n
FUN overRide() !!!!"
)
var
id
=
elem
.
id
var
current_flag
=
$
(
"input[type='radio'][name='radios']:checked"
).
val
()
var
this_newflag
=
(
current_flag
==
AjaxRecords
[
id
][
"flag"
])?
false
:
current_flag
console
.
log
(
"striking: "
+
id
+
" | this-elem_flag: "
+
AjaxRecords
[
id
][
"flag"
]
+
" | current_flag: "
+
current_flag
)
console
.
log
(
"
\
t so the new flag is: "
+
this_newflag
)
// if(this_newflag)
// FlagsBuffer[this_newflag][id] = true;
// else
// delete FlagsBuffer[ AjaxRecords[id]["flag"] ][id];
var
sum__selected_elems
=
0
;
for
(
var
i
in
FlagsBuffer
)
sum__selected_elems
+=
Object
.
keys
(
FlagsBuffer
[
i
]).
length
;
console
.
log
(
""
)
console
.
log
(
"Current Buffer size: "
+
sum__selected_elems
)
console
.
log
(
FlagsBuffer
)
if
(
sum__selected_elems
>
0
)
$
(
"#Clean_All, #Save_All"
).
removeAttr
(
"disabled"
,
"disabled"
);
else
$
(
"#Clean_All, #Save_All"
).
attr
(
"disabled"
,
"disabled"
);
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
/**
* Click on a checkbox in a row
*
* @boxType : 'keep' or 'delete' (resp. maplist and stoplist)
* @elem : entire element row with attribute 'data-stuff' (= rec_id)
*/
function
checkBox
(
boxType
,
elem
)
{
console
.
log
(
'CLICK on check box'
)
;
var
elemId
=
elem
.
getAttribute
(
"data-stuff"
)
;
var
ngramId
=
AjaxRecords
[
elemId
].
id
;
var
currentState
=
AjaxRecords
[
elemId
].
state
;
// alert('ELEMENT: ' + elemId + '\n'
// + 'NGRAM: ' + ngramId + '\n'
// + 'CURRENT STATE: ' + currentState) ;
// find out which box
// if (boxType == 'keep') => affectedState = 1
// if (boxType == 'delete') => affectedState = 2
affectedState
=
System
[
0
][
"statesD"
][
boxType
]
;
// turn on if it's not already on
if
(
currentState
!=
affectedState
)
{
targetState
=
affectedState
}
// otherwise turn the 2 boxes off
else
{
targetState
=
0
;
}
// set old state and color
AjaxRecords
[
elemId
].
state
=
targetState
;
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
}
}
/**
/**
* "generic enough"
* "generic enough"
*
*
...
@@ -577,103 +638,67 @@ function overRide(elem) {
...
@@ -577,103 +638,67 @@ function overRide(elem) {
* ]
* ]
*/
*/
function
ulWriter
(
rowIndex
,
record
,
columns
,
cellWriter
)
{
function
ulWriter
(
rowIndex
,
record
,
columns
,
cellWriter
)
{
//
rl db
g
//
debu
g
console
.
log
(
"
\n
FUN ulWriter()"
)
//
console.log("\nFUN ulWriter()")
var
tr
=
''
;
var
tr
=
''
;
var
cp_rec
=
{}
var
cp_rec
=
{}
//console.log("rowIndex:" + rowIndex)
console
.
log
(
"record"
+
JSON
.
stringify
(
record
))
console
.
log
(
"columns"
+
JSON
.
stringify
(
columns
))
if
(
AjaxRecords
[
RecDict
[
record
.
id
]].
state
<
0
)
{
return
false
;
}
if
(
AjaxRecords
[
RecDict
[
record
.
id
]].
state
<
0
)
// Add cells content (values OR custom html) from record
return
false
;
// -----------------------------------------------------
// £TODO add states as checkboxes
cp_rec
=
transformContent
(
RecDict
[
record
.
id
])
cp_rec
=
transformContent
(
RecDict
[
record
.
id
])
// console.log("cp_rec" + JSON.stringify(cp_rec))
// console.log("\n----\nrecord" + JSON.stringify(record))
// grab the record's attribute for each column
// grab the record's attribute for each column
for
(
var
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++
)
{
tr
+=
cellWriter
(
columns
[
i
],
cp_rec
);
tr
+=
cellWriter
(
columns
[
i
],
cp_rec
);
}
}
console
.
log
(
"tr"
+
tr
)
// we could directly use record.id (ngram_id) if store states separately
var
data_id
=
RecDict
[
record
.
id
]
var
data_id
=
RecDict
[
record
.
id
]
return
'<tr data-stuff='
+
data_id
+
'>'
+
tr
+
'</tr>'
;
return
'<tr data-stuff='
+
data_id
+
'>'
+
tr
+
'</tr>'
;
}
}
function
SelectAll
(
box
)
{
/**
// rl dbg
* SelectAll: toggle all checkboxes in a row by changing state in System
console
.
log
(
"
\n
FUN SelectAll()"
)
*
var
current_flag
=
$
(
"input[type='radio'][name='radios']:checked"
).
val
()
* (new version without the old Delete|Keep radio choice)
* @boxType : 'keep' or 'delete' (resp. maplist and stoplist)
* @elem : entire element row with attribute 'data-stuff' (= rec_id)
*/
function
SelectAll
(
boxType
,
boxElem
)
{
// debug
// console.log("\nFUN SelectAll()")
$
(
"tbody tr"
).
each
(
function
(
i
,
row
)
{
$
(
"tbody tr"
).
each
(
function
(
i
,
row
)
{
var
id
=
$
(
row
).
data
(
'stuff'
)
var
rec_id
=
$
(
row
).
data
(
'stuff'
)
;
// for old state system
if
(
box
.
checked
)
{
var
ngramId
=
AjaxRecords
[
rec_id
].
id
;
// for future state system (cols)
AjaxRecords
[
id
][
"state_buff"
]
=
AjaxRecords
[
id
][
"state"
]
if
(
boxElem
.
checked
)
{
AjaxRecords
[
id
][
"state"
]
=
System
[
0
][
"statesD"
][
current_flag
]
// stateId: 1 if boxType == 'keep'
}
else
{
// 2 if boxType == 'delete'
AjaxRecords
[
id
][
"state"
]
=
AjaxRecords
[
id
][
"state_buff"
]
var
stateId
=
System
[
0
][
"statesD"
][
boxType
]
;
// buffer useful if restore
AjaxRecords
[
rec_id
][
"state_buff"
]
=
AjaxRecords
[
rec_id
][
"state"
]
AjaxRecords
[
rec_id
][
"state"
]
=
stateId
;
}
// restore previous states
else
{
AjaxRecords
[
rec_id
][
"state"
]
=
AjaxRecords
[
rec_id
][
"state_buff"
]
;
}
}
});
});
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
MyTable
.
data
(
'dynatable'
).
dom
.
update
();
}
}
function
SaveGlobalChanges
(
delete_
)
{
// rl dbg
console
.
log
(
"
\n
FUN SaveGlobalChanges()"
)
console
.
log
(
"iterating over global stop words:"
)
$
(
'.globalstopwords'
).
each
(
function
()
{
console
.
log
(
$
(
this
).
data
(
"id"
)
)
});
console
.
log
(
" - - - - -"
)
console
.
log
(
"delete: "
+
delete_
)
if
(
!
delete_
)
{
// SaveLocalChanges()
}
else
{
}
}
function
SaveGlobalChanges_Form
(
nodes2del
)
{
// rl dbg
console
.
log
(
"
\n
FUN SaveGlobalChanges_Form()"
)
console
.
log
(
"In SaveGlobalChanges:"
)
console
.
log
(
nodes2del
)
//AjaxRecords[RecDict[1731]]
$
(
"#stoplist_content"
).
html
(
""
)
var
html_globalstop
=
""
for
(
var
i
in
nodes2del
)
{
$
(
'<span/>'
,
{
"class"
:
"globalstopwords"
,
"data-id"
:
AjaxRecords
[
RecDict
[
nodes2del
[
i
]]].
id
,
"data-stuff"
:
RecDict
[
nodes2del
[
i
]],
title
:
'Click to remove'
,
text
:
AjaxRecords
[
RecDict
[
nodes2del
[
i
]]].
name
,
css
:
{
"cursor"
:
"pointer"
,
"border"
:
"1px solid red"
,
"margin"
:
"3px"
,
"padding"
:
"3px"
,
}
})
.
click
(
function
()
{
$
(
this
).
remove
()
// if nothing in group div, then remove it
if
(
$
(
"#stoplist_content"
).
children
().
length
==
0
)
{
SaveLocalChanges
()
}
})
.
appendTo
(
'#stoplist_content'
)
}
$
(
"#pre_savechanges"
).
modal
(
"show"
)
}
// Save changes to all corpusA-lists
// Save changes to all corpusA-lists
function
SaveLocalChanges
()
{
function
SaveLocalChanges
()
{
// rl dbg
console
.
log
(
"
\n
FUN SaveLocalChanges()"
)
console
.
log
(
"
\n
FUN SaveGlobalChanges()"
)
// console.clear()
// console.clear()
console
.
log
(
"In SaveChanges()"
)
console
.
log
(
"In SaveChanges()"
)
var
sum__selected_elems
=
0
;
var
sum__selected_elems
=
0
;
...
@@ -721,10 +746,10 @@ function SaveLocalChanges() {
...
@@ -721,10 +746,10 @@ function SaveLocalChanges() {
}
}
// [ = = = = / For deleting subforms = = = = ]
// [ = = = = / For deleting subforms = = = = ]
//
console.log(" = = = = = = = = = == ")
console
.
log
(
" = = = = = = = = = == "
)
//
console.log("FlagsBuffer:")
console
.
log
(
"FlagsBuffer:"
)
// console.log(FlagsBuffer
)
console
.
log
(
JSON
.
stringify
(
FlagsBuffer
)
)
var
nodes_2del
=
Object
.
keys
(
FlagsBuffer
[
"delete"
]).
map
(
Number
)
var
nodes_2del
=
Object
.
keys
(
FlagsBuffer
[
"delete"
]).
map
(
Number
)
var
nodes_2keep
=
Object
.
keys
(
FlagsBuffer
[
"keep"
]).
map
(
Number
)
var
nodes_2keep
=
Object
.
keys
(
FlagsBuffer
[
"keep"
]).
map
(
Number
)
...
@@ -732,21 +757,21 @@ function SaveLocalChanges() {
...
@@ -732,21 +757,21 @@ function SaveLocalChanges() {
var
nodes_2inmap
=
$
.
extend
({},
FlagsBuffer
[
"inmap"
])
var
nodes_2inmap
=
$
.
extend
({},
FlagsBuffer
[
"inmap"
])
var
nodes_2outmap
=
$
.
extend
({},
FlagsBuffer
[
"outmap"
])
var
nodes_2outmap
=
$
.
extend
({},
FlagsBuffer
[
"outmap"
])
//
console.log("")
console
.
log
(
""
)
//
console.log("")
console
.
log
(
""
)
//
console.log(" nodes_2del: ")
console
.
log
(
" nodes_2del: "
)
//
console.log(nodes_2del)
console
.
log
(
nodes_2del
)
//
console.log(" nodes_2keep: ")
console
.
log
(
" nodes_2keep: "
)
//
console.log(nodes_2keep)
console
.
log
(
nodes_2keep
)
//
console.log(" nodes_2group: ")
console
.
log
(
" nodes_2group: "
)
//
console.log(nodes_2group)
console
.
log
(
nodes_2group
)
//
console.log(" nodes_2inmap: ")
console
.
log
(
" nodes_2inmap: "
)
//
console.log(nodes_2inmap)
console
.
log
(
nodes_2inmap
)
//
console.log(" nodes_2outmap: ")
console
.
log
(
" nodes_2outmap: "
)
//
console.log(nodes_2outmap)
console
.
log
(
nodes_2outmap
)
//
console.log("")
console
.
log
(
""
)
//
console.log("")
console
.
log
(
""
)
var
list_id
=
$
(
"#list_id"
).
val
()
var
list_id
=
$
(
"#list_id"
).
val
()
var
corpus_id
=
getIDFromURL
(
"corpus"
)
// not used
var
corpus_id
=
getIDFromURL
(
"corpus"
)
// not used
...
@@ -787,26 +812,17 @@ $("#Clean_All").click(function(){
...
@@ -787,26 +812,17 @@ $("#Clean_All").click(function(){
$
(
"#Save_All"
).
click
(
function
(){
$
(
"#Save_All"
).
click
(
function
(){
SaveLocalChanges
()
SaveLocalChanges
()
// var Elems_2Del = {};
// for(var id in AjaxRecords) {
// if(AjaxRecords[id]["state"]==System[0]["statesD"]["delete"]) {
// Elems_2Del[AjaxRecords[id].id] = true
// }
// }
// if( Object.keys(Elems_2Del).length>0 ) {
// SaveGlobalChanges_Form( Object.keys(Elems_2Del).map(Number) )
// } else {
// // SaveLocalChanges() //At the end, reload!
// }
});
});
// For lists, all http-requests
// For lists, all http-requests
function
CRUD
(
parent_id
,
action
,
nodes
,
args
,
http_method
,
callback
)
{
function
CRUD
(
parent_id
,
action
,
nodes
,
args
,
http_method
,
callback
)
{
// rl dbg
console
.
log
(
"
\n
!!!! FUN CRUD() !!!! ----------------"
)
var
the_url
=
window
.
location
.
origin
+
"/api/node/"
+
parent_id
+
"/ngrams"
+
action
+
"/"
+
nodes
.
join
(
"+"
);
var
the_url
=
window
.
location
.
origin
+
"/api/node/"
+
parent_id
+
"/ngrams"
+
action
+
"/"
+
nodes
.
join
(
"+"
);
the_url
=
the_url
.
replace
(
/
\/
$/
,
""
);
//remove trailing slash
the_url
=
the_url
.
replace
(
/
\/
$/
,
""
);
//remove trailing slash
if
(
nodes
.
length
>
0
||
Object
.
keys
(
args
).
length
>
0
)
{
// debug
// console.log("CRUD AJAX => URL: " + the_url + " (" + http_method + ")")
if
(
nodes
.
length
>
0
||
Object
.
keys
(
args
).
length
>
0
)
{
$
.
ajax
({
$
.
ajax
({
method
:
http_method
,
method
:
http_method
,
url
:
the_url
,
url
:
the_url
,
...
@@ -835,19 +851,23 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
...
@@ -835,19 +851,23 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
/**
/**
* 1. Creates the html of the table
* 1. Creates the html of the table
* => therefore thead for dynatable columns template
* => therefore thead for dynatable columns template
* 2. Fills the AjaxRecords from data
* 2. Fills the AjaxRecords from data
* record.id, record.name, record.score... all except record.state
* record.state is initalized in:
* - AfterAjax for map items
* - ??? for stop items
* 3. Creates the scores distribution chart over table
* 3. Creates the scores distribution chart over table
* 4. ???
* 4. Set up Search div
* 5. PROFIT!
*
*
* @param data: a response from the api/node/CID/ngrams/list/ routes
* @param data: a response from the api/node/CID/ngrams/list/ routes
* @param initial: initial score type "occs" or "tfidf"
* @param initial: initial score type "occs" or "tfidf"
* @param search_filter: eg 'filter_all' (see SearchFilters.MODE)
* @param search_filter: eg 'filter_all' (see SearchFilters.MODE)
*
* minor modifications rloth 2016 (previous work: Samuel Castillo 2015)
*/
*/
function
Main_test
(
data
,
initial
,
search_filter
)
{
function
Main_test
(
data
,
initial
,
search_filter
)
{
// debug
// alert("refresh main")
console
.
log
(
""
)
console
.
log
(
""
)
console
.
log
(
" = = = = MAIN_TEST: = = = = "
)
console
.
log
(
" = = = = MAIN_TEST: = = = = "
)
console
.
log
(
"data:"
)
console
.
log
(
"data:"
)
...
@@ -873,19 +893,60 @@ function Main_test( data , initial , search_filter) {
...
@@ -873,19 +893,60 @@ function Main_test( data , initial , search_filter) {
// div_table += "\t"+"\t"+"\t"+'<input type="checkbox" id="multiple_selection" onclick="SelectAll(this);" /> Select'+"\n"
// div_table += "\t"+"\t"+"\t"+'<input type="checkbox" id="multiple_selection" onclick="SelectAll(this);" /> Select'+"\n"
$
(
"#div-table"
).
html
(
""
)
$
(
"#div-table"
).
html
(
""
)
$
(
"#div-table"
).
empty
();
$
(
"#div-table"
).
empty
();
// ? TODO move this to terms.html template
// ----------------------------------------
var
div_table
=
'<p align="right">'
+
"
\n
"
var
div_table
=
'<p align="right">'
+
"
\n
"
div_table
+=
'<table id="my-ajax-table" class="table table-bordered table-hover">'
+
"
\n
"
div_table
+=
'<table id="my-ajax-table" class="table table-bordered table-hover">'
+
"
\n
"
div_table
+=
"
\
t"
+
'<thead>'
+
"
\n
"
div_table
+=
"
\
t"
+
'<thead>'
+
"
\n
"
// each <th> will affect "columns" template arg in ulWriter()
div_table
+=
"
\
t"
+
'<tr>'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="add_to_map">Add to map</th>'
+
"
\n
"
// ------------------------------------------------------------------
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="add_to_stop">Add to stop</th>'
+
"
\n
"
// Any <th> defined here will end up in the 'columns' arg of ulWriter
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="name">Terms</th>'
+
"
\n
"
// ------------------------------------------------------------------
div_table
+=
"
\
t"
+
"
\
t"
+
'<th id="score_column_id" data-dynatable-sorts="score" data-dynatable-column="score">Score</th>'
+
"
\n
"
div_table
+=
"
\
t"
+
"
\
t"
+
'</th>'
+
"
\n
"
// uncomment for column tableId
div_table
+=
"
\
t"
+
'</thead>'
+
"
\n
"
// div_table += "\t"+"\t"+'<th data-dynatable-column="rec_id" style="background-color:grey">local id</th>'+"\n";
div_table
+=
"
\
t"
+
'<tbody>'
+
"
\n
"
div_table
+=
"
\
t"
+
'</tbody>'
+
"
\n
"
// uncomment for column ngramId
div_table
+=
'</table>'
+
"
\n
"
// div_table += "\t"+"\t"+'<th data-dynatable-column="ngramId" style="background-color:grey">ngramId</th>'+"\n";
// uncomment for column stateId
// div_table += "\t"+"\t"+'<th data-dynatable-column="state" style="background-color:grey">State</th>'+"\n" ;
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="name">Terms</th>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
"
\
t"
+
'<th id="score_column_id" data-dynatable-sorts="score" data-dynatable-column="score">Score</th>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
"
\
t"
+
'</th>'
+
"
\n
"
;
// selector columns... not sortable to allow 'click => check all'
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="will_be_map"'
+
' data-dynatable-no-sort="true"'
+
' title="Selected terms will appear in the map."'
+
' style="width:3em;"'
+
'>'
+
'Map'
+
'<p class="note">'
+
'<input type="checkbox"'
+
' onclick="SelectAll(
\'
keep
\'
,this)" title="Check to select all currently visible terms"></input>'
+
'<label>All</label>'
+
'</p>'
+
'</th>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
"
\
t"
+
'<th data-dynatable-column="will_be_stop"'
+
' data-dynatable-no-sort="true"'
+
' title="Selected terms will be removed from all lists."'
+
' style="width:3em;"'
+
'>'
+
'Del'
+
'<p class="note">'
+
'<input type="checkbox"'
+
' onclick="SelectAll(
\'
delete
\'
,this)" title="Check to select all currently visible terms"></input>'
+
'<label>All</label>'
+
'</p>'
+
'</th>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
'</tr>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
'</thead>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
'<tbody>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
"
\
t"
+
'<tr><td>a</td><td>a</td><td>a</td><td>a</td></tr>'
+
"
\n
"
;
div_table
+=
"
\
t"
+
'</tbody>'
+
"
\n
"
;
div_table
+=
'</table>'
+
"
\n
"
;
div_table
+=
'</p>'
;
div_table
+=
'</p>'
;
$
(
"#div-table"
).
html
(
div_table
)
$
(
"#div-table"
).
html
(
div_table
)
...
@@ -900,8 +961,8 @@ function Main_test( data , initial , search_filter) {
...
@@ -900,8 +961,8 @@ function Main_test( data , initial , search_filter) {
AjaxRecords
=
[]
AjaxRecords
=
[]
for
(
var
i
in
data
.
ngrams
)
{
for
(
var
i
in
data
.
ngrams
)
{
var
le_ngram
=
data
.
ngrams
[
i
]
var
le_ngram
=
data
.
ngrams
[
i
]
;
var
orig_id
=
le_ngram
.
id
var
orig_id
=
le_ngram
.
id
var
arr_id
=
parseInt
(
i
)
var
arr_id
=
parseInt
(
i
)
RecDict
[
orig_id
]
=
arr_id
;
RecDict
[
orig_id
]
=
arr_id
;
...
@@ -914,9 +975,9 @@ function Main_test( data , initial , search_filter) {
...
@@ -914,9 +975,9 @@ function Main_test( data , initial , search_filter) {
"group_blocked"
:
false
,
"group_blocked"
:
false
,
"state"
:
(
le_ngram
.
state
)?
le_ngram
.
state
:
0
,
"state"
:
(
le_ngram
.
state
)?
le_ngram
.
state
:
0
,
// rl:
simple tests for new columns
// rl:
2 new columns showing 'state == map' and 'state == del'
"
add_to_map"
:
"hello"
,
"
will_be_map"
:
null
,
"
add_to_stop"
:
false
"
will_be_stop"
:
null
}
}
AjaxRecords
.
push
(
node_info
)
AjaxRecords
.
push
(
node_info
)
...
@@ -1040,7 +1101,7 @@ function Main_test( data , initial , search_filter) {
...
@@ -1040,7 +1101,7 @@ function Main_test( data , initial , search_filter) {
LineChart
.
filterAll
();
LineChart
.
filterAll
();
volumeChart
.
filterAll
();
volumeChart
.
filterAll
();
dc
.
redrawAll
();
dc
.
redrawAll
();
MyTable
=
[]
MyTable
=
[]
MyTable
=
$
(
'#my-ajax-table'
).
dynatable
({
MyTable
=
$
(
'#my-ajax-table'
).
dynatable
({
dataset
:
{
dataset
:
{
...
@@ -1055,17 +1116,7 @@ function Main_test( data , initial , search_filter) {
...
@@ -1055,17 +1116,7 @@ function Main_test( data , initial , search_filter) {
// _cellWriter: customCellWriter
// _cellWriter: customCellWriter
}
}
})
})
// .bind("dynatable:afterUpdate", function(e, rows) {
// $(e.target).children("tbody").children().each(function(i) {
// $(this).click(function(){
// var row_nodeid = $(this).data('stuff')
// var elem = { "id":row_nodeid , "checked":false }
// overRide(elem); //Select one row -> select one ngram
// });
// });
// });
// MyTable.data('dynatable').settings.dataset.records = []
// MyTable.data('dynatable').settings.dataset.records = []
// MyTable.data('dynatable').settings.dataset.originalRecords = []
// MyTable.data('dynatable').settings.dataset.originalRecords = []
// MyTable.data('dynatable').settings.dataset.originalRecords = AjaxRecords;
// MyTable.data('dynatable').settings.dataset.originalRecords = AjaxRecords;
...
@@ -1074,6 +1125,7 @@ function Main_test( data , initial , search_filter) {
...
@@ -1074,6 +1125,7 @@ function Main_test( data , initial , search_filter) {
MyTable
.
data
(
'dynatable'
).
sorts
.
add
(
'score'
,
0
)
// 1=ASCENDING,
MyTable
.
data
(
'dynatable'
).
sorts
.
add
(
'score'
,
0
)
// 1=ASCENDING,
MyTable
.
data
(
'dynatable'
).
process
();
MyTable
.
data
(
'dynatable'
).
process
();
MyTable
.
data
(
'dynatable'
).
paginationPage
.
set
(
1
);
MyTable
.
data
(
'dynatable'
).
paginationPage
.
set
(
1
);
MyTable
.
data
(
'dynatable'
).
paginationPerPage
.
set
(
20
);
// default:10
// MyTable.data('dynatable').process();
// MyTable.data('dynatable').process();
// MyTable.data('dynatable').sorts.clear();
// MyTable.data('dynatable').sorts.clear();
MyTable
.
data
(
'dynatable'
).
process
();
MyTable
.
data
(
'dynatable'
).
process
();
...
@@ -1087,18 +1139,7 @@ function Main_test( data , initial , search_filter) {
...
@@ -1087,18 +1139,7 @@ function Main_test( data , initial , search_filter) {
$
(
".dynatable-pagination-links"
).
insertAfter
(
".imadiv"
)
$
(
".dynatable-pagination-links"
).
insertAfter
(
".imadiv"
)
// Search
var
Div_PossibleActions
=
""
for
(
var
action
in
PossibleActions
)
{
var
a
=
PossibleActions
[
action
];
var
ischecked
=
(
Number
(
action
)
==
0
)?
"checked"
:
""
;
Div_PossibleActions
+=
'<input type="radio" id="radio'
+
action
+
'" name="radios" value="'
+
a
.
id
+
'" '
+
ischecked
+
'>'
;
Div_PossibleActions
+=
'<label style="color:'
+
a
.
color
+
';" for="radio'
+
action
+
'">'
+
a
.
name
+
'</label>'
;
}
var
Div_SelectAll
=
' <input type="checkbox" id="multiple_selection" onclick="SelectAll(this);" /> Select All'
$
(
".imadiv"
).
html
(
'<div style="float: left; text-align:left; input[type=radio] {display: none;}">'
+
Div_PossibleActions
+
Div_SelectAll
+
'</div><br>'
);
$
(
"#filter_search"
).
html
(
$
(
"#filter_search"
).
html
().
replace
(
'selected="selected"'
)
);
$
(
"#filter_search"
).
html
(
$
(
"#filter_search"
).
html
().
replace
(
'selected="selected"'
)
);
$
(
"#"
+
search_filter
).
attr
(
"selected"
,
"selected"
)
$
(
"#"
+
search_filter
).
attr
(
"selected"
,
"selected"
)
var
the_content
=
$
(
"#filter_search"
).
html
();
var
the_content
=
$
(
"#filter_search"
).
html
();
...
@@ -1108,8 +1149,6 @@ function Main_test( data , initial , search_filter) {
...
@@ -1108,8 +1149,6 @@ function Main_test( data , initial , search_filter) {
function
SearchFilters
(
elem
)
{
function
SearchFilters
(
elem
)
{
// rl dbg
console
.
log
(
"
\n
FUN SearchFilters()"
)
var
MODE
=
elem
.
value
;
var
MODE
=
elem
.
value
;
if
(
MODE
==
"filter_all"
)
{
if
(
MODE
==
"filter_all"
)
{
...
@@ -1143,6 +1182,7 @@ function SearchFilters( elem ) {
...
@@ -1143,6 +1182,7 @@ function SearchFilters( elem ) {
// MyTable.data('dynatable').sorts.add('score', 0) // 1=ASCENDING,
// MyTable.data('dynatable').sorts.add('score', 0) // 1=ASCENDING,
// MyTable.data('dynatable').process();
// MyTable.data('dynatable').process();
}
}
if
(
MODE
==
"filter_stop-list"
)
{
if
(
MODE
==
"filter_stop-list"
)
{
console
.
log
(
NGrams
[
"stop"
]
)
console
.
log
(
NGrams
[
"stop"
]
)
...
@@ -1152,9 +1192,13 @@ function SearchFilters( elem ) {
...
@@ -1152,9 +1192,13 @@ function SearchFilters( elem ) {
"scores"
:
$
.
extend
({},
NGrams
[
"main"
].
scores
)
"scores"
:
$
.
extend
({},
NGrams
[
"main"
].
scores
)
}
}
for
(
var
r
in
NGrams
[
"stop"
])
{
for
(
var
r
in
NGrams
[
"stop"
])
{
var
a_ngram
=
NGrams
[
"stop"
][
r
]
var
a_ngram
=
NGrams
[
"stop"
][
r
]
;
a_ngram
[
"state"
]
=
System
[
0
][
"statesD"
][
"delete"
]
// deletestateId = 2
var
deletestateId
=
System
[
0
][
"statesD"
][
"delete"
]
;
a_ngram
[
"state"
]
=
deletestateId
;
sub_ngrams_data
[
"ngrams"
].
push
(
a_ngram
)
sub_ngrams_data
[
"ngrams"
].
push
(
a_ngram
)
}
}
var
result
=
Main_test
(
sub_ngrams_data
,
NGrams
[
"main"
].
scores
.
initial
,
MODE
)
var
result
=
Main_test
(
sub_ngrams_data
,
NGrams
[
"main"
].
scores
.
initial
,
MODE
)
console
.
log
(
result
)
console
.
log
(
result
)
...
@@ -1164,8 +1208,6 @@ function SearchFilters( elem ) {
...
@@ -1164,8 +1208,6 @@ function SearchFilters( elem ) {
}
}
function
getIDFromURL
(
item
)
{
function
getIDFromURL
(
item
)
{
// rl dbg
console
.
log
(
"
\n
FUN getIDFromURL()"
)
var
pageurl
=
window
.
location
.
href
.
split
(
"/"
)
var
pageurl
=
window
.
location
.
href
.
split
(
"/"
)
var
cid
;
var
cid
;
for
(
var
i
in
pageurl
)
{
for
(
var
i
in
pageurl
)
{
...
@@ -1179,8 +1221,6 @@ function getIDFromURL( item ) {
...
@@ -1179,8 +1221,6 @@ function getIDFromURL( item ) {
// For lists, only GET requests
// For lists, only GET requests
function
GET_
(
url
,
callback
)
{
function
GET_
(
url
,
callback
)
{
// rl dbg
console
.
log
(
"
\n
FUN GET_("
+
url
+
")"
)
$
.
ajax
({
$
.
ajax
({
type
:
"GET"
,
type
:
"GET"
,
url
:
url
,
url
:
url
,
...
@@ -1276,8 +1316,8 @@ GET_( url[0] , function(result) {
...
@@ -1276,8 +1316,8 @@ GET_( url[0] , function(result) {
function
AfterAjax
()
{
function
AfterAjax
()
{
//
rl db
g
//
debu
g
console
.
log
(
"
\n
FUN AfterAjax()"
)
//
console.log("\nFUN AfterAjax()")
// // Deleting subforms from the ngrams-table, clean start baby!
// // Deleting subforms from the ngrams-table, clean start baby!
if
(
Object
.
keys
(
NGrams
[
"group"
].
links
).
length
>
0
)
{
if
(
Object
.
keys
(
NGrams
[
"group"
].
links
).
length
>
0
)
{
...
@@ -1300,11 +1340,16 @@ function AfterAjax() {
...
@@ -1300,11 +1340,16 @@ function AfterAjax() {
}
}
NGrams
[
"main"
].
ngrams
=
ngrams_data_
;
NGrams
[
"main"
].
ngrams
=
ngrams_data_
;
}
}
// initialize state of maplist items
if
(
Object
.
keys
(
NGrams
[
"map"
]).
length
>
0
)
{
if
(
Object
.
keys
(
NGrams
[
"map"
]).
length
>
0
)
{
for
(
var
i
in
NGrams
[
"main"
].
ngrams
)
{
for
(
var
i
in
NGrams
[
"main"
].
ngrams
)
{
if
(
NGrams
[
"map"
][
NGrams
[
"main"
].
ngrams
[
i
].
id
])
{
myMiamNgram
=
NGrams
[
"main"
].
ngrams
[
i
]
NGrams
[
"main"
].
ngrams
[
i
][
"state"
]
=
System
[
0
][
"statesD"
][
"keep"
]
if
(
NGrams
[
"map"
][
myMiamNgram
.
id
])
{
// keepstateId = 1
keepstateId
=
System
[
0
][
"statesD"
][
"keep"
]
myMiamNgram
[
"state"
]
=
keepstateId
;
}
}
}
}
}
}
...
...
templates/corpus/terms.html
View file @
72e104ea
...
@@ -25,13 +25,34 @@
...
@@ -25,13 +25,34 @@
-o-transition
:
height
0.1s
;
-o-transition
:
height
0.1s
;
transition
:
height
0.1s
;
transition
:
height
0.1s
;
}
}
th
{
color
:
#fff
;
}
th
{
color
:
#fff
;
font-weight
:
normal
;
font-size
:
0.9em
;
vertical-align
:
top
;
}
/* specific selector to override equally specific bootstrap.css */
.table
>
thead
>
tr
>
th
{
vertical-align
:
top
;
}
th
a
{
th
a
{
color
:
#fff
;
color
:
#fff
;
font-weight
:
normal
;
font-style
:
italic
;
font-style
:
italic
;
font-size
:
0.9em
;
}
th
p
.note
{
color
:
#ccc
;
font-size
:
0.6em
;
margin
:
1em
0
0
0
;
}
th
p
.note
>
input
{
float
:
left
;
margin
:
0
.2em
0
0
;
}
th
p
.note
>
label
{
float
:
left
;
}
}
tr
:hover
{
tr
:hover
{
...
@@ -171,7 +192,7 @@ input[type=radio]:checked + label {
...
@@ -171,7 +192,7 @@ input[type=radio]:checked + label {
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<h4
class=
"panel-title"
>
<h4
class=
"panel-title"
>
<a
data-toggle=
"collapse"
data-parent=
"#accordion"
href=
"#collapseOne"
>
<a
data-toggle=
"collapse"
data-parent=
"#accordion"
href=
"#collapseOne"
>
<p
id=
"corpusdisplayer"
onclick=
'Final_UpdateTable("click")'
class=
"btn btn-primary btn-lg"
style=
"width:200px; margin:0 auto; display:block;"
>
Open Folder
</h2></p>
<p
id=
"corpusdisplayer"
onclick=
'Final_UpdateTable("click")'
class=
"btn btn-primary btn-lg"
style=
"width:200px; margin:0 auto; display:block;"
>
Close Term List
</h2></p>
</a>
</a>
</h4>
</h4>
</div>
</div>
...
@@ -247,66 +268,6 @@ input[type=radio]:checked + label {
...
@@ -247,66 +268,6 @@ input[type=radio]:checked + label {
</div>
</div>
<div
id=
"pre_savechanges"
class=
"modal fade"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h3
class=
"modal-title"
>
Do you want to apply these to the whole Project as well?:
</h3>
</div>
<div
class=
"modal-body"
>
<div
id=
"stoplist_content"
>
</div>
<!--
<ul class="nav nav-tabs">
<li class="active"><a id="stoplist" href="#stoplist_content">Stop List</a></li>
<li><a id="maplist" href="#maplist_content">Map List</a></li>
<li><a id="grouplist" href="#grouplist_content">Group List</a></li>
</ul>
<div class="tab-content">
<div id="stoplist_content" class="tab-pane fade in active">
<ul>
<li>jiji01</li>
<li>jiji02</li>
<li>jiji03</li>
</ul>
</div>
<div id="maplist_content" class="tab-pane fade">
qowieuoqiwueowq
</div>
<div id="grouplist_content" class="tab-pane fade">
asdhasjkdhasjdh
</div>
</div>
-->
<div
class=
"modal-footer"
>
<button
onclick=
"SaveGlobalChanges(false)"
id=
"nope"
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
No
</button>
<button
onclick=
"SaveGlobalChanges(true)"
id=
"yep"
type=
"button"
class=
"btn btn-primary"
>
Yes
</button>
</div>
</div>
</div>
</div>
</div>
<div
id=
"filter_search"
style=
"visibility:hidden"
>
<div
id=
"filter_search"
style=
"visibility:hidden"
>
<select
id=
"example-single-optgroups"
onchange=
"SearchFilters(this);"
>
<select
id=
"example-single-optgroups"
onchange=
"SearchFilters(this);"
>
...
...
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