[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-09-11 12:51:55', 'search_fields': None, 'module': 'Application Internal', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': 'index_html = \'\'\'\n  <div class = "divmargin" style="margin-left:%s;border">\n    <table style="width:100%%;font-family: Arial, Sans; font-size:%s;font-weight:%s;">\n      <tr>\n        <td style="width:40px;text-align:right;">%s</td>\n        <td>%s</td>        \n      </tr>\n    </table>%s\n  </div>\n\'\'\'\n\nmod_html = \'\'\'\n    <br><div class = "divmargin" style="margin-left:32px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 20px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n    </div>\n\'\'\'\n\nreport_html = \'\'\'\n  <div class = "divmargin" style="margin-left:40px;">\n    <table style="width:100%%;font-family: Arial, Sans; font-size: 18px;font-weight:normal;">\n      <tr>\n        <td style="width:40px;text-align:right;">%s</td>\n        <td>%s</td>\n      </tr>\n    </table>\n  </div>\n\'\'\'\n\ndoc_html=\'\'\'\n    <br><div class = "divmargin" style="margin-left:40px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 18px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n    </div>\n\'\'\'\n\ndocsec_html=\'\'\'\n  <div class = "divmargin" style="margin-left:48px;">\n      <table style="width:100%%;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">\n        <tr>\n          <td style="width:40px;text-align:right;">%s</td>\n          <td>%s</td>\n        </tr>\n      </table>%s\n  </div>\n  <div style="page-break-after:always;">\n  </div>\n\'\'\'\n\nscreenshot_html=\'\'\'\n  <br><div class = "divmargin"><img src="cgi-bin/getfile.cgi?name=%s"></img></div>\n\'\'\'\n\ndocfields_html = \'\'\'\n  <div class = "divmargin" style="margin-left:56px; width:800px;">\n    <table style="border:%s;background-color:%s;">\n      <tr>\n        <td>%s:</td>\n      </tr>\n      <tr>\n        <td><div class = "divmargin" style="margin-left:20px;width:550;"><p><code>%s</code></p></div></td>  \n      </tr>\n    </table>\n  </div>\n\'\'\'\n\ndoctables_html = \'\'\'\n  <div class = "divmargin" style="margin-left:56px;">\n    <table style="width:100%%;">\n      <tr>\n        <td>%s</td>\n      </tr>\n      <tr>\n        <td>%s</td>\n      </tr>      \n    </table>\n  </div>\n\'\'\'\n\nclass DocType:\n  def __init__(self,doc,doclist=[]):\n    self.doc = doc\n    self.doclist = doclist\n    self.main_html = \'\'\n    self.out = \'\'\n    self.index_html = \'\'\n    \n  def get_doc(self):\n    self.main_html = \'\'\'<html><head><style type="text/css">p{white-space:pre-wrap}</style><style>.simpletable {border-collapse:collapse;}</style><style>.simpletable td {padding: 3px; border: 1pt solid #000; font-family: Arial, Sans; font-size: 12px; vertical-align: top; }</style><style>.divmargin {margin-right:25px;}</style><style>.margin {margin:50px;}</style></head><body class="margin" style="border-collapse:collapse"><div style="margin:20px;border:1px solid #000;border-collapse:collapse;">%s</div><div style="page-break-after:always;"></div><div style="margin:20px;border:1px solid #000;border-collapse:collapse">%s</div></body><html>\'\'\'\n\n#All modules\n    modules = sql("select module_name from `tabModule Def`")\n    n=0\n    grp_mod_html= \'\'\n    grp_modindex_html = \'\'\n    temp_main_html = \'\'\n    for m in modules:\n      n1=0\n      n = n+1\n      rp_no = 0\n      grp_doc_html=\'\'\'<br><div style="margin-left:40px;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">DocTypes</div>\'\'\'\n      grp_report_html=\'\'\'<br><div style="margin-left:40px;font-family: Arial, Sans; font-size: 16px;font-weight:normal;">Reports</div>\'\'\'\n      grp_docindex_html =\'\'\n      reports = sql("select distinct criteria_name from `tabSearch Criteria` where module= \'%s\'" % m[0])\n      doctypes = sql("select name from `tabDocType` where module =\'%s\'" %(m[0]))\n\n      for rp in reports:\n        rp_no +=1\n        grp_report_html += report_html % (str(rp_no), rp[0])\n\n      for d in doctypes:\n        n1 = n1+1\n        n2 = 0\n        sr = \'\'\n        sr= str(n) + \'.\' + str(n1)\n        grp_docsec_html = \'\'\n        grp_secindex_html = \'\'\n        grp_ss_html=\'\'\n        docfields_name = sql("select name,autoname,description,client_script,server_code,client_string from `tabDocType` where name=%s",d[0],as_dict = 1)\n#        docsections = [\'Screenshot\',\'Options\',\'Permissions\',\'Fields\',\'Client Script\', \'Server Script\',\'Client String\']\n        docsections = [\'Options\',\'Permissions\',\'Fields\']        \n        for ds in docsections:\n          n2 = n2+1\n          sr1 = \'\'\n          sr1 = str(n)+\'.\'+str(n1)+\'.\'+str(n2)\n          for df in docfields_name:\n            grp_docfields_html = \'\'\n            if ds == \'Options\':\n              self.out = \'\'\n              if df[\'name\']:\n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'Name\',str(df[\'name\']))\n              if df[\'autoname\']:             \n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'AutoName\',str(df[\'autoname\']))\n              if df[\'description\']:\n                grp_docfields_html += docfields_html % (\'0pt none #FFFFFF\',\'#FFFFFF\',\'Description\',str(df[\'description\']))\n          \n            if ds == \'Client Script\':\n              if df[\'client_script\']:\n                cl_sc = df[\'client_script\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',cl_sc)\n            if ds == \'Server Script\':\n              if df[\'server_code\']:\n                ser_sc = df[\'server_code\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',ser_sc)\n            if ds == \'Client String\':\n              if df[\'client_string\']:\n                cl_str = df[\'client_string\'].replace(\'<\',\'< \')\n                grp_docfields_html += docfields_html % (\'1pt solid #000\',\'#EBECE4\',\'Code\',cl_str)\n\n#for screenshot\n#            if ds == \'Screenshot\':\n #             fname = sql("select file_list from `tabDocType` where name=%s", d[0])[0][0] or \'\'\n  #            fname = fname.split(\',\')[0]\n   #           if fname:\n    #            grp_docfields_html += screenshot_html % (fname)\n              \n#              grp_docsec_html += docsec_html % (str(sr1),ds,grp_ss_html)\n\n#for permission table\n            if ds == \'Permissions\':\n              lbl1 = [\'Level\',\'Role\',\'Read\',\'Write\',\'Create\',\'Submit\',\'Cancel\',\'Amend\',\'Execute\',\'Match\']\n              perm = sql("select `permlevel`,`role`,`read`,`write`,`create`,`submit`,`cancel`,`amend`,`execute`,`match` from `tabDocPerm` where parent=\'%s\' order by idx" % d[0])\n              self.make_table(perm,\'Roles & Permissions\',lbl1)                \n            \n              grp_docfields_html += doctables_html % (\'\', self.out)\n            \n#for table fields\n            if ds == \'Fields\':\n              self.out = \'\'\n              tbl_name = \'\'\n              #Doctype fields\n              lbl = [\'Label\',\'Type\',\'Name\',\'Option\',\'Perm Level\']\n              \n              option1 = sql("select label,fieldtype,fieldname,options,permlevel from `tabDocField` where parent=\'%s\' and fieldtype !=\'Section Break\' and fieldtype != \'Column Break\' order by idx" % d[0])\n\n              self.make_table(option1,d[0],lbl)\n\n              #table fields\n              tbl = sql("select options from `tabDocField` where parent=\'%s\' and fieldtype=\'Table\'" % d[0])\n              for t in tbl:\n                option2 = sql("select label,fieldtype,fieldname,options,permlevel from `tabDocField` where parent=\'%s\' and fieldtype !=\'Section Break\' and fieldtype != \'Column Break\' order by idx" % t[0])\n                self.make_table(option2,t[0],lbl)\n\n              grp_docfields_html +=doctables_html % (\'\', self.out)\n#              grp_docsec_html += docsec_html % (str(sr1),ds,grp_ss_html)\n          grp_docsec_html += docsec_html % (str(sr1), ds, grp_docfields_html)\n          grp_secindex_html += index_html % (\'48px\',\'16px\',\'normal\',str(sr1),ds,\'\')        \n        grp_doc_html += doc_html % (str(sr), d[0], grp_docsec_html)\n        grp_docindex_html += index_html % (\'40px\',\'18px\',\'normal\',str(sr), d[0],grp_secindex_html)      \n      grp_mod_html += mod_html % (str(n),m[0],grp_doc_html)\n      grp_mod_html += grp_report_html\n      grp_modindex_html += \'<br>\' + index_html % (\'32px\',\'20px\',\'normal\',str(n),m[0],grp_docindex_html)\n\n    self.main_html = self.main_html % (grp_modindex_html, grp_mod_html)\n    return self.main_html\n    \n  def make_table(self,opt,heading,lbl):\n    sr_no = 0\n    self.out += \'<br><div style="margin-left:56px; width:100%%">\' + heading + \'</div>\'\n    self.out += \'\'\'<br><div style="margin-left:56px; width:100%%">\n                <table class="simpletable" width="100%%" style="page-break-after:always;">\n                  <tr>\n                    <td style="width:5%%;">Sr</td>\'\'\'\n\n    for l in lbl:\n      self.out += \'<td>\' + l + \'</td>\'\n    self.out +=\'</tr>\'\n                  \n    for op in opt:\n      sr_no += 1\n      self.out = self.out + \'<tr>\'\n      self.out = self.out + \'<td>\'+cstr(sr_no)+\'</td>\'\n      for i in range(len(lbl)):\n        self.out = self.out + \'<td>\'+cstr(op[i])+\'</td>\'\n\n    self.out = self.out + \'</table></div>\'\n    return self.out', 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Documentation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': "cur_frm.cscript['Print Document'] = function(doc,cdt,cdn){\n  $c('runserverobj',args={'method':'get_doc','docs':compress_doclist([doc])},\n    function(r,rt){\n      get_print_doc(r.message);\n    }\n  );\n}\n\nvar get_print_doc = function(html){\n//  alert('print - ' + html)\n  var w = window.open('');\n  w.document.write(html);\n  w.document.close();\n}", 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00415', 'parent': 'Documentation', 'read': 1, 'create': 1, 'creation': '2009-09-11 12:51:55', 'modified': '2010-03-31 10:33:16', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-11 12:51:55', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Print Document', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Documentation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02955', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-03-31 10:33:16', 'parenttype': 'DocType', 'fieldname': None, 'fieldtype': 'Button', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]