/**
     * Constructor
     * 
     * @return object
     * @access public
     * @since 4/14/06
     */
    function __construct()
    {
        $this->_action = 'editview';
        $this->_controlsVisitor = new EditModeControlsSiteVisitor();
        $this->_controlsVisitor->setReturnAction($this->_action);
        parent::__construct();
        $this->_classNames = array('Block' => _('Content Block'), 'NavBlock' => _('Page'), 'NavSection' => _('Section'), 'SiteNavBlock' => _('Site'), 'MenuOrganizer' => _('Pages Container'), 'FlowOrganizer' => _('Content Container'), 'FixedOrganizer' => _('Layout Container'), 'SubMenu_multipart' => _('Section'), 'SidebarSubMenu_multipart' => _('Section with Sidebar'), 'ContentPage_multipart' => _('Page'), 'SidebarContentPage_multipart' => _('Page with Sidebar'));
        ob_start();
        // Print out Javascript functions needed by our methods
        $this->printJavascript();
        print <<<END
\t\t\t
\t\t\t<style type='text/css'>
\t\t\t\t.controls_form {
\t\t\t\t\ttext-align: left;
\t\t\t\t\tcolor: #000;
\t\t\t\t\tpadding: 3px;
\t\t\t\t}
\t\t\t\t
\t\t\t\t.controls_form a {
\t\t\t\t\ttext-align: left;
\t\t\t\t\tcolor: #000;
\t\t\t\t}
\t\t\t</style>

END;
        $harmoni = Harmoni::instance();
        $outputHandler = $harmoni->getOutputHandler();
        $outputHandler->setHead($outputHandler->getHead() . ob_get_clean());
        UserDataHelper::writeHeadJs();
    }
 public function test_Should_Get_PublicKey()
 {
     PublicKeyHelper::setupPublicKey();
     $publicKey = PublicKeyHelper::create(Constants::VIRGIL_PRIVATE_KEY, Constants::VIRGIL_PUBLIC_KEY);
     UserDataHelper::persist($publicKey->userData->get(0)->id->userDataId, MailinatorHelper::fetchMessage(Constants::VIRGIL_USER_DATA_VALUE1));
     $publicKey = PublicKeyHelper::get($publicKey->publicKeyId);
     $this->assertEquals(Constants::VIRGIL_PUBLIC_KEY, $publicKey->publicKey);
 }
 public function test_Should_Reset_PublicKey()
 {
     PublicKeyHelper::setupPublicKey();
     $publicKey = PublicKeyHelper::create(Constants::VIRGIL_PRIVATE_KEY, Constants::VIRGIL_PUBLIC_KEY);
     UserDataHelper::persist($publicKey->userData->get(0)->id->userDataId, MailinatorHelper::fetchMessage(Constants::VIRGIL_USER_DATA_VALUE1));
     $resetResult = PublicKeyHelper::reset($publicKey->publicKeyId, Constants::VIRGIL_PUBLIC_KEY_NEW, Constants::VIRGIL_PRIVATE_KEY_NEW);
     $publicKey = PublicKeyHelper::persist($publicKey->publicKeyId, $resetResult['action_token'], array(MailinatorHelper::fetchMessage(Constants::VIRGIL_USER_DATA_VALUE1)));
     $this->assertEquals(Constants::VIRGIL_PUBLIC_KEY_NEW, $publicKey->publicKey);
 }
예제 #4
0
 /**
  * Write Javascript needed for supporting user-data to the page head.
  * 
  * @return void
  * @access public
  * @since 9/23/08
  * @static
  */
 public static function writeHeadJs()
 {
     if (self::$headJsWritten) {
         return;
     }
     $harmoni = Harmoni::instance();
     $outputHandler = $harmoni->getOutputHandler();
     $outputHandler->setHead($outputHandler->getHead() . self::getHeadJs());
     self::$headJsWritten = true;
 }
 public function test_Should_SignedGrab_PublicKey()
 {
     PublicKeyHelper::setupPublicKey();
     $publicKey = PublicKeyHelper::create(Constants::VIRGIL_PRIVATE_KEY, Constants::VIRGIL_PUBLIC_KEY);
     UserDataHelper::persist($publicKey->userData->get(0)->id->userDataId, MailinatorHelper::fetchMessage(Constants::VIRGIL_USER_DATA_VALUE1));
     $publicKey = PublicKeyHelper::grab(Constants::VIRGIL_USER_DATA_VALUE1, $publicKey->publicKeyId, Constants::VIRGIL_PRIVATE_KEY);
     $this->assertEquals($publicKey->get(0)->publicKey, Constants::VIRGIL_PUBLIC_KEY);
     $this->assertEquals(Constants::VIRGIL_USER_DATA_CLASS, $publicKey->get(0)->userData->get(0)->class);
     $this->assertEquals(Constants::VIRGIL_USER_DATA_TYPE, $publicKey->get(0)->userData->get(0)->type);
     $this->assertEquals(Constants::VIRGIL_USER_DATA_VALUE1, $publicKey->get(0)->userData->get(0)->value);
     $this->assertTrue($publicKey->get(0)->userData->get(0)->isConfirmed);
 }
예제 #6
0
 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 5/8/07
  */
 function buildContent()
 {
     SegueAjaxPlugin::writeAjaxLib();
     /*********************************************************
      * Other headers and footers
      *********************************************************/
     $harmoni = Harmoni::instance();
     $outputHandler = $harmoni->getOutputHandler();
     UserDataHelper::writeHeadJs();
     ob_start();
     print Segue_MediaLibrary::getHeadHtml();
     $outputHandler->setHead($outputHandler->getHead() . ob_get_clean());
     parent::buildContent();
 }
 public function test_Should_Delete_PublicKey()
 {
     PublicKeyHelper::setupPublicKey();
     $publicKey = PublicKeyHelper::create(Constants::VIRGIL_PRIVATE_KEY, Constants::VIRGIL_PUBLIC_KEY);
     UserDataHelper::persist($publicKey->userData->get(0)->id->userDataId, MailinatorHelper::fetchMessage(Constants::VIRGIL_USER_DATA_VALUE1));
     $publicKey = PublicKeyHelper::get($publicKey->publicKeyId);
     $this->assertEquals(Constants::VIRGIL_PUBLIC_KEY, $publicKey->publicKey);
     PublicKeyHelper::delete($publicKey->publicKeyId, Constants::VIRGIL_PRIVATE_KEY);
     try {
         PublicKeyHelper::get($publicKey->publicKeyId);
     } catch (WebException $ex) {
         $this->assertEquals(404, $ex->getHttpStatusCode());
     }
 }
예제 #8
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function execute()
 {
     ob_start();
     $harmoni = Harmoni::instance();
     /*********************************************************
      * Other headers and footers
      *********************************************************/
     $outputHandler = $harmoni->getOutputHandler();
     // Add our common Harmoni javascript libraries
     require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php";
     print Segue_MediaLibrary::getHeadHtml();
     $outputHandler->setHead(ob_get_clean());
     UserDataHelper::writeHeadJs();
     // Get the plugin asset id
     $harmoni->request->startNamespace('plugin_manager');
     $id = RequestContext::value('plugin_id');
     if (RequestContext::value('extended') == 'true') {
         $showExtended = true;
     } else {
         $showExtended = false;
     }
     $harmoni->request->endNamespace();
     // Get the plugin asset object
     $repositoryManager = Services::getService("Repository");
     $idManager = Services::getService("Id");
     $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.segue.sites_repository"));
     $asset = $repository->getAsset($idManager->getId($id));
     $pluginManager = Services::getService("Plugs");
     $plugin = $pluginManager->getPlugin($asset);
     if (!is_object($plugin)) {
         print $plugin;
     } else {
         if ($showExtended) {
             print $plugin->executeAndGetExtendedMarkup(TRUE);
         } else {
             print $plugin->executeAndGetMarkup(TRUE);
         }
     }
     // 		exit();
     $block = new UnstyledBlock(ob_get_clean());
     return $block;
 }
예제 #9
0
    /**
     * Execute this action.
     * 
     * @return mixed
     * @access public
     * @since 4/25/05
     */
    function execute()
    {
        $title = $this->getHeadingText();
        $harmoni = Harmoni::instance();
        $harmoni->request->startNamespace('media');
        $nodeId = RequestContext::value('node');
        $harmoni->request->endNamespace();
        $POLYPHONY_PATH = POLYPHONY_PATH;
        $MYPATH = MYPATH;
        print <<<END
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
\t<title>{$title}</title>

END;
        require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php";
        print UserDataHelper::getHeadJs();
        print Segue_MediaLibrary::getHeadHtml();
        print <<<END
\t
\t<script type='text/javascript'>
\t\t// <![CDATA[
\t\t
\t\tMediaLibrary.prototype.onClose = function () { 
\t\t\twindow.close();
\t\t}
\t\t
\t\t// ]]>
\t</script>
\t
</head>
<body onload="this.onUse = function (mediaFile) { window.opener.SetUrl(mediaFile.getUrl());}; MediaLibrary.run('{$nodeId}', this); ">
\t
</body>
</html>


END;
        exit;
    }
예제 #10
0
 /**
  * Add Javascript function to our header
  * 
  * @return void
  * @access protected
  * @since 7/25/08
  */
 protected function addHeadJs()
 {
     UserDataHelper::writeHeadJs();
     $harmoni = Harmoni::instance();
     ob_start();
     print "\n\n \t\t<script type='text/javascript' src='" . MYPATH . "/javascript/scriptaculous-js/lib/prototype.js'></script>\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/scriptaculous-js/src/scriptaculous.js'></script>\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "javascript/CenteredPanel.js'></script>\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/AliasPanel.js'></script>\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/MigrationPanel.js'></script>\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/ArchiveStatus.js'></script>\n\t\t\n\t\t<style type='text/css'>\n\t\t\t/* Other portal styles are in the static CSS file, images/SegueCommon.css */\n\t\t\tul.portal_folders li {\n\t\t\t\tlist-style-image:  url(" . MYPATH . "/images/icons/16x16/folder_open.png);\n\t\t\t}\n\t\t</style>\n\t\t";
     $handler = $harmoni->getOutputHandler();
     $handler->setHead($handler->getHead() . ob_get_clean());
 }
예제 #11
0
 /**
  * Add the header controls to the main screen gui component
  * 
  * @param object Component $mainScreen
  * @return object Component The allWrapper
  * @access public
  * @since 4/7/08
  */
 public function addHeaderControls(Component $mainScreen)
 {
     $harmoni = Harmoni::instance();
     /*********************************************************
      * Additional setup
      *********************************************************/
     $rootSiteComponent = SiteDispatcher::getCurrentRootNode();
     $outputHandler = $harmoni->getOutputHandler();
     /*********************************************************
      * Theme
      *********************************************************/
     $outputHandler->setCurrentTheme($rootSiteComponent->getTheme());
     /*********************************************************
      * Other headers and footers
      *********************************************************/
     // 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(SiteDispatcher::getCurrentNode()->acceptVisitor(new BreadCrumbsVisitor(SiteDispatcher::getCurrentNode())));
     print "</title>";
     // Add our common Harmoni javascript libraries
     require POLYPHONY_DIR . "/main/library/Harmoni.js.inc.php";
     print Segue_MediaLibrary::getHeadHtml();
     $outputHandler->setHead(ob_get_clean());
     UserDataHelper::writeHeadJs();
     // Add the RSS head links
     RssLinkPrinter::addHeadLinks(SiteDispatcher::getCurrentNode());
     // Add the selection Panel
     Segue_Selection::instance()->addHeadJavascript();
     $allWrapper = new Container(new YLayout(), BLANK, 1);
     if (defined('SEGUE_SITE_HEADER')) {
         $this->siteMessage = $allWrapper->add(new Component($this->getSegueSiteHeader(), BLANK, 1), "100%", null, CENTER, TOP);
     }
     // :: login, links and commands
     $this->headRow = $allWrapper->add(new Container(new XLayout(), BLANK, 1), $rootSiteComponent->getWidth(), null, CENTER, TOP);
     $this->leftHeadColumn = $this->headRow->add($this->getSegueLinksComponent(), null, null, LEFT, TOP);
     $rightHeadColumn = $this->headRow->add(new Container(new YLayout(), BLANK, 1), null, null, CENTER, TOP);
     $rightHeadColumn->add($this->getLoginComponent(), null, null, RIGHT, TOP);
     if ($this->isAuthorizedToExecute()) {
         $rightHeadColumn->add($this->getCommandsComponent(), null, null, RIGHT, TOP);
     }
     $allWrapper->add($mainScreen, $rootSiteComponent->getWidth(), null, CENTER, TOP);
     // :: Top Row ::
     // 		$this->headRow = $mainScreen->add(
     // 			new Container(new XLayout, HEADER, 1),
     // 			"100%", null, CENTER, TOP);
     // 		$this->leftHeadColumn = $this->headRow->add(
     // 			new UnstyledBlock("<h1>".$rootSiteComponent->getTitleMarkup()."</h1>"),
     // 			null, null, LEFT, TOP);
     return $allWrapper;
 }