Wednesday, May 14, 2014

Login Page





==============================CSS CODING==================

--->COPY THE CSS CODE AND SAVE INOT ONE ZIP FILE NAME IS LOGINSTYLE.

<-----------------CSS CODE===============>
<style>
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}

body {
  line-height: 1;
}

ol, ul {
  list-style: none;
}

blockquote, q {
  quotes: none;
}

blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

.about {
  margin: 70px auto 40px;
  padding: 8px;
  width: 260px;
  font: 10px/18px 'Lucida Grande', Arial, sans-serif;
  color: #bbb;
  text-align: center;
  text-shadow: 0 -1px rgba(0, 0, 0, 0.3);
  background: #383838;
  background: rgba(34, 34, 34, 0.8);
  border-radius: 4px;
  background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
  background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
  background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
  -webkit-box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 6px rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 6px rgba(0, 0, 0, 0.4);
}
.about a {
  color: #eee;
  text-decoration: none;
  border-radius: 2px;
  -webkit-transition: background 0.1s;
  -moz-transition: background 0.1s;
  -o-transition: background 0.1s;
  transition: background 0.1s;
}
.about a:hover {
  text-decoration: none;
  background: #555;
  background: rgba(255, 255, 255, 0.15);
}

.about-links {
  height: 30px;
}
.about-links > a {
  float: left;
  width: 50%;
  line-height: 30px;
  font-size: 12px;
}

.about-author {
  margin-top: 5px;
}
.about-author > a {
  padding: 1px 3px;
  margin: 0 -1px;
}

::-moz-focus-inner {
  padding: 0;
  border: 0;
}

:-moz-placeholder {
  color: #bcc0c8 !important;
}

::-webkit-input-placeholder {
  color: #bcc0c8;
}

:-ms-input-placeholder {
  color: #bcc0c8 !important;
}

body {
  font: 12px/20px 'Lucida Grande', Verdana, sans-serif;
  color: #404040;
}

input, textarea, select, label {
  font-family: inherit;
  font-size: 12px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.login {
  margin: 50px auto;
  padding: 18px 20px;
  width: 270px;
  background: #3f65b7;
  background-clip: padding-box;
  border: 1px solid #172b4e;
  border-bottom-color: #142647;
  border-radius: 5px;
  background-image: -webkit-radial-gradient(cover, #437dd6, #3960a6);
  background-image: -moz-radial-gradient(cover, #437dd6, #3960a6);
  background-image: -o-radial-gradient(cover, #437dd6, #3960a6);
  background-image: radial-gradient(cover, #437dd6, #3960a6);
  -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 10px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 10px rgba(0, 0, 0, 0.5);
}
.login > h1 {
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: bold;
  color: white;
  text-align: center;
  text-shadow: 0 -1px rgba(0, 0, 0, 0.4);
}

.login-input {
  display: block;
  width: 100%;
  height: 37px;
  margin-bottom: 20px;
  padding: 0 9px;
  color: white;
  text-shadow: 0 1px black;
  background: #2b3e5d;
  border: 1px solid #15243b;
  border-top-color: #0d1827;
  border-radius: 4px;
  background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2) 20%, rgba(0, 0, 0, 0));
 background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2) 20%, rgba(0, 0, 0, 0));
  background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2) 20%, rgba(0, 0, 0, 0));
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2) 20%, rgba(0, 0, 0, 0));
  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.2);
}
.login-input:focus {
  outline: 0;
  background-color: #32486d;
  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 4px 1px rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 4px 1px rgba(255, 255, 255, 0.6);
}
.lt-ie9 .login-input {
  line-height: 35px;
}

.login-submit {
  display: block;
  width: 100%;
  height: 32px;
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: bold;
  color: #294779;
  text-align: center;
  text-shadow: 0 1px rgba(255, 255, 255, 0.3);
  background: #adcbfa;
  background-clip: padding-box;
  border: 1px solid #284473;
  border-bottom-color: #223b66;
  border-radius: 4px;
  cursor: pointer;
  background-image: -webkit-linear-gradient(top, #d0e1fe, #96b8ed);
  background-image: -moz-linear-gradient(top, #d0e1fe, #96b8ed);
  background-image: -o-linear-gradient(top, #d0e1fe, #96b8ed);
  background-image: linear-gradient(to bottom, #d0e1fe, #96b8ed);
  -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), inset 0 0 7px rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), inset 0 0 7px rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.15);
}
.login-submit:active {
  background: #a4c2f3;
  -webkit-box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.4), 0 1px rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.4), 0 1px rgba(255, 255, 255, 0.1);
}

.login-help {
  text-align: center;
}
.login-help > a {
  font-size: 11px;
  color: #d4deef;
  text-decoration: none;
  text-shadow: 0 -1px rgba(0, 0, 0, 0.4);
}
.login-help > a:hover {
  text-decoration: underline;
}
body input.btn {
    font-size:15px;
}
</style>
<=============END OF CSS CODE==================>
<=============VISUALFORCE PAGE=====================>
<apex:page showHeader="false" controller="LoginController1">
  <apex:stylesheet value="{!URLFOR($Resource.LoginStyle, 'LoginStyle.css')}" />
  <html lang="en">
        <head>
            <meta charset="utf-8"/>
            <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
            <title>Login</title>
        </head>
        <body>
        <apex:form styleClass="login">
           <img src="http://www2.sfdcstatic.com/common/assets/img/logo-company.png"/><br/>
              <h1>Login</h1><br/><br/>
                <apex:pageMessages id="pageMsg"/>
                <apex:outputLabel value="UserName" style="color:white;font-size:14px;"/>
                <apex:inputText value="{!emailId}" styleClass="login-input"/>
                <apex:outputLabel value="Password"  style="color:white;font-size:14px;"/>
                <apex:inputSecret value="{!password}" styleClass="login-input"/>
                <apex:commandButton value="Login" action="{!login}" styleClass="login-submit"/>
                 </apex:form>
        </body>
    </html>

</apex:page>
<=================END OF VFPAGE=====================>
<==============CONTROLLER CALSS=====================>
  public with sharing class LoginController1 {
  public LoginController1 (){
  }
  
  public String emailId { get; set; }  
  public String password { get; set; }
  public List<contact> con{set;get;}
  public PageReference login() {
     if(emailId != Null && emailId != '' && password != Null && password != '') {
            con=[ Select Email, Password__c From Contact Where Email =: emailId LIMIT 1];
             if(con.size() > 0) {
                 if( con[0].Password__c.compareTo(password) == 0) {
                   return page.googleINT;
                 }
                 else{
                   ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'ERROR MESSAGES' ));
                 }
            }
     }       
     return null;            
  } 
}
<===============END OF CONTROLLER CLASS==============>

Friday, May 2, 2014

Sending Mail TO Multiple Users Throw visualforce page and also attach the document.

===================Visulforce page===================================
<apex:page controller="mailcon">
  <style>
.right
{
position:absolute;
right:10px;
width:300px;
background-color:#b0e0e6;

}
.ashok{
background-color:lightblue;
font-size:20px;
color: #FF7C00;
content: "\f00c";
font-family: FontAwesome;
text-decoration: none;
}

</style>
 <apex:form >
 <apex:messages styleClass="ashok"/>
  <apex:pageBlock title="Send mails to user" id="pb">
   <apex:pageBlockSection columns="3">
    <apex:commandButton value="Send Mail" action="{!snd}" rendered="{!sndcon}"/>
    <apex:commandButton value="back" action="{!bck}"/>
    <apex:commandButton value="Send Mass Mail" action="{!sndmail}"/>
   
   </apex:pageBlockSection>
  </apex:pageBlock>
  <apex:pageBlock rendered="{!pbcon}" >
   <apex:pageblockSection >
   <apex:outputText rendered="{!Con}" style="color:blue"> Message Has been sent successfully</apex:outputText><br/>
    <apex:inputText value="{!name}" label="Email Single Address" size="100" style="color:green"/><br/>
   
    <apex:inputTextarea value="{!body}" label="Body"/>
   
      <div class="right">
  <apex:inputFile value="{!attach.body}" filename="{!attach.name}" contentType="appicationtype/ms.word"/><br/>
      </div>
    <apex:commandButton value="Send" action="{!snd1}"/>
   </apex:pageblockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

======================Controller============================
public with sharing class mailcon {
   public Attachment attach {get;set;}
    public PageReference bck() {
        return page.mailTomultipulUsers;
        //return null;
    }


    public boolean pbcon { get; set; }

    public boolean sndcon { get; set; }
public mailcon (){
pbcon=false;
sndcon=true;
con=false;}

    public boolean Con { get; set; }

    public PageReference sndmail() {
   
        return null;
    }


    public String body { get; set; }

    public String name { get; set; }
   
 
 

    public  void snd1() {
   
    integer count=0;
        String str=name + ',';
        List<String> li=new List<String>();
        while(str.contains(',')){
       
          count++;
          String[] str1=str.split(',',2);
          system.debug('............'+str1);
              li.add(str1[0]);
          str=str1[1];

         
      }
     
     
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

        String[] toAddresses = new String[] {};
           for(integer i=0;i<count;i++){
             toAddresses.add(li[i]);

        }
        String myString = 'StringToBlob';
Blob b = Blob.valueof(myString);
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('attachment.pdf');
efa.setBody(b);


        mail.setToAddresses(toAddresses);
        mail.setSubject('Email from VF page');
        mail.setPlainTextBody(body);
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
       
        try{
       Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        con=true;
    }
    catch (Exception e){
    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Sorry... Enter Proper Email Id'));
    }
      name=null;
      body=null;
   
   
     
       
    }


    public PageReference snd() {
     pbcon =true;
   // sndcon=false;
        return null;
    }

}