Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (salsah): Create multiple links in a resource, and other bug fixes #315

Merged
merged 4 commits into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions salsah/src/public/js/jquery.editvalue.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
var drop_btn = $('<span>').addClass('glyphicon glyphicon-minus').attr({title: strings._remove});
var rights_btn = $('<span>').addClass('glyphicon glyphicon-lock').attr({title: strings._rights});
var comment_btn = $('<span>').addClass('glyphicon glyphicon-comment').attr({title: strings._annotate});
var valinfo_btn = $('<span>').addClass('glyphicon glyphicon-info-sign').attr({title: strings._valinfo});

var set_button = function(btn_ele, type) {
switch (type) {
Expand Down
12 changes: 11 additions & 1 deletion salsah/src/public/js/jquery.propedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
var comment_icon = new Image();
comment_icon.src = SITE_URL + '/app/icons/16x16/comment.png';

var valueinfo_icon = new Image();
valueinfo_icon.src = SITE_URL + '/app/icons/16x16/info.png';


$.fn.propedit = function(resdata, propinfo, project_id, optpar) {
var $that = this;

Expand Down Expand Up @@ -215,6 +219,12 @@
}
}
}

if (prop != '__label__') {
$('<img>', {src: valueinfo_icon.src, 'class': 'propedit'}).on('mouseover', function(event) {
load_value_infowin(event, propinfo[prop].value_ids[value_index], this);
}).css({cursor: 'pointer'}).appendTo(value_container);
}
};

var make_add_button = function (prop_container, prop) {
Expand Down Expand Up @@ -1759,7 +1769,7 @@
tmpele.spinbox('edit');
}
else {
tmpele.spinbox('edit', propinfo[prop].values[value_index]);
tmpele.spinbox('edit', {value: propinfo[prop].values[value_index]});
}
value_container.append($('<img>', {src: save_icon.src, title: strings._save, 'class': 'propedit'}).click(function(event) {
postdata[propinfo[prop].valuetype_id](value_container, prop, value_index, tmpele.spinbox('value'), is_new_value);
Expand Down
37 changes: 19 additions & 18 deletions salsah/src/public/js/jquery.resadd.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@
}
};

var create_entry = function(propname, create_tag) {
var create_entry = function(propname, pinfo, create_tag) {
var add_symbol;

prop_status[propname].td.append($('<span>').addClass('entrySep').html('&nbsp'));
create_tag(prop_status[propname].td, attributes);
create_tag(prop_status[propname].td, attributes, pinfo);
prop_status[propname].count = 1;

if (prop_status[propname].occurrence != '1') {
Expand All @@ -183,7 +183,8 @@
'name': propname
}, function(event) {
// $(this).before(create_tag(prop_status[event.data.name].td, prop_status[event.data.name].attributes));
create_tag(prop_status[event.data.name].td, prop_status[event.data.name].attributes);

create_tag(prop_status[event.data.name].td, prop_status[event.data.name].attributes, pinfo);
prop_status[event.data.name].count++;
if (((prop_status[event.data.name].count == 1) &&
((prop_status[event.data.name].occurrence == '0-n') || (prop_status[event.data.name].occurrence == '0-1'))) ||
Expand Down Expand Up @@ -371,7 +372,7 @@
case 'text':
{
attributes.type = 'text';
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var tmpele = $('<input>', attr).css({
width: '85%'
}).dragndrop('makeDropable', function(event, dropdata) {
Expand All @@ -388,7 +389,7 @@
}
case 'textarea':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var tmpele = $('<textarea>', attr).css({
width: '85%'
}).dragndrop('makeDropable', function(event, dropdata) {
Expand All @@ -402,7 +403,7 @@
}
case 'richtext':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {

//console.log('resadd');
//console.log(attr);
Expand Down Expand Up @@ -451,7 +452,7 @@
selection_id = attr[1].replace("<", "").replace(">", ""); // remove brackets from Iri to make it a valid URL
}
});
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var selbox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
selbox.selection('edit', {
selection_id: selection_id
Expand All @@ -471,7 +472,7 @@
selection_id = attr[1].replace("<", "").replace(">", ""); // remove brackets from Iri to make it a valid URL
}
});
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var radiobox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
radiobox.selradio('edit', {
selection_id: selection_id
Expand All @@ -482,7 +483,7 @@
}
case 'checkbox':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var checkbox = $('<input>', {
type: "checkbox"
});
Expand All @@ -496,7 +497,7 @@
}
case 'spinbox':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pfino) {
var spinbox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
spinbox.spinbox('edit');
});
Expand All @@ -506,7 +507,7 @@
case 'searchbox':
{
attributes.type = 'text';
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var tmpele = $('<input>', attr).addClass('__searchbox').insertBefore(ele.find('.entrySep'));

var restype_id = -1;
Expand Down Expand Up @@ -561,7 +562,7 @@
}
case 'date':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var datebox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
datebox.dateobj('edit');
return datebox;
Expand All @@ -571,7 +572,7 @@
}
case 'time':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var timebox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
timebox.timeobj('edit');
if ((localdata.settings.defaultvalues !== undefined) && (localdata.settings.defaultvalues[propname])) {
Expand All @@ -584,7 +585,7 @@
}
case 'interval':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var timebox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
timebox.timeobj('edit', {
show_duration: true
Expand All @@ -609,7 +610,7 @@
}
case 'fileupload':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var tmpele = $('<span>', attributes).insertBefore(ele.find('.entrySep'));
tmpele.location('edit');
return tmpele;
Expand All @@ -619,7 +620,7 @@
}
case 'colorpicker':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var colbox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
if (rtinfo.name == 'http://www.knora.org/ontology/knora-base#Region') {
colbox.colorpicker('edit', {
Expand Down Expand Up @@ -654,7 +655,7 @@
hlist_id = attr[1].replace("<", "").replace(">", ""); // remove brackets from Iri to make it a valid URL
}
});
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var hlistbox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
hlistbox.hlist('edit', {
hlist_id: hlist_id
Expand All @@ -667,7 +668,7 @@

case 'geoname':
{
create_entry(propname, function(ele, attr) {
create_entry(propname, pinfo, function(ele, attr, pinfo) {
var geonamebox = $('<span>', attr).insertBefore(ele.find('.entrySep'));
geonamebox.geonames('edit', {
new_entry_allowed: true
Expand Down
112 changes: 80 additions & 32 deletions salsah/src/public/js/load_infowin.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,51 +107,99 @@ var load_infowin = function(event, res_id, obj) {
});
};

/*
$.__post(SITE_URL + '/ajax/get_properties.php', {res_id: res_id, type: 'html', noresedit: true, origin: origin}, function(data) {
if (typeof data == 'object') {
alert(data.MSG);
}
}


var load_value_infowin = function(event, val_id, obj) {
if (the_infowin_pending) return;

// window.status = 'load_infowin (' + event.pageX + ', ' + event.pageY + ') ' + the_infowin_pending;

var position_it = function(event) {
var xpos = event.pageX;
var ypos = event.pageY;
var win_w = $('body').width();
var win_h = $('body').height();
var w, h;
if (the_infowin === undefined) {
w = 200;
h = 50;
}
else {
w = the_infowin.outerWidth(true);
h = the_infowin.outerHeight(true);
}
if ((xpos + 20 + w) > win_w) {
xpos = xpos - w - 20;
}
else {
xpos += 20;
}
if ((ypos + 10 + h) > win_h) ypos = win_h - 10 - h;
ypos += 10;
return {x: xpos, y: ypos};
}


if (the_infowin === undefined) {
the_infowin_pending = true;


SALSAH.ApiGet('values/' + encodeURIComponent(val_id), function(data) {
if (data.status == ApiErrors.OK) {
window.status = 'GET...';

var pos = position_it(event);
the_infowin = $('<div>').addClass('searchinfowin').css({
position: 'absolute',
minHeight: '50px',
maxHeight: '600px',
minWidth: '200px',
maxWidth: '400px',
overflow: 'hidden',
left: pos.x,
top: pos.y,
zIndex: 200
}).on('mousemove', function(event) {
event.stopImmediatePropagation();
position_it(event);
}).html('<p>' + strings._owner + ': ' + data.valuecreatorname + '<br/>' + strings._creation_date + ': ' + data.valuecreationdate + '</p>').on('mousemove', function(event) {
var pos = position_it(event);
the_infowin.css({
left: pos.x,
top: pos.y
});
}).appendTo($('body'));
}
the_infowin.html(data);
position_it(event);

$(obj).on('mousemove', function(event) {
event.stopImmediatePropagation();
position_it(event);
});
pos = position_it(event);
the_infowin.css({
left: pos.x,
top: pos.y
});

$(obj).on('mouseout', function(event) {
the_infowin.remove();
the_infowin = undefined;
$(this).off('mousemove');
$(this).off('mouseout');
$(document).off('mousemove');
});
$(obj).on('mousemove', function(event) {
event.stopImmediatePropagation();
event.preventDefault();
var pos = position_it(event);
the_infowin.css({
left: pos.x,
top: pos.y
});
});

$(document).on('mousemove', function(event){
if (the_infowin !== undefined) {
the_infowin.remove();
the_infowin = undefined;
$(document).off('mousemove');
$(obj).off('mousemove');
the_infowin_pending = false;
}
});

$(document).on('mousemove', function(event){
if (the_infowin !== undefined) {
the_infowin.remove();
the_infowin = undefined;
$(document).off('mousemove');
$(this).off('mousemove');
$(this).off('mouseout');
the_infowin_pending = false;

}
else {
alert(data.errormsg);
}
});

});
*/
}
}
5 changes: 3 additions & 2 deletions salsah/src/public/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"_select_all" : "Alle auswählen",
"_deselect_all" : "Alle abwählen",
"_alert_missing_restype" : "Bitte einen Resource-Typen wählen",
"_alert_missing_resprop" : "Bitte mindestens ein Merkmalfeld (zur Spaltenansicht) wählen."

"_alert_missing_resprop" : "Bitte mindestens ein Merkmalfeld (zur Spaltenansicht) wählen.",
"_valinfo" : "Informationen über den Wert",
"_creation_date": "Erstellungsdatum"
}
4 changes: 3 additions & 1 deletion salsah/src/public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,7 @@
"_alert_missing_restype" : "You have to choose a resource type!",
"_alert_missing_resprop" : "You have to choose at least one property!",
"_export" : "Export",
"_export_csv" : "Export the data as comma-separated values (csv)"
"_export_csv" : "Export the data as comma-separated values (csv)",
"_valinfo" : "Information about the value",
"_creation_date": "Creation date"
}
4 changes: 3 additions & 1 deletion salsah/src/public/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,7 @@
"_hlist_node_expl" : "Clickez sur %s en-dessous pour effacer le nœud, ou sur %s pour fermer la fenêtre sans effaces le nœud!",
"_salsah_help" : "SALSAH Aide",
"_limitsearch" : "Limiter la recherche sur",
"_langchangeq" : "Changer la langue de l'interface utilisateur ?"
"_langchangeq" : "Changer la langue de l'interface utilisateur ?",
"_valinfo" : "Information sur la valeur",
"_creation_date": "Date de création"
}
6 changes: 3 additions & 3 deletions salsah/src/public/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"_hlist_delete" : "Estinguere la gerarchia",
"_salsah_help" : "SALSAH Aiuto",
"_limitsearch" : "Restringere la ricerca a",
"_langchangeq" : "Cambiare la lingua dell'interfaccia utente ?"

"_langchangeq" : "Cambiare la lingua dell'interfaccia utente ?",
"_valinfo" : "Informazione sul valore",
"_creation_date": "Data di creazione"
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ class ResourceCreationSpec extends SalsahSpec {
{"path": "_test_data/demo_data/images-demo-data.ttl", "name": "http://www.knora.org/data/images"},
{"path": "_test_data/ontologies/beol-onto.ttl", "name": "http://www.knora.org/ontology/beol"},
{"path": "_test_data/ontologies/anything-onto.ttl", "name": "http://www.knora.org/ontology/anything"},
{"path": "_test_data/all_data/anything-data.ttl", "name": "http://www.knora.org/data/anything"}
{"path": "_test_data/all_data/anything-data.ttl", "name": "http://www.knora.org/data/anything"},
{"path": "_test_data/all_data/biblio-data.ttl", "name": "http://www.knora.org/data/biblio"},
{"path": "_test_data/ontologies/biblio-onto.ttl", "name": "http://www.knora.org/ontology/biblio"}
]
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class SearchAndEditSpec extends SalsahSpec {
{"path": "_test_data/demo_data/images-demo-data.ttl", "name": "http://www.knora.org/data/images"},
{"path": "_test_data/ontologies/beol-onto.ttl", "name": "http://www.knora.org/ontology/beol"},
{"path": "_test_data/ontologies/anything-onto.ttl", "name": "http://www.knora.org/ontology/anything"},
{"path": "_test_data/all_data/anything-data.ttl", "name": "http://www.knora.org/data/anything"}
{"path": "_test_data/all_data/anything-data.ttl", "name": "http://www.knora.org/data/anything"},
{"path": "_test_data/all_data/biblio-data.ttl", "name": "http://www.knora.org/data/biblio"},
{"path": "_test_data/ontologies/biblio-onto.ttl", "name": "http://www.knora.org/ontology/biblio"}
]
"""

Expand Down
Loading