/** * Execute the Action * * @param object Harmoni $harmoni * @return mixed * @access public * @since 4/25/05 */ function execute() { $xLayout = new XLayout(); $yLayout = new YLayout(); $harmoni = Harmoni::instance(); $mainScreen = new Container($yLayout, BLOCK, 1); // :: Top Row :: // The top row for the logo and status bar. $headRow = new Container($xLayout, HEADER, 1); // The logo $logo = new Component("\n<a href='" . MYPATH . "/'> <img src='" . LOGO_URL . "' \n\t\t\t\t\t\t\tstyle='border: 0px;' alt='" . _("Concerto Logo'") . "/> </a>", BLANK, 1); $headRow->add($logo, null, null, LEFT, TOP); // Language Bar $harmoni->history->markReturnURL("polyphony/language/change"); $languageText = "\n<form action='" . $harmoni->request->quickURL("language", "change") . "' method='post'>"; $harmoni->request->startNamespace("polyphony"); $languageText .= "\n\t<div style='text-align: center'>\n\t<select name='" . $harmoni->request->getName("language") . "'>"; $harmoni->request->endNamespace(); $langLoc = Services::getService('Lang'); $currentCode = $langLoc->getLanguage(); $languages = $langLoc->getLanguages(); ksort($languages); foreach ($languages as $code => $language) { $languageText .= "\n\t\t<option value='" . $code . "'" . ($code == $currentCode ? " selected='selected'" : "") . ">"; $languageText .= $language . "</option>"; } $languageText .= "\n\t</select>"; $languageText .= "\n\t<input type='submit' />"; $languageText .= "\n\t</div>\n</form>"; $languageBar = new Component($languageText, BLANK, 1); $headRow->add($languageBar, null, null, LEFT, TOP); // Pretty Login Box $loginRow = new Container($yLayout, OTHER, 1); $headRow->add($loginRow, null, null, RIGHT, TOP); ob_start(); $authN = Services::getService("AuthN"); $agentM = Services::getService("Agent"); $idM = Services::getService("Id"); $authTypes = $authN->getAuthenticationTypes(); $users = ''; while ($authTypes->hasNext()) { $authType = $authTypes->next(); $id = $authN->getUserId($authType); if (!$id->isEqual($idM->getId('edu.middlebury.agents.anonymous'))) { $agent = $agentM->getAgent($id); $exists = false; foreach (explode("+", $users) as $user) { if ($agent->getDisplayName() == $user) { $exists = true; } } if (!$exists) { if ($users == '') { $users .= $agent->getDisplayName(); } else { $users .= " + " . $agent->getDisplayName(); } } } } if ($users != '') { print "\n<div style='text-align: right'><small>"; if (count(explode("+", $users)) == 1) { print _("User: "******"\t"; } else { print _("Users: ") . $users . "\t"; } print "<a href='" . $harmoni->request->quickURL("auth", "logout") . "'>" . _("Log Out") . "</a></small></div>"; } else { // set bookmarks for success and failure $harmoni->history->markReturnURL("polyphony/display_login"); $harmoni->history->markReturnURL("polyphony/login_fail", $harmoni->request->quickURL("user", "main")); $harmoni->request->startNamespace("harmoni-authentication"); $usernameField = $harmoni->request->getName("username"); $passwordField = $harmoni->request->getName("password"); $harmoni->request->endNamespace(); $harmoni->request->startNamespace("polyphony"); print "\n<div style='text-align: right'>" . "\n<form action='" . $harmoni->request->quickURL("auth", "login") . "' align='right' method='post'><small>" . "\n\t" . _("Username:"******" <input type='text' size='8' \n\t\t\t\t\tname='{$usernameField}'/>" . "\n\t" . _("Password:"******" <input type='password' size ='8' \n\t\t\t\t\tname='{$passwordField}'/>" . "\n\t <input type='submit' value='Log In' />" . "\n</small></form></div>\n"; $harmoni->request->endNamespace(); } $loginRow->add(new Component(ob_get_clean(), BLANK, 2), null, null, RIGHT, TOP); // User tools ob_start(); print "<div style='font-size: small; margin-top: 8px;'>"; print "<a href='" . $harmoni->request->quickURL("user", "main") . "'>"; print _("User Tools"); print "</a>"; print " | "; print "<a href='" . $harmoni->request->quickURL("admin", "main") . "'>"; print _("Admin Tools"); print "</a>"; print "</div>"; $loginRow->add(new Component(ob_get_clean(), BLANK, 2), null, null, RIGHT, BOTTOM); //Add the headerRow to the mainScreen $mainScreen->add($headRow, "100%", null, LEFT, TOP); // :: Center Pane :: $centerPane = $mainScreen->add(new Container($xLayout, OTHER, 1), "100%", null, LEFT, TOP); // use the result from previous actions if ($harmoni->printedResult) { $contentDestination = new Container($yLayout, OTHER, 1); $centerPane->add($contentDestination, null, null, LEFT, TOP); $contentDestination->add(new Block($harmoni->printedResult, 1), null, null, TOP, CENTER); $harmoni->printedResult = ''; } else { $contentDestination = $centerPane; } // use the result from previous actions if (is_object($harmoni->result)) { $contentDestination->add($harmoni->result, null, null, CENTER, TOP); } else { if (is_string($harmoni->result)) { $contentDestination->add(new Block($harmoni->result, STANDARD_BLOCK), null, null, CENTER, TOP); } } // Menu Column $menuColumn = $centerPane->add(new Container($yLayout, OTHER, 1), "140px", null, LEFT, TOP); // Main menu $menuGenerator = new ConcertoMenuGenerator(); $menuColumn->add($menuGenerator->generateMainMenu(), "140px", null, LEFT, TOP); // RSS Links $outputHandler = $harmoni->getOutputHandler(); if (preg_match("/^(collection|asset)\\.browse(Asset)?\$/", $harmoni->getCurrentAction()) && RequestContext::value('collection_id')) { ob_start(); print "<div style='font-size: small; padding-left: 5px;'>"; $url = $harmoni->request->quickURL('collection', 'rss_latest', array('collection_id' => RequestContext::value('collection_id'))); $title = _("RSS feed of the most recently added Assets"); $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<link rel='alternate' type='application/rss+xml'" . " title='" . $title . "' href='" . $url . "'/>"); print "\n\t\t<a href='" . $url . "' style='white-space: nowrap;' title='" . $title . "'>"; print "\n\t\t\t<img src='" . POLYPHONY_PATH . "icons/rss_icon02.png' border='0' alt='" . _("RSS Icon") . "'/>"; print "\n\t\t\t" . _("RSS: newest"); print "\n\t\t</a><br/>"; $url = $harmoni->request->quickURL('collection', 'rss_latest', array('collection_id' => RequestContext::value('collection_id'), 'order' => 'modification')); $title = _("RSS feed of the most recently changed Assets"); $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<link rel='alternate' type='application/rss+xml'" . " title='" . $title . "' href='" . $url . "'/>"); print "\n\t\t<a href='" . $url . "' style='white-space: nowrap;' title='" . $title . "'>"; print "\n\t\t\t<img src='" . POLYPHONY_PATH . "icons/rss_icon02.png' border='0' alt='" . _("RSS Icon") . "'/>"; print "\n\t\t\t" . _("RSS: recently updated"); print "\n\t\t</a>"; print "\n</div>"; $menuColumn->add(new Block(ob_get_clean(), HIGHLIT_BLOCK), "100%", null, LEFT, TOP); } /* if (preg_match("/^collections\..+$/", $harmoni->getCurrentAction())) { ob_start(); print "<div style='font-size: small; padding-left: 5px;'>"; $url = $harmoni->request->quickURL('collection', 'rss_all_latest'); $title = _("RSS feed of the most recently added Assets across all Collections"); $outputHandler->setHead($outputHandler->getHead() ."\n\t\t<link rel='alternate' type='application/rss+xml'" ." title='".$title."' href='".$url."'/>"); print "\n\t\t<a href='".$url."' style='white-space: nowrap;' title='".$title."'>"; print "\n\t\t\t<img src='".POLYPHONY_PATH."icons/rss_icon02.png' border='0' alt='"._("RSS Icon")."'/>"; print "\n\t\t\t"._("RSS: all newest"); print "\n\t\t</a><br/>"; $url = $harmoni->request->quickURL('collections', 'rss_all_latest', array('order' => 'modification')); $title = _("RSS feed of the most recently changed Assets across all Collections"); $outputHandler->setHead($outputHandler->getHead() ."\n\t\t<link rel='alternate' type='application/rss+xml'" ." title='".$title."' href='".$url."'/>"); print "\n\t\t<a href='".$url."' style='white-space: nowrap;' title='".$title."'>"; print "\n\t\t\t<img src='".POLYPHONY_PATH."icons/rss_icon02.png' border='0' alt='"._("RSS Icon")."'/>"; print "\n\t\t\t"._("RSS: all recently updated"); print "\n\t\t</a>"; print "\n</div>"; $menuColumn->add(new Block(ob_get_clean(), HIGHLIT_BLOCK), "100%", null, LEFT, TOP); } */ if (preg_match("/^exhibitions\\.browse_exhibition\$/", $harmoni->getCurrentAction()) && RequestContext::value('exhibition_id')) { ob_start(); print "<div style='font-size: small; padding-left: 5px;'>"; $url = $harmoni->request->quickURL('exhibitions', 'rss_latest_slideshows', array('exhibition_id' => RequestContext::value('exhibition_id'))); $title = _("RSS feed of the most recently added Slideshows in this Exhibition"); $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<link rel='alternate' type='application/rss+xml'" . " title='" . $title . "' href='" . $url . "'/>"); print "\n\t\t<a href='" . $url . "' style='white-space: nowrap;' title='" . $title . "'>"; print "\n\t\t\t<img src='" . POLYPHONY_PATH . "icons/rss_icon02.png' border='0' alt='" . _("RSS Icon") . "'/>"; print "\n\t\t\t" . _("RSS: newest"); print "\n\t\t</a><br/>"; $url = $harmoni->request->quickURL('exhibitions', 'rss_latest_slideshows', array('order' => 'modification', 'exhibition_id' => RequestContext::value('exhibition_id'))); $title = _("RSS feed of the most recently changed Slideshows in this Exhibition"); $outputHandler->setHead($outputHandler->getHead() . "\n\t\t<link rel='alternate' type='application/rss+xml'" . " title='" . $title . "' href='" . $url . "'/>"); print "\n\t\t<a href='" . $url . "' style='white-space: nowrap;' title='" . $title . "'>"; print "\n\t\t\t<img src='" . POLYPHONY_PATH . "icons/rss_icon02.png' border='0' alt='" . _("RSS Icon") . "'/>"; print "\n\t\t\t" . _("RSS: recently updated"); print "\n\t\t</a>"; print "\n</div>"; $menuColumn->add(new Block(ob_get_clean(), HIGHLIT_BLOCK), "100%", null, LEFT, TOP); } /* if (preg_match("/^exhibitions\.browse$/", $harmoni->getCurrentAction())) { ob_start(); print "<div style='font-size: small; padding-left: 5px;'>"; $url = $harmoni->request->quickURL('exhibitions', 'rss_latest_slideshows'); $title = _("RSS feed of the most recently added Slideshows across all Exhibitions"); $outputHandler->setHead($outputHandler->getHead() ."\n\t\t<link rel='alternate' type='application/rss+xml'" ." title='".$title."' href='".$url."'/>"); print "\n\t\t<a href='".$url."' style='white-space: nowrap;' title='".$title."'>"; print "\n\t\t\t<img src='".POLYPHONY_PATH."icons/rss_icon02.png' border='0' alt='"._("RSS Icon")."'/>"; print "\n\t\t\t"._("RSS: all newest"); print "\n\t\t</a><br/>"; $url = $harmoni->request->quickURL('exhibitions', 'rss_latest_slideshows', array('order' => 'modification')); $title = _("RSS feed of the most recently changed Slideshows across all Exhibitions"); $outputHandler->setHead($outputHandler->getHead() ."\n\t\t<link rel='alternate' type='application/rss+xml'" ." title='".$title."' href='".$url."'/>"); print "\n\t\t<a href='".$url."' style='white-space: nowrap;' title='".$title."'>"; print "\n\t\t\t<img src='".POLYPHONY_PATH."icons/rss_icon02.png' border='0' alt='"._("RSS Icon")."'/>"; print "\n\t\t\t"._("RSS: all recently updated"); print "\n\t\t</a>"; print "\n</div>"; $menuColumn->add(new Block(ob_get_clean(), HIGHLIT_BLOCK), "100%", null, LEFT, TOP); } */ // Basket $basket = Basket::instance(); if (preg_match("/^(collection|asset)\\.browse(Asset)?\$/", $harmoni->getCurrentAction())) { $menuColumn->add(AssetPrinter::getMultiEditOptionsBlock(), "100%", null, LEFT, TOP); } $menuColumn->add($basket->getSmallBasketBlock(EMPHASIZED_BLOCK), "100%", null, LEFT, TOP); // Collection Tags if (preg_match("/^(collection|asset|tags)\\./", $harmoni->getCurrentAction()) && $this->getCurrentRepository()) { $harmoni->request->passthrough("collection_id"); $harmoni->request->passthrough("asset_id"); $menuColumn->add(new Block("<strong>" . _("Tags in this Collection: ") . "</strong>" . TagAction::getTagCloudForRepository($this->getCurrentRepository(), 'concerto'), EMPHASIZED_BLOCK), "100%", null, LEFT, TOP); $harmoni->request->forget("collection_id"); $harmoni->request->forget("asset_id"); } // :: Footer :: $footer = new Container(new XLayout(), FOOTER, 1); $helpText = "<a target='_blank' href='"; $helpText .= $harmoni->request->quickURL("help", "browse_help"); $helpText .= "'>" . _("Help") . "</a>"; $footer->add(new UnstyledBlock($helpText), "50%", null, LEFT, BOTTOM); if (!isset($_SESSION['ConcertoVersion'])) { $document = new DOMDocument(); // attempt to load (parse) the xml file if ($document->load(MYDIR . "/doc/raw/changelog/changelog.xml")) { $versionElems = $document->getElementsByTagName("version"); $latest = $versionElems->item(0); $_SESSION['ConcertoVersion'] = $latest->getAttribute('number'); if (preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/', $latest->getAttribute('date'), $matches)) { $_SESSION['ConcertoCopyrightYear'] = $matches[1]; } else { $_SESSION['ConcertoCopyrightYear'] = $latest->getAttribute('date'); } } else { $_SESSION['ConcertoVersion'] = "2.x.x"; $_SESSION['ConcertoCopyrightYear'] = "2006"; } } $footerText = "<a href='" . $harmoni->request->quickURL('window', 'changelog') . "' target='_blank'>Concerto v." . $_SESSION['ConcertoVersion'] . "</a> "; $footerText .= "©" . $_SESSION['ConcertoCopyrightYear'] . " Middlebury College <a href='http://concerto.sourceforge.net'>"; $footerText .= _("about"); $footerText .= "</a>"; $footer->add(new UnstyledBlock($footerText), "50%", null, RIGHT, BOTTOM); $mainScreen->add($footer, "100%", null, RIGHT, BOTTOM); return $mainScreen; }
function printAssetShort($asset, $harmoni) { ob_start(); $assetId = $asset->getId(); print "\n\t<strong>" . $asset->getDisplayName() . "</strong> - " . _("ID#") . ": " . $assetId->getIdString(); $description = HtmlString::withValue($asset->getDescription()); $description->trim(25); print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>"; AssetPrinter::printAssetFunctionLinks($harmoni, $asset); $layout = new Block(ob_get_contents(), 3); ob_end_clean(); return $layout; }
function printAssetShort($asset, $harmoni) { ob_start(); $assetId = $asset->getId(); print "\n\t<strong>" . $asset->getDisplayName() . "</strong> - " . _("ID#") . ": " . $assetId->getIdString(); print "\n\t<br /><em>" . $asset->getDescription() . "</em>"; print "\n\t<br />"; AssetPrinter::printAssetFunctionLinks($harmoni, $asset); $layout = new Block(ob_get_contents(), 4); ob_end_clean(); return $layout; }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $asset = $this->getAsset(); $repositoryId = $this->getRepositoryId(); // function links ob_start(); AssetPrinter::printAssetFunctionLinks($harmoni, $asset); $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, "100%", null, LEFT, CENTER); // Columns for Description and thumbnail. $xLayout = new XLayout(); $contentCols = new Container($xLayout, OTHER, 1); $actionRows->add($contentCols, "100%", null, LEFT, CENTER); // Description and dates ob_start(); $assetId = $asset->getId(); print "\n\t<dl>"; 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 >"; try { print $asset->getAssetType()->asString(); } catch (UnimplementedException $e) { print "unknown"; } print "</dd>"; try { $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>"; } catch (UnimplementedException $e) { } try { $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>"; } catch (UnimplementedException $e) { } try { 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>"; } } catch (UnimplementedException $e) { } try { 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>"; } catch (UnimplementedException $e) { } $contentCols->add(new Block(ob_get_clean(), STANDARD_BLOCK), "60%", null, LEFT, TOP); // 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 ob_start(); print "\n\t<div style='font-weight: bold; margin-bottom: 10px;'>" . _("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>"; $contentCols->add(new Block(ob_get_clean(), STANDARD_BLOCK), "40%", null, LEFT, TOP); //*********************************** // Info Records //*********************************** ob_start(); $printedRecordIds = array(); // Get the set of RecordStructures so that we can print them in order. $setManager = Services::getService("Sets"); $structSet = $setManager->getPersistentSet($repositoryId); if ($structSet->hasNext()) { // First, lets go through the info structures listed in the set and print out // the info records for those structures in order. while ($structSet->hasNext()) { $structureId = $structSet->next(); $records = $asset->getRecordsByRecordStructure($structureId); while ($records->hasNext()) { $record = $records->next(); $recordId = $record->getId(); $printedRecordIds[] = $recordId->getIdString(); print "<hr />"; printRecord($repositoryId, $assetId, $record); } } } else { $structures = $asset->getRecordStructures(); while ($structures->hasNext()) { $structure = $structures->next(); $structureId = $structure->getId(); $records = $asset->getRecordsByRecordStructure($structureId); while ($records->hasNext()) { $record = $records->next(); $recordId = $record->getId(); $printedRecordIds[] = $recordId->getIdString(); print "<hr />"; printRecord($repositoryId, $assetId, $record); } } } $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, "100%", null, LEFT, CENTER); //*********************************** // Content // If we can, we may want to print the content here. // @todo Add some sniffing of content so that we can either put it in if // it is text, image, etc, or do otherwise with it if it is some other form // of data. //*********************************** try { $content = $asset->getContent(); if ($string = $content->asString()) { ob_start(); print "\n<textarea readonly='readonly' rows='30' cols='80'>"; print htmlspecialchars($string); print "</textarea>"; $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, "100%", null, LEFT, CENTER); } } catch (UnimplementedException $e) { } }
/** * 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); }
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; }