+ All Categories
Home > Documents > Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013...

Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013...

Date post: 21-Dec-2015
Category:
Upload: vivien-douglas
View: 226 times
Download: 0 times
Share this document with a friend
32
Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice
Transcript
Page 1: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Microsoft® Official Course

Customizing User Interface Elements

Microsoft SharePoint 2013

SharePoint Practice

Page 2: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Module Overview

Working with Custom Actions

Using Client-Side User Interface Components•Customizing the SharePoint List User Interface

Page 3: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lesson 1: Working with Custom Actions

Introduction to Custom Actions

Using the CustomAction Element

Customizing the Ribbon

Demonstration: Customizing the Ribbon

Customizing Other SharePoint Objects

Using the Custom Action Templates•Deploying Custom Actions

Page 4: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Introduction to Custom Actions

•You can create custom actions for:• The SharePoint ribbon• The Site settings menu• Navigational menus• List item menus

•You can deploy custom actions as part of a Feature in a:• Sandbox solution• Farm solution• App for SharePoint

Page 5: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using the CustomAction Element

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<CustomAction

Id="Microsoft.SharePointStandardMenu.SiteActions.Contact"

GroupId="SiteActions"

Location="Microsoft.SharePoint.StandardMenu"

Title="Contact"

Description="Contact page" >

<UrlAction Url="~site/_layouts/15/contact.aspx"/>

</CustomAction>

</Elements>

Page 6: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Customizing the Ribbon

•Using the CustomAction element to customize the ribbon:• CommandUIDefinitions element• CommandUIHandlers element

• Laying out the controls:• Group layouts• Scaling

Page 7: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Demonstration: Customizing the Ribbon

In this demonstration, you will see how to add a custom action Library tab with a custom group and two custom buttons to a document page.

Page 8: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Customizing Other SharePoint Objects

•Edit Control Block

•Settings menu

•Site Settings page

Page 9: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using the Custom Action Templates

•Menu Item Custom Action:• Location attribute set to "EditControlBlock"• Set UrlAction element to required page

•Ribbon Custom Action:• Location attribute set to "CommandUI.Ribbon"• Modify CommandUIDefinitions element as required

Page 10: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Deploying Custom Actions

• In a solution:• Deploy directly from Visual Studio to the local SharePoint site• Deploy to an alternative site by creating a SharePoint package

• In an app for SharePoint:• Deploy directly from Visual Studio to the local SharePoint site• Deploy to an alternative site or store by creating an app package

Page 11: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lesson 2: Using Client-Side User Interface Components

Displaying Status Bar Messages

Demonstration: Displaying Status Bar Messages

Displaying Notifications

Demonstration: Displaying Notifications

Using SharePoint Dialog Boxes

Displaying Callouts

SPAnimation Library•Using Focus on Content

Page 12: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Displaying Status Bar Messages

•Use methods of the SP.UI.Status object:• addStatus• updateStatus• setStatusPriColor• removeStatus• removeAllStatus

function showStatusMessage () {

strStatusID = SP.UI.Status.addStatus("Info:", "Message", true);

SP.UI.Status.setStatusPriColor(strStatusID, "yellow");

}

Page 13: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Demonstration: Displaying Status Bar Messages

In this demonstration, you will see how to use the methods of the SP.UI.Status object to display and customize a message to the user.

Page 14: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Displaying Notifications

•Use methods of the SP.UI.Notify object:• addNotification• removeNotification

function showNotification(){ SP.UI.Notify.addNotification("Notification…", true)}

Page 15: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Demonstration: Displaying Notifications

In this demonstration, you will see how to use the methods of the SP.UI.Notify object to display notifications to the user.

Page 16: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using SharePoint Dialog Boxes

•Displaying a modal dialog box:var NewDialog = new SP.UI.DialogOptions();newDialog.html = htmlElement;SP.UI.ModalDialog.showModalDialog(newDialog)

•Displaying a wait screen:var waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose( 'Loading page', 'Please wait…');waitDialog.close();

Page 17: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Displaying Callouts

SP.SOD.executeFunc("callout.js"), "Callout", DisplayCallout(){});

function DisplayCallout(){

var calloutElement = document.getElementById('DocInfo');

var docInfoCalloutOptions = new CalloutOptions();

docInfoCalloutOptions.ID = 'docinfocallout';

docInfoCalloutOptions.launchPoint = calloutElement;

docInfoCalloutOptions.beakOrientation = 'topBottom');

docInfoCalloutOptions.content = 'Information to display to the user';

CalloutManager.createNew(docInfoCalloutOptions);

}

Page 18: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

SPAnimation Library

•BasicAnimator class

function strikeThroughText(){ var actionedItem = document.getElementById("Item1");

SPAnimationUtility.BasicAnimator.StrikeThrough( actionedItem, null, null, null);

SPAnimationUtility.BasicAnimator.FadeOut( actionedItem, null, null);

}

Page 19: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using Focus on Content

Page 20: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lab A: Using the Edit Control Block to Launch an App

Exercise 1: Configuring an App to Display Customer Orders•Exercise 2: Use a Custom Action to Launch an App

Page 21: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lab Scenario

Contoso maintains a list of customers in a Contacts list. The sales team at Contoso would like to be able to view a summary of recent sales activities for each customer from the Contacts list. You plan to implement this functionality as an app for SharePoint. First, you will develop a SharePoint-hosted app that displays the order history for a selected customer. You will then develop a custom action that launches the app from the Edit Control Block for a Contacts list item. The custom action must provide the app with the URL of the selected list item. It must also display the app page as a dialog box.

Page 22: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lesson 3: Customizing the SharePoint List User Interface

Introduction to Client-Side Rendering

Using Client-Side Rendering to Customize the Default List View

Using Client-Side Rendering to Create Custom Views

Using Client-Side Rendering to Customize List Forms

Using Client-Side Rendering to Apply Conditional Formatting

Demonstration: Applying Conditional Formatting•Using jQuery UI In Client-Side Rendering Code

Page 23: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Introduction to Client-Side Rendering

•Advantages of client-side rendering over using XSLT:• Performance• Flexibility• Standard development language

•Two high-level tasks:• Create a JavaScript code file• Link the JavaScript code file to the list view

Page 24: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using Client-Side Rendering to Customize the Default List View

• Formatting list fields:(function () {

var overrideCtx = {};

overrideCtx.Templates = {};

overrideCtx.Templates.Fields = {'Description' : { 'View' :

'<i><#=ctx.CurrentItem.Description#></i>'}

};

SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);

})();

• Linking the JavaScript code to the list view:<JSLink>~site/Scripts/ItalicCustomization.js</JSLink>

Page 25: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using Client-Side Rendering to Create Custom Views

•Creating the View element:<View BaseViewID="2" Type="HTML" . . . Url="CustomView.aspx">

. . .

<JSLink>~site/Scripts/ItalicCustomization.js</JSLink>

. . .

</View>

• Linking the function to the new view:(function () {

. . .

overrideCtx.BaseViewID = 2;

overrideCtx.ListTemplateType = 10001;

. . .

})();

Page 26: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using Client-Side Rendering to Customize List Forms

•Creating the View element:<Form BaseViewID=“NewForm" Type="HTML“ Url="NewForm.aspx" JSLink="~site/ScriptsCustomize.js" >

• Linking the function to the new view:(function () { . . . overrideCtx.BaseViewID = "NewForm"; overrideCtx.ListTemplateType = 10000; . . .})();

Page 27: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using Client-Side Rendering to Apply Conditional Formatting

function progressBar(ctx) { var percentage = ctx.CurrentItem.PercentComplete; var percentageNr = ctx.CurrentItem.PercentComplete.replace(" %", "");

var duedate = new Date(ctx.CurrentItem.DueDate);

var color = getColor(percentageNr,duedate); return "<div style=\"background: #F3F3F3; display:block; height: 20px; width: 100px;\"><div style=\"background: " + color + "; height: 100%; width: " + percentageNr + "%;\"></div></div> " + percentage + "";}

Page 28: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Demonstration: Applying Conditional Formatting

In this demonstration, you will see how to apply conditional formatting to a list view.

Page 29: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Using jQuery UI In Client-Side Rendering Code

1. Download the jQuery UI files2. Add the jQuery UI files to your project3. Add the jQuery UI files to your pages4. Create a JavaScript code file that uses

jQuery UI5. Modify the JSLink element to reference

your code file

Page 30: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lab B: Using jQuery to Customize the SharePoint List User Interface

•Exercise 1: Creating a Custom List View

Page 31: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Lab Scenario

You have a list of customers with details about each one. When this list uses the default list view, it is not easy to read the information and you can foresee that as more data is added to the list, the worse the problem will become. You decide to use the accordion functionality available in jQuery UI to display the list and use the style sheet to apply custom styling to the list.

Page 32: Microsoft ® Official Course Customizing User Interface Elements Microsoft SharePoint 2013 SharePoint Practice.

Module Review and Takeaways

•Review Question(s)


Recommended