示例#1
0
 /**
  * Execute this action.
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  * @since 4/25/05
  */
 function execute()
 {
     if (!$this->isAuthorizedToExecute()) {
         throw new PermissionDeniedException();
     }
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("harmoni-authentication");
     $query = RequestContext::value("user");
     $harmoni->request->endNamespace();
     header('Content-type: text/plain');
     if (!strlen($query)) {
         exit;
     }
     $authNMethodManager = Services::getService("AuthNMethods");
     $types = $authNMethodManager->getAuthNTypes();
     while ($types->hasNext()) {
         $type = $types->next();
         $method = $authNMethodManager->getAuthNMethodForType($type);
         $foundTokens = $method->getTokensBySearch($query);
         while ($foundTokens->hasNext()) {
             $tokens = $foundTokens->next();
             print $method->getDisplayNameForTokens($tokens) . " (" . $type->getKeyword() . ")|type=\"" . $type->asString() . "\" id=\"" . $tokens->getIdentifier() . "\"\n";
         }
     }
     exit;
 }
示例#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();
     $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);
 }
    /**
     * Build the content for this action
     * 
     * @return void
     * @access public
     * @since 4/26/05
     */
    function buildContent()
    {
        $actionRows = $this->getActionRows();
        $harmoni = Harmoni::instance();
        // Set our textdomain
        $defaultTextDomain = textdomain("polyphony");
        ob_start();
        $harmoni->request->startNamespace("harmoni-authentication");
        $action = $harmoni->history->getReturnURL("polyphony/authentication");
        $usernameField = $harmoni->request->getName("username");
        $passwordField = $harmoni->request->getName("password");
        $usernameText = _("Username/Email");
        $passwordText = _("Password");
        $submitLabel = _('Log In');
        print <<<END
\t\t
\t\t<center><form name='login' action='{$action}' method='post'>
\t\t\t{$usernameText}: <input type='text' name='{$usernameField}' />
\t\t\t<br />{$passwordText}: <input type='password' name='{$passwordField}' />
\t\t\t<br /><input type='submit' value='{$submitLabel}'/>
\t\t</form></center>
\t\t
END;
        $actionRows->add(new Block(ob_get_contents(), 2), "100%", null, CENTER, CENTER);
        ob_end_clean();
        $harmoni->request->endNamespace();
        // go back to the default text domain
        textdomain($defaultTextDomain);
    }
function getVisitorLoginLink()
{
    $harmoni = Harmoni::instance();
    $authN = Services::getService("AuthN");
    // Visitor Registration Link
    $authTypes = $authN->getAuthenticationTypes();
    $hasVisitorType = false;
    $visitorType = new Type("Authentication", "edu.middlebury.harmoni", "Visitors");
    while ($authTypes->hasNext()) {
        $authType = $authTypes->next();
        if ($visitorType->isEqual($authType)) {
            $hasVisitorType = true;
            break;
        }
    }
    if ($hasVisitorType && !$authN->isUserAuthenticatedWithAnyType()) {
        $harmoni->request->startNamespace('polyphony');
        $url = $harmoni->request->mkURL("auth", "login_type");
        $url->setValue("type", urlencode($visitorType->asString()));
        // Add return info to the visitor registration url
        $visitorReturnModules = array('view', 'ui1', 'ui2', 'versioning');
        if (in_array($harmoni->request->getRequestedModule(), $visitorReturnModules)) {
            $url->setValue('returnModule', $harmoni->request->getRequestedModule());
            $url->setValue('returnAction', $harmoni->request->getRequestedAction());
            $url->setValue('returnKey', 'node');
            $url->setValue('returnValue', SiteDispatcher::getCurrentNodeId());
        }
        $harmoni->request->endNamespace();
        return "\n\t<a href='" . $url->write() . "'>" . _("Visitor Login") . "</a>";
    }
    return null;
}
 /**
  * Generates a menu layout based on the current action.
  * @param string $actionString A dotted-pair action string of the form
  *		"module.action" .
  * @return object MenuLayout
  * @static
  */
 static function generateMainMenu()
 {
     $harmoni = Harmoni::instance();
     list($module, $action) = explode(".", $harmoni->request->getRequestedModuleAction());
     $mainMenu = new Menu(new YLayout(), 1);
     // :: Home ::
     $mainMenu_item = new MenuItemLink(_("Home"), $harmoni->request->quickURL("home", "welcome"), $module == "home" && $action == "welcome" ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     // 		$mainMenu_item = new MenuItemLink(
     // 			_("Plugin Tests"),
     // 			$harmoni->request->quickURL("plugin_manager", "test"),
     // 			($module == "plugin_manager")?TRUE:FALSE,1);
     // 		$mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     $mainMenu_item = new MenuItemLink(_("Portal"), $harmoni->request->quickURL('portal', "list"), $module == "portal" && $action == 'list' ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     if (defined('DATAPORT_SEGUE1_URL') && defined('DATAPORT_SEGUE1_SECRET_KEY') && defined('DATAPORT_SEGUE1_SECRET_VALUE')) {
         $mainMenu_item = new MenuItemLink(_("Migrate Sites"), $harmoni->request->quickURL('dataport', "choose_site"), $module == "dataport" && $action == 'choose_site' ? TRUE : FALSE, 1);
         $mainMenu->add($mainMenu_item, "100%", null, LEFT, CENTER);
     }
     $mainMenu_item8 = new MenuItemLink(_("User Tools"), $harmoni->request->quickURL("user", "main"), preg_match("/^user\$/", $module) ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item8, "100%", null, LEFT, CENTER);
     $mainMenu_item7 = new MenuItemLink(_("Admin Tools"), $harmoni->request->quickURL("admin", "main"), preg_match("/^admin\$/", $module) ? TRUE : FALSE, 1);
     $mainMenu->add($mainMenu_item7, "100%", null, LEFT, CENTER);
     return $mainMenu;
 }
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $idManager = Services::getService("Id");
     $repositoryManager = Services::getService("Repository");
     $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.concerto.exhibition_repository"));
     $asset = $repository->getAsset($idManager->getId(RequestContext::value('slideshow_id')));
     // Remove it from its set.
     $exhibitionId = $idManager->getId(RequestContext::value('exhibition_id'));
     $setManager = Services::getService("Sets");
     $exhibitionSet = $setManager->getPersistentSet($exhibitionId);
     $exhibitionSet->removeItem($asset->getId());
     // Log the action
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Concerto");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Delete Node", "Slideshow deleted:\n<br/>&nbsp; &nbsp; &nbsp;" . $asset->getDisplayName());
         $item->addNodeId($asset->getId());
         $item->addNodeId($idManager->getId(RequestContext::value('exhibition_id')));
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     $repository->deleteAsset($idManager->getId(RequestContext::value('slideshow_id')));
     RequestContext::locationHeader($harmoni->request->quickURL("exhibitions", "browse_exhibition", array("exhibition_id" => RequestContext::value('exhibition_id'))));
 }
示例#7
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $idManager = Services::getService("Id");
     $repositoryManager = Services::getService("Repository");
     $repositoryId = $idManager->getId(RequestContext::value('collection_id'));
     $repository = $repositoryManager->getRepository($repositoryId);
     $displayName = $repository->getDisplayName();
     // Delete all of the tags for the assets in the repository
     $itemsToDelete = array();
     $assets = $repository->getAssets();
     while ($assets->hasNext()) {
         $asset = $assets->next();
         $itemsToDelete[] = TaggedItem::forId($asset->getId(), 'concerto');
     }
     $tagManager = Services::getService('Tagging');
     $tagManager->deleteItems($itemsToDelete, 'concerto');
     $repositoryManager->deleteRepository($idManager->getId(RequestContext::value('collection_id')));
     // Log the success or failure
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Concerto");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Delete Node", "Repository deleted:\n<br/>&nbsp; &nbsp; &nbsp;" . $displayName);
         $item->addNodeId($repositoryId);
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     RequestContext::locationHeader($harmoni->request->quickURL("collections", "namebrowse"));
 }
 /**
  * Execute the action
  * 
  * @return mixed
  * @access public
  */
 public function execute()
 {
     try {
         if (!$this->isAuthorizedToExecute()) {
             throw new PermissionDeniedException();
         }
         ob_start();
         $harmoni = Harmoni::instance();
         $component = SiteDispatcher::getCurrentNode();
         $site = SiteDispatcher::getCurrentRootNode();
         $slotMgr = SlotManager::instance();
         $slot = $slotMgr->getSlotBySiteId($site->getId());
         $exportDirname = $slot->getShortname() . "-html";
         $exportDir = DATAPORT_TMP_DIR . "/" . $exportDirname;
         $archivePath = DATAPORT_TMP_DIR . '/' . $exportDirname . ".zip";
         if (!file_exists($exportDir)) {
             header('HTTP/1.1 404 Not Found');
             print "Not Found";
             exit;
         }
         header("Content-Type: text/html;");
         $this->printStatus($exportDir);
     } catch (PermissionDeniedException $e) {
         header('HTTP/1.1 403 Forbidden');
         header("Content-Type: text/plain;");
         print _("You are not authorized to monitor the export this component.");
         exit;
     }
     exit;
 }
示例#9
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     ob_start();
     CollectionsPrinter::printFunctionLinks();
     $layout = new Block(ob_get_contents(), STANDARD_BLOCK);
     ob_end_clean();
     $actionRows->add($layout, null, null, CENTER, CENTER);
     $type = HarmoniType::fromString(urldecode(RequestContext::value('type')));
     $repositoryManager = Services::getService("Repository");
     // Get the Repositories
     $allRepositories = $repositoryManager->getRepositoriesByType($type);
     // put the repositories into an array and order them.
     // @todo, do authorization checking
     $repositoryArray = array();
     while ($allRepositories->hasNext()) {
         $repository = $allRepositories->next();
         $repositoryArray[$repository->getDisplayName()] = $repository;
     }
     ksort($repositoryArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($repositoryArray, 2, 20, "printrepositoryShort", $harmoni);
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout();
     $actionRows->add($resultLayout, null, null, CENTER, CENTER);
 }
示例#10
0
    /**
     * Add a supported-browser warning
     *
     * @return void
     * @access public
     * @since 12/20/07
     * @static
     */
    public static function addBrowserWarning()
    {
        $harmoni = Harmoni::instance();
        $outputHandler = $harmoni->getOutputHandler();
        $polyphonyPath = POLYPHONY_PATH;
        $msieWarning = _('The \'New Mode\' editing interface does not support old versions of Microsoft Internet Explorer.\\n\\nPlease use the \'Classic Mode\' editing interface or use one of the following browsers:\\n\\tFirefox\\n\\tOpera\\n\\tSafari\\n\\tInternet Explorer (version 7 and later)');
        $warning = <<<END
\t\t
\t\t<script src='{$polyphonyPath}/javascript/brwsniff.js' type='text/javascript'></script>
\t\t<script type='text/javascript'>
\t\t// <![CDATA[
\t\t
\t\tvar br = getBrowser();
\t\t
\t\t// Display warning for old MSIE
\t\tif (br[0] == 'msie' && getMajorVersion(br[1]) < 7) {
\t\t\talert("{$msieWarning}");
\t\t}
\t\t
\t\t// ]]>
\t\t</script>

END;
        $outputHandler->setHead($outputHandler->getHead() . $warning);
    }
示例#11
0
 /**
  * Visit a Block
  * 
  * @param object BlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitBlock(BlockSiteComponent $siteComponent)
 {
     // check to see if user is authorized to view block
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_comments"), $idManager->getId($siteComponent->getId()))) {
         return;
     }
     $harmoni = Harmoni::instance();
     //get all comments for site component
     $commentsManager = CommentManager::instance();
     $comments = $commentsManager->getAllComments($siteComponent->getAsset());
     while ($comments->hasNext()) {
         $comment = $comments->next();
         $item = $this->addItem(new RSSItem());
         $item->setTitle($comment->getSubject());
         $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())) . "#comment_" . $comment->getIdString(), true);
         $item->setPubDate($comment->getModificationDate());
         $agentMgr = Services::getService("Agent");
         $agent = $comment->getAuthor();
         $item->setAuthor($agent->getDisplayName());
         $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())));
         $pluginMgr = Services::getService("PluginManager");
         $plugin = $pluginMgr->getPlugin($comment->getAsset());
         $item->setDescription($plugin->executeAndGetMarkup());
         // MediaFile eclosures.
         try {
             foreach ($plugin->getRelatedMediaFiles() as $file) {
                 $item->addEnclosure($file->getUrl(), $file->getSize()->value(), $file->getMimeType());
             }
         } catch (UnimplementedException $e) {
         }
     }
 }
示例#12
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);
 }
示例#13
0
 /**
  * This class implements the Singleton pattern. There is only ever
  * one instance of the this class and it is accessed only via the 
  * ClassName::instance() method.
  * 
  * @return object 
  * @access public
  * @since 5/26/05
  * @static
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Harmoni();
     }
     return self::$instance;
 }
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 8/15/06
  */
 function buildContent()
 {
     $harmoni = Harmoni::instance();
     $idManager = Services::getService("Id");
     $repositoryManager = Services::getService("Repository");
     $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.concerto.exhibition_repository"));
     $exhibitionId = $idManager->getId(RequestContext::value('exhibition_id'));
     $exhibition = $repository->getAsset($exhibitionId);
     $slideshowId = $idManager->getId(RequestContext::value('slideshow_id'));
     $slideshowAsset = $repository->getAsset($slideshowId);
     $setManager = Services::getService("Sets");
     $exhibitionSet = $setManager->getPersistentSet($exhibitionId);
     $oldPosition = $exhibitionSet->getPosition($slideshowId);
     $newPosition = RequestContext::value('new_position');
     // Out of range Error Condition
     if ($newPosition < 0 || $newPosition >= $exhibitionSet->count()) {
         // Log the error
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Concerto");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Error", "Errors.");
             $item = new AgentNodeEntryItem("Reorder Slideshows Failed", "Out of range error: Slideshow in the " . $exhibition->getDisplayName() . " exhibition could not be moved from position {$oldPosition} to {$newPosition} (" . $exhibitionSet->count() . " items in the set).");
             $item->addNodeId($exhibition->getId());
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
     } else {
         $exhibitionSet->moveToPosition($slideshowId, $newPosition);
         // Log the action
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Concerto");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
             $item = new AgentNodeEntryItem("Reorder Slideshows", "Slideshows in the " . $exhibition->getDisplayName() . " exhibition have been reorderd.");
             $item->addNodeId($exhibition->getId());
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
         // Remove any missing slideshows
         $slideshowsIdStrings = array();
         $slideshows = $exhibition->getAssets();
         while ($slideshows->hasNext()) {
             $slideshow = $slideshows->next();
             $slideshowId = $slideshow->getId();
             $slideshowsIdStrings[] = $slideshowId->getIdString();
         }
         $itemsToRemove = array();
         $exhibitionSet->reset();
         while ($exhibitionSet->hasNext()) {
             $itemId = $exhibitionSet->next();
             if (!in_array($itemId->getIdString(), $slideshowsIdStrings)) {
                 $itemsToRemove[] = $itemId;
             }
         }
         foreach ($itemsToRemove as $id) {
             $exhibitionSet->removeItem($id);
         }
     }
     RequestContext::locationHeader($harmoni->request->quickURL("exhibitions", "browse_exhibition", array("exhibition_id" => $exhibitionId->getIdString())));
 }
示例#15
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     ob_start();
     CollectionsPrinter::printFunctionLinks();
     print "<p>";
     print _("Below are listed the available <em>Collections</em>, organized by type, then name.");
     print "</p>\n<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>";
     $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
     ob_end_clean();
     $exhibitionRepositoryType = new Type('System Repositories', 'edu.middlebury.concerto', 'Exhibitions');
     $repositoryManager = Services::getService("Repository");
     // Get all the types
     $types = $repositoryManager->getRepositoryTypes();
     // put the drs into an array and order them.
     $typeArray = array();
     while ($types->hasNext()) {
         $type = $types->next();
         // include all but Exhibitions repository.
         if (!$exhibitionRepositoryType->isEqual($type)) {
             $typeArray[HarmoniType::typeToString($type)] = $type;
         }
     }
     ksort($typeArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($typeArray, 2, 20, "printTypeShort");
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout();
     $actionRows->add($resultLayout, null, null, CENTER, CENTER);
 }
示例#16
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $idManager = Services::getService("Id");
     $repositoryManager = Services::getService("Repository");
     $repository = $repositoryManager->getRepository($idManager->getId(RequestContext::value('collection_id')));
     $asset = $repository->getAsset($idManager->getId(RequestContext::value('asset_id')));
     // Remove this asset from the tagging manager
     $tagManager = Services::getService('Tagging');
     $tagManager->deleteItems(TaggedItem::forId($asset->getId(), 'concerto'));
     // Log the action
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Concerto");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Delete Node", "Asset deleted:\n<br/>&nbsp; &nbsp; &nbsp;" . $asset->getDisplayName());
         $item->addNodeId($asset->getId());
         $item->addNodeId($repository->getId());
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     $repository->deleteAsset($idManager->getId(RequestContext::value('asset_id')));
     $harmoni->history->goBack("concerto/asset/delete-return");
 }
示例#17
0
 /**
  * Answer a links back to the main Segue pages
  * 
  * @return object GUIComponent
  * @access public
  * @since 1/12/07
  */
 function getCommandsComponent()
 {
     $harmoni = Harmoni::instance();
     ob_start();
     print "<div class='commands'>";
     print "<a href='";
     print SiteDispatcher::quickURL('view', 'html');
     print "' title='" . _("Go to View-Mode") . "'>";
     print _("view") . "</a>";
     print " | <a href='";
     print SiteDispatcher::quickURL('ui2', 'editview');
     print "' title='" . _("Go to Edit-Mode") . "'>";
     print _("edit") . "</a>";
     print " | <a href='";
     print SiteDispatcher::quickURL('ui2', 'headerfooter');
     print "' title='" . _("Go to Header/Footer Edit-Mode") . "'>";
     print _("header/footer") . "</a>";
     print " | " . _("arrange");
     // Add permissions button
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     // Rather than checking the entire site, we will just check the current node.
     // This forces users who are not site-wide admins to browse to the place where
     // they are administrators in order to see the permissions button, but
     // cuts load-times for non-admins on a given large site from 35s to 1.4s.
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), SiteDispatcher::getCurrentNode()->getQualifierId())) {
         $url = SiteDispatcher::quickURL("roles", "choose_agent", array("node" => SiteDispatcher::getCurrentNodeId(), "returnModule" => $harmoni->request->getRequestedModule(), "returnAction" => $harmoni->request->getRequestedAction()));
         print " | \n\t<a href='#' onclick='window.location = \"{$url}\".urlDecodeAmpersands(); return false;'>";
         print _("roles") . "</a>";
     }
     print " | " . self::getUiSwitchForm();
     print "</div>";
     $ret = new Component(ob_get_clean(), BLANK, 2);
     return $ret;
 }
示例#18
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);
 }
示例#19
0
 /**
  * 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();
 }
示例#20
0
 /**
  * Execute the Action
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  * @since 4/3/06
  */
 function execute()
 {
     // redirect
     $harmoni = Harmoni::instance();
     $newUrl = $harmoni->request->mkURLWithPassthrough('view', 'html');
     RequestContext::sendTo($newUrl->write());
 }
 /**
  * Print links for the various functions that are possible to do.
  * 
  * @return void
  * @access public
  * @date 8/6/04
  * @static
  */
 static function printFunctionLinks()
 {
     $links = array();
     $harmoni = Harmoni::instance();
     $actionString = $harmoni->getCurrentAction();
     //===== NameBrowse Link =====//
     if ($actionString != "collections.namebrowse") {
         $links[] = "<a href='" . $harmoni->request->quickURL("collections", "namebrowse") . "'>" . _("Browse") . "</a>";
     } else {
         $links[] = _("Browse");
     }
     //===== TypeBrowse Link =====//
     if ($actionString != "collections.typebrowse") {
         $links[] = "<a href='" . $harmoni->request->quickURL("collections", "typebrowse") . "'>" . _("Browse by Type") . "</a>";
     } else {
         $links[] = _("browse by type");
     }
     //===== Search Link =====//
     if ($actionString != "collections.search") {
         $links[] = "<a href='" . $harmoni->request->quickURL("collections", "search") . "'>" . _("Search") . "</a>";
     } else {
         $links[] = _("search");
     }
     //===== Create Link =====//
     require_once MYDIR . "/main/modules/collection/create.act.php";
     $createAction = new createAction();
     if ($createAction->isAuthorizedToExecute()) {
         // 		if (true) {
         $links[] = "<a href='" . $harmoni->request->quickURL("collection", "create") . "'>" . _("Create a new <em>Collection</em>") . "</a>";
         //===== Import Link =====//
         $links[] = "<a href='" . $harmoni->request->quickURL("collections", "import") . "'>" . _("Import <em>Collection(s)</em>") . "</a>";
     }
     print implode("\n\t | ", $links);
 }
示例#22
0
 function buildContent()
 {
     $harmoni = Harmoni::instance();
     $centerPane = $this->getActionRows();
     $centerPane->add(new Heading(_("Upload a file to view its EXIF/IPTC data"), 2), null, null, LEFT, TOP);
     ob_start();
     print "\n<form action='" . $harmoni->request->quickURL() . "' method='post' enctype='multipart/form-data'>";
     print "\n\t<input type='file' name='" . RequestContext::name('image_file') . "'/>";
     print "\n\t<input type='submit'/>";
     print "\n</form>";
     $centerPane->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, LEFT, TOP);
     if (isset($_FILES[RequestContext::name('image_file')]) && !$_FILES[RequestContext::name('image_file')]['error']) {
         $fileArray = $_FILES[RequestContext::name('image_file')];
         ob_start();
         print "<h2>" . $fileArray['name'] . "</h2>";
         $exifImporter = new ExifRepositoryImporter($fileArray['tmp_name'], null, false);
         $exifImporter->getSingleAssetInfo($fileArray['tmp_name']);
         // 			printpre($exifImporter->_photoshopIPTC);
         print "\n<h3>" . _("IPTC Fields") . "</h3>";
         $this->printFields($exifImporter->extractPhotoshopMetaData());
         print "\n<h3>" . _("EXIF Fields") . "</h3>";
         $this->printFields($exifImporter->extractExifMetadata($fileArray['tmp_name']));
         $centerPane->add(new Block(ob_get_clean(), STANDARD_BLOCK), null, null, LEFT, TOP);
     }
 }
 /**
  * Execute this action. This is a template method that handles setting up
  * components of the screen as well as authorization, delegating the various
  * parts to descendent classes.
  * 
  * @return mixed
  * @access public
  * @since 4/25/05
  */
 public final function execute()
 {
     $harmoni = Harmoni::instance();
     $pageTitle = $harmoni->config->get('programTitle');
     // Our Rows for action content
     $actionRows = $this->getActionRows();
     // Check authorization
     if (!$this->isAuthorizedToExecute()) {
         $actionRows->add(new Block($this->getUnauthorizedMessage(), ALERT_BLOCK), "100%", null, CENTER, TOP);
         return $actionRows;
     }
     // Add a heading if specified
     if ($headingText = $this->getHeadingText()) {
         $actionRows->add(new Heading($headingText, 1), "100%", null, LEFT, CENTER);
     }
     if ($this->getTitleText()) {
         $pageTitle .= ": " . $this->getTitleText();
     }
     // Set the page title and other new header items
     $outputHandler = $harmoni->getOutputHandler();
     ob_start();
     // Remove any existing title tags from the head text
     print preg_replace("/<title>[^<]*<\\/title>/", "", $outputHandler->getHead());
     //Add our new title
     print "\n\t\t<title>";
     print strip_tags(preg_replace("/<(\\/)?(em|i|b|strong)>/", "*", $pageTitle));
     print "</title>";
     // Add our common Harmoni javascript libraries
     require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php";
     $outputHandler->setHead(ob_get_clean());
     // Pass content generation off to our child classes
     $this->buildContent();
     return $actionRows;
 }
示例#24
0
 /**
  * Answer the current harvester config array
  * 
  * @return string
  * @access public
  * @static
  * @since 3/9/07
  */
 static function getCurrentHarvesterConfig()
 {
     global $errors;
     $harmoni = Harmoni::instance();
     $config = $harmoni->getAttachedData('OAI_CONFIG');
     if ($config->getProperty('ENABLE_OAI')) {
         $harvesterConfig = $config->getProperty('OAI_HARVESTER_CONFIG');
         foreach ($harvesterConfig as $configArray) {
             if (!count($configArray["ips_allowed"])) {
                 return $configArray;
             } else {
                 foreach ($configArray["ips_allowed"] as $ipRange) {
                     $ipRange = str_replace(".", "\\.", $ipRange);
                     if (preg_match('/^' . $ipRange . '/', $_SERVER['REMOTE_ADDR'])) {
                         return $configArray;
                     }
                 }
             }
         }
         require_once dirname(__FILE__) . "/phpoai2/oai2/oaidp-util.php";
         require_once dirname(__FILE__) . "/phpoai2/oai2/oaidp-config.php";
         $errors .= oai_error('unauthorizedHarvesterIP', "\$_SERVER['REMOTE_ADDR']", $_SERVER['REMOTE_ADDR']);
     } else {
         require_once dirname(__FILE__) . "/phpoai2/oai2/oaidp-util.php";
         require_once dirname(__FILE__) . "/phpoai2/oai2/oaidp-config.php";
         // 			throwError(new Error('harvesting disabled'));
         $errors .= oai_error('harvestingDisabled');
     }
     oai_exit();
 }
示例#25
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 7/11/07
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace('comments');
     $comment = $this->getComment();
     if (RequestContext::value('subject')) {
         $comment->updateSubject(RequestContext::value('subject'));
     }
     header("Content-type: text/xml");
     print "<comment>\n";
     print "\t<subject><![CDATA[";
     print $comment->getSubject();
     print "]]></subject>\n";
     if (RequestContext::value('threading') == 'threaded') {
         $markup = $comment->getMarkup(TRUE);
     } else {
         $markup = $comment->getMarkup(FALSE);
     }
     print "\t<markup><![CDATA[";
     // CDATA sections cannot contain ']]>' and therefor cannot be nested
     // get around this by replacing the ']]>' tags in the markup.
     print preg_replace('/\\]\\]>/', '}}>', $markup);
     print "]]></markup>\n";
     print "</comment>";
     $harmoni->request->endNamespace();
     exit;
 }
示例#26
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $idManager = Services::getService("Id");
     $recordStructureId = $this->getRecordStructureId();
     $recordStructure = $this->getRecordStructure();
     $recordStructureIdString = $recordStructureId->getIdString();
     $repositoryId = $this->getRepositoryId();
     $repository = $this->getRepository();
     // Log the action
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Concerto");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Delete RecordStructure", "RecordStructure deleted:\n<br/>&nbsp; &nbsp; &nbsp;" . $recordStructure->getDisplayName());
         $item->addNodeId($recordStructureId);
         $item->addNodeId($repositoryId);
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     $setManager = Services::getService("Sets");
     $set = $setManager->getPersistentSet($repositoryId);
     if ($set->isInSet($recordStructureId)) {
         $set->removeItem($recordStructureId);
     }
     $repository->deleteRecordStructure($recordStructureId, new StatusStars(_("Deleting Schema and associated Records")));
     RequestContext::sendTo($harmoni->history->getReturnUrl("concerto/schema/delete-return/" . $recordStructureIdString));
 }
示例#27
0
 /**
  * Answer all the tags in Segue by everyon 
  * 
  * @return object TagIterator
  * @access public
  * @since 11/8/06
  */
 function getTags()
 {
     $harmoni = Harmoni::instance();
     $tagManager = Services::getService("Tagging");
     $tags = $tagManager->getTags(TAG_SORT_ALFA, $this->getNumTags());
     return $tags;
 }
 function execute()
 {
     $harmoni = Harmoni::instance();
     // Get services
     $idManager = Services::getService("Id");
     $authZ = Services::getService("AuthZ");
     $harmoni->request->startNamespace("polyphony-authorizations");
     // Get info passed to this action via the URL
     $operation = RequestContext::value("operation");
     $functionIdString = RequestContext::value("functionId");
     $qualifierIdString = RequestContext::value("qualifierId");
     $agentList = array();
     if (RequestContext::value("mult")) {
         $agentList = unserialize(urldecode(RequestContext::value("agents")));
     } else {
         $agentList = array(RequestContext::value("agentId"));
     }
     // Process authorizations
     if ($operation == 'create') {
         // Get Ids from these strings
         $functionId = $idManager->getId($functionIdString);
         $qualifierId = $idManager->getId($qualifierIdString);
         foreach ($agentList as $agentIdString) {
             $authZ->createAuthorization($idManager->getId($agentIdString), $functionId, $qualifierId);
         }
     } else {
         if ($operation == 'delete') {
             // Get Ids from these strings
             $functionId = $idManager->getId($functionIdString);
             $qualifierId = $idManager->getId($qualifierIdString);
             foreach ($agentList as $agentIdString) {
                 $authorizations = $authZ->getExplicitAZs($idManager->getId($agentIdString), $functionId, $qualifierId, false);
                 while ($authorizations->hasNext()) {
                     $authorization = $authorizations->next();
                     /*					$qualifier =$authorization->getQualifier();
                     					$function =$authorization->getFunction();
                     					$qualifierId =$qualifier->getId();
                     					$functionId =$function->getId();
                     					print "auth -> function: ".$functionId->getIdString().", qualifier: ".$qualifierId->getIdString()."<br/>";
                     */
                     $authZ->deleteAuthorization($authorization);
                 }
             }
         } else {
             if ($operation == 'delete_all') {
                 // clear all authorizations for the users selected
                 foreach ($agentsList as $agentIdString) {
                     $authorizations = $authZ->getAllExplicitAZsForAgent($idManager->getId($agentIdString), false);
                     while ($authorizations->hasNext()) {
                         $authorization = $authorizations->next();
                         $authZ->deleteAuthorization($authorization);
                     }
                 }
             }
         }
     }
     $harmoni->request->endNamespace();
     $harmoni->history->goBack("polyphony/agents/process_authorizations");
 }
 /**
  * Collect the password that the user may have supplied, Reply NULL if none
  * are found.
  * 
  * @return mixed
  * @access public
  * @since 3/16/05
  */
 function collectPassword()
 {
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("harmoni-authentication");
     $password = $harmoni->request->get("password");
     $harmoni->request->endNamespace();
     return $password;
 }
示例#30
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     ob_start();
     require dirname(__FILE__) . "/phpoai2/index.php";
     $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
 }