/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("basket"); $idManager = Services::getService("Id"); $authZ = Services::getService("AuthZ"); $basket = Basket::instance(); $basket->clean(); $basket->reset(); //*********************************** // Things to do with your basket //*********************************** ob_start(); print _("Basket") . ": "; // perhaps there will be enough links sometime for this function // BasketPrinter::printBasketFunctionLinks($harmoni, $basket); print "<a href=\"" . $harmoni->request->quickURL("basket", "export") . "\">" . _("Export Selection(<em>Assets</em>)") . "</a>"; print " | "; print "<a href=\"" . $harmoni->request->quickURL("basket", "empty") . "\">" . _("Empty Selection") . "</a>"; $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, "100%", null, CENTER, CENTER); //*********************************** // print the results //*********************************** $resultPrinter = new IteratorResultPrinter($basket, 3, 6, "printAssetShort"); $resultLayout = $resultPrinter->getLayout("viewAction::canView"); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); $harmoni->request->endNamespace(); }
/** * Add display of tags * * @return Component * @access public * @since 4/7/08 */ public function getResult() { $harmoni = Harmoni::instance(); $items = $this->getItems(); $resultPrinter = new IteratorResultPrinter($items, 1, 5, array($this, 'getTaggedItemComponent'), $this->getViewAction()); $resultLayout = $resultPrinter->getLayout(array($this, "canViewItem")); return $resultLayout; }
/** * Add display of tags * * @param Component $mainScreen * @return Component * @access public * @since 4/7/08 */ public function getResult() { $harmoni = Harmoni::instance(); $items = $this->getItems(); $resultPrinter = new IteratorResultPrinter($items, 1, 5, array($this, 'getTaggedItemComponent'), $this->getViewAction()); $resultLayout = $resultPrinter->getLayout(array($this, "canViewItem")); // $mainScreen->add($resultLayout, "100%", null, LEFT, CENTER); // $mainScreen->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); return $resultLayout; }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $repository = $this->getRepository(); // The type $type = HarmoniType::fromString(urldecode(RequestContext::value('type'))); // function links ob_start(); print _("Collection") . ": "; RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository); $layout = new Block(ob_get_contents(), 2); ob_end_clean(); $actionRows->add($layout, null, null, CENTER, CENTER); // Get the assets to display $assets = $repository->getAssetsByType($type); // print the results $resultPrinter = new IteratorResultPrinter($assets, 2, 6, "printAssetShort", $harmoni); $resultLayout = $resultPrinter->getLayout("canView"); $actionRows->add($resultLayout, null, null, CENTER, CENTER); }
/** * Build the content for this action * * @return void * @access public * @since 11/07/06 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); // ob_start(); $harmoni = Harmoni::instance(); $harmoni->request->startNamespace("polyphony-tags"); $actionRows->add(new Block(TagAction::getTagMenu(), STANDARD_BLOCK), "100%", null, LEFT, TOP); // Related Tags ob_start(); print "<h3 style='margin-top: 0px; margin-bottom: 0px;'>" . _("Related Tags:") . "</h3>"; $tag = $this->getTag(); print TagAction::getTagCloudDiv($tag->getRelatedTags(TAG_SORT_FREQ), 'view', 100); $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); $items = $this->getItems(); $resultPrinter = new IteratorResultPrinter($items, 1, 5, 'getTaggedItemComponent', $this->getViewAction()); $resultLayout = $resultPrinter->getLayout("canViewItem"); // $resultLayout =$resultPrinter->getLayout(); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); // $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); $harmoni->request->endNamespace(); textdomain($defaultTextDomain); }
/** * Build the content for this action * * @return void * @access public * @since 11/07/06 */ function buildContent() { $defaultTextDomain = textdomain("polyphony"); $actionRows = $this->getActionRows(); // ob_start(); $harmoni = Harmoni::instance(); $harmoni->request->passthrough('collection_id'); $harmoni->request->startNamespace("polyphony-tags"); $harmoni->request->passthrough('repository_id'); $harmoni->request->passthrough('system'); $actionRows->add(new Block(TagAction::getTagMenu(), STANDARD_BLOCK), "100%", null, LEFT, TOP); $items = $this->getItems(); $resultPrinter = new IteratorResultPrinter($items, 1, 5, 'getTaggedItemComponent', $this->getViewAction()); $resultLayout = $resultPrinter->getLayout("canViewItem"); // $resultLayout =$resultPrinter->getLayout(); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); // $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP); $harmoni->request->forget('repository_id'); $harmoni->request->forget('system'); $harmoni->request->endNamespace(); textdomain($defaultTextDomain); $harmoni->request->passthrough('collection_id'); }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $repository = $this->getRepository(); // get the search type. $searchType = HarmoniType::fromString(urldecode(RequestContext::value('search_type'))); // Get the Search criteria $searchModules = Services::getService("RepositorySearchModules"); $searchCriteria = $searchModules->getSearchCriteria($repository, $searchType); // function links ob_start(); print _("Collection") . ": "; RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository); $layout = new Block(ob_get_contents(), 2); ob_end_clean(); $actionRows->add($layout, null, null, CENTER, CENTER); ob_start(); print "<p>"; print _("Some <em>Collections</em>, <em>Exhibitions</em>, <em>Assets</em>, and <em>Slide-Shows</em> may be restricted to certain users or groups of users. Log in above to ensure your greatest access to all parts of the system."); print "</p>"; $introText = new Block(ob_get_contents(), 2); ob_end_clean(); $actionRows->add($introText, null, null, CENTER, CENTER); //*********************************** // Get the assets to display //*********************************** $assets = $repository->getAssetsBySearch($searchCriteria, $searchType, new HarmoniProperties(new Type('Repository', 'edu.middlebury', 'null'))); //*********************************** // print the results //*********************************** $resultPrinter = new IteratorResultPrinter($assets, 2, 6, "printAssetShort", $harmoni); $resultLayout = $resultPrinter->getLayout(); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $idManager = Services::getService("Id"); $repositoryManager = Services::getService("Repository"); $exhibitionRepositoryId = $idManager->getId("edu.middlebury.concerto.exhibition_repository"); $repository = $repositoryManager->getRepository($exhibitionRepositoryId); // If the Repository supports searching of root assets, just get those $hasRootSearch = FALSE; $rootSearchType = new HarmoniType("Repository", "edu.middlebury.harmoni", "RootAssets", ""); $searchTypes = $repository->getSearchTypes(); while ($searchTypes->hasNext()) { if ($rootSearchType->isEqual($searchTypes->next())) { $hasRootSearch = TRUE; break; } } ob_start(); print "<p>"; print _("Some <em>Exhibitions</em> and <em>Slide-Shows</em> may be restricted to certain users or groups of users. Log in above to ensure your greatest access to all parts of the system."); print "</p>"; $authZ = Services::getService("AuthZ"); //===== Create Link =====// if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $exhibitionRepositoryId)) { print "\n<p>"; print "\n\t<a href='" . $harmoni->request->quickURL("exhibitions", "create_exhibition") . "'>" . _("Create a new <em>Exhibition</em>") . "</a>"; //===== Import Link =====// // $harmoni->request->startNamespace("import"); // print "\t|\t<a href='". // $harmoni->request->quickURL("exhibitions", "import_exhibition"). // "'>". // _("Import <em>Exhibition(s)</em>"). // "</a>"; // $harmoni->request->endNamespace(); print "\n</p>"; } $introText = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($introText, "100%", null, CENTER, CENTER); //*********************************** // Get the assets to display //*********************************** if ($hasRootSearch) { $criteria = NULL; $searchProperties = new HarmoniProperties(HarmoniType::fromString("repository::harmoni::order")); $searchProperties->addProperty("order", $arg = "DisplayName"); unset($arg); $searchProperties->addProperty("direction", $arg = "ASC"); unset($arg); $assets = $repository->getAssetsBySearch($criteria, $rootSearchType, $searchProperties); } else { $assets = $repository->getAssets(); } //*********************************** // print the results //*********************************** $resultPrinter = new IteratorResultPrinter($assets, 1, 20, "printAssetShort", $harmoni); $resultLayout = $resultPrinter->getLayout("canView"); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $this->init(); $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $repository = $this->getRepository(); // function links ob_start(); print _("Collection") . ": "; RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository); $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, "100%", null, CENTER, CENTER); $searchBar = new Container(new YLayout(), BLOCK, STANDARD_BLOCK); $actionRows->add($searchBar, "100%", null, CENTER, CENTER); // Limit selection form $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(); // search fields print "\n<div style='margin-bottom: 10px;'>"; $searchModuleManager = Services::getService("RepositorySearchModules"); // print _("Search").": "; print "\n\t<select name='" . RequestContext::name("searchtype") . "'"; print " onchange='this.form.submit();'>"; $types = $repository->getSearchTypes(); while ($types->hasNext()) { $type = $types->next(); print "\n\t\t<option value='" . $type->asString() . "'"; if ($this->_state['searchtype']->isEqual($type)) { print " selected='selected'"; } print ">" . $type->getKeyword() . "</option>"; } print "\n\t</select>"; // print "\n\t<div style='margin-left: 25px;'>"; print "\n\t\t" . $searchModuleManager->createSearchFields($repository, $this->_state['searchtype']); // submit print "\n\t<input type='submit' value='" . _("Search") . "' />"; // print "\n\t</div>"; print "\n</div>"; // Type limits print "\n<div style='margin-bottom: 10px;'>"; print "\n\t<input type='checkbox' onchange='TypeLimitList.toggle(this, this.nextSibling.nextSibling);'"; print " name='" . RequestContext::name("limit_by_type") . "'"; print " value='true'"; if ($this->_state["limit_by_type"] == 'true') { print " checked='checked'"; $typesDisplay = 'block'; } else { $typesDisplay = 'none'; } print "/>" . _("Limit to Types...") . " "; print "\n\t<div id='listDiv' style='margin-left:25px; display: " . $typesDisplay . ";'>"; if ($this->_state["limit_by_type"] == 'true') { print "\n\t<table border='0'>"; print "\n\t\t<tr>"; $i = 0; $types = $repository->getAssetTypes(); $selectedTypes = array(); while ($types->hasNext()) { print "\n\t\t\t<td>"; $type = $types->next(); print "\n\t\t\t\t<input type='checkbox'"; print " name='" . RequestContext::name("type___" . $type->asString()) . "'"; print " value='true'"; if (array_key_exists($type->asString(), $this->_state["selectedTypes"])) { print " checked='checked'"; } print "/>" . $type->getKeyword() . ""; print "\n\t\t\t<td>"; $i++; if ($i % 4 == 0) { print "\n\t\t</tr>\n\t\t<tr>"; } } print "\n\t\t</tr>"; print "\n\t</table>"; } print "\n\t</div>"; $repositoryId = $repository->getId(); $loadListUrl = str_replace('&', '&', $harmoni->request->quickUrl('collection', 'typeList', array('collection_id', $repositoryId->getIdString()))); $errorString = _('error'); $loadingString = _('loading types'); print <<<END \t<script type='text/javascript'> \t/* <![CDATA[ */ \t\t \t\t/** \t\t * The type limit list, a static class for managing the type limit list \t\t * \t\t * @since 5/10/06 \t\t */ \t\tfunction TypeLimitList () { \t\t\t \t\t} \t\t \t\t/** \t\t * Toggle the showing and collapsing of the type limit list \t\t * \t\t * @param element listDiv \t\t * @return void \t\t * @access public \t\t * @since 5/10/06 \t\t */ \t\tTypeLimitList.toggle = function (checkbox, listDiv) { \t\t\tif (!checkbox.checked) { \t\t\t\tlistDiv.style.display = 'none'; \t\t\t\tTypeLimitList.uncheckChildren(listDiv); \t\t\t\treturn; \t\t\t} else { \t\t\t\t// if we have not loaded our table, load it via AJAX \t\t\t\tvar hasChildTable = false; \t\t\t\tfor (var i = 0; i < listDiv.childNodes.length; i++) { \t\t\t\t\tif (listDiv.childNodes[i].nodeName.toUpperCase() == 'TABLE') { \t\t\t\t\t\thasChildTable = true; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t} \t\t\t\t \t\t\t\tif (!hasChildTable) { \t\t\t\t\tTypeLimitList.load(listDiv, '{$loadListUrl}'); \t\t\t\t} \t\t\t\t \t\t\t\tlistDiv.style.display = 'block'; \t\t\t\tTypeLimitList.checkChildren(listDiv); \t\t\t} \t\t} \t\t \t\t/** \t\t * uncheck all of the descendent checkboxes of a node \t\t * \t\t * @param element node \t\t * @return void \t\t * @access public \t\t * @since 5/10/06 \t\t */ \t\tTypeLimitList.load = function( destinationNode, url ) { \t\t\t/********************************************************* \t\t\t * Do the AJAX request and repopulate the basket with \t\t\t * the contents of the result \t\t\t *********************************************************/ \t\t\t \t\t\tdestinationNode.innerHTML = "<div style='text-decoration: blink;'>{$loadingString}</div>"; \t\t\t\t\t\t \t\t\t// branch for native XMLHttpRequest object (Mozilla, Safari, etc) \t\t\tif (window.XMLHttpRequest) \t\t\t\tvar req = new XMLHttpRequest(); \t\t\t\t \t\t\t// branch for IE/Windows ActiveX version \t\t\telse if (window.ActiveXObject) \t\t\t\tvar req = new ActiveXObject("Microsoft.XMLHTTP"); \t\t\t \t\t\t \t\t\tif (req) { \t\t\t\treq.onreadystatechange = function () { \t\t\t\t\t// only if req shows "loaded" \t\t\t\t\tif (req.readyState == 4) { \t\t\t\t\t\t// only if we get a good load should we continue. \t\t\t\t\t\tif (req.status == 200) { \t\t\t\t\t\t\tdestinationNode.innerHTML = req.responseText; \t\t\t\t\t\t\tTypeLimitList.checkChildren(destinationNode); \t\t\t\t\t\t} else { \t\t\t\t\t\t\tdestinationNode.innerHTML = "<div style='background-color: #FAA; border: 1px solid; padding: 5px;'>{$errorString}</div>"; \t\t\t\t\t\t\talert("There was a problem retrieving the XML data:\\n" + \t\t\t\t\t\t\t\treq.statusText); \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t} \t\t\t\t \t\t\t\treq.open("GET", url, true); \t\t\t\treq.send(null); \t\t\t} \t\t} \t\t \t\t/** \t\t * uncheck all of the descendent checkboxes of a node \t\t * \t\t * @param element node \t\t * @return void \t\t * @access public \t\t * @since 5/10/06 \t\t */ \t\tTypeLimitList.uncheckChildren = function( node ) { \t\t\tif (node.type == 'checkbox') { \t\t\t\tnode.checked = false; // \t\t\t\talert('unchecking: ' + node.name); \t\t\t} \t\t\t \t\t\tfor (var i = 0; i < node.childNodes.length; i++) { \t\t\t\tTypeLimitList.uncheckChildren(node.childNodes[i]); \t\t\t} \t\t} \t\t \t\t/** \t\t * check all of the descendent checkboxes of a node \t\t * \t\t * @param element node \t\t * @return void \t\t * @access public \t\t * @since 5/10/06 \t\t */ \t\tTypeLimitList.checkChildren = function( node ) { \t\t\tif (node.type == 'checkbox') { \t\t\t\tnode.checked = true; // \t\t\t\talert('checking: ' + node.name); \t\t\t} \t\t\t \t\t\tfor (var i = 0; i < node.childNodes.length; i++) { \t\t\t\tTypeLimitList.checkChildren(node.childNodes[i]); \t\t\t} \t\t} \t \t/* ]]> */ \t</script> \t\t END; print "\n</div>"; $searchBar->add(new UnstyledBlock(ob_get_clean()), null, null, LEFT, TOP); //*********************************** // print the results //*********************************** $resultPrinter = new IteratorResultPrinter($this->getAssets(), $_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 *********************************************************/ $searchBar->add($this->getDisplayOptions($resultPrinter), null, null, LEFT, TOP); }