public function getPopupManager($rootDir = null, $class = null, $classID = null, $usePool = false, $fieldDefaultFile = "", $uploadTargetFilename = null) { if ($rootDir != null) { $T = new HTMLTable(1); #$rel = "$rootDir"; $root = FileStorage::getFilesDir() . $rootDir; $_SESSION["BPS"]->setProperty("mFileGUI", "path", $root); $_SESSION["BPS"]->setProperty("mFileGUI", "root", $root); $F = new File($root); $F->loadMe(); if ($F->getA() == null) { if (is_writable(FileStorage::getFilesDir())) { mkdir($root, 0777, true); } else { $B = new Button("", "stop"); $B->type("icon"); $B->style("float:left;margin-right:10px;"); $T->addRow($B . "Das Verzeichnis <code>{$rootDir}</code> existiert nicht und kann nicht automatisch angelegt werden, da keine Schreibberechtigung für <code>specifics</code> vorliegt."); die($T); } } } $bps = $this->getMyBPSData(); if (strpos($bps["path"], $bps["root"]) === false) { $bps["path"] = $bps["root"]; } if ($bps != -1 and isset($bps["path"])) { $this->setDir($bps["path"]); } $this->hideDirs(true); $gui = new HTMLGUIX(); $gui->object($this); $cols = array(); if ($fieldDefaultFile != "") { $C = new $class($classID); self::$fieldDefaultFile = array($C, $C->A($fieldDefaultFile), $fieldDefaultFile); $cols[] = "isDefault"; $gui->colWidth("isDefault", 20); $gui->parser("isDefault", "mFileGUI::parserDefault"); } $cols[] = "FileName"; $gui->attributes($cols); $gui->parser("FileName", "mFileGUI::nameParser2"); $gui->options(true, false, false); $gui->name("Datei"); $gui->addToEvent("onDelete", OnEvent::reloadPopup("mFile")); $oldFiles = ""; if ($class != null and $classID != null) { $AC = anyC::get("Datei", "DateiClassID", $classID); $AC->addAssocV3("DateiClass", "=", $class); $oldFiles = new HTMLTable(2, "Verknüpfte Dateien"); while ($F = $AC->getNextEntry()) { $BDL = new Button("Datei herunterladen", "./plugins/Files/download.png", "icon"); $BDL->onclick("windowWithRme('File','" . $F->A("DateiPath") . "','download','');"); $BDL->style("float:right;"); $oldFiles->addRow(array($BDL . $F->A("DateiName"))); } } $BPool = new Button("Pool\nanzeigen", "./lightCRM/Mail/images/attach.png"); $BPool->style("float:right;margin:10px;"); $BPool->onclick(OnEvent::popupSidePanel("mFile", -1, "sidePanelPool", array("'{$class}Pool'", "'{$rootDir}'"))); if ($usePool and $rootDir) { echo $BPool . "<div style=\"clear:both;\"></div>"; if (file_exists(FileStorage::getFilesDir() . "{$class}Pool")) { echo OnEvent::script("window.setTimeout(function(){ if(\$j('#editDetailsmFileSidePanel').length > 0) return; " . OnEvent::popupSidePanel("mFile", -1, "sidePanelPool", array("'{$class}Pool'", "'{$rootDir}'")) . "}, 100);"); } } $F = new HTMLForm("fileUpload", array("datei")); $s = array("path" => $bps["path"], "class" => "File"); if ($uploadTargetFilename != null) { $s["targetFilename"] = $uploadTargetFilename; } $F->setType("datei", "file", null, $s); $F->addJSEvent("datei", "onChange", OnEvent::reloadPopup("mFile")); $F->getTable()->setColWidth(1, 120); echo "<p class=\"prettyTitle\">/" . basename($bps["path"]) . "</p><p style=\"color:grey;margin-top:-15px;margin-bottom:10px;\"><small>" . dirname(realpath($bps["path"])) . "</small></p>" . $F . $gui->getBrowserHTML(-1) . $oldFiles; }
function sidePanel($targetClass, $targetClassId, $targetMethod, $targetMethodParameters = "", $popupName = "edit") { $this->onclick(OnEvent::popupSidePanel($targetClass, $targetClassId, $targetMethod, $targetMethodParameters, $popupName)); }
/** * Method to display an E-Mail popup for easy E-Mail sending * * Requires a method named "getEMailData" in $dataClass which returns an array: * array(fromName, fromAddress, recipientName, recipientAddress, subject, body) * * Will call $dataClass($dataClassID)::sendEmail afterwards * * @param string $dataClass * @param string $dataClassID */ public static function EMailPopup($dataClass, $dataClassID, $callbackParameter = null, $onSuccessFunction = null, $onAbortFunction = null, $return = false) { $c = new $dataClass($dataClassID); $data = $c->getEMailData($callbackParameter); $html = ""; if (isset($data["attachmentsAlways"])) { /*$B = new Button("Anhänge", "export", "LPBig"); $B->style("margin:10px;float:right;"); $B->sidePanel("Util", "-1", "EMailPopupAttachmentsSP", array("'$dataClass'", "'$dataClassID'", "'$callbackParameter'")); $html .= $B;*/ $html .= OnEvent::script(OnEvent::popupSidePanel("Util", "-1", "EMailPopupAttachmentsSP", array("'{$dataClass}'", "'{$dataClassID}'", "'{$callbackParameter}'"))); } #$html .= "<p class=\"prettyTitle\">Neue E-Mail</p>"; #$html .= "<div style=\"clear:both;\"></div>"; $tab = new HTMLTable(2); $tab->setColWidth(1, "120px;"); $tab->addLV("Absender:", "{$data['fromName']}<br /><small style=\"color:grey;\"><{$data['fromAddress']}></small>"); if (is_array($data["recipients"])) { if (count($data["recipients"]) == 1) { $tab->addLV("Empfänger:", $data["recipients"][0][0] . "<br /><small style=\"color:grey;\"><" . $data["recipients"][0][1] . "></small>"); } else { $recipients = array(); foreach ($data["recipients"] as $ID => $Rec) { $recipients[$ID] = new HTMLInput($Rec[0] . " <" . $Rec[1] . ">", "option", $ID); } $IS = new HTMLInput("EMailRecipient{$dataClassID}", "select", isset($data["default"]) ? $data["default"] : "0", $recipients); $IS->id("EMailRecipient{$dataClassID}"); $tab->addLV("Empfänger:", $IS); } } else { $IS = new HTMLInput("EMailRecipient{$dataClassID}", "text", $data["recipients"]); $IS->id("EMailRecipient{$dataClassID}"); $tab->addLV("Empfänger:", $IS); } if (isset($data["bcc"]) and count($data["bcc"]) > 0) { foreach ($data["bcc"] as $bcc) { $tab->addLV("BCC:", $bcc); } } $tab->addLV("Betreff:", "<input type=\"text\" id=\"EMailSubject{$dataClassID}\" value=\"{$data['subject']}\" />"); $html .= $tab; $html .= "<div style=\"width:94%;margin:auto;\"><textarea class=\"tinyMCEEditor\" id=\"EMailBody{$dataClassID}\" style=\"width:100%;height:300px;font-size:10px;\">{$data['body']}</textarea></div>"; #$tab->addRow(array("")); #$tab->addRowColspan(1, 2); #$tab->addRowClass("backgroundColor0"); $tab = new HTMLTable(2); $tab->setColWidth(1, "120px;"); if ($onSuccessFunction == null) { $onSuccessFunction = "" . OnEvent::reload("Left") . " Popup.close('Util', 'edit');"; } $BAbort = new Button("Abbrechen", "stop"); if ($onAbortFunction == null) { $BAbort->onclick("Popup.close('Util', 'edit');"); } else { $BAbort->onclick($onAbortFunction); } $BAbort->style("margin-bottom:10px;margin-top:10px;"); $optional = "var files = '';"; if (isset($data["attachmentsOptional"])) { $optional .= "\$j('#UtilEmailFormAttachments input[type=checkbox]:checked').each(function(k, v){ files += \$j(v).data('value')+'##'; });"; } $BGo = new Button("E-Mail\nsenden", "okCatch"); $BGo->style("float:right;margin-top:10px;"); $BGo->loading(); $BGo->doBefore("{$optional} %AFTER"); if (strpos($data["body"], "<p") !== false or trim($data["body"]) == "") { $BGo->doBefore("{$optional} \$j('#EMailBody{$dataClassID}').val(tinyMCE.get('EMailBody{$dataClassID}').getContent()); %AFTER"); } $BGo->rmePCR(str_replace("GUI", "", $dataClass), $dataClassID, "sendEmail", array("\$('EMailSubject{$dataClassID}').value", "\$j('#EMailBody{$dataClassID}').val()", (is_array($data["recipients"]) and count($data["recipients"]) == 1) ? "0" : "\$('EMailRecipient{$dataClassID}').value", "'" . $callbackParameter . "'", "files"), $onSuccessFunction); #$BGo->onclick("CloudKunde.directMail('$this->ID', '$data[recipientAddress]', $('EMailSubject$this->ID').value, $('EMailBody$this->ID').value); "); $tab->addRow(array($BGo . $BAbort)); $tab->addRowColspan(1, 2); $tab->addRowClass("backgroundColor0"); $html .= $tab; if (strpos($data["body"], "<p") !== false or trim($data["body"]) == "") { echo OnEvent::script("\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t" . tinyMCEGUI::editorMail("EMailBody{$dataClassID}", null, "undo redo | pastetext | bold italic underline | fullscreen code") . "\n\t\t\t}, 100);"); } if ($return) { return $html; } else { echo $html; } }