Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
adding css and jobad services
Browse files Browse the repository at this point in the history
  • Loading branch information
jukowski committed Aug 16, 2013
1 parent 790a863 commit b84c869
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sites/all/modules/sally/jobad/fex_tooltip.js
@@ -0,0 +1,16 @@
(function($){JOBAD.modules.register({
info: {
'identifier': 'fex_tooltip',
'title': 'Testing tooltip',
'author': 'Alexandru Toader',
'description': 'Show text of fields that overflow ',
'hasCleanNamespace': false
},
hoverText: function(target){
if((target.is("span.title-dependency") || target.is("span.title-text") || target.is("div.cell-iterator") || target.is("div.cell-value"))
&& target[0].scrollWidth> target.width()){
return target.text();
}
},
});
})(JOBAD.refs.$);
49 changes: 49 additions & 0 deletions sites/all/modules/sally/jobad/navigate.js
@@ -0,0 +1,49 @@
(function($){
JOBAD.modules.register({
info: {
'identifier': 'navigate',
'title': 'Show dependency graph',
'author': 'Alexandru Toader',
'description': 'Show the dependency graph of the selected item',
'hasCleanNamespace': false
},
/**
@base_path base path for the planetary installation
@token string used to identify the workflow
@context Context message containing all the available cd/name pairs in the current document
*/
init: function (JOBADInstance, base_path, token, context) {
this.localStore.set("base_path", base_path);
this.localStore.set("token", token);
this.localStore.set("context", context);
},
contextMenuEntries: function (target) {
var message = this.localStore.get("context");
var base_path = this.localStore.get("base_path");
var token = this.localStore.get("token");
var i = 0;
while (true) {
if (typeof message.context[i] == 'undefined')
break;
if (target.is('span') && target.is('.omdoc-term') && target.attr('omdoc:cd') == message.context[i].theory && target.attr('omdoc:name') == message.context[i].symbol)
return [
["Show cell in spreadsheet",
function () {
if (Communication.isActive()) {
var token = this.localStore.get("token");
var term = new sally.OntologyItem;
term.theory = target.attr("omdoc:cd");
term.symbol = target.attr("omdoc:name");
var message = new sally.TheoNavigateTo;
message.term = term;
message.actionId = token;
Communication.sendMessage(message);
}
}
]];
i++;
}

},
});
})(JOBAD.refs.$);
40 changes: 40 additions & 0 deletions sites/all/modules/sally/jobad/opendef.js
@@ -0,0 +1,40 @@
(function($){
JOBAD.modules.register({
info: {
'identifier': 'opendef',
'title': 'Open definition',
'author': 'Alexandru Toader',
'description': 'Open the definition of the selected ontology item',
'hasCleanNamespace': false
},
/**
@base_path base path for the planetary installation
@token string used to identify the workflow
*/
init: function(JOBADInstance, base_path, token){
this.localStore.set("base_path", base_path);
this.localStore.set("token", token);
},
contextMenuEntries: function (target) {
var cd, symbol;
var token = this.localStore.get("token");
var base_path = this.localStore.get("base_path");
if (target.is('span')) {
cd = target.attr("omdoc:cd");
symbol = target.attr("omdoc:name");
} else if (target.is('div')) {
var aux = target.attr('id');
aux = aux.substring(aux.lastIndexOf("/") + 1);
cd = aux.substring(0, aux.indexOf(".omdoc"));
symbol = aux.substring(aux.indexOf("#") + 1, aux.lastIndexOf(".def"));
}
if ((target.is('.omdoc-term') || target.attr('class') == 'node') && typeof(token) != 'undefined')
return {
"Look-up definition": function(element) {
window.open(base_path + "index.php?q=sally/showdef/" + cd + "/" + symbol + "/" + token, "_parent");
}
}

},
});
})(JOBAD.refs.$);
45 changes: 45 additions & 0 deletions sites/all/modules/sally/jobad/searchGoogle.js
@@ -0,0 +1,45 @@
(function($){JOBAD.modules.register({
info: {
'identifier': 'searchGoogle',
'title': 'Search Google',
'author': 'Alexandru Toader',
'description': 'Search Google for selected text or for the title of a node. ',
'hasCleanNamespace': false
},
getSelectedText: function () {
var selectedText = (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text
);
if (!selectedText || selectedText == "") {

if (document.activeElement && document.activeElement.selectionStart) {
selectedText = document.activeElement.value.substring(document.activeElement.selectionStart.document.activeElement.selectionEnd);
}
}

return selectedText;
},

contextMenuEntries: function (target) {
var txt = this.getSelectedText().toString();
var text = "Search Google for ";
if (txt && txt.replace(/\s+/g, ' ') != '') {
text += '"' + txt.substring(0, 5) + ".." + '""';
return [
[text, function (element) {
window.open("http://www.google.com/search?q=" + txt, "_parent");
}]
];
} else if (target.attr('class') == 'node' && target.is('div')) {
console.log("here");
txt = target.text();
text += '"' + txt.substring(0, 5) + ".." + '""';
return [
[text, function (element) {
window.open("http://www.google.com/search?q=" + txt, "_parent");
}]
];
}

},
});
})(JOBAD.refs.$);
35 changes: 35 additions & 0 deletions sites/all/modules/sally/jobad/showGraph.js
@@ -0,0 +1,35 @@
(function($){JOBAD.modules.register({
info: {
'identifier': 'showGraph',
'title': 'Show dependency graph',
'author': 'Alexandru Toader',
'description': 'Show the dependency graph of the selected item',
'hasCleanNamespace': false
},
/**
@base_path base path for the planetary installation
@token string used to identify the workflow
*/
init: function(JOBADInstance, base_path, token){
this.localStore.set("base_path", base_path);
this.localStore.set("token", token);
},
contextMenuEntries: function (target) {
var cd, symbol;
var token = this.localStore.get("token");
var base_path = this.localStore.get("base_path");
if (target.is('span')) {
cd = target.attr("omdoc:cd");
symbol = target.attr("omdoc:name");
if (target.is('.omdoc-term') && typeof(token) != 'undefined')
return [
["Show dependency graph", function (element) {
window.open(base_path+"index.php?q=sally/semnav/" + cd + "/" + symbol + "/" + token, "_parent");
}]
];
}

},
});
})(JOBAD.refs.$);

11 changes: 11 additions & 0 deletions sites/all/modules/sally/sally.css
@@ -0,0 +1,11 @@
annotation-xml {
display:none;
}

span.omdoc-term {
color: blue;
}

mo {
display: none;
}

0 comments on commit b84c869

Please sign in to comment.