[sagenb] 56/179: remove "Search Users" box

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit 597e8cbe57cbc44defc51857ca57e23c8f7f0c5f
Author: Robin Martinjak <rob at rmartinjak.de>
Date:   Sat Mar 9 19:42:47 2013 +0100

    remove "Search Users" box
---
 flask_version/worksheet.py                         |  6 +---
 .../data/sage/html/notebook/worksheet_share.html   | 33 +---------------------
 sagenb/notebook/notebook.py                        | 14 ++-------
 3 files changed, 4 insertions(+), 49 deletions(-)

diff --git a/flask_version/worksheet.py b/flask_version/worksheet.py
index 9acb194..f293418 100644
--- a/flask_version/worksheet.py
+++ b/flask_version/worksheet.py
@@ -564,10 +564,6 @@ def worksheet_edit_published_page(worksheet):
 def worksheet_share(worksheet):
     return g.notebook.html_share(worksheet, g.username)
 
- at 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))
     
 ########################################################
diff --git a/sagenb/data/sage/html/notebook/worksheet_share.html b/sagenb/data/sage/html/notebook/worksheet_share.html
index 731d957..42ff38c 100644
--- a/sagenb/data/sage/html/notebook/worksheet_share.html
+++ b/sagenb/data/sage/html/notebook/worksheet_share.html
@@ -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 @@ INPUT:
 {% 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 @@ function add_collab(u) {
     <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 %}
diff --git a/sagenb/notebook/notebook.py b/sagenb/notebook/notebook.py
index 5c86adf..bdca928 100644
--- a/sagenb/notebook/notebook.py
+++ b/sagenb/notebook/notebook.py
@@ -62,7 +62,6 @@ try:
                ('sh', False),
                ('singular', False),
                ('axiom', True),
-               ('fricas', True),
                ('kash', True),
                ('macaulay2', True),
                ('magma', True),
@@ -1369,7 +1368,7 @@ class Notebook(object):
                         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 @@ class Notebook(object):
             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"""

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list