Ejemplo n.º 1
0
 function sHiddenFieldsForElement(&$oElement)
 {
     // key: "WEBYEP_FIELDNAME" with value "Activity Photo's" results in:
     // <input type='hidden' name='WEBYEP_FIELDNAME' value='Activity Photo' s'="">
     $s = "";
     $d = WYEditor::dQueryForElement($oElement);
     foreach ($d as $sKey => $sValue) {
         $s .= '<input type="hidden" name="' . $sKey . '" value="' . $sValue . '">';
     }
     $s .= "<input type='hidden' name='" . WY_QK_ACTION . "' value='" . WY_QK_EDITOR_SAVE . "'>";
     return $s;
 }
Ejemplo n.º 2
0
    echo $oHFNewImage->sDisplay();
    ?>
</td></tr>
      </table>
      </form>
	<?php 
    echo $goApp->sHelpLink($sHelpFile);
    ?>
	<?php 
} else {
    /* else for 'if(!$bDidSave)' */
    echo "<div class='formFieldTitle'>";
    echo "<div class='response' style='font-size:12px'>{$sResponse}</div>";
    if ($bOK) {
        echo WYEditor::sPostSaveScript();
    } else {
        echo WYEditor::sPostSaveScript(true);
        // new parameter for static method, meaning: keep editor window (defaults to false)
        echo "<p class='textButton'>{$iNrOfErrors} Fehler!</p>";
        echo "<div style='width:100%'><div style='width:auto;margin:10px auto'><input type='button' class='formButton' value='" . WYTS("CloseWindow") . "' onclick='window.close()' /></div></div>";
        //  no backlink, because of problems keeping track of internal state!
    }
    echo "</div>";
}
?>
</td>
  </tr>
</table>
</body>
</html>
Ejemplo n.º 3
0
    WYTSD("SaveButton", true);
    ?>
">
               <?php 
    echo WYEditor::sHiddenFieldsForElement($oElement);
    ?>
</td>
           </tr>
         </table>
         </form>
      <?php 
    echo $goApp->sHelpLink($sHelpFile);
    ?>
      <?php 
} else {
    echo "<blockquote>";
    echo "<div class='response'>{$sResponse}</div>";
    if ($bOK) {
        echo WYEditor::sPostSaveScript();
    } else {
        echo "<p class='textButton'>" . webyep_sBackLink() . "</p>";
    }
    echo "</blockquote>";
}
?>
</td>
     </tr>
   </table>
</body>
</html>
Ejemplo n.º 4
0
    }
    function fatalError($sM)
    {
        print "fatal error: {$sM}<br>";
    }
    function &oSharedInstance()
    {
        global $goApp;
        return $goApp;
    }
}
if (!isset($webyep_bDocumentPage)) {
    $webyep_bDocumentPage = true;
}
$goApp = new WYApplication();
WYLanguage::setup();
// check for file managers and start session only if one is present
if (webyep_bHasFilemanager() && webyep_bHasEditPermissions()) {
    session_start();
}
// caution: WYDocument's constructor needs $goApp!
$goApp->oDocument = new WYDocument(WYURL::oCurrentURL());
$goApp->bEditPermission = $goApp->bEditMode;
if ($goApp->bEditPermission && !$goApp->bAuthCheck($webyep_bDocumentPage ? $goApp->oDocument->oDocPath : WYEditor::oEditedPagesPath())) {
    $goApp->bEditPermission = false;
    $_SESSION[WY_SV_IS_AUTH] = false;
}
if ($webyep_bLiveDemo && !$webyep_sLiveDemoSlotID && $webyep_bLiveDemoLockTemplate) {
    $goApp->bEditPermission = false;
    $_SESSION[WY_SV_IS_AUTH] = false;
}
Ejemplo n.º 5
0
 function showEditButtons()
 {
     global $goApp, $webyep_bShowDisabledEditButtons, $webyep_bOtherLoginsMayEditGlobalData;
     if ($goApp->bEditMode) {
         if ($this->iEditedID == $this->iLoopID) {
             $this->showAnchor();
         }
         if ($this->bUserMayEditThisElement()) {
             $oURL = od_clone(WYURL::oCurrentURL());
             unset($oURL->dQuery[WY_QK_LOOP_ADD_ABOVE]);
             $oLink = od_nil;
             $oImg = od_nil;
             $oImgURL = od_clone($goApp->oImageURL);
             $dEditQuery = WYEditor::dQueryForElement($this);
             $aLoopIDs = $this->_aLoopIDs();
             $iCount = count($aLoopIDs);
             $dEditQuery[WY_QK_LOOP_ID] = $this->iCurrentLoopID();
             $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_ADD);
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditQuery));
             $oURL->sAnchor = "WEBYEP_CURRENT_LOOP_ITEM";
             $oLink = new WYLink($oURL, WYTS("LoopAddButton"));
             $oImgURL->addComponent("add-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImg->setAttribute("alt", WYTS("LoopAddButton"));
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepLoopAddButton");
             $oLink->setAttribute("onclick", "webyep_loopAddBlockAboveBelow(this); return true;");
             echo $oLink->sDisplay();
             if ($iCount > 1) {
                 $dEditQuery = $oURL->dQuery;
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_REMOVE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopRemoveButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("remove-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopRemoveButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("LoopRemoveConfirm") . "\");");
                 $oLink->setAttribute("class", "WebYepLoopRemoveButton");
                 echo $oLink->sDisplay();
                 $oLink->removeAttribute("onclick");
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_UP);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopUpButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("up-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopUpButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopUpButton");
                 echo $oLink->sDisplay();
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_DOWN);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopDownButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("down-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopDownButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopDownButton");
                 echo $oLink->sDisplay();
             }
             if ($this->bIDIsDisabled($this->iCurrentLoopID())) {
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_ENABLE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopEnableButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("enable-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopEnableButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopEnabledButton");
                 echo $oLink->sDisplay();
             } else {
                 $goApp->setActionInQuery($dEditQuery, WY_QV_LOOP_DISABLE);
                 $oURL->setQuery($dEditQuery);
                 $oLink = new WYLink($oURL, WYTS("LoopDisableButton"));
                 $oImgURL->removeLastComponent();
                 $oImgURL->addComponent("disable-button.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("style", "border: none");
                 $oImg->setAttribute("alt", WYTS("LoopDisableButton"));
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", "WebYepLoopEnabledButton");
                 echo $oLink->sDisplay();
             }
         } else {
             // editing now allowed
             if ($webyep_bShowDisabledEditButtons) {
                 $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
                 $oImgURL = od_clone($goApp->oImageURL);
                 $oImgURL->addComponent("loop-buttons-disabled.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("border", 0);
                 $oImg->setAttribute("alt", $sToolTip);
                 $oLink = new WYLink(new WYURL("javascript:void(0);"), $sToolTip);
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", $this->sEditButtonCSSClass);
                 echo $oLink->sDisplay();
             }
         }
     }
 }
Ejemplo n.º 6
0
 function sEditButtonHTML($sButtonImage = "edit-button.gif", $sToolTip = "", $oCustomEditURL = false)
 {
     global $goApp, $webyep_bShowDisabledEditButtons, $webyep_bOtherLoginsMayEditGlobalData;
     $oImgURL = od_nil;
     $oImg = od_nil;
     $oEditorURL = od_nil;
     $oNeedJSURL = od_nil;
     $dQuery = array();
     $iEW = $iEH = 0;
     $sWCookie = $sHCookie = "";
     $bUsesCustomURL = false;
     if ($this->bUserMayEditThisElement()) {
         if (!$sToolTip) {
             $sToolTip = sprintf(WYTS("editTheField"), $this->sName);
         }
         $oImgURL = od_clone($goApp->oImageURL);
         $oImgURL->addComponent($sButtonImage);
         $oImg = new WYImage($oImgURL);
         $oImg->setAttribute("border", 0);
         $oImg->setAttribute("alt", $sToolTip);
         if ($oCustomEditURL === false || $oCustomEditURL === od_nil) {
             $oEditorURL = od_clone($goApp->oProgramURL);
             $oEditorURL->addComponent("editors/" . $this->sEditorPageName);
             $dQuery = array_merge(WYEditor::dQueryForElement($this), $this->dEditorQuery);
             $oEditorURL->setQuery($dQuery);
         } else {
             $oEditorURL = $oCustomEditURL;
             $bUsesCustomURL = true;
         }
         $this->getSizeCookieNames($sWCookie, $sHCookie);
         if (isset($_COOKIE[$sWCookie])) {
             $iEW = (int) $_COOKIE[$sWCookie];
             $iEH = (int) $_COOKIE[$sHCookie];
             WYEditor::tranformSizeForOperation($iEW, $iEH, WY_EDITOR_OPEN);
         } else {
             $iEW = $this->iEditorWidth;
             $iEH = $this->iEditorHeight;
         }
         if ($bUsesCustomURL) {
             $oLink = new WYLink($oEditorURL, $sToolTip);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", $this->sEditButtonCSSClass);
             return $oLink->sDisplay();
         } else {
             $oWin = new WYPopupWindowLink($oEditorURL, "WebYepEditor" . mt_rand(1000, 9999), $iEW, $iEH, WY_POPWIN_TYPE_PLAIN);
             $oNeedJSURL = od_clone($goApp->oProgramURL);
             $oNeedJSURL->addComponent(WYTS("LogonURL"));
             $oWin->setAttribute("href", $oNeedJSURL->sEURL());
             // special href: JS warning
             $oWin->setInnerHTML($oImg->sDisplay());
             $oWin->setToolTip($sToolTip);
             $oWin->setAttribute("class", $this->sEditButtonCSSClass);
             return $oWin->sDisplay();
         }
     } else {
         if ($webyep_bShowDisabledEditButtons) {
             $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
             $oImgURL = od_clone($goApp->oImageURL);
             $oImgURL->addComponent("edit-button-disabled.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("border", 0);
             $oImg->setAttribute("alt", $sToolTip);
             $oLink = new WYLink(new WYURL("javascript:void(0);"), $sToolTip);
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", $this->sEditButtonCSSClass);
             return $oLink->sDisplay();
         } else {
             return "";
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * Liefert das Markup für die EditButtons eines Bildes
  *
  * @access 		private
  *	@param		int		$iID	imageID
  *	@return		string			HTML der Bearbeitungselemente
  */
 function _sEditButtons($iID)
 {
     global $goApp, $webyep_bShowDisabledEditButtons;
     $sHTML = "";
     $oURL = od_clone(WYURL::oCurrentURL());
     $oLink = od_nil;
     $oImg = od_nil;
     $oImgURL = od_clone($goApp->oImageURL);
     $dEditQuery = WYEditor::dQueryForElement($this);
     $aItems =& $this->_aItems();
     $iCount = count($aItems);
     if ($goApp->bEditMode) {
         if ($this->iEditedID === $iID) {
             $sHTML .= $this->sAnchor();
         }
         $sHTML .= "<div style=\"white-space: nowrap; text-align: center; margin-top: 4px\">";
         if ($this->bUserMayEditThisElement()) {
             $dEditQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $oURL->setQuery(array_merge($oURL->dQuery, $dEditQuery));
             $oURL->sAnchor = "WEBYEP_CURRENT_GALLERY_ITEM";
             $this->dEditorQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $this->dEditorQuery[WY_QK_THUMB_WIDTH] = $this->iTNWidth;
             $this->dEditorQuery[WY_QK_THUMB_HEIGHT] = $this->iTNHeight;
             $this->dEditorQuery[WY_QK_IMAGE_WIDTH] = $this->iImageWidth;
             $this->dEditorQuery[WY_QK_IMAGE_HEIGHT] = $this->iImageHeight;
             $this->dEditorQuery[WY_QK_GALLERY_IMAGE_ID] = $iID;
             $this->dEditorQuery[WY_QK_GALLERY_ADD] = "true";
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_UP);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 1 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryUpButton"));
             $oImgURL->addComponent("gallery-move-left-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepGalleryUpButton");
             $sHTML .= $oLink->sDisplay();
             $this->sEditButtonCSSClass = "WebYepGalleryAddButton";
             $sHTML .= $this->sEditButtonHTML("gallery-add-button.gif", WYTS("GalleryAddButton"), $goApp->bIsiPhone ? $this->oIPhoneEditURL() : od_nil);
             $dEditQuery = $oURL->dQuery;
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_REMOVE);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 0 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryRemoveButton"));
             $oImgURL->addComponent("gallery-remove-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("onclick", "return confirm(\"" . WYTS("GalleryRemoveConfirm") . "\");");
             $oLink->setAttribute("class", "WebYepGalleryRemoveButton");
             $sHTML .= $oLink->sDisplay();
             $oLink->removeAttribute("onclick");
             $goApp->setActionInQuery($dEditQuery, WY_QV_GALLERY_DOWN);
             $oURL->setQuery($dEditQuery);
             $oLink = new WYLink($iCount > 1 ? $oURL : new WYURL("javascript:void(0)"), WYTS("GalleryDownButton"));
             $oImgURL->addComponent("gallery-move-right-button.gif");
             $oImg = new WYImage($oImgURL);
             $oImg->setAttribute("style", "border: none");
             $oImgURL->removeLastComponent();
             $oLink->setInnerHTML($oImg->sDisplay());
             $oLink->setAttribute("class", "WebYepGalleryDownButton");
             $sHTML .= $oLink->sDisplay();
             if ($iCount > 0) {
                 $sHTML .= "<br />";
                 $this->dEditorQuery[WY_QK_GALLERY_ADD] = "false";
                 $this->sEditButtonCSSClass = "WebYepGalleryEditButton";
                 $sHTML .= $this->sEditButtonHTML("gallery-edit-button.gif", WYTS("GalleryEditButton"), $goApp->bIsiPhone ? $this->oIPhoneEditURL() : od_nil);
             }
         } else {
             // editing not allowed
             if ($webyep_bShowDisabledEditButtons) {
                 $sToolTip = sprintf(WYTS("insufficientPermissions"), $this->sName);
                 $oImgURL = od_clone($goApp->oImageURL);
                 $oImgURL->addComponent("gallery-buttons-disabled.gif");
                 $oImg = new WYImage($oImgURL);
                 $oImg->setAttribute("border", 0);
                 $oImg->setAttribute("alt", $sToolTip);
                 $oLink = new WYLink(new WYURL("javascript:void(0);"), $sToolTip);
                 $oLink->setInnerHTML($oImg->sDisplay());
                 $oLink->setAttribute("class", $this->sEditButtonCSSClass);
                 $sHTML .= $oLink->sDisplay();
             }
         }
         $sHTML .= "</div>";
     }
     return $sHTML;
 }