Permalink
Browse files

remove "Search Users" box

  • Loading branch information...
rmartinjak committed Mar 9, 2013
1 parent 714ac4f commit 597e8cbe57cbc44defc51857ca57e23c8f7f0c5f
Showing with 4 additions and 49 deletions.
  1. +1 −5 flask_version/worksheet.py
  2. +1 −32 sagenb/data/sage/html/notebook/worksheet_share.html
  3. +2 −12 sagenb/notebook/notebook.py
@@ -564,10 +564,6 @@ def worksheet_edit_published_page(worksheet):
def worksheet_share(worksheet):
return g.notebook.html_share(worksheet, g.username)
-@worksheet_command('search_collab')
-def worksheet_search_collab(worksheet):
- return g.notebook.html_share(worksheet, g.username, request.values.get('lookup'))
-
@worksheet_command('invite_collab')
def worksheet_invite_collab(worksheet):
owner = worksheet.owner()
@@ -577,6 +573,7 @@ def worksheet_invite_collab(worksheet):
if len(collaborators-old_collaborators)>500:
# to prevent abuse, you can't add more than 500 collaborators at a time
return current_app.message(_("Error: can't add more than 500 collaborators at a time"), cont=url_for_worksheet(worksheet))
+ worksheet.set_collaborators(collaborators)
user_manager = g.notebook.user_manager()
# add worksheet to new collaborators
for u in collaborators-old_collaborators:
@@ -593,7 +590,6 @@ def worksheet_invite_collab(worksheet):
# user doesn't exist
pass
- worksheet.set_collaborators(collaborators)
return redirect(url_for_worksheet(worksheet))
########################################################
@@ -3,8 +3,7 @@
INPUT:
- worksheet - an instance of Worksheet
- username - a string containing a username
- - lookup - (optional) string used for user lookup
- - lookup_result - (optional) list of users returned by user lookup
+ - other_users - a list of strings containing other users names
#}
{% block sharebar_title %}
@@ -14,16 +13,6 @@
{% set select = "share" %}
{% block after_sharebar %}
-<script type="text/javascript">
-function add_collab(u) {
- var col = document.getElementById('collaborators');
- if (col.value != "") {
- col.value+= ", ";
- }
- col.value+=u;
-}
-</script>
-
{% if not (notebook.user_manager().user_is_admin(username) or username == worksheet.owner()) %}
{{ gettext('Only the owner of a worksheet is allowed to share it. You can do whatever you want if you <a href="copy">make your own copy</a>.') }}
{% else %}
@@ -34,25 +23,5 @@
<textarea name="collaborators" rows=5 cols=70 class="edit" id="collaborators" style="display:block; margin-bottom:1em;">{{ worksheet.collaborators()|join(', ') }}</textarea>
<input type="submit" title="{{ gettext('Give access to your worksheet to the above collaborators') }}" value="{{ gettext('Invite Collaborators') }}" />
</form>
-
- <hr class="usercontrol" />
- {% if lookup %}
- <div>
- <p>{{ gettext ('Search results:') }}{% if lookup_result %}
- {% for u in lookup_result %}
- <span class="users">
- <a href="javascript:add_collab('{{ u }}');" class="users">{{ u }}</a>
- </span>
- {% endfor %}
- {% else %} {{ gettext('No match found') }}
- {% endif %}</p>
- </div>
- {% else %}
- {{ gettext('Search Users') }}
- {% endif %}
- <form width=70% method="post" action="search_collab" style="margin-bottom:1em">
- <input type="text" class="edit" id="lookup" name="lookup" value="{{ lookup if lookup else '' }}" />
- <input type="submit" value="{{ gettext('Search') }}" />
- </form>
{% endif %}
{% endblock %}
@@ -62,7 +62,6 @@
('sh', False),
('singular', False),
('axiom', True),
- ('fricas', True),
('kash', True),
('macaulay2', True),
('magma', True),
@@ -1369,7 +1368,7 @@ def html_specific_revision(self, username, ws, rev):
username = username, rev = rev, prev_rev = prev_rev,
next_rev = next_rev, time_ago = time_ago)
- def html_share(self, worksheet, username, lookup=None):
+ def html_share(self, worksheet, username):
r"""
Return the HTML for the "share" page of a worksheet.
@@ -1390,19 +1389,10 @@ def html_share(self, worksheet, username, lookup=None):
sage: nb.html_share(W, 'admin')
u'...currently shared...add or remove collaborators...'
"""
- lookup_result = self.user_manager().user_lookup(lookup) if lookup else None
- if lookup_result is not None:
- lookup_result.sort(lambda x,y: cmp(x.lower(), y.lower()))
- if username in lookup_result:
- lookup_result.remove(username)
-
-
return template(os.path.join("html", "notebook", "worksheet_share.html"),
worksheet = worksheet,
notebook = self,
- username = username,
- lookup = lookup,
- lookup_result = lookup_result)
+ username = username)
def html_download_or_delete_datafile(self, ws, username, filename):
r"""

0 comments on commit 597e8cb

Please sign in to comment.