Hi,
I'd like to pass the selected images' IDs from Basket in OMERO.web to my app as input arguments.
Could you tell me which file I should look at as an example?
Best,
BK
<input class="button" type="image" src="{% url webstatic "images/folder_html16.png" %}" alt="New share" title="New share" onclick="makeShare();">
function makeShare() {
if (!isCheckedById("image")) {
alert ("Please select at least one image. Currently you cannot add other objects to basket.");
} else {
var productArray = $("input[type='checkbox']:checked");
var productListQuery = "";
if (productArray.length > 0 ) {
productArray.each(function() {
if(this.checked) {
productListQuery += "&"+this.name+"="+this.id;
}
});
} else {
productListQuery += "&"+productArray.name+"="+productArray.id;
}
}
src = '/webclient/basket/toshare/?'+productListQuery+'';
loadMetadata(src); //loads right hand panel
return false;
}
omeroweb/webclient/urls.py
url( r'^basket/(?:(?P<action>[a-zA-Z]+)/)?$', views.basket_action, name="basket_action"),
webclient/basket/basket.html
{% for c in basket.imageInBasket %}
<tr id="{{ c.id }}">
<td class="action">
<img src="{% url render_thumbnail_resize 32 c.id %}" alt="image" title="{{ c.name }}"/>
<input type="checkbox" name="image" id="{{ c.id }}" class="hide">
</td>
<td class="desc">{{ c.name|truncatebefor:"65" }} {% if c.annotation_counter %}<img src="{% url webstatic "images/knotes16.png" %}" alt="a" title="annotation"/>{% endif %}{% if not c.isOwned %} <img src="{% url webstatic "images/kgpg12.png" %}" alt="l" title="locked"/>{% endif %}</td>
<td class="roles">{{ c.getDate }}</td>
</tr>
{% endfor %}
<a href="/myApp/selected_images/?iIds={% for c in basket.imageInBasket %}{{ c.id }}{% if not forloop.last %},{% endif %}{% endfor %}">My App Link</a>
/myApp/selected_images/?iIds=2305,2306,2307
iIds = request.REQUEST.get('iIds', None)
if iIds:
imageIds = iIds.split(",")
... etc.
$("div#tree_details").load("{% url load_data %}?view=tree", function () {
simpleTreeCollection = $('.simpleTree').simpleTree({
autoclose: false,
afterRootClick:function(node){
...
},
afterClick:function(node){
if($(node).attr('id') == "orphaned") {
...
} else {
var obj = $(node).attr('id').split("-");
var par = $(node).parents('li:first').attr('id')
if (obj[0] == 'pr') {
...
} else if (obj[0] == 'ds') {
//obj[1] - dataset id, pass it here to your app
}
}
},...
Return to Developer Discussion
Users browsing this forum: No registered users and 1 guest