Commit 69ef9c013779d664da80a8e69b5d50f6dba23a2a

Authored by Neil Blakey-Milner
1 parent 459ca7fa

Display docaction buttons using CSS and HTML by default. Can still ask

for image buttons, if you so wish.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2947 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
... ... @@ -384,17 +384,37 @@ function renderDependantDocuments($oDocument, $bEdit) {
384 384 return $sToRender;
385 385 }
386 386  
  387 +$aImageNameToLabel = array(
  388 + "dependentdoc" => "Link new doc",
  389 +);
  390 +
387 391 function displayButton($sAction, $sQueryString, $sImageName, $sDisabledText = "") {
388 392 global $default;
  393 + global $aImageNameToLabel;
389 394 // the active is active if there is no disabled text
390 395 $bActive = !strlen($sDisabledText) > 0;
391   - $sImage = "<img border=\"0\" src=\"$default->graphicsUrl/widgets/docactions/";
392   - if ($bActive) {
393   - $sImage .= "$sImageName.gif\"";
394   - } else {
395   - $sImage .= "disabled-$sImageName.gif\" title=\"$sDisabledText\"";
396   - }
397   - $sImage .= "/>";
  396 + if ($default->useTextButtons === false) {
  397 + $sImage = "<img border=\"0\" src=\"$default->graphicsUrl/widgets/docactions/";
  398 + if ($bActive) {
  399 + $sImage .= "$sImageName.gif\"";
  400 + } else {
  401 + $sImage .= "disabled-$sImageName.gif\" title=\"$sDisabledText\"";
  402 + }
  403 + $sImage .= "/>";
  404 + } else {
  405 + if (array_key_exists($sImageName, $aImageNameToLabel)) {
  406 + $sLabel = $aImageNameToLabel[$sImageName];
  407 + } else {
  408 + $sLabel = $sImageName;
  409 + }
  410 + $sLabel = strtoupper($sLabel);
  411 + if ($bActive) {
  412 + $sClass = "button";
  413 + } else {
  414 + $sClass = "disabledbutton";
  415 + }
  416 + $sImage = "<span class=\"$sClass\">$sLabel</span>";
  417 + }
398 418 if ($bActive) {
399 419 return generateControllerLink($sAction, $sQueryString, $sImage);
400 420 } else {
... ... @@ -405,7 +425,11 @@ function displayButton($sAction, $sQueryString, $sImageName, $sDisabledText = &quot;&quot;
405 425 function displayViewButton($oDocument, $bEdit) {
406 426 global $default;
407 427 $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.");
  428 + if ($default->useTextButtons === false) {
408 429 return "<tr><td align=\"left\"><a onClick=\"alert('$sViewAlert '); return true;\" href=\"" . generateControllerLink("downloadDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/view.gif\" border=\"0\" title=\"" . _("View the document") . "\"/></a></td></tr>\n";
  430 + } else {
  431 + return "<tr><td align=\"left\"><a onClick=\"alert('$sViewAlert '); return true;\" href=\"" . generateControllerLink("downloadDocument", "fDocumentID=" . $oDocument->getID()) . "\"><span class=\"button\" title=\"" . _("View the document") . "\">VIEW</span></a></td></tr>\n";
  432 + }
409 433 }
410 434  
411 435 function displayCheckInOutButton($oDocument, $bEdit) {
... ... @@ -436,7 +460,7 @@ function displayCheckInOutButton($oDocument, $bEdit) {
436 460  
437 461 function displayEmailButton($oDocument) {
438 462 global $default;
439   - return "<tr><td align=\"left\"><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/email.gif\" border=\"0\" /></a></td></tr>\n";
  463 + return "<tr><td align=\"left\">" . displayButton("emailDocument", "fDocumentID=" . $oDocument->getID(), "email") . "</td></tr>\n";
440 464 }
441 465  
442 466 function displayDeleteButton($oDocument, $bEdit) {
... ... @@ -453,7 +477,7 @@ function displayDeleteButton($oDocument, $bEdit) {
453 477  
454 478 function displayHistoryButton($oDocument) {
455 479 global $default;
456   - return "<tr><td align=\"left\"><a href=\"" . generateControllerLink("viewHistory", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/history.gif\" border=\"0\" /></a></td></tr>\n";
  480 + return "<tr><td align=\"left\">" . displayButton("viewHistory", "fDocumentID=" . $oDocument->getID(), "history") . "</td></tr>\n";
457 481 }
458 482 function displayMoveButton($oDocument, $bEdit) {
459 483 if ($bEdit) {
... ... @@ -487,7 +511,7 @@ function displaySubscriptionButton($oDocument) {
487 511  
488 512 function displayDiscussionButton($oDocument, $bEdit) {
489 513 global $default;
490   - return "<tr><td align=\"left\"><a href=\"" . generateControllerLink("viewDiscussion", "fDocumentID=" . $oDocument->getID() . "&fForDiscussion=1") . "\"><img src=\"$default->graphicsUrl/widgets/docactions/discussion.gif\" border=\"0\" /></a></td></tr>\n";
  514 + return "<tr><td align=\"left\">" . displayButton("viewDiscussion", "fDocumentID=" . $oDocument->getID() . "&fForDiscussion=1", "discussion") . "</td></tr>\n";
491 515 }
492 516  
493 517 function displayArchiveButton($oDocument, $bEdit) {
... ... @@ -512,7 +536,7 @@ function displayArchiveButton($oDocument, $bEdit) {
512 536  
513 537 function displayDependantDocumentButton($oDocument, $bEdit) {
514 538 global $default;
515   - return "<td align=\"left\"><a href=\"" . generateControllerLink("createDependantDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/docactions/dependentdoc.gif\" border=\"0\" /></a></td>\n";
  539 + return "<td align=\"left\">" . displayButton("createDependantDocument", "fDocumentID=" . $oDocument->getID(), "dependentdoc") . "</td>\n";
516 540 }
517 541  
518 542 function displayPublishButton($oDocument, $bEdit) {
... ...