');
$oP->add('| ');
- if (isset($aEditFields[PORTAL_ATTCODE_LOG]))
+ if (isset($aEditFields[$sLogAttCode]))
{
$oP->add(" ");
- $oP->add(' '.$aEditFields[PORTAL_ATTCODE_LOG]['label'].'');
- $oP->add($aEditFields[PORTAL_ATTCODE_LOG]['value']);
+ $oP->add(''.$aEditFields[$sLogAttCode]['label'].'');
+ $oP->add($aEditFields[$sLogAttCode]['value']);
$oP->add('');
}
else
{
- $oP->add(''.MetaModel::GetLabel($sClass, PORTAL_ATTCODE_LOG).'');
- $oP->add($oObj->GetAsHTML(PORTAL_ATTCODE_LOG));
+ $oP->add(''.MetaModel::GetLabel($sClass, $sLogAttCode).'');
+ $oP->add($oObj->GetAsHTML($sLogAttCode));
}
$oP->add(' | ');
$oP->add('
');
@@ -1031,7 +1188,9 @@ try
ApplicationContext::SetUrlMakerClass('MyPortalURLMaker');
- if (!class_exists('UserRequest'))
+ $aClasses = explode(',', MetaModel::GetConfig()->Get('portal_tickets'));
+ $sMainClass = trim(reset($aClasses));
+ if (!class_exists($sMainClass))
{
$oP = new WebPage(Dict::S('Portal:Title'));
$oP->p(dict::Format('Portal:NoRequestMgmt', UserRights::GetUserFriendlyName()));
@@ -1074,7 +1233,7 @@ try
case 'details':
$oP->set_title(Dict::S('Portal:TitleDetailsFor_Request'));
DisplayMainMenu($oP);
- $oObj = $oP->FindObjectFromArgs(array('UserRequest'));
+ $oObj = $oP->FindObjectFromArgs(GetTicketClasses());
DisplayObject($oP, $oObj, $oUserOrg);
break;
@@ -1083,16 +1242,12 @@ try
DisplayMainMenu($oP);
if (!MetaModel::DBIsReadOnly())
{
- $oObj = $oP->FindObjectFromArgs(array('UserRequest'));
- switch(get_class($oObj))
- {
- case 'UserRequest':
- $aAttList = array(PORTAL_ATTCODE_LOG, 'user_satisfaction', PORTAL_ATTCODE_COMMENT);
- break;
-
- default:
- throw new Exception("Implementation issue: unexpected class '".get_class($oObj)."'");
- }
+ $oObj = $oP->FindObjectFromArgs(GetTicketClasses());
+ $aAttList = array(
+ GetConstant(get_class($oObj), 'PUBLIC_LOG'),
+ 'user_satisfaction',
+ GetConstant(get_class($oObj), 'USER_COMMENT')
+ );
try
{
$oP->DoUpdateObjectFromPostedForm($oObj, $aAttList);
diff --git a/portal/readme.txt b/portal/readme.txt
new file mode 100644
index 000000000..08108fe6b
--- /dev/null
+++ b/portal/readme.txt
@@ -0,0 +1,69 @@
+
+--- Customization of the portal
+
+This is the way it is working now and is highly subject to change...
+
+
+Configuration (itop-config.php)
+===============================
+portal_tickets: CSV value to specify which ticket classes are enabled (default to 'UserRequest')
+
+
+Common constants (XML)
+======================
+PORTAL_POWER_USER_PROFILE: Name of the profile that determines who can see the ticket of her organization (not only the tickets she is caller for)
+PORTAL_SERVICECATEGORY_QUERY: OQL to list the services (parameters available: org_id)
+PORTAL_SERVICE_SUBCATEGORY_QUERY: OQL to list the service subcategories (parameters available: org_id, svc_id)
+PORTAL_VALIDATE_SERVICECATEGORY_QUERY: OQL to check the service again (security against malicious HTTP POSTs)
+PORTAL_VALIDATE_SERVICESUBCATEGORY_QUERY: OQL to check the service again (security against malicious HTTP POSTs)
+PORTAL_ALL_PARAMS: parameters that the wizard will kindly propagate through its pages (mixing should not be a problem, default value could be cleaned a little...)
+PORTAL_SET_TYPE_FROM: attribute of the class ServiceSubcategory determining the request type
+PORTAL_TYPE_TO_CLASS: optional mapping from the request types to ticket classes
+PORTAL_TICKETS_SEARCH_CRITERIA: list of search criteria for closed tickets
+
+
+Caution: Hardcoded stuff
+========================
+Classes Service and ServiceSubcategory
+A user can update a ticket (new/assigned)
+A user can close a ticket (resolved) (user_satisfaction is hardcoded though user_comment is not)
+
+
+Constants depending on the class of ticket
+==========================================
+For each ticket class enabled, you will have to define these constants:
+
+PORTAL_