Nitrogen 学习过程实录(10)

 

5、动态网页的写法

写Nitrogen应用程序,主要的、甚至绝大部分的工作是写动态网页。

动态网页就是程序模块,即.erl文件。以下是一个例程(文件是/nitrogen/Quickstart/src/samples/web_samples_postback.erl):

-module (web_samples_postback).

-include ("wf.inc").

-compile(export_all).

main() -> #template { file="./wwwroot/onecolumn.html", bindings=[

  {'Group', learn},

  {'Item', samples}

]}.

%% 本模块生成的动态内容,揉进模板file,生成网页。bindings的用途,没弄明白。

title() -> "Postbacks".

headline() -> "Postbacks".

right() -> linecount:render().

%% 这三个函数和下面的body(),是网页模板填空时用的,查看/wwwroot/onecolumn.html就全明白了。

body() -> [  

  #p{},

  #button { text="Press Me", postback=button_pressed },

  #p{},

  #link { text="Click Me", postback=link_clicked },

  #p{},  

  #label { text="Press enter in the textbox." },

  #textbox { text="This is a message...", postback=textbox_enterkey },

  #p{},

  #checkbox { text="Toggle Me", postback=checkbox_clicked },

  #p{},  

  #dropdown { postback=dropdown_changed, options=[

    #option { text="Option 1" },

    #option { text="Option 2" },

    #option { text="Option 3" }

  ]},

  #p{},  

  #span { text="Mouse Over Me", actions=#event { type=mouseover, postback=span_mousedover } }

].  

%% 这个函数返回一个列表,列表成员是记录,代表着HTML元素,如#p{}表示<p>。

%% 这些记录的定义,在wf.inc。

event(EventInfo) ->

  wf:wire(#alert { text=wf:f("~p", [EventInfo]) }),

  ok.

这是Nitrogen最难弄懂的东西。

查看文件/nitrogen/src/wf.erl

wire(Actions) -> wf_render:wire(Actions).

再查看文件/nitrogen/src/lib/wf_render.erl

wire(Actions) -> 

wire(me, me, Actions).

wire(TriggerPath, Actions) ->

wire(TriggerPath, TriggerPath, Actions).

wire(TriggerPath, TargetPath, Actions) ->

% Add to the queue of wired actions. These will be rendered in get_script().

ActionQueue = get(wf_action_queue),

put(wf_action_queue, [{TriggerPath, TargetPath, Actions}|ActionQueue]),

ok.

本例执行第3子句。从字面意思猜测,这个函数的任务是取得“事件队列”,并把新事件送入其中。

事件由系统自动处理。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Rab GTPases serve as master regulators of membrane trafficking. They can be activated by guanine nucleotide exchange factors (GEF) and be inactivated by GTPase-activating proteins (GAPs). The roles of some GAPs have been explored in Saccharomyces cerevisiae, but are largely unknown in filamentous fungi. Here, we investigated the role of GAP Gyp3 gene, an ortholog of S. cerevisiae Gyp3, in an entomopathogenic fungus, Metarhizium acridum. We found that MaGyp3 is mainly localized to the endoplasmic reticulum (ER) of vegetative hyphae, nuclei of mature conidia, and both ER and nuclei in invasive hyphae. Lack of MaGyp3 caused a decreased tolerance to hyperosmotic stress, heat-shock and UV-B radiation. Moreover, the ΔMaGyp3 mutant showed a significantly decreased pathogenicity owing to delayed germination, reduced appressorium-mediated penetration and impaired invasive growth. Loss of MaGyp3 also caused impaired fungal growth, advanced conidiation and defects in utilization of carbon and nitrogen sources, while overexpression of MaGyp3 exhibited delayed conidiation on nutrient-rich medium and conidiation pattern shift from microcycle conidiation to normal conidiation on nutrient-limited medium. Mavib-1, a tanscription factor invloved in conidiation by affecting nutrient utilizaiton, can directly bind to the promoter of MaGyp3. ΔMaGyp3 and ΔMavib-1 mutants shared similar phenotypes, and overexpression mutants of MaGyp3 and Mavib-1 (Mavib-1-OE) exhibited similar phenotypes in growth, conidiation and pathogenicity. Reintroduction of the Magyp3 driven by strong promoter gpd in ΔMavib-1 mutant recovered the defects in growth and conidiation for dysfunction of Mavib1. Taken together, our findings uncovered the role of GAP3 in a filamentous pathogenic fungus and and illustrated the upstream regulatory mechanism by direct interaction with Mavib-1.请用nature杂志的风格润色成学术论文的形式。
02-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值