Changeset 1149 in main


Ignore:
Timestamp:
05/31/12 14:11:06 (7 years ago)
Author:
zali
Message:

Management tab deleted.

Location:
trunk/openPLM
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/media/css/lifecycle.css

    r1146 r1149  
    44    background-color: #E4E3E2; 
    55    display: table; 
     6    margin-bottom:1%; 
    67    padding: 1%; 
    7     border: 4px solid #F95CC8; 
     8    border: 4px solid #F49FE9; 
    89    border-radius: 4px; 
    910} 
     11 
    1012div.lifecycle { 
    1113    background-color: #E4E3E2; 
  • trunk/openPLM/plmapp/tests/views.py

    r1109 r1149  
    361361        
    362362    def test_management(self): 
    363         response = self.get(self.base_url + "management/", page="management") 
     363        response = self.get(self.base_url + "lifecycle/", page="lifecycle") 
    364364        self.brian.groups.add(self.group) 
    365365        self.controller.set_owner(self.brian) 
    366         response = self.get(self.base_url + "management/") 
     366        response = self.get(self.base_url + "lifecycle/") 
    367367        self.assertFalse(response.context["is_notified"]) 
    368368        form = response.context["notify_self_form"] 
     
    372372    def test_management_add_get(self): 
    373373        response = self.get(self.base_url + "management/add/", 
    374                link=True, page="management") 
     374               link=True, page="lifecycle") 
    375375        attach = response.context["attach"] 
    376376        self.assertEqual(self.controller.id, attach[0].id) 
     
    391391            user=self.brian, role=role) 
    392392        response = self.get(self.base_url + "management/replace/%d/" % link.id, 
    393                 link=True, page="management") 
     393                link=True, page="lifecycle") 
    394394        attach = response.context["attach"] 
    395395        self.assertEqual(self.controller.id, attach[0].id) 
  • trunk/openPLM/plmapp/views/main.py

    r1146 r1149  
    240240def display_object_lifecycle(request, obj_type, obj_ref, obj_revi): 
    241241    """ 
    242     Lifecycle view of the given object (a part or a document). 
     242    Lifecycle data of the given object (a part or a document). 
    243243   
    244244    :url: :samp:`/object/{obj_type}/{obj_ref}/{obj_revi}/lifecycle/[apply/]` 
     
    258258 
    259259    ``RequestContext`` 
    260      
    261     ``object_lifecycle`` 
    262         List of tuples (state name, *boolean*, signer role). The boolean is 
    263         True if the state name equals to the current state. The signer role 
    264         is a dict {"role" : name of the role, "user__username" : name of the 
    265         signer} 
    266  
    267     ``is_signer`` 
    268         True if the current user has the permission to promote this object 
    269  
    270     ``is_signer_dm`` 
    271         True if the current user has the permission to demote this object 
    272  
    273     ``password_form`` 
    274         A form to ask the user password 
    275  
    276     ``cancelled_revisions`` 
    277         List of plmobjects that will be cancelled if the object is promoted 
    278      
    279     ``deprecated_revisions`` 
    280         List of plmobjects that will be deprecated if the object is promoted 
    281260 
    282261    ``action`` 
    283262        Only for unsuccessful POST requests. 
    284263        Name of the action ("demote" or "promote") that the user tries to do. 
    285     """ 
    286     obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) 
    287     if request.method == 'POST': 
    288         password_form = forms.ConfirmPasswordForm(request.user, request.POST) 
    289         if password_form.is_valid(): 
    290             if "demote" in request.POST: 
    291                 obj.demote() 
    292             elif "promote" in request.POST: 
    293                 obj.promote() 
    294             return HttpResponseRedirect("..") 
    295         if "demote" in request.POST: 
    296             ctx["action"] = "demote" 
    297         elif "promote" in request.POST: 
    298             ctx["action"] = "promote" 
    299     else:  
    300         password_form = forms.ConfirmPasswordForm(request.user) 
    301     state = obj.state.name 
    302     object_lifecycle = [] 
    303     roles = dict(obj.plmobjectuserlink_plmobject.values_list("role", "user__username")) 
    304     lcs = obj.lifecycle.to_states_list() 
    305     for i, st in enumerate(lcs): 
    306         signer = roles.get(level_to_sign_str(i)) 
    307         object_lifecycle.append((st, st == state, signer)) 
    308     is_signer = obj.check_permission(obj.get_current_sign_level(), False) 
    309     is_signer_dm = obj.check_permission(obj.get_previous_sign_level(), False) 
    310  
    311     # warning if a previous revision will be cancelled/deprecated 
    312     cancelled = [] 
    313     deprecated = [] 
    314     if is_signer: 
    315         if lcs.next_state(state) == obj.lifecycle.official_state.name: 
    316             for rev in obj.get_previous_revisions(): 
    317                 if rev.is_official: 
    318                     deprecated.append(rev) 
    319                 elif rev.is_draft or rev.is_proposed: 
    320                     cancelled.append(rev) 
    321     ctx["cancelled_revisions"] = cancelled 
    322     ctx["deprecated_revisions"] = deprecated 
    323  
    324     ctx.update({'current_page':'lifecycle',  
    325                 'object_lifecycle': object_lifecycle, 
    326                 'is_signer' : is_signer,  
    327                 'is_signer_dm' : is_signer_dm, 
    328                 'password_form' : password_form, 
    329                 }) 
    330     #get_management_data(obj,ctx) 
    331     return r2r('lifecycle.html', ctx, request) 
    332  
    333 def display_lifecycle_bis(request, obj_type, obj_ref, obj_revi): 
    334     """ 
    335     Manage html page which display lifecycle of an object and users who manages its 
    336264    """ 
    337265    obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) 
     
    357285     
    358286def get_lifecycle_data(signers,obj,ctx): 
     287    """ 
     288    Update lifecycle data for a given object  
     289     
     290    ``object_lifecycle`` 
     291        List of tuples (state name, *boolean*, signer role). The boolean is 
     292        True if the state name equals to the current state. The signer role 
     293        is a dict {"role" : name of the role, "user__username" : name of the 
     294        signer} 
     295 
     296    ``is_signer`` 
     297        True if the current user has the permission to promote this object 
     298 
     299    ``is_signer_dm`` 
     300        True if the current user has the permission to demote this object 
     301     
     302    ``signers_data`` 
     303        List of tuple (signer, nb_signer). The signer is a dict which contains 
     304        management data for the signer and indicates wether a signer exists or not. 
     305         
     306    ``password_form`` 
     307        A form to ask the user password 
     308 
     309    ``cancelled_revisions`` 
     310        List of plmobjects that will be cancelled if the object is promoted 
     311     
     312    ``deprecated_revisions`` 
     313        List of plmobjects that will be deprecated if the object is promoted 
     314    """ 
    359315    state = obj.state.name 
    360316    object_lifecycle = [] 
     
    399355def get_management_data(request,obj,ctx): 
    400356    """ 
    401     Update ctx with mangemement data related to obj 
     357    Update context for html page which displays the Users who manage the selected object (:class:`PLMObjectUserLink`). 
     358    It computes a context dictionnary based on 
     359     
     360    .. include:: views_params.txt  
    402361    """ 
    403362    object_management_list = models.PLMObjectUserLink.objects.filter(plmobject=obj) 
     
    11841143###    All functions which manage the different html pages specific to part and document  ### 
    11851144############################################################################################# 
    1186 @handle_errors 
    1187 def display_management(request, obj_type, obj_ref, obj_revi): 
    1188     """ 
    1189     Manage html page which displays the Users who manage the selected object (:class:`PLMObjectUserLink`). 
    1190     It computes a context dictionnary based on 
    1191      
    1192     .. include:: views_params.txt  
    1193     """ 
    1194     obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) 
    1195      
    1196     object_management_list = models.PLMObjectUserLink.objects.filter(plmobject=obj) 
    1197     object_management_list = object_management_list.order_by("role") 
    1198     if not ctx["is_owner"]: 
    1199         link = object_management_list.filter(role="notified", user=request.user) 
    1200         ctx["is_notified"] = bool(link) 
    1201         if link: 
    1202             ctx["remove_notify_link"] = link[0] 
    1203         else: 
    1204             if obj.check_in_group(request.user, False): 
    1205                 initial = { "type" : "User", 
    1206                             "username" : request.user.username 
    1207                           } 
    1208                 form = forms.SelectUserForm(initial=initial) 
    1209                 for field in ("type", "username"): 
    1210                     form.fields[field].widget = HiddenInput()  
    1211                 ctx["notify_self_form"] = form 
    1212                 ctx["can_notify"] = True 
    1213             else: 
    1214                 ctx["can_notify"] = False 
    1215     ctx.update({'current_page':'management', 
    1216             'object_management': object_management_list}) 
    1217      
    1218     return r2r('management.html', ctx, request) 
    1219  
    1220 ########################################################################################## 
     1145 
    12211146@handle_errors(undo="../../../lifecycle") 
    12221147def replace_management(request, obj_type, obj_ref, obj_revi, link_id): 
     
    12421167                if link.role == 'notified': 
    12431168                    obj.remove_notified(link.user) 
    1244             return HttpResponseRedirect("../..") 
     1169            return HttpResponseRedirect("../../../lifecycle") 
    12451170    else: 
    12461171        replace_management_form = forms.SelectUserForm() 
    12471172     
    1248     ctx.update({'current_page':'management',  
     1173    ctx.update({'current_page':'lifecycle',  
    12491174                'replace_management_form': replace_management_form, 
    12501175                'link_creation': True, 
     
    12531178 
    12541179##########################################################################################     
    1255 @handle_errors(undo="../..") 
     1180@handle_errors(undo="../../lifecycle") 
    12561181def add_management(request, obj_type, obj_ref, obj_revi): 
    12571182    """ 
     
    12701195                user_obj = get_obj_from_form(add_management_form, request.user) 
    12711196                obj.set_role(user_obj.object, "notified") 
    1272             return HttpResponseRedirect("..") 
     1197            return HttpResponseRedirect("../../lifecycle") 
    12731198    else: 
    12741199        add_management_form = forms.SelectUserForm() 
    12751200     
    1276     ctx.update({'current_page':'management',  
     1201    ctx.update({'current_page':'lifecycle',  
    12771202                'replace_management_form': add_management_form, 
    12781203                'link_creation': True, 
     
    12971222        except (KeyError, ValueError, ControllerError): 
    12981223            return HttpResponseForbidden() 
    1299     return HttpResponseRedirect("../") 
     1224    return HttpResponseRedirect("../../lifecycle") 
    13001225 
    13011226########################################################################################## 
  • trunk/openPLM/templates/blocks/menu.html

    r792 r1149  
    33    <ul id="MenuList"> 
    44        {% for menu_item in object_menu %} 
     5            {% if menu_item != "management" %} 
    56            <li {% ifequal menu_item current_page%} class="CurrentPage" {%endifequal%}> 
    67            <a href="{{obj.plmobject_url}}{{menu_item}}/"> 
     
    89            </a> 
    910            </li> 
     11            {% endif %} 
    1012        {% endfor %} 
    1113    </ul> 
  • trunk/openPLM/templates/documents/files.html

    r1137 r1149  
    2424                var url = $(this).attr("href"); 
    2525                $("#dialog_check-out").dialog('option', 'buttons', { 
    26                  
    2726                    "CANCEL": function() { 
    2827                        $(this).dialog("close"); 
     
    3635                    $("#dialog_check-out").dialog("open"); 
    3736                    return false; 
    38                 }); 
     37            }); 
    3938 
    4039            $("#s_all").click(function(){ 
     
    5958{% include "documents/files_add.html" %} 
    6059</div> 
     60{% else %} 
     61    {% if is_owner %} 
     62        {% trans "The status of this document does not allow adding/deleting files." %} 
     63    {% else %} 
     64        {% trans "You don't have the necessary rights to add/delete files."%} 
     65    {% endif %} 
    6166{% endif %} 
    6267    {% if file_formset.total_form_count %} 
  • trunk/openPLM/templates/lifecycle_bis.html

    r1146 r1149  
    6161        {% endif %} 
    6262 
    63         <div id="msg"> 
     63        <div id="msg">  
    6464        </div> 
    6565        {% if obj.state != obj.lifecycle.first_state %} 
  • trunk/openPLM/urls.py

    r1141 r1149  
    106106    (r'$', display_object), 
    107107    (r'attributes/$', display_object_attributes), 
    108     #(r'lifecycle/(?:apply/)?$', display_object_lifecycle), 
    109     (r'lifecycle/(?:apply/)?$', display_lifecycle_bis), 
     108    (r'lifecycle/(?:apply/)?$', display_object_lifecycle), 
    110109    (r'revisions/$', display_object_revisions), 
    111110    (r'history/$', display_object_history), 
     
    127126    (r'files/checkout/(?P<docfile_id>[^/]+)/$', checkout_file), 
    128127    (r'modify/$', modify_object), 
    129     (r'management/$', display_management), 
     128    #(r'management/$', display_management), 
    130129    (r'management/add/$', add_management), 
    131130    (r'management/replace/(?P<link_id>\d+)/$', replace_management), 
Note: See TracChangeset for help on using the changeset viewer.