End User Recipe: Meeting Details

If a meeting request is successful and no conflicting meetings are found, a confirmation page is displayed. The meeting_details page is almost identical to the meeting_conflict page even down to the recordset with two important differences. First, on the meeting_details page, there is no error message to inform the user of a problem, and second, a link is provided so that the record details can be edited.

This page is also available through the search meetings application discussed later in this recipe.

Note

For the sake of completeness, all the steps for creating the meeting_details page are presented here. However, you could save a fair amount of work by opening the meeting_conflict page and saving it as meeting_details. Then, all you would need to do is change the text on the page from Meeting Conflict to Meeting Detail, remove the error message, and add the link to the edit_meetingrequest page.


Step 1: Implement Meeting Details Design

The meeting_details page uses only a series of dynamic text elements and a link to an edit page.

  1. Create a basic dynamic page, either by hand or derived from a template.

    graphics/book.gif In the ConferenceRoomScheduler folder, locate the folder for your server model and open the meeting_details page found there.

  2. Add a table to the content region of your page to contain the interface elements for the application.

    graphics/book.gif From the Snippets panel, drag the Recipes > ConferenceRoom > Wireframes > Meeting Details - Wireframe snippet into the Content editable region.

  3. Add the table area to hold the dynamic text for the record details and a link to a page for modifying the record.

    graphics/book.gif Place your cursor in the row below the words MEETING DETAILS and insert the Recipes > ConferenceRoom > ContentTables > Meeting Details - Content Table snippet [r3-7].


    Figure r3-7.

    graphics/05fig07.jpg


  4. Be sure to save the file before proceeding.

Step 2: Add Database Components

As with the meeting_conflict page, only one data source is required for this page. In fact, it's the same recordset based on the same view and filtered in the same way. Accordingly, the setup is different for the various server models.

For ASP and ColdFusion
  1. From the Bindings panel, choose Add (+) and select Recordset (Query).

  2. In the simple Recordset dialog, enter an appropriate name.

    graphics/book.gif Enter Conferences in the Name field.

  3. Select the desired data source connection.

    graphics/book.gif Choose Recipes from the Connection (Data Source) list.

  4. Choose the needed view.

    graphics/book.gif From the Tables list, select ConferenceDisplay.

  5. Leaving the Columns option set to All, set the four Filter list elements like this:

    graphics/218fig01.gif

    Note

    If you've already created the meeting_conflict page and want to save yourself some work, you can copy the existing recordset and use it on this page. To do this, open the meeting_conflict page and, from the Bindings panel, select the Conferences recordset. Then choose Copy from the panel options menu. Next, switch to the meeting_details page and, again in the Bindings panel, choose Paste from the panel options menu. The Conferences recordset should appear, and you're ready to move on to the next step.

  6. Keep the Sort option set to None and click OK to close the dialog.

For PHP

Again, PHP users have two obstacles to overcome when defining this recordset: the lack of views in MySQL and the date formatting incompatibilities with the Dreamweaver server model implementation. As with the previous recipe, a temporary recordset is first created to allow placement of the data fields. After that step is accomplished, the proper code is inserted.

graphics/book.gif

To prepare for this step, right-click (Control-click) on the Recipes > ConferenceRoom > SQL > Meeting Conflict - Fake PHP SQL Statement snippet and select the Copy Snippet command.


  1. From the Bindings panel, choose Add (+) and select Recordset (Query) from the list.

  2. In the advanced Recordset dialog, enter an appropriate name for the recordset.

    graphics/book.gif Enter Conferences in the Recordset field.

  3. Choose the desired data source.

    graphics/book.gif Select Recipes from the Connections list.

  4. Enter the proper SQL statement:

    graphics/book.gif In the SQL area, press Ctrl-V (Command-V) to paste the code copied from the snippet.

    graphics/php.gif

     SELECT conferences.ConferenceID, rooms.RoomName, rooms.RoomID, rooms.RoomDescription, conferences.ConferenceName,  conferences.ConferenceDescription, conferences.ConferenceStart, conferences.ConferenceDuration, conferences.ConferenceBy, conferences.ConferenceStart AS StartTime, conferences.ConferenceStart AS StartDate, conferences.ConferenceDuration AS ConferenceEnd FROM conferences, rooms WHERE conferences.ConferenceRoom = rooms.RoomID AND conferences.ConferenceID = 'IDParam' 

  5. In the Variables section, choose Add (+) and enter the following details in the Add Parameter dialog:

    graphics/219fig01.gif

  6. Click OK to close the dialog and insert the recordset.

  7. Save your page.

Step 3: Data Binding Process

With the recordset defined, you're ready to incorporate the seven dynamic text elements.

  1. From the Bindings panel, expand the Conferences recordset.

  2. Place the data source fields onto the page in their respective areas:

    graphics/book.gif Drag ConferenceName to the cell next to the Meeting Name label.

    Drag ConferenceBy to the cell next to the Meeting Owner label.

    Drag ConferenceDescription to the cell next to the Meeting Description label.

    Drag StartDate to the cell next to the Meeting Date label.

    Drag StartTime to the cell next to the Start Time label.

    Drag ConferenceDuration to the cell next to the Duration label.

    Drag Room Name to the cell next to the Conference Room label.

  3. Save your page.

As noted, PHP users have another task to complete before they can move on: the substitution of the temporary code with the actual code for the Conferences recordset.

  1. From the Server Behaviors panel, select the Conferences recordset.

  2. In Code view, select and cut the unneeded section of the recordset:

     
     $query_Conferences = sprintf("SELECT conferences.ConferenceID, rooms.RoomName, rooms.RoomID, rooms.RoomDescription, conferences.ConferenceName, conferences.ConferenceDescription, conferences.ConferenceStart,  conferences.ConferenceDuration, conferences.ConferenceBy, conferences.ConferenceStart AS StartTime, conferences.ConferenceStart AS StartDate, conferences.ConferenceDuration AS ConferenceEnd FROM conferences, rooms WHERE conferences.ConferenceRoom = rooms.RoomID AND conferences.ConferenceID = '%s'", $IDParam_Conferences); 
     

    Although the code is quite long, if you have Automatic wrapping turned off in Preferences, it will appear as a single line.

  3. Insert the replacement code:

    graphics/book.gif From the Snippets panel, insert the Recipes > ConferenceRoom > SQL > Meeting Conflict - Real PHP SQL Statement snippet.

     
     $query_Conferences = "SELECT conferences.ConferenceID, rooms.RoomName, rooms.RoomID, rooms.RoomDescription, conferences.ConferenceName, conferences.ConferenceDescription, conferences.ConferenceStart, TIME_FORMAT(conferences.ConferenceDuration,'%k:%i') AS ConferenceDuration, conferences.ConferenceBy, DATE_FORMAT(conferences.ConferenceStart,'%k:%i %p') AS StartTime, DATE_FORMAT(conferences.ConferenceStart,'%c/%d/%Y') AS StartDate, (INTERVAL HOUR(conferences.ConferenceDuration) HOUR + INTERVAL MINUTE(conferences.ConferenceDuration) MINUTE + conferences.ConferenceStart) AS ConferenceEnd FROM conferences, rooms WHERE conferences.ConferenceRoom = rooms.RoomID AND conferences.ConferenceID = " . $IDParam_Conferences; 
     
  4. Save your page.

PHP developers will notice some out-of-the-norm Dreamweaver behavior at this point: The Conferences recordset will no longer be available from the Bindings panel. This is the unfortunate side effect of replacing the code which was necessary to get the desired functionality. The current PHP server model implementation uses the sprintf() function to insert values into strings, and the %s pointers that mark the variable values clash with MySQL formatting techniques.

We're now ready for the next step: linking to a record edit page.

Step 4: Link to Update Meeting

The final step for the meeting_detail page is to provide a way for users to change the details if they see a problem. To accomplish this, we link to an update page and pass the ID number as a URL argument.

Note

PHP developers will need to code the parameter link by hand, as the Dynamic Data dialog is not available to them at this stage.


For ASP and ColdFusion
  1. Select the text or image you want to use as a link.

    graphics/book.gif Select the text update meeting in the top row of the content table.

  2. From the Property inspector, choose Browse for File, the folder icon next to the Link field.

  3. In the Select File dialog, choose the file you want to handle the update.

    graphics/book.gif Choose edit_meetingrequest.

  4. Select Parameters from the Select File dialog.

  5. In the Parameters dialog, enter ID under the Value column.

  6. Under the Value column, select the lightning symbol to open the Dynamic Data dialog and choose ConferenceID [r3-8].


    Figure r3-8.

    graphics/05fig08.gif


    Note

    If you're a Windows user who has files set to open with one click, selecting a file automatically accepts your choice and closes the dialog you'll need to open it again for the next step.

  7. Click OK to close the Dynamic Data, Parameters, and Select File dialogs.

  8. Save the page.

The meeting_details page is now ready for testing. To test this page, request a new meeting that does not conflict with an existing one. After the meeting request is added to the data source, this page the meeting details is presented.

For PHP

Instead of using the Dynamic Data dialog to assign parameters to the link to the meeting_details page, we'll need to hand-code it for PHP.

  1. Select the text or image you want to use as a link.

    graphics/php.gif Select the text update meeting in the top row of the content table.

  2. From the Property inspector, enter the following code in the Link field:

    graphics/php.gif

    [View full width]

     edit_meetingrequest.php?ID=<?php echo graphics/ccc.gif $row_Conferences['ConferenceID']; ?> 

  3. Save your page.



Macromedia Dreamweaver MX 2004 Web Application Recipes
Macromedia Dreamweaver MX 2004 Web Application Recipes
ISBN: 0735713200
EAN: 2147483647
Year: 2003
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net