示例#1
0
 /**
  * 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);
 }
示例#2
0
 /**
  * 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();
     // function links
     ob_start();
     print _("Collection") . ": ";
     RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
     $layout = new Block(ob_get_contents(), 3);
     ob_end_clean();
     $actionRows->add($layout, "100%", null, LEFT, CENTER);
     $repositoryManager = Services::getService("Repository");
     // Get all the types
     $types = $repository->getAssetTypes();
     // put the drs into an array and order them.
     $typeArray = array();
     while ($types->hasNext()) {
         $type = $types->next();
         $typeArray[$type->getDomain() . " " . $type->getAuthority() . " " . $type->getKeyword()] = $type;
     }
     ksort($typeArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($typeArray, 2, 20, "printTypeShort", $repository->getId());
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout();
     $actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
 }
示例#3
0
 /**
  * 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();
     $repositoryId = $this->getRepositoryId();
     // function links
     ob_start();
     print _("Collection") . ": ";
     RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
     $layout = new Block(ob_get_contents(), 3);
     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(), 3);
     ob_end_clean();
     $actionRows->add($introText, null, null, CENTER, CENTER);
     // Print out the search types
     ob_start();
     $searchModules = Services::getService("RepositorySearchModules");
     $searchTypes = $repository->getSearchTypes();
     while ($searchTypes->hasNext()) {
         $searchType = $searchTypes->next();
         $typeString = $searchType->getDomain() . "::" . $searchType->getAuthority() . "::" . $searchType->getKeyword();
         print "\n<h3>" . $typeString . "</h3>";
         print "\n" . $searchModules->createSearchForm($repository, $searchType, $harmoni->request->quickURL("collection", "searchresults", array("collection_id" => $repositoryId->getIdString(), "asset_type" => urlencode($typeString))));
     }
     $searchFields = new Block(ob_get_contents(), 3);
     ob_end_clean();
     $actionRows->add($searchFields, "100%", null, LEFT, CENTER);
 }
示例#4
0
 /**
  * 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);
 }
示例#5
0
function printrepositoryShort($repository, $harmoni)
{
    ob_start();
    $repositoryId = $repository->getId();
    print "\n\t<strong>" . $repository->getDisplayName() . "</strong> - " . _("ID#") . ": " . $repositoryId->getIdString();
    $description = HtmlString::withValue($repository->getDescription());
    $description->trim(100);
    print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>";
    RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
    $layout = new Block(ob_get_contents(), EMPHASIZED_BLOCK);
    ob_end_clean();
    return $layout;
}
示例#6
0
function printRepositoryShort($repository)
{
    $harmoni = Harmoni::instance();
    ob_start();
    $repositoryId = $repository->getId();
    print "\n\t<div style='font-weight: bold' title='" . _("ID#") . ": " . $repositoryId->getIdString() . "'>" . $repository->getDisplayName() . "</div>";
    $description = HtmlString::withValue($repository->getDescription());
    $description->trim(500);
    print "\n\t<div style='font-size: smaller;'>" . $description->asString() . "</div>";
    RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
    $xLayout = new XLayout();
    $layout = new Container($xLayout, BLANK, 1);
    $layout2 = new Block(ob_get_contents(), EMPHASIZED_BLOCK);
    $layout->add($layout2, null, null, CENTER, CENTER);
    ob_end_clean();
    return $layout;
}
示例#7
0
    /**
     * 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('&amp;', '&', $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);
    }