core dev book

150
Content Server Core Developer I Version: 5.5 Last Revised On: December 19, 2003 12:10 pm

Upload: jorge-fernandez-garcia

Post on 24-Oct-2014

282 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Core Dev Book

Content Server Core Developer IVersion: 5.5

Last Revised On: December 19, 2003 12:10 pm

Page 2: Core Dev Book

FATWIRE, CORP. PROVIDES THIS PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. In no event shall Fatwire be liable for any loss of profits, loss of business, loss of use of data, interruption of business, or for indirect, special, incidental, or consequential damages of any kind, even if Fatwire has been advised of the possibility of such damages arising from this publication. Fatwire may revise this publication from time to time without notice. Some states or jurisdictions do not allow disclaimer of express or implied warranties in certain transactions; therefore, this statement may not apply to you.

Copyright © 2003 Fatwire, corp. All rights reserved.

This product may be covered under one or more of the following U.S. patents: 4477698, 4540855, 4720853, 4742538, 4742539, 4782510, 4797911, 4894857, 5070525, RE36416, 5309505, 5511112, 5581602, 5594791, 5675637, 5708780, 5715314, 5724424, 5812776, 5828731, 5909492, 5924090, 5963635, 6012071, 6049785, 6055522, 6118763, 6195649, 6199051, 6205437, 6212634, 6279112 and 6314089. Additional patents pending.

Fatwire, Content Server, Content Server Bridge Enterprise, Content Server Bridge XML, Content Server COM Interfaces, Content Server Desktop, Content Server Direct, Content Server Direct Advantage, Content Server DocLink, Content Server Engage, Content Server InSite Editor, Content Server Satellite, and Transact are trademarks or registered trademarks of Fatwire, corp. in the United States and other countries.

iPlanet, Java, J2EE, Solaris, Sun, and other Sun products referenced herein are trademarks or registered trademarks of Sun Microsystems, Inc. AIX, IBM, WebSphere, and other IBM products referenced herein are trademarks or registered trademarks of IBM Corporation. WebLogic is a registered trademark of BEA Systems, Inc. Microsoft, Windows and other Microsoft products referenced herein are trademarks or registered trademarks of Microsoft Corporation. UNIX is a registered trademark of The Open Group. Any other trademarks and product names used herein may be the trademarks of their respective owners.

This product includes software developed by the Apache Software Foundation (http://www.apache.org/) and software developed by Sun Microsystems, Inc. This product contains encryption technology from Phaos Technology Corporation.

You may not download or otherwise export or reexport this Program, its Documentation, or any underlying information or technology except in full compliance with all United States and other applicable laws and regulations, including without limitations the United States Export Administration Act, the Trading with the Enemy Act, the International Emergency Economic Powers Act and any regulations thereunder. Any transfer of technical data outside the United States by any means, including the Internet, is an export control requirement under U.S. law. In particular, but without limitation, none of the Program, its Documentation, or underlying information of technology may be downloaded or otherwise exported or reexported (i) into (or to a national or resident, wherever located, of) Cuba, Libya, North Korea, Iran, Iraq, Sudan, Syria, or any other country to which the U.S. prohibits exports of goods or technical data; or (ii) to anyone on the U.S. Treasury Department’s Specially Designated Nationals List or the Table of Denial Orders issued by the Department of Commerce. By downloading or using the Program or its Documentation, you are agreeing to the foregoing and you are representing and warranting that you are not located in, under the control of, or a national or resident of any such country or on any such list or table. In addition, if the Program or Documentation is identified as Domestic Only or Not-for-Export (for example, on the box, media, in the installation process, during the download process, or in the Documentation), then except for export to Canada for use in Canada by Canadian citizens, the Program, Documentation, and any underlying information or technology may not be exported outside the United States or to any foreign entity or “foreign person” as defined by U.S. Government regulations, including without limitation, anyone who is not a citizen, national, or lawful permanent resident of the United States. By using this Program and Documentation, you are agreeing to the foregoing and you are representing and warranting that you are not a “foreign person” or under the control of a “foreign person.”

Content ServerCore Developer Course: Exercises and SolutionsDocument Revision Date: December 19, 2003 12:10 pmProduct Version: 5.0

Page 3: Core Dev Book

3

Table of

Contents

Module 1: Introduction to Content Server 5.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . .7Module Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Terms to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Lesson 1.1: Content Server Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8What is Content Server?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Content Server Servlets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8General Rules for Content Server Servlets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9CS-Direct Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9CS-Direct Advantage Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Additional Content Server Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Lesson 1.2: Content Server Product Architecture. . . . . . . . . . . . . . . . . . . . . . . . 14Content Server Product Stack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Content Server Environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Module Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Module 2: Page Design and Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17Module Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Terms to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Lesson 2.1: CS-Direct Asset Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18The Basic Asset Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Core and Sample Asset Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Assets and the Content Server User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Asset Types: CS-Direct Out-of-the-Box and Samples. . . . . . . . . . . . . . . . . . . . . 19Core Asset Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Burlington Financial Sample Asset Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Exercise 2.1.1: Working with Assets via CS-Direct . . . . . . . . . . . . . . . . . . . . . . 22

Lesson 2.2: AssetMaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Page 4: Core Dev Book

Core Developer Course: Exercises and Solutions

4

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Asset Descriptor File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24AssetMaker, Data Types, and Asset Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Coding an Asset Descriptor File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Exercise 2.2.1: Creating Hello Personal Asset Type . . . . . . . . . . . . . . . . . . . . . 28Exercise 2.2.2: Creating Hello Personal Assets . . . . . . . . . . . . . . . . . . . . . . . . 31

Lesson 2.3: Builing a Content Server Direct Web Site . . . . . . . . . . . . . . . . . . . . 32Developing the Hello Asset World Web Site. . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Lesson 2.4: The Page Asset Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Exercise 2.4.1: Creating and Placing Page Assets . . . . . . . . . . . . . . . . . . . . . . 35

Lesson 2.5: Asset Relationship and Association. . . . . . . . . . . . . . . . . . . . . . . . . . 37Sample Burlington Financial Site. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Exercise 2.5.1: Creating Asset Association . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Lesson 2.6: Query and Collection Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Exercise 2.6.1: Building Collection Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Module Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Module 3: Content Server Tools and Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47Module Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Terms to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Lesson 3.1: Content Server Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Content Server Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Exercise 3.1.1: Working with Content Server Explorer . . . . . . . . . . . . . . . . . . . 50Exercise 3.1.2: Customizing the Asset Descriptor File . . . . . . . . . . . . . . . . . . . 52CatalogMover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Exercise 3.1.3: Using Catalog Mover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Lesson 3.2: Content Server Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<ics:setvar> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<ics:setssvar> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<ics:getvar> Tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<ics:getssvar> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58<ics:callelement> Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Exercise 3.2.1: Commonly Used Content Server JSP Tags . . . . . . . . . . . . . . . . 60

Lesson 3.3: Database Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Types of Database Tables (Catalogs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

Lesson 3.4: Error Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Lesson 3.5: Page Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Modular Page Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Modular Design and Caching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Choose the Coding Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Activity: Modularizing an Existing Web Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Lesson 3.6: Caching Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

Caching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76CacheManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Double Buffered Caching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

Page 5: Core Dev Book

Table of Contents

5

Exercise 3.6.1: Page Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Module Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

Module 4: Template Assets and Content Server Tags . . . . . . . . . . . . . . . . . . . .81Module Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Terms to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Lesson 4.1: The Template Asset Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Exercise 4.1.1: Creating a Template Asset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Lesson 4.2: Asset Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Asset Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Exercise 4.2.1: Using the <asset:load> and <asset:get> Tags . . . . . . . . . . . . 94Exercise 4.2.2: Using the <asset:children> Tag . . . . . . . . . . . . . . . . . . . . . . . 95

Lesson 4.3: Render Tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98Setting the rendermode Arguement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98Render Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98Exercise 4.3.1: Using Render JSP Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102Exercise 4.3.2: Rendering Collection Assets with Templates . . . . . . . . . . . . . 103Exercise 4.3.3: Rendering Page Assets with Templates . . . . . . . . . . . . . . . . . . 105

Lesson 4.4: Site Plan Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Database Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Site Plan Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Exercise 4.4.1: Building a Page Navigation Bar . . . . . . . . . . . . . . . . . . . . . . . 111

Module Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Module 5: Workflow, Publishing, and Revision Tracking . . . . . . . . . . . . . . . . .115Module Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Terms to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Lesson 5.1: Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Workflow Participants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Workflow States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Workflow Steps: Moving Assets from State to State. . . . . . . . . . . . . . . . . . . . . 119Managing Deadlocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Delegating and Clearing Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Placing an Asset in Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Restricting Access to Assets While They Are in Workflow . . . . . . . . . . . . . . . 121

Instructor Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Sample Workflow Steps and States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Sample Workflow Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Placing an Asset in a Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

Lesson 5.2: Publishing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128Delivery Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Publishing Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Publishing and the Approval Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130The Publishing Schedule (Publish Events). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132What Happens During the Publishing Session? . . . . . . . . . . . . . . . . . . . . . . . . . 133

Page 6: Core Dev Book

Core Developer Course: Exercises and Solutions

6

Instructor Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Creating a Destination for Dynamic Publishing. . . . . . . . . . . . . . . . . . . . . . . . . 134Mirroring an Asset (Dynamic Publishing) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Creating a Destination for Static Publishing . . . . . . . . . . . . . . . . . . . . . . . . . . . 136Exporting an Asset to Disk (Static Publishing) . . . . . . . . . . . . . . . . . . . . . . . . . 137

Lesson 5.3: Revision Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138Implicit vs. Explicit Checkin and Checkout. . . . . . . . . . . . . . . . . . . . . . . . . . . . 138Revision Tracking and Non-Asset Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139How Many Versions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Instructor Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Enabling Revision Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Checking Out Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Undoing a Checkout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Checking In Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Examining Version History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Reverting to a Previous Version (Rollback). . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Releasing Locked Assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Module Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

Page 7: Core Dev Book

7

Module 1

Introduction to Content Server 5.5

Module Learning Objectives• Describe the features of Content Server, CS-Direct and CS-Direct Advantage.

• Define the functions of the various Content Server servlets.

• List the tasks that Content Server Direct can be used to complete.

• List the components of the Content Server product architecture that are common to an environment whether it be development, management, or publishing environment.

Terms to Know

Terms Definition

Asset Type A category of basic assets. Each asset must belong to an asset type. For example, Article is a popular asset type. An Article asset is an instance of an Article asset type. A site might contain millions of Article assets but only one asset type named Article.

Asset An instance of an asset type.

The central organizational unit of CS-Direct, CS-Direct Advantage, and CS-Engage. The following are examples of assets: one image and the data that describes it, one article and the data that describes it, or one product for sale. A large site might contain millions of assets. In addition, nearly all the infrastructure in a site (for example, templates and attributes) are themselves assets. CSEE defines two major categories of assets: basic assets and flex assets.

Basic Assets The way in which CS-Direct stores content objects in one primary storage table in the database for each type of asset.

Page 8: Core Dev Book

Content Server Core Developer I

8

Lesson 1.1: Content Server OverviewIn this lesson you will learn about the various features of Content Server, CS-Direct, CS-Direct Advantage and CS-Satellite.

IntroductionThere are a few main components of Content Server 5.0 that are important to understand:

• Content Server

• Content Server Satellite

• Content Server Direct

• CSEE Tools

Content Server Enterprise Edition (CSEE)Content Server Enterprise Edition (CSEE) Server is the foundation for the entire Fatwire Content Server product family.

The Content Server application serves content that defines the online site.Content Server is a toolset that provides Java methods and utilities that you can use for both designing a public, online site and for developing a customized content application.

Content Server ServletsContent Server consists of several servlets that run on top of an application server. The ones you will likely reference include:

• ContentServer

• CatalogManager

• TreeManger

• BlobServer

• CookieServer

• DebugServer

• HelloCS

ContentServerThe ContentServer servlet generates and serves pages dynamically. It provides disk caching, session management, event management, searching, and personalization services.

CatalogManagerThe CatalogManager servlet manages the content and object tables, which store hierarchical information about other tables in the Content Server database.

TreeManagerThe TreeManager servlet manages the tree tables, which store hierarchical information about other tables in the Content Server database.

Page 9: Core Dev Book

Module 1

9

BlobServer The BlobServer servlet locates and serves binary large objects (or blobs for short) and is most commonly used for images. Blobs are not processed in any way — they are served served in the same format as they are stored in.

CookieServerThe CookieServer servlet serves cookies for Content Server pages, whether those pages are delivered by the ContentServer servlet or by the CS-Satellite application.

DebugServer This servlet provides tools to help debug XML or JSP code.

HelloCSDisplays version information about the Content Server software installed on your system.

General Rules for Content Server ServletsThe following is a list of rules that apply to Content Server servlets in general:

• Pertinent servlets are invoked to perform a discrete set of tasks such as generating HTML for web pages, adding a record to the database, or setting a cookie.

• Each servlet has a corresponding Java API with Java methods. XML tags and JSP tags are used to invoke these methods.

• You simply invoke the appropriate tag or method and let Content Server determine the appropriate servlet to call.

CS-Direct OverviewContent Server Direct (CS-Direct) provides you with a user interface that enables you to easily input, organize, and edit your content as objects called assets.

CS-Direct includes the following features:

• The Basic asset model

• The concept of a Sites & site plan

• CS-Direct XML & JSP tags

Basic Asset Model An asset is a Java object that either represents a piece of content on your web site or that allows you to create a structure for your site. Assets are the core of CS-Direct and CS-Direct Advantage.

There are two different types of assets, basic assets and flexible (flex) assets. The following section describes the basic asset model.

CS-Direct uses the basic asset model, where there is one primary storage table in the database for each type of asset. For example, you might have asset types such called Article that represents the articles on your site, and another asset type called Image that represents the images.

Page 10: Core Dev Book

Content Server Core Developer I

10

Assets can be:

• Created

• Edited

• Inspected

• Deleted

• Shared across sites

• Placed into workflow

• Tracked through revision tracking

• Searched for

• Previewed

• Published

During the process of designing your online site, you and others on your team examine your design and determine how the content of your site breaks down into assets. In general, content should be treated as an asset and not embedded into your code.

Sites and the Site PlanCS-Direct introduces the concept of a Content Server "site" to the Content Server product family. A Content Server site can manage all or part of the assets in your web site. For example, all the assets in a small web site, such as the Hello Asset World sample site, are contained in one site. However, a very large site can be divided into several sections. Each section may be managed by a different Content Server site.

When you install CS-Direct, the Site Plan tab appears in the Content Server interface. The Site Plan tab displays the Site Plan Tree, which is a representation of the site design for the Content Server site that you are currently logged in to.

Burlington Financial Sample Site CS-Direct provides a fully functional sample site named Burlington Financial. Most of the examples in this guide that illustrate CS-Direct functionality or coding practices are taken from this sample site so that you can examine them both in this training guide and online in the context of an actual online site.

Burlington Financial provides sample asset types, elements, SiteCatalog entries, a workflow process, and other components that you can use to create your web site.

Template Assets, Elements, & SiteCatalog Entries The CS-Direct introduces the Template asset, which formats the content of your web site.

Template assets represent elements in the Content Server interface when CS-Direct is present. These assets control the XML or JSP element that they represent, which means that the element can be managed with workflow and revision tracking. Template elements can format assets of one type only.

Even though the template asset controls the element it represents, the element code is still stored in the ElementCatalog table. When you create a template asset, CS-Direct creates a SiteCatalog page entry for it by default, as well.

By using template assets, the writers, editors, copywriters, and marketers at your organization can choose a formatting option for their assets without being required to code.

Page 11: Core Dev Book

Module 1

11

In other words, template assets serve as an intermediary between formatting code and content providers. Content providers can assign the code to their assets but they cannot modify it (unless they have the appropriate permissions).

CS-Direct XML & JSP Tags CS-Direct delivers several new tag families (both XML and JSP versions) that you use to code your elements. You use these tag families to identify, extract, and then display assets on your online site. Here are some of the basic tag families you will use most frequently:

CS-Direct Advantage OverviewContent Server Direct Advantage (or CS-Direct Advantage) provides you with a user interface which enables you input and edit flexible (flex) assets. CS-Direct Advantage also allows you to provide your site visitors with a different asset navigation structure than your content editors.

CS-Direct includes the following features:

• The Flex asset model

• Hierarchy and Attribute Inheritance

• Flex asset-related XML & JSP tags

Flexible Asset ModelEach attribute of a basic asset corresponds to a column in that asset type’s table. The attributes together compose one basic asset instance. In contrast, each attribute of a flex asset is itself an asset. This allows instances of flex assets to vary widely.

Another difference between basic and flex assets is that a basic asset’s attributes and the attribute values are stored in a single table. A flex asset’s values are stored in a different table that the flex assets themselves.

Additional Content Server FeaturesCSEE also provides the following features, regardless of which asset model you choose to use:

• Enhanced publishing functionality (an approval subsystem)

• Revision tracking functionality

• Workflow

• CS Tools, such as CS-Desktop, InSite Editor, CS-Designer and CS-DocLink

Tag Library Description

asset loads and displays asset fields

render renders Content Server pages, blobs, and elements

siteplan displays the Site Plan Tree pages

Page 12: Core Dev Book

Content Server Core Developer I

12

Approval & Publishing Content Server page is the composition of several components into a viewable, final output. Creating that output is called rendering. Making either that output or the content that is to be rendered available to the visitors of your online site is called publishing.

You publish by moving your content from your management system to the delivery system. CS-Direct delivers two publishing methods built with the Content Server publishing APIs. These publishing methods interact with the CS-Direct approval system, an underlying system that determines which assets have been approved.

When assets are ready to be published, someone marks them as approved. Then, when the publish process is ready to start, it invokes the approval system which compiles a list of all the approved assets, and examines all the dependencies for those assets. If an asset is approved but an asset that it is linked to is not approved, that asset is not published until the linked asset is also approved.

The CS-Direct publishing and approval systems track and verify all the asset dependencies, which maintain the integrity of the content on your delivery system. These systems ensure that only the assets that you have determined are ready to be published get published.

The CS-Direct publishing methods are as follows:

• Mirror to Server - A dynamic publishing method built with the Content Server Mirror API and copies approved assets from the Content Server database on one system to the Content Server database on another system.

• Export to Disk - A static publishing method that renders your approved assets into static HTML files, using the template elements assigned to them to format them. An administrator or automated process then copies those files to your delivery system using FTP or another file transfer method.

CS-Direct & Revision Tracking When you are using CS-Direct, the Content Server revision tracking feature is extended and implemented for asset types in the Content Server interface. There are additional administrative forms and the asset forms are modified to include revision tracking functionality when it is enabled for that asset type.

You specify which asset types you want to track, CS-Direct enables the revision tracking feature for the appropriate tables without your having to do it directly through Content Server and the content providers then check out and check back in their assets as they work.

Workflow CS-Direct introduces the workflow feature to the Content Server product family. Workflow is the movement of content from one person to another in a predictable, systematic way.

For example, perhaps all articles must be seen by both an editor and by someone from your legal department before they can be approved (and then published). You can use the workflow feature to ensure that the article is assigned to the appropriate person at the appropriate point in its life cycle and to restrict who has access to an asset at each stage.

Page 13: Core Dev Book

Module 1

13

Additional Interfaces for Working with Assets In addition to the core extensions to the Content Server interface (forms for creating and managing assets), CS-Direct delivers two alternative methods for entering assets into the Content Server database:

• CS-Desktop - Enables your users to Microsoft Word to create and edit their assets. Content providers who want to use Microsoft Word rather than the Content Server interface can install this feature on their personal computers. The feature installs a Content Server toolbar that provides CS-Direct functionality in the Microsoft Word client.

• InSite Editor - For content providers who need to make edits to (and perhaps approve) assets in the context of how they actually look when they are rendered in a browser. The InSite Editor allows content providers to work in a continuous preview mode.

To enable this interface, you and other developers must code your rendering templates to activate it for the appropriate asset types.

Searching & Search Engines CS-Direct comes with a search function that helps users find the assets that they want to work with. The default search mechanism is a SQL-based database search. You can replace the default search method with a Verity or AltaVista search engine.

To do so, you install the search engine (typically as part of the Content Server installation process). When a search engine is present, CS-Direct presents a different form on the Admin tab that you use to determine which asset types should use the search engine's index-based search and which (if any) asset types should use the default database search.

To enable searches for assets that you want to display in your online site on your delivery system, you use a combination of SQL queries, query assets, and collection assets. In certain cases, you might also want to use a search engine on your delivery system so that you can implement an index-based search feature for online site.

Page 14: Core Dev Book

Content Server Core Developer I

14

Lesson 1.2: CSEE Product ArchitectureIn this lesson you will learn about Content Server 5.0 product architecture.

Content Server Product StackThe following diagram illustrates the components common to a typical environment whether it be development, management, or publishing environment:

Figure 1: Content Server Product Stack

Software RequirementsContent Server requires a web server, an application server, a database and a browser. To find the current supported versions, go to http://www.openmarket.com/products/ContentServer/

Content Server EnvironmentsA Content Server system has four different environments:

• Development

• Q/A and Performance Testing

J2EE Application Server

Content Server/CS-Satellite

CS-Direct

CS-Direct Advantage

Web Server/CS-Satellite

CS-Engage

Database

CS

-Brid

ge X

ML

CustomJava

Beansand

Servlets

YourCS-DirectWeb Site

CustomContentServer

Elements

CS-Bridge Enterprise

Page 15: Core Dev Book

Module 1

15

• Management

• Delivery

The following diagram illustrates these environments:

Figure 2: Content Server Environments

• In the Development Environment, web and Java developers code the various componants of the web site. When their work is complete, they then move their work to the Testing Environment for testing.

• In the Testing Environment, QA Engineers test the code that the developers have created. The testing environment is also used for performance testing the web site. Once the code has been tested and approved by QA, it is moved to the Management and Delivery environments.

• In the Management Environment, Authors and Editors create and edit the content for the web site. Completed content is then published to the Delivery Environment so that visitors to the live web site can view it.

• The Delivery Environment contains completed code and content. It serves the finished web site to the site visitors.

Developers

ContentProviders:

EditorsAuthors

Web SiteVisitors

Firewall

DevelopmentEnvironment

ManagementEnvironment

DeliveryEnvironment

Content

Code

Code

Code

Content

TestingEnvironment

QA

Page 16: Core Dev Book

Content Server Core Developer I

16

Module Summary• Content Server consists of several servlets that run on top of an application server,

including the ContentServer and BlobServer servlets.

• The Content Server Direct application takes advantage of all of Content Server's features, while adding another layer to extend the content management features.

• Each environment (development, testing, management and delivery) requires the following components: Web browser, Web server, Content Server software, J2EE application server, and DBMS.

• Rendering is the construction of output that is displayed on the browser.

• A pagelet in the Content Server environment is the output of an HTTP request displayed in a browser.

• Content Server Direct (or CS-Direct) uses the basic asset model to create a structure for your content in which there is one primary storage table in the database for each type of asset.

Page 17: Core Dev Book

17

Module 2

Page Design and Assets

Module Learning ObjectivesAfter completing this module, you will be able to:

• Describe the features of Content Server, CS-Direct and CS-Direct Advantage.

• Define the functions of the various Content Server servlets.

• List the tasks that Content Server Direct can be used to complete.

• List the components of the Content Server product architecture that are common to an environment whether it be development, management, or publishing environment.

• Describe the Basic Asset Model in CS-Direct.

• Define the various asset types.

• Describe the difference between asset associations and asset relationships.

• Describe the functionality of the AssetMaker, including the Asset Description File.

Terms to Know

Terms Definition

Basic Asset The way in which CS-Direct stores content objects in one primary storage table in the database for each type of asset.

Asset Association

A parent-child relationship between two basic assets. For example, an Article asset can be a parent of an ImageFile asset. No field values are inherited in this relationship.

Asset Maker A utility used to create a new asset type.

Template Asset An asset that contains the code used to format your web site.

A Template asset is a site design asset.

Page 18: Core Dev Book

Content Server Core Developer I

18

Lesson 2.1: CS-Direct Asset TypesIn this lesson you will learn about the basic asset model in CS-Direct.

The Basic Asset ModelCS-Direct supports the basic asset type. Each basic asset type has its own primary storage table, which shares the name of the asset type. For example, asset instances of the asset type ImageFile are stored in the ImageFile table.

Because basic assets of the same asset type are stored in the same table, the properties (called attributes) of a basic asset are fixed. Each column contains a different attribute. For example, all Article assets are stored in the Article table. Each property (name, body, headline, author, etc.) of an Article asset is a separate column of the Article table.

Each asset type represents a different type of content. For example, you might have an asset type called Press Release to store press releases. You might have another asset type called ImageFile to store photos and graphics.

CS-Direct also introduces one complex asset type, called the template asset type. Complex assets store data in multiple tables.

Core and Sample Asset TypesDuring the process of designing your web site, you and your team will determine which parts of the site should be extracted as assets. All content should be treated as an asset and not embedded into your code.

Some asset types are not content themselves, but instead help you manage your content assets. These are called site design assets. Other asset types store code that is meant to be rendered, such as a navigation bar, or discrete snippets of logic that are executed on the live site.

Core asset types are included with CS-Direct whether or not you install the Content Server sample sites. The list of core assets follows:

• Page

• Collection

• Query

• Template

• SiteEntry

• CSElement

• Link

Other asset types, such as the Article asset, are sample asset types. Sample asset types are only installed if you install the Content Server sample sites.

Assets and the Content Server User InterfaceOn the CS-Direct Interface you will see a toolbar with these icons for the newly created asset type:

• Preview - Preview this item; View how the asset will be presented to site visitors.

• Inspect - Inspect this item; Examine the attributes and their values of a specific asset.

Page 19: Core Dev Book

Module 2

19

• Edit?Edit this item; Make modifications to the values of the attributes of a specific asset.

• Delete?Delete this item; Delete a specific asset of a particular type.

Asset Types: CS-Direct Out-of-the-Box and Samples There are several core and sample asset types provided by CS-Direct:

Core Asset Types• Query

• Collection

• Page

• Template

• CSElement

• SiteEntry

• Link

Burlington Financial Sample Asset Types• Article

• ImageFile

• Image (Deprecated)

• Linkset (Deprecated)

• StyleSheet

Hello Asset World Sample Asset Types• HelloArticle

• HelloImage

Core Asset Types

Combination Site Design and Content: Query Asset TypeA query asset stores a SQL query and returns a single asset type. When you create a query asset, you specify what kind of asset the query asset returns in the result of Query field: Articles, ImageFiles, etc.

Combination Site Design and Content: Collection Asset TypeA collection asset stores an ordered list of assets of one type. You create (or design) a collection asset by naming it and selecting query assets for it. By default, you can select up to three query assets. If your site design requires more queries for collection assets, you can create additional named associations for the additional queries.

A collection uses a query asset to obtain a list of possible assets for the collection. You build (or populate) a collection by running its queries, selecting assets from the results of

Page 20: Core Dev Book

Content Server Core Developer I

20

the queries, and then ranking (or ordering) the assets that you selected. This ranked, ordered list is the collection.

Site Design: Page Asset TypePage assets are site design assets that store references to other assets.

These page assets represent sections of the site, in essence the structure or organization of the site. They do not represent each and every rendered page that can possibly be served.

Typically, you create page assets only once?when you design the site. You relate collections, queries, articles, etc. with page assets and code template elements that format the types of assets you want to associate with the page asset.

Before you can select the correct content for your page assets, you must be familiar with how your site is structured and what your template elements for page assets are designed to do. That is why you and other site developers (the people coding elements and creating template assets) typically create the page assets for a site.

Site Design: Template Asset Type The site design asset types other than the template asset (page, collection, and query) provide organizational or structural logic for the assets that provide the content for an on-line site.

A template is a special kind of site design asset because it provides the formatting code (the combination of content code and format code) for all other asset types. You create one or more template assets for each of the other asset types that you plan to display on your on-line sites

When you create a template asset, you also code a template element (element). You can use either the Template Asset Form to code the element or you can write the element in Content Server Explorer and name it according to the applicable CS-Direct naming convention.

Template developers can create elements and register them as templates two ways:

• Create the element via Content Server Explorer and register Template via Form.

• Create the element via Template Form and register Template via Form. – Recommended Procedure

Regarding template naming conventions, you should use the Template Asset Form of CS-Direct:

• Name: Template_Name

• For Asset Type: Asset_Type

Burlington Financial Sample Asset Types

Content: Article Asset TypeThese are some of the attributes that describe the article asset type, which contains a newspaper-like document:

• Description - The headline of the article.

• Abstract - A statement summarizing the important points of a text.

• Byline - The name of the author of the article.

Page 21: Core Dev Book

Module 2

21

• Creditline - The organization responsible for the article.

• urlbody - The link to the actual text of the article.

Content: ImageFile Asset Type ImageFile assets are stored as BLOBs in the ImageFile table under urlpicture field. The ImageFile asset graphic is stored on a local file system. When a user requests an ImageFile, BlobServer verifies that the user has the correct permissions before serving the file.

Site Design: StyleSheet Asset TypeStyleSheet assets store style sheet files of any format (such as CSS, XSLT, etc.). This asset type is installed only if you install the Burlington Financial sample site.

Typically, you do not assign template assets to StyleSheet assets because they are, effectively, templates in themselves. However, if you need to create a different kind of StyleSheet or you want to display information about the StyleSheet on a site, you can create a template asset and assign it to a StyleSheet asset.

Dependency Type The “exact” dependency type indicates that two assets are inseparable. Use when:

• The assets are highly interdependent.

• One asset “contains” the other.

• Two assets can be considered one combo-asset but are separated because of workflow or work process reasons.

The “exists” dependency type indicates that two assets are companions. Use when:

• The association is optional.

• Any asset of the appropriate asset type will do.

• Edits on the two assets are likely to be independent.

“Exists” is the default

Page 22: Core Dev Book

Content Server Core Developer I

22

Exercise 2.1.1: Working with Assets via CS-DirectPurposeWhile performing this exercise, you will learn how to:

• Familiarize yourself with the assets types used in the Burlington Financial.

• Perform a simple search for an asset.

• Work with the asset functions: Inspect, Preview, and Edit.

• Save a search.

Begin the ExerciseThis exercise has the following parts:

• Logging in to CS-Direct

• Searching for Assets

• Working with Asset Functions

• Saving a Search

• Adding Assets to Active List

Logging in to CS-Direct1. In the Windows Explorer, double-click on cskit5.5/jconsole to invoke the Jump

Start kit.

2. Using a browser, go to the Content Server Login screen of CS-Direct by typing: http://localhost:7001/servlet/ContentServer? pagename=OpenMarket/Xcelerate/UIFramework/LoginPage in the url field of the browser.

3. Save this link to the Internet Explorer Favorites folder for future reference.

4. Enter admin in the Login Name field and demo in the Password field. Then click the Login button.

5. You will be presented with a list of sites in which admin is enabled. Since your goal is to become familiar with the assets of Burlington Financial, click the BurlingtonFinancial link to go directly to this site that is content managed by CS-Direct.

Searching for Assets1. From the Content Server CS-Direct Interface screen, click the Search button to get a

list of asset types that are searchable.

2. Click the Find Article link to perform a simple search of article assets.

To search for a particular article instance, enter a key word that will be your search criteria. (Example: In the Search field, select Name and in the field, enter AMD). By clicking the Search button, you will be searching the Article table for all records that have AMD as the value of the Name field.

Page 23: Core Dev Book

Module 2

23

Saving a SearchIf the preceeding search will be executed many of times, then as a rule, save the search so that a business user can execute the search again without building the search criteria.

1. Click the Save This Search link.

2. In the Name field, enter AMD Article Search.

3. Check the Users of the following roles check box and from the Sharing Search Criteria list, select Author.

All users in Author role will be able to use this search.

4. From the Other Publications box, you can select BurlingtonFinancial.

Users in Author role in Burlington Financial site will be able to use the AMD Article Search.

5. Click the Save button.

Working with Asset Functions1. From the resultset of executing the simple search, inspect the asset’s attributes by

clicking the Inspect icon. Inspecting allows a business user to view the attributes (or fields) and their corresponding values of a particular asset.

2. Click the Preview icon to view how the asset will be presented to site visitors. Previewing opens a new browser window that will display how the asset is rendered by the template assigned to it.

3. Click the Edit icon to invoke the edit form that allows business users to make changes to an asset’s attributes values. Make any changes you like and click the Save Changes button to commit the change. Then, preview the asset again to view the changes.

Adding Assets to Active ListSave the assets that you use frequently to your active list. Next time you need to use these asset, you can find them in your Active List tab. The assets will be stored for the user or all the users in the same role, if you choose thos option, between sessions.

1. From the Content Server CS-Direct Interface screen, click the Search button to get a list of asset types that are searchable.

2. Click the Article link to perform a simple search of article assets and then click the Search button again.

3. Check the assets you would like to add to your active list and then click on the Add to My Active List button.

4. Go to Active List tab to find your active list assets.

Page 24: Core Dev Book

Content Server Core Developer I

24

Lesson 2.2: AssetMakerIn this lesson you will learn about AssetMaker for CS-Direct.

IntroductionAssetMaker helps you create, and delete custom CS-Direct asset types.

To create an asset type, you code an XML file called an Asset Descriptor File (ADF) that describes your new asset type. AssetMaker then uses the ADF to create the specified asset type.

Asset Descriptor FileWhen AssetMaker reads the Asset Descriptor File, it:

• Creates the database table.

• Generates the XML stub elements (such as New, Inspect, Edit, Delete, Copy, and Search).

• Registers stub elements in ElementCatalog to control CS-Direct user interface. (Do to modify.)

• Registers SQL files in SystemSQL table. (Do not modify.)

• Updates the SystemInfo, Category, and AssetType tables.

• Creates the forms that the users on the management system will use to create and edit instances of the asset type.

All information required to create an asset and its database table are defined in the Asset Descriptor File. However, only custom fields (with JDBC data types) specific to the asset type are defined in the Asset Descriptor File. AssetMaker automatically defines standard asset fields.

Coding an Asset Descriptor FileThe following code shows the general format of an Asset Descriptor File (ADF):

<ASSET><PROPERTIES>

<PROPERTY></PROPERTY><PROPERTY></PROPERTY>

</PROPERTIES></ASSET>

You use the <PROPERTY> tag to create a custom field.

Overview of the AssetMaker TagsAn asset descriptor file begins with the standard XML version tag:

<?xml version="1.0" ?>

The ASSET tag, which follows the XML version tag, names the asset type, provides the name of the database table for the asset type, and determines what graphical notation

Page 25: Core Dev Book

Module 2

25

designates that a field is required. The opening tag is always the first line of code and the closing tag is always the last line of code in the asset descriptor file.

There is only one ASSET tag pair in each asset descriptor file because an asset descriptor file defines one asset type.

A pair of PROPERTIES tags marks the section of the file that holds the property descriptions. The opening tag is always the second statement in the asset descriptor file. There is only one PROPERTIES tag pair in each asset descriptor file.

Nested within the PROPERTIES tag pair are pairs of PROPERTY tags that define each property (field and column) for assets of this type. The PROPERTY tag provides both the name of the column in the database that holds the values entered for this field as well as the field name on the form that you use to create assets of this type.

Asset TagThis tag names the new asset type and its database table and sets certain default values.

Its syntax is represented as:

<ASSET NAME="..." DESCRIPTION="…" PROCESSOR="…" DEFDIR="…">

Example:

<ASSET NAME="PostItNotes” DESCRIPTION="PostItNotes” PROCESSOR=“5.0” DEFDIR="D:\futuretense\postitnotes">

</ASSET>

Property TagThis tag Instructs AssetMaker to create a new property and provides the name for the column in the table and the name for the field in the CS-Direct forms.

Its syntax is represented as:

<PROPERTY NAME="column_name" DESCRIPTION="field_name">

Attribute Description

NAME The name of the asset (internal name)

DESCRIPTION The name of the asset seen by CS-Direct users (external name).

PROCESSOR Specifies the version number of AssetMaker for which this asset description is designed.

DEFDIR Required if the asset type contains url fields (for uploaded files), see the Article table.

ATTRIBUTE DESCRIPTION

NAME The internal name of the property, that is, the name of

the column in the database table for this asset type.

Page 26: Core Dev Book

Content Server Core Developer I

26

Example:

<PROPERTY NAME=”title” DESCRIPTION=”Title”><STORAGE TYPE=”VARCHAR” LENGTH=”100”/><INPUTFORM TYPE=”TEXT” WIDTH=”65” MAXLENGTH=”65” REQUIRED=”YES”

DEFAULT=”DefaultValue”/><SEARCHFORM DESCRIPTION=”Title Contains:” TYPE=”TEXT”

WIDTH=”20” MAXLENGTH=”30”/>

</PROPERTY>

Each pair of PROPERTY tags are the following tags:

• STORAGE, which determines the name and data type of the column. This value defines how field values are stored in the database.

• INPUTFORM, which determines the appearance of the field on the Edit and Inspect forms, its name and format. For example: is it a drop-down list or a check box or a text field? The TYPE specified by INPUTFORM must be compatible with the TYPE specified by STORAGE.

• SEARCHFORM, which determines whether the field is displayed on the CS-Direct Advanced Search form. Note that if the value of the TYPE parameter is "Table" or “Date”, a drop down list will not appear on the SimpleSearch form, although it will appear in the Advanced Search form for the asset type.

• SEARCHRESULTS, which determines which field values appear in the search results form that CS-Direct displays after a search. By default, the field is not displayed unless INCLUDE is set to “TRUE”. (This tag is optional.)

If you are modifying a standard field, do not set SEARCHRESULTS to true for name or description.

Input Types for the FieldsThe INPUT TYPE parameter specifies how data can be entered in a field when it is displayed in the CS-Direct forms. The following table lists all the input types. Note that the input type for a field must be compatible with the data type of its column:

Table 1: Input Types of the Fields

DESCRIPTION The external name of the property, that is, the name of the field in the CS-Direct forms.

Input TYPE Description

TEXT A single line of text.

Corresponds to the HTML input type named TEXT.

ATTRIBUTE DESCRIPTION

Page 27: Core Dev Book

Module 2

27

TEXTAREA A text box, with scroll bars, that accepts multiple lines of text.

Corresponds to the HTML input type named TEXTAREA.

If you expect large amounts of text to be entered in the field, it is a good idea to create a text box that displays the contents of a URL column. To do so, you must specify a string for PROPERTY NAME that begins with the letters “url” and set the STORAGE TYPE to VARCHAR.

When a user clicks Save, the text entered into this kind of field is stored in the file directory specified as the default storage directory for this asset type. You can specify the default storage directory (defdir) in either the asset descriptor file, or in the AssetMaker form when you create the asset type.

Note that you can specify an unlimited size for a url field that is edited via a TEXTAREA field by not specifying a value for the MAXLENGTH parameter.

UPLOAD A field that takes a file name (a URL) and presents a Browse button so that you can either enter the path to and name of a file or browse to it and select it.

When you specify that a field is an upload field, set a string for PROPERTY NAME that begins with the letters “url” and set STORAGE TYPE (the property’s data type) to VARCHAR.

You can also use the BLOB storage type for an upload field; in this case, the PROPERTY NAME string does not have to begin with url.

When the user clicks Save, Content Server uploads the selected file and stores it in the file directory specified as the default storage directory for this asset type. You can specify the default storage directory (defdir) in either the asset descriptor file, or in the AssetMaker form when you upload the file.

Note: the size of a file that is selected in an upload field cannot exceed 30 megabytes.

SELECT A field that presents a drop-down list of options that can be selected.

You can either specify the options that are presented in the list or you can specify a query so that the options are selected from the database (or an external table) and presented dynamically.

Corresponds to the HTML input type SELECT.

CHECKBOX A check box field.

You can specify the names of the check box options or you can specify a query so that the names are selected from the database (or an external table) and presented dynamically. This input type allows the user to select more than one option.

Corresponds to the HTML input type CHECKBOX.

Input TYPE Description

Page 28: Core Dev Book

Content Server Core Developer I

28

Columns in the Asset Type’s Database TableWhen AssetMaker creates the database table for the asset type, it creates columns for all the properties defined by the pairs of PROPERTY tags in the asset descriptor file.

However, CS-Direct needs several default columns for its basic functionality and so AssetMaker creates each of the default columns in the asset type’s storage table in addition to the columns defined in the asset descriptor file for that asset type.

Storage Types for the ColumnsThe STORAGE TYPE parameter specifies the data type of a column. The data types are defined by the Content Server database properties located in the futuretense.ini file.

The following table presents the possible data types for your asset type’s table columns:

RADIO A radio button control.

You can either specify the names of the radio options or you can specify a query so that the names are selected from the database (or an external table) and presented dynamically. This input type allows the user to select only one option.

Corresponds to the HTML input type RADIO.

EWEBEDITPRO A field whose contents you edit by using the eWebEditPro HTML editor, a third-party tool from Ektron, Inc.

When you specify that a field is an eWebEditPro field field, it’s best if you make it a URL field. That is, set a string for PROPERTY NAME that begins with the letters “url” and set STORAGE TYPE (the property’s data type) to VARCHAR.

ELEMENT Calls an element that you create to display a field on the ContentForm, ContentDetails, or SearchForm forms. The custom element must be found at one of the following locations:

For a field on the ContentForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/ ContentForm/fieldname

For a field on the ContentDetails form:

OpenMarket/Xcelerate/AssetType/myAssetType/ContentDetails/fieldname

For a field on the SearchForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/SearchForm/fieldname

Where myAssetType is the asset type that you are creating the custom field for, and fieldname is the name of the custom field.

An ELEMENT field can have any storage type, including BLOB.

Input TYPE Description

Page 29: Core Dev Book

Module 2

29

Table 2: Storage Types

Datatypes for Standard Asset FieldsYou can customise the appearance of CS-Direct’s standard asset fields, however, the datatypes of these fields must not be changed.

System fields, which are identified in the following table, can be altered cosmetcally, but their behavior cannot change. For other fields, the length of the varchar can be changed, but the datatype must remain the same. The following table lists the datatypes for standard fields:

Table 3: Basic Asset Type Standard Fields

Type (generic ODBC/JDBC data type)

Property

CHAR cc.char

VARCHAR cc.varchar

SMALLINT cc.smallint

INTEGER cc.integer

BIGINT cc.bigint

DOUBLE cc.double

TIMESTAMP cc.datetime

BLOB cc.blob

LONGVARCHAR cc.bigtext

Field Datatype

ID(System Field) NOT NULL NUMBER(38)

NAME NOT NULL VARCHAR(64)

DESCRIPTION VARCHAR(128)

TEMPLATE(System Field) VARCHAR(64)

SUBTYPE VARCHAR(24)

FILENAME VARCHAR(64)

PATH VARCHAR(255)

STATUS(System Field) NOT NULL VARCHAR(2)

EXTERNALDOCTYPE (System Field)

VARCHAR(64)

URLEXTERNALDOCXML(System Field)

VARCHAR(255)

Page 30: Core Dev Book

Content Server Core Developer I

30

Indirect Data Storage with a url Field In the Content Server database, object tables (such as the AssetType table) can have url fields, which allow you to store data on the file system rather than in the database. This means that storage of large bits of data is external to the database management system.

To create a url field, the field name must begin with the letters url. Using url as the first three letters of a field name tells Content Server to treat that field as an indirect data field.

Why Use a url Field?There are several good reasons to use a url field:

• When the database management system you are using does not support fields large enough to accommodate the size of the data that you want to store there.

• If the database management system you are using does not support enough fields in an individual table to contain the data that you want to store.

• Because the performance of selecting data degrades with large field sizes.

Default Storage DirectoryAny table with a url field must have a default storage directory (or defdir) specified for it. This directory is where the values entered into the field are actually stored.

The defdir column of the SystemInfo table holds the name of the default storage directory for tables with url fields.

The value entered into a url field is actually a relative path to a file since the value in a url field is appended to the value of the table's defdir setting.

ElementCatalog URL & the Jump Start KitConsider the field url of the ElementCatalog table:

elementname = OpenMarket/Samples/NewPortal/JSP/main

Editing this element with Content Server Explorer, the element designer is actually using the built-in text editor of Content Server Explorer on file main.jsp.

The location of main.jsp is determined by the value of defdir and the value of url:

• defdir = $(CS.Property.cs.jskpath)\futuretense\Storage\elements\

URLEXTERNALDOC(System Field)

VARCHAR2(255)

CREATEDBY(System Field) NOT NULL VARCHAR(64)

UPDATEDBY(System Field) NOT NULL VARCHAR(64)

CREATEDDATE(System Field) NOT NULL DATE

UPDATEDDATE(System Field) NOT NULL DATE

STARTDATE DATE

ENDDATE DATE

Field Datatype

Page 31: Core Dev Book

Module 2

31

Note: CS.Property.cs.jskpath = /JumpStartKit

• url = OpenMarket\Samples\NewPortal\JSP\main.jsp

Therefore, the location of main.jsp is:

\JumpStartKit\futuretense\Storage\elements\OpenMarket\Samples\NewPortal\JSP\main.jsp

To view the contents of this file with Content Server Explorer, double-click on its urlbody field value. The built-in text editor of Content Server Explorer will then open file 972312773045.txt.

The location of 972312773045.txt is determined by the value of defdir and the value of urlbody:

• defdir = $(CS.Property.cs.jskpath)\futuretense\Storage\Storage\ Article\

Note: CS.Property.cs.jskpath = /JumpStartKit

• urlbody = 972312773045.txt

Therefore, the location of 972312773045.txt is:

\JumpStartKit\futuretense\Storage\Storage\Article\972312773045.txt

Page 32: Core Dev Book

Content Server Core Developer I

32

Exercise 2.2.1: Creating Hello Personal Asset TypeFor this exercise, the site administrator is responsible for introducing additional custom assets that follow the basic model. CS-Direct includes the AssetMaker utility that site administrators can use to introduce additional custom asset types.

PurposeIn this lab exercise, you will complete the following actions:

• Log in CS-Direct as an administrator for Hello Asset World site.

• Code the Asset Descriptor File.

• Review and load the Asset Descriptor File.

Begin the ExerciseThis exercise has the following parts:

• Creating the Asset Descriptor File

• Loading Your ADF

• Enabling the HelloPersonal Asset Type

• Adding a New Start Menu

• Adding a Search Start Menu

• Creating HelloPersonal Subtypes

Creating the Asset Descriptor File1. Open the CourseMaterials/HelloPersonalsADF.xml file using Notepad or

WordPad.

2. Using the other PROPERTY statements as a guide, and the information about the PROPERTY tag in section “Property Tag” on page 25 and Table 1, “Input Types of the Fields” on page 26, create three new properties in your ADF:

3. Save your file as HelloPersonal.xml

Loading Your ADF1. To load the Asset Descriptor File, from the Admin tab, expand the AssetMaker node

and then double-click the Add New option.

Property Name

Property Description Property Data Type

greeting Greeting VARCHAR(255)

urlad Personal Ad VARCHAR(64) - reference to the file on the file system

homeplanet Home Planet VARCHAR(64)

Page 33: Core Dev Book

Module 2

33

2. Enter HelloPersonal in the Name field and browse for HelloPersonalADF.xml in the Descriptor File field.

3. Click the Save button.

4. To create the HelloPersonal table, click the Create Asset Table radio button and then click the Create Asset Table button.

5. To create the stub elements, click the Register Asset Elements button.

The location of the created stub elements is OpenMarket/Xcelerate/AssetType/HelloPersonal of the ElementCatalog.

6. Right-click the AssetMaker node and then click the Refresh option. You will now see an entry for the HelloPersonal asset type.

Enabling the HelloPersonal Asset Type1. From the Admin tab, expand the Sites > HelloAssetWorld > Asset Types node.

2. Double-click the Enable option to view a list of asset types that you can enable for Hello Asset World.

3. Select HelloPersonal and then click the Enable Asset Type button to indicate that the preceeding asset type is legal for Hello Asset World.

Note: Enabling the HelloPersonal asset type only gives System users the ability to search for instances of the HelloPersonal asset type. It does not provide the ability to create new instances of HelloPersonal asset type.

Adding a New Start MenuFrom the Admin tab, expand the Start Menu node.Double-click the Add New option to create a new Start Menu for the HelloPersonal asset type. The Start Menu window will appear. Enter the following fields:

1. In the Name field, enter New Hello Personal

2. In the Description field, enter Creates a New Hello Personal asset

3. From the Type menu, select New.

4. From the Asset Type menu, select HelloPersonal asset type.

5. From the Sites menu, choose the HelloAssetWorld site.

6. From the Roles menu, select the following roles that you want to be able to create new HelloPersonal assets.

- HelloEditor- HelloAuthor

If you select HelloAuthor and HelloEditor roles, Coco and anyone else in these roles will be able to log in and created new instanses of HelloPersonal asset type.

7. Leave the WorkflowProcess field unchanged.

This field is used to automatically place each new asset in to the workflow.

8. Click the Save button at the bottom of the screen to save the new start menu item.

Page 34: Core Dev Book

Content Server Core Developer I

34

Adding a Search Start MenuFrom the Admin tab, expand the Start Menu node.Double-click the Add New option to create a new Start Menu for the HelloPersonal asset type. The Start Menu window will appear. Enter the following fields:

1. In the Name field, enter Find Hello Personal

2. In the Description field, enter Searches for a New Hello Personal asset

3. From the Type menu, select Search.

4. From the Asset Type menu, select HelloPersonal asset type.

5. From the Sites menu, choose the HelloAssetWorld site.

6. From the Roles menu, select the following roles that you want to be able to create new HelloPersonal assets:

- HelloEditor- HelloAuthor

If you select HelloAuthor and HelloEditor roles, Coco and anyone else in these roles will be able to log in and search for HelloPersonal assets.

7. Leave the WorkflowProcess field unchanged.

Note: The WorkflowProcess field should not be in this form (known bug).

8. Click the Save button at the bottom of the screen to save the search start menu item.

Creating HelloPersonal Subtypes1. From the Admin tab, expand the Asset Types > HelloPersonal node.

2. Double-click the Subtypes node and then click the Add New Subtype button to add a new subtype for your asset type. The Add New HelloPersonal Subtype window will appear:

Page 35: Core Dev Book

Module 2

35

a. In the Name field, enter Female.

b. From the list of sites, select HelloAssetWorld site.

c. Click the Add New Subtype button to save the subtype.

3. Repeat the preceeding steps to create Male subtype.

Page 36: Core Dev Book

Content Server Core Developer I

36

Exercise 2.2.2: Creating Hello Personal AssetsPurposeIn this lab exercise, you will learn how to create instances of the new Personal asset type.

Begin the ExerciseFollow these directions for completing this lab exercise.

1. If you are not already logged in, log in to the CS-Direct user interface with the user name Coco and the password hello. This logs you into the HelloAssetWorld CS-Direct site.

2. Click the New assets button at the top left-hand corner of the screen.

3. Click the New HelloPersonal asset type link. The New HelloPersonal window displays on the right-hand side of the screen.

4. Complete all required fields as indicated by an asterisk (*).

Note: You can either enter your own values into the HelloPersonal form fields or cut and paste in values from files in the CourseMaterials/HelloWorldPersonals folder.

5. Repeat this process to add more HelloPersonal assets.

Page 37: Core Dev Book

Module 2

37

Lesson 2.3: Builing a Content Server Direct Web Site

In this lesson you will learn about building a web site with CS-Direct.

Developing the Hello Asset World Web SiteIn this course, you will be adding a new page to the HelloAssetWorld sample site that comes with Content Server. The new page that you create will display the Personals asset type that you created in a previous lesson and allows you to navigate among various instances of the Personals asset.

The finished page will look like the following screen shot:

Figure 3: HelloWorld Personal Page

In order to create this web page, you will need to take the following steps:

• Create a Page asset called PersonalPage.

• Place the PersonalPage asset in the Site Plan Tree.

• Associate each Personal asset with the appropriate HelloImage asset.

• Create a Query asset called PersonalQuery which will retrieve the asset IDs of your Personal assets. (This has already been done for you.)

• Create a Collection asset called PersonalCollection which contains the results of PersonalQuery.

Page 38: Core Dev Book

Content Server Core Developer I

38

• Create a Template asset called PersonalTemplate that displays the Personals asset and its associated ImageFile asset.

• Create a Template asset called QueryTemplate that displays the results of a query as a navigation bar.

• Create a Template asset called HelloPersonalPage that calls the PersonalTemplate and the QueryTemplate.

The exercises in this section lead you through the first six of these tasks.

Page 39: Core Dev Book

Module 2

39

Lesson 2.4: The Page Asset TypeA Content Server Page asset is a container that holds other assets that you want to display on your finished web site. Its content can correspond exactly to the content of the web page that you want to create but it does not have to do so.

After you have created a page asset, you place it into the Site PlanTree. The Site Plan Tree is a visual model of your web site’s hierarchy. If you choose to create a navigation bar for your web site using the siteplan tags, the navigation will be created based upon the hierarchy of the Page assets in your Site Plan Tree.

Page 40: Core Dev Book

Content Server Core Developer I

40

Exercise 2.4.1: Creating and Placing Page AssetsIn this exercise you will create and place page assets.

Page stores references to other assets. Arranging and designing page assets are how you represent the organization or design of your site. You design page assets by selecting the appropriate collections, articles, imagefiles, queries, and so on for them. Then, you position your page assets on the Site Plan tab that represents your site in the tree on the left side of the Content Server interface.

PurposeIn this lab exercise, you will complete the following actions:

• Create a page asset.

• Place the page asset in the Site Plan Tree.

Begin the ExerciseThis exercise has the following parts:

• Adding Subtypes to the Page Asset Type

• Creating Page Assets

• Placing Pages in the Site Plan Tree

Adding Subtypes to the Page Asset TypeIn the following steps you will create two suptypes for the Page asset type: articles and personals. You use there subtypes in the HelloAssetWorld site only. The subtypes distinguish pages that render HelloArticles assets from the ones that render HelloPersonal assets.

1. From the Admin tab, expand the Asset Types > Page node.

2. Double-click the Subtypes node to add a new subtype for your asset type.

a. In the Name field, enter articles.

b. From the list of sites, select HelloAssetWorld site.

c. Click the Add New Subtype button to save the subtype.

3. Repeat the preceeding steps to create personals subtype.

Creating Page Assets1. Click the New button, then click the Create New Page link to create a new page asset.

2. To create a page asset representing the main page of HelloAssetWorld, enter the following values in these fields:

- Name: HelloPersonalsHome- Description: HelloPersonals Home Page- Subtype: personals

3. Click the Save button.

4. Use the preceeding steps to create two more Page assets: FemaleAliensPage and MaleAliensPage.

Page 41: Core Dev Book

Module 2

41

Placing Pages in the Site Plan Tree1. From the Site Plan tab in the Content Server Direct UI, right-click Placed Pages node

and select the Place Page option.

2. Rank page asset HelloPersonalsHome with a value of 10 and then click the Save button.

3. Expand the Placed Pages node again. Right-click on the HelloPersonalsHome node and select the Place Page option again.

4. Rank FemaleAliensPage and MaleAliensPage assets with a value of 10 and 20 and then click the Save button.

Page 42: Core Dev Book

Content Server Core Developer I

42

Lesson 2.5: Asset Relationship and AssociationAsset type associations allow a relationship between asset types. Relationships are between individual instances of an asset.

Typically, you create page assets only once — when you design the site. You relate collections, queries, and articles with page assets, and code template elements that format the types of assets associates with the page asset.

The table below outlines the asset type associations in which the page asset type is the parent of the association:

Thus, a page asset is a container of other assets.

Following are some examples using the home page of the Burlington Financial site:

Sample Burlington Financial Site

Figure 4: Page: Home (sample 1)

with the Collection with the Query with the Article

• Page P1 - Collection C1

• Page P2 - Collection C5

Page P1 - Query Q2 Page P1 - Article A4

Page P1 - Article A7

Collection: HomePage Stories

Page: Home

Collection: HomePage Columns

Collection: Editor’s Pick

Collection: Analyst Home Stories

Query: Home Wire Feed

Page ←Association→ Collection Association Name: Top Stories Dependency Type: Exists

Page ←Association→ Query Association Name: WireFeed Dependency Type: Exists

Page ←Association→ Collection Association Name: Sidebar Top Dependency Type: Exists

Page ←Association→ Collection Association Name: Sidebar Middle Dependency Type: Exists

Page ←Association→ Collection Association Name: Sidebar Bottom Dependency Type: Exists

Page 43: Core Dev Book

Module 2

43

Figure 5: Page: Home (sample 2)

Collection: HomePage Stories

Page: Home

Collection: HomePage Columns

Collection: Editor’s Pick

Collection: Analyst Home Stories

Query: Home Wire Feed

Home ←Relationship→ HomePage Stories Association Name: Top Stories

Home ←Relationship→ Home Wire Feed Association Name: WireFeed

Home ←Relationship→ HomePageColumns Association Name: Sidebar Top

Home ←Relationship→ Editor’s Pick Association Name: Sidebar Middle

Home ←Relationship→ Analyst Home Stories Association Name: Sidebar Bottom

Page 44: Core Dev Book

Content Server Core Developer I

44

Exercise 2.5.1: Creating Asset AssociationIn this exercise you will create associations between a HelloPersonal asset type and a HelloImage asset type. This allows to display the correct HelloImage for each page of HelloAssetWorld.

Basic asset types have very simple parent-child relationships. You use these relationships to associate or link assets to each other. Then, when you design the on-line templates for your on-line sites, you code template elements that identify, extract, and display an asset's children or parent assets in appropriate ways.

PurposeIn this lab exercise, you will complete the following actions:

• Create asset type associations (admin)

• Create asset type associations (user)

Begin the ExerciseThis exercise has the following parts:

• Creating Asset Type Association

• Creating Asset Relationship

Creating Asset Type AssociationCreating asset type associations is the responsibility of the Site administrator (Coco/hello).

1. From the Admin tab, expand the Asset Types > HelloPersonal > Asset Association node.

2. Double-click the Add New option to create a new asset type association between HelloPersonal asset type and HelloImage asset type.

3. In the Name field, enter photo1

4. In the Description field, enter main photo.

5. For the Child Asset, select HelloImage.

6. For the HelloPersonal Subtypes, select Any.

7. For the Dependency Type, select the Exists radio button (default).

8. Click the Add New Association button.

Creating Asset RelationshipCreating asset relationships is the responsibility of the business users of the site. Since you are currently logged in as the Site administrator (Coco/hello), you can log out of CS-Direct and re-login as a business user (Moe/hello) of HelloAssetWorld.

Page 45: Core Dev Book

Module 2

45

1. First, search for all of the HelloImages for HelloAssetWorld and add them to your Active List:

a. Click the Search button and click the HelloImage link to implement a simple search for all HelloImage assets of HelloAssetWorld.

b. At the Search for HelloImage window, click the Search button again to display all HelloImages of HelloAssetWorld.

c. For each HelloImage record displayed, select the associate checkbox at the right.

d. Finally, click the Add to My Active List button.

2. Search for the HelloPersonal assets of HelloAssetWorld, select any HelloPersonal asset and then click the Edit icon.

3. In the asset edit window, scroll down to the Related: section and find the Associated HelloImage link. This is where you will make an Asset Retionship between the HelloPersonal asset a HelloImage asset:

a. From the Active List tab, highlight a HelloImage asset by clicking its node once.

b. Then click the Add Select Items button corresponding to HelloPersonal – HelloImage Association to make the relationship.

c. Click the Save Changes button.

4. Repeat the preceeding steps for the remaining HelloImage assets that need to be related to other Alien Personals.

Note: If you would like to use more HelloImage assets for your personals, you can create additional HelloImage assets and upload sample image file located in the CourseMaterials/HelloPersonals/alien_images directory.

Page 46: Core Dev Book

Content Server Core Developer I

46

Lesson 2.6: Query and Collection AssetsA Query asset contains a SQL query that you code to retireve other assets from the Content Server database.

Query assets can be used as a stand-alone method of retireving and ordering data from the database, or they can be used as the basis for a Collection asset.

A Collection asset allows business users to organize the resultset that is retrieved from the database using the Content Server user interface.

Page 47: Core Dev Book

Module 2

47

Exercise 2.6.1: Building Collection AssetsThe objective of this lab exercise is to build a collection of HelloPersonal assets for use on the HelloPersonalsHome page asset.

Collection assets allow buisness users to organize the resultsets retrieved by a Query asset. In this case, the Query asset you will use to create the collection is already made for you—it is called HelloPersonalQuery.

PuposeIn this lab exercise, you will complete the following actions:

• Create a new Collection asset.

• Build the Collection asset.

Begin the ExerciseThis exercise has the following parts:

• Creating Query Assets

• Creating Collection Assets

• Building Collections

• Assign Collections to Pages

Creating Query AssetsThe query asset will query HelloPersonal table and extract assets that match the query. This query can be used later by the collections. Complete the following steps to create query assets:

1. If necessary, log in to the CS-Direct user interface with the user name Coco and the password hello.

2. Click New on the button bar and then select Query from the list of asset types. (Query asset type must be enabled for your site). The Query form appears.

3. Fill in the following fields with the following values:

a. In the Name field, type FemaleAliensQuery.

b. In the Description field, type a brief description of the query.

c. In the Result of Query, select HelloPersonal.

d. In the SQL query text box, type the following query:

SELECT * FROM HelloPersonal WHERE status!='VO' AND subtype='Female'

e. Click the Save button to save the query asset.

4. Follow the preceeding steps to add another query called MaleAliensQuery. Use the following SQL statement for your query:

SELECT * FROM HelloPersonal WHERE status!='VO' AND subtype='Male'

Note: If you named your subtypes female and male (all small letters) use the exact names in your queries. Content Server is case sensitive.

Page 48: Core Dev Book

Content Server Core Developer I

48

Creating Collection AssetsComplete the following steps to create a collection asset:

1. Click New on the button bar and then select Collection from the list of asset types. (Collection asset types must be enabled for your site).The Collection form appears.

2. Fill in the following fields with the following values:

a. In the Name field, type FemaleAliensCollection.

b. In the Description field, type a brief description of the collection.

You can enter up to 128 characters.c. In the Subtype box, select HelloPersonal.

d. In the Associated queries section, select FemaleAliensQuery.

e. Click Save.

3. Follow the preceeding steps to add another collection called MaleAliensCollection. In the Associated queries section, select MaleAliensQuery.

4. Follow the preceeding steps to AllAliensCollection. In the Associated queries section, select both FemaleAliensQuery and MaleAliensQuery queries.

Building CollectionsComplete the following steps to build a collection asset:

1. Click the Inspect icon to edit the FemaleAliensCollection that you just created.

2. In the more... drop-down select box, located in the upper-right corner, select Build. You can also click the Build hyperlink in the lower right corner of the screen.

Note: Content Server runs the query or queries in the collection and displays the results in two or more lists of assets.

3. Rank the assets by entering the appropriate number in the Rank field. You can enter up to three numeric characters. If you want to remove an asset that is already included in the top list, select the Remove option next to its Rank field.

Note: You cannot remove an included asset by deleting its rank number in the query list.

4. Click Save Changes.

Content Server builds the collection and then displays it in the Inspect form.

5. Follow the preceeding steps to build the MaleAliensCollection and the AllAliensCollection assets. Save your changes after you build the collections.

Assign Collections to Pages1. Assign FemaleAliensCollection to the FemaleAliensPage:

a. From the SitePlan tab, find the FemaleAliensPage page asset.

b. Right-click on FemaleAliensPage and select Edit.

c. In the Related: section, find the Associated Collection: Top Stories association.

d. From the History tab, select FemaleAliensCollection asset, and then click on the Add Selected Items button in the Edit screen of FemaleAliensPage.

Page 49: Core Dev Book

Module 2

49

e. Save your Collection asset by clicking on the Save Changes button.

2. Follow the preceeding steps to assign the MaleAliensColection to the MaleAliensPage and AllAliensCollection to the HelloPersonalsHome.

Page 50: Core Dev Book

Content Server Core Developer I

50

Module Summary• Caching improves performance and relieves load on Content Server.

• Content Server uses double-buffered caching to ensure that visitors to your web site never encounter broken links.

• Modular page design allows users to code componants of their web pages once and use those componants in many places.

• Rendering is the construction of output that is displayed on the browser.

• A pagelet in the Content Server environment is the output of an HTTP request displayed in a browser.

• A web page is composed of multiple pagelets that are called by a containing page.

• Content Server Direct (or CS-Direct) uses the basic asset model to create a structure for your content in which there is one primary storage table in the database for each type of asset.

• Several asset types come with CS-Direct, including: Article, ImageFile, Image, Linkset, Stylesheet, Query, Collection, Page, and Template.

• Asset type associations are mechanisms that allow a relationship between assets.

• Associations are between asset types while relationships are between assets.

• Some dependency types are inseparable, while others are companions.

• You use the AssetMaker utility to create and delete new asset types.

• Developers must code an Asset Descriptor File in XML for each asset type they want to create.

• All tables with a url field must have a default storage directory in which the values entered into the column will be stored.

• AssetMaker helps you create new CS-Direct asset types

• When you use AssetMaker, you are only responsible for creating the Asset Descriptor File (.XML file) that is used by AssetMaker to create the specified asset type.

Page 51: Core Dev Book

51

Module 3

Content Server Tools and Tags

In this module you will construct the templates that will format and display the content for a second page of the Hello Asset World sample site.

Module Learning ObjectivesAfter completing this module, you will be able to:

• Create a Template asset

• Use Content Server Tools

• Understand Content Server Tags

• Understand the resargs parameter

• Understand when to use a CS-Element asset and when to use a non-asset element

• Use Page Debugger to evaluate the execution of elements

Terms to Know

Term Definition

Template Asset An asset that contains the code used to format your web site.

A Template asset is a site design asset.

Page Asset An asset that is a group of asset associations. You add any assets that you want to display on your web site to a Page asset.

A Page asset is a site design asset.

CS-Element Asset An asset that is associated with an element.

Site Entry Asset An asset that associates a CS-Element asset with an entry in the SiteCatalog table.

Page 52: Core Dev Book

Content Server Core Developer I

52

Page Debugger A Content Server tool that lets you step through the execution of XML and JSP elements.

resargs A parameter whose value is the arguments that you wish to pass to a web page or pagelet.

resargs are set in the SiteCatalog or ElementCatalog tables.

Term Definition

Page 53: Core Dev Book

Module 3

53

Lesson 3.1: Content Server ToolsIn this lesson you will learn about the Content Server Explorer and Catalog Mover tools.

IntroductionThere are a variety of tools available to you in Content Server. In this training session, we will focus on the following tools:

• Content Server Explorer: Microsoft Windows application for viewing and editing tables and rows in the Content Server database and for creating and editing executable elements (i.e. files) written in XML or JSP.

• CatalogMover: Allows you to export and import Content Server database tables.

These tools are also available in the Content Server Direct environment. Business users will be using the CS-Direct interfaces to perform content management tasks such as add, modify, and delete content, revision tracking, and workflow.

Content Server Explorer The Content Server Explorer tool provides a natural view of tables allowing you to add, edit, or delete records of a table.

This tool allows you to:

• Create and delete tables.

• Organize tables and folders into projects; contains SiteCatalog, ElementCatalog, SystemSQL, and user preferred tables.

• Export tables and projects and import tables, records, and projects. (The export and import features are exactly the same functions of CatalogMover.)

• Export records for an external source code control system.

• Preview pages using the browser of your choice.

It is recommended that you use Content Server Explorer's built-in editor to edit your elements.

Who Uses Content Server Explorer?The following job roles will utilize Content Server Explorer:

- Template Developers- Database Administrators

Page 54: Core Dev Book

Content Server Core Developer I

54

Exercise 3.1.1: Working with Content Server Explorer

The objective of this lab exercise is to use Content Server Explorer to create, modify, and delete a JSP element.

PurposeIn this lab exercise, you will complete the following actions:

• Log in to Content Server Explorer via Jump Start.

• Create a folder in the SiteCatalog and ElementCatalog tables.

• Add a record.

• Create a JSP element.

• Preview pages of the SiteCatalog.

Begin the ExerciseThis exercise has the following parts:

• Logging in to Content Server Explorer

• Creating a Folder

• Adding a ElementCatalog Entry

• Adding a SiteCatalog Entry

• Previewing a Page in the SiteCatalog

Follow these directions for completing this lab exercise.

Logging in to Content Server Explorer3. In the Windows Exporer, double-click on cskit5.5/tools/

ContentServerExplorer/ContentServerExplorer to invoke Content Server Explorer.

4. On the Content Server Explorer screen, choose the menu path: File > Open Content Server.... to open a connection to the database.

5. On the Content Server Login screen, enter the appropriate information in these fields:

- Name - jumpstart- Password - jumpstart- Host name or address - localhost- Port - 7001

6. Select the HTTP and Standard servlet (/servlet/CatalogManager) radio buttons.

7. Click the OK button.

Creating a Folder1. In the ElementCatalog table, a folder called Training:

a. Right-click on the ElementCatalog table and select New -> Folder.

CSEE created an unnamed folder.

Page 55: Core Dev Book

Module 3

55

b. Name the folder Training and then click the Save button.

2. Repeat the above steps to create a similar folder name Training in the SiteCatalog table.

Adding a ElementCatalog Entry1. Create a page record in the Training folder of the ElementCatalog table:

a. Highlight the Training folder and in the right panel, right-click on your mouse and select New.

b. In the elementname field for your element, enter hello.

c. In the description field, enter My first JSP element.

d. In the url field, click on a button and then select .jsp in the New file dialog window, and then click the OK button.

e. In the element editor, between tags <cs:ftcs> and </cs:ftcs>, look for <!-user code here -->. Overtype this line with the text: Hello Students!

2. Click the Save All files/catalogs to save your element.

Adding a SiteCatalog Entry1. Create a page record in the Training folder of the SiteCatalog table:

a. Highlight the Training folder and in the right panel, right-click on your mouse and select New.

b. In the pagename field for your element, enter HelloPage.

c. In the rootelement field, modify the string to Training/hello

d. In the cacheinfo field, set the SiteCatalog entry to be not cached (false).

2. Click the Save or Save All files/catalogs button to save your SiteCatalog entry.

Previewing a Page in the SiteCatalog1. From the Content Server Explorer screen, search for page entry Training/Hello.

Right-click the Display Status icon for page name Hello and select the Preview Page option.

2. Click the OK button to accept the default values displayed. A new browser window displays the Training/HelloPage page.

Note: You can also preview the same page directly in the browser by providing the following URL:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage

Page 56: Core Dev Book

Content Server Core Developer I

56

Exercise 3.1.2: Customizing the Asset Descriptor File

For this exercise, the developer is responsible for creating a eWebEditPro field and Custom Element field in the HelloPersonal Descriptor file.

PurposeIn this exercise, you will complete the following actions:

• Code the custom asset field element.

• Enable the Personal asset type for Hello Asset World site.

Begin the ExerciseYou can now change the descriptor file in the Content Server Explorer without having to re-create an asset type with AssetMaker. The descriptor file controls how the stub elements (new asset form, search form, advanced search form, etc.) look. For example, you can modify the size of the textbox for the urlad property (Personal Ad field in the User Interface) by modifying the ADF.

This exercise has the following parts:

• Creating an eWebEditPro Field

• Creating a Custom Element Field

Follow these directions for completing this lab exercise.

Creating an eWebEditPro Field1. In the Content Server Explorer, navigate to the AssetType folder.

2. Sort the table rows by clicking on a column named urldescriptor.

3. Find and open the descriptor file for the HelloPersonals asset type (HelloPersonalsADF.xml).

4. Change the parameters for the urlad property (Personal Ad field) to use eWebEditPro software, which is installed on with your JumpStart. The modified property should look similar to the following:

<PROPERTY NAME="urlad" DESCRIPTION="Personals Ad"><STORAGE TYPE="VARCHAR" LENGTH="6000"/><INPUTFORM TYPE="EWEBEDITPRO" WIDTH="500" HEIGHT="200" REQUIRED="YES"/></PROPERTY>

5. Save your changes in the Content Server Explorer and test them in the CS-Direct interface.

Note: The first time you edit a HelloPersonal asset, your Windows will install Ektron software to run eWebEditPro in your browser.

Creating a Custom Element Field1. In the Content Server Explorer, go to ElementCatalog > OpenMarket > Xcelerate >

AssetType > HelloPersonal folder.

Page 57: Core Dev Book

Module 3

57

2. Add a new folder called ContentForm and in this new folder, create a new element called idiosyncrasies.

Note: CS Explorer allows you to input the name of your new element. The name of the custom element must be the same as the name of the field in the ADF(idiosyncrasies).

3. In the new ElementCatalog/OpenMarket/Xcelerate/AssetType/HelloPersonal/ContentForm/idiosyncrasies element, do the following:

a. Click in the url field. If XML is not already selected as the coding language for this element, select it.

b. Locate and open the CustomField.txt file in the CourseMaterials folder. Paste the code that it contains into your element.

c. Replace the text ENTER DATA ENTRY INSTRUCTIONS HERE with some text of your choosing. Be sure to mention that the content managers should input the idiosyncracies as if they were keywords.

d. Click the Save icon to save your element.

4. Modify the idiosyncrasies property in the HelloPersonalADF.xml file again to call the custom element you created. Change the <INPUTFORM TYPE=”TEXT” ../> for the <INPUTFORM TYPE=”ELEMENT” ... />. The modified property should look similar to the following:

<PROPERTY NAME="idiosyncrasies" DESCRIPTION="Idiosyncrasies"><STORAGE TYPE="VARCHAR" LENGTH="255"/><INPUTFORM TYPE="ELEMENT" WIDTH="60" MAXLENGTH="255" REQUIRED="NO" DEFAULT="" /><SEARCHFORM DESCRIPTION="Idiosyncrasies field contains" TYPE="TEXT" WIDTH="100" MAXLENGTH="255"/></PROPERTY>

5. Save your changes again in the Content Server Explorer and test them in the CS-Direct interface.

Page 58: Core Dev Book

Content Server Core Developer I

58

CatalogMoverThe CatalogMover tool allows you to export and import Content Server database tables, including the SiteCatalog and ElementCatalog tables. CatalogMover creates an HTML file that preserves table structure and table content. If a table has a url column, then CatalogMover imports referenced files. In addition, it can uncompress imported files and compress exported files.

For example, you can use CatalogMover to export page elements and content assets to one system and load the same elements and assets into the database on another system. You can export and import database tables as either HTML or ZIP files.

CatalogMover allows you to:

• Connect to a server.

• Export table rows to an HTML file.

• Preserve table structure(s).

• Store associated uploaded files (such as URL fields) in a subdirectory.

• Import files can into another database.

This tool exports and imports table content but is not meant to move all tables. For instance, if you export the SystemUsers table (which holds all registered users of the system), passwords will be encrypted. Therefore, if you import the SystemUsers table passwords will be encrypted again.

It is important to remember that CatalogMover is unaware of Content Server Direct—it knows nothing about asset associations and will not automatically copy coherent set of tables.

However, CatalogMover is great for table backups.

Who Uses CatalogMover?People with following jobs use CatalogMover:

• Element Developers

• Content Server Administrators

Page 59: Core Dev Book

Module 3

59

Exercise 3.1.3: Using Catalog MoverThe objective of this lab exercise is to use Catalog Mover to import records into the Content Server database.

PurposeThe objectives of this exercise are:

• Import records into the ElementCatalog and SiteCatalog tables via Catalog Mover.

• Export elements from ElementCatalog.

Begin the ExerciseThis exercise has the following parts:

• Start and Log in to Catalog Mover

• Importing records into the Element Catalog

• Exporting records from ElementCatalog

Follow these directions for completing this lab exercise.

Start and Log in to Catalog MoverComplete the following steps to log in to CatalogMover:

1. Start Catalog Mover by running the tool from the cskit5.5/JumpStart/Tools. The CatalogMover dialog box appears.

2. Choose the menu path: Server > Connect. The Connect to Server dialog box appears.

3. Enter the appropriate information in these fields:

- Server - Enter the localhost- Port - Enter 7001- Name - Enter jumpstart- Password - Enter jumpstart

4. Select the following radio buttons:

- Secure (No)- Standard Servlets (\servlet\CatalogManager)

5. Click the Connect button.

Importing records into the Element CatalogIn this section, you will import the rows from a file into the ElementCatalog table.

1. From the CatalogMover - Connected to localhost:7001 dialog box, choose the following menu path: Catalog > Auto Import Catalog(s).

The Select base directory for import dialog box displays.

2. Find files to import in the following location CourseMaterials/Exercises/ElementCatalog.html

3. From this directory, double-click on the file you wish to import. The Catalog Data dialog box displays.

4. Accept the default values displayed and click the OK button.

Page 60: Core Dev Book

Content Server Core Developer I

60

5. The Importing Tables dialog box appears, followed by the Results for Import Catalogs dialog box. Click OK.

CatalogMover imports the following elements into the ElementCatalog table:

- HelloPersonal/Solutions/HelloPersonalTemplate- HelloPersonal/Solutions/HelloPersonalTemplate2- HelloPersonal/Solutions/HelloPersonalTemplate3- HelloImage/Solutions/HelloImageTemplate- Collection/Solutions/HelloCollectionTemplate2- Page/Solutions/HelloPageTemplate2- HelloExtra/Solutions/HelloNavBar

6. Log in to the Content Server Explorer and find the new imported rows in the ElementCatalog.

Exporting records from ElementCatalogIn this section, you will export the rows form the ElementCatalog and save them on your local drive. Because information about elements is stored in the ElementCatalog but the elements themselves are stored on a file system, CatalogMover will have to export both — the rows from the table and the files from the file system. It will place the save the rows from the table into the ElementCatalog.html file and the files from the file system into the folder called ElementCatalog.

7. In the Windows Explorer, create the folder called c:/fatwire.

1. From the CatalogMover - Connected to localhost:7001 dialog box, choose the menu path: CatalogList > Load.

The CatalogMover - Connected to localhost:7001 dialog box updates with a listing of tables.

2. From the list of tables displayed, double-click on the ElementCatalog selection to load the rows from the ElementCatalog table. Once the rows are loaded, the ElementCatalog panel will appear at the bottom of the Catalog Mover window.

3. Switch to the ElementCatalog panel to view the rows.

4. Highlight any element and then choose the menu path: Catalog > Export Catalog Rows. The Select base directory for export dialog box displays.

5. Browse to c:/fatwire folder. This is the directory where CatalogMover will place the exported files.

6. Click the Save button.

7. Click the OK button in the Results for Export Catalogs window.

8. When you are finished with this tool, click the Windows Close button.

9. In the c:/fatwire folder, find the following exported data:

- ElementCatalog.html file

- ElementCatalog folder

Examine both the ElementCatalog.html and the ElementCatalog folder.

Page 61: Core Dev Book

Module 3

61

Lesson 3.2: Content Server VariablesIn this lesson you will learn how to set and display variables using Content Server tags.

Content Server variables are stored in the Variables hash table and are live for the duration of the page.

<ics:setvar> TagThis JSP tag declares and initializes the value of a regular variable.

Its syntax is represented as:

<ics:setvar name="Variable_Name" value="Variable_Value"/>

For example,

<ics:setvar name="city" value="Boston"/>

The value of the variable exists for the duration of the page evaluation unless it is explicitly deleted using <ics:removevar>.

<ics:setssvar> TagThis tag sets the value of a session variable.

Its syntax is represented as:

<ics:setssvar name="Session_Variable_Name" value="Session_Variable_Value"/>

For example,

<ics:setssvar name="asset_type" value="Article"/>

The value of the session variable exists for the duration of the session unless it is explicitly deleted using <ics:removessvar>.

<ics:getvar> TagThis JSP tag returns and displays the value of a Content Server variable.

Its syntax is represented as:

<ics:getvar name="Variable_Name" encoding="default"output="Output_Variable_Name"/>

Parameter Description

name (required) The name of the variable.

encoding The encoding used to convert binary values to a string. The value of this parameter must be set to default.

Page 62: Core Dev Book

Content Server Core Developer I

62

The city variable could have been set previously either by using <ics:setvar/> tag or by passing this variable to a Content Server page with either GET or POST method.

For example, you can pass the city variable to the Content Server page named HelloPage by simply appending this variable and its value to a URL string that calls the page:

http://localhost:7001/servlet/ContentServer?pagename=HelloPage&city=Boston

<ics:getssvar> TagThis tag returns a Content Sever session variable.

Its syntax is represented as:

<ics:getssvar name="Session_Variable_Name"/>

For example:

<ics:getssvar name=”session_user_id”/>

<ics:callelement> TagThe ics:callelement tag processes the content of an element. The element must exist in the ElementCatalog.

Its syntax is represented as:

<ics:callelement element="element name"><ics:argument name="argument name" value="arg value"/>

</ics:callelement>

ElementVariables set in a parent element are not visible in the child element unless they are passed in the <ics:argument name="argument name" value="arg value"/> tag within <ics:callelement> tag.

However, variables set in a child element can be read in the parent element.

output Specifies an optional output variable. If this parameter is not specified, the output will be streamed to the browser.

For example,

<ics:getvar name="city"/>

Parameter Description

name (required) The name of the session variable.

Parameter Description

Page 63: Core Dev Book

Module 3

63

For example:

<!-- set variables in the caller element -->

<ics:setvar name=”x” value=”5”/><ics:setvar name=”y” value=”10”/>

...

<ics:callelement element="SimpleTest"><ics:argument name="var1" value=’<%= ics.GetVar(“x“) %>’/><ics:argument name="var2" value=’<%= ics.GetVar(“y“) %>’/>

</ics:callelement>

In the SimpleTest element, variables var1 and var2 can be displayed with the <ics:getvar/> tag:

Variable X: <b><getvar name=”var1”/></b><br>Variable Y: <b><getvar name=”var2”/></b><br>

The following result displays in the browser:

Variable X: 5Variable Y: 10

Page 64: Core Dev Book

Content Server Core Developer I

64

Exercise 3.2.1: Commonly Used Content Server JSP Tags

PurposeThe objectives of this lab exercise are to:

• Set a Content Server variable

• Display a Content Server variable

Begin the ExerciseThis exercise has the following parts:

• Setting Content Server Variables

• Rendering the Element

• Passing Content Server Variables to your Page

• Calling Elements

Follow these directions for completing this lab exercise.

Setting Content Server Variables1. Using Content Server Explorer, edit the Training/hello element located in the

ElementCatalog table.

2. Within the Training/hello element, use the <ics:setvar> tag to set a Content Server variable named city to the name of the city you are from.

3. Within the Training/hello element, use the <ics:getvar> tag to display the city variable that you set in step 2 of this procedure.

Rendering the Element1. Click the Save all files/catalogs button.

2. From the Content Server Explorer screen, search for the page entry Training/HelloPage.

3. Right-click the Display Status icon for the page name Training/HelloPage and select the Preview Page option.

4. Click the OK button to accept the default values displayed. A new browser window displays the Training/HelloPage page.

Passing Content Server Variables to your Page1. Within the Training/hello element, delete the <ics:setvar> tag that sets the

Content Server variable named city.

2. Preview your page by proving the following URL in your browser:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage

The page should not display the variable, because the variable was not set.

3. Now, preview the same page in your browser by appending city=Boston to the URL. Your URL should look similar to the following:

Page 65: Core Dev Book

Module 3

65

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage&city=Boston

Calling Elements1. In the Content Server Explorer, add an element Training/logo. Write the following

line in the element: Hello Page Logo

2. From the Training/hello element, call the Training/logo element by using the <ics:callement> tag.

3. Now, preview the same page in your browser again. Your URL should look similar to the following:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage&city=Boston

4. You can modify the <ics:callement> tag by adding arguments that you would like to pass to your Training/logo element. For example, you can set a Content Server variable with your name and then pass its value to the Training/logo element. In the Training/logo element, display the value of the variable. Test your page again.

Page 66: Core Dev Book

Content Server Core Developer I

66

Lesson 3.3: Database AccessIn this lesson you will learn about database access in JSP element design.

Types of Database Tables (Catalogs)There are five types of tables in the Content Server database:

• Object tables, which hold data as objects and provide a unique identifier, automatically, for each row in the table

• Tree tables, which hold the hierarchical information about relationships between objects in object tables

• Content tables, which hold flat data and do not provide a unique identifier for each row

• System tables, which are core Content Server application tables that cannot be modified

• Foreign tables, which can be either of the following:

- Tables that are outside of the Content Server database but that Content Server has access to.

- Tables that are in the Content Server database but that Content Server did not create.

Content Server can cache the resultsets from queries against any table in the Content Server database, including foreign tables.

Object TablesObject tables store data as an object and can be represented in hierarchies. Those objects can be loaded, saved, and managed with the CatalogManager API. The asset type tables for CS-Direct and CS-Direct Advantage are object tables.

The primary key for object tables is always the ID (id) column. This column cannot be changed. When you instruct Content Server to add an object table, it creates an ID column in that table. ID is a unique identifier that Content Server assigns to each row as it is added to the table. For example, when someone creates a new asset with CS Direct, Content Server determines the ID and assigns that value as the ID for that asset.

You cannot change the ID that Content Server assigns to objects (such as assets). Anytime that you need to store data and you want to ensure that each row of that data is uniquely identified, use an object table because Content Server handles ID generation for you.

When AssetMaker or Flex Family maker creates an object table for a new asset type, they create several additional columns by default.

Examples of object tables:

• All tables that hold assets

• Many of the CS-Direct publishing tables

• The CS-Engage tables that hold visitor data

Page 67: Core Dev Book

Module 3

67

Tree TablesTree tables store information about the hierarchical relationships between object tables. In other words, object tables can be represented in hierarchies, but the hierarchy itself is stored in a tree table—the hierarchy is the tree. For example, CS-Direct adds the following tree tables to the Content Server database:

• AssetRelationTree, which stores information about associations between assets. These associations create parent-child relationships.

• SitePlanTree, which stores information about parent-child relationships between page assets and the assets that are referred to from those assets. This information is presented graphically on the Site Plan tab that is present in the Content Server interface when CS-Direct is installed. Each row in a tree table is a node in that tree. Each node in a tree table points to two places:

- To an object in an object table, that is, to the object that it represents.- To its parent node in that tree table, unless it is a top-level node and has no parent

In other words, the object itself is stored in an object table. That object's relationships to other objects in the database (as described by the tree) are stored in the tree table as a node on a tree.

Note that child nodes point to parent nodes, but parents do not point to children.

When you create a tree table, it has the following columns by default. You cannot add to or modify these columns:

nid

Field Description

nid The ID of the node. This is the primary key.

nparentid The ID of the node's parent node.

nrank A number that ranks peer or sibling nodes. For example, the AssetRelationTree table uses this column to determine the order of the assets that are in collections.

otype The object type of the node. For example, in the SitePlanTree table (a CS-Direct table), otype is either the asset type "page" or the name of a site ("publication"). In the AssetRelationTree table (another CS-Direct table), otype is an asset type and is the name of the object table for assets of that type.

oid The ID of the object that the node refers to.

oversion Reserved for future use.

ncode Holds a string that has meaning in the context of what the table is being used for. For example, in the SitePlanTree, ncode is set to "placed" or "unplaced" based on whether the page asset that the node refers to has been placed or not. In the AssetRelationTree, ncode holds the name of a named association.

Page 68: Core Dev Book

Content Server Core Developer I

68

Content TablesContent tables store data as flat data (rather than as objects) and that information cannot be organized in a hierarchy. You use content tables for simple lookup tables.

For example, these are a few of the content tables that CS-Direct adds to the Content Server database:

• Source, which holds strings that are used to identify the source of an article or image asset

• Category, which holds codes that are used to organize assets in several ways

• StatusCode, which holds the codes that represent the status of an asset

All three of these tables are lookup tables that the CS-Direct product uses to look up values for various columns in the asset type tables (object tables).

In another example, CS-Direct also adds a content table called MimeType. This table holds mimetype codes that are displayed in the Mimetype fields of the Burlington Financial sample site asset types named stylesheet and imagefile. The Mimetype fields for these asset types query the MimeType table for mimetype codes based on the keyword column in that table.

Setting the Primary Key for a Content TableWhen you create a content table, an ID column is not created for you and the primary key is not required to be the ID. This is another major difference between content tables and object tables.

The cc.contentkey property in the futuretense.ini file specifies the name of the default primary key for all content tables. When you create a new content table, you are responsible for defining a column with the name specified by the cc.contentkey property.

However, you can override the identity of the primary key for a specific content table by adding and setting a custom property in the futuretense.ini file. This property must use the following format: cc.tablenameKey

For example, if you create a content table named Books and you want to override the default primary key so that it uses the ISBN column instead, you would add a property named cc.BooksKey and set it to ISBN.

Foreign TablesA foreign table is one that Content Server does not completely manage. For example, perhaps your site pages perform queries against a table that is populated by an ERP system and Content Server displays that information to your site visitors.

Content Server can query foreign tables and cache the resultsets just as it does for its own object and content tables. However, you must first identify that foreign table to Content Server by adding a row for it in the SystemInfo table.

This is the only time you should ever modify information in the SystemInfo table. Additionally, you must be sure to flush the Content Server resultset cache with a CatalogManager flushcatalog tag whenever the external system updates the tables that you query. Otherwise, the resultsets cached against those tables might not be up-to-date.

Page 69: Core Dev Book

Module 3

69

System TablesSystem tables are core Content Server tables whose schema is fixed. They are implemented in Content Server by their own classes and they do not follow the rules (for caching and so on) that the other tables follow.

You can add rows to some of the system tables (either using the Content Server Management Tools forms or the Content Server Explorer tool), but you cannot add or modify the columns in these tables in any way. You also cannot add system tables to the database.

The following table lists and defines the Content Server system tables:

Table Description

SiteCatalog Lists a page reference for each page or pagelet served by Content Server.

ElementCatalog Lists all the XML or JSP elements used in your system. An element is a named piece of code.

SystemACL Has a row for each of the access control lists (ACLs) that were created for your Content Server system. ACLs are named definitions of roles or users who have particular access permissions, called privileges.

SystemEvents Has a row for each event being managed by Content Server.

An event represents an action that takes place on a certain schedule.

Content Server inserts a row in this table when you set an event by using either the APPEVENT or EMAILEVENT tags.

SystemInfo Lists all the tables that are in the Content Server database and any foreign tables that Content Server needs to reference.

SystemSQL Holds SQL queries that you can reuse in as many pages or pagelets as necessary. You can store SQL queries in this table and then use the ics.CallSQL() method, the CALLSQL XML tag,or the <ics:callsql> JSP tag to invoke them. Then, if you need to modify the SQL statement, you only have to modify it once.

SystemSeedAccess Registers Java classes that are external to Content Server but that Content Server has access to (includes access control).

SystemUsers Lists all the users who are allowed access to pages, functions, and tables. Note that if you are using LDAP, this table is not used.

SystemUserAttr Stores attribute information about the users such as their email addresses. Note that if you are using LDAP, this table is not used.

Page 70: Core Dev Book

Content Server Core Developer I

70

Database Access & Catalog ManagerThe CatalogManager servlet (and its API) maintains the resultset cache on your Content Server systems. Whenever the database is queried, Content Server serves a resultsetæeither a cached or an uncached resultset.

Resultset caching reduces the load on your database and improves the response time for queries.

Querying DatabasesThere are several methods you can use to query the Content Server database for information:

• Java Query Methods:

- ics.SelectTo()- ics.CatalogManager()- ics.SQL()- ics.CallSQL()

• JSP Tags

- ics:selectto- ics:catalogmanager - ics:sql - ics:callsql

<ics:selectto> JSP TagThis JSP tag executes a simple query from a table. However, it is not used for joined tables.

Its syntax is represented as:

<ics:selectto table="Table_Name" what="Field_Name" listname="List_Name" where="Criteria" orderby="Sort_By_Field" limit="List_Size"/>

SystemPageCache Holds information about pages that are cached: the folder that it is cached to, the query used to generate the file name, the time it was cached, and the time that it should expire.

SystemItemCache Holds information about specific items on pages that are cached (assets, for example): the identity of the item, the page it is associated with, and the time it was cached.

Parameter Description

table (required) Name of the Content Server table to query.

Table Description

Page 71: Core Dev Book

Module 3

71

Example:

Consider the following content table called EnployeeRecords where the information about employees is stored in 6 columns:

• ssn (primary key) - social security number

• fname - first name

• lname - last name

• address - street address

• city - city of residence

• state - state of residence

Figure 6: EmployeeRecords Table

The following is the code used to retreive and display records of employees (first name, last name, address, city, and state) who live in Ohio state, city Howard:

<ics:setvar name=”city” value=”Howard”/><ics:setvar name=”state” value=”Ohio”/>

what (required) List of columns to return; the format of what is a comma-separated list of column names.

listname (required) Name of the list to contain the resultset.

where (required) Comma-separated list of table columns to select against. For each item in the where string, the value of the corresponding variable is used to construct a SQL where clause. All the elements in the comma-separated list must be variables.

orderby Orders the rows returned by the query; the format of orderby is a comma-separated list of column names.

limit Maximum number of rows to return.

ssn fname lname address city state

513567890 Joe Smith 53 First St. Howard Ohio

345673245 Mary Scott 284 Vine Ave. Pleasantville

Ohio

456372332 Sam Jones 33 Elm St. Paris New York

234567890 Sarah Akerman 440 Walnut St. Upton Michigan

Parameter Description

Page 72: Core Dev Book

Content Server Core Developer I

72

<ics:selectto table="EmployeeRecords" what="fname,lname,address,city,state" listname="EmployeeList" where="address" />

<!-- display the results here --><!-- use the <ics:listloop> and <ics:listget> tags -->...

<ics:listloop> JSP TagThis JSP tag provides a tabular data structure that contains content in row/column format and acts as the container of a resultset.

Use <ics:listloop> to iterate throughout the entire list.

Its syntax is represented as:

<ics:listloop listname="List_Name" maxrows="Number_Of_Iterations"

startrow="Start_Row_Number" endrow="End_Row_Number"/>

Parameter Description

listname (required) Name of the list to iterate.

maxrows The maximum iterations the loop should be executed.

startrow The row number to start the iteration.

endrow The row number of the row to end the iteration.

Page 73: Core Dev Book

Module 3

73

<ics:listget> JSP TagThis JSP tag retrieves the value of the specified field in a specified list.

Its syntax is represented as:

<ics:listget listname="List_Name" fieldname="Field_Name" output="variable_name/>

Example:

<ics:listloop listname="EmployeeList"><ics:listget listname="EmployeeList" fieldname="SSN"

output="ssnumber"/><br><ics:listget listname="EmployeeList" fieldname="fname"/><br>

<ics:listget listname="EmployeeList" fieldname="lname"/><br><ics:listget listname="EmployeeList" fieldname="address"/><br>

<A HREF="http://localhost:7001/servlet/ ContentServer?pagename=EmployeeResume&emplId='<%= ics.GetVar("ssnumber") %>'>Get Employee Resume</A>

</ics:listloop>

<ics:callsql> JSP TagThis JSP tag retrieves and executes an SQL query stored in the SystemSQL table. The resultset of the query is cached against the table name specified for the query in the SystemSQL table. The table name must exist in the database prior to calling <ics:callsql>.

Its syntax is represented as:

<ics:callsql qryname="Query_Name" listname="List_Name"

limit="List_Size"/>

Parameter Description

listname (required) Name of the list to iterate.

fieldname (required) The fieldname parameter may be any column in the list to retrieve that columns value for the current row.

output A Content Server variable that will store the value of a fieldname. Later, this variable can be evaluated with <ics:getvar/>

Parameter Description

qryname (required) Name of query to retrieve and execute.

listname (required) Name of list to contain resultset.

limit Maximum number of rows in the resultset.

Page 74: Core Dev Book

Content Server Core Developer I

74

Example:

To get reccords from the EmployeeRecords table, a developer first needs to create an SQL query in the SystemSQL table called Training/getEmployees:

select * from EmployeeRecords where state=’Variables.mystate’

Variables mystate can be provided to Content Server page either by GET or POST method or by using <ics:setvar/> tag. Content Server will evaluate all of its variables prior to running queries.

Below is the example of how the query can be called with <ics:callsql/> tag:

<ics:callsql qryname="Training/getEmployees" listname="EmployeeList2" />

<!-- display employee records here --><ics:listloop listname="EmployeeList2">

<ics:listget listname="EmployeeList2" fieldname="SSN" output="ssnumber"/>

<ics:listget listname="EmployeeList2" fieldname="fname"/><br> <ics:listget listname="EmployeeList2" fieldname="lname"/><br>

<ics:listget listname="EmployeeList2" fieldname="address"/><br>

<A HREF="http://localhost:7001/servlet/ ContentServer?pagename=EmployeeResume&emplId='<%= ics.GetVar("ssnumber") %>'>Get Employee Resume</A>

</ics:listloop>

Note: In <ics:callsql/> tag (qryname argument) requires you to provide the full path to you query. If your query name is getEmployees and it is located in the Training folder in the SystemSQL table, then gryname must be set to Training/getEmployees.

<ics:catalogmanager> JSP TagThis JSP tag invokes the CatalogManager servlet. That servlet creates, modifies, or deletes tables and rows.

The syntax of the <ics:catalogmanager> JSP tag is dependent upon the command passed to it.

Refer to documentation for a complete list of commands and their corresponding syntax for <ics:catalogmanager>

Example:

To add a row to the EmployeeRecords table, use the following code:

<ics:catalogmanager> <ics:argument name=”ftcmd” value=”addrow”/><ics:argument name=”EmployeeRecords” value=”table”/><ics:argument name=”fname" value=”Jane”/><ics:argument name=”lname" value=”Rosen”/><ics:argument name=”address" value=”34 Howard Street”/>

Page 75: Core Dev Book

Module 3

75

<ics:argument name=”city" value=”Cambridge”/><ics:argument name=”state" value=”Massachusetts”/>

</ics:catalogmanager>

Page 76: Core Dev Book

Content Server Core Developer I

76

Lesson 3.4: Error Checking In this lesson you will learn about checking errors in Content Server via log files.

Error CheckingSome requests to Content Server can result in an error condition.

Content Server tags report error codes which are stored in the errno variable.

Use the <ics:if> tag to test the value of errno. If errno is a negative integer, then an error occurred during the execution of the tag. Otherwise, the tag was executed successfully.

The following examples show how to use the <ics:geterrno/> tag to display the value of the errno variable:

<ics:if condition='<%= ics.GetErrno() < 0 %>'>

<ics:then>

Error Value: <ics:geterrno/>

</ics:then>

</ics:if>

or

<%

if (ics.GetErrno() < 0) {

out.write ("Error Value: " + ics.GetErrno());

}

%>

Log FileContent Server logs errors to several default log files. To turn error logging on, set the following debug properties (located in futuretense.ini) to yes :

• ft.debug - Controls whether Content Server should put debug messages into the log file.

• ft.xmldebug - Controls whether Content Server should put XML template evaluation messages into the log file.

• ft.dbdebug - Controls whether Content Server should put database debug messages into the log file and standard output.

• ft.dbl - Allows for browser-based retrieval of the log.

Page 77: Core Dev Book

Module 3

77

Lesson 3.5: Page DesignIn the following lesson, you will learn about page design.

Modular Page DesignFatwire recommends that you design your web pages using a modular page design strategy, where a web page that a web site visitor sees is composed of multiple elements. Modular page design has several benefits:

• It improves system performance by allowing you to develop an efficient caching strategy

• It allows you to code common design elements, like navigation bars, one time and use them on multiple web pages

The following diagram shows a simple modular page:

Figure 7: Page Design

Each rectangle in the preceeding diagram represents a pagelet—the generated output of one or more elements. These pagelets are called by a containing page.

The containing page lays out how the pagelets appear on the finished web page and contains any code that must be evaluated each time the page is viewed—custom ACL

Pagelet A

Pagelet B

Pagelet C

Root E lem ent

Page 78: Core Dev Book

Content Server Core Developer I

78

checking code, for example. This strategy allows you to code an element once and use it in many places in your web site.

Modular Design and CachingWith a modular page design, caching occurs at the pagelet level; the containing page is never cached, so that any cached pagelets are always protected by ACLs. You choose which pagelets get cached based on how frequently they are updated.

The following table summarizes the guidelines for caching pagelets:

When a request for a web page comes to CS-Satellite, it checks its cache for the various pagelets that comprise the finished page, then assembles those chached componants and serves the completed page.

Choose the Coding LanguageContent Server supports both XML and JSP as a language for creating elements. You can call elements written in JSP from an XML element and the reverse. You cannot, however, mix XML and JSP code in the same element.

Note that the performance impact of invoking a JSP element is slightly greater than the impact of calling an XML element. Keep this fact in mind when deciding what language to code an element in.

You can improve your site’s performance by using XML and JSP in specific types of elements:

CS also supports Java. Use the Content Server Java API to code your business logic.

Cache the pagelet Don’t cache the pagelet

• If the content seldom changes.• If the pagelet does not contain logic that

requires evaluation to work.

• If the content changes frequently.• If the content must be “real time.”• If the pagelet contains code that checks for

ACLs, or other logic that requires evaluation to work.

Use XML Use JSP

• For page layout• For displaying text or images• In elements with few loops or

conditionals

• In elements with a large number of loops and conditionals

• In elemenst with the large number of database calles and Content Server tags

Page 79: Core Dev Book

Module 3

79

Activity: Modularizing an Existing Web PageThis activity allows you to break down an existing web page design into individual pagelets.

Look at the Hello Asset World web page on the screen and consider the following questions:

• How would you break this web page down into pagelets?

• Why did you make the choices that you did?

• When does it make sense to use XML versus JSP while coding templates?

Page 80: Core Dev Book

Content Server Core Developer I

80

Lesson 3.6: Caching ConceptsIn this lesson you will learn about Content Server caching.

CachingCaching is one of the most powerful features of Content Server. Caching stores a copy of a rendered web page in memory. When a web site visitor requests a cached page, Content Server displays the copy of the page rather than re-rendering it.

An effective page caching strategy allows your site to perform well by relieving load on Content Server and the database. The divine Content Server product family contains two products that cache web pages:

• Content Server, which caches pages on the main server to either disk or Java memory.

• Content Server Satellite, (CS-Satellite) which provides another level of page caching. CS-Satellite comes with Content Server and is installed automatically on the Content Server box. For additional performance benefits, you can also install CS-Satellite on remote servers.

For optimum performance on the delivery system, Content Server uses the caching capabilities of both products in tandem, in a method known as double-buffered caching.

CacheManagerAs assets change, pages containing them will change. Therefore, cached versions become invalid. The CacheManager Java object manages cached pages and pagelets, flushing only the invalid pages from the cache.

When an “item” such as an asset is loaded for a page, CacheManager records that item as a dependency for the page’s validity. Then it saves this information with the cache information. As a result, two new cache tracking tables are created:

• SystemPageCache (replaces SystemExpire and gives each page an ID)

• SystemItemCache (links items such as assets to pages)

When new content is published, CacheManager checks the cache tracking tables to find which pages and pagelets contain outdated content. It then flushes outdated pages and pagelets from the cache, and loads updated copies of the outdated pagelets into the Content Server cache. CacheManager’s flush and refresh functions work for both Content Server and CS-Satellite.

CacheManager’s flush and refresh functions work for both Content Server and CS-Satellite.

Double Buffered CachingContent Server uses a method called double buffered caching to insure that visitors to your site will never see broken links, even when the content on the site is being updated.

Page 81: Core Dev Book

Module 3

81

The following diagrams illustrate the caching process:

Figure 8: Double-buffered caching

Content providers publish updated assets to the delivery system. CacheManager checks the cache tracking tables to see which cached items are affected by the updated assets.

CacheManager flushes the outdated Page1 from the Content Server cache, then reloads the Content Server cache with the updated Page1.

Any requests for Page1 will be served the old version of Page1 from the CS-Satellite cache. This protects the Content Server machine from undue load as it deletes and rebuilds its cache.

CacheManager flushes the outdated items from the CS-Satellite cache. As visitors come to the web site and request Page1, the CS-Satellite searches to see if Page1 is in its cache. Because Page1 is not in the CS-Satellite cache, the request is passed on to Content Server.

The CS-Satellite system’s cache is filled with an updated version of Page1, taken from the Content Server cache. The updated page is served to the requestors. If Page1 were requested again, the page would be served from the CS-Satellite cache.

Content Server Cache

Page1

CS-Satellite/Web Server

NewContent

for Page1

Page1

Page 82: Core Dev Book

Content Server Core Developer I

82

Exercise 3.6.1: Page CachingPurposeThe objectives of this lab exercise are to:

• Set a Content Server page cache

• Observe the behavior of Content Server pages with set page criteria

Begin the ExerciseThis exercise has the following parts:

• Setting Page Cache

• Setting Page Criteria

Follow these directions for completing this lab exercise.

Setting Page CacheIn this section, you will set the cache for your page.

1. In the Content Server Explorer, find the SiteCatalog entry (page) Training/HelloPage.

2. In the cachinfo field for the Training/HelloPage page, enter true.

3. Save your changes by clicking the Save button.

4. Click the Save all files/catalogs button.

5. Find and preview the Training/HelloPage page.

6. Make a change in the Training/hello element and preview the page again. The page rendered in the browser will not change because the page is cached.

7. Now, preview the same page in your browser by appending city=Boston to the URL. Your URL should look similar to the following:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage&city=Boston

Your page will not change.

Setting Page CriteriaIn this section of the exercise, you will set the page criteria.

1. In the Content Server Explorer, find the SiteCatalog entry (page) Training/HelloPage.

2. In the resargs1 field for the Training/HelloPage page, enter PageCriteria=city

3. Save your changes by clicking the Save button.

4. Now, preview the same page in your browser by appending city=Boston to the URL. Your URL should look similar to the following:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage&city=Boston

Has your page changed?

Page 83: Core Dev Book

Module 3

83

5. Change the value of the city argument passed to the page to NYC. Your URL should look similar to the following:

http://localhost:7001/servlet/ContentServer?pagename=Training/HelloPage&city=NYC

What is your observation?

Page 84: Core Dev Book

Content Server Core Developer I

84

Module Summary • There are a variety of tools available to you in Content Server, including Content

Server Explorer and CatalogMover.

• Content Server Explorer is a Microsoft Windows application for viewing and editing tables and rows in the Content Server database and for creating and editing executable elements (i.e. files) written in XML or JSP.

• Users of the Content Server Explorer tool include Element Developers and Database Administrators.

• CatalogMover allows you to export and import Content Server database tables.

• Users of the CatalogMover tool include Element Developers and CSEE Administrators.

• JSP provides an easy way to mix raw HTML and Java code in the same file.

• Use HTML (format code) to lay out the format of a page; use Java or XML or JSP tags (content code) to provide logic or access the database.

Page 85: Core Dev Book

85

Module 4

Template Assets and Content Server Tags

In this module you will learn about more about JSP element design including Asset, Site Plan, and Render tags.

Module Learning ObjectivesAfter completing this module, you will be able to:

• Define an asset in CS-Direct.

• Define the terms “asset type association” and “asset relationship”.

• Describe the various database tables that store asset information.

• Describe the various database tables that store page asset information.

• List the Asset, Site Plan, and Render database queries and describe their functionality.

• Describe the ways CS-Direct renders content.

• List the valid settings for the rendermode argument.

Terms to Know

Term Definition

Asset type A category of basic assets. Each asset must belong to an asset type. For example, Article is a popular asset type. An Article asset is an instance of an Article asset type. A site might contain millions of Article assets but only one asset type named Article.

Page 86: Core Dev Book

Content Server Core Developer I

86

Asset An instance of an asset type.

The central organizational unit of CS-Direct, CS-Direct Advantage, and CS-Engage. The following are examples of assets: one image and the data that describes it, one article and the data that describes it, or one product for sale. A large site might contain millions of assets. In addition, nearly all the infrastructure in a site (for example, templates and attributes) are themselves assets. CSEE defines two major categories of assets: basic assets and flex assets.

Placed page The state of a page asset when positioned appropriately in the site tree.

pubid A unique value that identifies a publication (site).

Unplaced page The state of a page asset when the location of the page is not in the site tree.

Term Definition

Page 87: Core Dev Book

Module 4

87

Lesson 4.1: The Template Asset TypeThe Template asset type has two functions: it provides the formatting information for your web pages and pagelets, and displays, or renders, your assets.

An instance of the Template asset formats assets of a type that you specify. For example, in this module you will create a Template asset that formats and displays the HelloPersonal asset type, a Template asset that formats and displays the Collection asset type, and a Template Asset that formats the Page asset type.

A Template asset is associated with an element of the same name. This element contains the code to format and render your assets.

Because they are assets, instances of the Template asset are published to the delivery system on publish, are cached, and the cached copies are managed by CacheManager.

When you create a template, the CS-Direct does the following:

• Creates a row in the Template table for the template asset.

• Examines the Publication table to determine the name of the site that the template belongs to. (Early versions of Content Server used the term “publication” instead of “site.” Several database tables still refer to sites as publications.)

• Creates a page entry in the SiteCatalog table using the SiteName/AssetTypeName/TemplateName naming convention.

• Sets the name of the root element of the new SiteCatalog page entry to the name of the ElementCatalog entry (or to what it expects will be the name of the root element).

• Creates an entry in the ElementCatalog table using the AssetTypeName/TemplateName naming convention. If the element was coded in the template form, it also creates the element file.

In the SiteCatalog, the following fields get set up:

• cacheinfo, which corresponds to the PageletCacheInfo field in CS-Direct. By default, this field is set to true.

To override these settings for the page entry for this template, click in the field and enter the new values.

• acl, which contains a comma-separarated list of the Access Control Lists (ACLs). If you want to restrict the visitors who can request this page, enter the ACLs that visitors must have in order to see the page.

• resargs2, which corresponds to the PageLevelParameters field in CS-Direct. This column holds variables (arguments) that can be passed to the page entry. CS-Direct uses several reserved variables, called PageCriteria, that CS-Direct stores in the resargs column when you save the template.

Note that the root element for this page entry in the SiteCatalog table is the element that you create or identify in the next section of the template form.

Page 88: Core Dev Book

Content Server Core Developer I

88

Exercise 4.1.1: Creating a Template AssetPurposeYou create a CS-Direct template element using the Content Server user interface. When you create your template elements using the user interface, the element is already seeded with the basic tags and file includes you will need.

Begin the ExerciseFollow these directions for completing this lab exercise:

1. Log in to the HelloAssetWorld site with the user name Coco and the password hello.

2. In the top left corner of the screen, click the New tab. The New screen appears. Click the Template link.

3. The Template form appears. In the Name field, type HelloPersonalTemplate (Required)

4. In the For Asset Type field, select the Personals asset type (required field) and then click the Continue button.

5. In the Description field, type a brief description of the template. You can enter up to 128 characters.

6. If this template will be used to render sub types, select the subtypes in the Applies to Subtypes field.

7. In the Create Template Element? section, click JSP.

8. In the Template Element Description field, enter a description of the template. When you save the template asset, the information in this field is written to the description column for the element entry in the ElementCatalog table.

9. In the Template Element Logic entry area, code your element. Write a simple statement, such as Hello Students!

You can use Content Server Explorer to continue coding this template element. If you decide to use Content Server Explorer, complete the rest of the steps in this procedure first, before you use Content Server Explorer to open the element.

10. Click the Save button to save your template.

Test Your Results1. Assign your template to one of the HelloPersonal assets:

a. Click the Edit button to edit a HelloPersonal asset.

b. In the Template field, choose HelloPersonalTemplate as the default template.

c. Save your changes.

2. Preview your HelloPersonal asset by clicking the Preview button.

To test a CS-Direct template directly in the browser (live mode), type the following URL:

Page 89: Core Dev Book

Module 4

89

http://localhost:7001/servlet/ContentServer?pagename=HelloAssetWorld/HelloPersonal/HelloPersonalTemplate&cid=HelloPersonalId

Page 90: Core Dev Book

Content Server Core Developer I

90

Lesson 4.2: Asset TagsAssets are the core of Content Server Direct (CS-Direct). An asset is a Java object that you manipulate with CS-Direct XML or JSP tags.

There are three types of assets:

• Content assets, which represent discrete units of content that will appear on your live web site. An Article asset is an example of a content asset.

• Site design assets, which organize that content. A Page asset is an example of a site design asset.

• Combination assets, which both represent and organize content. A Collection asset is an example of a combination asset.

Assets are stored in the Content Server database. You use Asset methods (or tags) to extract the information about the assets that you want to display on your on-line site from the database.

When you use an <asset:load> tag to retrieve an asset from the database, CS-Direct loads an instance of the asset into memory as an object. You then have access to that instance of the asset with the other asset tags until either the session is flushed (the root element exits) or the name that is used for the asset object is overwritten.

Assets can have parent-child relationships that are set up through one of the following:

• Named associations - Defined, asset-type-specific relationships represented as fields in the asset forms.

• Unnamed relationships - Established, for example, when you select assets from the generic select list boxes on the Page form.

Database TablesCS-Direct stores information about assets in these database tables:

• Primary database table - Holds assets of a given type. For example, each page asset has a row in the Page table and each article asset has a row in the Article table. These tables store information such as the asset’s name, object ID, who created it, which template it uses, etc. Use the Asset methods to extract information from these tables.

• AssetRelationTree table - Holds information if the asset has named associations or unnamed relationships with other assets. Use the <asset:children> tag to extract information from this table.

• AssetPublication table - Specifies which management sites (or publications) give you access to the asset through CS-Direct’s asset entry and edit forms. If the asset is shared between more than one site (or publication), there is a row entry for each pubid, which is a unique value that identifies a publication (or site).

• SitePlanTree table - Holds information if the asset is a Page asset.

Page 91: Core Dev Book

Module 4

91

Asset TagsThe following tags retrieve an asset from the database and allow you to access the information that it contains:

• <asset:load>

• <asset:get>

• <asset:scatter>

• <asset:children>

<asset:load> TagThe <asset:load> tag retrieves an instance of a specified asset and then saves the instance into memory (as session information), assigning it the name provided by the name parameter. That object is then available until the session is flushed (the root element exits) or the name is overwritten. Object names are global in scope.

Its syntax is represented as:

<asset:load name=”Asset_Name” type=”Asset_type” objectid=”Asset_ID” field=”Field_Name” value=”Field_Value”/>

Example:

Below is the example of how to load a HelloArticle asset:

<asset:load name=”myArticle” type=”HelloArticle” objectid=”HelloArticleID”/>

Parameter Description

name (required) Name to use to identify the asset after it is retrieved and stored as an object in memory. All references to the asset by other asset tags (for example, <asset:children> and <asset:get>) during this session will use this name to identify the asset.

type (required) Asset type of the asset that you want to retrieve from the database.

objectid (required) The object ID of the asset.

field If the objectid fargument is not used, use both field and value attributes.

The field attribute supplies a field name for a field that contains a value that uniquely identifies an asset.

value If the objectid argument is not used, use both field and value attributes.

The value attribute is used in conjunction with the field attribute, the value attribute supplies a value that uniquely identifies an asset.

Page 92: Core Dev Book

Content Server Core Developer I

92

or if you don’t want to use the ID of the HelloArticle asset and you know its unique name, you can use the followng code instead to do the same result:

<asset:load name=”myArticle” type=”HelloArticle” field=”name” value=”spacejunk”/>

<asset:get> TagThe <asset:get> tag retrieves the value of a single field from a loaded asset object and stores that value in a Content Server variable.

Typically, this tag is used to extract information that you want to display on-line from the specified asset object. If you want to extract information from multiple fields at once, use the <asset:scatter> tag.

The syntax is represented as:

<asset:get name=”Asset_Name” field=”Field_Name” output=”Variable_Name”/>

Example:

Below is the example of how to get fields (name, description, headline, and body) of a HelloArticle asset:

<!-- load a HelloArticle asset first --> <!-- get the cid and c arguments dynamically -->Hello Article ID: <ics:getvar name=”cid”/>

<asset:load name=”myArticle” type=’<%= ics.GetVar(“c“) %>’ objectid=’<%= ics.GetVar(“cid“) %>’/>

<!-- get the article name --><asset:get name=”myArticle” field=”name” output=”theName”/><br><b>Article Name:</b> <ics:getvar name=”theName”/>

<!-- get the article description --><asset:get name=”myArticle” field=”description” output=”theDesc”/><br><b>Article Description:</b> <ics:getvar name=”theDesc”/>

<!-- get the article headline --><asset:get name=”myArticle” field=”headline” output=”theHeadline”/>

Parameter Description

name (required) The name assigned to the asset whose field value you want to get. This asset must be loaded and assigned a name before you can pass its name to this tag.

field (required) The name of the field whose value you want to retrieve.

output The name of the output variable to create to store the value of the field.

Page 93: Core Dev Book

Module 4

93

<br><b>Article Headline:</b> <ics:getvar name=”theHeadline”/>

<!-- get the article body --><asset:get name=”myArticle” field=”urlbody” output=”theBody”/><br><b>Article Body:</b> <ics:getvar name=”theBody”/>

Note: You always have to load the asset first with the <asset:load> tag before you get its fields.

Note: In the <asset:get> tag, the names of the fields the names of columns in the asset type table rather than the names of the field that appear in the CS-Direct user interface. For example, the HelloArticle body field has a corresponding column in the HelloArticle table called urlbody. When using <asset:get> tag to extract HelloArticle body field, use set the field argument to urlbody.

<asset:scatter> TagThe <asset:scatter> tag retrieves values from the fields of a previously loaded asset and then writes them into memory (session information) as variables. The variables are constructed with a prefix that you supply by using the tag’s prefix parameter. After you use this tag, you can display the information contained in the asset’s fields.

Its syntax is represented as:

<asset:scatter name=”Asset_Name” prefix=”Variable_Prefix_Name”/>

Example:

Below is the example of how to scatter fields (name, description, headline, and body) of a HelloArticle asset:

<!-- load a HelloArticle asset first --> <!-- get the cid and c arguments dynamically -->Hello Article ID: <ics:getvar name=”cid”/>

<asset:load name=”myArticle” type=’<%= ics.GetVar(“c“) %>’ objectid=’<%= ics.GetVar(“cid“) %>’/>

<!-- scatter all the fields from the HelloArticle asset --><asset:scatter name="myArticle" prefix="article"/>

<!-- print the values of the scattered fields --><br><b>Article Name:</b>

<ics:getvar name=”article:name”/>

Parameter Description

name (required) The name assigned to the asset whose fields you want to make variables of (or “scatter”). This asset must be loaded and assigned a name before you can pass its name to this tag.

prefix (required) Specifies a string to be included in the name of the variables that store the asset’s information.

Page 94: Core Dev Book

Content Server Core Developer I

94

<br><b>Article Description:</b> <ics:getvar name=”article:description”/>

<br><b>Article Headline:</b> <ics:getvar name=”article:headline”/>

<!-- <asset:scatter> does not work when rendering url fields, use <asset:get> instead to render HelloArticle boudy -->

<asset:get name=”myArticle” field=”urlbody” output=”theBody”/><br><b>Article Body:</b> <ics:getvar name=”theBody”/>

Note: You always have to load the asset first with the <asset:load> tag before you scatter its fields.

Note: In the <asset:scatter> tag, the names of the fields the names of columns in the asset type table rather than the names of the field that appear in the CS-Direct user interface.

<asset:children> TagThe <asset:children> tag retrieves assets that are associated with (are children of) the asset that you specify. Each child is listed with a value for each field from its row in the AssetRelationTree table (such as nid, nparentid, nrank, otype, oid, and ncode). You must load the parent asset (By using the <asset:load> tag) before you can invoke this tag to list its children.

Its syntax is represented as:

<asset:children name=”Asset_Name” list=”List_Name” code=”Association_Name” objectype=”Asset_Type” objectid=”Asset_ID” order=”nrank”/>

The <asset:children> tag will extract children assets from the AssetRelationTree table and returned the following fields for each child in the list:

Parameter Description

name (required) The name assigned to the parent asset whose children you want to list. This parent asset must be loaded and assigned a name before you can pass its name to this tag.

list (required) The name to assign to the list which stores the results.

code Restricts the list to include only the child assets that have the relationship (or association) specified by this parameter.

objecttype Restricts the list of children by asset type.

objectid Restricts the list to include only the child asset that you specify.

order The fields to sort the list by and whether the sort on those fields is in ascending (“asc”) or descending (“desc”) order.

Page 95: Core Dev Book

Module 4

95

• oid (child id)

• otype (child type)

• nid (node id)

• nparentid (child node parent id)

• ncode (name of the association, if named)

• nrank (ranking for assets in collections only)

Example:

Below is the example of how to find an associated asset for a HelloArticle asset:

<asset:load name=”myArticle” type=’<%= ics.GetVar(“c”) %>’ objectid=’<%= ics.GetVar(“cid”) %>’/><asset:children name=”myArticle” list=”ImageList” objecttype=”HelloImage”/>

<ics:if condition='<%= ics.GetErrno() < 0 %>' ><ics:then>

<ics:if condition='<%= ics.GetErrno() == -111 %>' ><ics:then>

<br>Asset has no children</ics:then><ics:else>

<br>Error received: <ics:geterrno/></ics:else>

</ics:if></ics:then><ics:else><!-- display asset children --><ics:listloop listname=”ImageList”>

<ics:listget listname=”ImageList” fieldname=”#numRows” output=”childNum” />

<ics:listget listname=”ImageList” fieldname=”oid” output=”childId” />

<ics:listget listname=”ImageList” fieldname=”otype” output=”childType” />

<br>Number of children: <ics:getvar name=”childNum” /><br>

<!-load the child asset --><asset:load name=”myImage” objectid=’<%=

ics.GetVar(“childId”) %>’ type=’<%= ics.GetVar(“childType”) %>’ />

<asset:get name=”myImage” field=”name” output=”v_name” /><br><ics:getvar name=”v_name”/><asset:get name=”myImage” field=”description” output=”v_desc”

/><br><ics:getvar name=”v_desc”/>

<!-- use the <render:satellite> tag to display a picture -->...

Page 96: Core Dev Book

Content Server Core Developer I

96

</ics:listloop></ics:else>

</ics:if>

<satellite:blob> TagThe <satellite:blob> tag retrieves a blob. If the specified blob is already cached on this CS-Satellite, <satellite:blob> loads it into the page. If the specified blob is not already cached on this CS-Satellite, <satellite:blob> extracts the blob from a table, caches it, and loads it into the page. Keep in mind that this tag works regardless of the cookie setting on the browser.

This tag overrides the default caching expiration time defined by the CS-Satellite expiration property.

The satellite:blob tag is the preferred method to render images, downloadable documents, and other large objects that are managed by Content Server.

Its syntax is represented as:

<satellite:blob> [<satellite:parameter name="service" value="service_name"/>] [<satellite:parameter name="blobtable" value="blob_table_name"/>] [<satellite:parameter name="blobkey" value="primary_key_name"/>] [<satellite:parameter name="blobwhere" value="primary_key_value"/>] [<satellite:parameter name="blobcol" value="column_name"/>] [<satellite:parameter name="blobheader" value="MIME_type"/>] [<satellite:parameter name="csblobid" value="session variable"/>] <satellite:parameter name="cachecontrol" value="expiration_date_time"/> [<satellite:parameter name="blobnocache" value="true or false"/>] <satellite:parameter name="ALT" value="alttext"/> <satellite:parameter name="BORDER" value="border_size"/>

Parameter Description

service (required) Specify the start of the HTML tag to hold this blob. For example, if the blob is an image, set service_name to "img src".

blobtable (required) Name of the content table containing the binary data.

blobkey (required) Name of the column used as the table's primary key.

blobwhere (required)

Value of the primary key for the row containing the binary data.

Page 97: Core Dev Book

Module 4

97

Example:

Below is the example of how to display a HelloImage asset with the BlobServer:

<satellite:tag><satellite:parameter name='type' value='open'/>

</satellite:tag>

blobcol (required) Name of the column containing the binary data.

blobheader (required) MIME type for returned data. It takes the form description/extension. For example, the MIME type for a GIF image is image/gif.

csblobid The value of this parameter must correspond to a session variable of the same name when BlobServer security is on. When a request is made to the BlobServer, the img src service parameter sends a new request to the application server after the browser reads the containing page. BlobServer then verifies if the csblobid parameter was set. When BlobServer security is set to true and the csblobid value matches the session variable value, the blob is served. If the values do not match a security violation is reported and no blob is served.

cachecontrol Specifies when this blob expires from the cache. If you omit this tag, CS-Satellite uses the value of the expiration property to determine how long to cache this blob. You can override the default expiration value by specifying one of the following:

• never - This blob should never expire for time reasons. Such objects are not guaranteed to stay in the cache forever. For example, if the cache is full, CS-Satellite removes blobs on a LRU (Least Recently Used) basis.

• immediate - Expire this blob immediately; in other words, to not cache this page.

• expiration_date_and_time - Specifies the precise date(s) and time(s) this blob should expire.

session:expiration_date_and_time - Specifies the precise date(s) and time(s) this blob should expire. Placing the word session in front of expiration_date_and_time tells CS-Satellite to serve this blob only to the person who originally requested it.

blobnocache Whether or not to disable blob caching. A value of true prevents the blob from being cached.

ALT Alternate text associated with the blob.

BORDER Sets the border size for the blob.

Parameter Description

Page 98: Core Dev Book

Content Server Core Developer I

98

...

<satellite:blob><satellite:parameter name="service" value="img src"/><satellite:parameter name="blobtable" value=”HelloImage” /><satellite:parameter name="blobkey" value="id" /><satellite:parameter name="blobwhere" value=”HelloImageID”/><satellite:parameter name="blobcol" value="urlfile" /><satellite:parameter name="blobheader" value=”img/gif” /><satellite:parameter name="ALT" value=”Some Image”

</satellite:blob>

...

<satellite:tag><satellite:parameter name='type' value='closed'/>

</satellite:tag>

Note: Make sure that you import satellite.tld tag library file with the following code:

<%@ taglib prefix="satellite" uri="futuretense_cs/satellite.tld" %>

Page 99: Core Dev Book

Module 4

99

Exercise 4.2.1: Using the <asset:load> and <asset:get> Tags

PurposeThe objective of this lab exercise is to create templates that will render a HelloPersonal asset.

In this lab exercise, you will complete the following actions:

• Create and assign a template for a HelloPersonal asset.

• Call Content Server to serve a HelloPersonal asset with the right template.

• Use the <asset:load> tag to load a HelloPersonal asset.

• Get field values of an asset by using <asset:get>.

Begin the ExerciseFollow these directions for completing this lab exercise.

1. In the HelloPersonalTemplate element, uncomment the following line:

<%@ taglib prefix="asset" uri="futuretense_cs/asset.tld" %>

2. Add the <asset:load> JSP tag to load your HelloPersonal asset into memory.

3. Use the <asset:get> and <ics:getvar> JSP tags to get and display the values in the asset’s fullname, race and mass fields.

Test Your ResultsIn Content Server Direct, find the HelloPersonal you want to preview with your new template and click the Preview button.

You can also preview any asset with any template by typing the following URL in your browser:

http://localhost:7001/servlet/ContentServer?pagename=SiteName/AssetTypeName/TemplateName&cid=AsssetID

Now, preview another HelloPersonal asset with the template that you created in this exercise. Use the URL shown above and simply change the value of cid to be the ID of your asset.

Extra CreditUse the <asset:scatter> tag to display the same fields as you displayed with the <asset:get> tag.

Note: You always have to loads the asset before you scatter its fields. The <asset:scatter> tag does not work when rendering url fields; use the <asset:get> tag instead.

Page 100: Core Dev Book

Content Server Core Developer I

100

Exercise 4.2.2: Using the <asset:children> TagPurposeThe objective of this lab exercise is to create templates that will render the HelloPersonal asset and its associated HelloImage asset.

In this lab exercise, you will complete the following actions:

• Create an asset association between a HelloPersonal asset and a HelloImage asset.

• Use the <asset:children> tag to find a HelloImage associated with your HelloPersonal.

• Use <asset:load> and <asset:get> to load and get the name of the HelloImage associated with your HelloPersonal.

• Use <satellite:blob> tag to display the HelloImage asset.

Begin the ExerciseThis exercise has the following parts:

• Finding Associated Assets with the <asset:children> JSP tag

• Displaying HelloImage Asset

Finding Associated Assets with the <asset:children> JSP tag1. Modify your HelloPersonalTemplate element to add the <asset:children> JSP

tag. Name the list returned by the <asset:children> tag HelloImageList.

2. From the list the associated of HelloImage assets, retrieve and display the value of each child image’s oid field. Use this oid value (image ID) to load a HelloImage asset with the <asset:load> tag.

3. Use the <asset:get> JSP tag to get the values of the mimetype and alttext fields for the HelloImage asset. Store the values in the Content Server variables v_mimetype and v_alttext, respectively.

Displaying HelloImage AssetBefore you use satellite.blob tag, you will need to notify Satellite Server that there are Satellite tags in the code. For this, you will need to add both, the Satellite Server opening and closing tags to your element:

1. Add a Satellite Server opening tag in the beginning of your element:

<satellite:tag><satellite:parameter name=’type’ value=’open’/>

</satellite:tag>

2. Add the Satellite Server closing tag at the end of your element:

<satellite:tag><satellite:parameter name=’type’ value=’closed’/>

</satellite:tag>

3. Import the satellite.tld by adding the following line in the header of your element:

Page 101: Core Dev Book

Module 4

101

<%@ taglib prefix=”satellite” uri=”futuretense_cs/satellite.tld” %>

4. Display the HelloImage asset with <satellite:blob>. The following is the code sample for displaying a HelloImage with the <satellite:blob> tag:

<satellite:blob><satellite:parameter name=”service” value=”img src”/><satellite:parameter name=”blobtable” value=”HelloImage” /><satellite:parameter name=”blobkey” value=”id” /><satellite:parameter name=”blobwhere” value=’<%=

ics.GetVar(“ChildId”) %>’ /><satellite:parameter name=”blobcol” value=”urlfile” /><satellite:parameter name=”blobheader” value=’<%=

ics.GetVar(“v_mimetype”) %>’ /><satellite:parameter name=”ALT” value=’<%=

ics.GetVar(“v_alttext”) %>’ /></satellite:blob>

Test Your Results1. In Content Server Direct, find the HelloPersonal you want to preview with your new

template and then click on the Preview button.

While previewing an asset in the Preview mode (via the CS-Direct interface), CS may display an preview error page at the bottom of the template, which looks similar to the following:

The error message only happens in the Preview mode when the asset does not have any other assets associated with it and asset:children tag returns an empty list.

2. In your browser, preview any asset with any template by typing the following URL:

http://localhost:7001/servlet/ContentServer?pagename=HelloAssetWorld/HelloPersonal/HelloPersonalTemplate&cid=HelloPersonaID

Page 102: Core Dev Book

Content Server Core Developer I

102

Lesson 4.3: Render TagsCS-Direct renders content in three ways, by:

• Displaying pages and pagelets dynamically when a visitor requests them on the live site.

• Displaying assets in response to the Preview function on a CS-Direct management or development system.

• Converting pages and pagelets into static HTML files through the Export to Disk publishing method.

CS-Direct determines how to render content by using an argument named rendermode. rendermode has three valid settings:

• Export - CS-Direct uses the Export to Disk publishing method to create static HTML files.

• Live - CS-Direct invokes Content Server to serve content dynamically.

• Preview - CS-Direct invokes Content Server to render a selected asset in a browser pointed at a CS-Direct management or development system.

Setting the rendermode ArguementThe rendermode argument is set through the resargs of page entries in the SiteCatalog table.

When CS-Direct creates page entries for templates, it sets rendermode as an argument in the resargs2 field for that entry and sets it to live. If you export or preview an asset that uses that template, CS-Direct sets rendermode to export or preview, as appropriate.

Render TagsThe following tags render a page for use with CS-Satellite, render an element, and render a blob for use with CS-Satellite:

• <render:satellitepage>

• <render:callelement>

• <render:satelliteblob>

<render:satellitepage> JSP TagUse this JSP tag to serve a CS-Direct page or pagelet when you are using CS-Satellite on your system. The page or pagelet must have a page entry in the SiteCatalog. If the specified pagelet is already cached on a CS-Satellite, this tag loads it. However, if the specified pagelet is not already cached, this tag caches it and loads it.

If an element is coded with a <render:satellitepage> tag but CS-Satellite is not present, <render:satellitepage> passes the call to <render:contentserver> which then serves the page or pagelet.

This tag is the CS-Direct equivalent of the <satellite:page> tag except that rendermode is passed to the element automatically.

Its syntax is represented as:

<render:satellitepage pagename=”SiteCatalog_Entry_Name” cachecontrol=”Expiration_Date_and_Time”>

Page 103: Core Dev Book

Module 4

103

<render:argument name=”Argument_Name” value=”Argument_Value”/> </render:satellitepage>

Example:

The following code calls for the page entry of a template named HelloImageTemplate1, passing the ID of the asset that it should display:

<render:satellitepage pagename="HelloAssetWorld/HelloImage/HelloImageTemplate1">

<render:argument name="cid" value=”HelloImageID”/></render:satellitepage>

Note: This tag assumes that the asset you are rendering has its own template. Thus if you would like to display a child asset with its parent you can do so either by displaying the child asset within a parent template as you did in Exercise 4.2.2, or you can create a template for child assets and use <render:satellitepage> to display child assets with their own templates.

If you would like to display a child with the default template, the best way to get the name of a default template is looking up in the asset type table. Load the child asset first with <asset:load> tag and then get the name of a default template with the <asset:get> tag. See the example:

<!-load the child asset --><asset:load name=”myImage” objectid=’<%= ics.GetVar(“childId”) %>’ type=’<%= ics.GetVar(“childType”) %>’ />

<asset:get name=”myImage” field=”template” output=”v_template” />

<render:getpageurl> JSP TagThe <render:getpageurl> tag creates a URL for an asset, processing the arguments passed to it from the calling element into a URL-encoded string and returning it in a variable.

Its syntax is represented as:

<render:getpageurl outstr=”theURLVariable” pagename=”SiteCatalogPageEntry” cid=”Assets ID” [p=”NameOfParentPage”] [c=”AssetType”] [addsession=”true/false”] [dynamic=”true/false”] [packedargs=”stringFromPACKARGStag”]> [<render:argument name=”xxx” value=”y”/>]

Parameter Description

pagename The name of the page to invoke.

cachecontrol Determines how long to cache the pagelet.

Page 104: Core Dev Book

Content Server Core Developer I

104

</render:getpageurl>

Example:

Below is an example of how to create dynamic links for the HelloArticle assets in the Collection of HelloArticle assets:

<render:getpageurl outstr="theURL" pagename="HelloAssetWorld/HelloArticle/HelloArticleTemplate" cid=”ArticleID”></render:getpageurl>

<br><A HREF='<%= ics.GetVar("theURL") %>'>Article Name</A>

Parameter Description

outstr (required) Name of the variable that stores the URL generated by this tag.

pagename (required) Page name from a SiteCatalog entry. The page name can be referred to by a specific name or it can be determined through some combination of the four standard CS-Direct page criteria variables (c, cid, ct, and p). For example: pagename=”BurlingtonFinancial/Article/Variables.ct”

cid (required) ID of the asset that the URL represents.

p ID of the parent page. If a value for p is not explicitly provided, the tag tries to determine whether a value exists.

c Type of the asset. This parameter is optional, but if c (asset type) is not supplied, rendermode is set to export, and assets of this type have a Filename field, then the file name that the Export to Disk publishing method creates for the asset does not include the information from the Filename field of the asset.

divine strongly recommends that you supply a value for c.

addsession Whether or not to include session IDs in the URL when a browser is set to reject cookies. true means to encode session IDs in the URL. If this parameter is not specified, it is set to true by default.

dynamic Whether to create a static or a dynamic URL for the asset when the page is being rendered by the Export to Disk publishing method.

true means to create a dynamic URL even if rendermode is set to export. false means to create a static URL if rendermode is set to export. If this parameter is not specified, it is set to false by default.

packedargs Previously created URL-encoded packed arguments, in standard form; that is, the output of a previous render:packargs tag.

render:argument Name/value pairs to be passed in and included in the URL.

Page 105: Core Dev Book

Module 4

105

<render:callelement> JSP TagThe <render:callelement> tag calls an element from the ElementCatalog table to process the content of an element that you wrote for CS-Direct and want the scope of that element to be local. The element must exist in the ElementCatalog.

This tag is the CS-Direct equivalent of the Content Server JSP CallElement tag with the following differences: 1) its scope is always local and 2) rendermode is passed to the element automatically if rendermode is set to export or preview.

Its syntax is represented as:

<render:callelement elementname=”ElementCatalog_Entry_Name”><render:argument name=”Argument_Name” value=”Argument_Value”/>

</render:callelement>

<render:satelliteblob> JSP TagThis JSP tag retrieves a blob from a table or the CS-Satellite cache.

This tag is the CS-Direct equivalent of the CS-Satellite <satellite:blob> tag, except that rendermode is passed in automatically.

Its syntax is represented as:

<render:satelliteblob service=”HTML_Tag_Name” blobtable=”Table_Name” blobkey=”Primary_Key_Field” blobwhere=”Primary_Key_Value” blobcol=”Field_Name” blobheader=”MIME_Type” cachecontrol=”Expiration_Date_and_Time”>

<render:argument name=”Argument_Name” value=”Argument_Value”/> </render:satelliteblob>

Parameter Description

elementname (required)

The name of the element to invoke.

Parameter Description

service (required) Input. Start of the HTML tag to hold the reference to the blob. For example, if the blob is an image, use service=“IMG SRC”.

blobtable (required) Input. Name of the CS-Direct table that stores assets of this type. For example, blobtable=“ImageFile”.

blobkey (required) Input. Name of the column used as the primary key. Typically, this is “id”.

blobwhere (required) Input. Object ID of the asset.

blobcol (required) Input. Name of the column that contains the binary data. For example, for the imagefile asset type, blobcol=“urlpicture”.

Page 106: Core Dev Book

Content Server Core Developer I

106

blobheader (required) Mimetype for returned data, in the form description/extension. For example, the mimetype for a GIF image is image/gif.

blobheadernamen Specifies HTTP header variables to suit your needs, The blobheadername parameter is used in conjunction with the blobheadervalue parameter to produce name/value pairs. This parameter represents the variable name.

blobheadervaluen Used in conjunction with blobheadername to specify and represent HTTP header variable values.

render:argument Input. Name/value modifiers for the HTML tag. For example:

<render:argument name=“vspace” value=“5”/>

<render:argument name=“hspace” value=“5”/>

cachecontrol Input. Determines for how long to cache the blob. See satellite:blob for details about this parameter.

csblobid Value of this parameter must correspond to a session variable of the same name when BlobServer security is on. When a request is made to the BlobServer, the img src service parameter sends a new request to the application server after the browser reads the containing page. BlobServer then verifies if the csblobid parameter was set.

When BlobServer security is set to true and the csblobid value matches the session variable value, the blob is served. If the values do not match, a security violation is reported and no blob is served.

Parameter Description

Page 107: Core Dev Book

Module 4

107

Exercise 4.3.1: Using Render JSP Tags PurposeThe objective of this lab exercise is to:

• Create templates for HelloImage assets.

• Use the <render:satellitepage> tag to display HelloImage assets within the HelloPersonalTemplate (parent template)

Begin the ExerciseThis exercise has the following parts:

• Creating a Template for HelloImage Assets

• Using the <render:satellitepage> Tag to Call HelloImageTemplate

Creating a Template for HelloImage Assets1. Log in to CS-Direct and create a JSP template asset called HelloImageTemplate.

HelloImage assets will be rendered with this template.

2. Use the <asset:load>, <asset:get>, and <ics:getvar> tags to load a HelloImage asset, and then to get and display the name of the asset.

3. Use the <satellite:blob> tag to display the HelloImage asset.

Refer to the tag syntax and example in “<satellite:blob> Tag” on page 96. Don’t forget to import the satellite.tld and to use the opening and closing tag for Satellite Server in your element.

4. Add an HTML tag to your template to display the image with a background color (<body bgcolor=”yellow”> </body>).

5. Assign the HelloImageTemplate to one of the HelloImages as a default template.

6. Preview a HelloImage asset with the HelloImageTemplate. You should be able to see the image with its name and yellow background.

Using the <render:satellitepage> Tag to Call HelloImageTemplate1. Modify the HelloPersonalTemplate element to display HelloImage child asset within

its own template:

a. Remove the <satellite:blob> tag from the HelloPersonalTemplate element. HelloImageTemplate will render the image.

b. Use the <render:satellitepage> tag to make a call to HelloImageTemplate and pass the ID of a HelloImage asset that you would like to display.

2. Preview a HelloPersonal asset. You should be able to see your image with the yellow background.

Page 108: Core Dev Book

Content Server Core Developer I

108

Exercise 4.3.2: Rendering Collection Assets with Templates

The objective of this lab exercise is to:

• Create templates for Collection assets.

• Use <render:getpageurl> tags to display hyperlinks.

Begin the ExerciseThis exercise has the following parts:

• Creating a Template for a Collection Asset

• Rendering a Collection asset

Creating a Template for a Collection Asset1. In the CS-Direct, create a JSP Template asset called HelloCollectionTemplate2.

Collections assets will be rendered with this template.

a. In the Name and Description fields, type HelloCollectionTemplate2

b. In the For Asset Type field, select Collection

c. In the Applies to Subtypes field, select HelloPersonals.

This template will only render collections of HelloPersonals assets.d. From the Create Template Element? section, click the JSP button.

e. Click the Save button to save your template.

2. Assign the HelloCollectionTemplate2 template to all three Collections:

- FemaleAliensCollection- MaleAliensCollection- AllAliensCollection

Rendering a Collection asset1. In the Content Server Explorer, open the Collection/

HelloCollectionTemplate2 element.

2. Use the <asset:load>, <asset:get>, and <ics:getvar> tags to load a Collection asset, and then to get and display the name of the Collection.

3. Similarly to steps for rendering HelloPersonals children in “Using the <asset:children> Tag” on page 100, add code to your template to find an ordered Collection children (HelloPersonal assets).

4. Display the ordered list of children by showing hyperlinks to HelloPersonals assets. When the user clicks on a link, he or she should see a HelloPersonal asset displayed with the HelloPersonal Template.

Use <render:getpageurl> tag to display the link to these assets. The hyperlink should render a HelloPersonal asset with the HelloPersonalTemplate. Please refer to the example and tag syntax in the “<render:getpageurl> JSP Tag” on page 103.

Page 109: Core Dev Book

Module 4

109

Test Your Results1. In the CS-Direct, search for the FemaleAliensCollection asset.

2. In the Inspect form of this asset, click the Preview button to preview the asset.

You should be able to see a page with the list of hyperlnks to the HelloPersonal assets.

3. Click on a hyperlink to view a HelloPersonal.

Page 110: Core Dev Book

Content Server Core Developer I

110

Exercise 4.3.3: Rendering Page Assets with Templates

The objective of this lab exercise is to:

• Create templates for Page assets.

Begin the ExerciseThis exercise has the following parts:

• Creating a Template for a Collection Asset

• Rendering a Page asset

Creating a Template for a Page Asset1. In the CS-Direct, create a JSP Template asset called HelloPageTemplate2.

Collections assets will be rendered with this template.

a. In the Name and Description fields, type HelloPageTemplate2

b. In the For Asset Type field, select Page

c. In the Applies to Subtypes field, select personals.

This template will only render collections of HelloPersonals assets.d. From the Create Template Element? section, click the JSP button.

e. Click the Save button to save your template.

2. Assign the HelloPageTemplate2 template to the following page asset:

- HelloPersonalsHome- FemaleAliensPage- MaleAliensPage

Rendering a Page asset1. In the Content Server Explorer, open the Page/HelloPageTemplate2 element.

2. Use the <asset:load>, <asset:get>, and <ics:getvar> tags to load a Page asset, and then to get and display the name of the Page.

3. Use the steps for rendering HelloPersonals children in “Using the <asset:children> Tag” on page 100, add code to your template to find Page children (Collections).

4. Display the ordered list of the Page children.

Use <render:satellitepage> tag to display each Collection. This tag should render a Collection with the HelloCollectionTemplate2. Please refer to the example and tag syntax in the “<render:satellitepage> JSP Tag” on page 102.

Page 111: Core Dev Book

Module 4

111

Test Your Results1. In the CS-Direct, search for the FemaleAliensPage asset.

2. In the Inspect form of this asset, click the Preview button to preview the asset.

Page 112: Core Dev Book

Content Server Core Developer I

112

Lesson 4.4: Site Plan TagsIn this lesson you will learn about Site Plan tags. You use Site Plan tags to create navigation bars for your web site.

The CS-Direct site tree is an outline or site plan, located on the Site Plan tab, that displays the page assets in your site.

Use the Site Plan methods (or tags) to extract information about a page asset’s position in the site tree hierarchy from the CS-Direct database.

You can then display that information on your on-line site in site maps, navigation bars, etc.

Database TablesCS-Direct stores information about Page assets in these Content Server database tables:

• Page table - Stores information about the Page asset as an asset (such as its name and object ID, who created it, which template it uses, etc.); uses the Asset methods to obtain information from that table.

• AssetPublication table - Specifies which management sites (or publications) give you access to the Page. Page assets cannot be shared between sites (or publications) so there is only one row entry for a page because it can have only one pubid, which is a unique value that identifies a publication (or site).

• SitePlanTree table - Stores information about the Page asset’s hierarchy in the site structure; uses the Site Plan methods to obtain information from that table.

Site Plan TagsThe following is a list of some tags that you will find useful:

• <siteplan:load>

• <asset:getsitenode>

• <siteplan:children>

<siteplan:load> JSP TagThe <siteplan:load> tag executes a database query to retrieve an instance of the specified site plan tree node and then saves the instance into memory (as session information), assigning it the name provided by the name parameter. That object is then available until the session is flushed or the name is overwritten.

To determine the node ID of the site plan tree node that you want to load, you can either use the <asset:getsitenode> or <siteplan:listpages> tags.

Its syntax is represented as:

<siteplan:load name=”Node_Name” nodeid=”Node_ID”/>

Parameter Description

name (required) The name of top-level node of the site plan to load.

nodeid (required) The node ID of the top-level node in the site plan.

Page 113: Core Dev Book

Module 4

113

<asset:getsitenode> JSP TagThe <asset:getsitenode> tag queries the SitePlanTree table and returns the node ID of the specified page asset.

The relationships set up between page assets on the site tree in the CS-Direct main window are stored in the SitePlanTree table. This tag uses the object ID of a page asset to retrieve its node ID from that table.

You can then use the node ID to acquire information about the site’s hierarchy to use for display. For example, to create a navigation bar with links to section pages or a link back to the parent page.

Its syntax is represented as:

<asset:getsitenode name=”Asset_Name” output=”Variable_Name”/>

The following is the example of how to use this tag:

<!-- load the Home page --><asset:load name="root" type="Page" field="name" value="Home"/>

<!-- get the node ID of this page asset --><asset:getsitenode name="root" output="topnodeid"/>Node ID: <ics:getvar name=”topnodeid”/>

<!-- load the node --><siteplan:load name="topnode" nodeid='<%= ics.GetVar("topnodeid") %>'/>

<!-- get the page children here -->

...

<siteplan:children> JSP TagThis JSP tag queries the SitePlanTree table and then builds a list of the child nodes (or pages) for the specified node (or page).

Its syntax is represented as:

<siteplan:children name=”Asset_Name” list=”List_Name” objectype=”Page” objectid=”Page_ID” code=”Placed or Unplaced” order=”Field_Name”/>

Parameter Description

name (required) The name assigned to the page asset whose node ID you want to retrieve. This page asset must be loaded and assigned a name before you can pass its name to this tag.

output (required) The variable name to assign to the page asset’s node ID.

Parameter Description

name (required) The name of the parent node whose children you want to list. This parent node must be loaded and assigned a name before you can pass its name to this tag.

Page 114: Core Dev Book

Content Server Core Developer I

114

You should load the node from the Site Plan tree first before looking for child pages.

The following is the example of how to use this tag:

<!-- load the Home page --><asset:load name="root" type="Page" field="name" value="Home"/>

<!-- get the node ID of this page asset --><asset:getsitenode name="root" output="topnodeid"/>Node ID: <ics:getvar name=”topnodeid”/>

<!-- load the node --><siteplan:load name="topnode" nodeid='<%= ics.GetVar("topnodeid") %>'/><!-- get the page children here --><siteplan:children name="topnode" list="pageList" code="Placed" order="nrank"/>

<ics:if condition='<%= ics.GetErrno() < 0 %>' ><ics:then>

<ics:if condition='<%= ics.GetErrno() == -111 %>' ><ics:then>

<br>Page has no children</ics:then><ics:else>

<br>Error received: <ics:geterrno/></ics:else>

</ics:if></ics:then><ics:else>

<ics:listget listname="children" fieldname="#numRows" output="childNum" />

list (required) The name to assign to the list of the node’s children. This list holds values for all of the fields in the SitePlanTree table.

objectype Restricts the list to nodes of a specific type and that type should always be “Page”.

objectid The object ID of a specific child node.

code The name of the association that describes the relationship between the child and parent nodes. Valid values are “Placed” and “Unplaced”.

order The fields to sort the list by and whether the sort on those fields is in ascending (“asc”) or descending (“desc”) order.

Parameter Description

Page 115: Core Dev Book

Module 4

115

<ics:listloop listname="children" maxrows='<%= ics.GetVar("childNum") %>'>

<ics:listget listname="children" fieldname="oid" output="childpage:id" />

<asset:load name="childpage" type="Page" objectid='<%= ics.GetVar("childpage:id") %>'/>

<asset:get name="childpage" field="name" output="childpage:name"/>

<br>&nbsp;&nbsp;&nbsp;Child Page Name: <ics:getvar name="childpage:name"/>

</ics:listloop></ics:else>

</ics:if>

Page 116: Core Dev Book

Content Server Core Developer I

116

Exercise 4.4.1: Building a Page Navigation BarThis exercise will teach you how to navigate through the Sumner Financial site tree.

PurposeWhile performing this exercise, you will learn how to:

• Use the <siteplan:children> tag.

• Use the <siteplan:listpages> tag to navigate through the Hello Asset World site tree.

• Generate dynamic links to pages by building the referURL variable.

Begin the ExerciseYou will learn how to use <siteplan:children> tag to display pages in the in the Hello Asset World SitePan Tree.

This exercise has the following parts:

• Creating a CSElement HelloNavBar

• Displaying the Root of Hello Asset World Site Plan Tree

• Displaying All Pages in Hello Asset World Site Plan Tree

Creating a CSElement HelloNavBarIn this section, you will create a new CSElement asset that displays page assets the Site Plan tree. The CSElement HelloNavBar is an asset, which you can inspect, edit, delete, publish, and preview in the CS-Direct interface. This element can be shared by all the pages in the Hello Asset World site.

1. In the CS-Direct interface, select New and then click on the CSElement link to create a new CSElement asset.

2. In the Name field, enter HelloNavBar.

3. In the Description field, enter HelloAssetWorld Page Navigation.

4. In the ElementCatalog Entry Name field, enter HelloExtra\HelloNavBar.

If you do not enter anything in this field, the CS-Direct will automatically create a new HelloNavBar element in the root directory of the ElementCatalog.

5. From the Create Element? section, click the JSP button.

The CS-Direct will create code in the Element Logic text area. When you save this asset, this code is saved in the HelloExtra\HelloNavBar.jsp file. You can change the name of the JSP file by modifying the entry in the Element Catalog Entry Storage Path/Filename: field before you save the CSElement asset.

6. Click the Save button to save your CSElement asset.

You can now modify code in the HelloExtra\HelloNavBar element. You can also test your changes by simply clicking the Preview button in the asset Inspect form.

Page 117: Core Dev Book

Module 4

117

Displaying the Root of Hello Asset World Site Plan TreeIn this section, you will add code to the HelloExtra\HelloNavBar element to display the Site Plan tree.

1. Use the <asset:load> tag to load the HelloPersonalsHome page (top page in the Site Plan tree). You do not need to know the ID of this page asset. Simply use the name of the asset in your code. The following code is the example of how you can find an asset by its unique field:

<asset:load name="root" type="Page" field="name" value="HelloPersonalsHome"/>

2. Use the <asset:get> tag to get the value of the page asset ID and then use the <render:getpageurl> tag to display the link to this page.

Please refer to the example and tag syntax in the <render:getpageurl> JSP Tag.

Displaying All Pages in Hello Asset World Site Plan TreeIn this section, you will modify the HelloExtra\HelloNavBar element. You will use the <siteplan:children> tag to display links HelloPersonalsHome children pages.

1. Get the Site Plan tree top node if with the <asset:getsitenode> tag. Store the node id in the CS variable (refer to the example and tag syntax in “Site Plan Tags” on page 112).

2. Load this node with the <siteplan:load> tag.

3. Use the <siteplan:children> tag to get all children nodes.

4. Write an <ics:if><ics:then><ics:else> statement that checks for errors returned by the <siteplan:children> tag. Error -111 means that no children nodes were found. Do not display any error messages if no grandchildren were found.

5. If the children list exists, for each child page load and display the name of the page and then use the <render:getpageurl> tag to build and display a dynamic link to the child page.

Test Your ResultsTest your work by previewing the HelloNavBar CSElement asset.

1. In the CS-Direct, search for the HelloNavBar CSElement.

2. In the Inspect form of this asset, click the Preview button to preview the asset.

3. Call the HelloExtra\HelloNavBar element in Hello Asset World templates. Use <render:callelement> to render the element. Please, refer to the example in <render:callelement> JSP Tag.

Page 118: Core Dev Book

Content Server Core Developer I

118

Module Summary • When you use an <asset:load> tag to retrieve an asset from the database, CS-

Direct loads an instance of the asset into memory as an object.

• Assets can have parent-child relationships that are set up through named associations or unnamed relationships.

• Named associations are defined, asset-type-specific relationships represented as fields in the asset forms.

• Unnamed relationships are established, for example, when you select assets from the generic Select list boxes on the Page form.

• CS-Direct stores information about assets in these database tables:

- Primary database- AssetRelationTree- AssetPublication- SitePlanTree

• Asset database queries you will use include:

- <asset:load>- <asset:get>- <asset:scatter>

- <asset:children>.

• The CS-Direct site tree is an outline or site plan, located on the Site Plan tab, that displays the page assets in your site.

• CS-Direct stores information about page assets in these database tables:

- Page- AssetRelationTree- AssetPublication- SitePlanTree

• Siteplan queries that you use frequently include:

- <siteplan:load>- <asset:getsitenode>- <siteplan:children>

• CS-Direct renders content by pages and pagelets into static HTML pages (via the Export to Disk function) or dynamic pages and by assets (via the Preview function)

• There are three valid settings for the rendermode argument:

- export- live- preview

• Render queries that you use frequently include:

- <render:satellitepage>- <render:callelement>- <render:satelliteblob>

Page 119: Core Dev Book

Module 4

119

Page 120: Core Dev Book

Content Server Core Developer I

120

Page 121: Core Dev Book

121

Module 5

Workflow, Publishing, and Revision Tracking

In this module you will learn about more about workflow, publishing, and revision tracking systems.

Module Learning ObjectivesAfter completing this module, you will be able to:

• Define steps to create a Workflow process

• List ways to resolve deadlocks

• Descibe how to deligate or cancel an assignment

• Describe three different publishing delivery types

• What is a publishing destination

• Define role of cache manager during publishing process

• Describe how to publish multiple assets and schedule a publishing process

• Describe how to put an asset into the revision tracking system

Terms to Know

Term Definition

workflow process Workflow is a feature provided by CS-Direct that you use to manage the work on an asset when more than one person participates in its creation.

assignment An asset that a participant is working on (or is supposed to be working on).

workflow step The movement of an asset between states is called a step

Page 122: Core Dev Book

Content Server Core Developer I

122

workflow state A state is a point in the workflow process that represents the status of the asset at that point. For example, writing article, reviewing image, legal review, and so on.

role The job titles of the people who participate in a workflow process are considered roles in the Content Server interface. Roles describe the function of an individual on a site. When you enable a user for a site, you assign that user the roles that they fulfill for that site.

workflow participant The individual user who is selected from the pool of users who have the correct role at any point is called a workflow participant.

deadlock A deadlock occurs when the following conditions are true:

• There is more than one step from a state.• Two or more of the steps require the participants to

perform that step. That is, they are all-voting steps.• An asset in that state is assigned to more than one

participant.• The participants select different all-voting steps when

they finish the assignment.

workflow group Workflow groups enable content providers to send a defined set of assets though the workflow together.

function privilege Function privileges restrict access to a function from the user interface only.

workflow action You can then configure the workflow process to send e-mail messages that remind a participant when the deadline is approaching or has been missed. These e-mail messages are examples of timed actions.

dynamic publishing (Mirror to Server)

On a static CSEE delivery system, Content Server copies the rows for your approved assets from the Content Server database on the management system to the Content Server database on the delivery system.

static HTML publishing

(Export to Disk)

On a static CSEE delivery system, a web server, CS-Direct instructs Content Server to render all approved assets according to their templates and then saves those files.

static XML publishing

(Export Assets to XML)

This delivery type is a data transformation method. Rather than creating pages that are ready to be displayed by a web server, it uses the Export API to create one XML file for each approved asset.

publishing destination A publishing destination defines the location where your content is published to.

version number Total number or revisions for Content Server to keep.

rollback Going back to the previous version.

Term Definition

Page 123: Core Dev Book

Module 5

123

Implicit Checkin and Checkout (automatic)

When users create or edit assets of a type that is being revision tracked, they do not have to manually check out the asset: it is automatically assigned to them. Then, when they click Save, the asset is checked back in.

Explicit Checkin and Checkout (manual)

When a content provider manually (explicitly) checks out an asset, a version is not stored—no matter how many times he or she saves it—until is is manually checked back in.

Term Definition

Page 124: Core Dev Book

Content Server Core Developer I

124

Lesson 5.1: WorkflowWorkflow is a feature provided by CS-Direct that you use to manage the work on an asset when more than one person participates in its creation.

The end goal for any asset is for it to be published. Before an asset can be published, it must be approved for publishing. The workflow feature routes assets through whatever series of tasks you deem necessary in a workflow process that ushers assets from creation to approval.

You can configure a workflow process with as many or as few tasks as necessary to reflect the way the work at your organization is accomplished. You can configure e-mail messages that CS-Direct sends to notify people when assets are assigned to them and to remind them that a deadline is approaching or has been missed.

Because there are so many configuration possibilities, it is typical to create a separate workflow process for each asset type that you plan to use workflow with rather than attempt to create one process for more than one asset type.

Workflow ParticipantsWhen you begin creating a workflow process, the first general question is this: what are the job titles of the people who work on assets of this type? For example, are they authors, editors, marketers, graphic artists, product managers, lawyers?

The job titles of the people who participate in a workflow process are considered roles in the Content Server interface. Roles describe the function of an individual on a site. When you enable a user for a site, you assign that user the roles that they fulfill for that site.

When you create a workflow process, you determine which roles are appropriate for each task. Then, when an individual asset is going through that workflow process, only the users who have the appropriate role are allowed to complete the task. The individual user who is selected from the pool of users who have the correct role at any point is called a workflow participant.

Workflow StatesNext, what are the tasks that are performed for assets of this type? For example, writing, pricing, editing, fact checking, legal review, and so on.

These tasks are called workflow states. A state is a point in the workflow process that represents the status of the asset at that point. For example, writing article, reviewing image, legal review, and so on. Participants complete the work that the state represents while the asset is in that state.

An asset that a participant is working on (or is supposed to be working on) is called an assignment. A user’s assignment list is displayed on the My Work form in the Content Server interface. An asset appears on a user’s assignment list as soon as it enters a state for which the user has a role to fulfill as a workflow particpant.

Should an asset in a specific state remain in that state for only a specific amount of time? If so, assign a deadline to the state. You can then configure the workflow process to send e-mail messages that remind a participant when the deadline is approaching or has been missed. These e-mail messages are examples of timed actions.

You can create one or more timed action for each state.

Page 125: Core Dev Book

Module 5

125

Workflow Steps: Moving Assets from State to StateNext, how does the asset move from state to state? Does a marketing writer send a prospectus asset to a legal reviewer? Does a graphic artist send an image asset to an editor? And then what?

The movement of an asset between states is called a step. Because creating the steps in a process links together states in a specific order, creating the steps in your workflow process is what organizes your process.

When you create a step in a process, you specify which state a step moves the asset from (the From State), which state that step moves the asset to (the To State), and which roles can take the step.

Managing DeadlocksA deadlock occurs when the following conditions are true:

• There is more than one step from a state.

• Two or more of the steps require the participants to perform that step. That is, they are all-voting steps.

• An asset in that state is assigned to more than one participant.

• The participants select different all-voting steps when they finish the assignment.

This diagram illustrates a deadlock:

Note that if even one of the steps is not all-voting and a participant selects that step, the asset will not become deadlocked.

Resolving DeadlocksAn asset that is in a deadlocked state cannot progress through the workflow process until the deadlock is resolved. To resolve the deadlock, the participants must confer with each other and agree on that path that the asset should take. Then, the participants who must change their selection can do one of the following to resolve the deadlock:

• Finish the assignment and select the step that they all agreed to take.

• Select the Abstain from Voting option from the Workflow Commands drop-down list on the asset’s Status form.

Editor:(All Voting)

Approve

Fact Checker:(All Voting)

Reject

Step notifiesAuthor

Review

EditorFact Checker

DEADLOCK

Page 126: Core Dev Book

Content Server Core Developer I

126

Preventing DeadlocksBefore configuring a workflow process that can result in a deadlock, be sure that it is absolutely necessary to have complete agreement on all the possible steps from the state. As you can see from this description, deadlocks cause additional work for all the participants so be sure that you use this feature only when you need to.

For example, consider a review state with two possible steps: “return for revisions” and “approve for publish.” If you configure the steps so that “return for revisions” does not require a unanimous vote but “approve for publish” does, you have created a desirable control—all the reviewers must agree before the asset can be published and any rejection stops the asset from being published—without risking a deadlock.

Notifying Participants When Deadlocks OccurIf you do need to create a workflow process that can result in a deadlock, be sure to configure and assign a deadlock action that notifies the participants of the deadlock for each of the steps that can cause the deadlock. The default deadlock action is an e-mail message that CS-Direct sends to the appropriate participants when a step causes a deadlock.

Workflow GroupsIs there ever a situation in which several assets are so closely connected that they need to be thought of as one unit of work or they need to be approved at the same time? In such a case, you can use the workflow group feature.

Using Workflow GroupsWorkflow groups enable content providers to send a defined set of assets though the workflow together. While it is the content providers who create workflow groups and select the assets that are assigned to the group, you, the administrator, still need to know what kind of assets will be included in workflow groups. Why? So that you can configure the workflow processes appropriately.

For example, you can configure workflow steps that allow each asset in the group to progress to the next state when it is finished or you can configure a step that requires all the assets in the group to reach that point before any of them can progress. (This second example, called a synchronize step, is described next.)

Adding a Synchronize StepWhen creating a workflow process that will be used with workflow groups, it is usually best to configure the process so that it has only one synchronize step. Multiple synchronize steps can slow down the work on those assets unneccessarily. Assess the business process that is reflected by the workflow process and determine which steps must truly be synchronized: perhaps all the assets should go to legal review in one batch, or perhaps all the assets should be approved for publishing at the same time, for example.

Managing Group DeadlocksIf you create a workflow process to be used with workflow groups and any of the steps can result in a deadlock, be sure to configure and assign a group deadlock action that notifies participants when there is a group deadlock and assign it to the process.

Page 127: Core Dev Book

Module 5

127

Delegating and Clearing AssignmentsPeople go on vacation, get reassigned to new work groups, and move on to different jobs. What happens to the assets that they are working on? They can delegate their assignments to other participants who have the appropriate roles.

Additionally, each workflow process can have a workflow administrator. The administrator of a workflow process can delegate assignments on behalf of the other participants.

When an asset is delegated to a new participant, should that person receive an e-mail notice? If so, configure a delegate action to send an e-mail message to new assignees when assets are delegated to them. You can specify one or more delegate actions for each workflow process.

If an asset no longer needs to be assigned or if it is easiest to clear the assignment and then start over, you can use the Clear Assignments feature on the Admin tab.

Placing an Asset in WorkflowAn asset begins its participation in a workflow process in one of the following ways:

• A user selects a workflow process from the Workflow Commands field on the Status form for the asset.

• Selecting the workflow process invokes the start step for the process, which places the asset into the first state.

• A user creates an asset and the start menu New item for assets of that type is configured such that there is a default workflow process.

• In this case, saving the asset invokes the start step for the process, which automatically places the asset into the first state.

Because steps are enabled for specific roles, only the users who have a role that is assigned to the start step of a process can select that process. This means that if you are using start menu items to place assets in workflow, you must be sure that the roles assigned to the start menu item are the same roles that are assigned to the start step of the default workflow.

Restricting Access to Assets While They Are in WorkflowAlthough workflow routes an asset through a business process, sending it to the appropriate users at the appropriate times, the fact that the asset is assigned to a specific user does not stop other users from modifying or even deleting that asset.

If you want to restrict who has access to an asset while it is in workflow, use the workflow feature called function privileges. These are restrictions set on functions such as edit, copy, approve, delete, show versions, and so on in the context of workflow states and workflow roles.

Note

Versions of CS-Direct prior to Version 4 assigned a default workflow to assets through a property in the futuretense_xcel.ini file. The ability to assign a default workflow through a start menu item has replaced that method of determining a default workflow.

Page 128: Core Dev Book

Content Server Core Developer I

128

There are three parts to a function privilege:

• The function being restricted.

• The roles allowed or not allowed to perform the function.

• The state during which users with those roles are allowed or not allowed to perform the function.

When a function privilege is in effect, it means that a user can perform that function only when the following conditions are true:

• The user has an appropriate role.

• The asset is in the correct state.

• The asset is assigned to the user.

This means that even if the user has the correct role and the asset is in the correct state, the user cannot perform that function on that asset unless the asset is assigned to that user.

Function Privileges and Step ActionsFunction privileges restrict access to a function from the user interface only. This means that you can program step actions that invoke a function when a step is taken regardless of what the function privilege is set to at that moment.

The ApproveForPublish step action is an example. Even if you specify function privileges that restrict users from using the Approve option in the user interface, those same users can approve an asset with a workflow step if the workflow step invokes the ApproveFor Publish action and the user has the correct role to take the step.

In other words, you can use function privileges to prevent users from selecting and changing assets by mistake and use actions to invoke those functions in a highly controlled way.

Function Privileges: All or NoneYou cannot create just one function privilege: if you create even one function privilege that allows or restricts access to a function, you must create function privileges that cover all the other possible conditions for your workflow process.

For example, suppose that the only function that you want to restrict is the Delete function—you want to allow only the editors to delete article assets and only then if the article is in the Review state. If you create a function privilege that allows editors to delete article assets while it is in the Review state but you do not create any other function privileges, the only task that can be completed for an article when it is in the workflow is that editors can delete it while it is in the Review state. That is, no one can edit it, approve it, copy it, or even finish their assignments.

To implement the preceding condition—the Delete function is accessible to editors only when the article is in the Review state—you need to create the following function privileges:

• Delete – allowed for editors when the asset is in the Review state.

• Edit – allowed for all roles in all states.

• Abstain from Voting – allowed for all roles in all states.

• Copy – allowed for all roles in all states.

Page 129: Core Dev Book

Module 5

129

• Continue down the list of functions, until you have at least one privilege specified for each function privilege listed in the Functions form for the workflow process.

Page 130: Core Dev Book

Content Server Core Developer I

130

Instructor DemonstrationFollow along as the instructor demonstrates how to place and navigate HelloPersonal asset in a workflow.

Sample Workflow Steps and StatesThe steps and states of the HelloPersonal Process are shown in the following table:

Sample Workflow ScenarioThis section describes the flow of a typical HelloPersonal asset through the sample workflow HelloPersonal Process. The process starts when one of the eligible users creates the article asset and assigns it to the workflow.

The HelloAuthor writes the HelloPersonal and sends it for review Ada the HelloAuthor receives e-mail notification of the assignment. The state of the HelloPersonal is Write HelloPersonal (the first state in the workflow). Joe writes the HelloPersonal, saves the the asset, and uses the Finish My Assignment function to send it on for editing.

The workflow process changes the state of the HelloPersonal to Edit HelloPersonal, assigns it to Flo the HelloEditor, and sends the editor an e-mail notice about the new assignment.

The HelloEditor edits the HelloPersonal and approves it for publishing Flo the HelloEditor logs in, sees her assignment list, and selects the HelloPersonal.The state of the HelloPersonal is Edit HelloPersonal (the second state in the workflow). Flo

Step State Description

Place in Workflow (start of workflow)

Start: (none)

End: Write HelloPersonal

A user in HelloAuthor role—has assigned a HelloPersonal asset to the HelloPersonal Process workflow.

Send for Editor Start: Write HelloPersonal

End: Edit HelloPersonal

A user in the role of HelloAuthor receives e-mail notification of the assignment. The author writes and revises the article before finishing the assignment.

Approve for Publishing

Start: Edit HelloPersonal

End: End of Workflow

The HelloPersonal status is updated to approved for publishing to selected destinations. The asset is removed from workflow.

Return for Revisions

Start: Edit HelloPersonal

End: Write HelloPersonal

A user in the role of HelloEditor receives an e-mail notification of the assignment.

The HelloEditor finishes the assignment by rejecting the HelloPersonal because of factual errors. The rejection triggers a notice to the HelloAuthor, who must make some corrections and resubmit the HelloPersonal for approval.

Page 131: Core Dev Book

Module 5

131

reads the HelloPersonal and fixes some punctuation. When done, Flo saves her changes and uses the Finish My Assignment function to Approve for Publishing.

Because Flow can either approve or reject the HelloPersonal asset, the workflow process presents both options to her.

However, when Flo approves the article, its state does not change until Coco (another HelloEditor) also approves it.

If Coco approves the HelloPersonal, the workflow process changes the state of the article to End of Workflow. The asset is automatically approved for publishing and removed from workflow.

Placing an Asset in a WorkflowComplete the following steps to place HelloArticle asset in a workflow:

1. Log in to the Content Server Direct with the user name Joe and the password hello.

Since Joe and Moe are the two users that have HelloAuthor role, any of them can log in and place a HelloPersonal asset in to the workflow.

2. Create a new HelloPersonl asset or use the existing one to place it in a workflow. For this, inspect the asset and select choose Status from the pop-up menu:

Page 132: Core Dev Book

Content Server Core Developer I

132

3. In the asset’s status screen,which looks similar to the following screen, will come up:

4. From the Workflow commands, choose Select Workflow.

5. From the Select Workflow for HelloPersonal: HelloPersonal asset name screen, select HelloPersonal Process and then click the Set Participants button.

6. From the Set Participants screen, select Joe for HelloAuthor role and then select both Flo and Coco for HelloEditor role.

7. Click the Set Participants button.

This should bring you back to the Select Workflow for HelloPersonal: HelloPersonal asset name screen.

8. From this screen, click the Select Workflow button, to place the asset into the HelloPersonal workflow process.

9. Edit and save the HelloPersonal asset.

After you finish your work for an assignment, you need to notify the system that you are done so the asset can continue to move through the workflow process. Complete the following steps:

1. View the asset’s status by opening the asset in the Status form.

2. Click in the Workflow commands field and then choose Finish My Assignment from the drop-down list.

Page 133: Core Dev Book

Module 5

133

From the same menu, you can also select Delegate Assignment to another user in HelloAuthor role. However, Joe is the only participant of this role in this workflow.

a. Select the next step and state for the asset.

b. In the Action Taken field, type a short description of the work that you completed on the asset.

c. In the Action to Take field, type a short suggestion for the next person who will work with the asset.

3. Click Finish My Assignment.

The asset status screen will show with the workflow history. Examine the workflow history to verify where the asset went. It should indicate who the asset was assigned to. In this case, this asset was assigned to Flow and Coco (both are in HelloEditor role). The HelloPersonal asset is now in the EditPersonal state and should be edited by both Flo and Coco.

4. Log out and log back in to Content Server with the Flo/hello user name and password. You should be able to see the HelloPersonal asset in the assignment list. Continue editing and reviewing the asset. Finish your assignment to pass the asset to the next state.

Page 134: Core Dev Book

Content Server Core Developer I

134

Lesson 5.2: PublishingYou make content available to the visitors of your online site by moving it to your delivery system. Moving content from one CSEE system to another is called publishing.

Content Server provides two publishing APIs, called Export and Mirror. The Export API renders Content Server pages into files. The Mirror API copies rows from tables in one Content Server database to the corresponding tables in another Content Server database.

The CS-Direct publishing system interacts with several underlying systems and APIs before, during, and after a publishing session.

Before CS-Direct can publish assets to a destination system, the following information must be determined:

• Which delivery type should CS-Direct use: Export to Disk, Export Assets to XML, or Mirror to Server?

• As an administrator, you specify the delivery type for the destination when you configure the publishing destination.

• Where should CS-Direct publish to? That is, what is the destination for the publishing session?

• As an administrator, you configure the publishing destinations for your system. When content providers mark their assets “approved,” they approve them for a specific destination.

• Which assets are ready to be published to the current destination?

• The approval system manages this information. When an asset is ready to be published, a content provider marks it as “approved” for a specific destination. The publishing system checks with the approval system and then only the assets that are marked as approved are published, which protects the site from having any broken links. Connected parts of the site are held until they are all ready to be published.

• When should the assets be published?

• As an administrator, you set up the publishing schedule. The publishing process runs as a batch process that you schedule to occur at regularly-occuring intervals. On an as-needed basis, you can also override the schedule and publish on demand.

During a publishing session, CS-Direct writes information about that session to log files. Because the publishing process runs in the background, you can use your browser to complete other administratrive tasks while the session runs. And you can monitor the session through the Publish Console, which shows both the publishing history and the status of any publishing sessions that are currently running.

When the publishing session uses the Mirror to Server delivery type, the publishing system communicates and cooperates with the CacheManager on the delivery system. The CacheManager is a Content Server servlet that manages the page cache on a system. It ensures that pagelets or pages that refer to the assets that will be mirrored are cached. Then, after the publishing session concludes, CacheManager generates those pages again to display the updated content, and caches the new pages and pagelets.

Page 135: Core Dev Book

Module 5

135

Delivery TypesThe term “delivery type” means the publishing method. There are three delivery types and they use either the Export API or the Mirror API. Which delivery type you use for your CSEE system depends on how you plan to deliver the content on your delivery system (statically or dynamically) or whether you are delivering your content to some other non-CSEE system:

• On a static CSEE delivery system, a web server delivers static files files to your site visitors. You use the Export to Disk delivery type to create the files. During an export publishing process, CS-Direct instructs Content Server to render all approved assets according to their templates and then saves those files. You, the adminstrator, must then use FTP or another file transfer protocol to move those files to the web server that is your delivery system.

• On a dynamic CSEE delivery system, Content Server generates (renders) pages upon request. Content Server makes dynamic content decisions based on the request. You use the Mirror to Server delivery type to copy the rows for your approved assets from the Content Server database on the management system to the Content Server database on the delivery system.

• The Export Assets to XML delivery type is a data transformation method. Rather than creating pages that are ready to be displayed by a web server, it uses the Export API to create one XML file for each approved asset. You use this delivery type when your end goal is to publish assets to another (non-CSEE) delivery system or database and that system needs your content to be formatted in XML.

Publishing DestinationsA publishing destination defines the location where your content is published to. A destination is a named object that contains the following information:

• A delivery type (that is, Export to Disk, Mirror to Server, or Export Assets to XML)

• A location

- For Export to Disk and Export Assets to XML, the location is the root file directory that the resulting HTML or XML files are saved to after the publishing system converts the approved assets into files. You set this directory with the cs.pgexportfolder property in the futuretense.ini file.

- For Mirror to Server, the destination is the server name in URL format (which includes the port number if it is anything other than 80) of the server that is supposed to deliver that content. You set the server name in the Destination address field of the Destination form.Note that before you can publish to a mirror destination, you must initialize it.

• Various publishing arguments, depending on which delivery type you are using. For example, if you are using Export to Disk you could specify a URL prefix for your internal links (HREFs).

• The CSEE sites whose assets can be published to the destination.

You can configure more than one publishing destination for your CSEE system. Depending on how your online sites are designed by the developers, you may need to publish both static and dynamic content. For this kind of dual implementation, consult with your developers to determine how to configure your publishing destinations.

Page 136: Core Dev Book

Content Server Core Developer I

136

In this document, the following terms are used when discussing publishing destinations and configuration:

• Source, which means the Content Server database that serves as the source for a publishing session. Because you can mirror assets from any CSEE system to any other CSEE system, the source is not always the CSEE management system.

• Destination, which means either the Content Server database that you are mirroring to or the directory that you are exporting to.

Publishing and the Approval ProcessThe publishing system and the approval system work very closely together. The approval system determines the answers to the following questions:

• Which assets are ready to be published (that is, are marked as approved)?

• Are there any assets that must accompany those approved assets or that must exist on the destination to ensure that all the links on the site will work correctly?

When an asset is ready to be published, a content provider marks it as approved for a specific destination. (For information about how you approve assets, see the chapter on publishing in the CSEE User's Guide.) CS-Direct then verifies that the asset is ready to be published by calculating the list of assets upon which approval depends.

For example, the Burlington Financial sample site has article assets with associated imagefiles. An approved article with an unapproved associated imagefile cannot be published until the imagefile is also approved.

It is typical to build an approval step into your workflow processes.

Approval DependenciesThe approval status of an asset is determined by its dependency relationships, which include the approval status of all asset items associated with a particular asset item, as well as the dependency relationships of those associated items.

How are approval dependencies calculated? That depends on the publishing method:

• For Export to Disk, the approval system renders the asset according to the template that is assigned to it when the asset is approved, or, if there is one, according to the default approval template for assets of that type.The tags in the template code set approval dependencies that determine the appropriate dependents for the approved asset. The dependent assets must be in an appropriate approval state before the current asset can be published.

• For Mirror to Server or Export Assets to XML, the approval process examines the data relationships between asset types. Basic assets have associations. Flex assets have family relationships. Both of these relationships create approval dependencies for these publishing methods. For example, if you approve a flex asset, it will be held from a publishing session unless its parent assets are in an appropriate approval state.

When the approval system calculates approval dependencies, it further categorizes those dependencies by the following types:

• Exists – some version of the dependent asset must exist on the destination so that links to it will work.

• Exact – the version of the dependent asset must exactly match the version of it that was approved. That version must either already exist on the destination or be approved

Page 137: Core Dev Book

Module 5

137

for the destination so that it can be published with the asset that is being evaluated. The version of an asset is based on the timestamp in the updateddate column for that asset.

An asset can be published only if it meets all specified dependencies: that is, all associated assets are also in the correct approval state (either approved or previously published, as necessary). If not, the approved asset is held by CS-Direct until its dependent assets have been approved.

Held AssetsA held asset is one that cannot be published because its approval dependencies are not yet met. When its approval dependencies are met, it will be published.

An asset will be held from a publishing session when any of the following conditions are true:

• It is not approved.

• It was approved, but someone edited it again and it has not yet been re-approved.

• It has a dependent asset with an exact dependency that is not approved.

• It has a dependent asset with an exists dependency and that dependent asset has never been published.

• It has a dependent asset with an exact dependency, the dependent asset has been published, but it has since been edited and is not yet approved.

• It is an exact dependent of another asset that was previously approved, but has since been edited and is not yet re-approved.

• It is checked out (revision tracking).

The approval system calculates dependencies for basic assets differently when the delivery type is Export to Disk than when it is Mirror to Server and Export Assets to XML.

Calculating Dependencies for Export to DiskWhen an asset is approved to a destination that uses Export to Disk, the approval system determines the compositional dependencies for that asset by evaluating the code in the template that is assigned to the asset. It performs a “test-render.”

• For basic assets, tags such as ASSET.LOAD, RENDER.LOGDEP, ASSET.SITEPARENT, and RENDER.GETPAGEURL mark dependencies between assets and the pages that they are rendered on.

• For flex assets, several tags in the ASSETSET family of tags, RENDER.LOGDEP, and the RENDER.GETPAGEURL tags mark dependencies between assets and the pages that they are rendered on.

Note

When someone deletes an asset, its status is changed to Void and it is automatically approved for any destination that it was ever published to. Then, during the next publishing sessions for those destinations, that asset is published and its status becomes Void on those destinations.

Page 138: Core Dev Book

Content Server Core Developer I

138

When the delivery type is Export to Disk, the dependencies are determined as the code in the template is evaluated. If a default template has been assigned for assets of that type, the approval system uses it to determine the dependencies. If there is no default template, the approval system uses the template specified for the asset.

Developers create default templates for asset types for the following reason: when Export to Disk actually publishes the asset, it does not necessarily use the template that is assigned to the asset— the code in another element could determine that a different template is used for that asset in certain cases. If this is the case for your online site, it is likely that the developers who created the templates also designed default templates for the approval system to use when calculating approvals.

You or your site designers can set default approval templates for each asset type and for each publishing destination.

For more information about how dependencies are created between assets when the delivery type is Export to Disk, see the chapters on template design in the CSEE Developer’s Guide.

Approving Multiple AssetsThe approval system provides a feature called Approve Multiple Assets. You use it to approve multiple assets in the following situations:

• You are upgrading from one version of CSEE to another and you have previously published assets that you want to be marked as approved.

• You add a new publishing destination and want to publish assets to it that you know are ready because they are approved for other destinations.

• The default approval template for an export destination is changed.

Note that the Approve Multiple Assets feature is not the BulkApprover utility. The BulkApprover utility approves only those assets that have been imported into the Content Server database with the BulkLoader utility. Both BulkLoader and BulkApprover are described in the CSEE Developer’s Guide.

The Publishing Schedule (Publish Events)A publishing session (no matter what the delivery type) runs as a background, batch process called a publish event. As the administrator, you configure the schedule for the publishing events for your CSEE system.

You can schedule publishing events to occur daily, weekly, hourly, every 15 minutes, or in various combinations of these time increments.

Because each publishing session is a background event, there can be only one publishing session for the same destination at any given time. If a publishing session to a specific destination is still ongoing when the next event for that destination is scheduled, the second event attempts to run and then fails, reporting that a publishing session to that destination is already underway.

Note that you should never schedule a publishing session to a destination for a time when the destination system could be publishing to another destination. For example, you publish from the development system to the management system and you publish from the management system to the delivery system. You should never run a publishing session from the development system to the management system while the management system is publishing to the delivery system.

Page 139: Core Dev Book

Module 5

139

Additionally, you can publish to more than one destination at the same time. You just set up events for the destinations and select the same time for them.

Be aware that the reverse is not true: that is, you cannot have more than one source publish to the same destination. If you do, there will be problems with data integrity as well as publishing errors.

Because a publishing event completes database transactions, the publishing feature must have a user account specified for it. This user is called the batch user and you use the xcelerate.batchuser and xcelerate.batchpass properties in the futuretense_xcel.ini file to identify the batch user account for your CSEE system.

What Happens During the Publishing Session?When the publishing system begins publishing approved assets, CS-Direct does the following:

• Creates a publishing session by adding a row to the PubSession table and assigns the session a unique ID, called the PubSession ID.

• Runs a query to gather all the assets that are approved and are ready to be published to the destination that the session is publishing to.

• Locks the assets that are returned by the query, and also notifies the CacheManager about these assets, so that they cannot be edited while the publishing session is underway.

• Invokes the appropriate element for the delivery type (Export to Disk or Mirror to Server), passing it the list of assets that should be published.

Then, those assets are either rendered into files or mirrored to a destination database, depending on the delivery type in use.

When the publishing session concludes, the publishing system notifies the approval system of which assets were published and then it updates the page cache.

Note

The CS-Direct publishing system publishes assets that are held in the Content Server database.

If you are storing files directly on your web server or your site designers use links from assets to files that are not assets, you must implement an additional process to move those files to your web server and to update them when necessary.

Page 140: Core Dev Book

Content Server Core Developer I

140

Instructor DemonstrationFollow along as the instructor demonstrates how to create a publishing destination and publish HelloPersonal asset.

Creating a Destination for Dynamic PublishingIn this section, the instructor will demostrate how to create a publishing destination to mirrow an asset to server (dynamic publishing).

Complete the following steps to create a publishing destination:

1. From the Admin tab of the Content Server Direct Interface, expand the Publishing node and then double-click the Dynamic link. The screen that appears in the right side of user interface looks similar to the following image:

2. In the Publish Destination screen, click the Edit button to edit the destination:

a. In the Name field, write HelloAssetWorld Destination.

b. In the Destination address field, write the address of your destination server, the port, and the application server directory.

You can use your neighbor’s server to publish the asset. For this, ask another student to get your the name of his/her machine and construct the destination server in the following manner: http://servername:portnumber/servlet/ContentServer

Page 141: Core Dev Book

Module 5

141

3. In the Arguments field, write the following:

REMOTEUSER=Coco&REMOTEPASS=hello

This user name and password are used to log in and publish an asset on a remote server.

4. From the Sites list, choose Hello Asset World.

5. Click the Save button.

Mirroring an Asset (Dynamic Publishing)In this section, the instructor will demostrate how to dynamically publish a HelloPersonal asset to another machine.

Complete the following steps to approve and publish a HelloPersonal asset to another machine:

1. Search for a HelloPersonal asset and open it in the Inspect form.

2. From the more ... drop-down menu on the top right corner of the Inspect form, select Approve for Publishing. The following screen will show:

3. Check the Dynamic (using Mirror to Server) check box and then click the Approve botton. Content Server will list the depending assets that you have to approve on the next screen.

4. Check all the dependencies and then click the Approve button. Content Server will inform you whether the assets are approved.

5. Click the Publishing button on the Content Server Direct toolbar to publish the asset.

6. From the Publish Console window, from the Publish Destinations, select Dynamic (Mirror to Server) and then click the Select Destination button.

Content Server will inform you how many assets are ready to be published.

7. Click the Publish button, wait, and then go to Publish console to see the status of the publishing process.

Page 142: Core Dev Book

Content Server Core Developer I

142

Content Server will inform you whether the process went successfully or failed for a certain reason.

Creating a Destination for Static PublishingIn this section, the instructor will demostrate how to create a publishing destination to export to disk an asset (static publishing).

Complete the following steps to create a publishing destination:

1. From the Admin tab of the Content Server Direct Interface, expand the Publishing node and then double-click the Dynamic link. The following screen appears in the right side of user interface looks similar to the following:

2. In the Arguments field, write DIR=yourname

This arguement will appernt /yourname to the standard directory where the files are usually stored (usually set in the cs.pgexportfolder property in the futuretense.ini file).

3. From the Sites menu, select Hello Asset World.

4. Click the Save button.

You can now set a default template that publishing process will use for the HelloPersnal assets. Since there is only one template in this site, the setting up of a default template is not as important; however for training purpose, the instructor will demonstrate to you how to do it anyway.

5. In the Admin tab, go to Publishing->Destinations->Static->Set Default Templates.

6. In the screen that appears on the right side of the window, select a default template for the HelloPersnal asset and for any other asset type that you intend to publish.

Page 143: Core Dev Book

Module 5

143

You are now ready to approve the asset for publishing.

Exporting an Asset to Disk (Static Publishing)In this section, the instructor will demonstate how to publish statically a HelloPersonal asset to disk.

Complete the following steps to approve and publish a HelloPersonal asset to another machine:

1. Search for a HelloPersonal asset and open it in the Inspect form.

2. From the more ... drop-down menu on the top right corner of the Inspect form, select Status option to preview and set up a starting point for the asset.

3. At the bottom of the Status screen, in the Publishing Destinations section, next to Static: click the Specify Path/Filename, Start points link. On the next screen, do the following:

a. On the next screen, from the Is this asset an export starting point?, select Yes checkbox.

b. In the Using Templates section, check HelloPersonalTempalate.

c. Leave the Force specified path and Force specified filename unchecked.

d. Click the Save button.

Content Server will take you back to the Status screen from where you can preview an asset with the template it is going to be published with. For this, simply click the Preview this for Static link.

e. If you like what you see in the Preview window, click the Approve this asset link

4. In the Approve for publish to Static of HelloPersonal: HelloPersonal Asset Name window, select and approve all the dependent assets.

Once the asset the all its dependent assets are approves, you can follow the steps in the “Mirroring an Asset (Dynamic Publishing)” section to publish the assets.

If publishing is successful, you will find the *.html files on your local drive. The location of the files is easyto find out. First, look at the cs.pgexportfolder property in the futuretense.ini file. Then, append your DIR argument value set in the “Creating a Destination for Static Publishing” section. You direcory name will be cs.pgexportfolder/DIR.

Page 144: Core Dev Book

Content Server Core Developer I

144

Lesson 5.3: Revision TrackingContent Server provides revision tracking functionality that prevents a row in a table from being edited by more than one user at a time. When you enable revision tracking for a table, Content Server maintains multiple versions of a row in that table.

Content Server provides revision tracking functionality through its revision tracking API. CS-Direct uses this API to provide additional revision tracking functionality for asset type tables.

When you enable revision tracking for an asset type, Content Server creates a new table, called a tracker table, for assets of that type. You specify how many versions you want to keep and you also specify a storage directory that the tracker table uses to store supporting files for the assets that it is tracking.

CS-Direct’s implementation of revision tracking provides the following features:

• Check out and check in.

Check out locks an asset so that only one user can edit it at a time.

Check in releases the lock on the asset, increments the version number, and determines whether the number of versions falls within the configured limit. If the new version exceeds the limit, the oldest version is deleted to make room for the next version.

• Storage of multiple versions of an asset.

When you enable revision tracking for an asset type, Content Server stores versions in a tracker table; upload data is stored in a storage directory (defdir) that you specify. Because past versions are stored (that is, a history exists), a user can roll back an asset to a previous version or examine the differences between two versions of the asset.

• Administrative or maintenance features.

An administrator can delete past versions of an asset or clear the checkout for an asset by overriding the check out on it and checking it back in.

When an asset type is being tracked, CS-Direct provides checkin, checkout, and other revision tracking features on the New and Edit forms for assets of those types.

Implicit vs. Explicit Checkin and CheckoutWhen revision tracking is on for an asset type, Content Server provides both implicit (or automatic) and explicit (or manual) checkout/checkin functionality. When users create or edit assets of a type that is being revision tracked, they do not have to manually check out the asset: it is automatically assigned to them. Then, when they click Save, the asset is checked back in.

This may or may not be the behavior that you want. For example, if an author is making extensive revisions to an asset that was checked out implicitly, each save creates an archived version. Depending on how many revisions the asset type is configured to store, that author might overwrite an older version that he or she really wanted to keep.

When a content provider manually (explicitly) checks out an asset, a version is not stored—no matter how many times he or she saves it—until is is manually checked back in.

Page 145: Core Dev Book

Module 5

145

Revision Tracking and Non-Asset TablesIn addition to using revision tracking for your asset types, you can implement revision tracking on your non-asset tables.

To do so, you use the Content Server Management Tools feature on the Admin tab to enable tracking for the table. Content Server then creates a corresponding tracker table to support the tracked table. It is named the same way as a tracker table for an asset type: nameOfTable_t. For example, if you enabled revision tracking for the Source table, the tracker table would be called Source_t.

When revision tracking is enabled for a non-asset table, you can use either the revision tracking features accessible from the menus in Content Server Explorer to lock (check out) a row and then unlock it (check it back in) when you are finished with it or the Content Server Management Tools.

If you need to provide additional support outside of the Content Server Explorer tool for revision tracking of a non-asset table, your developers can code additional forms, using the Content Server revision tracking API and and revision tracking XML or JSP tags. For information, see the CSEE Developer’s Tag Reference and the CSEE Java API Reference.

How Many Versions?Each revision of an asset or a database row occupies disk space. Therefore, your decision about how many revisions to keep must be based on the following factors:

• The amount of disk space that you have available

• The typical data size of the asset (or row)

• The likelihood that there could be a need for a rollback of several versions

For example, an asset that consists of a small amount of ASCII data occupies so little space that a large number of revisions would take little disk space. However, each version of an asset that holds a large amount of binary data could occupy a significant amount of disk space. In the second case, you must strike the appropriate balance, storing the fewest number of versions necessary for rollback purposes.

Note

If you need to delete a non-asset table from the Content Server database and that table is being revision tracked, be sure to untrack the table before deleting it.

Page 146: Core Dev Book

Content Server Core Developer I

146

Instructor DemonstrationFollow along as the instructor demonstrates how to create a publishing destination and publish HelloPersonal asset.

Enabling Revision TrackingIn this section, the instructor will demostrate how to enable revision tracking for the HelloPersonal asset type.

Complete the following steps to set up revision tracking:

1. From the Admin tab of the Content Server Direct Interface, expand the

Asset Types->HelloPersonal->Revision Tracking node, and then double-click the Track link. The following screen will appear on the site:

2. In the Revisions to Keep text box, indicate how many revisions you would like to have, then click the Enable Revisions Tracking button.

You are now ready to place HelloPersonal assets in the revision tracking system.

Checking Out AssetsTo check out an asset:

1. If the Content Server interface is not already open, log with Flo/hello user name and password.

2. Find and select the asset you want to check out.

3. Open the asset in the Inspect form and click Check Out under the action bar.

If the asset has been checked out by another user, the Content Server interface displays a message indicating that. If your checkout is successful, the Content Server interface displays the message: Checkout Successful, and updates the checkout status.

Page 147: Core Dev Book

Module 5

147

Undoing a Checkout To undo a checkout:

1. If the Content Server interface is not already open, log in.

2. Find and select the asset.

3. Open the asset in the Inspect form and click Undo Checkout under the action bar.

The Content Server interface displays the message: Undo Check Out Successful! The asset is returned to the database without a record of this checkout.

Checking In AssetsTo check in an asset that you have checked out:

1. If the Content Server interface is not already open, log in.

2. Find and select the asset you want to check in.

3. Open the asset in the Inspect form and click Check In under the action bar.

The Content Server interface displays a checkin form.

4. (Optional) In the Comments text box, enter comments or instructions that pertain to the version that you are checking in. Comments are displayed with the asset title when you view the version history.

5. Keep Checked Out (optional) Select this option if you want to back up the asset but need to continue working on it.

6. Click Check In.

A confirmation message appears.

Examining Version HistoryTo examine an asset’s version history:

1. If the Content Server interface is not already open, log in.

2. Find and select the asset whose history you want to examine.

3. Open the asset in the Inspect form and click Show Versions under the action bar.

The Content Server interface displays a Revision History Report for the asset.

You can view any listed version by clicking the appropriate inspect icon in the left column. The Inspect view appears in a separate window.

Reverting to a Previous Version (Rollback)To roll back an asset:

1. If the Content Server interface is not already open, log in.

2. Find and select the asset you want to roll back.

3. Open the asset in the Inspect form and click Rollback under the action bar.

The Content Server interface displays a list of the asset’s versions.

Page 148: Core Dev Book

Content Server Core Developer I

148

4. Select the option in the Rollback column next to the version of the asset that you want to return to.

5. Click Rollback.

A confirmation message appears. Note that rolling back an asset creates another version.

Releasing Locked AssetsBecause automatic checkout is in effect when revision tracking is enabled, you might accidentally check out an asset while you work in the Content Server interface. If so, that asset is locked and no one else can work with it. To make sure that you are not stopping other people from working with assets that you inadvertently checked out, review the assets checked out to you and check in any assets that you do not need.

To release locked assets:

1. If the Content Server interface is not already open, log in.

2. Click the Show My Checkouts icon on the icon bar.

The system displays a list of all the assets that are currently checked out to you.

3. For any asset that should not be checked out to you, select it and check it back in. See “Checking In Assets” for help with this step.

Page 149: Core Dev Book

Module 5

149

Module Summary• The end goal for any asset is for it to be published. Before an asset can be published, it

must be approved for publishing.

• Because there are so many configuration possibilities, it is typical to create a separate workflow process for each asset type that you plan to use workflow with rather than attempt to create one process for more than one asset type.

• When an individual asset is going through that workflow process, only the users who have the appropriate role are allowed to complete the task.

• Before configuring a workflow process that can result in a deadlock, be sure that it is absolutely necessary to have complete agreement on all the possible steps from the state.

• If you want to restrict who has access to an asset while it is in workflow, use the workflow feature called function privileges. These are restrictions set on functions such as edit, copy, approve, delete, show versions, and so on in the context of workflow states and workflow roles.

• The term “delivery type” means the publishing method. There are three delivery types and they use either the Export API or the Mirror API. Which delivery type you use for your CSEE system depends on how you plan to deliver the content on your delivery system (statically or dynamically) or whether you are delivering your content to some other non-CSEE system: Export to Disk, Mirror to Server, and Export Assets to XML.

• A publishing destination is either the Content Server database that you are mirroring to or the directory that you are exporting to.

• The approval system provides a feature called Approve Multiple Assets and publishing scheduling.

• When you enable revision tracking for a table, Content Server maintains multiple versions of a row in that table.

• When revision tracking is on for an asset type, Content Server provides both implicit (or automatic) and explicit (or manual) checkout/checkin functionality. When users create or edit assets of a type that is being revision tracked, they do not have to manually check out the asset: it is automatically assigned to them. Then, when they click Save, the asset is checked back in.

Page 150: Core Dev Book

Content Server Core Developer I

150