$render=explode(" ", $_POST['partial_render']);
$msgs='{summary: "Você se cadastrou", detail: "",severity: "info",severityText: "Information"}';
if($_POST['email']==''){
$msg_email='<div id="msg:email" role="alert" aria-atomic="true" aria-live="polite" data-display="both" data-target="email" data-redisplay="true" class="ui-message ui-message-error ui-widget ui-corner-all">
<div><span class="ui-message-error-icon"></span><span class="ui-message-error-detail" id="msg:email_error-detail">Usuário: Erro de validação: o valor é obrigatório.</span></div>
</div>
<script id="msg:email_s" type="text/javascript">
DinarteCoelho.cw("Message", "widget_msg_email", {
id: "msg:email",
target: "email"
});
</script>';
$erro_email='ui-state-error';
$msgs='{summary: "Usuário: Erro de validação: o valor é obrigatório.", detail: "", severity: "error", severityText: "Error"}';
$extension='{"validationFailed":true}';
}
if($_POST['username']==''){
$msg_username='
<div id="msg:username" role="alert" aria-atomic="true" aria-live="polite" data-display="both" data-target="username" data-redisplay="true" class="ui-message ui-message-error ui-widget ui-corner-all">
<div><span class="ui-message-error-icon"></span><span class="ui-message-error-detail" id="msg:username_error-detail">Nome: Erro de validação: o valor é obrigatório.</span></div>
</div>
<script id="msg:username_s" type="text/javascript">
DinarteCoelho.cw("Message", "widget_msg_username", {
id: "msg:username",
target: "username"
});
</script>
';
$erro_username='ui-state-error';
$msgs='{summary: "Usuário: Erro de validação: o valor é obrigatório.", detail: "", severity: "error", severityText: "Error" }';
$extension='{"validationFailed":true}';
}
if($_POST['username']=='' AND $_POST['email']==''){
$msgs='{summary: "Nome: Erro de validação: o valor é obrigatório..", detail: "", severity: "error", severityText: "Error" }, { summary: "Usuário: Erro de validação: o valor é obrigatório.", detail: "", severity: "error", severityText: "Error" }';
}
$resposta='
<span id="alerta" class="ui-growl-pl" data-widget="widget_alerta" data-summary="data-summary" data-severity="all,error" data-redisplay="true"></span>
<script id="alerta_s" type="text/javascript">
DinarteCoelho.cw("Growl", "widget_alerta", {
id: "alerta",
sticky: false,
life: 6000,
escape: true,
keepAlive: false,
msgs: ['.$msgs.']
});
</script>
';
$resposta1='
<table id="grid" cellpadding="7">
<tbody>
<tr>
<td><label class="ui-outputlabel ui-widget ui-state-error" for="username">Nome:<span class="ui-outputlabel-rfi">*</span></label></td>
<td><input id="username" name="username" type="text" value="'.$_POST['username'].'" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all '.$erro_username.' " aria-required="true" aria-invalid="true" data-p-label="Nome" data-p-required="true" data-p-minlength="2" data-p-val="Length" />
<script id="username_s" type="text/javascript">
DinarteCoelho.cw("InputText", "widget_username", {
id: "username"
});
</script>
</td>
<td>
'.$msg_username.'
</td>
</tr>
<tr>
<td><label class="ui-outputlabel ui-widget ui-state-error" for="email">Usuário:<span class="ui-outputlabel-rfi">*</span></label></td>
<td><input id="email" name="email" type="text" value="'.$_POST['email'].'" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all '.$erro_email.' " aria-required="true" aria-invalid="true" data-p-label="Surname" data-p-required="true" />
<script id="email_s" type="text/javascript">
DinarteCoelho.cw("InputText", "widget_email", {
id: "email"
});
</script>
</td>
<td>
'.$msg_email.'
</td>
</tr>
</tbody>
</table>
';
function handleForm(xhr, status, args) {
if (args.validationFailed)
DC('widget_spot')
.show();
else
DC('widget_spot')
.hide();
}
dc.cw("Messages", "widget_msgs", {
id: "msgs"
});
dc.cw("InputText", "widget_username", {
id: "username"
});
dc.cw("Message", "widget_msg_user", {
id: "msg:username"
, target: "username"
});
dc.cw("InputText", "widget_email", {
id: "email"
});
dc.cw("Message", "widget_msg_email", {
id: "msg:email"
, target: "email"
});
dc.cw("CommandButton", "widget_salvar", {
id: "salvar"
});
dc.cw("Panel", "widget_pnl", {
id: "pnl"
});
dc.cw("Spotlight", "widget_spot", {
id: "pnl:spot"
, target: "pnl"
});