function test_collections()
 {
     $collection = new StyleCollection("div", null, "The Block", "Some Blocky Block");
     $collection->addSP(new ColorSP("#FFBBAA"));
     $css1 = $collection->getCSS();
     $css2 = "div {\n\tcolor: #FFBBAA;\n}\n";
     $this->assertIdentical($css1, $css2);
     $this->assertFalse($collection->canBeApplied());
     // another one
     $collection = new StyleCollection("p.col3", "col3", "The Block", "Some Blocky Block");
     $sp = $collection->addSP(new ColorSP("#FFBBAA"));
     $collection->addSP(new BorderSP("3em", "solid", "#421"));
     $css1 = $collection->getCSS("\t\t");
     $css2 = "\t\tp.col3 {\n\t\t\tcolor: #FFBBAA;\n\t\t\tborder: 3em solid #421;\n\t\t}\n";
     $this->assertIdentical($css1, $css2);
     $this->assertTrue($collection->canBeApplied());
     $this->assertIdentical($collection->getClassSelector(), "col3");
     $this->assertNotNull($collection->_SPs['color']);
     $sp1 = $collection->removeSP($sp);
     $this->assertReference($sp1, $sp);
     $this->assertTrue(!isset($collection->_SPs['color']));
     $sps = $collection->getSPs();
     $this->assertTrue(!isset($sps['color']));
 }
예제 #2
0
 /**
  * The constructor. All initialization and Theme customization is performed
  * here.
  * @access public
  **/
 function SimpleTheme()
 {
     $this->Theme("Simple Theme", "A simple theme with rounded boxes.");
     // =====================================================================
     // global Theme style
     $body = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
     $body->addSP(new BackgroundColorSP("#FFF"));
     $body->addSP(new ColorSP("#000"));
     //$body->addSP(new FontFamilySP("Verdana"));
     $body->addSP(new PaddingSP("0px"));
     $body->addSP(new MarginSP("0px"));
     $this->addGlobalStyle($body);
     // 		$links = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
     // 		$links->addSP(new TextDecorationSP("underline"));
     // 		$this->addGlobalStyle($links);
     //
     // 		$links_hover = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of hover links.");
     // 		$links_hover->addSP(new TextDecorationSP("underline"));
     // 		$this->addGlobalStyle($links_hover);
     //
     // =====================================================================
     // Block 1 style
     $block1 = new StyleCollection("*.block1", "block1", "Block 1", "The main block where normally all of the page content goes in.");
     $block1->addSP(new BackgroundColorSP("#DDD"));
     $block1->addSP(new PaddingSP("10px"));
     $block1->addSP(new MarginSP("10px"));
     $this->addStyleForComponentType($block1, BLOCK, 1);
     //
     // 		// =====================================================================
     // 		// Block 2 style
     // 		$block2 = new StyleCollection("*.block2", "block2", "Block 2", "A 2nd level block.");
     // 		//$block2->addSP(new PaddingSP("10px"));
     // 		$block2->addSP(new TextAlignSP("justify"));
     // 		$this->addStyleForComponentType($block2, BLOCK, 2);
     //
     // 		// =====================================================================
     // 		// Block 3 style
     // 		$block3 = new StyleCollection("*.block3", "block3", "Block 3", "A 3rd level block.");
     // 		//$block3->addSP(new BackgroundColorSP("#FFFFFF"));
     // 		//$block3->addSP(new ColorSP("#000"));
     // 		//$block3->addSP(new BorderSP("1px", "solid", "#000"));
     // 		$block3->addSP(new PaddingSP("10px"));
     // 		$block3->addSP(new TextAlignSP("justify"));
     // 		$this->addStyleForComponentType($block3, BLOCK, 3);
     //
     // 		// =====================================================================
     // 		// Block 4 style
     // 		$block4 = new StyleCollection("*.block4", "block4", "Block 4", "A 4th level block.");
     // 		$block4->addSP(new BackgroundColorSP("#D4D4D4"));
     // 		$block4->addSP(new ColorSP("#000"));
     // 		$block4->addSP(new BorderTopSP("1px", "solid", "#000"));
     // 		$block4->addSP(new BorderRightSP("1px", "solid", "#000"));
     // 		$block4->addSP(new BorderBottomSP("1px", "solid", "#000"));
     // 		$block4->addSP(new BorderLeftSP("1px", "solid", "#000"));
     // 		$block4->addSP(new PaddingSP("10px"));
     // 		$block4->addSP(new MarginSP("10px"));
     // 		$this->addStyleForComponentType($block4, BLOCK, 4);
     //
     // 		// =====================================================================
     // 		// Heading 1 style
     // 		$heading1 = new StyleCollection("*.heading1", "heading1", "Heading 1", "A 1st level heading.");
     // 		$heading1->addSP(new ColorSP("#F00"));
     // 		$heading1->addSP(new FontSizeSP("200%"));
     // 		$this->addStyleForComponentType($heading1, HEADING, 1);
     //
     // 		// =====================================================================
     // 		// Heading 2 style
     // 		$heading2 = new StyleCollection("*.heading2", "heading2", "Heading 2", "A 2nd level heading.");
     // 		$heading2->addSP(new BackgroundColorSP("#D4D4D4"));
     // 		$heading2->addSP(new ColorSP("#007"));
     // 		$heading2->addSP(new FontSizeSP("125%"));
     // 		$heading2->addSP(new PaddingSP("10px"));
     // 		$heading2->addSP(new MarginSP("10px"));
     // 		$heading2->addSP(new BorderTopSP("1px", "solid", "#000"));
     // 		$this->addStyleForComponentType($heading2, HEADING, 2);
     //
     // 		// =====================================================================
     // 		// Footer 1 style
     // 		$footer1 = new StyleCollection("*.footer1", "footer1", "Footer 1", "A 1st level footer.");
     // 		$footer1->addSP(new ColorSP("#959595"));
     // 		$footer1->addSP(new MarginSP("10px"));
     // 		$footer1->addSP(new FontSizeSP("125%"));
     // 		$this->addStyleForComponentType($footer1, FOOTER, 1);
     //
     // 		// =====================================================================
     // 		// Menu 1 style
     // 		$menu1 = new StyleCollection("*.menu1", "menu1", "Menu 1", "A 1st level menu.");
     // 		$menu1->addSP(new BackgroundColorSP("#D4D4D4"));
     // 		$menu1->addSP(new ColorSP("#000"));
     // 		$menu1->addSP(new BorderSP("1px", "solid", "#000"));
     // 		$this->addStyleForComponentType($menu1, MENU, 1);
     //
     // 		// =====================================================================
     // 		// Menu Heading 1 style
     // 		$menuHeading1 = new StyleCollection("*.menuHeading1", "menuHeading1", "Menu Heading 1", "A 1st level menu heading.");
     // 		$menuHeading1->addSP(new DisplaySP("block"));
     // 		$menuHeading1->addSP(new BackgroundColorSP("#AAA"));
     // 		$menuHeading1->addSP(new PaddingSP("10px"));
     // 		//$menuHeading1->addSP(new FontWeightSP("bold"));
     // 		$this->addStyleForComponentType($menuHeading1, MENU_ITEM_HEADING, 1);
     //
     // 		// =====================================================================
     // 		// Menu Unselected Link 1 style
     // 		$menuLink1_unselected = new StyleCollection("*.menuLink1_unselected a", "menuLink1_unselected", "Unselected Menu Link 1", "A 1st level unselected menu link.");
     // 		$menuLink1_unselected->addSP(new DisplaySP("block"));
     // 		$menuLink1_unselected->addSP(new BackgroundColorSP("#D4D4D4"));
     // 		$menuLink1_unselected->addSP(new PaddingSP("10px"));
     // 		$this->addStyleForComponentType($menuLink1_unselected, MENU_ITEM_LINK_UNSELECTED, 1);
     //
     // 		$menuLink1_hover = new StyleCollection("*.menuLink1_hover a:hover", "menuLink1_hover", "Menu Link 1 Hover", "A 1st level menu link hover behavior.");
     // 		$menuLink1_hover->addSP(new BackgroundColorSP("#AAA"));
     // 		$this->addStyleForComponentType($menuLink1_hover, MENU_ITEM_LINK_UNSELECTED, 1);
     //
     // 		// =====================================================================
     // 		// Menu Selected Link 1 style
     // 		$menuLink1_selected = new StyleCollection("*.menuLink1_selected a", "menuLink1_selected", "Selected Menu Link 1", "A 1st level selected menu link.");
     // 		$menuLink1_selected->addSP(new DisplaySP("block"));
     // 		$menuLink1_selected->addSP(new BackgroundColorSP("#AAA"));
     // 		$menuLink1_selected->addSP(new PaddingSP("10px"));
     // 		$this->addStyleForComponentType($menuLink1_selected, MENU_ITEM_LINK_SELECTED, 1);
 }
 /**
  * Returns a layout of the Results
  * 
  * @param optional string $shouldPrintFunction The name of a function that will
  *		return a boolean specifying whether or not to filter a given result.
  *		If null, all results are printed.
  * @return object Layout A layout containing the results/page links
  * @access public
  * @date 8/5/04
  */
 function getLayout($shouldPrintFunction = NULL)
 {
     $defaultTextDomain = textdomain("polyphony");
     $startingNumber = $this->getStartingNumber();
     $yLayout = new YLayout();
     $container = new Container($yLayout, OTHER, 1);
     $endingNumber = $startingNumber + $this->_pageSize - 1;
     $numItems = 0;
     $resultContainer = new Container($this->_resultLayout, OTHER, 1);
     if ($this->_iterator->hasNext()) {
         // trash the items before our starting number
         while ($this->_iterator->hasNext() && $numItems + 1 < $startingNumber) {
             $item = $this->_iterator->next();
             // Ignore this if it should be filtered.
             if (is_null($shouldPrintFunction)) {
                 $shouldPrint = true;
             } else {
                 $shouldPrint = call_user_func_array($shouldPrintFunction, array($item));
             }
             if ($shouldPrint) {
                 $numItems++;
             }
         }
         // print up to $this->_pageSize items
         $pageItems = 0;
         while ($this->_iterator->hasNext() && $numItems < $endingNumber) {
             $item = $this->_iterator->next();
             // Only Act if this item isn't to be filtered.
             if (is_null($shouldPrintFunction)) {
                 $shouldPrint = true;
             } else {
                 $shouldPrint = call_user_func_array($shouldPrintFunction, array($item));
             }
             if ($shouldPrint) {
                 $numItems++;
                 $pageItems++;
                 $itemArray = array($item);
                 $params = array_merge($itemArray, $this->_callbackParams);
                 // Add in our starting number to the end so that that it is accessible.
                 $params[] = $numItems;
                 $itemLayout = call_user_func_array($this->_callbackFunction, $params);
                 $resultContainer->add($itemLayout, floor(100 / $this->_numColumns) . "%", "100%", CENTER, TOP);
                 // If $itemLayout is not unset, since it is an object,
                 // it may references to it made in add() will be changed.
                 unset($itemLayout);
             }
         }
         //if we have a partially empty last row, add more empty layouts
         // to better-align the columns
         // 			while ($pageItems % $this->_numColumns != 0) {
         // 				$currentRow->addComponent(new Content(" &nbsp; "));
         // 				$pageItems++;
         // 			}
         // find the count of items
         while ($this->_iterator->hasNext()) {
             $item = $this->_iterator->next();
             // Ignore this if it should be filtered.
             if (is_null($shouldPrintFunction)) {
                 $shouldPrint = true;
             } else {
                 $shouldPrint = call_user_func_array($shouldPrintFunction, array($item));
             }
             if ($shouldPrint) {
                 $numItems++;
             }
         }
     } else {
         $text = new Block("<ul><li>" . _("No items are available.") . "</li></ul>", STANDARD_BLOCK);
         $resultContainer->add($text, null, null, CENTER, CENTER);
     }
     /*********************************************************
      *  Page Links
      * ------------
      * print out links to skip to more items if the number of Items is greater
      * than the number we display on the page
      *********************************************************/
     if ($linksHTML = $this->getPageLinks($startingNumber, $numItems)) {
         // Add the links to the page
         $pageLinkBlock = new Block($linksHTML, BACKGROUND_BLOCK);
         $container->add($pageLinkBlock, "100%", null, CENTER, CENTER);
         $styleCollection = new StyleCollection("*.result_page_links", "result_page_links", "Result Page Links", "Links to other pages of results.");
         $styleCollection->addSP(new MarginTopSP("10px"));
         $pageLinkBlock->addStyle($styleCollection);
     }
     $container->add($resultContainer, "100%", null, LEFT, CENTER);
     if ($numItems > $this->_pageSize) {
         $container->add($pageLinkBlock, null, null, CENTER, CENTER);
     }
     $this->numItemsPrinted = $numItems;
     textdomain($defaultTextDomain);
     return $container;
 }
예제 #4
0
 /**
  * The constructor. All initialization and Theme customization is performed
  * here.
  * @access public
  **/
 function SimpleTheme()
 {
     $this->Theme("Simple Theme", "A simple theme with rounded boxes.");
     // =====================================================================
     // global Theme style
     $collection = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
     $collection->addSP(new BackgroundColorSP("#fff"));
     $collection->addSP(new ColorSP("#000"));
     //$collection->addSP(new FontFamilySP("Verdana"));
     $collection->addSP(new PaddingSP("0px"));
     $collection->addSP(new MarginSP("1px"));
     $this->addGlobalStyle($collection);
     $collection = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
     $collection->addSP(new TextDecorationSP("underline"));
     $collection->addSP(new ColorSP("#FFF"));
     // 		$collection->addSP(new FontWeightSP("bold"));
     $this->addGlobalStyle($collection);
     //
     // 		$collection = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of hover links.");
     // 		$collection->addSP(new TextDecorationSP("underline"));
     // 		$this->addGlobalStyle($collection);
     //
     // =====================================================================
     // Block 1 style
     $collection = new StyleCollection("*.block1", "block1", "Block 1", "The main block where normally all of the page content goes in.");
     // 		$collection->addSP(new BackgroundColorSP("#DDD"));
     // 		$collection->addSP(new PaddingSP("10px"));
     // 		$collection->addSP(new MarginSP("10px"));
     $this->addStyleForComponentType($collection, BLOCK, 1);
     // =====================================================================
     // Block 2 style
     $collection = new CornersStyleCollection("*.block2", "block2", "Block 2", "A 2nd level block. Used for standard content");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#ccc"));
     $collection->addSP(new ColorSP("#000"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $this->addStyleForComponentType($collection, BLOCK, 2);
     $collection = new StyleCollection("*.block2 a", "block2", "Block 2 Links", "Properties of links");
     $collection->addSP(new ColorSP("#000"));
     $this->addStyleForComponentType($collection, BLOCK, 2);
     // =====================================================================
     // Block 3 style
     $collection = new CornersStyleCollection("*.block3", "block3", "Block 3", "A 3rd level block. Used for emphasized content such as Wizards.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#AAA9A9"));
     $collection->addSP(new ColorSP("#000"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $this->addStyleForComponentType($collection, BLOCK, 3);
     // =====================================================================
     // Block 4 style
     $collection = new CornersStyleCollection("*.block4", "block4", "Block 4", "A 4th level block. Used for alerts and highlit dialog boxes.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $this->addStyleForComponentType($collection, BLOCK, 4);
     // =====================================================================
     // Heading 1 style
     $collection = new CornersStyleCollection("*.heading1", "heading1", "Heading 1", "A 1st level heading.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#666666"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $collection->addSP(new ColorSP("#fff"));
     $collection->addSP(new FontSizeSP("175%"));
     $this->addStyleForComponentType($collection, HEADING, 1);
     // =====================================================================
     // Heading 2 style
     $collection = new CornersStyleCollection("*.heading2", "heading2", "Heading 2", "A 2nd level heading.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#AAA9A9"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $collection->addSP(new ColorSP("#fff"));
     $collection->addSP(new FontSizeSP("125%"));
     $this->addStyleForComponentType($collection, HEADING, 2);
     // =====================================================================
     // Header 1 style
     $collection = new CornersStyleCollection("*.header1", "header1", "Header 1", "A 1st level header.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#666666"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $collection->addSP(new ColorSP("#fff"));
     // 		$collection->addSP(new FontSizeSP("200%"));
     $this->addStyleForComponentType($collection, HEADER, 1);
     // =====================================================================
     // Footer 1 style
     $collection = new CornersStyleCollection("*.footer1", "footer1", "Footer 1", "A 1st level footer.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#666666"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("right"));
     $collection->addSP(new ColorSP("#fff"));
     $collection->addSP(new FontSizeSP("75%"));
     $this->addStyleForComponentType($collection, FOOTER, 1);
     // =====================================================================
     // Menu 1 style
     $collection = new CornersStyleCollection("*.menu1", "menu1", "Menu 1", "A 1st level menu.");
     $collection->setBorderUrl("TopLeft", MYPATH . "/themes/SimpleTheme/images/corner_TL.gif");
     $collection->setBorderUrl("TopRight", MYPATH . "/themes/SimpleTheme/images/corner_TR.gif");
     $collection->setBorderUrl("BottomLeft", MYPATH . "/themes/SimpleTheme/images/corner_BL.gif");
     $collection->setBorderUrl("BottomRight", MYPATH . "/themes/SimpleTheme/images/corner_BR.gif");
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     // 		$collection->addSP(new BorderSP("1px", "solid", "#000"));
     $collection->addSP(new PaddingSP("10px"));
     $collection->addSP(new MarginSP("1px"));
     $collection->addSP(new TextAlignSP("left"));
     $this->addStyleForComponentType($collection, MENU, 1);
     // =====================================================================
     // Menu Heading 1 style
     $collection = new StyleCollection("*.menuHeading1", "menuHeading1", "Menu Heading 1", "A 1st level menu heading.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new PaddingSP("5px"));
     //$collection->addSP(new FontWeightSP("bold"));
     $this->addStyleForComponentType($collection, MENU_ITEM_HEADING, 1);
     // =====================================================================
     // Menu Unselected Link 1 style
     $collection = new StyleCollection("*.menuLink1_unselected a", "menuLink1_unselected", "Unselected Menu Link 1", "A 1st level unselected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new FontSizeSP("larger"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 1);
     $collection = new StyleCollection("*.menuLink1_hover a:hover", "menuLink1_hover", "Menu Link 1 Hover", "A 1st level menu link hover behavior.");
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 1);
     // =====================================================================
     // Menu Selected Link 1 style
     $collection = new StyleCollection("*.menuLink1_selected a", "menuLink1_selected", "Selected Menu Link 1", "A 1st level selected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new FontSizeSP("larger"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_SELECTED, 1);
     // =====================================================================
     // Menu Unselected Link 2 style
     $collection = new StyleCollection("*.menuLink2_unselected a", "menuLink2_unselected", "Unselected Menu Link ", "A 2nd level unselected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("10px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 2);
     $collection = new StyleCollection("*.menuLink2_hover a:hover", "menuLink2_hover", "Menu Link 2 Hover", "A 2nd level menu link hover behavior.");
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 2);
     // =====================================================================
     // Menu Selected Link 2 style
     $collection = new StyleCollection("*.menuLink2_selected a", "menuLink2_selected", "Selected Menu Link 2", "A 2nd level selected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("10px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_SELECTED, 2);
     // =====================================================================
     // Menu Unselected Link 3 style
     $collection = new StyleCollection("*.menuLink3_unselected a", "menuLink3_unselected", "Unselected Menu Link ", "A 3nd level unselected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("20px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 3);
     $collection = new StyleCollection("*.menuLink3_hover a:hover", "menuLink3_hover", "Menu Link 3 Hover", "A 3nd level menu link hover behavior.");
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 3);
     // =====================================================================
     // Menu Selected Link 3 style
     $collection = new StyleCollection("*.menuLink3_selected a", "menuLink3_selected", "Selected Menu Link 3", "A 3nd level selected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("20px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_SELECTED, 3);
     // =====================================================================
     // Menu Unselected Link 4 style
     $collection = new StyleCollection("*.menuLink4_unselected a", "menuLink4_unselected", "Unselected Menu Link ", "A 4nd level unselected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("30px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 4);
     $collection = new StyleCollection("*.menuLink4_hover a:hover", "menuLink4_hover", "Menu Link 4 Hover", "A 4nd level menu link hover behavior.");
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 4);
     // =====================================================================
     // Menu Selected Link 4 style
     $collection = new StyleCollection("*.menuLink4_selected a", "menuLink4_selected", "Selected Menu Link 4", "A 4nd level selected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("30px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_SELECTED, 4);
     // =====================================================================
     // Menu Unselected Link 5 style
     $collection = new StyleCollection("*.menuLink5_unselected a", "menuLink5_unselected", "Unselected Menu Link ", "A 5nd level unselected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#FD9453"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("40px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 5);
     $collection = new StyleCollection("*.menuLink5_hover a:hover", "menuLink5_hover", "Menu Link 5 Hover", "A 5nd level menu link hover behavior.");
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_UNSELECTED, 5);
     // =====================================================================
     // Menu Selected Link 5 style
     $collection = new StyleCollection("*.menuLink5_selected a", "menuLink5_selected", "Selected Menu Link 5", "A 5nd level selected menu link.");
     $collection->addSP(new DisplaySP("block"));
     $collection->addSP(new BackgroundColorSP("#C77441"));
     $collection->addSP(new ColorSP("#FFF"));
     $collection->addSP(new PaddingSP("5px"));
     $collection->addSP(new MarginLeftSP("40px"));
     $this->addStyleForComponentType($collection, MENU_ITEM_LINK_SELECTED, 5);
 }
 /**
  * Answer a placeholder for a menu target
  * 
  * @param object MenuOrganizerSiteComponent $organizer
  * @return Component
  * @access protected
  * @since 12/18/07
  */
 protected function getMenuTargetPlaceholder(MenuOrganizerSiteComponent $organizer)
 {
     // Add a placeholder to our target if we don't have any children
     ob_start();
     print "<div style='height: 50px;'>";
     $authZ = Services::getService("AuthZ");
     $idMgr = Services::getService("Id");
     if ($authZ->isUserAuthorized($idMgr->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId())) {
         print _("This Section has no Pages yet. <br/><br/>Add a Page by clicking the <strong>+ Page</strong> button for this Section and choose 'Page'.");
     } else {
         print " ";
         print "\n</div>";
         return new UnstyledBlock(ob_get_clean());
     }
     print "\n</div>";
     $placeholder = new UnstyledBlock(ob_get_clean());
     $title = str_replace('%1', $organizer->getParentComponent()->getDisplayName(), _("<em>Sub-Menu of</em> %1 <em>Target Placeholder</em>"));
     $controlsHTML = $this->getControlsHTML($organizer, $title, '', '#F00', '#F99', '#F66');
     $placeholder->setPreHTML($controlsHTML);
     $styleCollection = new StyleCollection('.placeholder_red_outline', 'placeholder_red_outline', 'Red Outline', 'A red outline around a menu placeholder');
     $styleCollection->addSP(new BorderSP('1px', 'solid', '#F00'));
     $placeholder->addStyle($styleCollection);
     return $placeholder;
 }
 function test_menu_components()
 {
     $theme = new Theme("", "");
     $heading = new MenuItemHeading("hoho", 3);
     $this->assertIdentical($heading->getType(), MENU_ITEM_HEADING);
     $this->assertIdentical($heading->getDisplayName(), "hoho");
     //			$comp->render($theme);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $this->assertIdentical($comp->getDisplayName(), "Google");
     $this->assertIdentical($comp->getURL(), "http://www.google.com");
     $this->assertTrue($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "_BLANK");
     $this->assertIdentical($comp->getAccessKey(), "g");
     $this->assertIdentical($comp->getToolTip(), "Go to the Google search page");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_SELECTED);
     $comp->setDisplayName("1");
     $comp->setURL("2");
     $comp->setSelected(false);
     $comp->setTarget("4");
     $comp->setAccessKey("5");
     $comp->setToolTip("6");
     $this->assertIdentical($comp->getDisplayName(), "1");
     $this->assertIdentical($comp->getURL(), "2");
     $this->assertFalse($comp->isSelected());
     $this->assertIdentical($comp->getTarget(), "4");
     $this->assertIdentical($comp->getAccessKey(), "5");
     $this->assertIdentical($comp->getToolTip(), "6");
     $this->assertIdentical($comp->getType(), MENU_ITEM_LINK_UNSELECTED);
     $comp = new MenuItemLink("Google", "http://www.google.com", true, 1, "_BLANK", "g", "Go to the Google search page");
     $comp->addAttribute("name", "haha");
     //			$comp->render($theme);
     $menuStyle = new StyleCollection("*.menu", "menu", "Menu Style", "Style for the menu.");
     $menuStyle->addSP(new BackgroundColorSP("#997755"));
     $menuStyle->addSP(new BorderSP("1px", "solid", "#FFFFFF"));
     $menu = new Menu(new XLayout(), 4, $menuStyle);
     $this->assertTrue(!isset($comp->_selectedId));
     $menu->add($comp, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 1);
     $this->assertIdentical($comp->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp);
     $comp1 = $comp;
     $menu->add($comp1, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $comp2 = $comp;
     $comp2->setSelected(false);
     $menu->add($comp2, "100px", null, CENTER);
     $this->assertIdentical($menu->_selectedId, 2);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), true);
     $this->assertIdentical($comp2->isSelected(), false);
     $this->assertReference($menu->getSelected(), $comp1);
     $menu->select(3);
     $this->assertIdentical($comp->isSelected(), false);
     $this->assertIdentical($comp1->isSelected(), false);
     $this->assertIdentical($comp2->isSelected(), true);
     $this->assertReference($menu->getSelected(), $comp2);
     $menu->add($heading, "100px", null, CENTER);
     echo "<style>";
     echo $menuStyle->getCSS();
     echo "</style>";
     $menu->render($theme);
 }
예제 #7
0
$bodyStyle->addSP(new TextAlignSP("center"));
$mainBoxStyle = new StyleCollection("*.mainBoxStyle", "mainBoxStyle", "Main Box Style", "Style for the main box.");
$mainBoxStyle->addSP(new BackgroundColorSP("#FFF3C2"));
$mainBoxStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$mainBoxStyle->addSP(new WidthSP("750px"));
$mainBoxStyle->addSP(new MarginTopSP("5px"));
$mainBoxStyle->addSP(new MarginBottomSP("5px"));
$mainBoxStyle->addSP(new MarginLeftSP("auto"));
$mainBoxStyle->addSP(new MarginRightSP("auto"));
$mainBoxStyle->addSP(new PaddingSP("5px"));
$menuBoxStyle = new StyleCollection("*.menuBoxStyle", "menuBoxStyle", "Menu Box Style", "Style for the menu box.");
$menuBoxStyle->addSP(new BackgroundColorSP("#AAA58F"));
$menuBoxStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$menuBoxStyle->addSP(new MarginSP("5px"));
$menuBoxStyle->addSP(new PaddingSP("5px"));
$menuItemsStyle = new StyleCollection("*.menuItemsStyle", "menuItemsStyle", "Menu Items Style", "Style for the menu items.");
$menuItemsStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$menuItemsStyle->addSP(new BackgroundColorSP("#5B5666"));
$menuItemsStyle->addSP(new ColorSP("#FFF9E0"));
$menuItemsStyle->addSP(new WidthSP("80px"));
$menuItemsStyle->addSP(new MarginSP("5px"));
$menuItemsStyle->addSP(new PaddingSP("5px"));
$menuItemsStyle->addSP(new FontSP("Verdana", "10pt", null, "bold"));
$mainContentStyle = new StyleCollection("*.mainContentStyle", "mainContentStyle", "Main Content Style", "Style for the main content.");
$mainContentStyle->addSP(new BackgroundColorSP("#AAA58F"));
$mainContentStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$mainContentStyle->addSP(new MarginSP("5px"));
$mainContentStyle->addSP(new PaddingSP("5px"));
$mainContentStyle->addSP(new TextAlignSP("justify"));
// =============================================================================
// Create some containers & components. This stuff would normally go in an action.
예제 #8
0
 /**
  * The constructor. All initialization and Theme customization is performed
  * here.
  * @access public
  **/
 function DobomodeTheme()
 {
     $this->Theme("Dobomode Theme", "The Dobomode Theme by Dobo Radichkov. Visit <a href=\"http://www.dobomode.com\">www.dobomode.com</a> for more information.");
     // Add some global styles
     // =====================================================================
     // body
     $style = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
     $style->addSP(new FontFamilySP("'Arial', 'Helvetica', 'Verdana'"));
     $style->addSP(new FontSizeSP("10pt"));
     $style->addSP(new ColorSP("#262D34"));
     $style->addSP(new BackgroundColorSP("#5D7D9C"));
     $style->addSP(new TextAlignSP("center"));
     $style->addSP(new OverflowSP("auto"));
     $style->addSP(new MarginSP("0px"));
     // the following scrollbar style properties are not part of GUIManager
     // create them manually
     $sp = new StyleProperty("scrollbar-face-color", "Scrollbar Face Color", "Scrollbar Face Color");
     $sp->addSC(new ColorSC("#A4B9CD"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-shadow-color", "Scrollbar Shadow Color", "Scrollbar Shadow Color");
     $sp->addSC(new ColorSC("#A4B9CD"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-highlight-color", "Scrollbar Highlight Color", "Scrollbar Highlight Color");
     $sp->addSC(new ColorSC("#FFFFFF"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-darkshadow-color", "Scrollbar Darkshadow Color", "Scrollbar Darkshadow Color");
     $sp->addSC(new ColorSC("#262D34"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-3dlight-color", "Scrollbar 3D Light Color", "Scrollbar 3D Light Color");
     $sp->addSC(new ColorSC("#262D34"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-track-color", "Scrollbar Track Track", "Scrollbar Track Color");
     $sp->addSC(new ColorSC("#4C5A68"));
     $style->addSP($sp);
     $sp = new StyleProperty("scrollbar-arrow-color", "Scrollbar Arrow Color", "Scrollbar Arrow Color");
     $sp->addSC(new ColorSC("#262D34"));
     $style->addSP($sp);
     $this->addGlobalStyle($style);
     // =====================================================================
     // anchors
     $style = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
     $style->addSP(new TextDecorationSP("none"));
     $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
     $style->addSP(new ColorSP("#323B44"));
     $this->addGlobalStyle($style);
     $style = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of links when the mouse pointer is over them.");
     $style->addSP(new ColorSP("#FFFFFF"));
     $this->addGlobalStyle($style);
     // =====================================================================
     // initialize wrapper object
     $style = new StyleCollection("*.wrapper", "wrapper", "Wrapper Style", "Style settings for wrapper component.");
     $style->addSP(new WidthSP("700px"));
     $style->addSP(new MarginSP("auto"));
     $style->addSP(new TextAlignSP("left"));
     $this->_wrapper = new Container(new FlowLayout(), BLOCK, 0, $style);
     // =====================================================================
     // initialize main container object
     $style = new StyleCollection("*.main", "main", "Main Box Style", "Style settings for main content box.");
     $style->addSP(new FloatSP("right"));
     // total width with borders and padding = 500
     $style->addSP(new WidthSP("468px"));
     // total height with borders and padding = 400
     $style->addSP(new HeightSP("356px"));
     $style->addSP(new OverflowSP("auto"));
     $style->addSP(new BackgroundColorSP("#CFDBE6"));
     $style->addSP(new BorderSP("1px", "solid", "#262D34"));
     $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
     $style->addSP(new MarginTopSP("20px"));
     $style->addSP(new MarginLeftSP("10px"));
     $style->addSP(new PaddingTopSP("20px"));
     $style->addSP(new PaddingBottomSP("20px"));
     $style->addSP(new PaddingLeftSP("15px"));
     $style->addSP(new PaddingRightSP("15px"));
     $this->_main = new Container(new FlowLayout(), BLOCK, 0, $style);
     $this->_wrapper->add($this->_main);
     // =====================================================================
     // initialize main menu
     // styles for level 1 menu
     $style = new StyleCollection("*.menu_1", "menu_1", "Level 1 Menu Style", "Style settings for level 1 menus.");
     $style->addSP(new FloatSP("left"));
     // total width with borders and padding = 160
     $style->addSP(new WidthSP("138px"));
     $style->addSP(new OverflowSP("hidden"));
     $style->addSP(new BackgroundColorSP("#CFDBE6"));
     $style->addSP(new BorderSP("1px", "solid", "#262D34"));
     $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
     $style->addSP(new MarginTopSP("20px"));
     $style->addSP(new MarginRightSP("10px"));
     $style->addSP(new PaddingBottomSP("10px"));
     $style->addSP(new PaddingLeftSP("10px"));
     $style->addSP(new PaddingRightSP("10px"));
     $this->addStyleForComponentType($style, MENU, 1);
     // styles for level 1 menu item links
     $style = new StyleCollection("*.menu_item_link_1 a", "menu_item_link_1", "Level 1 Menu Link Style", "Style settings for level 1 menu links.");
     $style->addSP(new BackgroundColorSP("#A4B9CD"));
     $style->addSP(new ColorSP("#262D34"));
     $style->addSP(new BorderSP("1px", "solid", "#262D34"));
     $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
     $style->addSP(new FontWeightSP("bold"));
     $style->addSP(new TextAlignSP("center"));
     $style->addSP(new MarginSP("8px"));
     $style->addSP(new MarginTopSP("15px"));
     $style->addSP(new PaddingSP("3px"));
     $style->addSP(new DisplaySP("block"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 1);
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 1);
     $style = new StyleCollection("*.menu_item_link_1 a:hover", "menu_item_link_1", "Level 1 Menu Link Hover Style", "Hover style settings for level 1 menu links.");
     $style->addSP(new BackgroundColorSP("#4C5A68"));
     $style->addSP(new ColorSP("#FFFFFF"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 1);
     $style = new StyleCollection("*.menu_item_link_selected_1 a", "menu_item_link_selected_1", "Level 1 Selected Menu Link Style", "Style settings for level 1 selected menu links.");
     $style->addSP(new BorderSP("2px", "solid", "#262D34"));
     $style->addSP(new BackgroundColorSP("#4C5A68"));
     $style->addSP(new ColorSP("#FFFFFF"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 1);
     // styles for level 1 menu item headings
     $style = new StyleCollection("*.menu_item_heading_1", "menu_item_heading_1", "Level 1 Menu Heading", "Style settings for level 1 menu heading.");
     $style->addSP(new ColorSP("#000000"));
     $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
     $style->addSP(new FontWeightSP("bold"));
     $style->addSP(new TextAlignSP("center"));
     $style->addSP(new MarginTopSP("10px"));
     $style->addSP(new DisplaySP("block"));
     $this->addStyleForComponentType($style, MENU_ITEM_HEADING, 1);
     // styles for level 2 menu
     $style = new StyleCollection("*.menu_2", "menu_2", "Level 2 Menu Style", "Style settings for level 2 menus.");
     $style->addSP(new FloatSP("left"));
     $style->addSP(new FontSizeSP("8pt"));
     // total width with borders and padding = 120
     $style->addSP(new WidthSP("108px"));
     $style->addSP(new OverflowSP("hidden"));
     $style->addSP(new BackgroundColorSP("#CFDBE6"));
     $style->addSP(new BorderSP("1px", "solid", "#262D34"));
     $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
     $style->addSP(new MarginTopSP("20px"));
     $style->addSP(new MarginLeftSP("20px"));
     $style->addSP(new MarginRightSP("20px"));
     $style->addSP(new PaddingBottomSP("5px"));
     $style->addSP(new PaddingLeftSP("5px"));
     $style->addSP(new PaddingRightSP("5px"));
     $this->addStyleForComponentType($style, MENU, 2);
     // styles for level 2 menu item links
     $style = new StyleCollection("*.menu_item_link_2 a", "menu_item_link_2", "Level 2 Menu Link Style", "Style settings for level 2 menu links.");
     $style->addSP(new BackgroundColorSP("#A4B9CD"));
     $style->addSP(new ColorSP("#262D34"));
     $style->addSP(new BorderSP("1px", "solid", "#262D34"));
     $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
     $style->addSP(new FontWeightSP("bold"));
     $style->addSP(new TextAlignSP("center"));
     $style->addSP(new MarginSP("5px"));
     $style->addSP(new MarginTopSP("5px"));
     $style->addSP(new PaddingSP("1px"));
     $style->addSP(new DisplaySP("block"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 2);
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 2);
     $style = new StyleCollection("*.menu_item_link_2 a:hover", "menu_item_link_2", "Level 2 Menu Link Hover Style", "Hover style settings for level 2 menu links.");
     $style->addSP(new BackgroundColorSP("#4C5A68"));
     $style->addSP(new ColorSP("#FFFFFF"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 2);
     $style = new StyleCollection("*.menu_item_link_selected_2 a", "menu_item_link_selected_2", "Level 2 Selected Menu Link Style", "Style settings for level 2 selected menu links.");
     $style->addSP(new BorderSP("2px", "solid", "#262D34"));
     $style->addSP(new BackgroundColorSP("#4C5A68"));
     $style->addSP(new ColorSP("#FFFFFF"));
     $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 2);
 }
예제 #9
0
 /**
  * 
  * 
  * @param <##>
  * @return <##>
  * @access public
  * @since 1/18/06
  */
 public function printSiteShort(Asset $asset, $action, $num, Slot $otherSlot = null)
 {
     $harmoni = Harmoni::instance();
     $assetId = $asset->getId();
     $authZ = Services::getService('AuthZ');
     $idMgr = Services::getService('Id');
     if (!$authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId) && !$otherSlot->isUserOwner()) {
         return new UnstyledBlock('', BLANK);
     }
     $container = new Container(new YLayout(), BLOCK, STANDARD_BLOCK);
     $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container.");
     $fillContainerSC->addSP(new MinHeightSP("88%"));
     // 	$fillContainerSC->addSP(new WidthSP("100%"));
     // 	$fillContainerSC->addSP(new BorderSP("3px", "solid", "#F00"));
     $container->addStyle($fillContainerSC);
     $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
     $centered->addSP(new TextAlignSP("center"));
     // Use the alias instead of the Id if it is available.
     $viewUrl = SiteDispatcher::getSitesUrlForSiteId($assetId->getIdString());
     $slotManager = SlotManager::instance();
     try {
         $sitesTrueSlot = $slotManager->getSlotBySiteId($assetId);
     } catch (Exception $e) {
     }
     // Print out the content
     ob_start();
     print "\n\t<div class='portal_list_slotname'>";
     if (isset($sitesTrueSlot)) {
         if (is_null($otherSlot) || $sitesTrueSlot->getShortname() == $otherSlot->getShortname()) {
             print $sitesTrueSlot->getShortname();
         } else {
             print $otherSlot->getShortname();
             $targets = array();
             $target = $otherSlot->getAliasTarget();
             while ($target) {
                 $targets[] = $target->getShortname();
                 if ($target->isAlias()) {
                     $target = $target->getAliasTarget();
                 } else {
                     $target = null;
                 }
             }
             print "\n<br/>";
             print str_replace('%1', implode(' &raquo; ', $targets), _("(an alias of %1)"));
             // Add Alias info.
             // 				if ($otherSlot->isAlias()) {
             // 					ob_start();
             //
             // 					print _("This slot is an alias of ").$slot->getAliasTarget()->getShortname();
             //
             // 					$container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, TOP);
             // 				}
         }
     } else {
         print _("ID#") . ": " . $assetId->getIdString();
     }
     print "\n\t</div>";
     print "\n\t<div class='portal_list_site_title'>";
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         print "\n\t\t<a href='" . $viewUrl . "'>";
         print "\n\t\t\t<strong>" . HtmlString::getSafeHtml($asset->getDisplayName()) . "</strong>";
         print "\n\t\t</a>";
         print "\n\t\t<br/>";
         print "\n\t\t<a href='" . $viewUrl . "' style='font-size: smaller;'>";
         print "\n\t\t\t" . $viewUrl;
         print "\n\t\t</a>";
     }
     print "\n\t</div>";
     print "\n\t<div class='portal_list_controls'>\n\t\t";
     $controls = array();
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         $controls[] = "<a href='" . $viewUrl . "'>" . _("view") . "</a>";
     }
     // Hide all edit links if not authenticated to prevent web spiders from traversing them
     if ($this->isAuthenticated) {
         // While it is more correct to check modify permission permission, doing
         // so forces us to check AZs on the entire site until finding a node with
         // authorization or running out of nodes to check. Since edit-mode actions
         // devolve into view-mode if no authorization is had by the user, just
         // show the links all the time to cut page loads from 4-6 seconds to
         // less than 1 second.
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
             $controls[] = "<a href='" . SiteDispatcher::quickURL($action->getUiModule(), 'editview', array('node' => $assetId->getIdString())) . "'>" . _("edit") . "</a>";
         }
         // 		if ($action->getUiModule() == 'ui2') {
         // 			$controls[] = "<a href='".SiteDispatcher::quickURL($action->getUiModule(), 'arrangeview', array('node' => $assetId->getIdString()))."'>"._("arrange")."</a>";
         // 		}
         // add link to tracking
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
             $trackUrl = $harmoni->request->quickURL("participation", "actions", array('node' => $assetId->getIdString()));
             ob_start();
             print " <a target='_blank' href='" . $trackUrl . "'";
             print ' onclick="';
             print "var url = '" . $trackUrl . "'; ";
             print "window.open(url, 'site_map', 'width=600,height=600,resizable=yes,scrollbars=yes'); ";
             print "return false;";
             print '"';
             print ">" . _("track") . "</a>";
             $controls[] = ob_get_clean();
         }
         if (!is_null($otherSlot) && $otherSlot->isAlias() && $otherSlot->isUserOwner()) {
             $controls[] = "<a href='" . $harmoni->request->quickURL('slots', 'remove_alias', array('slot' => $otherSlot->getShortname())) . "' onclick=\"if (!confirm('" . str_replace("%1", $otherSlot->getShortname(), str_replace("%2", $otherSlot->getAliasTarget()->getShortname(), _("Are you sure that you want \\'%1\\' to no longer be an alias of \\'%2\\'?"))) . "')) { return false; }\">" . _("remove alias") . "</a>";
         } else {
             if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.delete'), $assetId)) {
                 $controls[] = "<a href='" . $harmoni->request->quickURL($action->getUiModule(), 'deleteComponent', array('node' => $assetId->getIdString())) . "' onclick=\"if (!confirm('" . _("Are you sure that you want to permenantly delete this site?") . "')) { return false; }\">" . _("delete") . "</a>";
             }
         }
         // Add a control to select this site for copying. This should probably
         // have its own authorization, but we'll use add_children/modify for now.
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $assetId)) {
             if (isset($sitesTrueSlot) && (is_null($otherSlot) || $sitesTrueSlot->getShortname() == $otherSlot->getShortname())) {
                 $controls[] = Segue_Selection::instance()->getAddLink(SiteDispatcher::getSiteDirector()->getSiteComponentFromAsset($asset));
             }
         }
     }
     print implode("\n\t\t | ", $controls);
     print "\n\t</div>";
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         $description = HtmlString::withValue($asset->getDescription());
         $description->trim(25);
         print "\n\t<div class='portal_list_site_description'>" . $description->asString() . "</div>";
     }
     print "\n\t<div style='clear: both;'></div>";
     print $this->getExportControls($assetId, $otherSlot, $sitesTrueSlot);
     $component = new UnstyledBlock(ob_get_clean());
     $container->add($component, "100%", null, LEFT, TOP);
     return $container;
 }
예제 #10
0
function printSlideShort($asset, $params, $slideshowIdString, $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"));
    $idManager = Services::getService("Id");
    $repositoryManager = Services::getService("Repository");
    $authZ = Services::getService("AuthZ");
    // Get our record and its data
    $slideRecords = $asset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure"));
    if ($slideRecords->hasNext()) {
        $slideRecord = $slideRecords->next();
        // Text-Position
        $textPosition = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.text_position", $slideRecord);
        // Display Metadata
        $displayMetadata = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.display_metadata", $slideRecord);
        // Media
        $mediaIdStringObj = getFirstPartValueFromRecord("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.target_id", $slideRecord);
        if (strlen($mediaIdStringObj->asString())) {
            $mediaId = $idManager->getId($mediaIdStringObj->asString());
        } else {
            $mediaId = null;
        }
    }
    // ------------------------------------------
    ob_start();
    print "\n\t<a style='cursor: pointer;'";
    print " onclick='Javascript:window.open(";
    print '"' . VIEWER_URL . "?&amp;source=";
    print urlencode($harmoni->request->quickURL('exhibitions', "slideshowOutlineXml", array('slideshow_id' => $slideshowIdString)));
    print '&amp;start=' . ($num - 1) . '", ';
    print '"_blank", ';
    print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
    print ")'>";
    $viewerATag = ob_get_clean();
    /*********************************************************
     * Media
     *********************************************************/
    if (isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId) && $_SESSION["show_thumbnail"] == 'true') {
        $mediaAsset = $repositoryManager->getAsset($mediaId);
        $mediaAssetId = $mediaAsset->getId();
        $mediaAssetRepository = $mediaAsset->getRepository();
        $mediaAssetRepositoryId = $mediaAssetRepository->getId();
        $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($mediaAsset);
        if ($thumbnailURL !== FALSE) {
            $thumbSize = $_SESSION["thumbnail_size"] . "px";
            ob_start();
            print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto;'>";
            print $viewerATag;
            print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' style='max-height: {$thumbSize}; max-width: {$thumbSize};' class='thumbnail_image' />";
            print "\n\t</a>";
            print "\n</div>";
            $component = new UnstyledBlock(ob_get_clean());
            $component->addStyle($centered);
            $container->add($component, "100%", null, CENTER, CENTER);
        }
        // other files
        $fileRecords = $mediaAsset->getRecordsByRecordStructure($idManager->getId("FILE"));
    }
    // Link to viewer
    $numFiles = 0;
    if (isset($fileRecords)) {
        while ($fileRecords->hasNext()) {
            $record = $fileRecords->next();
            $numFiles++;
        }
    }
    ob_start();
    print "\n<div height='15px; font-size: small;'>";
    print $viewerATag;
    print _("Open in Viewer");
    if ($numFiles > 1) {
        print " (" . ($numFiles - 1) . " " . _("more files") . ")";
    }
    print "\n\t</a>";
    print "\n</div>";
    $component = new UnstyledBlock(ob_get_clean());
    $component->addStyle($centered);
    $container->add($component, "100%", null, CENTER, CENTER);
    // Title
    ob_start();
    if ($_SESSION["show_displayName"] == 'true') {
        print "\n\t<div style='font-weight: bold; height: 50px; overflow: auto;'>" . htmlspecialchars($asset->getDisplayName()) . "</div>";
    }
    // Caption
    if ($_SESSION["show_description"] == 'true') {
        $description = HtmlString::withValue($asset->getDescription());
        $description->clean();
        if (isset($thumbnailURL)) {
            print "\n\t<div style='font-size: smaller; height: 100px; overflow: auto;'>";
        } else {
            print "\n\t<div style='font-size: smaller; height: " . ($_SESSION["thumbnail_size"] + 100) . "px; overflow: auto;'>";
        }
        print $description->asString();
        if (isset($displayMetadata) && $displayMetadata->isTrue() && isset($mediaId) && $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId)) {
            print "\t\t\t<hr/>\n";
            $mediaAsset = $repositoryManager->getAsset($mediaId);
            printTargetAsset($mediaAsset);
        }
        // Unauthorized to view Media Message
        if (isset($mediaId) && !$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $mediaId)) {
            print "\t\t\t<div style='font-size: large; font-weight: bold; border: 2px dotted; padding: 5px;'>";
            $harmoni = Harmoni::instance();
            print "\n\t\t\t\t<p>";
            print _("You are not authorized to view the media for this slide.");
            print "</p>\n\t\t\t\t<p>";
            print _("If you have not done so, please go to ");
            print "<a href='" . $harmoni->request->quickURL("home", "welcome");
            print "'>Concerto</a>";
            print _(" and log in.");
            print "\t\t\t\t</p>\n\t\t\t</div>\n";
        }
        print "</div>";
    }
    $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, TOP);
    // Controls
    ob_start();
    // Authorization Icons
    print _("Slide: ") . AuthZPrinter::getAZIcon($asset->getId());
    if (isset($mediaId) && $mediaId) {
        print "<br/>" . _("Media: ") . AuthZPrinter::getAZIcon($mediaId);
    }
    $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, BOTTOM);
    return $container;
}
예제 #11
0
 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;
 }
예제 #12
0
 /**
  * The constructor. All initialization and Theme customization is performed
  * here.
  * @access public
  **/
 function SimpleTheme1()
 {
     $this->Theme("Simple Theme One", "A basic theme based on simple borders and colored blocks.");
     // =====================================================================
     // global Theme style
     $body = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
     $body->addSP(new BackgroundColorSP("#AAA"));
     $body->addSP(new ColorSP("#000"));
     $body->addSP(new FontSP("Verdana", "10pt"));
     $body->addSP(new PaddingSP("0px"));
     $body->addSP(new MarginSP("0px"));
     $this->addGlobalStyle($body);
     $links = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
     $links->addSP(new TextDecorationSP("none"));
     $this->addGlobalStyle($links);
     $links_hover = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of hover links.");
     $links_hover->addSP(new TextDecorationSP("underline"));
     $this->addGlobalStyle($links_hover);
     $person = new StyleCollection("*.person", "person", "Person", "Person?");
     $person->addSP(new TextAlignSP("left"));
     $this->addGlobalStyle($person, BLOCK, 1);
     // =====================================================================
     // Block 1 style
     $block1 = new StyleCollection("*.block1", "block1", "Block 1", "The main block where normally all of the page content goes in.");
     $block1->addSP(new BackgroundColorSP("#FFFFFF"));
     $block1->addSP(new ColorSP("#000"));
     $block1->addSP(new BorderTopSP("1px", "solid", "#000"));
     $block1->addSP(new BorderRightSP("2px", "solid", "#000"));
     $block1->addSP(new BorderBottomSP("2px", "solid", "#000"));
     $block1->addSP(new BorderLeftSP("1px", "solid", "#000"));
     $block1->addSP(new PaddingSP("10px"));
     $block1->addSP(new MarginSP("10px"));
     $block1->addSP(new WidthSP("700px"));
     $this->addStyleForComponentType($block1, BLOCK, 1);
     // =====================================================================
     // Block 2 style
     $block2 = new StyleCollection("*.block2", "block2", "Block 2", "A 2nd level block.");
     $block2->addSP(new PaddingSP("10px"));
     $block2->addSP(new TextAlignSP("justify"));
     $this->addStyleForComponentType($block2, BLOCK, 2);
     // =====================================================================
     // Block 3 style
     $block3 = new StyleCollection("*.block3", "block3", "Block 3", "A 3rd level block.");
     $block3->addSP(new BackgroundColorSP("#EAEAEA"));
     $block3->addSP(new ColorSP("#000"));
     $block3->addSP(new BorderTopSP("2px", "solid", "#000"));
     $block3->addSP(new BorderRightSP("1px", "solid", "#000"));
     $block3->addSP(new BorderBottomSP("1px", "solid", "#000"));
     $block3->addSP(new BorderLeftSP("1px", "solid", "#000"));
     $block3->addSP(new PaddingSP("10px"));
     $block3->addSP(new FloatSP("right"));
     $block3->addSP(new MarginLeftSP("10px"));
     $block3->addSP(new MarginBottomSP("10px"));
     $block3->addSP(new WidthSP("200px"));
     $block3->addSP(new TextAlignSP("justify"));
     $block3->addSP(new FontSizeSP("8pt"));
     $this->addStyleForComponentType($block3, BLOCK, 3);
     // =====================================================================
     // Heading 1 style
     $heading1 = new StyleCollection("*.heading1", "heading1", "Heading 1", "A 1st level heading.");
     $heading1->addSP(new ColorSP("#F00"));
     $heading1->addSP(new FontSizeSP("150%"));
     $this->addStyleForComponentType($heading1, HEADING, 1);
     // =====================================================================
     // Heading 2 style
     $heading2 = new StyleCollection("*.heading2", "heading2", "Heading 2", "A 2nd level heading.");
     $heading2->addSP(new ColorSP("#007"));
     $heading2->addSP(new FontSizeSP("125%"));
     $heading2->addSP(new PaddingSP("10px"));
     $heading2->addSP(new MarginSP("10px"));
     $heading2->addSP(new BorderTopSP("2px", "solid", "#000"));
     $this->addStyleForComponentType($heading2, HEADING, 2);
     // =====================================================================
     // Footer 1 style
     $footer1 = new StyleCollection("*.footer1", "footer1", "Footer 1", "A 1st level footer.");
     $footer1->addSP(new ColorSP("#959595"));
     $footer1->addSP(new MarginSP("10px"));
     $footer1->addSP(new FontSizeSP("125%"));
     $this->addStyleForComponentType($footer1, FOOTER, 1);
     // =====================================================================
     // Menu 1 style
     $menu1 = new StyleCollection("*.menu1", "menu1", "Menu 1", "A 1st level menu.");
     $menu1->addSP(new BackgroundColorSP("#D4D4D4"));
     $menu1->addSP(new ColorSP("#000"));
     $menu1->addSP(new BorderTopSP("2px", "solid", "#000"));
     $menu1->addSP(new BorderRightSP("1px", "solid", "#000"));
     $menu1->addSP(new BorderBottomSP("1px", "solid", "#000"));
     $menu1->addSP(new BorderLeftSP("1px", "solid", "#000"));
     $this->addStyleForComponentType($menu1, MENU, 1);
     // =====================================================================
     // Menu 2 style
     $menu2 = new StyleCollection("*.menu2", "menu2", "Menu 2", "A 2nd level menu.");
     $menu2->addSP(new BackgroundColorSP("#D4D4D4"));
     $menu2->addSP(new ColorSP("#000"));
     $menu2->addSP(new BorderTopSP("2px", "solid", "#000"));
     $menu2->addSP(new BorderRightSP("1px", "solid", "#000"));
     $menu2->addSP(new BorderBottomSP("1px", "solid", "#000"));
     $menu2->addSP(new BorderLeftSP("1px", "solid", "#000"));
     $menu2->addSP(new WidthSP("150px"));
     $menu2->addSP(new FloatSP("left"));
     $menu2->addSP(new MarginRightSP("10px"));
     $menu2->addSP(new MarginBottomSP("10px"));
     $this->addStyleForComponentType($menu2, MENU, 2);
     // =====================================================================
     // Menu Heading 1 style
     $menuHeading1 = new StyleCollection("*.menuHeading1", "menuHeading1", "Menu Heading 1", "A 1st level menu heading.");
     $menuHeading1->addSP(new BackgroundColorSP("#EAEAEA"));
     $menuHeading1->addSP(new PaddingSP("6px"));
     $menuHeading1->addSP(new FontWeightSP("bold"));
     $this->addStyleForComponentType($menuHeading1, MENU_ITEM_HEADING, 1);
     // =====================================================================
     // Menu Unselected Link 1 style
     $menuLink1_unselected = new StyleCollection("*.menuLink1_unselected a", "menuLink1_unselected", "Unselected Menu Link 1", "A 1st level unselected menu link.");
     $menuLink1_unselected->addSP(new DisplaySP("block"));
     $menuLink1_unselected->addSP(new BackgroundColorSP("#D4D4D4"));
     $menuLink1_unselected->addSP(new PaddingSP("5px"));
     $this->addStyleForComponentType($menuLink1_unselected, MENU_ITEM_LINK_UNSELECTED, 1);
     $menuLink1_hover = new StyleCollection("*.menuLink1_hover a:hover", "menuLink1_hover", "Menu Link 1 Hover", "A 1st level menu link hover behavior.");
     $menuLink1_hover->addSP(new BackgroundColorSP("#AAA"));
     $this->addStyleForComponentType($menuLink1_hover, MENU_ITEM_LINK_UNSELECTED, 1);
     // =====================================================================
     // Menu Selected Link 1 style
     $menuLink1_selected = new StyleCollection("*.menuLink1_selected a", "menuLink1_selected", "Selected Menu Link 1", "A 1st level selected menu link.");
     $menuLink1_selected->addSP(new DisplaySP("block"));
     $menuLink1_selected->addSP(new BackgroundColorSP("#AAA"));
     $menuLink1_selected->addSP(new PaddingSP("5px"));
     $this->addStyleForComponentType($menuLink1_selected, MENU_ITEM_LINK_SELECTED, 1);
 }
예제 #13
0
 function test_menu_theme()
 {
     $menuStyle = new StyleCollection("*.menu", "menu", "Menu Style", "Style for the menu.");
     $menuStyle->addSP(new BackgroundColorSP("#997755"));
     $menuStyle->addSP(new BorderSP("1px", "solid", "#FFFFFF"));
     $menu = new Menu(new XLayout(), 4, $menuStyle);
     $theme = new MenuThemeAbstract("Master", "And Servant");
     $theme->addMenu($menu, 1);
     $menu1 = $theme->getMenu(1);
     $this->assertReference($menu, $menu1);
 }
예제 #14
0
function printAssetShort($assetId, $num)
{
    $harmoni = Harmoni::instance();
    $repositoryManager = Services::getService("Repository");
    $asset = $repositoryManager->getAsset($assetId);
    $container = new Container(new YLayout(), BLOCK, STANDARD_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') {
        $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset);
        if ($thumbnailURL !== FALSE) {
            $xmlStart = $num - 1;
            $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 '"' . VIEWER_URL . "?&amp;source=";
            print urlencode($harmoni->request->quickURL("basket", "browse_xml"));
            print '&amp;start=' . $xmlStart . '", ';
            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 thumbnail_image' 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(25);
        print "\n\t<div style='font-size: smaller; height: 50px; overflow: auto;'>" . $description->asString() . "</div>";
    }
    $component = new UnstyledBlock(ob_get_contents());
    ob_end_clean();
    $container->add($component, "100%", null, LEFT, TOP);
    ob_start();
    print "\n<a href='";
    print $harmoni->request->quickURL("basket", "remove", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _("Remove from Selection") . "'>";
    print _('remove');
    print "</a>";
    print "\n | <a href='";
    print $harmoni->request->quickURL("basket", "up", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _('move up') . "'>";
    // 	print "<img src='".POLYPHONY_PATH."/icons/basket/arrowleft.png' width='25px' border='0' alt='"._("Move Up")."' />";
    print "&lt;--";
    print "</a>";
    print "\n | <a href='";
    print $harmoni->request->quickURL("basket", "down", array('asset_id' => $assetId->getIdString()));
    print "' title='" . _('move down') . "'>";
    // 	print "<img src='".POLYPHONY_PATH."/icons/basket/arrowright.png' width='25px' border='0'  alt='"._("Move Down")."'  />";
    print "--&gt;";
    print "</a>";
    $container->add(new UnstyledBlock(ob_get_clean()), "100%", null, RIGHT, BOTTOM);
    return $container;
}