root/galaxy-central/templates/sharing_base.mako @ 2

リビジョン 2, 12.2 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1##
2## Base template for sharing or publishing an item. Template expects the following parameters:
3## (a) item - item to be shared.
4##
5<%!
6    def inherit(context):
7        if context.get('use_panels', False) == True:
8            if context.get('webapp'):
9                webapp = context.get('webapp')
10            else:
11                webapp = 'galaxy'
12            return '/webapps/%s/base_panels.mako' % webapp
13        else:
14            return '/base.mako'
15%>
16<%inherit file="${inherit(context)}"/>
17
18<%namespace file="/display_common.mako" import="*" />
19<%namespace file="/message.mako" import="render_msg" />
20
21##
22## Page methods.
23##
24
25<%def name="init()">
26<%
27    self.has_left_panel=False
28    self.has_right_panel=False
29    self.message_box_visible=False
30    self.overlay_visible=False
31    self.message_box_class=""
32    self.active_view=""
33    self.body_class=""
34%>
35</%def>
36
37<%def name="title()">
38    Sharing and Publishing ${get_class_display_name( item.__class__ )} '${get_item_name( item )}'
39</%def>
40
41<%def name="javascripts()">
42    ${parent.javascripts()}
43    <script type="text/javascript">
44    $(document).ready( function()
45    {
46        //
47        // Set up slug-editing functionality.
48        //
49        var on_start = function( text_elt )
50        {
51            // Replace URL with URL text.
52            $('#item-url').hide();
53            $('#item-url-text').show();
54           
55            // Allow only lowercase alphanumeric and '-' characters in slug.
56            text_elt.keyup(function(){
57                text_elt.val( $(this).val().replace(/\s+/g,'-').replace(/[^a-zA-Z0-9\-]/g,'').toLowerCase() )
58            });
59        };
60       
61        var on_finish = function( text_elt )
62        {
63            // Replace URL text with URL.
64            $('#item-url-text').hide();
65            $('#item-url').show();
66           
67            // Set URL to new value.
68            var new_url = $('#item-url-text').text();
69            var item_url_obj = $('#item-url');
70            item_url_obj.attr( "href", new_url );
71            item_url_obj.text( new_url );
72        };
73       
74        <% controller_name = get_controller_name( item ) %>
75        async_save_text("edit-identifier", "item-identifier", "${h.url_for( controller=controller_name, action='set_slug_async', id=trans.security.encode_id( item.id ) )}", "new_slug", null, false, 0, on_start, on_finish);
76    });
77    </script>
78</%def>
79
80<%def name="stylesheets()">
81    ${parent.stylesheets()}
82    <style>
83        ## Put some whitespace before each section header.
84        h3
85        {
86            margin-top: 2em;
87        }
88        input.action-button
89        {
90            margin-left: 0;
91        }
92        ## If page is displayed in panels, pad from edges for readability.
93        %if context.get('use_panels'):
94        div#center
95        {
96            padding: 10px;
97        }
98        %endif
99    </style>
100</%def>
101
102<%def name="center_panel()">
103    ${self.body()}
104</%def>
105
106<%def name="body()">
107    ## Set use_panels var for use in page's URLs.
108    <% use_panels = context.get('use_panels', False)  %>
109
110    ## Render message.
111    %if message:
112        ${render_msg( message, status )}
113    %endif
114
115    <%
116        #
117        # Setup and variables needed for page.
118        #
119   
120        # Get class name strings.
121        item_class_name = get_class_display_name( item.__class__ )
122        item_class_name_lc = item_class_name.lower()
123        item_class_plural_name = get_class_plural_display_name( item.__class__ )
124        item_class_plural_name_lc = item_class_plural_name.lower()
125       
126        # Get item name.
127        item_name = get_item_name(item)
128    %>
129
130    <h2>Share or Publish ${item_class_name} '${item_name}'</h2>
131
132    ## Require that user have a public username before sharing or publishing an item.
133    %if trans.get_user().username is None or trans.get_user().username is "":
134        To make a ${item_class_name_lc} accessible via link or publish it, you must create a public username:
135        <p>
136        <form action="${h.url_for( action='set_public_username', id=trans.security.encode_id( item.id ) )}"     
137                method="POST">
138            <div class="form-row">
139                <label>Public Username:</label>
140                <div class="form-row-input">
141                    <input type="text" name="username" size="40"/>
142                </div>
143            </div>
144            <div style="clear: both"></div>
145            <div class="form-row">
146                <input class="action-button" type="submit" name="Set Username" value="Set Username"/>
147            </div>
148        </form>
149    %else:
150        ## User has a public username, so private sharing and publishing options.
151        <h3>Making ${item_class_name} Accessible via Link and Publishing It</h3>
152   
153            <div>
154                %if item.importable:
155                    <%
156                        item_status = "accessible via link"
157                        if item.published:
158                            item_status = item_status + " and published"   
159                    %>
160                    This ${item_class_name_lc} is currently <strong>${item_status}</strong>.
161                    <div>
162                        <p>Anyone can view and import this ${item_class_name_lc} by visiting the following URL:
163
164                        <blockquote>
165                            <%
166                                url = h.url_for( action='display_by_username_and_slug', username=trans.get_user().username, slug=item.slug, qualified=True )
167                                url_parts = url.split("/")
168                            %>
169                            <a id="item-url" href="${url}" target="_top">${url}</a>
170                            <span id="item-url-text" style="display: none">
171                                ${"/".join( url_parts[:-1] )}/<span id='item-identifier'>${url_parts[-1]}</span>
172                            </span>
173                           
174                            <a href="#" id="edit-identifier"><img src="${h.url_for('/static/images/fugue/pencil.png')}"/></a>
175                        </blockquote>
176       
177                        %if item.published:
178                            This ${item_class_name_lc} is publicly listed and searchable in Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section.
179                        %endif
180                    </div>
181       
182                    <p>You can:
183                    <div>
184                    <form action="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ) )}"
185                            method="POST">
186                            %if not item.published:
187                                ## Item is importable but not published. User can disable importable or publish.
188                                <input class="action-button" type="submit" name="disable_link_access" value="Disable Access to ${item_class_name} Link">
189                                <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible.</div>
190                                <br>
191                                <input class="action-button" type="submit" name="publish" value="Publish ${item_class_name}" method="POST">
192                                <div class="toolParamHelp">Publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div>
193
194                            <br>
195                            %else: ## item.published == True
196                                ## Item is importable and published. User can unpublish or disable import and unpublish.
197                                <input class="action-button" type="submit" name="unpublish" value="Unpublish ${item_class_name}">
198                                <div class="toolParamHelp">Removes this ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div>
199                                <br>
200                                <input class="action-button" type="submit" name="disable_link_access_and_unpublish" value="Disable Access to ${item_class_name} via Link and Unpublish">
201                                <div class="toolParamHelp">Disables this ${item_class_name_lc}'s link so that it is not accessible and removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div>
202                            %endif
203               
204                    </form>
205                    </div>
206   
207                %else:
208   
209                    This ${item_class_name_lc} is currently restricted so that only you and the users listed below can access it. You can:
210                    <p>
211                    <form action="${h.url_for( action='sharing', id=trans.security.encode_id(item.id) )}" method="POST">
212                        <input class="action-button" type="submit" name="make_accessible_via_link" value="Make ${item_class_name} Accessible via Link">
213                        <div class="toolParamHelp">Generates a web link that you can share with other people so that they can view and import the ${item_class_name_lc}.</div>
214       
215                        <br>
216                        <input class="action-button" type="submit" name="make_accessible_and_publish" value="Make ${item_class_name} Accessible and Publish" method="POST">
217                        <div class="toolParamHelp">Makes the ${item_class_name_lc} accessible via link (see above) and publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div>
218                    </form>
219       
220                %endif
221
222        ##
223        ## Sharing with Galaxy users.
224        ##
225        <h3>Sharing ${item_class_name} with Specific Users</h3>
226
227            <div>
228                %if item.users_shared_with:
229
230                    <p>
231                        The following users will see this ${item_class_name_lc} in their ${item_class_name_lc} list and will be
232                        able to view, import, and run it.
233                    </p>
234           
235                    <table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
236                        <tr class="header">
237                            <th>Email</th>
238                            <th></th>
239                        </tr>
240                        %for i, association in enumerate( item.users_shared_with ):
241                            <% user = association.user %>
242                            <tr>
243                                <td>
244                                    <div class="menubutton popup" id="user-${i}-popup">${user.email}</div>
245                                </td>
246                                <td>
247                                    <div popupmenu="user-${i}-popup">
248                                    <a class="action-button" href="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ), unshare_user=trans.security.encode_id( user.id ), use_panels=use_panels )}">Unshare</a>
249                                    </div>
250                                </td>
251                            </tr>   
252                        %endfor
253                    </table>
254   
255                    <p>
256                    <a class="action-button"
257                       href="${h.url_for( action='share', id=trans.security.encode_id(item.id), use_panels=use_panels )}">
258                        <span>Share with another user</span>
259                    </a>
260
261                %else:
262
263                    <p>You have not shared this ${item_class_name_lc} with any users.</p>
264   
265                    <a class="action-button"
266                       href="${h.url_for( action='share', id=trans.security.encode_id(item.id), use_panels=use_panels )}">
267                        <span>Share with a user</span>
268                    </a>
269                    <br>
270   
271                %endif
272            </div>
273        </div>
274    %endif
275
276    <p><br><br>
277    <a href=${h.url_for( action="list" )}>Back to ${item_class_plural_name} List</a>
278</%def>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。