function sDisplay()
 {
     global $goApp, $webyep_sProductName;
     $s = "";
     $oImg = od_nil;
     $oLink = od_nil;
     $oImgURL = od_clone($goApp->oImageURL);
     $oPageURL = od_clone(WYURL::oCurrentURL());
     $oNoticeURL = od_clone($goApp->oProgramURL);
     unset($oPageURL->dQuery[WY_QK_LOGOUT]);
     $oNoticeURL->addComponent(WYTS("LogonURL"));
     if (!$goApp->bEditMode) {
         if ($this->bVisible) {
             $oImgURL->addComponent("logon-button.gif");
             $oImg = new WYImage($oImgURL);
         } else {
             $oImgURL->addComponent("nix.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("width", 16);
             $oImg->setAttribute("height", 16);
         }
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("WebYepLogon"));
         $oLink = new WYLink($oNoticeURL);
         if ($goApp->bValidUser()) {
             $oPageURL->dQuery[WY_QK_EDITMODE] = "yes" . mt_rand(1000, 9999);
             $oLink->setAttribute("onclick", "document.location=\"" . $oPageURL->sEURL() . "\"; return false;");
         } else {
             $oLink->setAttribute("onclick", webyep_sHTMLEntities($goApp->sAuthWindowJS()) . "; return false;");
         }
         $oLink->setInnerHTML($oImg->sDisplay());
         $sToolTip = WYTS("LogonButton");
         $sToolTip = str_replace("WebYep", $webyep_sProductName, $sToolTip);
         $oLink->setToolTip($sToolTip);
         $s = $oLink->sDisplay();
     } else {
         $oImgURL->addComponent("logoff-button.gif");
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("style", "border: none");
         $oImg->setAttribute("alt", WYTS("LogoffButton"));
         $oPageURL->dQuery[WY_QK_EDITMODE] = "no" . mt_rand(1000, 9999);
         $oLink = new WYLink($oPageURL);
         $oLink->setInnerHTML($oImg->sDisplay());
         $oLink->setToolTip(WYTS("LogoffButton"));
         $oLink->setAttribute("onclick", "if (event.shiftKey || event.altKey) this.href += \"&" . WY_QK_LOGOUT . "=1\"; return true;");
         $s = $oLink->sDisplay();
     }
     return $s;
 }
Exemple #2
0
    $oImg->setAttribute("height", $iHeight);
    $oImg->setAttribute("style", "border: 0");
    unset($oTrashLink);
    unset($oTrashLinkURL);
    $oTrashLinkURL = od_clone(WYURL::oCurrentURL());
    $oTrashLinkURL->dQuery[ACTION] = ACTION_DELETE;
    $oTrashLinkURL->dQuery[FILENAME] = $sFilename;
    $oTrashLink = new WYLink($oTrashLinkURL);
    $oTrashLink->setAttribute("onclick", "return confirmDelete()");
    $oTrashLink->setInnerHTML($oTrashImg->sDisplay());
    $oTrashLink->setToolTip(WYTS("DeleteImageButton"));
    unset($oSelectLink);
    $oSelectLink = new WYLink(new WYURL("javascript:void(0)"));
    $oSelectLink->setAttribute("onclick", "returnURL(\"" . $sURL . "\"); return false;");
    $oSelectLink->setInnerHTML($oImg->sDisplay());
    $oSelectLink->setToolTip($sDisplayFilename);
    echo "<td>";
    echo $oSelectLink->sDisplay();
    echo "<div style=\"margin-bottom: 16px; margin-top: 6px; text-align: center\">";
    echo $oTrashLink->sDisplay();
    echo "</div>";
    echo "</td>";
    $iCol++;
    if ($iCol == NUM_COLS) {
        echo "</tr>\n";
        $iCol = 0;
    }
}
?>
</table>
</div>
Exemple #3
0
 function sDisplay()
 {
     global $goApp, $webyep_bOpenFullURLsInNewWindow, $webyep_iUseImageBox, $webyep_oCurrentLoop;
     $sHTML = "";
     $oImg = od_clone($this->oImage());
     $sAltText = $this->sAltText();
     $sAtt = "";
     $sAnchor = "";
     $iLoop = 0;
     $oURL = od_nil;
     $iDW = $this->bIsThumb ? $this->iThumbWidth : $this->iImageWidth;
     $iDH = $this->bIsThumb ? $this->iThumbHeight : $this->iImageHeight;
     if ($oImg) {
         if ($iDW != 0 || $iDH != 0) {
             $iW = $oImg->iWidth();
             $iH = $oImg->iHeight();
             if ($iW != 0 && $iH != 0) {
                 // if image size could be determined
                 if ($iW > $iDW || $iH > $iDH) {
                     // image has not the correct size
                     list($iW, $iH) = $this->aContrainedSize($iW, $iH, $this->bIsThumb);
                     $this->sAttributes .= ($this->sAttributes ? " " : "") . "width=\"{$iW}\" height=\"{$iH}\"";
                 }
             }
         }
         if ($this->sAttributes) {
             if (stristr($this->sAttributes, "width=") || stristr($this->sAttributes, "height=")) {
                 // width or height can only be set in attributes if $this->iImageWidth/iThumbWidth are _not_ used!
                 $oImg->removeAttribute("width");
                 $oImg->removeAttribute("height");
             }
             if (stristr($this->sAttributes, "alt=")) {
                 $oImg->removeAttribute("alt");
             }
         }
         if ($this->sAttributes) {
             $sAtt = " " . $this->sAttributes;
         }
         if ($sAltText) {
             $oImg->setAttribute("alt", $sAltText);
         }
         $sHTML .= str_replace("<img", "<img{$sAtt}", $oImg->sDisplay());
         $oLink = od_nil;
         $sURL = $this->dContent[WY_DK_URL] ? $this->dContent[WY_DK_URL] : $this->sURL;
         if ($sURL) {
             $oURL = new WYURL($sURL);
             if (!$this->dContent[WY_DK_URL]) {
                 $iLoop = $goApp->oDocument->iLoopID();
                 if ($iLoop) {
                     $oURL->dQuery[WY_QK_DI] = $goApp->oDocument->iDocumentInstanceForLoopID($iLoop);
                 }
             }
             $oLink = new WYLink($oURL, "", true);
             if ($webyep_bOpenFullURLsInNewWindow && WYURL::bIsAbsolute($sURL)) {
                 $this->sTarget = "_blank";
             }
             if ($this->sTarget) {
                 $oLink->setAttribute("target", $this->sTarget);
             }
         }
         if ($this->bIsThumb && !$oLink) {
             if ($webyep_iUseImageBox == WEBYEP_LIGHTBOX) {
                 $oImg = $this->oDetailImage();
                 $oURL = $oImg->oURL;
                 if (!$oLink) {
                     $oLink = new WYLink($oURL);
                     if ($webyep_oCurrentLoop != od_nil) {
                         $sGroup = $webyep_oCurrentLoop->sFieldNameForFile();
                     } else {
                         $sGroup = "";
                     }
                     $oLink->setAttribute("rel", "lightbox" . ($sGroup ? "[{$sGroup}]" : ""));
                     $oLink->setAttribute("class", "WYPopUpImage");
                 }
             } else {
                 if ($webyep_iUseImageBox == WEBYEP_FANCYBOX) {
                     // use jquery.fancybox
                     $oImg = $this->oDetailImage();
                     $oURL = $oImg->oURL;
                     if (!$oLink) {
                         $oLink = new WYLink($oURL);
                         if ($webyep_oCurrentLoop != od_nil) {
                             $sGroup = $webyep_oCurrentLoop->sFieldNameForFile();
                         } else {
                             $sGroup = md5($oURL->sEURL());
                         }
                         // 'unique' ID to prevent Fancybox from grouping single pictures
                         $oLink->setAttribute("rel", "fancybox" . ($sGroup ? "_{$sGroup}" : ""));
                         $oLink->setAttribute("class", "WYPopUpImage");
                     }
                 } else {
                     $oURL = $this->oDetailWindowURL();
                     $oImg = $this->oDetailImage();
                     $iW = $oImg->iWidth();
                     $iH = $oImg->iHeight();
                     if ($iW == 0) {
                         $iW = 400;
                     }
                     if ($iH == 0) {
                         $iH = 400;
                     }
                     $oURL->dQuery[WY_QK_IMAGE_DETAIL] = $oImg->oURL->sBasename();
                     $oURL->dQuery[WY_QK_IMAGE_ALTTEXT] = $sAltText;
                     $oURL->dQuery[WY_QK_IMAGE_DEMOCONTENT] = $this->bDemoContent;
                     if (!$oLink) {
                         $oLink = new WYLink(new WYURL("javascript:void(0)"));
                     }
                     $oLink->setAttribute("onclick", sprintf("wydw=window.open(\"%s\", \"WYDetail\", \"width=%d,height=%d,status=yes,scrollbars=yes,resizable=yes\"); wydw.focus();", $oURL->sEURL(true, true, true), $iW, $iH));
                     $oLink->setAttribute("class", "WYPopUpImage");
                     if (!$sAltText) {
                         $oLink->setToolTip(WYTS("ClickToZoom"));
                     }
                 }
             }
         }
         if ($oLink) {
             // $oLink->setAttribute("class", "WYPopUpImage");
             if ($sAltText) {
                 $oLink->setToolTip($sAltText);
             }
             $oLink->setInnerHTML($sHTML);
             $sHTML = $oLink->sDisplay();
         }
     }
     return $sHTML;
 }
Exemple #4
0
 /**
  * Liefert den HTML-Code für das GalleryElement
  *
  * Diese Methode liefert den HTML-Code, der das GalleryElement in der Webseite darstellt.
  * Folgende globale Variablen beeinflussen die Arbeitsweise:
  * - $goApp										das globale Application-Objekt (gibt Auskunft über EditMode J/N, Programmpfad, Datenpfad)
  * - $webyep_bUseTablesForGalleries    sollen Tablellen oder DIVs für die Gallerie verwendet werden?
  * - $webyep_iUseImageBox					wird eine JavaScript-Anwendung zur Anzeige der Bilder verwendet?
  * - $webyep_sLiveDemoSlotID				TODO description
  *
  *	@return		string		HTML-Code des GalleryElement
  */
 function sDisplay()
 {
     global $goApp, $webyep_bUseTablesForGalleries, $webyep_iUseImageBox, $webyep_sLiveDemoSlotID;
     $sHTML = "";
     $iCount = count($this->_aItems());
     $i = 0;
     $iCols = $this->iCols;
     $bEditMode = $goApp->bEditMode;
     $sTNName = "";
     $oTN = $oLink = $oDetailURL = od_nil;
     $sText = $sFilename = "";
     $sBoxName = $this->sDataFileName(false);
     if ($iCount == 0 && !$bEditMode) {
         return "";
     }
     if ($webyep_iUseImageBox == WEBYEP_NOBOX) {
         $oDetailURL = od_clone($goApp->oProgramURL);
         $oDetailURL->addComponent("image-detail.php");
     }
     $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("<table class=\"%s\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n", WY_GALLERY_CSS_CONTAINER) : sprintf("<div class=\"%s\">\n", WY_GALLERY_CSS_CONTAINER);
     while ($i < $iCount || $iCount == 0 && $i == 0 && $bEditMode || $i % $iCols) {
         // new row?
         if (!($i % $iCols)) {
             $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("   <tr%s>\n", $i < $iCols ? " class=\"" . WY_GALLERY_CSS_FIRSTROW . "\"" : "") : sprintf("   <div style=\"overflow: hidden; zoom: 1.0\" class=\"%s%s\">\n", WY_GALLERY_CSS_ROW, $i < $iCols ? " " . WY_GALLERY_CSS_FIRSTROW : "");
         }
         $sHTML .= $webyep_bUseTablesForGalleries ? sprintf("      <td style=\"width: %dpx\"%s>", $this->iCellWidth, $i % $iCols == 0 ? " class=\"" . WY_GALLERY_CSS_FIRSTCOLUMN . "\"" : "") : sprintf("      <div style=\"float: left; width: %dpx\" class=\"%s%s\">", $this->iCellWidth, WY_GALLERY_CSS_CELL, $i % $iCols == 0 ? " " . WY_GALLERY_CSS_FIRSTCOLUMN : "");
         if ($i < $iCount) {
             $sHTML .= sprintf("<div class=\"%s\">", WY_GALLERY_CSS_IMAGE);
             $sFilename = $this->sFilenameForID($i);
             $sText = $this->sTextForID($i);
             if ($sFilename) {
                 $oTN =& $this->_oTNImage($sFilename);
                 unset($oLink);
                 if ($webyep_iUseImageBox == WEBYEP_LIGHTBOX) {
                     unset($oImgURL);
                     $oImgURL = od_clone($goApp->oDataURL);
                     $oImgURL->addComponent($sFilename);
                     if ($webyep_sLiveDemoSlotID) {
                         $oImg = new WYImage($oImgURL);
                         if (!$oImg->bExists()) {
                             $oImgURL->removeDemoSlotID();
                         }
                     }
                     $oLink = new WYLink($oImgURL, $sText ? $this->sStripFormatting($sText) : " ");
                     $oLink->setAttribute("rel", "lightbox[{$sBoxName}]");
                     $oLink->sInnerHTML = $oTN->sDisplay();
                     $sHTML .= $oLink->sDisplay();
                 } else {
                     if ($webyep_iUseImageBox == WEBYEP_FANCYBOX) {
                         unset($oImgURL);
                         $oImgURL = od_clone($goApp->oDataURL);
                         $oImgURL->addComponent($sFilename);
                         if ($webyep_sLiveDemoSlotID) {
                             $oImg = new WYImage($oImgURL);
                             if (!$oImg->bExists()) {
                                 $oImgURL->removeDemoSlotID();
                             }
                         }
                         $oLink = new WYLink($oImgURL, $sText ? $this->sStripFormatting($sText) : " ");
                         $oLink->setAttribute("rel", "fancybox_{$sBoxName}");
                         $oLink->setAttribute("class", "WYPopUpImage");
                         $oLink->sInnerHTML = $oTN->sDisplay();
                         $sHTML .= $oLink->sDisplay();
                     } else {
                         $oDetailURL->dQuery[WY_QK_IMAGE_DETAIL] = $sFilename;
                         $oDetailURL->dQuery[WY_QK_IMAGE_ALTTEXT] = $this->sStripFormatting($sText);
                         $oDetailURL->dQuery[WY_QK_IMAGE_DEMOCONTENT] = $this->bDemoContent;
                         $oLink = new WYLink(new WYURL("javascript:void(0)"));
                         $oLink->setAttribute("onclick", sprintf("wydw=window.open(\"%s\", \"WYDetail\", \"width=%d,height=%d,status=yes,scrollbars=no,resizable=yes\"); wydw.focus();", $oDetailURL->sEURL(true, true, true), $this->iImageWidth, $this->iImageHeight));
                         $oLink->setToolTip(WYTS("ClickToZoom"));
                         $oLink->sInnerHTML = $oTN->sDisplay();
                         $sHTML .= $oLink->sDisplay();
                     }
                 }
             } else {
                 if ($bEditMode) {
                     $sHTML .= WYTS("GalleryNoImage");
                 }
             }
             $sHTML .= "</div>";
         }
         if ($bEditMode && ($i < $iCount || $i == 0)) {
             $sHTML .= "\n<div>";
             $sHTML .= $this->_sEditButtons($i < $iCount ? $i : -1);
             $sHTML .= "</div>";
         }
         if ($i < $iCount) {
             if ($sText) {
                 $sHTML .= sprintf("<div class=\"%s\">", WY_GALLERY_CSS_TEXT);
                 // $sHTML .= webyep_sHTMLEntities($sText);
                 $sHTML .= WYLongTextElement::_sFormatContent($sText, true);
                 $sHTML .= "</div>";
             }
         }
         $sHTML .= $webyep_bUseTablesForGalleries ? "</td>\n" : "</div>\n";
         // /WY_GALLERY_CSS_CELL
         $i++;
         if (!($i % $iCols)) {
             $sHTML .= $webyep_bUseTablesForGalleries ? "   </tr>\n" : "   </div>\n";
         }
         // WY_GALLERY_CSS_ROW
     }
     $sHTML .= $webyep_bUseTablesForGalleries ? "</table>\n" : "</div>\n";
     // /WY_GALLERY_CSS_CONTAINER
     return $sHTML;
 }