Category Archives: UI

Readonly attribute in knockoutjs

HTML:

<input data-bind="value: text, readOnly: locked"  ></input> 

In knockout:

  ko.bindingHandlers.readOnly = {
    update: function(element, valueAccessor) {
        var value = ko.utils.unwrapObservable(valueAccessor());
        if (value) {
            element.setAttribute("readOnly", true); 
        }  else {
            element.removeAttribute("readOnly");
        }  
    }  
}
 
var viewModel = {
   
    locked = ko.observable(false)
};

Override a page for some, but not all, users

Some of your users should use a custom Visualforce page, while others should use a standard Salesforce.com page.To override the Account tab with a Visualforce page for most of your users, but send users with the “System Administrator” profile to the standard Salesforce.com Account home page:

  1. Create a Visualforce page called conditionalAccountOverride.
    • Click Setup | Develop | Pages.
    • Click New.
    • In the label field, enter Override the Account Page for Most Users.
    • In the name field, enter accountOverride.
    • In the description, enter This page will display for all users, except System Administrators, when they click the Account tab.
    • In the editor, enter the following markup:
<apex:page action=
  "{!if($Profile.Name !='System Administrator', 
    null, 
	urlFor($Action.Account.Tab, $ObjectType.Account,
	null, true))}"
  standardController="Account" 
  recordSetVar="accounts" 
  tabStyle="Account">

  <!-- Replace with your markup -->  
	
  This page replaces your Account home page for 
  all users except Administrators.
</apex:page>
    • Click Save.

2. Set the page level security to allow all users to view the page.

    • Click Security for the page you just created.
    • Select all the profiles that will be using this page in the Available Profiles list and click Add to add them to the Enabled Profiles list.
    • Click Save.

3. Create an override that directs users to your new page.

    • Click Setup | Customize | Accounts | Buttons and Links.
    • In the Standard Buttons and Links list, click Override for the Accounts Tab.
    • Set the content type to Visualforce Page.
    • From the Content Name drop-down list, select conditionalAccountOverride.
    • Click Save.

This solution uses the action attribute on the apex:page component to test the user’s profile. Using the action attribute is a good way to ensure an action is taken when the page loads. If instead of limiting the standard page to a particular group of users, you want to limit the override to a particular group of users, such as all “Marketing Users” and “Solution Managers,” you need to create a controller extension. To override the Account tab with a custom Visualforce page only for users with the “Marketing User” or the “Solution Manager” profile:

  1. Create a Visualforce page called standardAcctPage.
    • Click Setup | Develop | Pages.
    • Click New.
    • In the label field, enter Override the Account Page for Most Users.
    • In the name field, enter standardAcctPage.
    • In the description, enter This page will display for all users, except Marketing Users and Solution Managers, when they click the Account tab.
    • In the editor, enter the following markup:
<apex:page standardController="account" extensions="overrideCon" action="{!redirect}">
  <apex:detail/>
</apex:page>

This page overrides your current Account home page. It uses a controller extension to test the user profile. If the user is a “Marketing User” or “Solution Manager,” they are redirected to a different page.

2. Using the procedure in step 1, create a second Visualforce page called customAcctPage:

<apex:page standardController="account">
  <h1>Override Account page for two profiles</h1>
  <apex:detail />
</apex:page>

This is the page that only the “Marketing Users” and “Solutions Managers” will see. They only get to this page through redirection.

3. Grant access to both pages for all profiles.

    • Click Security for the each of the pages you just created.
    • Select all the profiles that will be using this page in the Available Profiles list and click Add to add them to the Enabled Profiles list.
    • Click Save.

4. Create a controller extension called overrideCon.

    • Click Setup | Develop | Apex Classes.
    • Click New.
    • In the editor, add the following content:
public class overrideCon {
   String recordId;
   
public overrideCon(ApexPages.StandardController 
       controller) {recordId = controller.getId();}

public PageReference redirect() {
  Profile p = [select name from Profile where id = 
			   :UserInfo.getProfileId()];
  if ('Marketing User'.equals(p.name) 
	  || 'Solution Manager'.equals(p.name)) 
	  {
	   PageReference customPage =  Page.customAccountPage;
	   customPage.setRedirect(true);
	   customPage.getParameters().put('id', recordId);
	   return customPage;
	  } else {
		  return null; //otherwise stay on the same page  
	
	  }
   }
}
    • Click Save

5.  Create an override that directs users to the standardAcctPage page when they click on the Accounts tab.

    • Click Setup | Customize | Accounts | Buttons and Links.
    • In the Standard Buttons and Links list, click Override for the Accounts Tab.
    • Set the content type to Visualforce Page.
    • From the Content Name drop-down list, select standardAcctPage.
    • Click Save.

When a user clicks on the Account tab, if their profile is “Marketing User” or “Solution Manager” the controller extension will automatically redirect them to the customAcctPage.

 

Add support:clickToDial tag for Salesforce CTI integration

The support:clickToDial component lets you add a phone field to custom Visualforce detail and edit pages. When users in organizations with Open CTI or Salesforce CRM Call Center click on the phone field, the phone number is dialed automatically and connects to the SoftPhone.

  • The User must be logged into the CTI to use
  • The showHeader=”true” attribute must be set in the <apex:page> tag or ommitted altogether to enable
<div class="customer">
    <apex:outputLabel value="Phone: ">
        <support:clickToDial number="{!Lead.phone}" entityId="{!Lead.Id}" /> 
    </apex:outputLabel>            					
</div>	

Results:

Capture

God Mode in Windows 7 and Later

“God Mode” (aka Master Control Panel) Found in Windows 7 and Later

Just create a new folder anywhere in Windows. You can create it on Desktop or within Windows Explorer and give it following name:
God Mode.{ED7BA470-8E54-465E-825C-99712043E01C}
Now you’ll have access to all Control Panel settings page in a single place as shown in following screenshot:

Windows_7_Gode_Mode

Disable Charms Bar in Windows 8

1. Press “WIN+R” key combination to launch RUN dialog box then type regedit and press Enter. It’ll open Registry Editor and go to following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\

2. Under ImmersiveShell key, create a new key EdgeUI.

3. Now select newly created key “EdgeUI” and in right-side pane, create a new DWORDDisableCharmsHint and set its value to 1

Disable_Charms_Bar_Hint_Windows_8

4. That’s it. It’ll immediately disable Charms Bar hint feature. You’ll not need to log off or restart the system.

NOTE: If you want to enable the Charms Bar hint feature again, simply delete the DWORD “DisableCharmsHint” or set its value to 0