Changes between Version 7 and Version 8 of BluePrint/WebSetup


Ignore:
Timestamp:
01/05/15 12:53:58 (7 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BluePrint/WebSetup

    v7 v8  
    1 [[TOC]]                         
    2 = WEB SETUP IMPLEMENTATION (Detail)=
    3 == '''MODELS''' ==
    4 === default.py ===
     1= Blueprint for Web Setup =
     2[[TOC]]
    53
    6 * '''session.SelectorCheck'''
    7   :It is a boolean value that checks if an eden instance is selected or not .It helps the controllers to decide whether to show the selector screen or not.
     4Allow access via Web UI to be able to edit 000_config.py.
    85
    9 * '''dict of libraries'''
    10   :These contain the information about lxml,reportlabs,xlwt,shapely and geos libraries . It helps to test the presence of these libraries and also give links to where they could be downloaded .
    11 {{{
    12 libraries = {
    13     'lxml':
    14         {
    15             'name': 'lxml',
    16             'description': 'To import and export XML, you need to install lxml',
    17             'link': 'http://codespeak.net/lxml/installation.html'
    18         },
    19 }
    20 }}}
     6This is probably best done by extending the Setup co-application:
     7* https://github.com/flavour/eden/tree/master/modules/templates/setup
    218
     9== See Also ==
     10DeveloperGuidelines/WebSetup
    2211
    23 
    24 === parsed_config.py===
    25 It actually consists of s3cfg.py and 000_config.py written one after the other . When this code is allowed to run we get the dict of all the deployment settings can easily be obtained .[[BR]]
    26 The s3cfg.py contains docstring in each get function . These doctstring contain the information like:-
    27 * '''type''' : which type of the input field is required in the forms
    28 * '''category''' : which category to the setting belong.
    29 * '''name''' : The name of the setting
    30 * '''options''' :The list of values shown in the dropdown
    31 The 000_config also has disabled module dictionary . This is really important for the cases when an module was initially deactivated and later activated.
    32 
    33 As the values are taken from the current 000_config and s3cfg.py and then used thus there is no problem even if an old instance is used in websetup to change the settings. These values in the forms reflect the current values  of 000_config.py
    34 
    35 == '''CONTROLLERS''' ==
    36 === default.py ===
    37      
    38 ==== Def selector(): ====
    39 If the session variable of the path is not set then I redirect the user from the index function to this function of the controller.
    40 *       I create a the list of paths of all the eden applications( Identified by license file in the folder )
    41 *       And then there is a drop down menu to select the path ( the user will select the name, I retrieve the path using the request.post_vars in the form.accepts and then set the path accordingly).We create forms using  SELECT() function for the dropdown and FIELDSET() for creating a filed in the form
    42 
    43 
    44 ==== Def index(): ====
    45 If the session variable is set then this part is executed. The main purpose of this is to create forms according to the needs and the docstrings written in the s3cfg.py . This part parses those data to retrieve the input fields ,name and category of settings .[[BR]]
    46 
    47 As for modules all the module mentioned in the docstring of the get_module() function is used.[[BR]]
    48 
    49 This part also checks for the:-[[BR]]
    50 * '''Module dependecies'''[[BR]]
    51   :I have mentioned all the dependencies in the docstring of the get_module()function. These are parsed and checked in this part.If any module is activated that needs other modules those other modules will be activated by themselves .
    52 
    53 * '''Core modules'''[[BR]]
    54   :I have removed the status option for the 4 core modules. Thus these modules cannot be deactivatted.
    55 The Form is generated by followinf the following scheme :-[[BR]]
    56 [[BR]]   
    57 Form (Entire collection)[[BR]]
    58 |[[BR]]
    59 Fieldset (Categorizes Settings, modules or create new eden block)[[BR]]
    60 |[[BR]]
    61 Fieldset (Groups of settings)[[BR]]
    62 |[[BR]]
    63 Table (Optional) (Not everything uses a table this is just for organization)[[BR]]
    64 |[[BR]]
    65 Input/Element (Individual setting)[[BR]]
    66 
    67 * Module Forms:
    68 [[BR]]
    69 
    70 * There will be similar forms for the settings. However I would like to have separate forms for different categories of settings. Like thsese:-
    71 [[BR]]
    72 
    73 
    74 '''Other Functions made to help index()'''
    75 
    76 * def create_new_eden():[[BR]]
    77 This function is used to create new eden . It copies the content from the current instance into a new folder with the given name. It also uses bzr if present to update the code bu downloading the revisions .
    78 [[BR]]
    79 '''Note: As of January 2012, BZR/Launchpad info for eden is deprecated. Please visit the GitHub page. Thanks.'''[[BR]]
    80 
    81 * def get_input_type():[[BR]]
    82 This function is used to create a dropdown menu or checkboxes for the given field. It also access the options to be made
    83 
    84 ==== Def write_out(): ====
    85 '''This writes data to 000_config'''[[BR]]
    86 For this they would need to open the config using os.path.join and write data to the config  in the correct format.[[BR]]
    87 This function extensively uses the modify() function to convert the dict of the deployment settings and and modules to convert into a python sytax which can be written to the 000_config.
    88 
    89 == '''VIEWS''' ==
    90 
    91 Though we have not talked about this part directly, however in the last section of index(): function we have talked about the forms that I would like to create. Most part of this code can be reused from the previous application.
    92 
    93 This part extensively uses jquery to create tabs and and also the css to create a good color scheme. Thus the form is generated only once and all the other
    94 navigaion is done through jquery thus making it much  faster and convenient to use. 
    95 
    96 == '''WEB SETUP NEW ARCHITECTURE''' ==
    97 {{{
    98 #!html
    99 <img src="http://www.picamatic.com/show/2011/04/08/04/42/7470362_2272x980.jpg">
    100 }}}
    101 
    102 == '''Workflow And Summary''' ==
    103 === Acivate the WebSetup : ===
    104  
    105 * Going to the web setup co-application and select an Eden Instance .
    106 
    107 === s3cfg and 000_config copied ===
    108  * These are stored in the models of the co-application thus they will run as the selector screen is submitted.
    109 
    110 === The forms for each setting is displayed ===
    111   * these forms are generated using index
    112   * there results are postulated using request.post_vars
    113 
    114 === The dict extracted from 000_config is writen to 000_config with the correct values ===
    115   * This process is done in write_out ()
    116 
    117 === In the process I am also generating a method for creating new Eden without Netowrk Access ===
    118  
    119 
     12Sahana Phase2 version:
     13* http://wiki.sahanafoundation.org/doku.php?id=dev:websetup
     14* http://wiki.sahanafoundation.org/doku.php?id=dev:saws