siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > "; // #3425 for consistency if ($bDisplayActions) { $sDocumentPath .= "" . $oDocument->getFileName() . ""; } else { $sDocumentPath .= $oDocument->getFileName(); } return "" . ($bDisplayActions ? "" : "") . "
" . $sDocumentPath . "Actions
\n"; } function renderDocumentData($oDocument, $bEditable, $sStatusMessage = "") { global $default; $sQuery = "SELECT D.name, D.modified, DTT.datetime AS created, U.name AS initiator, CONCAT(CONCAT(D.major_version, '.'), D.minor_version) AS version, WDSL.name AS status, DTL.name AS document_type, D.is_checked_out, COALESCE(U2.name, '') AS c_user " . "FROM $default->documents_table AS D INNER JOIN $default->web_documents_table AS WD ON WD.document_id = D.ID " . "INNER JOIN $default->web_documents_status_table AS WDSL ON WD.status_id = WDSL.id " . "INNER JOIN $default->users_table AS U ON U.id = D.creator_id " . "INNER JOIN $default->document_transactions_table AS DTT ON DTT.document_id = D.id " . "INNER JOIN $default->transaction_types_table AS TT ON DTT.transaction_id = TT.id " . "INNER JOIN $default->document_types_table AS DTL ON DTL.id = D.document_type_id " . "LEFT OUTER JOIN $default->users_table AS U2 ON U2.id = D.checked_out_user_id " . "WHERE D.id = " . $oDocument->getID() . " " . "AND TT.name LIKE 'Create'"; $aColumns = array("name", "modified", "created", "initiator", "document_type", "version", "status", "c_user"); $aColumnNames = array("Document title", "Last updated", "Created", "Document initiator", "Document Type", "Version", "Status", "Checked out by"); $aColumnTypes = array(1,1,1,1,1,1,1,1); $oPatternListFromQuery = & new PatternListFromQuery($sQuery, $aColumns, $aColumnNames, $aColumnTypes); $oPatternListFromQuery->setTableHeading("Document Data"); $oPatternListFromQuery->setEmptyTableMessage("No Document Data"); $oPatternListFromQuery->setTableWidth("400"); $sToRender .= "\t\n"; if ($sStatusMessage) { $sToRender .= ""; } $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\n"; if ($bEditable) { $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= "\t\n"; } $sToRender .= "\t
 
$sStatusMessage
" . $oPatternListFromQuery->render() . "
rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/edit.gif\" border=\"0\">
\n"; return $sToRender; } function renderGenericMetaData($oDocument, $bEditable) { global $default; $sQuery = "SELECT DF.name AS name, DFL.value as value " . "FROM $default->documents_table AS D INNER JOIN $default->document_fields_link_table AS DFL ON D.id = DFL.document_id " . "INNER JOIN $default->document_fields_table AS DF ON DF.id = DFL.document_field_id " . "WHERE document_id = " . $oDocument->getID() . " " . "AND DF.is_generic = 1"; $aColumns = array("name", "value"); $aColumnHeaders = array("Tag", "Value"); $aColumnTypes = array(1,1); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500"); $oPatternTableSqlQuery->setTableHeading("Generic Meta Data"); $oPatternTableSqlQuery->setEmptyTableMessage("No Generic Meta Data"); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\n"; if ($bEditable) { $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= "\t\n"; } $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
rootUrl/control.php?action=modifyDocumentGenericMetaData&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/edit.gif\" border=\"0\">
\n"; return $sToRender; } function renderTypeSpecificMetaData($oDocument, $bEditable) { global $default; $sQuery = "SELECT DF.name AS name, DFL.value AS value " . "FROM $default->documents_table AS D INNER JOIN document_fields_link AS DFL ON D.id = DFL.document_id " . "INNER JOIN $default->document_fields_table AS DF ON DF.ID = DFL.document_field_id " . "WHERE D.id = " . $oDocument->getID() . " " . "AND DF.name NOT LIKE 'Author' " . "AND DF.name NOT LIKE 'Category' " . "AND DF.is_generic = 0"; $aColumns = array("name", "value"); $aColumnHeaders = array("Tag", "Value"); $aColumnTypes = array(1,1); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500"); $oPatternTableSqlQuery->setTableHeading("Type Specific Meta Data"); $oPatternTableSqlQuery->setEmptyTableMessage("No Type Specific Meta Data"); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\n"; if ($bEditable) { $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= "\t\n"; } $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
rootUrl/control.php?action=modifyDocumentTypeMetaData&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/edit.gif\" border=\"0\">
\n"; return $sToRender; } function renderDocumentArchiveSettingsDetails($oDocument, $bEditable) { global $default; // retrieve the appropriate settings given the document id $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); if ($oDocumentArchiving) { // retrieve the settings $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); // switch on archiving type $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); $oTimePeriod = TimePeriod::get($oArchiveSettings->getTimePeriodID()); $sDisplayText = ""; switch ($sArchivingType) { case "Date" : $sDisplayText .= "Expiration Date: " . $oArchiveSettings->getExpirationDate(); if ($oTimePeriod) { $sDisplayText .= "
Expires after " . $oTimePeriod->getUnits() . " "; $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()) . " from document creation date"; } break; case "Utilisation" : $sDisplayText .= "Archive document " . $oTimePeriod->getUnits() . " "; $sDisplayText .= lookupName($default->time_unit_lookup_table, $oTimePeriod->getTimeUnitID()); $sDisplayText .= " after the last " . lookupName($default->transaction_types_table, $oArchiveSettings->getDocumentTransactionID()) . " transaction"; break; } $sDisplayText .= "" . ($bEditable ? "" . generateControllerLink("modifyDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "Edit") . "" : ""); $sArchivingType = "Archiving Type: " . $sArchivingType; } else { $sArchivingType = ""; $sDisplayText = "No archiving settings"; } $sToRender = ""; $sToRender .= ""; $sToRender .= ""; $sToRender .= ""; $sToRender .= $sDisplayText; $sToRender .= ""; $sToRender .= "
Archiving Settings
" . $sArchivingType . "
"; return $sToRender; } function renderDocumentArchiveSettings($oDocument, $bEditable) { global $default; $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; if ($bEditable) { $sToRender .= "\t\n"; // if there are no archiving settings then allow their addition $oDocumentArchiving = DocumentArchiving::getFromDocumentID($oDocument->getID()); $sToRender .= "\t\t\n"; $sToRender .= "\t"; } $sToRender .= "\t
" . renderDocumentArchiveSettingsDetails($oDocument, $bEditable) . "
" . ($oDocumentArchiving ? "" : generateControllerLink("addDocumentArchiveSettings", "fDocumentID=" . $oDocument->getID(), "graphicsUrl/widgets/add.gif\" border=\"0\"/>")) . "
\n"; return $sToRender; } function renderEditableDocumentRouting($oDocument) { global $default; $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.name, U2.name) AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done, 'Edit User' as edit " . "FROM $default->documents_table AS D INNER JOIN $default->groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . "INNER JOIN $default->roles_table AS R ON GFAL.role_id = R.id " . "LEFT OUTER JOIN $default->folders_user_roles_table AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . "LEFT OUTER JOIN $default->users_table AS U ON FURL.user_id = U.id " . "LEFT OUTER JOIN $default->users_table AS U2 ON GFAL.user_id = U2.id " . "WHERE D.id = " . $oDocument->getID() . " " . "ORDER BY GFAL.precedence, role_name ASC"; $aColumns = array("role_name", "name", "precedence", "active", "done", "edit"); $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done", ""); $aColumnTypes = array(1,1,1,2,2,3); $aDBColumnArray = array("id","document_id","active","done"); $aQueryStringVariableNames = array("fFolderCollaborationID", "fDocumentID","fIsActive","fIsDone"); $aLinkURLs = array(5=>"$default->rootUrl/control.php?action=modifyDocumentRouting"); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs,$aDBColumnArray,$aQueryStringVariableNames); $oPatternTableSqlQuery->setTableHeading("Document Routing"); $oPatternTableSqlQuery->setDisplayColumnHeadings(true); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; // display the begin collaboration button if: // collaboration cannot be started or approved/rejected unless the document is not checked out // the document has collaboration // collaboration hasn't started // the current user created the document, or is a system adminstrator if (!$oDocument->getIsCheckedOut() && $oDocument->hasCollaboration() && (!DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) && ( ($_SESSION["userID"] == $oDocument->getCreatorID()) || Permission::userIsSystemAdministrator() ) ) { //if not all collaboration steps have been set, then you cannot start the collaboration process //only the creator of the document can start the collaboration process $sToRender .= "\t\t\n"; // else if collboration has started and the current user has been assigned this step, display the approve/reject buttons } else if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) { //if the current user is responsible for an active step in the collaboration process $sToRender .= "\t\t\n"; } $sToRender .= "\t"; $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
graphicsUrl/widgets/begin.gif\" border=\"0\"/>"; $sToRender .= "\n"; $sToRender .= "\t\t\n"; // collaboration cannot be started or approved/rejected if the document is checked out if (!$oDocument->getIsCheckedOut()) { $sToRender .= "\t\t\n"; $sToRender .= "\t\t\n"; } $sToRender .= "\t\t
You currently have an active role
in the collaboration process
graphicsUrl/widgets/approve.gif\" border=\"0\"/>rootUrl/control.php?action=collaborationStepReject&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/reject.gif\" border=\"0\"/>
\n"; return $sToRender; } function renderNonEditableDocumentRouting($oDocument) { global $default; $sQuery = "SELECT D.id as document_id, GFAL.id as id, R.name AS role_name, COALESCE(U.Name, 'Not assigned') AS name, GFAL.precedence AS precedence, COALESCE(FURL.active,0) AS active, COALESCE(FURL.done, 0) AS done " . "FROM $default->documents_table AS D INNER JOIN $default->groups_folders_approval_table AS GFAL ON D.folder_id = GFAL.folder_id " . "INNER JOIN $default->roles_table AS R ON GFAL.role_id = R.id " . "LEFT OUTER JOIN $default->folders_user_roles_table AS FURL ON FURL.group_folder_approval_id = GFAL.id AND FURL.document_id = D.id " . "LEFT OUTER JOIN $default->users_table AS U ON FURL.user_id = U.id " . "WHERE D.id = " . $oDocument->getID() . " " . "ORDER BY GFAL.precedence, role_name ASC"; $aColumns = array("role_name", "name", "precedence", "active", "done"); $aColumnHeaders = array("Role", "User", "Seq", "Active", "Done"); $aColumnTypes = array(1,1,1,2,2); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", "$default->rootUrl/control.php?action=modifyDocumentRouting",$aDBColumnArray,$aQueryStringVariableNames); $oPatternTableSqlQuery->setTableHeading("Document Routing"); $oPatternTableSqlQuery->setDisplayColumnHeadings(true); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; if (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($oDocument->getID())) { //if the current user is responsible for an active step in the collaboration process $sToRender .= "\t\t\n"; } $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\t
You currently have an active role
in the collaboration process
graphicsUrl/widgets/approve.gif\" border=\"0\"/>rootUrl/control.php?action=collaborationStepReject&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/reject.gif\" border=\"0\"/>
\n"; return $sToRender; } function renderEditableLinkedDocuments($oDocument) { global $default; $sQuery = "SELECT D.id AS child_document_id, D.name, DL.id as document_link_id, DL.parent_document_id AS parent_document_id, 'Unlink' AS unlink " . "FROM $default->documents_table AS D INNER JOIN $default->document_link_table AS DL ON D.id = DL.child_document_id " . "WHERE DL.parent_document_id = " . $oDocument->getID(); $aColumns = array("name", "unlink"); $aColumnHeaders = array("Document"); $aColumnTypes = array(3,3); $aDBColumnArray = array("parent_document_id", "child_document_id","document_link_id", "child_document_id"); $aQueryStringVariableNames = array("fParentDocumentID","fChildDocumentID", "fDocumentLinkID", "fDocumentID"); $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument", 1=>"$default->rootUrl/control.php?action=removeDocumentLink"); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); $oPatternTableSqlQuery->setTableHeading("Linked documents"); $oPatternTableSqlQuery->setDisplayColumnHeadings(true); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= "\t"; $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
rootUrl/control.php?action=addDocumentLink&fDocumentID=" . $oDocument->getID() ."\">graphicsUrl/widgets/add.gif\" border=\"0\"/>
\n"; return $sToRender; } function renderNonEditableLinkedDocuments($oDocument) { global $default; $sQuery = "SELECT D.id, D.name " . "FROM $default->documents_table AS D INNER JOIN $default->document_link_table AS DL ON D.id = DL.child_document_id " . "WHERE DL.parent_document_id = " . $oDocument->getID(); $aColumns = array("name"); $aColumnHeaders = array("Document"); $aColumnTypes = array(3); $aDBColumnArray = array("id"); $aQueryStringVariableNames = array("fDocumentID"); $aLinkURLs = array(0=>"$default->rootUrl/control.php?action=viewDocument"); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); $oPatternTableSqlQuery->setTableHeading("Linked documents"); $oPatternTableSqlQuery->setDisplayColumnHeadings(true); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
\n"; return $sToRender; } function renderDependantDocuments($oDocument, $bEdit) { global $default; // FIXME: only allow escalation if you have write access and are the same user that requested the // dependant document? $sQuery = "SELECT DDI.id AS instance_id, DDI.document_title, U.name AS user_name, 'Escalate' AS escalate " . "FROM $default->dependant_document_instance_table DDI " . "INNER JOIN $default->users_table AS U ON DDI.user_id = U.id " . "WHERE DDI.parent_document_id = " . $oDocument->getID(); $aColumns = array("document_title", "user_name", "escalate"); $aColumnHeaders = array("Document Title", "User"); $aColumnTypes = array(1,1,3); $aDBColumnArray = array("instance_id"); $aQueryStringVariableNames = array("fInstanceID"); $aLinkURLs = array(2=>generateControllerUrl("escalateDependantDocument")); $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "500", $aLinkURLs, $aDBColumnArray, $aQueryStringVariableNames); $oPatternTableSqlQuery->setTableHeading("Dependant documents"); $oPatternTableSqlQuery->setDisplayColumnHeadings(true); $sToRender .= "\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= "\t"; $sToRender .= "\t
" . $oPatternTableSqlQuery->render() . "
rootUrl/control.php?action=createDependantDocument&fDocumentID=" . $oDocument->getID() ."\">graphicsUrl/widgets/add.gif\" border=\"0\"/>
\n"; return $sToRender; } function displayButton($sAction, $sQueryString, $sImageName, $sDisabledText = "") { global $default; // the active is active if there is no disabled text $bActive = !strlen($sDisabledText) > 0; $sImage = "graphicsUrl/widgets/docactions/"; if ($bActive) { $sImage .= "$sImageName.gif\""; } else { $sImage .= "disabled-$sImageName.gif\" title=\"$sDisabledText\""; } $sImage .= "/>"; if ($bActive) { return generateControllerLink($sAction, $sQueryString, $sImage); } else { return $sImage; } } function displayViewButton($oDocument, $bEdit) { global $default; $sViewAlert = "This will download a copy of the document and is not the same as Checking Out a document. Changes to this downloaded file will not be managed in the DMS."; return "graphicsUrl/widgets/docactions/view.gif\" border=\"0\" title=\"View the document\"/>\n"; } function displayCheckInOutButton($oDocument, $bEdit) { $sQueryString = "fDocumentID=" . $oDocument->getID(); // display the check in button if the document is checked out and you checked the document out if ($oDocument->getIsCheckedOut()) { $sAction = "checkInDocument"; $sImageName = "checkin"; if ($oDocument->getCheckedOutUserID() <> $_SESSION["userID"]) { $oUser = User::get($oDocument->getCheckedOutUserID()); $sDisabledText = "The document can only be checked back in by " . $oUser->getName(); } // otherwise display the check out button } else { $sAction = "checkOutDocument"; $sImageName = "checkout"; // #3481 if the document is published don't allow checkout if (DocumentCollaboration::documentIsPublished($oDocument->getID())) { $sDisabledText = "This document has been published and cannot be checked out"; } } if (!$bEdit) { $sDisabledText = "You do not have write access to this document"; } return "" . displayButton($sAction, $sQueryString, $sImageName, $sDisabledText) . "\n"; } function displayEmailButton($oDocument) { global $default; return "graphicsUrl/widgets/docactions/email.gif\" border=\"0\" />\n"; } function displayDeleteButton($oDocument, $bEdit) { if ($bEdit) { $sQueryString = "fDocumentID=" . $oDocument->getID(); if ($oDocument->getIsCheckedOut()) { $sDisabledText = "This document can't be deleted because its checked out"; } } else { $sDisabledText = "You do not have write access to this document"; } return "" . displayButton("deleteDocument", $sQueryString, "delete", $sDisabledText) . "\n"; } function displayHistoryButton($oDocument) { global $default; return "graphicsUrl/widgets/docactions/history.gif\" border=\"0\" />\n"; } function displayMoveButton($oDocument, $bEdit) { if ($bEdit) { $sQueryString = "fFolderID=" . $oDocument->getFolderID() . "&fDocumentID=" . $oDocument->getID(); // documents in collaboration and checked out documents can't be moved if ($oDocument->getIsCheckedOut()) { $sDisabledText = "The document is checked out and cannot be moved."; } if (DocumentCollaboration::documentCollaborationStarted($oDocument->getID()) && !DocumentCollaboration::documentCollaborationDone($oDocument->getID())) { $sDisabledText = "The document is in collaboration and cannot be moved."; } } else { $sDisabledText = "You do not have write access to this document"; } return "" . displayButton("moveDocument", $sQueryString, "move", $sDisabledText) . "\n"; } function displaySubscriptionButton($oDocument) { // display the unsubscribe button if the user is subscribed to the document if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { $sAction = "removeSubscription"; $sImageName = "unsubscribe"; // otherwise display the subscribe button } else { $sAction = "addSubscription"; $sImageName = "subscribe"; } return "" . displayButton($sAction, "fDocumentID=" . $oDocument->getID(), $sImageName) . "\n"; } function displayDiscussionButton($oDocument, $bEdit) { global $default; return "graphicsUrl/widgets/docactions/discussion.gif\" border=\"0\" />\n"; } function displayArchiveButton($oDocument, $bEdit) { // only display the archive button for available documents // if the document is not checked out // and if the document is not in collaboration if ($bEdit) { if (!$oDocument->getIsCheckedOut()) { if ($oDocument->hasCollaboration() && DocumentCollaboration::documentCollaborationStarted($oDocument->getID()) && !DocumentCollaboration::documentCollaborationDone($oDocument->getID())) { $sDisabledText = "This document is in collaboration and cannot be archived"; } } else { $sDisabledText = "This document is checked out and cannot be archived."; } } else { $sDisabledText = "You do not have write access to this document"; } return "" . displayButton("archiveDocument", "fDocumentID=" . $oDocument->getID(), "archive", $sDisabledText) . "\n"; } function displayDependantDocumentButton($oDocument, $bEdit) { global $default; return "graphicsUrl/widgets/docactions/dependentdoc.gif\" border=\"0\" />\n"; } function displayPublishButton($oDocument, $bEdit) { // only display the publish button for unpublished documents if (!DocumentCollaboration::documentIsPublished($oDocument->getID()) && !DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) { // if there is collaboration if ($oDocument->hasCollaboration()) { // only display publish button if collaboration is complete and you're the last user in the collaboration process (or a sysadmin) if (DocumentCollaboration::documentCollaborationDone($oDocument->getID())) { if ( !($_SESSION["userID"] == DocumentCollaboration::getLastCollaboratorID($oDocument->getID())) && !Permission::userIsSystemAdministrator() ) { $sDisabledText = "You are not the last collaborator and hence cannot publish this document"; } } else { $sDisabledText = "You cannot publish this document until collaboration is complete"; } } else { // no collaboration, check the user permissions if ( !($_SESSION["userID"] == $oDocument->getCreatorID()) && !Permission::userIsSystemAdministrator() ) { $sDisabledText = "You do not have permission to publish this document."; } } } else { if (DocumentCollaboration::documentIsPublished($oDocument->getID())) { $sDisabledText = "This document is already published."; } else if (DocumentCollaboration::documentIsPendingWebPublishing($oDocument->getID())) { $sDisabledText = "This document has been marked as pending publishing and the web publisher has been notified."; } } return "" . displayButton("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForPublish=1", "publish", $sDisabledText) . "\n"; } /** * Displays document action buttons */ function displayActionButtons($oDocument, $bEdit) { $sToRender .= displayViewButton($oDocument, $bEdit); $sToRender .= displayEmailButton($oDocument); $sToRender .= displayCheckInOutButton($oDocument, $bEdit); $sToRender .= displayDeleteButton($oDocument, $bEdit); $sToRender .= displayHistoryButton($oDocument); $sToRender .= displayMoveButton($oDocument, $bEdit); $sToRender .= displaySubscriptionButton($oDocument); $sToRender .= displayDiscussionButton($oDocument, $bEdit); $sToRender .= displayArchiveButton($oDocument, $bEdit); $sToRender .= displayDependantDocumentButton($oDocument, $bEdit); $sToRender .= displayPublishButton($oDocument, $bEdit); return $sToRender; } function renderSectionDiv($sDivName, $sHtml) { global $default; if ($default->bNN4) { return ""; } else { return ""; } } function renderDocumentSection($sSectionName, $sHeadingText, $bDisplayLink, $iDocumentID) { if ($bDisplayLink) { $sLink = generateControllerLink("viewDocument", "fDocumentID=$iDocumentID&fShowSection=$sSectionName", $sHeadingText); } else { $sLink = "$sHeadingText"; } return "$sLink\n"; } function getPage($oDocument, $bEdit, $sStatusMessage = "") { global $default; $sToRender = "
"; $sToRender .= renderHeading("Document Detail"); $sToRender .= renderDocumentPath($oDocument, true) . "\n\n"; $sToRender .= ""; $sToRender .= ""; $sToRender .= "
"; $sToRender .= ""; // if we have a status message, then make the section links refresh to viewDocument with the fShowSection variable // ie. effectively removes statusMessage on next click $bDisplayLink = ($sStatusMessage) ? true : false; $sToRender .= renderDocumentSection("documentData", "Document Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("genericMetaData", "Generic Meta Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("typeSpecificMetaData", "Type Specific Meta Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("archiveSettings", "Archive Settings", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("documentRouting", "Document Routing", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("linkedDocuments", "Linked Documents", $bDisplayLink, $oDocument->getID()); $sToRender .= "
"; $sToRender .= "
"; $sToRender .= "\n"; $sToRender .= displayActionButtons($oDocument, $bEdit); $sToRender .= "
\n"; $sToRender .= "
"; $sToRender .= "
"; // ugly netscape hacks if (!$default->bNN4) { $sToRender .= ""; } return $sToRender; } function getStatusPage($oDocument, $sStatusMessage) { global $default; $sToRender = "
"; $sToRender .= renderHeading("Document Detail"); $sToRender .= renderDocumentPath($oDocument, false) . "\n\n"; $sToRender .= ""; // if we have a status message, then make the section links refresh to viewDocument with the fShowSection variable // ie. effectively removes statusMessage on next click $bDisplayLink = ($sStatusMessage) ? true : false; $sToRender .= renderDocumentSection("documentData", "Document Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("genericMetaData", "Generic Meta Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("typeSpecificMetaData", "Type Specific Meta Data", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("archiveSettings", "Archive Settings", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("documentRouting", "Document Routing", $bDisplayLink, $oDocument->getID()); $sToRender .= renderDocumentSection("linkedDocuments", "Linked Documents", $bDisplayLink, $oDocument->getID()); $sToRender .= "
"; $sToRender .= "
"; $sToRender .= renderDocumentData($oDocument, false, $sStatusMessage); return $sToRender; } function getWebPublishPage($oDocument) { global $default; $oPatternListBox = & new PatternListBox($default->web_sites_table, "web_site_name", "id", "fWebSiteID"); $sToRender .= renderHeading("Document Detail"); $sToRender .= renderDocumentPath($oDocument, false) . "\n\n"; $sToRender .= "\n"; $sToRender .= "\t"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t\n"; $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "
Choose the website to publish to:
" . $oPatternListBox->render() . "
Enter a comment for the web master:
graphicsUrl/widgets/publish.gif\" border=\"0\"/>"; $sToRender .= "\t\trootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\">graphicsUrl/widgets/cancel.gif\" border=\"0\" />
\n"; $sToRender .= "\n\n\n\n"; $sToRender .= renderDocumentData($oDocument, $bEdit); return $sToRender; } function wrapInTable($sHtml) { return "\n\t\t\t
$sHtml
\n"; } ?>