/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { ob_start(); if (is_object($this->_id)) { $repositoryManager = Services::getService('Repository'); try { $asset = $repositoryManager->getAsset($this->_id); print "\n<table border='0'>"; print "\n\t<tr>\n\t\t<td>"; $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($this->_id); if ($thumbnailURL !== FALSE) { // print "\n\t<br /><a href='".$assetViewUrl."'>"; print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' class='thumbnail_image' />"; // print "\n\t</a>"; } print "\n\t\t</td>\n\t\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print _("Id: ") . $this->_id->getIdString(); print "\n\t\t</td>\n\t\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print _("Name: ") . $asset->getDisplayName(); print "\n\t\t</td>\n\t\t</tr>"; print "\n</table>"; } catch (UnknownIdException $e) { print "\n<div style='margin: 10px; padding: 10px; border: 1px dotted;'>"; print _("The target Asset has been deleted or is no longer available."); print "</div>"; } } $m = ob_get_contents(); ob_end_clean(); return $m; }
/** * Answer the XHTML string of the small version of the basket contents * * @param <##> * @return <##> * @access public * @since 5/2/06 */ function getSmallBasketHtml() { $this->addHeadJavascript(); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("basket"); $this->clean(); ob_start(); print "\n\t<a href='"; print $harmoni->request->quickURL("basket", "view"); print "'>"; print _("Selection: "); print "(" . $this->count() . " " . _("items") . ")"; print "</a>"; print "\n\t<div id='basket_small_contents' style='text-align: left; min-width: 200px;'>"; $this->reset(); $i = 0; if ($this->hasNext()) { while ($this->hasNext()) { $id = $this->next(); $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($id); if ($thumbnailURL !== FALSE) { print "\n\t<div style='border: 1px solid; height: 60px; width: 60px; float: left; text-align: center; vertical-align: middle; padding: 0px; margin: 2px;'>"; // The image print "\n\t\t<img class='thumbnail_image' \n\t\t\tsrc='{$thumbnailURL}' \n\t\t\talt='Thumbnail Image'"; print " \n\t\t\tstyle='max-height: 50px; max-width: 50px; vertical-align: middle; margin: 5px; cursor: pointer;'"; // border removal print " \n\t\t\tonload=\"if (this.parentNode) { this.parentNode.style.border='0px'; this.parentNode.style.margin='3px'; } /* Resize images for IE */ if (this.height > 50 || this.width > 50) {this.width = 50;}\" "; // Viewer Link print " \n\t\t\tonclick='window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL("basket", "browse_xml")); print '&start=' . $i . '", '; 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/>"; print "\n\t</div>"; $i++; } } } print "\n\t</div>"; print <<<END \t \t<script type='text/javascript'> \t// <![CDATA[ \t \t\tBasket.removeBorders(); \t \t// ]]> \t</script> \t\t END; if ($this->count()) { print "\n\t<div style='text-align: right; font-size: small; clear: both;'>"; print "<a onclick='Basket.empty()'>" . _("Empty") . "</a>"; print "\n\t</div>"; } $harmoni->request->endNamespace(); return ob_get_clean(); }
function printAssetShort($asset, $harmoni) { $idManager = Services::getService("Id"); $harmoni = Harmoni::instance(); /********************************************************* * Get number of slides and first thumbnail. *********************************************************/ $slides = $asset->getAssets(); $count = 0; while ($slides->hasNext()) { $slideAsset = $slides->next(); $count++; if (!isset($firstMediaUrl)) { $slideRecords = $slideAsset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure")); if ($slideRecords->hasNext()) { $slideRecord = $slideRecords->next(); // Media $mediaIdStringObj = browse_exhibitionAction::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()); $firstMediaUrl = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaId); } } } } $assetId = $asset->getId(); ob_start(); if (isset($firstMediaUrl) && $firstMediaUrl) { print "<a href='#' onclick='window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL("exhibitions", "slideshowOutlineXml", array("slideshow_id" => $assetId->getIdString()))); print '", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print "); return false;'>"; print "\n<img src='" . $firstMediaUrl . "' style='float: right; max-height: 200px; max-width: 200px;' class='thumbnail_image'/>"; print "</a>"; } print "\n\t<div style='font-weight: bold' title='" . _("ID#") . ": " . $assetId->getIdString() . "'>" . $asset->getDisplayName() . "</div>"; print "\n\t<div style='font-size: smaller; margin-bottom: 10px; margin-left: 20px; margin-right: 20px; white-space: nowrap;'>(" . $count . " " . _("slides") . ")</div>"; $description = HtmlString::withValue($asset->getDescription()); $description->clean(); print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>"; print "\n<div style='clear: both; white-space: nowrap;'>"; SlideShowPrinter::printFunctionLinks($asset); print "</div>"; $layout = new Block(ob_get_contents(), EMPHASIZED_BLOCK); ob_end_clean(); return $layout; }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $this->init(); $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $asset = $this->getAsset(); $assetId = $asset->getId(); // function links ob_start(); AssetPrinter::printAssetFunctionLinks($harmoni, $asset); $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, CENTER, CENTER); ob_start(); print "\n<table width='100%'>\n<tr><td style='text-align: left; vertical-align: top'>"; print "\n\t<dl>"; if ($asset->getDisplayName()) { print "\n\t\t<dt style='font-weight: bold;'>" . _("Title:") . "</dt>"; print "\n\t\t<dd>" . $asset->getDisplayName() . "</dd>"; } if ($asset->getDescription()) { $description = HtmlString::withValue($asset->getDescription()); $description->clean(); print "\n\t\t<dt style='font-weight: bold;'>" . _("Description:") . "</dt>"; print "\n\t\t<dd>" . $description->asString() . "</dd>"; } print "\n\t\t<dt style='font-weight: bold;'>"; print _("ID#"); print ":</dt>\n\t\t<dd >"; print $assetId->getIdString(); print "</dd>"; print "\n\t\t<dt style='font-weight: bold;'>"; print _("Type"); print ":</dt>\n\t\t<dd >"; print $asset->getAssetType()->asString(); print "</dd>"; $date = $asset->getModificationDate(); print "\n\t\t<dt style='font-weight: bold;'>"; print _("Modification Date"); print ":</dt>\n\t\t<dd >"; print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation(); print "</dd>"; $date = $asset->getCreationDate(); print "\n\t\t<dt style='font-weight: bold;'>"; print _("Creation Date"); print ":</dt>\n\t\t<dd >"; print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation(); print "</dd>"; if (is_object($asset->getEffectiveDate())) { $date = $asset->getEffectiveDate(); print "\n\t\t<dt style='font-weight: bold;'>"; print _("Effective Date"); print ":</dt>\n\t\t<dd >"; print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation(); print "</dd>"; } if (is_object($asset->getExpirationDate())) { $date = $asset->getExpirationDate(); print "\n\t\t<dt style='font-weight: bold;'>"; print _("Expiration Date"); print ":</dt>\n\t\t<dd >"; print $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year() . " " . $date->hmsString() . " " . $date->timeZoneAbbreviation(); print "</dd>"; } print "\n\t</dl>"; print "\n</td><td style='text-align: right; vertical-align: top'>"; $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($assetId); if ($thumbnailURL !== FALSE) { print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' align='right' class='thumbnail_image' style='margin-bottom: 5px;' />"; } // Add the tagging manager script to the header $outputHandler = $harmoni->getOutputHandler(); $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "javascript/Tagger.js'></script>" . "\n\t\t<link rel='stylesheet' type='text/css' href='" . POLYPHONY_PATH . "javascript/Tagger.css' />"); // Tags print "\n\t<div style='font-weight: bold; margin-bottom: 10px; text-align: left; clear: both;'>" . _("Tags given to this Asset: ") . "</div>"; print "\n\t<div style=' text-align: justify;'>"; print TagAction::getTagCloudForItem(TaggedItem::forId($assetId, 'concerto'), 'view'); print "\n\t</div>"; print "\n</td></tr></table>"; // print "\n\t<hr/>"; $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, LEFT, CENTER); ob_end_clean(); $searchBar = new Container(new YLayout(), BLOCK, STANDARD_BLOCK); $actionRows->add($searchBar, "100%", null, CENTER, CENTER); //*********************************** // Get the assets to display //*********************************** $assets = $asset->getAssets(); $tmpAssets = array(); while ($assets->hasNext()) { $asset = $assets->next(); switch ($_SESSION["asset_order"]) { case 'DisplayName': $assetKey = $asset->getDisplayName(); break; case 'Id': $id = $asset->getId(); $assetKey = $id->getIdString(); break; case 'ModificationDate': $date = $asset->getModificationDate(); $assetKey = $date->asString(); break; case 'CreationDate': $date = $asset->getCreationDate(); $assetKey = $date->asString(); break; default: $assetKey = '0'; } $i = 0; while (isset($tmpAssets[$assetKey . "_" . $i])) { $i++; } $tmpAssets[$assetKey . "_" . $i] = $asset; } if ($_SESSION["asset_order_direction"] == 'ASC') { ksort($tmpAssets); } else { krsort($tmpAssets); } //*********************************** // print the results //*********************************** $resultPrinter = new ArrayResultPrinter($tmpAssets, $_SESSION["asset_columns"], $_SESSION["assets_per_page"], array($this, "printAssetShort"), $this->getParams()); $resultPrinter->setStartingNumber($this->_state['startingNumber']); $resultLayout = $resultPrinter->getLayout(array($this, "canView")); $resultLayout->setPreHTML("<form id='AssetMultiEditForm' name='AssetMultiEditForm' action='' method='post'>"); $resultLayout->setPostHTML("</form>"); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); /********************************************************* * Display options *********************************************************/ $currentUrl = $harmoni->request->mkURL(); $searchBar->setPreHTML("\n<form action='" . $currentUrl->write() . "' method='post'>\n\t<input type='hidden' name='" . RequestContext::name('form_submitted') . "' value='true'/>"); $searchBar->setPostHTML("\n</form>"); ob_start(); print "\n\t<strong>" . _("Child Assets") . ":</strong>"; $searchBar->add(new UnstyledBlock(ob_get_clean()), null, null, LEFT, TOP); $searchBar->add($this->getDisplayOptions($resultPrinter), null, null, LEFT, TOP); }
/** * Create a new Wizard for this action. Caching of this Wizard is handled by * {@link getWizard()} and does not need to be implemented here. * * @return object Wizard * @access public * @since 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); /********************************************************* * Asset thumbnails: Generate a text string and attach to * the wizard for later retrieval. *********************************************************/ ob_start(); $assetIds = array(); for ($i = 0; $i < count($this->_assets); $i++) { $asset = $this->_assets[$i]; $assetId = $asset->getId(); $assetIds[] = $assetId->getIdString(); } $params = array(); $params["assetIds"] = implode(",", $assetIds); for ($i = 0; $i < count($this->_assets) && $i < 10; $i++) { $asset = $this->_assets[$i]; $assetId = $asset->getId(); $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset); if ($thumbnailURL !== FALSE) { $thumbSize = "100px"; print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto; float: left; text-align: center;'>"; print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail thumbnail_image' alt='Thumbnail Image' border='0'"; print " onclick='Javascript:window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL('asset', "viewAssetsXml", $params)); print '&start=' . $i . '", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print ")'"; print " style='max-height: {$thumbSize}; max-width: {$thumbSize}; vertical-align: middle; cursor: pointer;'"; print " />"; print "\n</div>"; } } if ($i < count($this->_assets)) { print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto; float: left; text-align: center; vertical-align: middle;'>"; print _(" (and ") . (count($this->_assets) - $i) . _(" more) "); print "\n</div>"; } $wizard->assetThumbnails = ob_get_clean(); /********************************************************* * :: Asset Properties :: *********************************************************/ $wizard->addStep("assetproperties", $this->getAssetPropertiesStep()); /********************************************************* * :: Record Structures :: *********************************************************/ $repository = $this->getRepository(); $repositoryId = $this->getRepositoryId(); if (!$repository) { throw new Exception("Repository not found"); } // Get the set of RecordStructures so that we can print them in order. $setManager = Services::getService("Sets"); $recStructSet = $setManager->getPersistentSet($repositoryId); // File Record Id $idManager = Services::getService("Id"); $fileRecStructId = $idManager->getId('FILE'); $remoteFileRecStructId = $idManager->getId('REMOTE_FILE'); // First, lets go through the info structures listed in the set and print out // the info records for those structures in order. while ($recStructSet->hasNext()) { $recStructId = $recStructSet->next(); if (in_array($recStructId->getIdString(), $this->_recStructsToIgnore)) { continue; } if ($recStructId->isEqual($fileRecStructId)) { if ($fileRecordStep = $this->getFileRecordsStep()) { $wizard->addStep("filestep", $fileRecordStep); } } else { if ($recStructId->isEqual($remoteFileRecStructId)) { if ($fileRecordStep = $this->getRemoteFileRecordsStep()) { $wizard->addStep("remotefilestep", $fileRecordStep); } } else { $recStruct = $repository->getRecordStructure($recStructId); $wizard->addStep($recStructId->getIdString(), $this->getRecordStructureStep($recStruct)); } } } /********************************************************* * :: Content :: *********************************************************/ $step = $this->getAssetContentStep(); if (!is_null($step)) { $wizard->addStep("contentstep", $step); } /********************************************************* * :: Content :: *********************************************************/ $step = $this->getParentStep(); if (!is_null($step)) { $wizard->addStep("parentstep", $step); } $wizard->initialState = $wizard->getAllValues(); return $wizard; }
function printAssetShort($asset, $harmoni) { ob_start(); $assetId = $asset->getId(); print "\n\t<div style='font-weight: bold' title='" . _("ID#") . ": " . $assetId->getIdString() . "'>" . $asset->getDisplayName() . "</div>"; $description = HtmlString::withValue($asset->getDescription()); $description->trim(100); print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>"; ExhibitionPrinter::printFunctionLinks($asset); $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($assetId); if ($thumbnailURL !== FALSE) { print "\n\t<br /><a href='"; print $harmoni->request->quickURL("asset", "view", array('asset_id' => $assetId->getIdString())); print "'>"; print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' class='thumbnail_image' />"; print "\n\t</a>"; } $layout = new Block(ob_get_contents(), EMPHASIZED_BLOCK); ob_end_clean(); return $layout; }
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; }
/** * Add an Asset to the feed * * @param object Asset $asset * @return object RSSItem * @access public * @since 8/8/06 */ function getAssetItem($asset) { $harmoni = Harmoni::instance(); $idManager = Services::getService("IdManager"); $assetId = $asset->getId(); $item = new RSSItem(); $item->setTitle($asset->getDisplayName()); $item->addCategory("Slideshow"); $item->setPubDate($asset->getModificationDate()); $item->setLink(VIEWER_URL . "?&source=" . urlencode($harmoni->request->quickURL("exhibitions", "slideshowOutlineXml", array("slideshow_id" => $assetId->getIdString())))); /********************************************************* * Get number of slides and first thumbnail. *********************************************************/ $slides = $asset->getAssets(); $count = 0; while ($slides->hasNext()) { $slideAsset = $slides->next(); $count++; if (!isset($firstMediaUrl)) { $slideRecords = $slideAsset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure")); if ($slideRecords->hasNext()) { $slideRecord = $slideRecords->next(); // Media $mediaIdStringObj = $this->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()); $firstMediaUrl = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaId); } } } } /********************************************************* * item description text. *********************************************************/ ob_start(); if (isset($firstMediaUrl)) { print "\n<img src='" . $firstMediaUrl . "' style='float: right'/>"; } print "\n<div style='margin-bottom: 10px'>" . $asset->getDescription() . "</div>"; print "\n<div style='clear: both'>(" . $count . " " . _("slides") . ")</div>"; $item->setDescription(ob_get_clean()); return $item; }
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 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; }