Skip to content

Commit

Permalink
Merge pull request #901 from will-moore/group_view_10243
Browse files Browse the repository at this point in the history
Group view 10243
  • Loading branch information
joshmoore committed Mar 22, 2013
2 parents f847141 + 539b25d commit e8cc8ef
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 85 deletions.
8 changes: 3 additions & 5 deletions components/tools/OmeroPy/src/omero/gateway/__init__.py
Expand Up @@ -478,12 +478,10 @@ def canLink(self):
"""
Determines whether user can create 'hard' links (Not annotation links).
E.g. Between Project/Dataset/Image etc.
We have decided to restrict the clients to only allow the OWNER of data
to create these links.
The server is more permissive. To see what the server will allow,
use self.getDetails().getPermissions().canLink()
Previously (4.4.6 and earlier) we only allowed this for object owners, but now we delegate
to what the server will allow.
"""
return self.isOwned()
return self.getDetails().getPermissions().canLink()

def canAnnotate(self):
"""
Expand Down
Expand Up @@ -253,10 +253,12 @@ def channelMetadata(self):

def loadTags(self, eid=None):
if eid is not None:
self.experimenter = self.conn.getObject("Experimenter", eid)
if eid == -1: # Load data for all users
eid = None
else:
self.experimenter = self.conn.getObject("Experimenter", eid)
else:
eid = self.conn.getEventContext().userId

self.tags = list(self.conn.listTags(eid))
self.t_size = len(self.tags)

Expand All @@ -281,7 +283,10 @@ def loadDataByTag(self):

def listImagesInDataset(self, did, eid=None, page=None, load_pixels=False):
if eid is not None:
self.experimenter = self.conn.getObject("Experimenter", eid)
if eid == -1: # Load data for all users
eid = None
else:
self.experimenter = self.conn.getObject("Experimenter", eid)
im_list = list(self.conn.listImagesInDataset(oid=did, eid=eid, page=page, load_pixels=load_pixels))
im_list.sort(key=lambda x: x.getName().lower())
self.containers = {'images': im_list}
Expand All @@ -292,10 +297,12 @@ def listImagesInDataset(self, did, eid=None, page=None, load_pixels=False):

def listContainerHierarchy(self, eid=None):
if eid is not None:
self.experimenter = self.conn.getObject("Experimenter", eid)
if eid == -1:
eid = None
else:
self.experimenter = self.conn.getObject("Experimenter", eid)
else:
eid = self.conn.getEventContext().userId

pr_list = list(self.conn.listProjects(eid))
ds_list = list(self.conn.listOrphans("Dataset", eid))
sc_list = list(self.conn.listScreens(eid))
Expand All @@ -313,7 +320,10 @@ def listContainerHierarchy(self, eid=None):

def listOrphanedImages(self, eid=None, page=None):
if eid is not None:
self.experimenter = self.conn.getObject("Experimenter", eid)
if eid == -1:
eid = None
else:
self.experimenter = self.conn.getObject("Experimenter", eid)
else:
eid = self.conn.getEventContext().userId

Expand Down Expand Up @@ -946,13 +956,10 @@ def move(self, parent, destination):
if parent[0] != destination[0]:
up_spl = None
spls = list(self.plate.getParentLinks()) #gets every links for child
if len(spls) == 1:
# gets old parent to delete
if spls[0].parent.id.val == long(parent[1]):
up_spl = spls[0]
self.conn.deleteObjectDirect(up_spl._obj)
else:
return 'This plate is linked in multiple places. Please unlink the plate first.'
for spl in spls:
if spl.parent.id.val == long(parent[1]):
self.conn.deleteObjectDirect(spl._obj)
break
else:
return 'Destination not supported.'
else:
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -160,19 +160,19 @@
$("#comments_container").on("click", ".removeComment", function(event){
var url = $(this).attr('url');
OME.removeItem(event, ".ann_comment_wrapper",
url, $.trim($("#object-id").text()), {{ index }});
url, $.trim($("#object-id").text()), {{ index|default:"0" }});
return false;
});
$("#tags_container").on("click", ".removeTag", function(event){
var url = $(this).attr('url');
OME.removeItem(event, ".tag_annotation_wrapper", url,
$.trim($("#object-id").text()), {{ index }});
$.trim($("#object-id").text()), {{ index|default:"0" }});
return false;
});
$("#fileanns_container").on("click", ".removeFile", function(event) {
var url = $(this).attr('href');
OME.removeItem(event, ".file_ann_wrapper", url,
$.trim($("#object-id").text()), {{ index }});
$.trim($("#object-id").text()), {{ index|default:"0" }});
return false;
});
Expand Down
Expand Up @@ -130,6 +130,16 @@
{{ grp.getName }}
</a>
<ul title="Switch to this Group and User">
<li>
{% ifequal grp.id active_group.id %}
<a href="{{ current_url }}?experimenter=-1">
<!-- otherwise we switch group too -->
{% else %}
<a href="{% url change_active_group %}?active_group={{grp.id}}&url={{ current_url }}?experimenter=-1">
{% endifequal %}
All members
</a>
</li>
{% if grp.leaders %}
<li class="non_selectable"><strong>Owners</strong></li>
{% for user in grp.leaders %}
Expand Down
Expand Up @@ -24,15 +24,25 @@
{% if manager.containers.orphaned %}
{% if manager.containers.images %}
{% for d in manager.containers.images %}
<li id='image-{{ d.id }}' rel="image{% if not d.canEdit %}-locked{% endif %}" class="{{ d.getPermsCss }}"><a href="#">{{ d.name|default:"Image"|truncatebefor:"30" }}</a>
<li id='image-{{ d.id }}' rel="image{% if not d.isOwned %}-locked{% endif %}" class="{{ d.getPermsCss }}"><a href="#">{{ d.name|default:"Image"|truncatebefor:"30" }}</a>
</li>
{% endfor %}
{% endif %}
{% else %}
{% if manager.containers.images %}
{% for d in manager.containers.images %}
<li id='image-{{ d.id }}' rel="image{% if not d.canEdit %}-locked{% endif %}" class="{{ d.getPermsCss }}"><a href="#">{{ d.name|default:"Image"|truncatebefor:"30" }}</a>
<li id='image-{{ d.id }}' rel="image{% if not d.isOwned %}-locked{% endif %}" class="{{ d.getPermsCss }}"><a href="#">{{ d.name|default:"Image"|truncatebefor:"30" }}</a>
</li>
{% endfor %}
{% endif %}
{% endif %}

{% if manager.plate %}
{% if manager.plate.countPlateAcquisitions %}
{% for e in manager.plate.listPlateAcquisitions %}
<li id='acquisition-{{ e.id }}' rel="acquisition{% if not e.isOwned %}-locked{% endif %}" class="{{ e.getPermsCss }}">
<a href="#">{{ e.name|default:"Run"|truncatebefor:"35" }}</a>
</li>
{% endfor %}
{% endif %}
{% endif %}
Expand Up @@ -26,18 +26,18 @@
{% if manager.c_size > 0 %}

{% for i in manager.containers.images %}
<li id='image-{{ i.id }}' rel="image{% if not i.canEdit %}-locked{% endif %}" class="{{ i.getPermsCss }}">
<li id='image-{{ i.id }}' rel="image{% if not i.isOwned %}-locked{% endif %}" class="{{ i.getPermsCss }}">
<a href="#">{{ i.name|truncatebefor:"30" }}</a>
</li>
{% endfor %}

{% for c in manager.containers.projects %}
<li id='project-{{ c.id }}' rel="project{% if not c.canEdit %}-locked{% endif %}" class="{{ c.getPermsCss }}">
<li id='project-{{ c.id }}' rel="project{% if not c.isOwned %}-locked{% endif %}" class="{{ c.getPermsCss }}">
<a href="#">{{ c.name|truncatebefor:"35" }}</a>
<ul>
{% if c.countChildren %}
{% for d in c.listChildren %}
<li id='dataset-{{ d.id }}' rel="dataset{% if not d.canEdit %}-locked{% endif %}" class="{{ c.getPermsCss }}{% if d.countChildren %} jstree-closed{% endif %}">
<li id='dataset-{{ d.id }}' rel="dataset{% if not d.isOwned %}-locked{% endif %}" class="{{ c.getPermsCss }}{% if d.countChildren %} jstree-closed{% endif %}">
<a href="#">{{ d.name|truncatebefor:"35" }}</a>
</li>
{% endfor %}
Expand All @@ -47,18 +47,18 @@
{% endfor %}

{% for d in manager.containers.datasets %}
<li id='dataset-{{ d.id }}' rel="dataset{% if not d.canEdit %}-locked{% endif %}" class="{{ c.getPermsCss }}{% if d.countChildren %} jstree-closed{% endif %}">
<li id='dataset-{{ d.id }}' rel="dataset{% if not d.isOwned %}-locked{% endif %}" class="{{ c.getPermsCss }}{% if d.countChildren %} jstree-closed{% endif %}">
<a href="#">{{ d.name|truncatebefor:"35" }}</a>
</li>
{% endfor %}

{% for c in manager.containers.screens %}
<li id='screen-{{ c.id }}' rel="screen{% if not c.canEdit %}-locked{% endif %}" class="{{ c.getPermsCss }}">
<li id='screen-{{ c.id }}' rel="screen{% if not c.isOwned %}-locked{% endif %}" class="{{ c.getPermsCss }}">
<a href="#">{{ c.name|truncatebefor:"35" }}</a>
<ul>
{% if c.countChildren %}
{% for d in c.listChildren %}
<li id='plate-{{ d.id }}' rel="plate{% if not d.canEdit %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<li id='plate-{{ d.id }}' rel="plate{% if not d.isOwned %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<a href="#">{{ d.name|truncatebefor:"35" }}</a>
</li>
{% endfor %}
Expand All @@ -68,12 +68,12 @@
{% endfor %}

{% for d in manager.containers.plates %}
<li id='plate-{{ d.id }}' rel="plate{% if not d.canEdit %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<li id='plate-{{ d.id }}' rel="plate{% if not d.isOwned %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<a href="#">{{ d.name|truncatebefor:"35" }}</a>
{% if d.countPlateAcquisitions %}
<ul>
{% for e in d.listPlateAcquisitions %}
<li id='acquisition-{{ e.id }}' rel="acquisition{% if not e.canEdit %}-locked{% endif %}" class="{{ e.getPermsCss }}">
<li id='acquisition-{{ e.id }}' rel="acquisition{% if not e.isOwned %}-locked{% endif %}" class="{{ e.getPermsCss }}">
<a href="#">{{ e.name|truncatebefor:"35" }}</a>
</li>
{% endfor %}
Expand All @@ -83,7 +83,7 @@
{% endfor %}

{% for a in manager.containers.aquisitions %}
<li id='acquisition-{{ a.id }}' rel="acquisition{% if not a.canEdit %}-locked{% endif %}" class="{{ a.getPermsCss }}">
<li id='acquisition-{{ a.id }}' rel="acquisition{% if not a.isOwned %}-locked{% endif %}" class="{{ a.getPermsCss }}">
<a href="#">{{ a.name|truncatebefor:"35" }}</a>
</li>
{% endfor %}
Expand Down
Expand Up @@ -24,7 +24,7 @@

{% if manager.containers.images %}
{% for d in manager.containers.images %}
<li id='image-{{ d.id }}' rel="image{% if not d.canEdit %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<li id='image-{{ d.id }}' rel="image{% if not d.isOwned %}-locked{% endif %}" class="{{ d.getPermsCss }}">
<a href="#">{{ d.name|truncatebefor:"30" }}</a>
</li>
{% endfor %}
Expand Down
Expand Up @@ -22,22 +22,22 @@
{% endcomment %}

<ul>
<li id="experimenter-0" rel="experimenter"><a href="#">{% if manager.experimenter %}{{ manager.experimenter.getFullName }}{% else %}{{ ome.user.getFullName }}{% endif %}</a>
<li id="experimenter-0" rel="experimenter"><a href="#">{% if manager.experimenter %}{{ manager.experimenter.getFullName }}{% else %}All Members{% endif %}</a>
{% if manager.t_size %}
<ul>
{% for t in manager.tags %}
{% if t.ns %}
<li id='tagset-{{ t.id }}' rel="tagset{% if not t.canEdit %}-locked{% endif %}" {% if t.countTagsInTagset %}class="jstree-closed"{% endif %}><a href="#">{{ t.textValue|truncatebefor:"35" }}</a>
<li id='tagset-{{ t.id }}' rel="tagset{% if not t.isOwned %}-locked{% endif %}" {% if t.countTagsInTagset %}class="jstree-closed"{% endif %}><a href="#">{{ t.textValue|truncatebefor:"35" }}</a>
{% if t.countTagsInTagset %}
<ul>
{% for d in t.listTagsInTagset %}
<li id='tag-{{ d.id }}' rel="tag{% if not d.canEdit %}-locked{% endif %}" class="jstree-closed"><a href="#">{{ d.textValue|truncatebefor:"35" }}</a></li>
<li id='tag-{{ d.id }}' rel="tag{% if not d.isOwned %}-locked{% endif %}" class="jstree-closed"><a href="#">{{ d.textValue|truncatebefor:"35" }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% else %}
<li id='tag-{{ t.id }}' rel="tag{% if not t.canEdit %}-locked{% endif %}" class="jstree-closed"><a href="#">{{ t.textValue|truncatebefor:"35" }}</a></li>
<li id='tag-{{ t.id }}' rel="tag{% if not t.isOwned %}-locked{% endif %}" class="jstree-closed"><a href="#">{{ t.textValue|truncatebefor:"35" }}</a></li>
{% endif %}
{% endfor %}
</ul>
Expand Down

0 comments on commit e8cc8ef

Please sign in to comment.