/** * Answer a placeholder for a menu target * * @param object MenuOrganizerSiteComponent $organizer * @return Component * @access protected * @since 12/18/07 */ protected function getMenuTargetPlaceholder(MenuOrganizerSiteComponent $organizer) { // Add a placeholder to our target if we don't have any children ob_start(); print "<div style='height: 50px;'>"; $authZ = Services::getService("AuthZ"); $idMgr = Services::getService("Id"); if ($authZ->isUserAuthorized($idMgr->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId())) { print _("This Section has no Pages yet. <br/><br/>Add a Page by clicking the <strong>+ Page</strong> button for this Section and choose 'Page'."); } else { print " "; print "\n</div>"; return new UnstyledBlock(ob_get_clean()); } print "\n</div>"; $placeholder = new UnstyledBlock(ob_get_clean()); $title = str_replace('%1', $organizer->getParentComponent()->getDisplayName(), _("<em>Sub-Menu of</em> %1 <em>Target Placeholder</em>")); $controlsHTML = $this->getControlsHTML($organizer, $title, '', '#F00', '#F99', '#F66'); $placeholder->setPreHTML($controlsHTML); $styleCollection = new StyleCollection('.placeholder_red_outline', 'placeholder_red_outline', 'Red Outline', 'A red outline around a menu placeholder'); $styleCollection->addSP(new BorderSP('1px', 'solid', '#F00')); $placeholder->addStyle($styleCollection); return $placeholder; }
function printAssetShort($asset, $params, $num) { $harmoni = Harmoni::instance(); $container = new Container(new YLayout(), BLOCK, EMPHASIZED_BLOCK); $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container."); $fillContainerSC->addSP(new MinHeightSP("88%")); $container->addStyle($fillContainerSC); $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text"); $centered->addSP(new TextAlignSP("center")); $assetId = $asset->getId(); if ($_SESSION["show_thumbnail"] == 'true') { try { $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset); } catch (Exception $e) { $thumbnailURL = false; } if ($thumbnailURL !== FALSE) { if (RepositoryInputOutputModuleManager::hasThumbnailNotIcon($asset)) { $thumbClass = 'thumbnail_image'; } else { $thumbClass = 'thumbnail_icon'; } } else { $thumbnailURL = POLYPHONY_PATH . "/icons/filetypes/unknown.png"; $thumbClass = 'thumbnail_icon'; } $thumbSize = $_SESSION["thumbnail_size"] . "px"; ob_start(); print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>"; print "\n\t<a style='cursor: pointer;'"; print " onclick='Javascript:window.open("; print '"' . AssetPrinter::getSlideshowLink($asset, $num) . '", '; // print '"'.preg_replace("/[^a-z0-9]/i", '_', $assetId->getIdString()).'", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print ")'>"; print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail {$thumbClass}' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' />"; print "\n\t</a>"; print "\n</div>"; $component = new UnstyledBlock(ob_get_contents()); $component->addStyle($centered); ob_end_clean(); $container->add($component, "100%", null, CENTER, CENTER); } ob_start(); if ($_SESSION["show_displayName"] == 'true') { print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>"; } if ($_SESSION["show_id"] == 'true') { print "\n\t<div>" . _("ID#") . ": " . $assetId->getIdString() . "</div>"; } if ($_SESSION["show_description"] == 'true') { $description = HtmlString::withValue($asset->getDescription()); $description->trim(16); $descriptionShort = preg_replace('/\\.\\.\\.$/', "<a onclick=\"" . "var panel = Panel.run(" . "'" . addslashes(htmlspecialchars($asset->getDisplayName())) . "', " . "100, 400, this.parentNode); " . "if (!panel.contentElement.innerHTML) " . "{panel.contentElement.innerHTML = this.parentNode.nextSibling.innerHTML;}" . "\">...</a>", $description->asString()); print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto;'>"; print $descriptionShort; print "</div>"; if (preg_match('/\\.\\.\\.$/', $description->asString())) { print "<div style='display: none'>" . $asset->getDescription() . "</div>"; } } if ($_SESSION["show_tags"] == 'true') { // Tags print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto; text-align: justify; margin-top: 5px;'>"; print TagAction::getTagCloudForItem(TaggedItem::forId($assetId, 'concerto'), 'view', array('font-size: 90%;', 'font-size: 100%;')); print "\n\t</div>"; } $component = new UnstyledBlock(ob_get_contents()); ob_end_clean(); $container->add($component, "100%", null, LEFT, TOP); // Bottom controls if ($_SESSION["show_controls"] == 'true') { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); ob_start(); print "\n<div style='margin-top: 5px; font-size: small; white-space: nowrap;'>"; AssetPrinter::printAssetFunctionLinks($harmoni, $asset, NULL, $num, false); print " | "; $harmoni->request->startNamespace("AssetMultiEdit"); print "\n<input type='checkbox'"; print " name='" . RequestContext::name("asset") . "'"; print " value='" . $assetId->getIdString() . "'"; print "/>"; print "\n<input type='hidden'"; print " name='" . RequestContext::name("asset_can_modify_" . $assetId->getIdString()) . "'"; try { if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $assetId)) { print " value='true'"; } else { print " value='false'"; } } catch (UnknownIdException $e) { // allow non-harmoni Repositories. print " value='true'"; } print "/>"; print "\n<input type='hidden'"; print " name='" . RequestContext::name("asset_can_delete_" . $assetId->getIdString()) . "'"; try { if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.delete"), $assetId)) { print " value='true'"; } else { print " value='false'"; } } catch (UnknownIdException $e) { // allow non-harmoni Repositories. print " value='true'"; } print "/>"; $harmoni->request->endNamespace(); print "</div>"; $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, RIGHT, BOTTOM); } return $container; }
function printSlideShort($asset, $params, $slideshowIdString, $num) { $harmoni = Harmoni::instance(); $container = new Container(new YLayout(), BLOCK, EMPHASIZED_BLOCK); $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container."); $fillContainerSC->addSP(new MinHeightSP("88%")); $container->addStyle($fillContainerSC); $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text"); $centered->addSP(new TextAlignSP("center")); $idManager = Services::getService("Id"); $repositoryManager = Services::getService("Repository"); $authZ = Services::getService("AuthZ"); // Get our record and its data $slideRecords = $asset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure")); if ($slideRecords->hasNext()) { $slideRecord = $slideRecords->next(); // Text-Position $textPosition = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.text_position", $slideRecord); // Display Metadata $displayMetadata = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.display_metadata", $slideRecord); // Media $mediaIdStringObj = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.target_id", $slideRecord); if (strlen($mediaIdStringObj->asString())) { $mediaId = $idManager->getId($mediaIdStringObj->asString()); } else { $mediaId = null; } } // ------------------------------------------ ob_start(); print "\n\t<a style='cursor: pointer;'"; print " onclick='Javascript:window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL('exhibitions', "slideshowOutlineXml", array('slideshow_id' => $slideshowIdString))); print '&start=' . ($num - 1) . '", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print ")'>"; $viewerATag = ob_get_clean(); /********************************************************* * Media *********************************************************/ if (isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId) && $_SESSION["show_thumbnail"] == 'true') { $mediaAsset = $repositoryManager->getAsset($mediaId); $mediaAssetId = $mediaAsset->getId(); $mediaAssetRepository = $mediaAsset->getRepository(); $mediaAssetRepositoryId = $mediaAssetRepository->getId(); $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaAsset); if ($thumbnailURL !== FALSE) { $thumbSize = $_SESSION["thumbnail_size"] . "px"; ob_start(); print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>"; print $viewerATag; print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' class='thumbnail_image' />"; print "\n\t</a>"; print "\n</div>"; $component = new UnstyledBlock(ob_get_clean()); $component->addStyle($centered); $container->add($component, "100%", null, CENTER, CENTER); } // other files $fileRecords = $mediaAsset->getRecordsByRecordStructure($idManager->getId("FILE")); } // Link to viewer $numFiles = 0; if (isset($fileRecords)) { while ($fileRecords->hasNext()) { $record = $fileRecords->next(); $numFiles++; } } ob_start(); print "\n<div height='15px; font-size: small;'>"; print $viewerATag; print _("Open in Viewer"); if ($numFiles > 1) { print " (" . ($numFiles - 1) . " " . _("more files") . ")"; } print "\n\t</a>"; print "\n</div>"; $component = new UnstyledBlock(ob_get_clean()); $component->addStyle($centered); $container->add($component, "100%", null, CENTER, CENTER); // Title ob_start(); if ($_SESSION["show_displayName"] == 'true') { print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>"; } // Caption if ($_SESSION["show_description"] == 'true') { $description = HtmlString::withValue($asset->getDescription()); $description->clean(); if (isset($thumbnailURL)) { print "\n\t<div style='font-size: smaller; height: 100px; overflow: auto;'>"; } else { print "\n\t<div style='font-size: smaller; height: " . ($_SESSION["thumbnail_size"] + 100) . "px; overflow: auto;'>"; } print $description->asString(); if (isset($displayMetadata) && $displayMetadata->isTrue() && isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId)) { print "\t\t\t<hr/>\n"; $mediaAsset = $repositoryManager->getAsset($mediaId); printTargetAsset($mediaAsset); } // Unauthorized to view Media Message if (isset($mediaId) && !$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId)) { print "\t\t\t<div style='font-size: large; font-weight: bold; border: 2px dotted; padding: 5px;'>"; $harmoni = Harmoni::instance(); print "\n\t\t\t\t<p>"; print _("You are not authorized to view the media for this slide."); print "</p>\n\t\t\t\t<p>"; print _("If you have not done so, please go to "); print "<a href='" . $harmoni->request->quickURL("home", "welcome"); print "'>Concerto</a>"; print _(" and log in."); print "\t\t\t\t</p>\n\t\t\t</div>\n"; } print "</div>"; } $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, TOP); // Controls ob_start(); // Authorization Icons print _("Slide: ") . AuthZPrinter::getAZIcon($asset->getId()); if (isset($mediaId) && $mediaId) { print "<br/>" . _("Media: ") . AuthZPrinter::getAZIcon($mediaId); } $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, BOTTOM); return $container; }
function printAssetShort($assetId, $num) { $harmoni = Harmoni::instance(); $repositoryManager = Services::getService("Repository"); $asset = $repositoryManager->getAsset($assetId); $container = new Container(new YLayout(), BLOCK, STANDARD_BLOCK); $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container."); $fillContainerSC->addSP(new MinHeightSP("88%")); $container->addStyle($fillContainerSC); $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text"); $centered->addSP(new TextAlignSP("center")); $assetId = $asset->getId(); if ($_SESSION["show_thumbnail"] == 'true') { $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset); if ($thumbnailURL !== FALSE) { $xmlStart = $num - 1; $thumbSize = $_SESSION["thumbnail_size"] . "px"; ob_start(); print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>"; print "\n\t<a style='cursor: pointer;'"; print " onclick='Javascript:window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL("basket", "browse_xml")); print '&start=' . $xmlStart . '", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print ")'>"; print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail thumbnail_image' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' />"; print "\n\t</a>"; print "\n</div>"; $component = new UnstyledBlock(ob_get_contents()); $component->addStyle($centered); ob_end_clean(); $container->add($component, "100%", null, CENTER, CENTER); } } ob_start(); if ($_SESSION["show_displayName"] == 'true') { print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>"; } if ($_SESSION["show_id"] == 'true') { print "\n\t<div>" . _("ID#") . ": " . $assetId->getIdString() . "</div>"; } if ($_SESSION["show_description"] == 'true') { $description = HtmlString::withValue($asset->getDescription()); $description->trim(25); print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto;'>" . $description->asString() . "</div>"; } $component = new UnstyledBlock(ob_get_contents()); ob_end_clean(); $container->add($component, "100%", null, LEFT, TOP); ob_start(); print "\n<a href='"; print $harmoni->request->quickURL("basket", "remove", array('asset_id' => $assetId->getIdString())); print "' title='" . _("Remove from Selection") . "'>"; print _('remove'); print "</a>"; print "\n | <a href='"; print $harmoni->request->quickURL("basket", "up", array('asset_id' => $assetId->getIdString())); print "' title='" . _('move up') . "'>"; // print "<img src='".POLYPHONY_PATH."/icons/basket/arrowleft.png' width='25px' border='0' alt='"._("Move Up")."' />"; print "<--"; print "</a>"; print "\n | <a href='"; print $harmoni->request->quickURL("basket", "down", array('asset_id' => $assetId->getIdString())); print "' title='" . _('move down') . "'>"; // print "<img src='".POLYPHONY_PATH."/icons/basket/arrowright.png' width='25px' border='0' alt='"._("Move Down")."' />"; print "-->"; print "</a>"; $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, RIGHT, BOTTOM); return $container; }