Commit ed114f524c1b8a0506d7ed7108702cbffb700208
1 parent
c2029399
Added function to generate links specific to browsing for template
documents when linking documents in folder collaboration git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1854 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
49 additions
and
0 deletions
lib/session/control.inc
| ... | ... | @@ -59,6 +59,29 @@ function generateLink($sTargetPage, $sQueryString, $sLinkText = "") { |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | + * Generates a link used when setting up template documents for document linking in folder | |
| 63 | + * collaboration. Formatted to send document name and id back to parent window | |
| 64 | + * | |
| 65 | + * @param string the url to link to | |
| 66 | + * @param string the querystring | |
| 67 | + * @param string the link text (optional) | |
| 68 | + * @return string the html link if the link text is specified, otherwise just the url | |
| 69 | + */ | |
| 70 | +function generateLinkForTemplateDocumentBrowse($sTargetPage, $sQueryString, $sLinkText = "", $sDocumentName, $iDocumentID) { | |
| 71 | + global $default; | |
| 72 | + | |
| 73 | + if (strlen($sQueryString) > 0) { | |
| 74 | + $sQueryStringDelimiter = (strstr($sTargetPage, "?") ? "&" : "?"); | |
| 75 | + } | |
| 76 | + $sLink = "http" . ($default->sslEnabled ? "s" : "") . "://" . $default->serverName . | |
| 77 | + ((substr($sTargetPage, 0, strlen($default->rootUrl)) != $default->rootUrl) ? $default->rootUrl : "") . | |
| 78 | + $sTargetPage . $sQueryStringDelimiter . $sQueryString; | |
| 79 | + | |
| 80 | + return (strlen($sLinkText) > 0) ? "<a href=\"$sLink\" onClick=\"load('$sDocumentName', $iDocumentID, top.opener);\">$sLinkText</a>" : $sLink; | |
| 81 | +} | |
| 82 | + | |
| 83 | + | |
| 84 | +/** | |
| 62 | 85 | * Returns a controller url. |
| 63 | 86 | * |
| 64 | 87 | * @param string the controller action to generate a url for | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc
| ... | ... | @@ -12,12 +12,38 @@ |
| 12 | 12 | * @package presentation.lookAndFeel.knowledgeTree.documentmanagement |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | + | |
| 16 | +/* only used when users choose a template document when setting up document linking | |
| 17 | + * on the folder collaboration page. Formats the link so that the child window | |
| 18 | + * lanuched by the javascript feeds back to the parent window | |
| 19 | +*/ | |
| 20 | +function displayDocumentLinkForTemplateBrowsing($oDocument, $bDisplayFullPath = false) { | |
| 21 | + global $default; | |
| 22 | + | |
| 23 | + $sIconUrl = $oDocument->getMimeTypeIconUrl(); | |
| 24 | + $sIconPath = ($sIconUrl ? generateImage($sIconUrl) : generateImage("$default->graphicsUrl/unknown.gif")); | |
| 25 | + | |
| 26 | + $sLinkText = $oDocument->getName(); | |
| 27 | + if ($bDisplayFullPath) { | |
| 28 | + // prepend folder path | |
| 29 | + $sLinkText = Folder::getFolderDisplayPath($oDocument->getFolderID()) . " > " . $sLinkText; | |
| 30 | + } | |
| 31 | + | |
| 32 | + | |
| 33 | + return generateLinkForTemplateDocumentBrowse("$default->rootUrl/control.php", | |
| 34 | + "action=viewDocument&fDocumentID=" . $oDocument->getID(), | |
| 35 | + $sIconPath . " " . $sLinkText, $oDocument->getName(), $oDocument->getID()); | |
| 36 | + | |
| 37 | + | |
| 38 | +} | |
| 39 | + | |
| 15 | 40 | /** |
| 16 | 41 | * Displays a link to view document details |
| 17 | 42 | * |
| 18 | 43 | * @param object the document to display |
| 19 | 44 | * @param boolean whether to display the entire path to the document or not |
| 20 | 45 | */ |
| 46 | + | |
| 21 | 47 | function displayDocumentLink($oDocument, $bDisplayFullPath = false) { |
| 22 | 48 | global $default; |
| 23 | 49 | ... | ... |