Dateiverwaltung für die WebBox
ulrich
2017-02-21 f5505fb5459ba11befd28ddd3aa89595c9f9ffc0
Code aufgeraeumt
2 files modified
186 ■■■■ changed files
web/ui/index.html 125 ●●●● patch | view | raw | blame | history
web/ui/ui.js 61 ●●●●● patch | view | raw | blame | history
web/ui/index.html
@@ -108,108 +108,22 @@
      <!-- zentraler Inhaltsbereich -->
      <div class="zentrum">
        
        <!-- Codemirror Start -->
        <div class="code-editor-container pr-3 pb-3">
        <div class="codeeditor-space pr-3">
          <textarea class="codeeditor" id="editspace"></textarea>       
        </div>
        </div>
        <!-- <div id="code-editor-container" class="pr-2"> -->
          <!--
          <div id="edit-tabs">
            <ul class="nav nav-tabs">
              <li class="nav-item">
                <a class="nav-link active" href="#">Active</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Link</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Link</a>
              </li>
              <li class="nav-item">
                <a class="nav-link disabled" href="#">Disabled</a>
              </li>
            </ul>
          </div>
          -->
        <!-- </div> -->
        <div id="dateiansicht">
          <!-- Breadcrumb Start -->
          <div class="zentrum-bc">
            <nav class="breadcrumb mr-5" id="bcnav">
              <!--
              <a class="breadcrumb-item" href="#">Home</a>
              <a class="breadcrumb-item" href="#">Library</a>
              <a class="breadcrumb-item" href="#">Data</a>
              <span class="breadcrumb-item active">Bootstrap</span>
              <div class="pull-right align-middle">
                <i class="fa fa-th-large"></i>
              </div>
              -->
            </nav>
          </div>
          <!-- Breadcrumb Ende -->
          <!-- Dateikacheln Start -->
          <div class="zentrum-liste" id="dateien">
            <!--
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">Kurzer Text</figcaption>
            </figure>
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">A caption for the above image.</figcaption>
            </figure>
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">Ein ganz langer Text, der dieses Element benennt.</figcaption>
            </figure>
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">Wort</figcaption>
            </figure>
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">Wort2</figcaption>
            </figure>
            <figure class="figure datei-figure text-center text-warning align-top">
              <i class="fa fa-folder fa-3x"></i>
              <figcaption class="figure-caption">Wort3</figcaption>
            </figure>
            -->
          </div>
          <!-- Dateikacheln Ende -->
        <!-- Codemirror Ende -->
        <!-- Breadcrumb Start -->
        <div class="zentrum-bc">
          <nav class="breadcrumb mr-5" id="bcnav"></nav>
        </div>
        <!-- Breadcrumb Ende -->
        <!-- Dateikacheln/-liste Start -->
        <div class="zentrum-liste" id="dateien"></div>
        <!-- Dateikacheln Ende -->
        
        <!-- Modal -->
        <div class="modal fade" id="saveModal">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title">Datei speichern</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <p id="dialogfrage">Dateiname?</p>
                <input class="form-control eingabe" type="text" size="20" maxlength="250" placeholder="Dateiname" name="dateiname" id="dateiname">
              </div>
              <div class="modal-footer">
                <button id="modal_ok" type="button" class="btn btn-primary" data-dismiss="modal">Speichern</button>
                <button id="modal_cancel" type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
              </div>
            </div>
          </div>
        </div> <!-- Modal Ende -->
      </div>
      <!-- oestliche Seitenleiste -->
      <!--
@@ -217,6 +131,27 @@
        &ouml;stliche Seitenleiste
      </div>
      -->
      <!-- Modal -->
      <div class="modal fade" id="saveModal">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title">Datei speichern</h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
              <p id="dialogfrage">Dateiname?</p>
              <input class="form-control eingabe" type="text" size="20" maxlength="250" placeholder="Dateiname" name="dateiname" id="dateiname">
            </div>
            <div class="modal-footer">
              <button id="modal_ok" type="button" class="btn btn-primary" data-dismiss="modal">Speichern</button>
              <button id="modal_cancel" type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
            </div>
          </div>
        </div>
      </div> <!-- Modal Ende -->
    </div>
    <!-- Fusszeile -->
    <!--
web/ui/ui.js
@@ -19,8 +19,6 @@
}
function fm_ansicht_umschalten() {
  //console.log('hat th-list: ' + $('#ansicht').children(0).hasClass('fa-th-list'));
  //console.log('hat th-large: ' + $('#ansicht').children(0).hasClass('fa-th-large'));
  if($('#ansicht').children(0).hasClass('fa-th-list')) {
    $('#ansicht').children(0).addClass('fa-th-large');
    $('#ansicht').children(0).removeClass('fa-th-list');
@@ -44,12 +42,6 @@
}
function fm_menu_neue_textdatei() {
  /*
  $('#dateiansicht').hide();
  $('.codeeditor-space').show();
  $('.code-editor-container').show();
  fm_code_edit('Test');
  */
  fm_text_edit('Test');
}
@@ -57,14 +49,12 @@
  $('.codeeditor-space').hide();
  $('.code-editor-container').hide();
  cm.toTextArea();
  $('#dateiansicht').show();
  $('#bcnav').show();
  $('#dateien').show();
}
function fm_dateiwahl() {
  var elem = this;
  //console.log('kachel datei gewaehlt ' + $(elem).text().trim());
  //console.log('liste datei gewaehlt ' + $(elem).children(1).text());
  //console.log('dateiname: ' + $(elem).find('.dateiname').text());
  if(modus == 'kacheln') {
    if($(elem).children(0).hasClass('fa-folder')) {
      var ordner = $(elem).text().trim();
@@ -105,7 +95,6 @@
function fm_bc_click() {
  var elem = this;
  var bcPfad = $(elem).attr('rpath');
  //console.log(relPath);
  if(bcPfad !== undefined) {
    pfad = bcPfad;
    fm_get_list(bcPfad);
@@ -113,13 +102,11 @@
    pfad = '';
    fm_get_list('');
  }
  //console.log($(elem).text() + ' ' + $(elem).attr('rpath') + ' ' + $(elem).hasClass('active'));
}
function fm_text_edit(content) {
  $('#dateiansicht').hide();
  $('#bcnav').hide();
  $('#dateien').hide();
  $('.codeeditor-space').show();
  $('.code-editor-container').show();
  fm_code_edit(content);  
@@ -143,14 +130,6 @@
    fm_get(u, "json", function(resp) {
      
    });
    /*
    var m = '?c=de.uhilger.filecms.api.FileMgr&m=saveTextFile';
    var u = '../svc' + m;
    fm_post(u, {p1: pfad, p2: $('#dateiname').val(), p3: cm.getValue()}, function(resp) {
    });
    */
  });
  $('.modal-title').text('Neuer Ordner');
  $('#dialogfrage').text("Name?");
@@ -163,27 +142,16 @@
}
function fm_get_file_content() {
  var fname = $('.datei-gewaehlt').text();
  //console.log(pfad + '/' + fname);
  var m = '?c=de.uhilger.filecms.api.FileMgr&m=getCode&p=' + pfad + '&p=' + fname;
  var u = '../svc' + m;
  fm_get(u, "text", function(resp) {
    /*
    $('#dateiansicht').hide();
    $('.codeeditor-space').show();
    $('.code-editor-container').show();
    fm_code_edit(resp);
    */
    fm_text_edit(resp);
  });
  
}
function fm_render_list(fl) {
  //if($('#ansicht').children(0).hasClass('fa-th-list')) {
  if(modus == 'kacheln') {
    // Kachelansicht
    var template = $('#tpl-kacheln').html();
@@ -302,21 +270,6 @@
    keyboard: false,
    show: true
  });
  // FileRef saveTextFile(String relPath, String fileName, String contents)
  /*
  var t = new Template(-2, $('#filename').val(), self.cm.getValue(), 3);
  var u = '../api/tr/?c=de.uhilger.webbox.api.ContentApi&m=newTemplate';
  self.post(u, {p: self.serialise(t)}, function (resp) {
    self.isnew = false;
    self.editid = resp.Template.id;
    $('#contlist').append(self.buildContListItem(3, resp.Template.name, resp.Template.id));
    $('#templateeditor').addClass('hidden');
  });
  */
}
function fm_logout() {
@@ -333,10 +286,6 @@
/* ---- codemirror editor handling -------- */
function fm_code_edit(content) {
  //var windowHeight = $(window).height();
  //$("editspace").empty();
  //self.cm.toTextArea();
  cm = CodeMirror.fromTextArea(document.getElementById("editspace"), {
    lineNumbers: true,
    mode: "xml",
@@ -436,4 +385,4 @@
function BcrFile(rp, n) {
  this.relPath = rp;
  this.fName = n;
}
}