diff --git a/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php b/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php
new file mode 100644
index 0000000..e503e73
--- /dev/null
+++ b/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php
@@ -0,0 +1,57 @@
+fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
+ require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc");
+ require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
+ require_once("$default->fileSystemRoot/presentation/Html.inc");
+ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
+ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
+ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
+ require_once("viewDependantDocumentsUI.inc");
+
+ //folder and collaboration are selected
+ $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID);
+ if ($oFolderCollaboration->hasDocumentInProcess()) {
+ //can't add document links if a document is currently undergoing the
+ //collaboration process
+ echo "in here";
+
+ } if (isset($fForAdd)) {
+ //we are adding a new dependant document
+ include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
+ $oPatternCustom = & new PatternCustom();
+ $oPatternCustom->setHtml(getAddPage($fFolderCollaborationID, $fFolderID, (isset($fUnitID) ? $fUnitID : -1), (isset($fDocumentTitle) ? $fDocumentTitle : "")));
+ $main->setCentralPayload($oPatternCustom);
+ $main->setFormAction("document.MainForm.action = " . $_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForAdd=1;document.MainForm.submit();");
+ $main->render();
+ } else {
+ include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
+
+ $oPatternCustom = & new PatternCustom();
+ $oPatternCustom->setHtml(getViewPage($fFolderCollaborationID, $fFolderID));
+ $main->setCentralPayload($oPatternCustom);
+ $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForAdd=1");
+ $main->render();
+ }
+
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsUI.inc b/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsUI.inc
new file mode 100644
index 0000000..de34214
--- /dev/null
+++ b/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsUI.inc
@@ -0,0 +1,116 @@
+siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
+ $sColor = $default->siteMap->getSectionColour($sSectionName, "th");
+ $sToRender = "
\n";
+ $sToRender .= "| $sHeading |
\n";
+ $sToRender .= "
\n";
+ $sToRender .= "
\n";
+ $sToRender .= "
\n";
+ return $sToRender;
+}
+
+function getFolderPath($iFolderID) {
+ global $default;
+ $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
+ $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
+ $sFolderPathLink = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
+ return "\n";
+}
+
+function getDocumentLinkFolderCollaborationData($iFolderCollaborationID) {
+ global $default;
+ $sQuery = "SELECT DDT.id, U.name AS username, DDT.document_title, D.name AS template_document_name, DDT.group_folder_approval_link_id, 'Edit' AS edit " .
+ "FROM dependant_document_template AS DDT INNER JOIN groups_folders_approval_link AS GFAL ON DDT.group_folder_approval_link_id = GFAL.id " .
+ "INNER JOIN users AS U ON U.id = DDT.default_user_id " .
+ "LEFT OUTER JOIN documents AS D ON D.id = DDT.template_document_id " .
+ "WHERE DDT.group_folder_approval_link_id = $iFolderCollaborationID";
+
+ //echo $sQuery;
+ $aColumns = array("document_title", "username", "template_document_name","edit");
+ $aColumnHeaders = array("Document title", "Default creator", "Template document", "Edit");
+ $aColumnTypes = array(1,1,1,3);
+ $aDBColumnArray = array("id","group_folder_approval_link_id");
+ $aQueryStringVariableNames = array("fDependantDocumentTemplateID","fFolderCollaborationID");
+ $aLinkURLs = array(3=>"$default->rootUrl/control.php?action=linkDocFolderCollaboration");
+
+ $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
+ $oPatternTableSqlQuery->setTableHeading("Linked Documents");
+ $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
+ $oPatternTableSqlQuery->setEmptyTableMessage("No dependant documents");
+
+ return $oPatternTableSqlQuery->render();
+
+
+}
+
+function getViewPage($iFolderCollaborationID, $iFolderID) {
+ global $default;
+ $sToRender = renderHeading("Dependant documents");
+ $sToRender .= getFolderPath($iFolderID);
+ $sToRender .= "\n";
+ $sToRender .= "\n";
+ $sToRender .= "| " . getDocumentLinkFolderCollaborationData($iFolderCollaborationID) . " | \n";
+ $sToRender .= "
\n";
+ $sToRender .= "\n";
+ $sToRender .= "| \n";
+ $sToRender .= " |
\n";
+ $sToRender .= "
\n";
+
+ return $sToRender;
+}
+
+function getEditPage() {
+
+}
+
+function getAddPage($iFolderCollaborationID, $iFolderID, $iUnitID, $sDocumentTitle) {
+ global $default;
+ $sToRender = renderHeading("Dependant documents");
+ $sToRender .= getFolderPath($iFolderID);
+ $sToRender .= "\n";
+
+ return $sToRender;
+}
+
+function getUserDropDown($iUnitID) {
+ global $default;
+ $oPatternListBox = & new PatternListBox($default->owl_users_table, "Name", "id", "fUserID", "GUL.unit_id = $iUnitID");
+ $sFromClause = "INNER join users_groups_link AS UGL ON UGL.user_id = ST.id " .
+ "INNER JOIN groups_units_link AS GUL ON GUL.group_id = UGL.group_id ";
+ $oPatternListBox->setFromClause($sFromClause);
+ return $oPatternListBox->render();
+
+
+}
+
+function getUnitDropDown($iFolderCollaborationID, $iFolderID, $iUnitID) {
+ global $default;
+ $oPatternListBox = & new PatternListBox($default->owl_units_table, "Name", "id", "fUnitID");
+ $oPatternListBox->setPostBackOnChange(true);
+ $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID&fForAdd=1')");
+ $oPatternListBox->setSelectedValue($iUnitID);
+ return $oPatternListBox->render();
+}
+
+
+?>
\ No newline at end of file