Administrator Recipe: New Journal


The New Journal page lets the user define the basic informationjournal name, owner, and descriptionas well as the archive period for each journal created. As noted in the chapter introduction, an archive is a time-based organizational tool. When a specific archive period is chosen from the list element, either daily, weekly, or monthly, a corresponding value (1, 2, and 3, respectively) is entered in the data source. These same values are used later in the other pages of this recipe, including the archive page.

Step 1: Implement New Journal Design

The New Journal layout follows a standard form pattern, with labels on the left and form elements on the right. Text fields are needed to enter the name and owner information, while a text area is used to hold the description. A drop-down list provides the archive options.

1.

In the server model of your choice, create a dynamic page.

In the Journal folder, locate the folder for your server model and open the new_journal page from there.

2.

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

From the Snippets panel, drag the Recipes > Journal > Wireframes > New Journal - Wireframe snippet into the Content editable region.

3.

Insert the form and, within it, a two-column table. The table should include form elements and labels for a journal name, the owner, a description, and an archive list. You'll also need a form button for inserting the new record.

Place your cursor in the row below the words NEW JOURNAL and insert the Recipes > Journal > Forms > New Journal - Form snippet.

4.

Save the file [r6-4].

r6-4.


Step 2: Insert RecordNew Journal

To store the newly entered values, the Insert Record server behavior is used. Although most of the settings in the dialog are fairly standard, you'll want to be sure to set the archive value type as numeric rather than text.

For ASP

1.

From the Server Behaviors panel, choose Add (+) and select Insert Record from the list.

2.

In the Insert Record dialog, choose your data source.

Choose Recipes from the Connection list.

3.

Select the table you want to insert the record into.

From the Insert Into Table list, choose Journals.

4.

Set the page you want to appear after the record is inserted.

Choose the manage_journals.asp file from your server model's folder for the After Inserting, Go To field.

5.

Select the form on the current page from which to gather the record values.

In the Get Values From list, make sure NewJournal is selected.

6.

In the Form Elements area, match the form elements on the page to the fields in the data source table.

Set JournalName to insert into the JournalTitle column as Text type.

 

Set JournalOwner to insert into the JournalOwner column as Text type.

 

Set JournalDescription to insert into the JournalDescription column as Text type.

 

Set Archive to insert into the JournalArchive column as Numeric type.


7.

When you're sure your choices are correct, click OK to close the dialog and add the behavior.

For ColdFusion and PHP

1.

From the Server Behaviors panel, choose Add (+) and select Insert Record.

2.

In the Insert Record dialog, choose the current form.

Select NewJournal from the Submit Values From list.

3.

Select your data source from the list.

Choose Recipes from the Data Source list.

4.

Enter your user name and password, if needed.

5.

From the list, select the table in the data source into which to insert.

Choose Journals (journals for PHP) from the Insert Into Table list.

6.

Set the data source fields to their corresponding form elements.

Make sure the JournalID data column is set to be an unused Primary Key.

 

Set JournalTitle to the FORM.JournalName form element and submit as Text type.

 

Set JournalOwner to the FORM.JournalOwner form element and submit as Text type.

 

Set JournalDescription to the FORM.JournalDescription form element and submit as Text type.

 

Set JournalArchive to the FORM.Archive form element and submit as Numeric type for ColdFusion and Integer for PHP.

 

Make sure JournalDate is set not to get a value.


7.

In the After Inserting, Go To field, enter manage_journals.cfm or manage_journals.php as appropriate and click OK to close the dialog.

8.

Save your page.

This relatively simple page is now complete. Test the first two pages together by creating a temporary journal with this page and then deleting it through the Manage Journal page.




Macromedia Dreamweaver 8 Recipes
Macromedia Dreamweaver 8 Recipes
ISBN: 0321393910
EAN: 2147483647
Year: 2003
Pages: 121

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