#NEWLINE# def write_lino_js( self , f ) : #NEWLINE# #INDENT# profile = jsgen . get_user_profile ( ) #NEWLINE# context = dict ( ext_renderer = self , site = settings . SITE , settings = settings , lino = lino , language = translation . get_language ( ) , constants = constants , extjs = settings . SITE . plugins . extjs ) #NEWLINE# context . update ( _ = _ ) #NEWLINE# tpl = self . linolib_template ( ) #NEWLINE# f . write ( jscompress ( ( tpl . render ( ** context ) + '\n' ) ) ) #NEWLINE# env = settings . SITE . plugins . jinja . renderer . jinja_env #NEWLINE# for p in settings . SITE . installed_plugins : #NEWLINE# #INDENT# if isinstance ( p , Plugin ) : #NEWLINE# #INDENT# for tplname in p . site_js_snippets : #NEWLINE# #INDENT# tpl = env . get_template ( tplname ) #NEWLINE# f . write ( jscompress ( ( '\n// from %s:%s\n' % ( p , tplname ) ) ) ) #NEWLINE# f . write ( jscompress ( ( ( '\n' + tpl . render ( ** context ) ) + '\n' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# menu = settings . SITE . get_site_menu ( lh , profile ) #NEWLINE# menu . add_item ( 'home' , _ ( 'Home' ) , javascript = 'Lino.handle_home_button()' ) #NEWLINE# f . write ( ( 'Lino.main_menu = %s;\n' % py2js ( menu ) ) ) #NEWLINE# 'Call Ext.namespace for *all* actors because\n        e.g. outbox.Mails.FormPanel is defined in ns outbox.Mails\n        which is not directly used by non-expert users.\n\n        ' #NEWLINE# for a in self . actors_list : #NEWLINE# #INDENT# f . write ( ( "Ext.namespace('Lino.%s')\n" % a ) ) #NEWLINE# #UNINDENT# actors_list = [ a for a in self . actors_list if ( a . get_handle_name is None ) ] #NEWLINE# actors_list = [ a for a in actors_list if a . default_action . get_view_permission ( profile ) ] #NEWLINE# f . write ( '\n// ChoiceLists: \n' ) #NEWLINE# for a in list ( choicelists . CHOICELISTS . values ( ) ) : #NEWLINE# #INDENT# if settings . SITE . is_installed ( a . app_label ) : #NEWLINE# #INDENT# f . write ( ( 'Lino.%s = %s;\n' % ( a . actor_id , py2js ( a . get_choices ( ) ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( profile == jsgen . get_user_profile ( ) ) #NEWLINE# def must_render( lh , profile ) : #NEWLINE# #INDENT# 'Return True if the given form layout `fl` is needed for\n            profile.' #NEWLINE# if ( not lh . main . get_view_permission ( profile ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if lh . layout . _datasource . get_view_permission ( profile ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# for ds in lh . layout . _other_datasources : #NEWLINE# #INDENT# if ds . get_view_permission ( profile ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return False #NEWLINE# #UNINDENT# for fl in self . param_panels : #NEWLINE# #INDENT# lh = fl . get_layout_handle ( self . plugin ) #NEWLINE# if must_render ( lh , profile ) : #NEWLINE# #INDENT# for ln in self . js_render_ParamsPanelSubclass ( lh ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for fl in self . action_param_panels : #NEWLINE# #INDENT# lh = fl . get_layout_handle ( self . plugin ) #NEWLINE# if must_render ( lh , profile ) : #NEWLINE# #INDENT# for ln in self . js_render_ActionFormPanelSubclass ( lh ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# assert ( profile == jsgen . get_user_profile ( ) ) #NEWLINE# for fl in self . form_panels : #NEWLINE# #INDENT# lh = fl . get_layout_handle ( self . plugin ) #NEWLINE# if must_render ( lh , profile ) : #NEWLINE# #INDENT# for ln in self . js_render_FormPanelSubclass ( lh ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# actions_written = set ( ) #NEWLINE# for rpt in actors_list : #NEWLINE# #INDENT# rh = rpt . get_handle ( ) #NEWLINE# for ba in rpt . get_actions ( ) : #NEWLINE# #INDENT# if ba . action . parameters : #NEWLINE# #INDENT# if ( not ( ba . action in actions_written ) ) : #NEWLINE# #INDENT# actions_written . add ( ba . action ) #NEWLINE# for ln in self . js_render_window_action ( rh , ba , profile ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for rpt in actors_list : #NEWLINE# #INDENT# rh = rpt . get_handle ( ) #NEWLINE# if ( isinstance ( rpt , type ) and issubclass ( rpt , ( tables . AbstractTable , choicelists . ChoiceList ) ) ) : #NEWLINE# #INDENT# for ln in self . js_render_GridPanel_class ( rh ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ba in rpt . get_actions ( ) : #NEWLINE# #INDENT# if ( ba . action . parameters and ( not ba . action . no_params_window ) ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ba . action . opens_a_window : #NEWLINE# #INDENT# if isinstance ( ba . action , ( ShowDetailAction , InsertRow ) ) : #NEWLINE# #INDENT# for ln in self . js_render_detail_action_FormPanel ( rh , ba ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ln in self . js_render_window_action ( rh , ba , profile ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ba . action . action_name : #NEWLINE# #INDENT# for ln in self . js_render_custom_action ( rh , ba ) : #NEWLINE# #INDENT# f . write ( ( ln + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( profile != jsgen . get_user_profile ( ) ) : #NEWLINE# #INDENT# logger . warning ( 'Oops, profile %s != jsgen.get_user_profile() %s' , profile , jsgen . get_user_profile ( ) ) #NEWLINE# #UNINDENT# return 1