Mongokit mis




**Functionalities implemented**

**1) Major changes regarding MIS GApp**
   - Different views & templates set-up for Event and Person GSystemType
   - Edit-view and display-view modified for Event & Person (& their sub-types) based on property_order field
   - Interface implemented for linking Student & Voluntary Teacher node to it's respective login account as well as also subscribes them to their respective college groups
   - Attendence-widget updated (only interface part, work still needs to be done on backend part)
   - Required fields marked on edit-view template (red star mark)
   - Group-admin check put-on MIS & MIS-PO GApps view
     - Only superusers, group-creator, and group-admins are able to see these GApps in the menubar 

**2) Different views & templates set-up for Event and Person GSystemType**
   - Used namespacing feature of django-urls in base url file ```__init__.py``` to redirect both MIS & MIS-PO GApps urls to common url file ```mis.py``` which in turn redirects to view-file ```mis.py```
   - ```mis.py``` (view) redirects to respective view-file based on selected GSystemType (or it's sub-type)
     - Currently implemented for Event & Person GSystemType and their sub-types
       - That is, whether it's Student/Voluntary Teacher, both are redirected from ```mis.py``` to ```person.py```
     - For others, same view-file ```mis.py``` is used.
     
   - File modified:
     1) urls/__init_.py
     2) views/mis.py
     
   - Files created:
      1) templates/mis_base_create_edit.html
      2) templates/mis_base.html
      3) templates/mis_base_list.html

      4) views/event.py
      5) templates/event_create_edit.html
      6) templates/event_details.html
      7) templates/event_list.html

      8) views/person.py
      9) templates/person_create_edit.html
     10) templates/person_details.html
     11) templates/person_list.html
     
   - Files deleted:
     1) urls/mis_po.py
     2) views/mis_po.py
     3) templates/mis_po_create_edit.html
     4) templates/mis_po_details.html
     5) templates/mis_po_list.html
     

**3) Edit-view and display-view modified for Event & Person (& their sub-types) based on property_order field**
   - Firstly, ```property_order``` field of these GSystemTypes' is populated with list containing:
     - tab-name, and
     - another list consisting of ObjectId of fields' that tab will hold

   - **Created a new common function**: ```get_property_order_with_value(gsystem_node)```
     - Accepts newly/already created instance node as it's parameter
     - This function reads property_order field's values and updates it in such order that it replaces ObjectIds with a dictionary (keys: _type, data_type, name, altnames, value, required)

   - For edit-view:
     - This updated property_order_list is rendered to create_edit template and where it's dictionary is passed to a template-tag ```html_widget```.
     - **Created a new template-tag**: ```html_widget(node_id, dict_var)```
       - Accepts node's ObjectId and updated property_order's dictionary variable corresponding to each tab-name in the list
       - This is an inclusive template tag that renders ```html_field_widget.html``` with respective html-widget for given node; based on node's data-type

   - Files modified:
     1) views/methods.py - ```get_property_order_with_value(gsystem_node)``` created
     2) templatetags/ndf_tags.py - ```html_widget(node_id, dict_var)``` created
     
   - File created:
     1) templates/ndf/html_field_widget.html

**4) Interface implemented for linking Student & Voluntary Teacher node to it's respective login account as well as also subscribes them to their respective college groups**
   - Files modified:
     1) templates/ndf/mis_base_list.html
        - ```Link``` button added
          - Enabled: When link is not established
          - Disabled (with label as Linked) - When link in established (even if user is not subscribed as it could also be done from group's detail-view)
     2) urls/ajax-urls.py - ```set_user_link``` url created
     3) views/ajax_views.py - ```set_user_link()``` view created
     4) views/person.py
        - Checks whether link is created or not and passes the result to template, depending on which ```Link``` button is toggled

     
**6) save() function updated - Solution to overcome the problem of updating rcs-version file even if nothing is changed**
   - Updates rcs-version file only when any field of the given node is modified

   - Files modified:
     1) views/methods.py - ```get_node_common_field()``` modified
     
        - Now returns bool value indicating whether node is modified or not
        
     2) models.py - ```save()``` modified
     
        - Accepts keyword-argument ```is_changed```
        - When passed, depending upon it's value rcs-version is updated
        
      3) views/ - implemented save() function's changes
      
         - browse_topic.py
         - course.py
         - file.py
         - group.py
         - imageDashboard.py
         - page.py
         - quiz.py
         - videoDashboard.py
        
**7) create_gattribute() and create_grelation() function created for common use**
   - **create_gattribute(node_id, attribute_type_node, object_value)**
     - Accepts following parameters
       - ObjectId of subject_type
       - AttributeType node (check it's type must be AttributeType)
       - value for this attribute (parsed value as this function doesn't parses based on data-type currently, later this will also be provided)
     - Returns created/updated GAttribute instance

   - **create_grelation(subject_id, relation_type_node, right_subject_node)**
     - Accepts following parameters:
       - ObjectId for subject
       - RelationType node (check it's type must be RelationType)
       - ObjectId/list of ObjectId for right_subject
     - Returns created/updated GRelation instance
   
   - File modified:
     1) views/methods.py - ```create_gattribute()``` and ```create_grelation()``` added