Information Technology Reference
In-Depth Information
commentControl.php:
...
$title = $_POST['title'];
$body = $_POST['body'];
$inventoryID = $_POST['inventoryID'];
$userID =$_POST['userID'];
$commentControl = new commentControl();
$commentControl->setComment($title, $body, $userID,
$inventoryID);
$tree->perform("addComment");
header("Location:http://
".$_SERVER['HTTP_HOST'].$clientRoot."productControl/
viewDetailProductInfo.php?inventoryID=$inventoryID");
...
viewDetailedProductInfo.php:
...
<?php if($tree->canBePerformed("addComment"))
{ ?>
<p> <font size='5' color='blue'> Writting comment </font></p>
<form method='POST' action='commentControl.php'>
<b> Title </b><br> <input type='text' name='title'><br><br>
<b>Body</b><br> <textarea rows="10" cols="30" name='body'>
</textarea>
...
<input type='submit' name='submitComment' value='Submit'>
<input type='reset' name='reset' value='Clear'>
...
<?php } ?>
...
viewCart.php:
...
<?php
if( $tree->canBePerformed("reviewOrder")
)
&& ($CartControl->getNumOfItem()>0){?>
<form action="CartControl.php"
method="POST"><p>
<input type='submit' value='Checkout'
name='continue'/></p>
<?php } ?>
...
Fig. 5. Conditioning and Instrumenting Code
will not be accessed, preventing rendering of the user interface elements, which in turn
prevents performance of the task by the user.
Advancement of the position of the state pointer, on the other hand, is implemented
through simple perform(t) statements inserted in the instrumentation points, where t is
the task that was just performed. The effect of the perform(t) statement is that the state
pointer advances to the child labeled with t or stays where it is if t is part of the path
from the root to the state pointer.
In Figure 5, examples of conditioning and instrumentation are shown for our PHP-
based on-line cart system. The upper right frame shows how displaying the widgets for
performing the task Add Comment is conditional to canBePerformed(addComment) be-
ing true. Once the user presses the submit button, a different file (commentControl.php)
arranges to insert the comment to the database and, among other workings, a call to per-
form(addComment) is made (seen in upper left frame), so that the policy tree advances
to the corresponding node. In the lower right frame, how customization conditions are
mixed with run-time conditions is illustrated. Thus, the “Checkout” button is visible if
“Checkout” is allowed by the current customization policy and the cart is non-empty,
which is something irrelevant of policy tree. It is important to notice, therefore, that
the policy tree is not used to completely arrange the details of the control flow of the
application but to only enforce more abstract customization decisions that have been
made at the requirements level. Note also that use of the policy tree is not restricted to
the functions discussed above. For example the function hasBeenPerformed(t) ,which
returns true iff task t is part of the associated prefix of the node currently pointed,
proved in our application to be helpful in handling large numbers of task permutation
possibilities.
 
Search WWH ::




Custom Search