diff --git a/lib/session/control.inc b/lib/session/control.inc index 66beaff..301c273 100644 --- a/lib/session/control.inc +++ b/lib/session/control.inc @@ -59,6 +59,29 @@ function generateLink($sTargetPage, $sQueryString, $sLinkText = "") { } /** + * Generates a link used when setting up template documents for document linking in folder + * collaboration. Formatted to send document name and id back to parent window + * + * @param string the url to link to + * @param string the querystring + * @param string the link text (optional) + * @return string the html link if the link text is specified, otherwise just the url + */ +function generateLinkForTemplateDocumentBrowse($sTargetPage, $sQueryString, $sLinkText = "", $sDocumentName, $iDocumentID) { + global $default; + + if (strlen($sQueryString) > 0) { + $sQueryStringDelimiter = (strstr($sTargetPage, "?") ? "&" : "?"); + } + $sLink = "http" . ($default->sslEnabled ? "s" : "") . "://" . $default->serverName . + ((substr($sTargetPage, 0, strlen($default->rootUrl)) != $default->rootUrl) ? $default->rootUrl : "") . + $sTargetPage . $sQueryStringDelimiter . $sQueryString; + + return (strlen($sLinkText) > 0) ? "$sLinkText" : $sLink; +} + + +/** * Returns a controller url. * * @param string the controller action to generate a url for diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc index a72e773..1bdd7a4 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc @@ -12,12 +12,38 @@ * @package presentation.lookAndFeel.knowledgeTree.documentmanagement */ + +/* only used when users choose a template document when setting up document linking + * on the folder collaboration page. Formats the link so that the child window + * lanuched by the javascript feeds back to the parent window +*/ +function displayDocumentLinkForTemplateBrowsing($oDocument, $bDisplayFullPath = false) { + global $default; + + $sIconUrl = $oDocument->getMimeTypeIconUrl(); + $sIconPath = ($sIconUrl ? generateImage($sIconUrl) : generateImage("$default->graphicsUrl/unknown.gif")); + + $sLinkText = $oDocument->getName(); + if ($bDisplayFullPath) { + // prepend folder path + $sLinkText = Folder::getFolderDisplayPath($oDocument->getFolderID()) . " > " . $sLinkText; + } + + + return generateLinkForTemplateDocumentBrowse("$default->rootUrl/control.php", + "action=viewDocument&fDocumentID=" . $oDocument->getID(), + $sIconPath . " " . $sLinkText, $oDocument->getName(), $oDocument->getID()); + + +} + /** * Displays a link to view document details * * @param object the document to display * @param boolean whether to display the entire path to the document or not */ + function displayDocumentLink($oDocument, $bDisplayFullPath = false) { global $default;