BrightSide Workbench Full Report + Source Code
org.turro.contacts.zul.register.RegisterControl Class Reference
Inheritance diagram for org.turro.contacts.zul.register.RegisterControl:
Collaboration diagram for org.turro.contacts.zul.register.RegisterControl:

Public Member Functions

void onTerms (Event event)
 
void onRegister (Event event)
 
void doFinally ()
 
- Public Member Functions inherited from org.turro.elephant.TemplateControl
void setRootTmpl (String rootTmpl)
 
void setTmpl (String tmpl)
 
void afterCompose ()
 

Static Public Member Functions

static SignUp confirmEmail (String id) throws Exception
 
static void writeResultConfirmAction (IConstructor constructor, SignUp signUp) throws Exception
 
static void createContact (SignUp signUp) throws Exception
 

Additional Inherited Members

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 71 of file RegisterControl.java.

Member Function Documentation

◆ confirmEmail()

static SignUp org.turro.contacts.zul.register.RegisterControl.confirmEmail ( String  id) throws Exception
static

Definition at line 195 of file RegisterControl.java.

195  {
196  if(!Strings.isBlank(id)) {
197  Dao dao = new ContactsPU();
198  SignUp su = dao.find(SignUp.class, id);
199  if(su != null) {
200  if(su.isValid()) {
201  if(!su.isConfirmed()) {
202  createContact(su);
203  su.setConfirmed(true);
204  dao.saveObject(su);
205  sendMailToAdmin(su);
206  sendWelcomeMailToUser(su);
207  }
208  }
209  }
210  return su;
211  }
212  return null;
213  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createContact()

static void org.turro.contacts.zul.register.RegisterControl.createContact ( SignUp  signUp) throws Exception
static

Definition at line 230 of file RegisterControl.java.

230  {
231  if(!existEmail(signUp.getEmail())) {
232  Contact contact = new Contact();
233  contact.setName(signUp.getName());
234  contact.getComplexName().setFull(signUp.getName());
235  contact.setUserMenu(true);
236  Connector email = new Connector();
237  email.setContact(contact);
238  email.setDescription(IUser.CONNECTOR_EMAIL);
239  email.setValue(signUp.getEmail());
240  contact.getConnectors().add(email);
241  try {
242  KeyValueMap kvm = signUp.getValues();
243  for(String key : kvm.keySet()) {
244  if(!Strings.isBlank(key) && !Strings.isBlank(kvm.get(key))) {
245  Connector suv = new Connector();
246  suv.setContact(contact);
247  suv.setDescription(key);
248  suv.setValue(kvm.get(key));
249  contact.getConnectors().add(suv);
250  }
251  }
252  } catch(Exception ex) {}
253  if(!Strings.isBlank(ElephantContext.getSiteSyndicate())) {
254  String groups[] = ElephantContext.getSiteSyndicate().split(",");
255  SocialGroups.syndicate(List.of(contact), Set.of(groups), null);
256  }
257  new ContactWrapper(contact).save();
258  }
259  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doFinally()

void org.turro.contacts.zul.register.RegisterControl.doFinally ( )

Reimplemented from org.turro.elephant.TemplateControl.

Definition at line 145 of file RegisterControl.java.

145  {
146  super.doFinally();
147  createTermsOfUse();
148  if(termsBox != null) {
149  accepted.setDisabled(false);
150  }
151  professional.setVisible(ProfileContext.hasCompanies());
152  student.setVisible(ProfileContext.hasCenters());
153  }
Here is the call graph for this function:

◆ onRegister()

void org.turro.contacts.zul.register.RegisterControl.onRegister ( Event  event)

Definition at line 106 of file RegisterControl.java.

106  {
107  SignUp su = new SignUp();
108  su.setName(name.getValue());
109  su.setEmail(email.getValue());
110  su.setComment(comment.getValue());
111  su.setValueMap(keepValues());
112  if(su.isValid()) {
113  if(existPending(su.getEmail())) {
114  Messages.confirmProcess().add(I_.get("Email pending to confirm"))
115  .paragraph().add(I_.get("Resend confirmation e-mail")).show(() -> {
116  try {
117  sendEmail(sue);
118  Clients.showNotification(I_.format("Confirmation e-mail has been sent to %s", sue.getEmail()));
119  } catch (EmailException ex) {
120  Logger.getLogger(RegisterControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
121  }
122  });
123  } else if(existEmail(su.getEmail())) {
124  Clients.showNotification(I_.format("%s already exists", su.getEmail()));
125  Application.getApplication().sendRedirect("/user?" + Actions.createRightNowAction("email=" + su.getEmail()));
126  } else {
127  if(termsrow.isVisible() && accepted != null && !accepted.isChecked()) {
128  Clients.showNotification(I_.get("Read and accepted") + "?");
129  } else {
130  su = new ContactsPU().saveObject(su);
131  try {
132  sendEmail(su);
133  Clients.showNotification(I_.format("Confirmation e-mail has been sent to %s", su.getEmail()));
134  } catch (EmailException ex) {
135  Logger.getLogger(RegisterControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
136  }
137  }
138  }
139  } else {
140  Clients.showNotification("No valid values");
141  }
142  }
Here is the call graph for this function:

◆ onTerms()

void org.turro.contacts.zul.register.RegisterControl.onTerms ( Event  event)

Definition at line 95 of file RegisterControl.java.

95  {
96  if(termsBox != null) {
97  if(accepted.isChecked()) {
98  SelectionDialog.showComponent(getPage(), I_.get("Terms of Use"), termsBox, "70%", "500px", null);
99  }
100  }
101  }
Here is the call graph for this function:

◆ writeResultConfirmAction()

static void org.turro.contacts.zul.register.RegisterControl.writeResultConfirmAction ( IConstructor  constructor,
SignUp  signUp 
) throws Exception
static

Definition at line 215 of file RegisterControl.java.

215  {
216  ElephantMarker em = new ElephantMarker(constructor);
217  if(signUp != null && signUp.isConfirmed()) {
218  em.put("signUp", signUp);
219  try {
220  em.put("link", ElephantContext.getRootWebPath() + "?" + Actions.createAction(signUp.getEmail(), "/user/changepass"));
221  } catch (Exception ex) {
222  Logger.getLogger(RegisterControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
223  }
224  em.process("signup", "confirmed");
225  } else {
226  em.process("signup", "failed");
227  }
228  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: