Commit 689db4e15060f424fd7970f003722a380adbc40e
1 parent
d9000654
refactored action button display, and added buttons at the top of the view document screen also
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1699 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
52 additions
and
36 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| ... | ... | @@ -17,7 +17,7 @@ function renderHeading() { |
| 17 | 17 | global $default; |
| 18 | 18 | $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); |
| 19 | 19 | $sColor = $default->siteMap->getSectionColour($sSectionName, "th"); |
| 20 | - $sToRender = "<table border=\"0\" width=\"100%\">\n"; | |
| 20 | + $sToRender = "<table border=\"0\" width=\"600\">\n"; | |
| 21 | 21 | $sToRender .= "<tr align=\"left\"><th class=\"sectionHeading\" bgcolor=\"$sColor\"><font color=\"ffffff\">Document Detail</font></th></tr>\n"; |
| 22 | 22 | $sToRender .= "<tr/>\n"; |
| 23 | 23 | $sToRender .= "<tr/>\n"; |
| ... | ... | @@ -133,10 +133,50 @@ function renderNonEditableDocumentRouting($oDocument) { |
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | +function displayActionButtons($oDocument, $bEdit) { | |
| 137 | + global $default; | |
| 138 | + if ($bEdit) { | |
| 139 | + // display the check in button if the document is checked out and you checked the document out | |
| 140 | + if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) { | |
| 141 | + $sToRender = "<td><a href=\"" . generateControllerLink("checkInDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkin.gif\" border=\"0\" /></a></td>\n"; | |
| 142 | + // otherwise display the check out button | |
| 143 | + } else { | |
| 144 | + $sToRender = "<td><a href=\"" . generateControllerLink("checkOutDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkout.gif\" border=\"0\" /></a></td>\n"; | |
| 145 | + } | |
| 146 | + } | |
| 147 | + | |
| 148 | + $sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n"; | |
| 149 | + if ($bEdit) { | |
| 150 | + $sToRender .= "<td><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/delete.gif\" border=\"0\" /></a></td>\n"; | |
| 151 | + } | |
| 152 | + $sToRender .= "<td><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/history.gif\" border=\"0\" /></a></td>\n"; | |
| 153 | + if ($bEdit) { | |
| 154 | + $sToRender .= "<td><a href=\"" . generateControllerLink("moveDocument", "fFolderID=" . $oDocument->getFolderID() . "&fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/move.gif\" border=\"0\" /></a></td>\n"; | |
| 155 | + } | |
| 156 | + | |
| 157 | + // display the unsubscribe button if the user is subscribed to the document | |
| 158 | + if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 159 | + $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 160 | + // otherwise display the subscribe button | |
| 161 | + } else { | |
| 162 | + $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 163 | + } | |
| 164 | + $sToRender .= "<td><a onClick=\"alert('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 true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n"; | |
| 165 | + | |
| 166 | + return $sToRender; | |
| 167 | +} | |
| 168 | + | |
| 136 | 169 | function getEditPage($oDocument) { |
| 137 | 170 | global $default; |
| 138 | 171 | $iDocumentID = $oDocument->getID(); |
| 139 | 172 | $sToRender = renderHeading() . renderDocumentPath($oDocument) . "\n<br>\n"; |
| 173 | + | |
| 174 | + $sToRender .= "<table>\n"; | |
| 175 | + $sToRender .= "<tr>\n"; | |
| 176 | + $sToRender .= displayActionButtons($oDocument, true); | |
| 177 | + $sToRender .= "</tr>\n"; | |
| 178 | + $sToRender .= "</table>\n"; | |
| 179 | + | |
| 140 | 180 | $sToRender .= "<table border = 0>\n"; |
| 141 | 181 | $sToRender .= "<tr>\n"; |
| 142 | 182 | $sToRender .= "<td>\n"; |
| ... | ... | @@ -203,31 +243,10 @@ function getEditPage($oDocument) { |
| 203 | 243 | $sToRender .= "</td>\n"; |
| 204 | 244 | $sToRender .= "</tr>\n"; |
| 205 | 245 | $sToRender .= "</table>\n"; |
| 246 | + | |
| 206 | 247 | $sToRender .= "<table>\n"; |
| 207 | 248 | $sToRender .= "<tr>\n"; |
| 208 | - | |
| 209 | - // display the check in button if the document is checked out and you checked the document out | |
| 210 | - if ($oDocument->getIsCheckedOut() && ($oDocument->getCheckedOutUserID() == $_SESSION["userID"])) { | |
| 211 | - $sToRender .= "<td><a href=\"" . generateControllerLink("checkInDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkin.gif\" border=\"0\" /></a></td>\n"; | |
| 212 | - // otherwise display the check out button | |
| 213 | - } else { | |
| 214 | - $sToRender .= "<td><a href=\"" . generateControllerLink("checkOutDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkout.gif\" border=\"0\" /></a></td>\n"; | |
| 215 | - } | |
| 216 | - | |
| 217 | - $sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n"; | |
| 218 | - $sToRender .= "<td><a href=\"" . generateControllerLink("deleteDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/delete.gif\" border=\"0\" /></a></td>\n"; | |
| 219 | - $sToRender .= "<td><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/history.gif\" border=\"0\" /></a></td>\n"; | |
| 220 | - $sToRender .= "<td><a href=\"" . generateControllerLink("moveDocument", "fFolderID=" . $oDocument->getFolderID() . "&fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/move.gif\" border=\"0\" /></a></td>\n"; | |
| 221 | - | |
| 222 | - // display the unsubscribe button if the user is subscribed to the document | |
| 223 | - if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 224 | - $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 225 | - // otherwise display the subscribe button | |
| 226 | - } else { | |
| 227 | - $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 228 | - } | |
| 229 | - $sToRender .= "<td><a onClick=\"alert('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 true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n"; | |
| 230 | - | |
| 249 | + $sToRender .= displayActionButtons($oDocument, true); | |
| 231 | 250 | $sToRender .= "</tr>\n"; |
| 232 | 251 | $sToRender .= "</table>\n"; |
| 233 | 252 | |
| ... | ... | @@ -238,6 +257,13 @@ function getViewPage($oDocument) { |
| 238 | 257 | global $default; |
| 239 | 258 | $iDocumentID = $oDocument->getID(); |
| 240 | 259 | $sToRender = renderHeading() . renderDocumentPath($oDocument) . "\n<br>\n"; |
| 260 | + | |
| 261 | + $sToRender .= "<table>\n"; | |
| 262 | + $sToRender .= "<tr>\n"; | |
| 263 | + $sToRender .= displayActionButtons($oDocument, false); | |
| 264 | + $sToRender .= "</tr>\n"; | |
| 265 | + $sToRender .= "</table>\n"; | |
| 266 | + | |
| 241 | 267 | $sToRender .= "<table border = 0>\n"; |
| 242 | 268 | $sToRender .= "<tr>\n"; |
| 243 | 269 | $sToRender .= "<td>\n"; |
| ... | ... | @@ -270,20 +296,10 @@ function getViewPage($oDocument) { |
| 270 | 296 | $sToRender .= "</td>\n"; |
| 271 | 297 | $sToRender .= "</tr>\n"; |
| 272 | 298 | $sToRender .= "</table>"; |
| 299 | + | |
| 273 | 300 | $sToRender .= "<table>\n"; |
| 274 | 301 | $sToRender .= "<tr>\n"; |
| 275 | - $sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n"; | |
| 276 | - $sToRender .= "<td><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/history.gif\" border=\"0\" /></a></td>\n"; | |
| 277 | - | |
| 278 | - // display the unsubscribe button if the user is subscribed to the document | |
| 279 | - if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) { | |
| 280 | - $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 281 | - // otherwise display the subscribe button | |
| 282 | - } else { | |
| 283 | - $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n"; | |
| 284 | - } | |
| 285 | - $sToRender .= "<td><a onClick=\"alert('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 true;\" href=\"" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fForDownload=1") . "\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n"; | |
| 286 | - | |
| 302 | + $sToRender .= displayActionButtons($oDocument, false); | |
| 287 | 303 | $sToRender .= "</tr>\n"; |
| 288 | 304 | $sToRender .= "</table>\n"; |
| 289 | 305 | ... | ... |