示例#1
0
 public function rightCol($return = false)
 {
     $useDir = realpath(FileStorage::getFilesDir());
     $path = BPS::getProperty("mFileGUI", "path", false);
     if ($path) {
         $path = preg_replace("/^([A-Z])%/", "\\1:", $path);
         if (strpos($path, realpath(FileStorage::getFilesDir())) === 0) {
             $useDir = $path;
         }
     }
     $writable = is_writable($useDir);
     $readable = is_readable($useDir);
     $this->setDir($useDir);
     $this->loadMultiPageMode(-1, 0, 10000);
     $showPath = str_replace(realpath(FileStorage::getFilesDir()), "", $useDir);
     $BH = new Button("Root", "home", "iconicL");
     $BH->onclick($this->pather(FileStorage::getFilesDir()));
     $BH->style("float:left;");
     $way = realpath(FileStorage::getFilesDir());
     $bread = "<div style=\"vertical-align:top;display:inline-block;border-right:1px solid #aaa;\" class=\"isFolder\" data-path=\"{$way}\">{$BH}&nbsp;</div>";
     foreach (explode(DIRECTORY_SEPARATOR, $showPath) as $k => $v) {
         if ($k == 0) {
             continue;
         }
         $way .= DIRECTORY_SEPARATOR . "{$v}";
         $bread .= "<div class=\"selectionRow isFolder\" data-path=\"{$way}\" onclick=\"" . $this->pather($way) . "\" style=\"padding:8px;cursor:pointer;border-right:1px solid #aaa;color:#555;vertical-align:top;display:inline-block;padding-left:20px;padding-right:20px;border-bottom:0px;\">{$v}</div>";
     }
     $I = new HTMLInput("upload", "file", null, array("path" => $way, "class" => "File"));
     $I->style("width:250px;");
     $I->onchange($this->pather($way));
     $IN = new HTMLInput("newDir", "text");
     $IN->placeholder("Neues Verzeichnis");
     $IN->style("width:250px;margin-right:20px;");
     $IN->onEnter(OnEvent::rme($this, "makeDir", array("'{$way}'", "\$j(this).val()"), "function(){ " . $this->pather($way) . " }"));
     $ISA = new HTMLInput("selectAll", "checkbox");
     $ISA->onchange("console.log(\$j(this).prop('checked')); \$j('.selectFile').prop('checked', \$j(this).prop('checked'));");
     if (!$writable or !$readable) {
         $I = "";
         $IN = "";
     }
     $html = "\n\t\t\t<div style=\"background-color:#F7F7F7;border-bottom:1px solid #ddd;\">\n\t\t\t\t{$bread}\n\t\t\t\t<div style=\"display:inline-block;margin-top:2px;float:right;\">{$IN}</div>\n\t\t\t\t<div style=\"display:inline-block;margin-top:1px;float:right;\">{$I}</div>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div id=\"filesFrame\" style=\"overflow:auto;\">\n\t\t\t<form id=\"dlFiles\">\n\t\t\t<div style=\"border-bottom:1px solid #ddd;color:#777;\">\n\t\t\t\t<div style=\"display:inline-block;float:right;padding:5px;\">\n\t\t\t\t\tGröße\n\t\t\t\t\t<div style=\"display:inline-block;width:64px;\">&nbsp;</div>\n\t\t\t\t</div>\n\t\t\t\t<!--<div style=\"display:inline-block;width:57px;float:left;padding-left:5px;\">{$ISA}</div>-->\n\t\t\t\t<div style=\"display:inline-block;width:26px;float:left;padding-left:5px;\">&nbsp;</div>\n\t\t\t\t<div style=\"padding:5px;\">Dateiname</div>\n\t\t\t</div>";
     if (!$readable) {
         $html .= "<div style=\"padding:5px;\" class=\"highlight\">Das Verzeichnis <code>{$useDir}</code> ist nicht lesbar.</div>";
         return $html;
     }
     if (!$writable) {
         $html .= "<div style=\"padding:5px;\" class=\"highlight\">Das Verzeichnis {$useDir} ist nicht beschreibbar.<br />\n\t\t\t\tEs können keine Unterverzeichnisse angelegt oder Dateien hochgeladen werden.<br />\n\t\t\t\tBitte machen Sie das Verzeichnis mit <code>chmod 777 " . basename($useDir) . "</code> durch den Webserver beschreibbar.</div>";
     }
     $i = 0;
     while ($F = $this->getNextEntry()) {
         if ($F->A("FileName") == "." or $F->A("FileName") == "..") {
             continue;
         }
         $ext = Util::ext($F->A("FileName"));
         $B = "";
         if ($F->A("FileIsDir")) {
             $B = new Button("Verzeichnis öffnen", "./plugins/Files/icons/folder.png", "icon");
             $B->style("margin-right:5px;margin-top:2px;");
         } elseif (!$F->A("FileIsDir") and file_exists(dirname(__FILE__) . "/icons/file_extension_{$ext}.png")) {
             $B = new Button("", "./plugins/Files/icons/file_extension_{$ext}.png", "icon");
             $B->style("margin-right:5px;margin-top:2px;");
         } elseif (!$F->A("FileIsDir") and !file_exists(dirname(__FILE__) . "/icons/file_extension_{$ext}.png")) {
             $B = new Button("", "./plugins/Files/icons/file_extension_unknown.png", "icon");
             $B->style("margin-right:5px;margin-top:2px;");
         }
         $BDL = new Button("Datei herunterladen", "download", "iconic");
         $BDL->style("margin-right:10px;");
         $BDL->windowRme("File", $F->getID(), "download");
         $size = "<div style=\"display:inline-block;margin-right:20px;color:grey;width:60px;text-align:right;\"></div>";
         if ($F->A("FileIsDir")) {
             $onclick = $this->pather($F->getID());
             $BDL = "";
         } else {
             $onclick = OnEvent::popup("Vorschau", "File", $F->getID(), "previewWindow", "", "", "{width:600, hPosition: 'center'}");
             $size = "<div style=\"display:inline-block;margin-right:20px;color:grey;width:60px;text-align:right;\">" . Util::formatByte($F->A("FileSize")) . "</div>";
         }
         $onRename = OnEvent::rme($F, "rename", array("\$j('input[name=renameFile{$i}]').val()"), "function(t){ \$j('.fileName{$i}').html(t.responseText); \$j('#default{$i}').show(); \$j('#rename{$i}').hide(); }");
         $BD = new Button("Element löschen", "trash_stroke", "iconic");
         #$BD->style("float:right;");
         $BD->onclick("deleteClass('File','" . $F->getID() . "', function() { " . $this->pather(realpath(dirname($F->getID()))) . " },'Element wirklich löschen?');");
         $BR = new Button("Element umbenennen", "pen_alt2", "iconic");
         $BR->style("margin-right:10px;");
         $BR->onclick("\$j('.fileDefault').show(); \$j('.fileRename, #default{$i}').hide(); \$j('#rename{$i}').show();");
         $IR = new HTMLInput("renameFile{$i}", "text", $F->A("FileName"));
         $IR->style("width:350px;");
         $IR->onEnter($onRename);
         $BC = new Button("Umbenennen abbrechen", "x", "iconic");
         $BC->onclick("\$j('#default{$i}').show(); \$j('#rename{$i}').hide();");
         $BC->style("margin-left:10px;");
         $BO = new Button("Umbenennen abschließen", "check", "iconic");
         $BO->onclick($onRename);
         $BO->style("margin-left:10px;");
         $IC = new HTMLInput("select{$i}", "checkbox");
         $IC->setClass("selectFile");
         $IC->style("margin-top:2px;margin-right:10px;display:none;");
         $html .= "\n\t\t\t<div data-path=\"" . $F->getID() . "\" class=\"selectionRow " . ($F->A("FileIsDir") ? "isFolder" : "") . "\" style=\"\">\n\t\t\t\t<div class=\"selectionRowHeightSetter\" style=\"display:inline-block;float:left;\">{$IC}{$B}</div>\n\t\t\t\t<div class=\"selectionRowHeightSetter\" style=\"display:inline-block;float:right;\">{$BDL}{$BR}{$size}{$BD}</div>\n\t\t\t\t\t\n\t\t\t\t<div id=\"rename{$i}\" class=\"fileRename selectionRowHeightSetter\" style=\"display:none;margin-bottom:-3px;\">{$IR}{$BC}{$BO}</div>\n\t\t\t\t<div id=\"default{$i}\" class=\"selectionRowHeightSetter fileDefault\" onclick=\"" . $onclick . "\" style=\"padding:5px;padding-top:9px;cursor:pointer;\">\n\t\t\t\t\t<span class=\"fileName{$i}\">" . str_replace(".{$ext}", "<span style=\"color:grey;\">.{$ext}</span>", $F->A("FileName")) . "</span>\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t<div style=\"clear:both;\"></div>\n\t\t\t</div>";
         $i++;
     }
     $html .= "</form></div>" . OnEvent::script("\n\$j('.selectionRow').draggable({\n\trevert: true,\n\thelper: function(v){\n\t\tvar newE = \$j(v.target).closest('.selectionRow').clone();\n\t\tnewE.css('width', '400px').css('opacity', '0.7').addClass('selectionRow');\n\t\tnewE.find('.iconic').remove();\n\t\treturn newE;\n\t}/*,\n\tstart: function (event, ui) {\n\t\t \$j(ui.helper).css('margin-left', event.clientX - \$j(event.target).offset().left + 10);\n\t\t \$j(ui.helper).css('margin-top', event.clientY - \$j(event.target).offset().top + 10);\n\t }*/\n});\n\n\$j('.isFolder').droppable({\n\thoverClass: 'highlight',\n\taccept: '.selectionRow',\n\ttolerance: 'pointer',\n\tdrop: function(event, ui) {\n\t\tvar newE = ui.helper.clone();\n\t\tui.helper.remove();\n\t\t" . OnEvent::rme($this, "moveFile", array("\$j(ui.draggable).data('path')", "\$j(this).data('path')"), "function(){ \n\t\t\t\$j(ui.draggable).fadeOut(400, function(){ \$j(this).remove(); }); \n\t\t\t\$j('body').append(newE);\n\t\t\t\$j(newE).fadeOut(400, function(){ \$j(this).remove(); }); \n\t\t}") . "\n\t}\n});\n");
     if (!$return) {
         echo $html;
     } else {
         return $html;
     }
 }
示例#2
0
 public function __toString()
 {
     $hiddenFields = "";
     if ($this->cols == 2 or $this->cols == 1) {
         foreach ($this->fields as $k => $v) {
             if (isset($this->spaceLines[$v])) {
                 $this->table->addRow(array("<hr />"));
                 #$this->table->addRowStyle("font-weight:bold;");
                 #$this->table->addCellStyle(1, "padding-top:20px;");
                 $this->table->addRowColspan(1, 2);
                 $this->table->addRowClass("FormSeparatorWithoutLabel");
             }
             if (isset($this->spaces[$v]) and $this->spaces[$v] != "") {
                 $this->table->addRow(array($this->spaces[$v]));
                 #$this->table->addRowStyle("font-weight:bold;");
                 #$this->table->addCellStyle(1, "padding-top:20px;");
                 $this->table->addRowColspan(1, 2);
                 $this->table->addRowClass("FormSeparatorWithLabel");
             }
             if (isset($this->spaces[$v]) and $this->spaces[$v] == "") {
                 $this->table->addRow(array(""));
                 $this->table->addRowClass("backgroundColor0");
                 $this->table->addRowColspan(1, 2);
                 $this->table->addRowClass("FormSeparatorWithoutLabel");
             }
             $Input = $this->getInput($v);
             $B = $this->getCustomButton($v, $Input);
             if (is_object($Input) and $Input instanceof HTMLInput) {
                 $InputS = $Input->__toString();
                 $this->callbacks .= $Input->getCallback();
             } else {
                 $InputS = $Input;
             }
             if (!isset($this->types[$v]) or $this->types[$v] != "hidden") {
                 if ($this->cols == 2) {
                     $this->table->addLV((isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ($this->printColon ? ":" : ""), $B . $InputS . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : ""));
                 }
                 if ($this->cols == 1) {
                     $this->table->addRow("<label " . ($this->cols == 1 ? "style=\"width:100%;\"" : "") . ">" . (isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ":</label>");
                     $this->table->addRowClass("backgroundColor3");
                     $this->table->addRow($B . $InputS . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : ""));
                     $this->table->addRowClass("backgroundColor0");
                 }
                 if (isset($this->inputLineSyles[$v])) {
                     $this->table->addRowStyle($this->inputLineSyles[$v]);
                 }
             } else {
                 $hiddenFields .= $InputS;
             }
         }
     }
     if ($this->cols == 4) {
         $row = array();
         foreach ($this->fields as $k => $v) {
             $Input = $this->getInput($v);
             if (isset($this->types[$v]) and $this->types[$v] == "hidden") {
                 $hiddenFields .= $Input;
                 continue;
             }
             if (isset($this->spaces[$v])) {
                 if ($this->spaces[$v] == "") {
                     if (count($row) == 0) {
                         $this->table->addRow(array("", "", "", ""));
                         $this->table->addRowClass("backgroundColor0");
                     }
                     if (count($row) == 2) {
                         $row[] = "";
                         $row[] = "";
                         $this->table->addRow($row);
                         $row = array();
                         $this->table->addRow(array("", "", "", ""));
                         $this->table->addRowClass("backgroundColor0");
                     }
                 } else {
                     if (count($row) == 0) {
                         $this->table->addRow(array($this->spaces[$v], "", "", ""));
                         $this->table->addRowClass("backgroundColor0");
                     }
                     if (count($row) == 2) {
                         $row[] = "";
                         $row[] = "";
                         $this->table->addRow($row);
                         $row = array();
                         $this->table->addRow(array($this->spaces[$v], "", "", ""));
                         $this->table->addRowClass("backgroundColor0");
                     }
                 }
                 #$this->table->addRow($row);
                 #$row = array();
             }
             $B = $this->getCustomButton($v, $Input);
             $row[] = "<label>" . (isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)) . ":</label>";
             $row[] = $B . $Input . (isset($this->descriptionField[$v]) ? "<br /><small style=\"color:grey;\">" . $this->descriptionField[$v] . "</small>" : "");
             /*if(!isset($this->types[$v]) OR $this->types[$v] != "hidden"){
             					$this->table->addLV(
             						(isset($this->labels[$v]) ? $this->labels[$v] : ucfirst($v)).":",
             						$B.$Input);
             
             					if(isset($this->inputLineSyles[$v]))
             						$this->table->addRowStyle($this->inputLineSyles[$v]);
             				}
             				else $hiddenFields .= $Input;*/
             if (count($row) == 4) {
                 $this->table->addRow($row);
                 $row = array();
             }
         }
         if (count($row) == 2) {
             $row[] = "";
             $row[] = "";
             $this->table->addRow($row);
         }
     }
     foreach ($this->endLV as $k => $v) {
         $this->table->addLV($v[0], $v[1]);
     }
     if ($this->saveMode != null) {
         switch ($this->saveMode) {
             case "custom":
                 $this->table->addRow(array($this->saveButtonCustom));
                 $this->table->addRowColspan(1, $this->cols);
                 break;
             case "class":
                 $S = $this->saveButton();
                 $this->table->addRow(array($S));
                 $this->table->addRowColspan(1, $this->cols);
                 break;
             case "multiCMS":
                 $S = new HTMLInput("submitForm", "submit", $this->saveButtonLabel);
                 if ($this->saveButtonBGIcon != "") {
                     $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;");
                 }
                 if ($this->saveButtonSubmit != null) {
                     $S->onclick(str_replace("/*CALLBACKS*/", $this->callbacks, $this->saveButtonSubmit));
                 }
                 $action = new HTMLInput("action", "hidden", $this->saveAction);
                 $handler = new HTMLInput("HandlerName", "hidden", $this->saveClass);
                 $return = new HTMLInput("returnP", "hidden", "/" . $_GET["permalink"]);
                 if ($this->cols > 1) {
                     $this->table->addRow(array("", $S . $action . $handler . $return));
                 } else {
                     $this->table->addRow(array($S . $action . $handler . $return));
                 }
                 break;
             case "rmeP":
                 $S = new HTMLInput("submitForm", "button", $this->saveButtonLabel);
                 if ($this->saveButtonBGIcon != "") {
                     $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;");
                 }
                 $S->onclick(($this->saveButtonConfirm != null ? "if(confirm('" . $this->saveButtonConfirm . "')) " : "") . $this->saveButtonSubmit);
                 $S->setClass("submitFormButton borderColor1");
                 $C = "";
                 if ($this->abortButton != null) {
                     $C = new HTMLInput("abortForm", "button", $this->abortButton[0]);
                     if ($this->abortButton[2] != null) {
                         $C->style("background-image:url({$this->abortButton[2]});background-position:98% 50%;background-repeat:no-repeat;");
                     }
                     $C->onclick($this->abortButton[1]);
                     $C->setClass("abortFormButton borderColor1");
                 }
                 $this->table->addRow(array($S . $C));
                 $this->table->addRowColspan(1, 2);
                 break;
             case "Bericht":
                 $S = new HTMLInput("submitForm", "button", $this->saveButtonLabel);
                 if ($this->saveButtonBGIcon != "") {
                     $S->style("background-image:url({$this->saveButtonBGIcon});background-position:98% 50%;background-repeat:no-repeat;");
                 }
                 $S->onclick($this->saveButtonOnclick);
                 $this->table->addRow(array($S));
                 $this->table->addRowColspan(1, 2);
                 break;
         }
     }
     $html = "";
     if ($this->formTag) {
         $html .= "\n\t<form\n\t\tid=\"{$this->id}\"\n\t\t" . ($this->action != null ? "action=\"{$this->action}\"" : "") . "\n\t\t" . ($this->method != null ? "method=\"{$this->method}\"" : "") . "\n\t\t" . ($this->enctype != null ? "enctype=\"{$this->enctype}\"" : "") . "\n\t\t" . ($this->onSubmit != null ? "onsubmit=\"{$this->onSubmit}\"" : "") . "\n\t\t" . ($this->style != null ? "style=\"{$this->style}\"" : "") . ">";
     }
     $html .= $this->table;
     $html .= $hiddenFields;
     if ($this->formTag) {
         $html .= "\n\t</form>";
     }
     return $html . ($this->appendJs != "" ? OnEvent::script($this->appendJs) : "") . ($this->useRecentlyChanged ? GUIFactory::editFormOnchangeTest($this->id) : "");
 }
示例#3
0
 public static function parserDayOfWeek($value)
 {
     $I = new HTMLInput("TodoRepeatDayOfWeek", "hidden", $value);
     $checked = array();
     if ($value != "") {
         $checked = explode(",", $value);
     }
     $Is = "";
     for ($i = 0; $i < 7; $i++) {
         $I2 = new HTMLInput("DOW{$i}", "checkbox", in_array($i, $checked) ? "1" : "0");
         $I2->style("float:left;margin:0px;margin-right:5px;");
         $I2->onchange("var selectedDOW = ''; \$j('.DOWSelector:checked').each(function(k, v){ selectedDOW += (selectedDOW == '' ? '' : ',')+\$j(v).prop('name').replace('DOW', '');}); \$j('[name=TodoRepeatDayOfWeek]').val(selectedDOW);");
         $I2->setClass("DOWSelector");
         $Is .= "<div style=\"margin-bottom:5px;\">" . $I2 . Util::CLWeekdayName($i) . "</div>";
     }
     return $Is . $I;
 }