def make_menu_javascript(self, query): """ Creates the javascript required to generate the menu """ ## Find all families: module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) menus = [] menus_titles = [] result = '' for k in module_list: submenu_text = '' ## Add the reports in the family: report_list = Registry.REPORTS.family[k] for r in report_list: if r.hidden: continue submenu_text += '''<div dojoType="MenuItem2" caption="%s" onClick="update_container('main','%s');"></div>\n''' % ( r.name, FlagFramework.query_type((), family=k, report=r.name)) if len(submenu_text) > 0: menus.append( '<div dojoType="PopupMenu2" widgetId="%s" toggle="wipe">%s</div>\n' % (k, submenu_text)) menus_titles.append( '<div dojoType="MenuBarItem2" caption="%s" submenuId="%s"></div>\n' % (k, k)) return result + ''' %s <div dojoType="MenuBar2" id="menubar" layoutAlign="top">%s</div> <div dojoType="ToolbarContainer" layoutAlign="top" id="ToolbarContainer" bindArgs="preventCache:false;"> <div dojoType="Toolbar" id="toolbar"></div></div> ''' % ('\n'.join(menus), '\n'.join(menus_titles))
def make_menu_javascript(self,query): """ Creates the javascript function required to generate the menu """ result = '''<table class=MenuBar><tr>''' submenus = '' ## Find all families: module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) for k in module_list: items = 0 submenu_text = '\n<table class=PopupMenu id="PopupMenu%s">' % k ## Add the reports in the family: report_list = Registry.REPORTS.family[k] for r in report_list: if r.hidden: continue submenu_text+="<tr class='MenuItem' onclick='SelectMenuItem(\"f?report=%s&family=%s\")'><td>%s</td></tr>\n" % (r.name, k, r.name) items += 1 continue if items > 0: result += "\n<td class=MenuBarItem id='MenuBarItem%s' onmouseover='displaySubMenu(\"%s\")'>%s</td>" % (k,k,k.replace(" "," ")) submenus += submenu_text + "</table>" return result + "<td style='width=100%'></td></tr></table>" + submenus
def make_menu_javascript(self,query): """ Creates the javascript required to generate the menu """ ## Find all families: module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) menus = [] menus_titles=[] result = '' for k in module_list: submenu_text = '' ## Add the reports in the family: report_list = Registry.REPORTS.family[k] for r in report_list: if r.hidden: continue submenu_text+='''<div dojoType="MenuItem2" caption="%s" onClick="update_container('main','%s');"></div>\n''' % (r.name,FlagFramework.query_type((),family=k,report=r.name)) if len(submenu_text)>0: menus.append('<div dojoType="PopupMenu2" widgetId="%s" toggle="wipe">%s</div>\n' % (k,submenu_text)) menus_titles.append('<div dojoType="MenuBarItem2" caption="%s" submenuId="%s"></div>\n'%(k,k)) return result+''' %s <div dojoType="MenuBar2" id="menubar" layoutAlign="top">%s</div> <div dojoType="ToolbarContainer" layoutAlign="top" id="ToolbarContainer" bindArgs="preventCache:false;"> <div dojoType="Toolbar" id="toolbar"></div></div> ''' % ('\n'.join(menus),'\n'.join(menus_titles))
def menu(self,flag,query, result): """ Draws the menu for the current family. @arg flag: A Flag object containing the appropriate dispatcher @arg query: The user query """ family = query['family'] module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) result=flag.ui() result.result='''<table cellspacing=0 cellpadding=0 width="100%" border=0 hspace="0" vspace="0" height="300"> <tbody> <tr> <td width=5><img height=22 alt="table corner" src="images/metbarleft.gif" width=5></td> <td width="918"> <table cellspacing=0 cellpadding=0 width="100%" background="images/metbarfill.gif" border=0 hspace="0" vspace="0"> <tbody> <tr> <td height=22> <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size=2></font><font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="2">Main Menu</font></b></font></div> </td> </tr> </tbody> </table> </td> <td width=10><img height=22 alt="table corner" src="images/metbarend.gif" width=8></td> </tr> <tr> <td width=5 background="images/sidebarleft.gif"> </td> <td valign=top width="918"> <p><font size="+1" face="Arial, Helvetica, sans-serif">''' for k in module_list: link = flag.ui() link.link(k,family=k) result.result+=''' %s<br />\n''' % (link,) if family==k: report_list = Registry.REPORTS.family[family] for r in report_list: if r.hidden: continue link = flag.ui() link.link(r.name,target=Theme.propegate(query,FlagFramework.query_type()),tooltip=r.__doc__,report=r.name) result.result+=" <strong><big>·</big></strong> %s <br />\n" % link result.result+="<br/>" result.result+=''' </font></p> </td> <td width=10 background="images/sidebarrgt.gif"> </td> </tr> <tr> <td width=5><img height=22 alt="table corner" src="images/greenbarleft.gif" width=5></td> <td width="918"> <table cellspacing=0 cellpadding=0 width="100%" background="images/greenbarfill.gif" border=0> <tbody> <tr> <td height=22> </td> </tr> </tbody> </table> </td> <td width=10><img height=22 alt="table corner" src="images/greenbarrgt.gif" width=8></td> </tr> </tbody> </table> ''' return result
def menu(self, flag, query, result): """ Draws the menu for the current family. @arg flag: A Flag object containing the appropriate dispatcher @arg query: The user query """ family = query['family'] module_list = Registry.REPORTS.get_families() Theme.order_families(module_list) result = flag.ui() result.result = '''<table cellspacing=0 cellpadding=0 width="100%" border=0 hspace="0" vspace="0" height="300"> <tbody> <tr> <td width=5><img height=22 alt="table corner" src="images/metbarleft.gif" width=5></td> <td width="918"> <table cellspacing=0 cellpadding=0 width="100%" background="images/metbarfill.gif" border=0 hspace="0" vspace="0"> <tbody> <tr> <td height=22> <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size=2></font><font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="2">Main Menu</font></b></font></div> </td> </tr> </tbody> </table> </td> <td width=10><img height=22 alt="table corner" src="images/metbarend.gif" width=8></td> </tr> <tr> <td width=5 background="images/sidebarleft.gif"> </td> <td valign=top width="918"> <p><font size="+1" face="Arial, Helvetica, sans-serif">''' for k in module_list: link = flag.ui() link.link(k, family=k) result.result += ''' %s<br />\n''' % (link, ) if family == k: report_list = Registry.REPORTS.family[family] for r in report_list: if r.hidden: continue link = flag.ui() link.link(r.name, target=Theme.propegate( query, FlagFramework.query_type()), tooltip=r.__doc__, report=r.name) result.result += " <strong><big>·</big></strong> %s <br />\n" % link result.result += "<br/>" result.result += ''' </font></p> </td> <td width=10 background="images/sidebarrgt.gif"> </td> </tr> <tr> <td width=5><img height=22 alt="table corner" src="images/greenbarleft.gif" width=5></td> <td width="918"> <table cellspacing=0 cellpadding=0 width="100%" background="images/greenbarfill.gif" border=0> <tbody> <tr> <td height=22> </td> </tr> </tbody> </table> </td> <td width=10><img height=22 alt="table corner" src="images/greenbarrgt.gif" width=8></td> </tr> </tbody> </table> ''' return result