Volume 2: Solutions and Publishing disclaimer


Built in Solutions Review



Download 0.72 Mb.
Page5/12
Date10.08.2017
Size0.72 Mb.
#31124
1   2   3   4   5   6   7   8   9   ...   12

Built in Solutions Review

Questions


  1. True or False: The Process tab is only available in Visio Premium.

  2. Which command is used to break out a collection of shapes from a flow diagram, move them to a new page, and replace them with a Subprocess shape?

  3. True or False: Validation issues can be ignored when creating Visio diagrams.

  4. True or False: Validation issues can be ignored when exporting SharePoint Workflow diagram.

  5. What data type are ShapeSheet formulas always stored as?

  6. Name three different types of ShapeSheet cells that you can link database fields to.

  7. What one thing must occur to construct a valid database linkage?

  8. What is the best way to make connections between a position shape and the manager shape to which it reports?

  9. Name the different sources of information that the Organization Chart Wizard can use to create an organization chart.

  10. Can the organization chart wizard be run in a non-interactive mode?

  11. When a Pivot Diagram is first created, what three elements are added to the Visio drawing?

  12. What are two ways to break a pivot node down by a category?

  13. How do you apply a filter?



Answers


  1. True

  2. Choose Process > Create from Selection.

  3. True

  4. False. SharePoint Workflow drawings must be valid before they can be exported.

  5. Strings

  6. Shape Data, User, any other named ShapeSheet cell.

  7. At least one connection must be made between a field in a record and a Visio Shape Data row to construct a valid database linkage.

  8. Drop the position shape on the manager shape. The connections will be made automatically.

  9. Text files, Excel spreadsheet, ODBC compliant data source, and Microsoft Exchange server.

  10. Yes. The wizard can be run in silent mode.

  11. The top level pivot node, a data legend, and the name of the pivot diagram.

  12. One, with the shape selected, from the Pivot Diagram window choose a category from Add Category.

Two, right-click the shape and choose the category.

  1. One, right-click the breakdown shape and choose Configure Column.

Two, in the Pivot Diagram window right-click the category and choose Configure Column.

Also, when using the Promote command, filters are automatically applied.



Publishing Diagrams


It is very easy to create drawings with Visio, but for others to view and edit those drawings, at least in their native form, has always required a license for Visio. However there are many options for getting information that has been captured in a drawing into the hands of other users. Determining which method is best depends on the amount of access to the data is needed by others. If the data only needs viewing, then a print or use of the Visio Viewer could be sufficient. If the drawings need to be interrogated for shape data, but not modified, then saving as a web page or as a web drawing or just using the Visio Viewer will do the job.

Visio Services, new for SharePoint 2010 allows the rendering of Visio drawings which have been saved as Web Drawings in a browser. For data connected drawings the data can be refreshed and the drawing updated automatically without republishing the drawing.

The Visio environment comes with a complete development environment for creating your own shapes, stencils, and templates. With a good software development platform like Visual Studio .NET, the extensions that can be created for Visio are almost limitless. But which solution type do you choose and how do you get your solution into the hands of others.

These are the topics of this module.



Objectives


After completing this module you will be able to:

  • Describe the variety of ways to publish and view Visio data

  • Save diagrams as Web Drawings for use by Visio Services

  • Describe the different options available for creating Visio solutions and the important issues related to deploying those solutions


Visio Services


Visio Services is a new feature of SharePoint 2010 that expands the audience for Visio drawings and enables the use of these drawings in doing real time data analysis. Visio Services lets you:

  • View diagrams in the browser without needing Visio on the client machine

  • Refresh data-driven diagrams in the browser

  • Integrate diagrams into SharePoint applications


http://blogs.msdn.com/blogfiles/visio/windowslivewriter/introducingvisioservices_edb3/architecture_2.png

Figure - Workflow for publishing and viewing drawings with Visio Services
Step 1: Create a drawing in Visio

The real power of Visio Services comes through with data-connected drawings, but this isn’t a requirement. Any Visio drawing can be saved as a Web Drawing. A Web Drawing is a new file type for Visio 2010. It is a zipped container holding the native Visio drawing file (.vsd) and the rendered forms of the drawing in XAML and PNG formats.

Note:

Visio Professional or Visio Premium is required to save a drawing as a Web Drawing.



Step 2: Upload the .vdw file to SharePoint

This step can be handled in two ways:

  1. Save a drawing in .vdw format and then upload the drawing to SharePoint from outside of Visio.

  2. Create a Visio Web Drawing using File > Share > Save to SharePoint and specify the file type as Web Drawing. This gets the job done in one easy step from within Visio.
Step 3: User requests diagram from SharePoint

To view the drawing in a web browser, the user simply clicks on the file name in the SharePoint document library.
Step 4: Visio Services refreshes the data and the diagram

Before Visio Services renders a data-driven diagram it fetches the diagram's linked data from an external data source and updates the diagram visuals based on the updated data. Thus once the drawing is posted to SharePoint it no longer needs to be republished just because the data has changed.
Step 5: Diagram is rendered in the browser

The drawing is rendered in full fidelity (XAML) if Silverlight is installed or as a PNG file if Silverlight is not installed. The user can pan, zoom, change pages, follow hyperlinks and view shape data from the browser. There is also an “Open in Visio” button which allows the drawing to be opened in Visio if Visio is installed

The user can view the drawing:



  • …in any browser (Internet Explorer, Firefox, Safari etc…)

  • …on any platform

  • …without leaving the browser

  • …without installing Visio, the Viewer or the Drawing Control

  • …without needing to accept multiple dialogs or browser warnings

Visio Services supports refreshing diagrams connected to one or more of the following data sources:

  • SQL (using either Kerberos, Single Sign On & Unattended Authentication)

  • SharePoint Lists

  • Excel Workbooks hosted in SharePoint

  • Any OLEDB/ODBC data sources that have recent drivers



Publishing Diagrams to Visio Services


Visio Web Drawing (*.VDW) files are created using Visio Professional 2010 or Visio Premium 2010. The Visio Web Drawing (*.VDW) is a new Visio file type that allows diagrams to be rendered in full fidelity in the browser using Visio Services on SharePoint 2010.

When you save a file in Visio 2010, you will see the option in the Save As dialog to save your diagram as a Web Drawing.



web drawing file type

You can also create a Visio Web Drawing using File > Share > Save to SharePoint. This tool allows you to quickly select a SharePoint location and the Web Drawing file type for saving your diagram.



save to sharepoint

Clicking on Save to SharePoint at the bottom of the billboard opens the Save As dialog so you can confirm or refine your selection.



save as

To use the default publishing options, press Save. You now have a diagram ready for viewing in the browser!

By default, Visio automatically opens a browser so you can see your diagram as others will see it in the browser. You can turn off this behavior from the Save As dialog.

save as dialog

You can also click on Options at the bottom of the Save As dialog to launch the Publish Settings dialog. Using this dialog, you can select the pages that display and, for data connected diagrams, the data sources that refresh in the browser.



publish settings

Visio Services allows you to refresh data-driven diagrams in the browser to present the most up-to-date view of the underlying data. The data sources selected in the Publish Settings dialog will be the data sources that refresh. Visio Services supports refreshing the following data sources:



  • SQL Tables & Views

  • WSS Lists

  • Excel Workbooks hosted in SharePoint

  • Generic OLEDB/ODBC data sources

In addition to giving you the option to customize your publish options, the Publish Settings dialog also indicates publishing issues. For example, in the image above, the data source titled “Sales data” has a warning icon beside it. This sales data is stored in a local Excel Workbook: this data source is not supported by Visio Services because it is stored on a local machine. If you want the data from an Excel Workbook to refresh with Visio Services, you should save the workbook to a SharePoint site, link your diagram to the workbook on SharePoint and then save your diagram to the SharePoint site.

On save, Microsoft Visio 2010 generates a Web Drawing file which is in fact a package containing:



  1. the native Visio representation of the diagram (a .VSD file), used to edit the file in Visio, and

  2. meta data re-generated on each save, used by Visio Services to render the web drawing in the browser.

Once your Visio Web Drawing file is saved to SharePoint, you can continue to work with it in Visio. Visio Professional 2010 and Visio Premium 2010 both fully support Visio Web Drawing files. This means that you can edit Visio Web Drawing files using the complete set of features provided by Visio.
Save as Web Drawing using automation

Along with the Web Drawing (.vdw) file format is a new object for managing the publishing options when automating the publishing process. Use it to specify the pages and records to be published with the drawing. These are analogous to choosing the option File > Share > Save to SharePoint > Web Drawing. Choose Options and select the pages and Data Sources to be published.


The following sample uses the ServerPublishOption to save a drawing as a .vdw file. Pages to publish are specified in an array of String with the array holding the page names. Recordsets to publish are held in an array of Long with each array value being the ID of the data recordsets to publish. Below is sample code for saving a drawing as a Web Drawing. It publishes pages 1 and 3 along with a data recordset with ID 1.

Sub SaveAsVDW()

'set the pages to publish

Dim PageNamesU(1) As String

PageNamesU(0) = "Page-1"

PageNamesU(1) = "Page-3"

Application.ActiveDocument.ServerPublishOptions.SetPagesToPublish _

visPublishPageSelect, PageNamesU, visLangUniversal

'set the recordsets to publish

Dim RecordsetIDs(0) As Long

RecordsetIDs(0) = 1

Application.ActiveDocument.ServerPublishOptions.SetRecordsetsToPublish _

visPublishDataRecordsetSelect, RecordsetIDs

'save the file

Application.ActiveDocument.SaveAsEx _

"C:\Users\Fred\Desktop\Sample.vdw", visSaveAsWS + visSaveAsListInMRU

End Sub

Integrating Visio drawings into SharePoint Applications


Visio Services enables you to embed Visio Web Drawings, regardless of whether they are static or dynamic, into SharePoint applications. Depending on your skill level with web technologies there are three scenarios for doing this. Slightly different skill sets are required for each scenario.

  • Visio Web Access web part.

    • Scenario: Embed Visio diagrams into SharePoint pages.

    • Skills required: know how to create a web part page in SharePoint.

  • Web Part Connections.

    • Scenario: You can enable limited interactivity between the Visio Web Access web part and another on the page, without code. A typical example of this type of interactivity is to trigger one web part to show extra relevant information about a particular shape when it’s clicked in the Visio web part.

    • Skills required: know how to create a web part page in SharePoint as well as how to set-up Web Part Connections.

  • The Visio Services Mash-up API

    • Scenario: You can enable rich interactivity on your web part page by manipulating the different Visio web diagram objects programmatically. A typical example of this type of interactivity is to show custom visual overlays when the person viewing the diagram hovers over a particular shape.

    • Skills required: know how to code JavaScript and/or ASPX pages.

Visio Web Access Web Part


Published diagrams are displayed to the user using the Visio Web Access Web Part. This Web Part provides the interface that allows a user to view and navigate published diagrams from within their browser. Add this Web Part to any of your Web Part pages in SharePoint to incorporate Visio diagrams into your dashboards or SharePoint application.

To add an instance of the VWA Web Part to your Web Part page simply select the zone on the page and from the Insert tab on the ribbon choose the Web Part option. From the list of categories choose Office Client Applications and then Visio Web Access from the list of available Web Parts.




Figure - Adding the VWA Web Part to a zone

After you add the VWA Web Part to your page you will need to configure each instance of the VWA Web Part by setting any necessary properties using the Modify Shared Web Part option.





Figure - Modify Shared Web Part

In order to display a particular Visio diagram in this instance of the VWA Web Part you must set the Diagram URL property. This property must point to a VDW diagram as this is the only file format that the server can render. If you choose any other file format you will see an error in the Web Part. The Diagram URL property must also point to a location on the same server, it cannot refer to a document on an external site.





Figure - Setting the Diagram URL property

Once the Diagram URL property has been set and you click on the OK or Apply buttons the target diagram should be rendered in the VWA Web Part.





Figure - Rendered diagram

The Visio Services Mash-up API


Not only does SharePoint 2010 provide Visio Services functionality to render Visio diagrams in the browser, it also supports extensibility allowing developers to build server based applications that incorporate Visio diagrams.

This new API allows developers to interact with a diagram that is hosted in an instance of the VWA Web Part, providing:



  • Diagram navigation such as setting the view and zoom level

  • Shape selection including notification of selection changed

  • Highlight functionality to highlight shapes

  • Overlay functionality to add additional markup

  • Shape data access to query individual shape data fields

  • Hyperlink access to query individual hyperlinks on each shape

The Mashup API is a browser-side JavaScript API with an easy to learn object model and support up to JavaScript 1.3 as this version of JavaScript is compatible with most browsers.



Figure - Mashup API Object Model

The object model shown above lists all of the objects that are available in the Mashup API however all of the methods and properties are not documented here.



Note:

Because it is very new, at the time of this writing it was unclear just where the Mashup API would be published. It may become part of the Visio 2010 SDK, but the reader should do a search to find the Mashup API documentation.



Walk through – Building a dashboard

Now that we have our basic Web Part page (created above) that is displaying an instance of a published diagram using the VWA Web Part, lets add additional functionality to this Web Part page using the new Mashup API. For this particular example we will add two additional enhancements to our Web Part page:

  1. Selecting a shape in the diagram will present the user with additional information that is stored in ShapeData for the selected shape. This is data that is of interest to users of this dashboard.

  2. Allow a user to filter the shapes in the diagram by using the Highlight functionality of the Mashup API to highlight shapes in the diagram that meet specific criteria.

In order to provide the capabilities described above we will need to edit our Web Part page and add another Web Part that will contain the JavaScript code and HTML. Edit the Web Part page and insert a Content Editor Web Part in the Right Column zone on the page.





Figure - Adding the HTML Form Web Part

Once this new Web Part has been added to the page you will need to use the Edit Web Part option to access the properties of this Web Part.





Figure - Edit Web Part to link JavaScript source

In order to attach the code to this Web Part, insert the URL of the JavaScript file into the Content Link property, clicking OK to accept the changes.





Figure - Set the Content Link property to the URL of the JS file

Note: To get the URL, use the Copy Shortcut RMA by right-clicking on the JavaScript file in the document library.





Figure - Copy Shortcut is an easy way to get the URL

Once submitted the Web Part should update, displaying the HTML controls that are part of this sample code. Not only should the HTML be visible but the JavaScript code is also active at this point so you can test the code before you exit edit mode and make the page available to your users.





Figure - HTML Form Web Part rendering our HTML and JavaScript

Updating other properties of the Content Editor Web Part will improve the user experience. For example, set a Title (under the Appearance group) for the Web Part and you might also change the size of the Web Part for better viewing.

When you are done editing the properties of the Web Part you can click OK to close the Web Part Content Editor and exit Edit mode on the Web Part page.



Figure - Web Part Page running in Edit mode

To test the functionality that we added using JavaScript you should be able to click on a shape in the drawing and the HTML TextBox controls should populate with property values from the selected shape. Clicking on any of the radio buttons for Status should add a highlight to any shapes on the page with a Status property matching the selected value.





Figure - Status property used to highlight shapes
Walk through – JavaScript explained
onApplicationLoad

This method is responsible for getting the instance of the VWA control on the Web Part page. Once you have the instance of the VWA control you can call the addHandler() method to connect to the events supported by the VWA control, which for this example are diagramComplete and shapeSelectionChanged.

new Vwa.VwaControl("WebPartWPQ3")



  • This returns the named instance of the VWA control on the Web Part page.

addHandler(string event, function handler)



  • This method is not specific to the VWA control but allows you to connect functions to events on the target object.

  • handler is the name of the function to call.

Note:

The only gotcha in this method is the name of the VWA control instance. "WebPartWPQ3" in this example happens to be the name assigned to the VWA Web Part instance. Assigned because when you inserted the control on your Web Part page SharePoint assigned this name automatically to the control instance. "WebPartWPQ#" is the format used where # is the next Web Part instance on the page.

This id is not available from the UI. The best way to determine the id of the Visio Web Part is to open the source for the page and search for it by searching for .

From the View menu on your browser, choose Source and then in the text editor search for .





Figure - Searching for the Web Part ID
onDiagramComplete

This method is called when the diagram is finished rendering in the VWA control instance. We connected this method to the diagramComplete event in the onApplicationLoad method described above.

This method simply gets the instance of the ActivePage from the control and sets a zoom value. This actually turns out to be a good debugging technique that will indicate you were successful retrieving the VWA control instance in the onApplicationLoad method. If your specific zoom value is not set when the diagram renders then you know that you were not successful in getting the instance of the VWA control and you will need to verify the control name that you used.

getActivePage()


  • This method returns the instance of the Page object that is the active page in the VWA control instance.
shapeSelectionChangedHandler

As the name implies this is the method that we connected to the shapeSelectionChanged event in the onApplicationLoad method described above.

This method is responsible for retrieving Shape Data values from the selected shape and populating the HTML controls on the page. To accomplish this we need to first get the active page from the control (getActivePage). Then we need to get the shapes collection from the active page (getShapes). Once we have the shapes collection we need to get the selected shape by passing the shapeId argument to the getItemFromId method on the shapes collection. Finally, once we have the selected shape, we can call the getShapeData method which will give us an array of the Label and Values for all the Shape Data properties. With the label and values from Shape Data we can populate our HTML controls appropriately.

getItemById(string shapeId)


  • This method returns the instance of the shape based on the shapeId argument.

    • shapeId is the Sheet Name used in Visio.

getShapeData()



  • This method returns an array of shape data items.

    • The label property of each item returns the value from the Label cell of the Property row of the ShapeSheet.

    • The value property of each item returns the value from Value cell of the Property row of the ShapeSheet.
Hightlight

A nice feature of the Mashup API is the ability to highlight shapes on the active page. The addHighlight() method on the Shape object draws a rectangle around the target shape. You can specify the line weight and the line color of the rectangle. removeHighlight() is responsible for removing a highlight from the target shape.

This method is called from the HTML input controls on our page using the onClick attributes (onclick="Highlight()") of each control. Each time a user clicks on one of these controls our Highlight method is called.

The first thing our Highlight method does is clean up the active page of any existing highlighted shapes. It walks thru the shapes collection calling removeHighlight() for each shape on the active page.

Secondly, our Highlight method uses the value attribute (value="ok") of the clicked HTML control as the filter to determine which shapes to highlight. The method walks thru each shape in the active page’s shapes collection, gets the array of Shape Data from the getShapeData method and determines if the shape has a specific property and value. If so we call the addHighlight() method on the shape.

removeHighlight()


  • this method does not accept any arguments. It removes any existing highlights on the target shape.

addHighlight(int width, string color)



  • this method adds a highlight rectangle to the target shape as specified by the following arguments

    • width - must be a positive integer.

    • color - accepts “#RRGGBB” formatted values.
Complete JavaScript source listing for this walk through

Below is all the source needed for the functionality described in this article.

Network Name:




IP Address:




Administrator:




Status:








Filter Options




Online


Offline


Unknown

None



Download 0.72 Mb.

Share with your friends:
1   2   3   4   5   6   7   8   9   ...   12




The database is protected by copyright ©ininet.org 2024
send message

    Main page