Commits

dianmora  committed 9f889b4 Merge

merge

  • Participants
  • Parent commits 1f28fba, 8ef56be

Comments (0)

Files changed (49)

File encuestame-business/src/main/java/org/encuestame/business/service/AbstractSurveyService.java

 import java.util.LinkedList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.encuestame.core.config.EnMePlaceHolderConfigurer;
+import org.encuestame.core.security.util.WidgetUtil;
 import org.encuestame.core.util.ConvertDomainBean;
 import org.encuestame.core.util.InternetUtils;
 import org.encuestame.core.util.SocialUtils;
      */
     public TweetPollSwitch createTweetPollSwitch(
             final TweetPoll tweetPoll,
-            final QuestionAnswer answer){
-        final TweetPollSwitch tPollSwitch = new TweetPollSwitch();
-        tPollSwitch.setAnswers(answer);
-        tPollSwitch.setTweetPoll(tweetPoll);
-        tPollSwitch.setCodeTweet(MD5Utils.shortMD5(Calendar.getInstance().getTimeInMillis() + answer.getAnswer()));
-        tPollSwitch.setDateUpdated(Calendar.getInstance().getTime());
-        final StringBuffer voteUrlWithoutDomain = new StringBuffer();
-        voteUrlWithoutDomain.append(this.TWEETPOLL_VOTE);
-        voteUrlWithoutDomain.append(tPollSwitch.getCodeTweet());
-        final StringBuffer completeDomain = new StringBuffer(EnMePlaceHolderConfigurer.getProperty("application.domain"));
-        completeDomain.append(voteUrlWithoutDomain.toString());
-         log.debug("tweet poll answer vote :{"+voteUrlWithoutDomain.toString());
-         if (InternetUtils.validateUrl(completeDomain.toString())) {
-             log.debug("createTweetPollSwitch: URL IS VALID");
-             log.debug("createTweetPollSwitch: short url provider "+answer.getProvider());
-             tPollSwitch.setShortUrl(this.createShortUrl(answer.getProvider(), completeDomain.toString()));
-         } else {
-             log.debug("createTweetPollSwitch: url IS NOT valid");
-             tPollSwitch.setShortUrl(completeDomain.toString());
-             log.warn("Invalid format vote url:{"+voteUrlWithoutDomain.toString());
-         }
-        getTweetPollDao().saveOrUpdate(tPollSwitch);
-        return tPollSwitch;
+            final QuestionAnswer answer,
+            final HttpServletRequest request) {
+		final TweetPollSwitch tPollSwitch = new TweetPollSwitch();
+		tPollSwitch.setAnswers(answer);
+		tPollSwitch.setTweetPoll(tweetPoll);
+		tPollSwitch.setCodeTweet(MD5Utils.shortMD5(Calendar.getInstance()
+				.getTimeInMillis() + answer.getAnswer()));
+		tPollSwitch.setDateUpdated(Calendar.getInstance().getTime());
+		final StringBuffer voteUrlWithoutDomain = new StringBuffer();
+		voteUrlWithoutDomain.append(this.TWEETPOLL_VOTE);
+		voteUrlWithoutDomain.append(tPollSwitch.getCodeTweet());
+		tPollSwitch.setRelativeUrl(voteUrlWithoutDomain.toString());
+		final StringBuffer completeDomain = new StringBuffer();
+		if (request != null) {
+			final String domain = WidgetUtil.getDomain(request);
+			completeDomain.append(domain);
+		}
+		completeDomain.append(voteUrlWithoutDomain.toString());
+		log.debug("tweet poll answer vote :{" + voteUrlWithoutDomain.toString());
+		if (InternetUtils.validateUrl(completeDomain.toString())) {
+			log.debug("createTweetPollSwitch: URL IS VALID");
+//			log.debug("createTweetPollSwitch: short url provider "+ answer.getProvider());
+			tPollSwitch.setShortUrl(this.createShortUrl(answer.getProvider(), completeDomain.toString()));
+		} else {
+			log.debug("createTweetPollSwitch: url IS NOT valid");
+			tPollSwitch.setShortUrl(completeDomain.toString());
+			log.warn("Invalid format vote url:{" + voteUrlWithoutDomain.toString());
+		}
+		getTweetPollDao().saveOrUpdate(tPollSwitch);
+		return tPollSwitch;
     }
 
     /**
      * @throws HttpException
      */
     public String createShortUrl(final ShortUrlProvider provider, final String url) {
-        log.debug("shortUrlProvider "+url);
-        log.debug("shortUrlProvider PROVIDER "+provider);
-        log.debug("Is offline? "+EnMePlaceHolderConfigurer.getBooleanProperty("application.offline.mode"));
+        log.debug("shortUrlProvider " + url);
+        log.debug("shortUrlProvider PROVIDER " + provider);
+        log.debug("Is offline? " + EnMePlaceHolderConfigurer.getBooleanProperty("application.offline.mode"));
         String urlShort = url;
         if (!EnMePlaceHolderConfigurer.getBooleanProperty("application.offline.mode")) {
             if (provider.equals(ShortUrlProvider.GOOGL)) {
             	urlShort = url;
             }
         }
-        log.debug("shortUrlProvider SHORT: "+urlShort);
+        log.debug("shortUrlProvider SHORT: " + urlShort);
         return urlShort;
     }
 
      * @param questionId
      * @param tweetPoll
      */
-    public void updateTweetPollSwitchSupport(final TweetPoll tweetPoll){
+    public void updateTweetPollSwitchSupport(final TweetPoll tweetPoll, final HttpServletRequest httpServletRequest) {
         final List<QuestionAnswer> answers = this.getQuestionDao().getAnswersByQuestionId(tweetPoll.getQuestion().getQid());
         log.debug("updateTweetPollSwitchSupport answers size:{"+answers.size());
         //iterate answer for one question
             TweetPollSwitch tPollSwitch = getTweetPollDao().getAnswerTweetSwitch(tweetPoll, answer);
             if (tPollSwitch == null) {
                 log.debug("created tweetpoll switch for tweetpoll:{"+tweetPoll.getTweetPollId());
-                tPollSwitch = this.createTweetPollSwitch(tweetPoll, answer);
+                tPollSwitch = this.createTweetPollSwitch(tweetPoll, answer, httpServletRequest);
             } else {
                 log.debug("updated tweetpoll switch:{"+tPollSwitch.getSwitchId()+" for tweetpoll :{"+tweetPoll.getTweetPollId());
             }

File encuestame-business/src/main/java/org/encuestame/business/service/TweetPollService.java

 import java.util.Date;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.encuestame.core.exception.EnMeFailSendSocialTweetException;
 import org.encuestame.persistence.domain.security.SocialAccount;
 import org.encuestame.persistence.domain.security.UserAccount;
 import org.encuestame.persistence.domain.survey.Poll;
-import org.encuestame.persistence.domain.survey.PollFolder;
 import org.encuestame.persistence.domain.survey.Survey;
 import org.encuestame.persistence.domain.tweetpoll.TweetPoll;
 import org.encuestame.persistence.domain.tweetpoll.TweetPollFolder;
 import org.encuestame.utils.json.TweetPollAnswerSwitchBean;
 import org.encuestame.utils.json.TweetPollBean;
 import org.encuestame.utils.web.HashTagBean;
-import org.encuestame.utils.web.PollBean;
 import org.encuestame.utils.web.QuestionAnswerBean;
 import org.encuestame.utils.web.TweetPollResultsBean;
 import org.joda.time.DateTime;
     public TweetPoll createTweetPoll(
             final TweetPollBean tweetPollBean,
             final String questionName,
-            final UserAccount user) throws EnMeExpcetion {
+            final UserAccount user,
+            final HttpServletRequest request) throws EnMeExpcetion {
         try{
             final Question question = createTweetPollQuestion(questionName, user);
-            log.debug("question found:{"+question);
+            log.debug("question found:{" + question);
             if (question == null) {
                 throw new EnMeNoResultsFoundException("question not found");
             } else {
                     getTweetPollDao().saveOrUpdate(tweetPollDomain);
                 }
                 //update tweetpoll switch support
-                this.updateTweetPollSwitchSupport(tweetPollDomain);
+                this.updateTweetPollSwitchSupport(tweetPollDomain, request);
                 return tweetPollDomain;
             }
         } catch (Exception e) {
      */
     public TweetPollSwitch createTweetPollQuestionAnswer(
             final QuestionAnswerBean answerBean,
-            final TweetPoll tp)
+            final TweetPoll tp,
+            final HttpServletRequest request)
             throws EnMeNoResultsFoundException {
         final Question question = tp.getQuestion();
         //create answer
         } else {
             //create tweet poll switch with tp and new answer.
             log.debug("createTweetPollQuestionAnswer: short url provider:{ "+questionAnswer.getProvider());
-            final TweetPollSwitch tpSwitch = this.createTweetPollSwitch(tp, questionAnswer);
+            final TweetPollSwitch tpSwitch = this.createTweetPollSwitch(tp, questionAnswer, request);
             return tpSwitch;
         }
     }
          //adding tweetpoll
          //publishedStatus.setTweetPoll(tweetPoll);
          //checking required values.
-         if(type.equals(TypeSearchResult.TWEETPOLL)){
+         if(type.equals(TypeSearchResult.TWEETPOLL)) {
         	//adding tweetpoll
              publishedStatus.setTweetPoll(tweetPoll);
-         } else if(type.equals(TypeSearchResult.POLL)){
+         } else if(type.equals(TypeSearchResult.POLL)) {
         	//adding tweetpoll
              publishedStatus.setPoll(poll);
-         } else if(type.equals(TypeSearchResult.SURVEY)){
+         } else if(type.equals(TypeSearchResult.SURVEY)) {
         	 publishedStatus.setSurvey(survey);
          } else {
         	 log.error("Type not defined");

File encuestame-business/src/main/java/org/encuestame/business/setup/install/demo/CSVDemoParser.java

 	        tweetPollBean.setSchedule(Boolean.FALSE);
 	        try {
 	        	//final Question qm = createQuestion(question, u, QuestionPattern.CUSTOMIZABLE_SELECTION);
-				final TweetPoll tweetPollDomain = getTweetPollService().createTweetPoll(tweetPollBean, question.getQuestionName(), u);
+				final TweetPoll tweetPollDomain = getTweetPollService().createTweetPoll(tweetPollBean, question.getQuestionName(), u, null);
 
 				double hits = getRandomNumberRange(2, EnMePlaceHolderConfigurer
 						.getIntegerProperty("demo.max.tweetpoll.hits"));
 					final QuestionAnswerBean answerBean = new QuestionAnswerBean(questionAnswerBean.getAnswers());
 	                answerBean.setShortUrlType(ShortUrlProvider.NONE);
 	                //create tweetpoll swithch
-	                final TweetPollSwitch tweetPollSwitch = getTweetPollService().createTweetPollQuestionAnswer(answerBean, tweetPollDomain);	
+	                final TweetPollSwitch tweetPollSwitch = getTweetPollService().createTweetPollQuestionAnswer(answerBean, tweetPollDomain, null);	
 	                double totalVotes = getRandomNumberRange(0, EnMePlaceHolderConfigurer.getIntegerProperty("demo.votes.by.tppoll")) - 1;
 	                log.debug(totalVotes+" Votes for this tweetpolls switch id "+tweetPollSwitch.getSwitchId());
 	                for (int i = 0; i < totalVotes; i++) {

File encuestame-business/src/test/java/org/encuestame/test/business/service/TestTweetPollService.java

                 questionBean);
         final TweetPoll myTweetPoll = tweetPollService.createTweetPoll(
                 myTpBean, "What is your favourite city?",
-                getSpringSecurityLoggedUserAccount());
+                getSpringSecurityLoggedUserAccount(), null);
         final Question myQuestion = createQuestion(
                 "What is your favourite city", "pattern");
 
                 "No", myQuestion.getQid());
 
         final TweetPollSwitch pollSwitch = tweetPollService
-                .createTweetPollQuestionAnswer(qAnswerBean, myTweetPoll);
+                .createTweetPollQuestionAnswer(qAnswerBean, myTweetPoll, null);
         final TweetPollSwitch pollSwitch2 = tweetPollService
-                .createTweetPollQuestionAnswer(qAnswerBean, myTweetPoll);
+                .createTweetPollQuestionAnswer(qAnswerBean, myTweetPoll, null);
 
         tweetPollService.tweetPollVote(pollSwitch, ipVote, Calendar.getInstance().getTime());
         //tweetPollService.tweetPollVote(pollSwitch2, ipVote);

File encuestame-core/src/main/java/org/encuestame/core/service/SecurityService.java

      * @param username
      * @throws EnMeNoResultsFoundException
      */
-    public void upadteAccountProfile(
+    public void updateAccountProfile(
             final Profile property,
             final String value) throws EnMeNoResultsFoundException{
-        log.debug("updating accoutn profile :"+property+" whith value "+value);
+		log.debug("updating accoutn profile :" + property + " whith value "
+				+ value);
         final UserAccount account = getUserAccount(getUserPrincipalUsername());
         if (Profile.USERNAME.equals(property)) {
             account.setUsername(value.trim());
      * @param completeName
      * @throws EnMeNoResultsFoundException
      */
-    public void upadteAccountProfile(
+    public void updateAccountProfile(
             final String bio,
             final String language,
             final String completeName,
             final String loggedUsername) throws EnMeNoResultsFoundException{
-        final UserAccount account = getUserAccount(loggedUsername);
-        log.debug("update Account user to update "+account.getUsername());
-        log.debug("update Account Profile bio "+bio);
-        log.debug("update Account Profile language "+language);
+        final UserAccount account = getUserAccount(getUserPrincipalUsername());
+        log.debug("update Account user to update " + account.getUsername());
+        log.debug("update Account Profile bio " + bio);
+        log.debug("update Account Profile language " + language);
+        log.debug("update Account Profile language " + loggedUsername);
         account.setCompleteName(completeName);
-        //TODO: bug 112, add another missing properties.
+        //TODO: ENCUESTAME-20
+        //this.updateAccountProfile()
         getAccountDao().saveOrUpdate(account);
     }
 

File encuestame-core/src/main/java/org/encuestame/core/service/imp/ITweetPollService.java

 import java.util.Date;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.encuestame.persistence.dao.ITweetPoll;
 import org.encuestame.persistence.domain.HashTag;
 import org.encuestame.persistence.domain.question.QuestionAnswer;
     TweetPoll createTweetPoll(
             final TweetPollBean tweetPollBean,
             final String question,
-            final UserAccount user) throws EnMeExpcetion;
+            final UserAccount user,
+            final HttpServletRequest httpServletRequest) throws EnMeExpcetion;
 
 
     /**
     * @throws EnMeNoResultsFoundException
     */
    TweetPollSwitch createTweetPollQuestionAnswer(
-           final QuestionAnswerBean answerBean, final TweetPoll tp)
+           final QuestionAnswerBean answerBean, 
+           final TweetPoll tp,
+           final HttpServletRequest request)
            throws EnMeNoResultsFoundException;
 
     /**

File encuestame-core/src/main/java/org/encuestame/core/service/imp/SecurityOperations.java

      * @param username
      * @throws EnMeNoResultsFoundException
      */
-    void upadteAccountProfile(
+    void updateAccountProfile(
             final org.encuestame.utils.enums.Profile property,
             final String value) throws EnMeNoResultsFoundException;
 
      * @param completeName
      * @throws EnMeNoResultsFoundException
      */
-    void upadteAccountProfile(
+    void updateAccountProfile(
             final String bio,
             final String language,
             final String completeName,

File encuestame-core/src/main/java/org/encuestame/core/util/ConvertDomainBean.java

 		answerSwitchBean.setAnswerBean(ConvertDomainBean
 				.convertAnswerToBean(pollSwitch.getAnswers()));
 		answerSwitchBean.setShortUrl(pollSwitch.getShortUrl());
+		answerSwitchBean.setRelativeUrl(pollSwitch.getRelativeUrl());
 		answerSwitchBean.setId(pollSwitch.getSwitchId());
 		return answerSwitchBean;
 	}
 			unitUserBean.setName(secUserSecondary.getCompleteName());
 			unitUserBean.setEmail(secUserSecondary.getUserEmail());
 			unitUserBean.setUsername(secUserSecondary.getUsername());
+			unitUserBean.setPictureSource(secUserSecondary.getPictureSource().toString());
 			// TODO: Bug 112, add private, language y bio.
 		}
 		return unitUserBean;

File encuestame-core/src/main/java/org/encuestame/core/util/InternetUtils.java

 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
 import java.net.UnknownHostException;
 
 import javax.servlet.http.HttpServletRequest;
             }
         return secure;
     }
+    
+    /**
+     * 
+     * @param addr
+     * @return
+     */
+    public static boolean isThisMyIpAddress(InetAddress addr) {
+        // Check if the address is a valid special local or loop back
+        if (addr.isAnyLocalAddress() || addr.isLoopbackAddress())
+            return true;
+
+        // Check if the address is defined on any interface
+        try {
+            return NetworkInterface.getByInetAddress(addr) != null;
+        } catch (SocketException e) {
+            return false;
+        }
+    }
 
     public static boolean pingTwitter() {
         return InternetUtils.hostReachable("twitter.com");

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/AbstractBaseOperations.java

         tweetPollBean.setResultNotification(Boolean.FALSE);
         //tweetPollBean.setPublishPoll(Boolean.TRUE); // always TRUE
         tweetPollBean.setSchedule(Boolean.FALSE);
-        return getTweetPollService().createTweetPoll(tweetPollBean, question, user);
+        return getTweetPollService().createTweetPoll(tweetPollBean, question, user, null);
     }
 
     /**
         log.debug("createTweetPoll Bean "+tweetPollBean.toString());
         return getTweetPollService().createTweetPoll(tweetPollBean,
                 tweetPollBean.getQuestionBean().getQuestionName(),
-                getUserAccount());
+                getUserAccount(), null);
     }
 
     /**

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/AbstractJsonController.java

     /**
      * Set Succes Response.
      */
-    protected void setSuccesResponse(){
+    protected void setSuccesResponse() {
         final Map<String, Object> response = new HashMap<String, Object>();
         response.put("r", 0);
         setItemResponse(response);
     }
     
     /**
+     * Create a success response with message
+     * @param message the message
+     */
+    protected void setSuccesResponse(final String message) {
+        final Map<String, Object> response = new HashMap<String, Object>();
+        response.put("r", 0);
+        response.put("message", message == null ? "" : message);
+        setItemResponse(response);
+    }    
+    
+    /**
      * Set a failed response.
      */
     protected void setFailedResponse(){

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/TweetPollController.java

     	addi18nProperty(model, "tp_options_allow_repeated_votes", getMessage("tp_options_allow_repeated_votes"));
     	addi18nProperty(model, "tp_options_notifications", getMessage("tp_options_notifications"));
     	addi18nProperty(model, "related_terms", getMessage("related_terms"));
+    	addi18nProperty(model, "commons_success", getMessage("commons_success"));
+    	addi18nProperty(model, "commons_favourite");
+    	addi18nProperty(model, "e_023");
+    	addi18nProperty(model, "commons_unfavourite");
     	return "tweetpoll";
     }
 

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/json/survey/TweetPollJsonController.java

             log.debug("tweetpoll"+tweetPoll.getTweetPollId());
             if(!tweetPoll.getPublishTweetPoll()){
             log.debug("action ANSWER--->"+type);
-            if("add".equals(type)) {
+            if ("add".equals(type)) {
                 final QuestionAnswerBean answerBean = new QuestionAnswerBean(answer);
                 answerBean.setShortUrlType(ShortUrlProvider.get(shortUrl));
                 log.debug("new answer bean:{ "+answerBean.toString());
                 final TweetPollSwitch tweetPollSwitch = getTweetPollService()
-                      .createTweetPollQuestionAnswer(answerBean, tweetPoll);
+                      .createTweetPollQuestionAnswer(answerBean, tweetPoll, request);
                 log.debug("new answer bean DOMAIN "+tweetPollSwitch.toString());
                 //log.debug("action questionAnswer "+questionAnswer);
                 jsonResponse.put("newAnswer", ConvertDomainBean.convertTweetPollSwitchToBean(tweetPollSwitch));

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/security/json/JsonUsersController.java

             HttpServletResponse response) throws JsonGenerationException,
             JsonMappingException, IOException {
         try {
-            getSecurityService().upadteAccountProfile(Profile.findProfile(property.toUpperCase()), value);
+            getSecurityService().updateAccountProfile(Profile.findProfile(property.toUpperCase()), value);
             setSuccesResponse();
         } catch (Exception e) {
             log.error(e);

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/settings/SettingsController.java

 			addi18nProperty(model, "settings_config_picture_description");
 			addi18nProperty(model, "settings_config_picture_own");
 			addi18nProperty(model, "settings_config_picture_restrictions");
+			addi18nProperty(model, "m_023");
+			addi18nProperty(model, "settings_config_profile_form_not_valid");
+			//social settings
+			
 			log.debug("settingsAccountController user: " + user.toString());
 		} catch (EnMeNoResultsFoundException e) {
 			log.error(e);
    @RequestMapping(value = "/settings/social", method = RequestMethod.GET)
    public String socialSettingsController(ModelMap model) {
        log.debug("social");
+       
+       addi18nProperty(model, "settings_config_profile_email");
+       addi18nProperty(model, "settings_config_profile_complete_name");
+       addi18nProperty(model, "settings_social_tp_published_whith_this_account");
+       addi18nProperty(model, "settings_social_pll_published_whith_this_account");
+       addi18nProperty(model, "settings_social_su_published_whith_this_account");
+       addi18nProperty(model, "button_remove");
+       addi18nProperty(model, "settings_social_set_default");
+       addi18nProperty(model, "settings_social_profile_url");
        return "settings/social";
    }
 }

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/settings/SettingsJsonController.java

             @RequestParam(value = "data", required = false) String data,
             HttpServletResponse response) throws JsonGenerationException,
             JsonMappingException, IOException {
-        log.debug("update profile type:"+type);
-        log.debug("update profile data:"+data);
+        	
+        log.debug("update profile type:" + type);
+        log.debug("update profile data:" + data);
         try {
             final SecurityOperations security = getSecurityService();
             final ValidateOperations operations = new ValidateOperations(security);
             final HashMap<String, Object> listError = new HashMap<String, Object>();
             //filter data
             data = filterValue(data);
-            if(type.equals(Profile.EMAIL.toString())){
+            if (type.equals(Profile.EMAIL.toString())) {
                 //TODO: review pattern email format validator.
                 log.debug("update email");
                 final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                 if (operations.validateUserEmail(data, account)) {
-                    security.upadteAccountProfile(Profile.EMAIL, data);
+                    security.updateAccountProfile(Profile.EMAIL, data);
                     setSuccesResponse();
                 } else {
-                    listError.put(type, "email not valid");
+                    listError.put(type, getMessage("e_005", request, null));
                 }
-            } else if(type.equals(Profile.USERNAME.toString())){
+            } else if(type.equals(Profile.USERNAME.toString())) {
                 log.debug("update username");
                 final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                 if (operations.validateUsername(data, account)) {
-                    security.upadteAccountProfile(Profile.USERNAME, data);
-                    setSuccesResponse();
+                    security.updateAccountProfile(Profile.USERNAME, data);
+                    setSuccesResponse(getMessage("settings_config_profile_success", request, null));
                 } else {
-                    listError.put(type, "username not valid");
+                    listError.put(type, getMessage("e_018", request, null));
                 }
-            } else if(type.equals(Profile.PICTURE.toString())){
+            } else if(type.equals(Profile.PICTURE.toString())) {
                  log.debug("update PICTURE");
-                 security.upadteAccountProfile(Profile.PICTURE, data);
-                 setSuccesResponse();
+                 security.updateAccountProfile(Profile.PICTURE, data);
+                 setSuccesResponse(getMessage("settings_config_picture_success", request, null));
             } else {
-                setError("type not valid", response);
+                setError(getMessage("e_023", request, null), response);
             }
             if (!listError.isEmpty()) {
                 log.debug("list errors " + listError.size());
             }
         } catch (Exception e) {
             log.error(e);
-            setError(e.getMessage(), response);
+            e.printStackTrace();
+            setError(getMessage("e_023", request, null), response);
             //throw new JsonGenerationException(e.getMessage());
         }
         return returnData();
             boolean emailValid = operations.validateUserEmail(email, account);
             log.debug("emailValid " +emailValid);
             if (!emailValid) {
-                listError.put("username", "username not valid");
+                listError.put("username", getMessage("e_018", request, null));
                 valid = false;
             }
             boolean usernameValid = operations.validateUsername(username, account);
             log.debug("usernameValid " +usernameValid);
             if (!usernameValid) {
-                listError.put("email", "email not valid");
+                listError.put("email", getMessage("e_005", request, null));
                valid = false;
             }
             log.debug("this form is valid? " +valid);
             } else {
                 log.debug("updating profile ....");
                 //setError("invalid type", response);
-                getSecurityService().upadteAccountProfile(bio, language, completeName, username);
+                getSecurityService().updateAccountProfile(bio, language, completeName, username);
+                setSuccesResponse(getMessage("settings_config_profile_success", request, null));
             }
         } catch (Exception e) {
             log.error(e);
             e.printStackTrace();
-            setError(e.getMessage(), response);
+            setError(getMessage("e_023", request, null), response);
         }
         return returnData();
     }

File encuestame-mvc/src/main/java/org/encuestame/mvc/controller/social/json/SocialAccountsJsonController.java

              final HashMap<String, Object> jsonResponse = new HashMap<String, Object>();
              final List<SocialProvider> providers = new ArrayList<SocialProvider>();
                  providers.add(SocialProvider.TWITTER);
-                 providers.add(SocialProvider.GOOGLE_BUZZ);
+                 providers.add(SocialProvider.GOOGLE_PLUS);
                  providers.add(SocialProvider.LINKEDIN);
                  providers.add(SocialProvider.IDENTICA);
                  providers.add(SocialProvider.FACEBOOK);

File encuestame-mvc/src/main/java/org/encuestame/mvc/interceptor/Messagei18nInterceptor.java

 			Object arg2, ModelAndView arg3) throws Exception {	
 		//add profile message
 		if (arg3 != null) {
-			addDefaulti18nMessages(arg3.getModelMap());
-			addi18nProperty(arg3.getModelMap(), "loading_message",
-					getMessage("loading_message"));
-			addi18nProperty(arg3.getModelMap(), "save_message",
-					getMessage("save_message"));
-			addi18nProperty(arg3.getModelMap(), "e_023", getMessage("e_023"));
+			//TODO: this messages are displayed on json responses, we need filter by type, spring config?
+//			addDefaulti18nMessages(arg3.getModelMap());
+//			addi18nProperty(arg3.getModelMap(), "loading_message",
+//					getMessage("loading_message"));
+//			addi18nProperty(arg3.getModelMap(), "save_message",
+//					getMessage("save_message"));
+//			addi18nProperty(arg3.getModelMap(), "e_023", getMessage("e_023"));
 		}
 	}
 

File encuestame-persistence/src/main/java/org/encuestame/persistence/domain/tweetpoll/TweetPollSwitch.java

      * Short URL.
      */
     private String shortUrl;
+    
+    /**
+     * The relative time.
+     */
+    private String relativeUrl;
 
     /**
      * @return the switchId
     public void setDateUpdated(Date dateUpdated) {
         this.dateUpdated = dateUpdated;
     }
+    
+    
+
+    /**
+	 * @return the relativeUrl
+	 */
+    @Column(name = "relative_url", nullable = true, length = 400)
+	public String getRelativeUrl() {
+		return relativeUrl;
+	}
+
+	/**
+	 * @param relativeUrl the relativeUrl to set
+	 */
+	public void setRelativeUrl(final String relativeUrl) {
+		this.relativeUrl = relativeUrl;
+	}
 
-    /* (non-Javadoc)
+	/* (non-Javadoc)
      * @see java.lang.Object#toString()
      */
     @Override

File encuestame-utils/src/main/java/org/encuestame/utils/json/ProfileUserAccount.java

     @JsonProperty(value = "language")
     private String language;
 
+    @JsonProperty(value = "picture_source")
+    private String pictureSource;
 
     /**
      * @return the username
     public void setName(final String name) {
         this.name = name;
     }
+
+	/**
+	 * @return the pictureSource
+	 */
+    @JsonIgnore
+	public String getPictureSource() {
+		return pictureSource;
+	}
+
+	/**
+	 * @param pictureSource the pictureSource to set
+	 */
+	public void setPictureSource(String pictureSource) {
+		this.pictureSource = pictureSource;
+	}
+    
+    
 }

File encuestame-utils/src/main/java/org/encuestame/utils/json/TweetPollAnswerSwitchBean.java

     public QuestionAnswerBean answerBean;
     @JsonProperty(value = "short_url")
     public String shortUrl;
+    @JsonProperty(value = "relative_url")
+    public String relativeUrl;
     @JsonProperty(value = "results")
     public TweetPollResultsBean resultsBean;
 
     public void setResultsBean(TweetPollResultsBean resultsBean) {
         this.resultsBean = resultsBean;
     }
+
+	/**
+	 * @return the relativeUrl
+	 */
+    @JsonIgnore
+	public String getRelativeUrl() {
+		return relativeUrl;
+	}
+
+	/**
+	 * @param relativeUrl the relativeUrl to set
+	 */
+	public void setRelativeUrl(String relativeUrl) {
+		this.relativeUrl = relativeUrl;
+	}       
 }

File encuestame-utils/src/main/java/org/encuestame/utils/social/SocialProvider.java

     /**
      * Google Buzz provider.
      */
+    @Deprecated
     GOOGLE_BUZZ,
 
     /** Google +. **/
         else if (this == IDENTICA) { provider = "IDENTICA"; }
         else if (this == LINKEDIN) { provider = "LINKEDIN"; }
         else if (this == GOOGLE_BUZZ) { provider = "GOOGLEBUZZ"; }
+        else if (this == GOOGLE_PLUS) { provider = "GOOGLEPLUS"; }
         else if (this == YAHOO) { provider = "YAHOO"; }
         else if (this == MYSPACE) { provider = "MYSPACE"; }
         else if (this == ALL) { provider = "ALL"; }
         else if (this == FACEBOOK) { provider = "FACEBOOK"; }
         else if (this == IDENTICA) { provider = "IDENTICA"; }
         else if (this == LINKEDIN) { provider = "LINKEDIN"; }
-        else if (this == GOOGLE_BUZZ) { provider = "GOOGLE"; }
+        else if (this == GOOGLE_PLUS) { provider = "GOOGLEPLUS"; }
+        else if (this == GOOGLE_BUZZ) { provider = "GOOGLEBUZZ"; }
         else if (this == YAHOO) { provider = "YAHOO"; }
         else if (this == MYSPACE) { provider = "MYSPACE"; }
         return provider.toLowerCase();
         else if (socialProvider.equalsIgnoreCase("FACEBOOK")) { return FACEBOOK; }
         else if (socialProvider.equalsIgnoreCase("IDENTICA")) { return IDENTICA; }
         else if (socialProvider.equalsIgnoreCase("LINKEDIN")) { return LINKEDIN; }
-        else if (socialProvider.equalsIgnoreCase("GOOGLEBUZZ")) { return GOOGLE_BUZZ; }
+        else if (socialProvider.equalsIgnoreCase("GOOGLEPLUS")) { return GOOGLE_PLUS; }
         else if (socialProvider.equalsIgnoreCase("GOOGLE_BUZZ")) { return GOOGLE_BUZZ; }
         else if (socialProvider.equalsIgnoreCase("YAHOO")) { return YAHOO; }
         else if (socialProvider.equalsIgnoreCase("MYSPACE")) { return MYSPACE; }
                 || provider.equals(MYSPACE)
                 || provider.equals(YAHOO)){
             return TypeAuth.OAUTH1;
-        } else if (provider.equals(GOOGLE_BUZZ) || provider.equals(FACEBOOK)){
+        } else if (provider.equals(GOOGLE_PLUS) || provider.equals(GOOGLE_BUZZ) || provider.equals(FACEBOOK)){
             return TypeAuth.OAUTH2;
         } else {
             return null;

File encuestame-war/src/main/webapp/WEB-INF/jsp/includes/javascript.jsp

             domain : '<%=WidgetUtil.getDomain(request)%>',
             suggest_limit : 10,
             delay : 1800000,
+            message_delay : 5000,
             activity_levelDebug : "<%=EnMePlaceHolderConfigurer.getProperty("not.main.activity.levelDebug")%>",
             activity_maxConnections : <%=EnMePlaceHolderConfigurer.getProperty("not.main.activity.maxConnections")%>,
             activity_maxNetworkDelay : <%=EnMePlaceHolderConfigurer.getProperty("not.main.activity.maxNetworkDelay")%>,

File encuestame-war/src/main/webapp/WEB-INF/jsp/includes/web/menu.jsp

         </span>
     </div>
     <c:if test="${logged}">
-                           <div dojoType="encuestame.org.core.shared.utils.Toaster" duration="<%=EnMePlaceHolderConfigurer.getProperty("not.toaster.duration")%>"
-                             messageTopic="/encuestame/message/publish"
-                             positionDirection="<%=EnMePlaceHolderConfigurer.getProperty("not.toaster.position")%>"
-                             id="toasted_message">
-                      </div>    
+         <div dojoType="encuestame.org.core.shared.utils.Toaster" duration="<%=EnMePlaceHolderConfigurer.getProperty("not.toaster.duration")%>"
+           messageTopic="/encuestame/message/publish"
+           positionDirection="<%=EnMePlaceHolderConfigurer.getProperty("not.toaster.position")%>"
+           id="toasted_message">
+    </div>    
     </c:if>
 </div>

File encuestame-war/src/main/webapp/WEB-INF/messages/messages_en_US.properties

 ## Settings
 ###############################
 
-settings.social.title = Administrate your Social Network Accounts
+# Social Settings
+settings.social.title = Manage your Social Network Conexions
+settings_social_profile_url = Your public profile
+settings_social_tp_published_whith_this_account = TweetPoll published with this account
+settings_social_pll_published_whith_this_account = Polls published with this account
+settings_social_su_published_whith_this_account = Surveys published with this account
+settings_social_set_default = Set as default
+# Main Settings
 settings.config.title = Settings Configuration
 settings.config.myaccount = Account
 settings.config.upload.image = Image
 settings_config_profile_username_description =  Your public site.
 settings_config_profile_complete_name = Complate Name
 settings_config_profile_language = Select your language
+settings_config_profile_form_not_valid = Tus datos estan incompletos, revisalos antes de guardar
+settings_config_profile_success = Gracias, tu configuraci�n ha sido guardada.
 ## Upload Images
 settings_config_picture_title = Select your Source Picture
 settings_config_picture_description = Update the source of your image profile
 settings_config_picture_own = Uploaded Picture File
-settings_config_picture_restrictions = Choose one file from your computer (10 MB m\u221A�x.)
+settings_config_picture_restrictions = Choose one file from your computer (10 MB m\u221A\u00B0x.)
+settings_config_picture_success = Gracias, tu configuraci�n ha sido guardada.
 
 ###############################
 ## Details Options
 commons_detail_total_votes = Total Votes
 commons_detail_percent = % (Percent)
 commons_no_results = No results
+commons_success = Gracias, tu configuraci�n ha sido guardada.
+commons_favourite = Saved on your favorites list
+commons_unfavourite = Removed from your favorites list
 
 ###############################
 ## Social Picker
 ###############################
 ## Survey
 ###############################
-survey.section.name.default = Section by default
-survey.section.name.description.default = Section created by default 
+survey.section.name.default = Section by default
+survey.section.name.description.default  

File encuestame-war/src/main/webapp/WEB-INF/messages/messages_es_ES.properties

 ## Settings
 ###############################
 
+# Social Settings
 settings.social.title = Administra tus Cuentas de Redes Sociales
+settings_social_profile_url = Tu perfil publico
+settings_social_tp_published_whith_this_account = TweetPoll publicados con esta cuenta
+settings_social_pll_published_whith_this_account = Sondeos publicados con esta cuenta
+settings_social_su_published_whith_this_account = Encuestas publicados con esta cuenta
+settings_social_set_default = Establecer como predeterminado
+# Main Settings
 settings.config.title = Configuracion 
 settings.config.myaccount = Cuenta
 settings.config.upload.image = Imagen
 settings_config_profile_email_description = Tu correo personal, este correo nunca sera mostrado publicamente y solo se usara para notificaciones
 settings_config_profile_username = Nombre de Usuario
 settings_config_profile_username_description =  Enlace a tu perfil publico
-settings_config_profile_complete_name = Nombre completo
+settings_config_profile_complete_name = Tu nombre completo
 settings_config_profile_language = Idioma
+settings_config_profile_form_not_valid = Tus datos estan incompletos, revisalos antes de guardar
+settings_config_profile_success = Gracias, tu configuraci�n ha sido guardada.
 ## Upload Images
 settings_config_picture_title = Tu imagen de perfil
 settings_config_picture_description = Actualiza la fuente de tu imagen de perfil 
 settings_config_picture_own = Sube tu propia imagen
 settings_config_picture_restrictions =  Tama�o m�ximo 700k. JPG, GIF, PNG.
+settings_config_picture_success = Gracias, tu configuraci�n ha sido guardada.
+
 
 
 ###############################
 commons_detail_total_votes = Votos Totales
 commons_detail_percent = Porcentaje
 commons_no_results = No hay datos
+commons_success = Gracias, tu configuraci�n ha sido guardada.
+commons_favourite = Guardado en tu lista de favoritos
+commons_unfavourite = Eliminado de tu lista de favoritos
 
 ###############################
 ## Social Picker
 ## Survey
 ###############################
 survey.section.name.default = Seccion por defecto
-survey.section.name.description.default = Seccion creada por defecto
+survey.section.name.description.default = Seccion creada por defecto

File encuestame-war/src/main/webapp/WEB-INF/views/settings/web/account.jsp

 	<div id="upload_image_settings" 
 		dojoType="encuestame.org.core.commons.profile.UploadProfilePicture"
 		data-enabled="false"
+		username="${account.username}"
+		pictureSource="${account.pictureSource}"
 		data-label="<spring:message code="settings.config.upload.image" />"></div>
 </div>

File encuestame-war/src/main/webapp/WEB-INF/views/settings/web/settings.jsp

 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp"%>
 <c:if test="${not empty message}">
-      <div class="${message.infoType.css} mainError">${message.message}</div>
+	<div class="${message.infoType.css} mainError">${message.message}</div>
 </c:if>
-     <h1>
-         <spring:message code="settings.social.title" />
-    </h1>
-    <div dojoType="encuestame.org.core.commons.social.SocialAccounts"
-         domain="<%=WidgetUtil.getDomain(request)%>"
-     ></div>
+<h1>
+	<spring:message code="settings.social.title" />
+</h1>
+<div dojoType="encuestame.org.core.commons.social.SocialAccounts"
+	domain="<%=WidgetUtil.getDomain(request)%>"></div>
+

File encuestame-war/src/main/webapp/WEB-INF/views/tweetpoll/web/detail.jsp

                     <div class="answer"
                         dojoType="encuestame.org.core.commons.tweetPoll.detail.TweetPollAnswer"
                          aId="${a.answers.questionAnswerId}"
-                          color="${a.answers.color}"
+                         color="${a.answers.color}"
                          label="${a.answers.answer}"
-                          owner="${tweetpoll.ownerUsername}"
-                          completed="${tweetpoll.completed}"
-                          url="${a.shortUrl}">
-                     </div>
+                         owner="${tweetpoll.ownerUsername}"
+                         completed="${tweetpoll.completed}"
+                         url="<%=request.getContextPath()%>${a.relativeUrl}">
+                     </div>                     
                </c:forEach>
             </div>
        </section>

File encuestame-war/src/main/webapp/resource/css-compile/development.css

 @import url("layout.css");
 @import url("common.css");
 @import url("web/admon.css");
-@import url("web/button.css");
 @import url("web/default.css");
 @import url("web/menu.css");
 @import url("web/public.css");
 @import url("web/components/dropdown-menu.css");
 @import url("web/components/publish-support.css");
 
-@import url("web/components/settings.css");
+@import url("web/components/settings.css");
+@import url("web/components/social_settings.css");

File encuestame-war/src/main/webapp/resource/css-compile/web/components/button.css

 
 .enme-web-context  .dijitMenuActive .dijitMenuItemHover, .enme-web-context .dijitMenuActive .dijitMenuItemSelected {
 	background-color: none !important;
+}
+
+/** float messages window **/
+
+.enme-web-context .dijitToasterContent {
+	background: none repeat scroll 0 0 transparent !important;
+	padding: 0 !important;
+}
+
+.enme-web-context .dijitToasterContent .message_toaster {
+  border-radius: 5px 5px 5px 5px;
+  box-shadow: 1px 1px 1px 1px #C6C6C6;
+  color: black;
+  margin: 5px;
+  padding: 5px;
+  width: 200px;
+}
+
+.enme-web-context .dijitToasterContent .message_toaster > div {
+  color: white;
+  font-size: 13px;
+  font-weight: bold;
+}
+
+.enme-web-context .dijitToasterContent .message_toaster > div > p {
+  margin: 3px 0;
+}
+
+.enme-web-context  .dijitToasterContainer {
+    display: block;
+    font: 0.75em Tahoma,Helvetica,Verdana,Arial;
+    margin: 0;
+   width: 300px;
+}
+
+.enme-web-context  .dijitToasterFatal  .message_toaster {
+      background: none repeat scroll 0 0 red;
+      color: #FFFFFF;    	
+}
+
+.enme-web-context  .dijitToasterError  .message_toaster {
+      background: none repeat scroll 0 0 red;
+      color: #FFFFFF;    
+}
+
+.enme-web-context  .dijitToasterMessage .message_toaster {
+      background: none repeat scroll 0 0 #ACEBAE;
+      color: #FFFFFF;
+}
+
+.enme-web-context  .dijitToasterWarning .message_toaster {
+      background: none repeat scroll 0 0 yellow;
+      color: black;
+	
 }

File encuestame-war/src/main/webapp/resource/css-compile/web/components/social_settings.css

+/** Row Account */
+.socialWrapperRow {
+	font-size: 110%;
+	-moz-box-shadow: 1px 1px 3px #888888 inset;
+	-webkit-box-shadow: 1px 1px 3px #888888 inset;
+	box-shadow: 1px 1px 3px #888888 inset;
+	-webkit-border-radius: 2px 2px 2px 2px;
+	-moz-border-radius: 2px 2px 2px 2px;
+	border-radius: 2px 2px 2px 2px;
+	cursor: pointer;
+	overflow: auto;
+	background-color: #F9F9F9;
+	margin-bottom: 10px;
+}
+
+.socialWrapperRow .sub-title-account {
+	overflow: auto;
+}
+
+.socialWrapperRow .sub-title-account .image {
+	float: left;
+}
+
+.socialWrapperRow div.title {
+	font-size: 14px;
+	font-weight: bold;
+	margin-left: 30px;
+	padding: 5px;
+}
+
+.socialWrapperRow form {
+	padding: 10px;
+}
+
+.socialWrapperRow div.socialNewForm {
+	clear: both;
+	position: fixed;
+}
+
+.socialWrapperRow div.tokensWrapper {
+	padding: 5px;
+	border-top: 1px dotted;
+	overflow: auto;
+}
+
+.socialWrapperRow div.tokensWrapper div.tokenHideOptions {
+	min-height: 45px;
+}
+
+.socialWrapperRow div.tokensWrapper div.tokenHideOptions table{
+	
+}
+
+.socialWrapperRow div.tokensWrapper div.tokenHideOptions table tr{
+	
+}
+
+.socialWrapperRow div.tokensWrapper div.tokenHideOptions table td {
+  padding: 5px;
+}
+
+.socialWrapperRow div.tokensWrapper div.tokenHideOptions table td label {
+  color: #767676;
+  text-shadow: 1px 2px 1px #FFFFFF;
+}
+
+.socialWrapperRow  div.option-button {
+	text-align: right;
+	float: right;
+	font-size: 12px;
+}
+
+.socialWrapperRow div.tokensWrapper .dijitTextBox {
+	font-size: 100%;
+	min-width: 250px;
+}
+
+.socialWrapperRow div.tokensWrapper label {
+	font-weight: bold;
+	font-size: 90%;
+}

File encuestame-war/src/main/webapp/resource/css-compile/web/public.css

 
 
 
-/** Row Account */
-div.socialWrapperRow {
-    font-size: 110%;
-    -moz-box-shadow: inset 0px 1px 1px #888;
-    -webkit-box-shadow: inset 0px 1px 1px #888;
-    box-shadow: inset 0px 1px 1px #888;
-    -webkit-border-radius: 2px 2px 2px 2px;
-    -moz-border-radius: 2px 2px 2px 2px;
-    border-radius: 2px 2px 2px 2px;
-    cursor: pointer;
-    overflow: auto;
-    background-color: #F9F9F9;
-    margin-bottom: 10px;
-}
-
-div.socialWrapperRow .sub-title-account {
-    overflow: auto;
-}
-
-div.socialWrapperRow .sub-title-account .image {
-    float: left;
-}
-
-div.socialWrapperRow div.title {
-    font-size: 14px;
-    font-weight: bold;
-    margin-left: 30px;
-    padding: 5px;
-}
 
-div.socialWrapperRow form {
-    padding: 10px;
-}
-
-div.socialWrapperRow div.socialNewForm {
-    clear: both;
-    position: fixed;
-}
-
-div.socialWrapperRow div.tokensWrapper {
-    padding: 5px;
-    border-top: 1px dotted;
-}
-
-div.socialWrapperRow div.tokensWrapper div.tokenHideOptions {
-    min-height: 45px;
-}
-
-div.socialWrapperRow  div.option-button {
-    text-align: right;
-    float: right;
-    font-size: 12px;
-}
-
-div.socialWrapperRow div.tokensWrapper .dijitTextBox {
-    font-size: 100%;
-    min-width: 250px;
-}
-
-div.socialWrapperRow div.tokensWrapper label {
-    font-weight: bold;
-    font-size: 90%;
-}
 
 /** gadget **/
 div.web-gadget {

File encuestame-war/src/main/webapp/resource/js/core/lib/constants.js

 				HASHTAGRATED :	"HASHTAGRATED",
 				// default status
 				STATUS : ['SUCCESS','FAILED', 'STAND_BY', 'RE_SCHEDULED', 'RE_SEND'],
+				// messages
+				MSG : {
+					SUCCESS : 'success',
+					ERROR : 'error',
+					WARN : 'warn',
+					FATAL : 'fatal'
+				},
 				// type of surveys   
 				TYPE_SURVEYS : ['TWEETPOLL', 'POLL', 'SURVEY', 'HASHTAG'],
 				//image sizes

File encuestame-war/src/main/webapp/resource/js/core/lib/messages.js

-ENME.namespace("ENME.messages");
+ENME.namespace("ENME.messages");
+
+/*
+ * List of constants used on user interface.
+ */
+ENME.messages = ( function(d, _e) {
+		// channel to publish
+		var channel = '/encuestame/message/publish';
+		// get the configuration default
+		var duration = _e.config('message_delay') || 5000;
+		// message type
+		var	messageTypes = {
+			MESSAGE: "message",
+			WARNING: "warning",
+			ERROR: "error",
+			FATAL: "fatal"
+		};
+		
+		/**
+		 * 
+		 */
+		var _publish = function(message, description, type) {
+			description === null ? "" : description;
+			if (typeof(message === 'string')) {
+				  d.publish(channel, [{
+					  message: message, 
+					  type: type, 
+					  duration: duration,
+					  description : description					  
+				  }]);
+			}
+		};
+	
+		var fn = {
+				success : function (message, description) {
+					_publish(message, description, messageTypes.MESSAGE);
+				},
+				
+				warning : function (message, description) {
+					_publish(message, description, messageTypes.WARNING);
+				},
+				
+				error : function (message, description) {
+					_publish(message, description, messageTypes.ERROR);
+				},
+				
+				fatal : function (message, description) {
+					_publish(message, description, messageTypes.FATAL);
+				}
+		};
+			
+		return fn;
+})(dojo, ENME);

File encuestame-war/src/main/webapp/resource/js/encuestame/org/core/commons/profile/Profile.js

 dojo.require("dijit.form.Select");
 dojo.require("dijit.form.Button");
 dojo.require("dijit.form.Form");
+dojo.require("dojox.form.BusyButton");
 
 dojo.require("encuestame.org.main.EnmeMainLayoutWidget");
 
          */
         postCreate : function() {
         	// create subcribe to display errors.
-        	dojo.subscribe("/encuestame/settings/profile/message", this, this._displayMessage);                                   
+        	dojo.subscribe("/encuestame/settings/profile/message", this, this._displayMessage);    
+        	this.events();
         },
         
         /**
                 //console.debug("change");
                 email.validateBackEnd("email");
             });
+            email.onKeyPress = dojo.hitch(this, function() {
+            	console.info("PRESSS");
+            });
+            email.onKeyDown = dojo.hitch(this, function() {
+            	console.info("onKeyDown");
+            });            
             var username = dijit.byId("username");
             username.onChange = dojo.hitch(this, function() {
                 //console.debug("change");
          * 
          */
         _displayMessage : function(message, type) {
-        	console.debug("_displayMessage");
+        	if (type === 'error') {
+        		this.errorMessage(message);
+        	} else if (type === 'success') {
+        		this.successMesage(message);
+        	}
         },
 
         /*
                     if (profile != null) {
                         var email = dijit.byId("email");
                         email.set('value', profile.email);
-                        console.info("EMAIL");
+                        //console.info("EMAIL");
                         var username = dijit.byId("username");
                         username.set('value', profile.username);
-                        console.info("USERNAMe");
+                        //console.info("USERNAMe");
                         var completeName = dijit.byId("completeName");
                         completeName.set('value', profile.name);
                     }
             if (formDijit.isValid()) {
                 var load = dojo.hitch(this, function(data) {
                     //console.debug(data);
-                	this.successMesage("Saved");
+                	if ("success" in data) {
+                		var message = data.success.message;
+                		if (message != 'undefined') {
+                			dojo.publish('/encuestame/settings/profile/message', [message, 'success']);
+                		}
+                	}
+                	this._submit.cancel();
                 });
-                var error = function(error) {
+                var error = dojo.hitch(this,function(error) {
                     //console.debug("error", error);
-                };
+                	dojo.publish('/encuestame/settings/profile/message', [error.message, 'error']);
+                	this._submit.cancel();
+                });
                 //var query = {};
                 //query.username =  dijit.byId("username").get("value") ;
                 //query.email = dijit.byId("email").get("value");
                 //var queryStr = dojo.objectToQuery(query);
                 encuestame.service.xhrPost(encuestame.service.list.updateProfile, form, load, error, true);
             } else {
-                console.info("form not valid");
+            	dojo.publish('/encuestame/settings/profile/message', [ENME.getMessage('settings_config_profile_form_not_valid'), 'error']);
             }
         }
 });
                     //console.debug("set error message");
                     dojo.publish('/encuestame/settings/profile/message', [message, 'error']);
                 } else {
-                	 dojo.publish('/encuestame/settings/profile/message', ["Updated", 'success']);
+                	 var message = response.success.messages[type] || "Not Defined";
+                	 dojo.publish('/encuestame/settings/profile/message', [message, 'success']);
                 }                
             });
             var error = function(error) {

File encuestame-war/src/main/webapp/resource/js/encuestame/org/core/commons/profile/UploadProfilePicture.js

 dojo.require("dijit.form.RadioButton");
 dojo.require("encuestame.org.core.shared.utils.AccountPicture");
 dojo.require("dojox.form.FileUploader");
+dojo.require("encuestame.org.main.EnmeMainLayoutWidget");
 
 dojo.require("encuestame.org.core.commons.profile.ProfileSupport");
 
 */
 dojo.declare(
    "encuestame.org.core.commons.profile.UploadProfilePicture",
-   [dijit._Widget, dijit._Templated],{
+   [encuestame.org.main.EnmeMainLayoutWidget],{
        templatePath: dojo.moduleUrl("encuestame.org.core.commons.profile", "templates/profilePicture.html"),
 
-    widgetsInTemplate : true,
-
     contextPath : encuestame.contextDefault,
     
     i18nMessage : {
 
     imagePath : '/',
 
-    _uploadImage : function(event){
+    /**
+     * Trigger upload the image.
+     * @param event
+     */
+    _uploadImage : function(event) {
         this.uploadImage();
     },
 
     /**
      *
      */
-    postCreate : function(){
-        console.debug("UploadProfilePicture", this.pictureSource);
+    postCreate : function() {
         if (this.username != null) {
             this._reloadPicture();
         }
         var radioGravatar = dijit.byId("gravatar_radio");
-        if (this.pictureSource == "gravatar") {
+        if (this.pictureSource == "GRAVATAR") {
             radioGravatar.value('checked', true);
         }
-        radioGravatar.onChange = dojo.hitch(this, function(e){
+        radioGravatar.onChange = dojo.hitch(this, function(e) {
              if (e) {
                  this._updatePictureSource("gravatar");
                  dojo.addClass(this._uploadedForm, "defaultDisplayHide");
              }
-        });
+        });                
         var uploadedRadio = dijit.byId("uploaded_radio");
-        if (this.pictureSource == "uploaded") {
-            uploadedRadio.value('checked', true);
+        if (this.pictureSource === 'UPLOADED') {
+        	uploadedRadio.set('checked', true);
         }
-        uploadedRadio.onChange = dojo.hitch(this, function(e){
-             if(e){
-                 this._updatePictureSource("uploaded");
-                 dojo.removeClass(this._uploadedForm, "defaultDisplayHide");
-             }
-        });
+    },
+    
+    startup : function () {
+    	var uploadedRadio = dijit.byId("uploaded_radio");
+        uploadedRadio.onChange = dojo.hitch(this, function(e) {
+            if(e){
+                this._updatePictureSource("uploaded");
+                dojo.removeClass(this._uploadedForm, "defaultDisplayHide");
+            }
+       });
+
     },
 
     /*
        console.debug("params", params);
        var load = dojo.hitch(this, function(data) {
            this._reloadPicture();
+           this.successMesage(data.success.message);
        });
        var error = function(error) {
-           console.error(error);
+           //console.error(error);
+           this.errorMessage(error.message);
        };
        encuestame.service.xhrPostParam(
                encuestame.service.list.updatePicture, params, load, error);
      */
     _reloadPicture : function(){
         dojo.empty(this._pictureWrapper);
-        console.debug("_reloadPicture");
-        var textData = new encuestame.org.core.shared.utils.AccountPicture({username : this.username, picture_width :"128",
+        //console.debug("_reloadPicture");
+        var textData = new encuestame.org.core.shared.utils.AccountPicture({
+        	username : this.username, 
+        	picture_width :"128",
             picture_height : "128", type : "default"}, "a");
-        console.log("textData", textData.domNode);
+        //console.log("textData", textData.domNode);
         this._pictureWrapper.appendChild(textData.domNode);
     },
 
      */
     uploadImage : function() {
         dojo.io.iframe.send({
-            url: this.contextPath+"/file/upload/profile",
+            url: this.contextPath + "/file/upload/profile",
             form : "imageForm",
             handleAs : "html",
             method: "POST",
                 }
             }),
             timeoutSeconds: 2000,
-            error: function (res,ioArgs) {
+            error: dojo.hitch(this,function (res,ioArgs) {
                 console.error("handle error: " + res);
                 console.error("handle error: " + ioArgs);
-            },
+                this.errorMessage("error");
+            }),
             // Callback on successful call:
-            load: function(response, ioArgs) {
+            load: dojo.hitch(this, function(response, ioArgs) {
                 // do something
                 // ...
                 console.debug("response: " + response);
                 console.debug("ioArgs: " + ioArgs);
+                this.successMesage(response);
                 // return the response for succeeding callbacks
                 return response;
-            }
+            })
         });
     }
 

File encuestame-war/src/main/webapp/resource/js/encuestame/org/core/commons/profile/templates/profile.html

                             validateType="username"
                             maxLength="18"
                             value="${username}"
-                            regExp="[\w]+" required="false" invalidMessage="Invalid username">
+                            regExp="[\w]+" required="false" 
+                            invalidMessage="Invalid username">
                     <p class="info-block">
                         ${i18nMessage.settings_config_profile_username_description} <a href="#">http://demo.encuestame.org/profile/username</a>
                     </p>
              </div>
              <div class="web-settings-account-row" style="">
                    <div class="settings-submit">
-                        <button dojoType="dijit.form.Button" type="button" dojoAttachEvent="onClick:_updateProfile">
-                            ${i18nMessage.commons_update}
-                        </button>
+                        <button dojoType="dojox.form.BusyButton"