• tankgirlrs
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 10
    Replies

I am trying to mimick some behavior I had with an s-control with visual force. If you place a custom button that links to an s-control and then specify that you want the side bar for example, you could link to a page without header and side bar refershing.

 

So I made a visual force page that I added to my account page layout and there I place a link or button. I tried with the commandlink and commandbutton that reference an action on my controller and the action returns a PageReference to a second visual force page. If I specify nothing then the page goes into the iframe in the account detail, not the idea, so I would need to add target=_top and force a client side redirect. However then the entire page is refreshed which makes it seem much slower than the original behavior with the s-control where only the account detail itself was refreshed. How can I obtain the same behavoir as the s-control linked to a custom button?

In my class I have a PageReference that does a SOSL search and I have a try catch block around it (purely for the off sinaro that search itself might fail...) but my code around it checks for null and if it is less than 3 in lenght.... so i cant seem to find a way to cover that block. Do i even need the try{} catch{} at this point?

 

Here is my method:

 

/*SOSL search for cases/contacts with the phone number in the param*/ public PageReference getCaseData(){ string p = getAniParam(); if(randishelperclass.checkIfNullOrEmpty(p)){ if(p.length() > 3){ string ph = p + '*'; try{ List<List<sObject>> searchlist = [find :ph IN PHONE FIELDS RETURNING Case (id,casenumber,SuppliedPhone,subject,product__c,contact.name,contact.id,status,LastModifiedDate ORDER by LastModifiedDate desc limit 25),Contact(id, phone, email, name ORDER by name desc limit 25) limit 50]; cseResults = ((List<Case>)searchlist[0]); conResults = ((List<Contact>)searchlist[1]); if(cseResults.size() > 0 && conResults.size() > 0){ renderCseResults = true; renderConResults = true; bRendered = false; }else if(cseResults.size() > 0 && conResults.size() == 0){ renderConResults = false; renderCseResults = true; bRendered = true; }else if(cseResults.size() == 0 && conResults.size() > 0){ renderConResults = true; renderCseResults = false; bRendered = false; } return null; }catch(exception e){ ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Fatal , 'Oops... ' + e); ApexPages.addMessage(msg); return null; } }else{ PageReference ref = new PageReference('/apex/ticketquickcreate?CAS=1'); ref.setRedirect(true); return ref; } }else{ PageReference ref = new PageReference('/apex/ticketquickcreate?CAS=1'); ref.setRedirect(true); return ref; } }

 

 

 

I have an extension class that i cant seem to test fully. It all stops on one method getContactId().

 

Here is my Extention Class:

 

public with sharing class FieldAccounts {

/*get the current case id*/
Private Final Case cse;

public FieldAccounts(ApexPages.StandardController stdController){
this.cse = (Case)stdController.getRecord();
}

public string getCaseId(){
return cse.id;
}

public boolean popWindow;
public Boolean tiedToAccount;
public boolean chooseAccount;

/*get the contact Info*/
public String contactId;
public String cseNumber;

public string getContactInfo(String cid){
Case[] cseconid = [select id, contactid, CaseNumber from Case where id = :cid];
contactId = cseconid[0].ContactId;
cseNumber = cseconid[0].CaseNumber;
return null;
}
/*get the contact ID*/
public string getContactId(){
getContactInfo(getCaseId());
return contactId;
}
/*get the case number*/
public string getCseNumber(){
getContactInfo(getCaseId());
return cseNumber;
}
/*see if the contact belongs to a vip account*/
public string faId;

public string getFaId(){
String conId = getContactId();
if(conId != null){
Contact[] con = [select id, logmein__Field_Account__r.Id from Contact where id = :conId limit 1];
faId = con[0].logmein__Field_Account__r.id;
if(faId != null && faId.length() > 1){
tiedToAccount = true;
popWindow = true;
}else{
tiedToAccount = false;
getContactEmail();
}return faId;
}else{return null;}
}
/*see if it is tied to a field account*/
public boolean getTiedToAccount(){
getFaId();
return tiedToAccount;
}

/*get the email address of the contact*/
public string contactEmail;

public string getContactEmail(){
String conId = getContactId();
if(conId != null){
Contact[] vCon = [select id, email from Contact where id = :conId limit 1];
if (vCon.size() != 0 && vCon != null){
contactEmail = vCon[0].email;
}
return contactEmail;
}else{return null;}
}

/*extract the domain from the contacts email*/
public String emailDomain;

public string getEmailDomain(){
string conE = getContactEmail();
if(conE != null){
contactUtils cUtils = new contactUtils();
String emailDomain = cUtils.getDomainFromEmail(conE);
//emailDomain = '%' + emailDomain + '%';
return emailDomain;
}else{return null;}
}

/*see if there are any field accounts that match that domain*/
public string accIds;
public string getAccIds(){
string eDom = getEmailDomain();
if(eDom != null){
FieldAccount__c[] fieldacc = database.query('select id from FieldAccount__c where domain__c like ' + '\'%' + eDom + '%\'');
if(fieldacc.size() > 0 ){
popWindow = true;
}
return accIds;
}else{popWindow = false; return null;}
}
/*see if the alert will fire*/
public boolean getPopWindow(){
getAccIds();
return popWindow;
}
public String getFAPageURL(){
PageReference pageRef= new PageReference('/apex/FieldAccounts');
return pageRef.getUrl();
}
public String getFACPageURL(){
PageReference pageRef= new PageReference('/apex/FieldAccountChoose');
return pageRef.getUrl();
}

}

 

 My exten test class so far(since it is returning null on getting the contact id)

 

public with sharing class FieldAccountsTest {
/*create a fa account*/
public FieldAccount__c[] createNewFAccount(string faname, string dom){
FieldAccount__c[] ac = new FieldAccount__c[0];
ac.add(new FieldAccount__c(name = faname, domain__c = dom));
insert ac;
return ac;
}

/*get the id*/
public String faccountid;

public String getFAccountid(string faname){
FieldAccount__c[] getid = [select id from FieldAccount__c where name = :faname limit 1];
faccountid = getid[0].id;
return faccountid;
}
/*create a account*/
public Account[] createNewAccount(string aname){
Account[] ac = new Account[0];
ac.add(new Account(name = aname));
insert ac;
return ac;
}
/*get the id*/
public String accountid;

public String getAccountid(string aname){
Account[] getid = [select id from Account where name = :aname limit 1];
accountid = getid[0].id;
return accountid;
}
/*add contacts to the account*/
public Contact[] createNewContact(String name, String lastname, String email, String acId){
Contact[] nc1 = new Contact[0];
nc1.add(new Contact(firstname = name, lastname = lastname, email = email, AccountId = acId));
insert nc1;
return nc1;
}
/*get the contact id*/
public string contactId;

public String getContactId(String cemail){
Contact[] cid = [select id from Contact where email = :cemail];
contactId = cid[0].id;
return contactId;
}
/*create a case under the first contact*/
public Case[] createNewCase(String email, String name, String product, String subject, String description, String origin){
Case[] cse = new Case[0];
cse.add(new Case(contactemail__c = email, SuppliedName = name, Product__c = product, Subject = subject, Description = description, Origin = origin));
insert cse;
return cse;
}
public string cseid;

public string getCaseId(string cemail){
case[] cid = [select id from case where contactemail__c =:cemail];
cseid = cid[0].id;
return cseid;
}
public string csenum;

public string getCsenum(string cemail){
case[] cid = [select id, CaseNumber from case where contactemail__c =:cemail];
csenum = cid[0].CaseNumber;
return csenum;
}
/*Get user info for testing*/
public string curUserId = UserInfo.getUserId();
public string getCurUserId(){
return curUserId;
}
public string curUserName;
public string curUserEmail;
public string getUserInfo(){
user[] info = [select id, name, email from User where id =:curUserId];
curUserName = info[0].name;
curUserEmail = info[0].email;
return null;
}
public string getCurUserName(){
getUserInfo();
return curUserName;
}
public string getCurUserEmail(){
getUserInfo();
return curUserEmail;
}
static testmethod void testGetContactInfo(){
FieldAccountsTest t = new FieldAccountsTest();
t.createNewFAccount('ge', '@ge.com');
string facid = t.getFAccountid('ge');

t.createNewAccount('accountone');
string acid = t.getAccountid('accountone');

t.createNewContact('Joe', 'shmo', 'js@ge.com', acid);
String cId = t.getContactId('js@ge.com');

Case cse = new Case(contactemail__c = 'js@ge.com',SuppliedName = 'joe shmo',Product__c = 'Logmein Rescue',Subject = 'help',Description = 'need some help', Origin ='email');
insert cse;
ApexPages.StandardController sc = new ApexPages.StandardController(cse);
string cseId = t.getCaseId('js@ge.com');
string cseNum = t.getCsenum('js@ge.com');

FieldAccounts f = new FieldAccounts(sc);

system.assertEquals(cseId, f.getCaseId());
f.getContactInfo(cseId);
system.assertEquals(cId, f.getContactId());
system.assertEquals(cseNum, f.getCseNumber());
f.getFaId();
system.assertEquals(false, f.getTiedToAccount());
f.getContactEmail();
system.assertEquals('js@ge.com', f.getContactEmail());
system.assertEquals('@ge.com', f.getEmailDomain());
system.assertEquals('/apex/logmein__FieldAccountChoose', f.getFACPageURL());
system.assertEquals('/apex/logmein__FieldAccounts', f.getFAPageURL());
}

}

 

 in the part

system.assertEquals(cId, f.getContactId());

f.getContactId() returns null. When i dig deeper, i found that even though 'system.assertEquals(cseId, f.getCaseId());' works and returns the case Id, in the getContactId() method it is null (only for the test class).

 

This is my first class extension that i have had to test, and all of my normal test classes that have very simular metods, if not the same, work. WTF???

 

Please i need some help!!

Message Edited by tankgirlrs on 01-11-2010 02:12 PM

In my page I have a background image that is set to repeat-x and it work perfectly in FireFox, but in IE, not so much.

 

On my site, I made a template page that all my other pages sit in using the <apex:composition template="myTemplate"> and  <apex:define name="somesection">. On one of the pages I have a list displaying the cases on that person's account (the one logged into the site) and I made links so they can see just there cases or all the account cases and then just open or just closed, so each time the user clicks on the link, the cases list rerenders. And you can imagine that some of the lists are longer than others, depending on the account. 

Before

In IE (compatibility mode and non compatibility mode...havent even looked at IE6)this is what seems to be happening:

After

The background image loads all the way to the bottom of the page on page load, on first rerender, it only loads to the shortest list and the rest of the page has a white background. 

 

has anyone see this or something like it? 

Message Edited by tankgirlrs on 12-07-2009 02:54 PM
Message Edited by tankgirlrs on 12-07-2009 02:55 PM
Message Edited by tankgirlrs on 12-08-2009 04:48 PM

I have created a customer portal for our VIP accounts with force.com sites, so they can log in and see any tickets(cases) under there account, and be able to submit new ones or add comments or attachments to current ones.

 

I have managed to create all of it with no trouble, except for the attachments piece. I can't even display existing attachments that may be on the ticket(case), it errors out the page. I am wondering if there is any sort of permissions issue with seeing attachments and sites/portal users? 

 

I have the table set up to only render if there is results from the query, and the table shows, but the data wont(since I have to make the get method return null.... Or the page wont load...)

 

here is the code I am using to get the existing attachments:

 

//get the id of the case so we can look for attachments in it
String pageid = ApexPages.currentPage().getParameters().get('id');
public string getPageid(){
return pageid;
}
//set the table to false so it wont show unless there is data
Boolean renderattachmentlist = false;
//run the query and render the list if there is data
public Boolean getRenderattachmentlist(){
getAttachmentResults();
return renderattachmentlist;
}
//select the attachment data to be shown from the case
public Attachment[] getAttachmentResults(){
Attachment[] attachmentInfo = [Select ParentId, Name, Id, CreatedDate, CreatedById From Attachment where ParentId = :pageid ORDER BY CreatedDate DESC];
//if there is data show the list
if(attachmentInfo.size() > 0){
renderattachmentlist = true;
}
return attachmentInfo;
}

 at the end of the getAttachmentResults() method I have it set to return null since the page wont load if I leave it as shown above.

 

Since I can't even get the existing attachments to show I figure it must be some sort of permissions issue. Can this be changed or fixed? 

 

The other piece that isn't working is adding new attachments, but I figure its for the same reason as above....

 

HELP!


 

Message Edited by tankgirlrs on 12-01-2009 09:56 AM

In my class I have a PageReference that does a SOSL search and I have a try catch block around it (purely for the off sinaro that search itself might fail...) but my code around it checks for null and if it is less than 3 in lenght.... so i cant seem to find a way to cover that block. Do i even need the try{} catch{} at this point?

 

Here is my method:

 

/*SOSL search for cases/contacts with the phone number in the param*/ public PageReference getCaseData(){ string p = getAniParam(); if(randishelperclass.checkIfNullOrEmpty(p)){ if(p.length() > 3){ string ph = p + '*'; try{ List<List<sObject>> searchlist = [find :ph IN PHONE FIELDS RETURNING Case (id,casenumber,SuppliedPhone,subject,product__c,contact.name,contact.id,status,LastModifiedDate ORDER by LastModifiedDate desc limit 25),Contact(id, phone, email, name ORDER by name desc limit 25) limit 50]; cseResults = ((List<Case>)searchlist[0]); conResults = ((List<Contact>)searchlist[1]); if(cseResults.size() > 0 && conResults.size() > 0){ renderCseResults = true; renderConResults = true; bRendered = false; }else if(cseResults.size() > 0 && conResults.size() == 0){ renderConResults = false; renderCseResults = true; bRendered = true; }else if(cseResults.size() == 0 && conResults.size() > 0){ renderConResults = true; renderCseResults = false; bRendered = false; } return null; }catch(exception e){ ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Fatal , 'Oops... ' + e); ApexPages.addMessage(msg); return null; } }else{ PageReference ref = new PageReference('/apex/ticketquickcreate?CAS=1'); ref.setRedirect(true); return ref; } }else{ PageReference ref = new PageReference('/apex/ticketquickcreate?CAS=1'); ref.setRedirect(true); return ref; } }

 

 

 

I have an extension class that i cant seem to test fully. It all stops on one method getContactId().

 

Here is my Extention Class:

 

public with sharing class FieldAccounts {

/*get the current case id*/
Private Final Case cse;

public FieldAccounts(ApexPages.StandardController stdController){
this.cse = (Case)stdController.getRecord();
}

public string getCaseId(){
return cse.id;
}

public boolean popWindow;
public Boolean tiedToAccount;
public boolean chooseAccount;

/*get the contact Info*/
public String contactId;
public String cseNumber;

public string getContactInfo(String cid){
Case[] cseconid = [select id, contactid, CaseNumber from Case where id = :cid];
contactId = cseconid[0].ContactId;
cseNumber = cseconid[0].CaseNumber;
return null;
}
/*get the contact ID*/
public string getContactId(){
getContactInfo(getCaseId());
return contactId;
}
/*get the case number*/
public string getCseNumber(){
getContactInfo(getCaseId());
return cseNumber;
}
/*see if the contact belongs to a vip account*/
public string faId;

public string getFaId(){
String conId = getContactId();
if(conId != null){
Contact[] con = [select id, logmein__Field_Account__r.Id from Contact where id = :conId limit 1];
faId = con[0].logmein__Field_Account__r.id;
if(faId != null && faId.length() > 1){
tiedToAccount = true;
popWindow = true;
}else{
tiedToAccount = false;
getContactEmail();
}return faId;
}else{return null;}
}
/*see if it is tied to a field account*/
public boolean getTiedToAccount(){
getFaId();
return tiedToAccount;
}

/*get the email address of the contact*/
public string contactEmail;

public string getContactEmail(){
String conId = getContactId();
if(conId != null){
Contact[] vCon = [select id, email from Contact where id = :conId limit 1];
if (vCon.size() != 0 && vCon != null){
contactEmail = vCon[0].email;
}
return contactEmail;
}else{return null;}
}

/*extract the domain from the contacts email*/
public String emailDomain;

public string getEmailDomain(){
string conE = getContactEmail();
if(conE != null){
contactUtils cUtils = new contactUtils();
String emailDomain = cUtils.getDomainFromEmail(conE);
//emailDomain = '%' + emailDomain + '%';
return emailDomain;
}else{return null;}
}

/*see if there are any field accounts that match that domain*/
public string accIds;
public string getAccIds(){
string eDom = getEmailDomain();
if(eDom != null){
FieldAccount__c[] fieldacc = database.query('select id from FieldAccount__c where domain__c like ' + '\'%' + eDom + '%\'');
if(fieldacc.size() > 0 ){
popWindow = true;
}
return accIds;
}else{popWindow = false; return null;}
}
/*see if the alert will fire*/
public boolean getPopWindow(){
getAccIds();
return popWindow;
}
public String getFAPageURL(){
PageReference pageRef= new PageReference('/apex/FieldAccounts');
return pageRef.getUrl();
}
public String getFACPageURL(){
PageReference pageRef= new PageReference('/apex/FieldAccountChoose');
return pageRef.getUrl();
}

}

 

 My exten test class so far(since it is returning null on getting the contact id)

 

public with sharing class FieldAccountsTest {
/*create a fa account*/
public FieldAccount__c[] createNewFAccount(string faname, string dom){
FieldAccount__c[] ac = new FieldAccount__c[0];
ac.add(new FieldAccount__c(name = faname, domain__c = dom));
insert ac;
return ac;
}

/*get the id*/
public String faccountid;

public String getFAccountid(string faname){
FieldAccount__c[] getid = [select id from FieldAccount__c where name = :faname limit 1];
faccountid = getid[0].id;
return faccountid;
}
/*create a account*/
public Account[] createNewAccount(string aname){
Account[] ac = new Account[0];
ac.add(new Account(name = aname));
insert ac;
return ac;
}
/*get the id*/
public String accountid;

public String getAccountid(string aname){
Account[] getid = [select id from Account where name = :aname limit 1];
accountid = getid[0].id;
return accountid;
}
/*add contacts to the account*/
public Contact[] createNewContact(String name, String lastname, String email, String acId){
Contact[] nc1 = new Contact[0];
nc1.add(new Contact(firstname = name, lastname = lastname, email = email, AccountId = acId));
insert nc1;
return nc1;
}
/*get the contact id*/
public string contactId;

public String getContactId(String cemail){
Contact[] cid = [select id from Contact where email = :cemail];
contactId = cid[0].id;
return contactId;
}
/*create a case under the first contact*/
public Case[] createNewCase(String email, String name, String product, String subject, String description, String origin){
Case[] cse = new Case[0];
cse.add(new Case(contactemail__c = email, SuppliedName = name, Product__c = product, Subject = subject, Description = description, Origin = origin));
insert cse;
return cse;
}
public string cseid;

public string getCaseId(string cemail){
case[] cid = [select id from case where contactemail__c =:cemail];
cseid = cid[0].id;
return cseid;
}
public string csenum;

public string getCsenum(string cemail){
case[] cid = [select id, CaseNumber from case where contactemail__c =:cemail];
csenum = cid[0].CaseNumber;
return csenum;
}
/*Get user info for testing*/
public string curUserId = UserInfo.getUserId();
public string getCurUserId(){
return curUserId;
}
public string curUserName;
public string curUserEmail;
public string getUserInfo(){
user[] info = [select id, name, email from User where id =:curUserId];
curUserName = info[0].name;
curUserEmail = info[0].email;
return null;
}
public string getCurUserName(){
getUserInfo();
return curUserName;
}
public string getCurUserEmail(){
getUserInfo();
return curUserEmail;
}
static testmethod void testGetContactInfo(){
FieldAccountsTest t = new FieldAccountsTest();
t.createNewFAccount('ge', '@ge.com');
string facid = t.getFAccountid('ge');

t.createNewAccount('accountone');
string acid = t.getAccountid('accountone');

t.createNewContact('Joe', 'shmo', 'js@ge.com', acid);
String cId = t.getContactId('js@ge.com');

Case cse = new Case(contactemail__c = 'js@ge.com',SuppliedName = 'joe shmo',Product__c = 'Logmein Rescue',Subject = 'help',Description = 'need some help', Origin ='email');
insert cse;
ApexPages.StandardController sc = new ApexPages.StandardController(cse);
string cseId = t.getCaseId('js@ge.com');
string cseNum = t.getCsenum('js@ge.com');

FieldAccounts f = new FieldAccounts(sc);

system.assertEquals(cseId, f.getCaseId());
f.getContactInfo(cseId);
system.assertEquals(cId, f.getContactId());
system.assertEquals(cseNum, f.getCseNumber());
f.getFaId();
system.assertEquals(false, f.getTiedToAccount());
f.getContactEmail();
system.assertEquals('js@ge.com', f.getContactEmail());
system.assertEquals('@ge.com', f.getEmailDomain());
system.assertEquals('/apex/logmein__FieldAccountChoose', f.getFACPageURL());
system.assertEquals('/apex/logmein__FieldAccounts', f.getFAPageURL());
}

}

 

 in the part

system.assertEquals(cId, f.getContactId());

f.getContactId() returns null. When i dig deeper, i found that even though 'system.assertEquals(cseId, f.getCaseId());' works and returns the case Id, in the getContactId() method it is null (only for the test class).

 

This is my first class extension that i have had to test, and all of my normal test classes that have very simular metods, if not the same, work. WTF???

 

Please i need some help!!

Message Edited by tankgirlrs on 01-11-2010 02:12 PM

In my page I have a background image that is set to repeat-x and it work perfectly in FireFox, but in IE, not so much.

 

On my site, I made a template page that all my other pages sit in using the <apex:composition template="myTemplate"> and  <apex:define name="somesection">. On one of the pages I have a list displaying the cases on that person's account (the one logged into the site) and I made links so they can see just there cases or all the account cases and then just open or just closed, so each time the user clicks on the link, the cases list rerenders. And you can imagine that some of the lists are longer than others, depending on the account. 

Before

In IE (compatibility mode and non compatibility mode...havent even looked at IE6)this is what seems to be happening:

After

The background image loads all the way to the bottom of the page on page load, on first rerender, it only loads to the shortest list and the rest of the page has a white background. 

 

has anyone see this or something like it? 

Message Edited by tankgirlrs on 12-07-2009 02:54 PM
Message Edited by tankgirlrs on 12-07-2009 02:55 PM
Message Edited by tankgirlrs on 12-08-2009 04:48 PM

I have created a customer portal for our VIP accounts with force.com sites, so they can log in and see any tickets(cases) under there account, and be able to submit new ones or add comments or attachments to current ones.

 

I have managed to create all of it with no trouble, except for the attachments piece. I can't even display existing attachments that may be on the ticket(case), it errors out the page. I am wondering if there is any sort of permissions issue with seeing attachments and sites/portal users? 

 

I have the table set up to only render if there is results from the query, and the table shows, but the data wont(since I have to make the get method return null.... Or the page wont load...)

 

here is the code I am using to get the existing attachments:

 

//get the id of the case so we can look for attachments in it
String pageid = ApexPages.currentPage().getParameters().get('id');
public string getPageid(){
return pageid;
}
//set the table to false so it wont show unless there is data
Boolean renderattachmentlist = false;
//run the query and render the list if there is data
public Boolean getRenderattachmentlist(){
getAttachmentResults();
return renderattachmentlist;
}
//select the attachment data to be shown from the case
public Attachment[] getAttachmentResults(){
Attachment[] attachmentInfo = [Select ParentId, Name, Id, CreatedDate, CreatedById From Attachment where ParentId = :pageid ORDER BY CreatedDate DESC];
//if there is data show the list
if(attachmentInfo.size() > 0){
renderattachmentlist = true;
}
return attachmentInfo;
}

 at the end of the getAttachmentResults() method I have it set to return null since the page wont load if I leave it as shown above.

 

Since I can't even get the existing attachments to show I figure it must be some sort of permissions issue. Can this be changed or fixed? 

 

The other piece that isn't working is adding new attachments, but I figure its for the same reason as above....

 

HELP!


 

Message Edited by tankgirlrs on 12-01-2009 09:56 AM

I am trying to mimick some behavior I had with an s-control with visual force. If you place a custom button that links to an s-control and then specify that you want the side bar for example, you could link to a page without header and side bar refershing.

 

So I made a visual force page that I added to my account page layout and there I place a link or button. I tried with the commandlink and commandbutton that reference an action on my controller and the action returns a PageReference to a second visual force page. If I specify nothing then the page goes into the iframe in the account detail, not the idea, so I would need to add target=_top and force a client side redirect. However then the entire page is refreshed which makes it seem much slower than the original behavior with the s-control where only the account detail itself was refreshed. How can I obtain the same behavoir as the s-control linked to a custom button?

Hi All,
 
I have been trying to use the following HTML code in my VisualForce Page editor.
 

 

Code:
<apex:page controller="Rephome" sidebar="false" tabstyle="SPA_Detail__c" standardstylesheets="false">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!--[if lt IE 8]><link rel="stylesheet" type="text/css" href="{!$Resource.ie}" /> <![endif]-->
<!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="{!$Resource.ielt7}" /> <![endif]-->

My questions:

Is it possible to use DOCTYPE defenition?, i get a warning saying that DOCTYPE is not allowed.

The conditional IF statements are finally generated as comments. Is HTML Conditional IF statement not supported in VisualForce or is there some other way in which this can be achieved?

I face browser related issues while rendering the VisualForce, is it because of the Doctype? When a custom stylesheet is used for a VF page with Salesforce Header does the custom stylesheet affect the Salesforce Header as well.

Thanks,

Edwin