|
|
@@ -5554,309 +5554,320 @@ jQuery(document).ready(function(){
|
|
|
|
|
|
$fileIndexField = V::get('DEST_FILE_INDEX_FIELD', 'ID', $folderConf);
|
|
|
$fileIndex = V::get($fileIndexField, $record['ID'], $record);
|
|
|
- ?>
|
|
|
- <script src="stuff/jquery.form.js"></script>
|
|
|
- <div class="container">
|
|
|
-
|
|
|
- <h4 style="margin:20px 0 3px 0;">Pliki w katalogu
|
|
|
- <?php if ($sharePoint) : ?>
|
|
|
- <a href="<?php echo $sharePoint; ?>"><span class="glyphicon glyphicon-folder-open"></span><code><?php echo $mainFolder; ?></code></a>
|
|
|
- <?php else : ?>
|
|
|
- <code><?php echo $mainFolder; ?></code>
|
|
|
- <?php endif; ?>
|
|
|
- <span class="pull-right valign-btns-bottom">
|
|
|
- <span id="FILES_LIST_ACTIONS_<?php echo $this->_htmlID; ?>"></span>
|
|
|
- <?php echo $rowFunctionsOut; ?>
|
|
|
- </span>
|
|
|
- </h4>
|
|
|
- <div style="clear:both; max-height:180px; overflow:auto; border-bottom:1px solid #ddd;">
|
|
|
- <table class="table table-bordered table-hover">
|
|
|
- <colgroup>
|
|
|
- <col style="">
|
|
|
- <col style="width:30px;">
|
|
|
- <?php if ($sharePoint) : ?>
|
|
|
- <col style="width:30px;">
|
|
|
- <?php endif; ?>
|
|
|
- <col style="width:80px;">
|
|
|
- <col style="width:140px;">
|
|
|
- </colgroup>
|
|
|
- <tbody id="FILES_LIST_<?php echo $this->_htmlID; ?>">
|
|
|
- <?php if (empty($mainFolder)) : ?>
|
|
|
- <tr>
|
|
|
- <td colspan="5">
|
|
|
- <div class="alert alert-warning">
|
|
|
- <h4>Brak folderu!</h4>
|
|
|
- Folder dla tego rekordu nie został utworzony.
|
|
|
- </div>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <?php elseif (empty($files)) : ?>
|
|
|
- <tr>
|
|
|
- <td colspan="5">
|
|
|
- <div class="alert alert-info">
|
|
|
- <h4>Brak plików</h4>
|
|
|
- </div>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <?php endif; ?>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
-
|
|
|
- <br>
|
|
|
- <br>
|
|
|
-<?php if (!$this->_acl->canWriteRecord($record)) : ?>
|
|
|
- <div class="alert alert-warning">
|
|
|
- Brak uprawnień do dodawania plików
|
|
|
- </div>
|
|
|
-<?php else : ?>
|
|
|
- <div id="FILES_CONN_TBLS_<?php echo $this->_htmlID; ?>"></div>
|
|
|
-
|
|
|
- <form enctype="multipart/form-data" method="POST" action="" id="FILES_FRM_<?php echo $this->_htmlID; ?>" class="form-inline">
|
|
|
-
|
|
|
- <input type="hidden" name="M_DIST_UPLOAD_SOURCE" value="local">
|
|
|
- <ul id="FILES_TAB_<?php echo $this->_htmlID; ?>" class="nav nav-tabs" style="margin:0;">
|
|
|
- <li class="active"><a href="#local" data-toggle="local">Wybierz plik lokalny</a></li>
|
|
|
- <li><a href="#scan" data-toggle="scan">Wybierz plik ze skanów</a></li>
|
|
|
- </ul>
|
|
|
- <div id="myTabContent" class="tab-content">
|
|
|
- <div class="tab-pane fade in active" id="local" style="text-align: center;">
|
|
|
- <input name="M_DIST_FILES_NAME" type="file" size="60" class="field-upload btn" style="width:86%;margin:10px auto;padding:10px 4%;background:#eee;text-align:center;" ondragover="this.style.backgroundColor='#D9EDF7'" ondragleave="this.style.backgroundColor='#eee'" ondragend="this.style.backgroundColor='#eee'">
|
|
|
- </div>
|
|
|
- <div class="tab-pane fade" id="scan">
|
|
|
- <?php if (empty($skanyFiles)) : ?>
|
|
|
- <div class="alert alert-info">
|
|
|
- <h4>Brak plików</h4>
|
|
|
- <?php if(!empty($skanyFolderWeb)) echo "skonfiguruj urządzenie biurowe aby wysyłało skany na ftp://skaner:(h*a*s*l*o)@".$_SERVER['SERVER_NAME']." <br> lub <a href=".FoldersConfig::getNfsOsPath().$skanySharePoint.">".FoldersConfig::getNfsOsPath().$skanySharePoint."</a>"; ?>
|
|
|
- </div>
|
|
|
- <?php else : ?>
|
|
|
- <div style="max-height:150px; overflow:auto; border-bottom:1px solid #ddd;">
|
|
|
- <table class="table table-bordered table-hover">
|
|
|
- <colgroup>
|
|
|
- <col style="width:30px;">
|
|
|
- <col style="">
|
|
|
- <col style="width:30px;">
|
|
|
- <col style="width:80px;">
|
|
|
- <col style="width:140px;">
|
|
|
- </colgroup>
|
|
|
- <tbody>
|
|
|
- <?php foreach ($skanyFiles as $vFilePath) : ?>
|
|
|
- <tr>
|
|
|
- <?php
|
|
|
- $vFileName = explode('/', $vFilePath);
|
|
|
- $vFileName = end($vFileName);
|
|
|
- $vFileSize = filesize($vFilePath);
|
|
|
- $vFileSizeOut = V::humanFileSize($vFileSize);
|
|
|
- ?>
|
|
|
- <td><input style="margin:0" type="radio" name="SCANS_COLUMN_ADD" value="<?= $vFileName; ?>"></td>
|
|
|
- <td><div style="overflow:hidden; white-space:nowrap" title="<?= $vFileName; ?>"><?= $vFileName; ?></div></td>
|
|
|
- <td style="white-space:nowrap; text-align:center"><a href="<?= str_replace($skanyLocalPath, $skanyFolderWeb, $vFilePath); ?>" target="_blank" class="glyphicon glyphicon-download-alt"></a></td>
|
|
|
- <td style="white-space:nowrap; text-align:right"><?= $vFileSizeOut; ?></td>
|
|
|
- <td style="white-space:nowrap"><?= date("Y-m-d H:i:s", filectime($vFilePath)); ?></td>
|
|
|
- </tr>
|
|
|
- <?php endforeach; ?>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- <?php endif; ?>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <br>
|
|
|
-
|
|
|
- <h4>Ustal nazwę pliku zgodną z obiegiem dokumentów
|
|
|
- <?php //TODO: link do procesu o obiegu dokumentów <i class="glyphicon glyphicon-question-sign" style="cursor:help" title="działa w nowszych przeglądarkach jak Firefox, Chrome"></i> ?>
|
|
|
- </h4>
|
|
|
- <table style="width:100%" class="table table-bordered">
|
|
|
- <tr>
|
|
|
- <th>Nr</th>
|
|
|
- <th>Typ</th>
|
|
|
- <th style="width:40%;">Opis <i class="glyphicon glyphicon-question-sign" title="kogo dotyczy / czego / sprawa / nazwa_firmy itp"></i></th>
|
|
|
- <th style="width:16%">Data wersji</th>
|
|
|
- <th style="width:12%">Numer wersji</th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>
|
|
|
- <?= $fileIndex; ?>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <select class="form-control" name="M_DIST_FILES_TYPE">
|
|
|
- <?php foreach ($fileTypes as $kType => $vLabel) : ?>
|
|
|
- <option value="<?= $kType; ?>"<?php if ($kType == 'TODO') { echo ' selected="selected"'; } ?> ><?= $vLabel; ?></option>
|
|
|
- <?php endforeach; ?>
|
|
|
- </select>
|
|
|
- <br>
|
|
|
- <label class="checkbox">
|
|
|
- <input type="checkbox" name="M_DIST_FILES_TYPE_AUTO">
|
|
|
- Wykrycie automatyczne typu z wysylanego pliku
|
|
|
- </label>
|
|
|
- <label class="checkbox">
|
|
|
- <input type="checkbox" name="M_DIST_FILES_TEMP">
|
|
|
- Plik tymczasowy / roboczy / nieoficjalny (_TEMP)
|
|
|
- </label>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <input class="form-control" style="width:100%" type="text" name="M_DIST_FILES_DESCRIPTION" value="" maxlength="50">
|
|
|
- <br><label>jeśli nie zostanie podany to zostanie automatycznie wygenerowany na podstawie nazwy pliku wysyłanego</label>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <div class="input-group">
|
|
|
- <input name="M_DIST_FILES_DATE" type="text" value="<?= date('Y-m-d');?>" class="se_type-date form-control" data-format="yyyy-MM-dd" maxlength="10"><span class="input-group-addon">
|
|
|
- <span class="glyphicon glyphicon-calendar"></span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
-<!--
|
|
|
- <input class="form-control" type="date" name="M_DIST_FILES_DATE" value="<?= date('Y-m-d');?>" maxlength="10">
|
|
|
--->
|
|
|
- <br><label>jeśli nie zostanie podana to zostanie ustawiona na dzisiaj (<?= date('Y-m-d');?>)</label>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- <input class="form-control" style="width:100%" type="number" name="M_DIST_FILES_VERSION">
|
|
|
- <br>
|
|
|
- <label class="checkbox">
|
|
|
- <input type="checkbox" name="M_DIST_FILES_VERSION_AUTO">
|
|
|
- Automatycznie dodaj wersje
|
|
|
- </label>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td colspan="5">
|
|
|
- <div id="FRM_UPLOAD_RESULTS_<?= $this->_htmlID; ?>"></div>
|
|
|
- <p>
|
|
|
- <input type="submit" value="Wyślij" class="btn btn-primary"> wybrany plik do folderu:
|
|
|
- </p>
|
|
|
- <p>
|
|
|
- <code><b><?= $uploader->getDestPathShare(true); ?></b></code>
|
|
|
- <br><i style="color:#777">(Jeśli folder nie istnieje to zostanie utworzony automatycznie)</i>
|
|
|
- </p>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
-<?php endif; ?>
|
|
|
- <script>
|
|
|
-function fileListUpdateAjax<?= $this->_htmlID; ?>() {
|
|
|
- var postData = {};
|
|
|
- jQuery.ajax({
|
|
|
- url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILES_LIST&ID=<?= $record['ID']; ?>',
|
|
|
- type: 'POST',
|
|
|
- //dataType: 'json',
|
|
|
- //contentType: "application/json; charset=utf-8",
|
|
|
- data: postData,
|
|
|
- success: function(data) {
|
|
|
- fileListUpdate<?php echo $this->_htmlID; ?>(data);
|
|
|
- },
|
|
|
- error: function(jhr, textStatus, errorThrown) {
|
|
|
- console.log('request error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-function fileListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
|
|
|
- var fileListNode = jQuery('#FILES_LIST_<?php echo $this->_htmlID; ?>');
|
|
|
- fileListNode.empty();
|
|
|
- fileListJson.map(function(file){
|
|
|
- var node = $('<tr></tr>');
|
|
|
-<?php if (!$this->_acl->canWriteRecord($record)) : ?>
|
|
|
- var fFun = null;
|
|
|
-<?php else : ?>
|
|
|
- var fFun = $('<i class="glyphicon glyphicon-remove" style="cursor:pointer" data-filename="' + file.name + '"></i>');
|
|
|
-<?php endif; ?>
|
|
|
- var fNameCell = $('<td style="overflow: hidden;"></td>');
|
|
|
- var fName = $('<div style="overflow:hidden; white-space:nowrap;" title="' + file.name + '"></div>');
|
|
|
- if (fFun) fName.append(fFun);
|
|
|
- fName.append(file.name);
|
|
|
- fName.appendTo(fNameCell);
|
|
|
- node.append(fNameCell);
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="' + file.web + '" target="_blank" class="glyphicon glyphicon-download-alt"></a>' + '</td>');
|
|
|
- <?php if ($sharePoint) : ?>
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="<?= $sharePoint; ?>/' + file.name + '" target="_blank" class="glyphicon glyphicon-folder-open"></a>' + '</td>');
|
|
|
- <?php endif; ?>
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap; text-align:right;">' + file.sizeStr + '</td>');
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap;">' + file.created + '</td>');
|
|
|
- node.appendTo(fileListNode);
|
|
|
-
|
|
|
- if (fFun) {
|
|
|
- $(fFun).click(function(e){
|
|
|
- var n = $(e.target);
|
|
|
- var fname= n.data('filename');
|
|
|
- if (!fname) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (confirm('Czy jesteś pewien, że chcesz usunąć plik o nazwie ' + fname + '?')) {
|
|
|
- var postData = {filename: fname};
|
|
|
- jQuery.ajax({
|
|
|
- url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILE_REMOVE&ID=<?= $record['ID']; ?>',
|
|
|
- type: 'POST',
|
|
|
- //dataType: 'json',
|
|
|
- //contentType: "application/json; charset=utf-8",
|
|
|
- data: postData,
|
|
|
- success: function(data) {
|
|
|
- if (data && data.type) {
|
|
|
- if (data.type == 'SUCCESS') {
|
|
|
- n.parents('tr').remove();
|
|
|
- //console.log('TODO: SUCCESS msg: ', data.msg);
|
|
|
- }
|
|
|
- else if (data.type == 'error') {
|
|
|
- console.log('TODO: ERROR msg: ', data.msg);
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('TODO: ??? data: ', data);
|
|
|
+ echo UI::h('div', [ 'class' => "container" ], [
|
|
|
+ UI::h('h4', [ 'style' => "margin:20px 0 3px 0;" ], [
|
|
|
+ "Pliki w katalogu ",
|
|
|
+ ($sharePoint)
|
|
|
+ ? UI::h('a', [ 'href' => $sharePoint ], [
|
|
|
+ UI::h('span', [ 'class' => "glyphicon glyphicon-folder-open" ]),
|
|
|
+ UI::h('code', [], $mainFolder),
|
|
|
+ ])
|
|
|
+ : UI::h('code', [], $mainFolder),
|
|
|
+ UI::h('span', [ 'class' => "pull-right valign-btns-bottom" ], [
|
|
|
+ UI::h('span', [ 'id' => "FILES_LIST_ACTIONS_{$this->_htmlID}" ]),
|
|
|
+ " {$rowFunctionsOut}",
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ UI::h('div', [ 'style' => "clear:both; max-height:180px; overflow:auto; border-bottom:1px solid #ddd;" ], [
|
|
|
+ UI::h('table', [ 'class' => "table table-bordered table-hover" ], [
|
|
|
+ UI::h('colgroup', [], [
|
|
|
+ UI::h('col', [ 'style' => "" ]),
|
|
|
+ UI::h('col', [ 'style' => "width:30px" ]),
|
|
|
+ ($sharePoint)
|
|
|
+ ? UI::h('col', [ 'style' => "width:30px" ])
|
|
|
+ : '',
|
|
|
+ UI::h('col', [ 'style' => "width:80px" ]),
|
|
|
+ UI::h('col', [ 'style' => "width:140px" ]),
|
|
|
+ ]),
|
|
|
+ UI::h('tbody', [ 'id' => "FILES_LIST_{$this->_htmlID}" ], [
|
|
|
+ (empty($mainFolder) || empty($files))
|
|
|
+ ? UI::h('tr', [], [
|
|
|
+ UI::h('td', [ 'colspan' => "5" ], [
|
|
|
+ (empty($mainFolder))
|
|
|
+ ? UI::h('div', [ 'class' => "alert alert-warning" ], [
|
|
|
+ UI::h('h4', [], "Brak folderu!"),
|
|
|
+ "Folder dla tego rekordu nie został utworzony."
|
|
|
+ ])
|
|
|
+ : UI::h('div', [ 'class' => "alert alert-info" ], [
|
|
|
+ UI::h('h4', [], "Brak plików!"),
|
|
|
+ ])
|
|
|
+ ]),
|
|
|
+ ])
|
|
|
+ : '',
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ UI::h('br'),
|
|
|
+ UI::h('br'),
|
|
|
+ (!$this->_acl->canWriteRecord($record))
|
|
|
+ ? UI::h('div', [ 'class' => "alert alert-warning" ], [
|
|
|
+ "Brak uprawnień do dodawania plików",
|
|
|
+ ])
|
|
|
+ : UI::h('div', [ 'id' => "FILES_CONN_TBLS_{$this->_htmlID}" ]),
|
|
|
+ (!$this->_acl->canWriteRecord($record))
|
|
|
+ ? ''
|
|
|
+ : UI::h('form', [ 'enctype' => "multipart/form-data", 'method' => "POST", 'action' => "", 'id' => "FILES_FRM_{$this->_htmlID}", 'class' => "form-inline" ], [
|
|
|
+ UI::h('input', [ 'type' => "hidden", 'name' => "M_DIST_UPLOAD_SOURCE", 'value' => "local" ]),
|
|
|
+ UI::h('ul', [ 'id' => "FILES_TAB_{$this->_htmlID}", 'class' => "nav nav-tabs", 'style' => "margin:0;"], [
|
|
|
+ UI::h('li', [ 'class' => "active" ], [ UI::h('a', [ 'href' => "#local", 'data-toggle' => "local" ], "Wybierz plik lokalny"), ]),
|
|
|
+ UI::h('li', [], [ UI::h('a', [ 'href' => "#scan", 'data-toggle' => "scan" ], "Wybierz plik ze skanów" ), ]),
|
|
|
+ ]),
|
|
|
+ UI::h('div', [ 'id' => "myTabContent", 'class' => "tab-content" ], [
|
|
|
+ UI::h('div', [ 'class' => "tab-pane fade in active", 'id' => "local", 'style' => "text-align: center;" ], [
|
|
|
+ UI::h('input', [ 'name' => "M_DIST_FILES_NAME", 'type' => "file", 'size' => "60", 'class' => "field-upload btn",
|
|
|
+ 'style' => "width:86%;margin:10px auto;padding:10px 4%;background:#eee;text-align:center",
|
|
|
+ 'ondragover' => "this.style.backgroundColor='#D9EDF7'",
|
|
|
+ 'ondragleave' => "this.style.backgroundColor='#eee'",
|
|
|
+ 'ondragend' => "this.style.backgroundColor='#eee'",
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ UI::h('div', [ 'class' => "tab-pane fade", 'id' => "scan" ], [
|
|
|
+ (empty($skanyFiles))
|
|
|
+ ? UI::h('div', [ 'class' => "alert alert-info" ], [
|
|
|
+ UI::h('h4', [], "Brak plików"),
|
|
|
+ (!empty($skanyFolderWeb))
|
|
|
+ ? "skonfiguruj urządzenie biurowe aby wysyłało skany na ftp://skaner:(h*a*s*l*o)@".$_SERVER['SERVER_NAME']." <br> lub <a href=".FoldersConfig::getNfsOsPath().$skanySharePoint.">".FoldersConfig::getNfsOsPath().$skanySharePoint."</a>"
|
|
|
+ : '',
|
|
|
+ ])
|
|
|
+ : UI::h('div', [ 'style' => "max-height:150px; overflow:auto; border-bottom:1px solid #ddd;" ], [
|
|
|
+ UI::h('table', [ 'class' => "table table-bordered table-hover" ], [
|
|
|
+ UI::h('colgroup', [], [
|
|
|
+ UI::h('col', [ 'style' => "width:30px;" ]),
|
|
|
+ UI::h('col', [ 'style' => "" ]),
|
|
|
+ UI::h('col', [ 'style' => "width:30px;" ]),
|
|
|
+ UI::h('col', [ 'style' => "width:80px;" ]),
|
|
|
+ UI::h('col', [ 'style' => "width:140px;" ]),
|
|
|
+ ]),
|
|
|
+ UI::h('tbody', [], array_map(function ($vFilePath) use ($skanyLocalPath, $skanyFolderWeb) {
|
|
|
+ $vFileName = explode('/', $vFilePath);
|
|
|
+ $vFileName = end($vFileName);
|
|
|
+ $vFileSize = filesize($vFilePath);
|
|
|
+ $vFileSizeOut = V::humanFileSize($vFileSize);
|
|
|
+ return UI::h('tr', [], [
|
|
|
+ UI::h('td', [], [ UI::h('input', [ 'style' => "margin:0", 'type' => "radio", 'name' => "SCANS_COLUMN_ADD", 'value' => $vFileName]) ]),
|
|
|
+ UI::h('td', [], [ UI::h('div', [ 'style' => "overflow:hidden; white-space:nowrap", 'title' => $vFileName ], $vFileName) ]),
|
|
|
+ UI::h('td', [ 'style' => "white-space:nowrap; text-align:center" ], [
|
|
|
+ UI::h('a', [ 'href' => str_replace($skanyLocalPath, $skanyFolderWeb, $vFilePath), 'target' => "_blank", 'class' => "glyphicon glyphicon-download-alt" ])
|
|
|
+ ]),
|
|
|
+ UI::h('td', [ 'style' => "white-space:nowrap; text-align:right" ], $vFileSizeOut),
|
|
|
+ UI::h('td', [ 'style' => "white-space:nowrap" ], date("Y-m-d H:i:s", filectime($vFilePath))),
|
|
|
+ ]);
|
|
|
+ }, $skanyFiles)),
|
|
|
+ ])
|
|
|
+ ]),
|
|
|
+ ])
|
|
|
+ ]),
|
|
|
+ UI::h('br'),
|
|
|
+ UI::h('h4', [], [
|
|
|
+ "Ustal nazwę pliku zgodną z obiegiem dokumentów",
|
|
|
+ //TODO: link do procesu o obiegu dokumentów <i class="glyphicon glyphicon-question-sign" style="cursor:help" title="działa w nowszych przeglądarkach jak Firefox, Chrome"></i>
|
|
|
+ ]),
|
|
|
+ UI::h('table', [ 'style' => "width:100%", 'class' => "table table-bordered" ], [
|
|
|
+ UI::h('tr', [], [
|
|
|
+ UI::h('th', [], "Nr"),
|
|
|
+ UI::h('th', [], "Typ"),
|
|
|
+ UI::h('th', [ 'style' => "width:40%" ], [
|
|
|
+ "Opis ",
|
|
|
+ UI::h('i', [ 'class' => "glyphicon glyphicon-question-sign", 'title' => "kogo dotyczy / czego / sprawa / nazwa_firmy itp" ]),
|
|
|
+ ]),
|
|
|
+ UI::h('th', [ 'style' => "width:16%" ], "Data wersji"),
|
|
|
+ UI::h('th', [ 'style' => "width:12%" ], "Numer wersji"),
|
|
|
+ ]),
|
|
|
+ UI::h('tr', [], [
|
|
|
+ UI::h('td', [], $fileIndex),
|
|
|
+ UI::h('td', [], [
|
|
|
+ UI::h('select', [ 'class' => "form-control", 'name' => "M_DIST_FILES_TYPE" ], array_map(function ($vLabel, $kType) {
|
|
|
+ return UI::h('option', array_merge([ 'value' => $kType],
|
|
|
+ ($kType == 'TODO')
|
|
|
+ ? [ 'selected' => "selected"]
|
|
|
+ : []
|
|
|
+ ), $vLabel);
|
|
|
+ }, $fileTypes, array_keys($fileTypes)) ),
|
|
|
+ UI::h('br'),
|
|
|
+ UI::h('label', [ 'class' => "checkbox" ], [
|
|
|
+ UI::h('input', [ 'type' => "checkbox", 'name' => "M_DIST_FILES_TYPE_AUTO" ]),
|
|
|
+ " Wykrycie automatyczne typu z wysylanego pliku",
|
|
|
+ ]),
|
|
|
+ UI::h('label', [ 'class' => "checkbox" ], [
|
|
|
+ UI::h('input', [ 'type' => "checkbox", 'name' => "M_DIST_FILES_TEMP" ]),
|
|
|
+ " Plik tymczasowy / roboczy / nieoficjalny (_TEMP)",
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ UI::h('td', [], [
|
|
|
+ UI::h('input', [ 'class' => "form-control", 'style' => "width:100%", 'type' => "text", 'name' => "M_DIST_FILES_DESCRIPTION", 'value' => "", 'maxlength' => "50" ]),
|
|
|
+ "<br><label>jeśli nie zostanie podany to zostanie automatycznie wygenerowany na podstawie nazwy pliku wysyłanego</label>",
|
|
|
+ ]),
|
|
|
+ UI::h('td', [], [
|
|
|
+ UI::h('div', [ 'class' => "input-group" ], [
|
|
|
+ UI::h('input', [ 'name' => "M_DIST_FILES_DATE", 'type' => "text", 'value' => date('Y-m-d'), 'class' => "se_type-date form-control", 'data-format' => "yyyy-MM-dd", 'maxlength' => "10" ]),
|
|
|
+ UI::h('span', [ 'class' => "input-group-addon" ], [
|
|
|
+ UI::h('span', [ 'class' => "glyphicon glyphicon-calendar" ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ // UI::h('input', [ 'class' => "form-control", 'type' => "date", 'name' => "M_DIST_FILES_DATE", 'value' => date('Y-m-d'), 'maxlength' => "10" ]),
|
|
|
+ "<br><label>jeśli nie zostanie podana to zostanie ustawiona na dzisiaj (" . date('Y-m-d') . ")</label>",
|
|
|
+ ]),
|
|
|
+ UI::h('td', [], [
|
|
|
+ UI::h('input', [ 'class' => "form-control", 'style' => "width:100%", 'type' => "number", 'name' => "M_DIST_FILES_VERSION" ]),
|
|
|
+ UI::h('br'),
|
|
|
+ UI::h('label', [ 'class' => "checkbox" ], [
|
|
|
+ UI::h('input', [ 'type' => "checkbox", 'name' => "M_DIST_FILES_VERSION_AUTO" ]),
|
|
|
+ " Automatycznie dodaj wersje",
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ UI::h('tr', [], [
|
|
|
+ UI::h('td', [ 'colspan' => "5" ], [
|
|
|
+ UI::h('div', [ 'id' => "FRM_UPLOAD_RESULTS_{$this->_htmlID}" ]),
|
|
|
+ UI::h('p', [], [
|
|
|
+ UI::h('input', [ 'type' => "submit", 'value' => "Wyślij", 'class' => "btn btn-primary" ], "wybrany plik do folderu:"),
|
|
|
+ ]),
|
|
|
+ UI::h('p', [], [
|
|
|
+ UI::h('code', [], [
|
|
|
+ UI::h('b', [], $uploader->getDestPathShare(true)),
|
|
|
+ ]),
|
|
|
+ UI::h('br'),
|
|
|
+ UI::h('i', [ 'style' => "color:#777" ], "(Jeśli folder nie istnieje to zostanie utworzony automatycznie)"),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]),
|
|
|
+ ]);
|
|
|
+ $className = __CLASS__;
|
|
|
+ $jsArgs = [
|
|
|
+ 'CAN_WRITE_RECORD' => (int)$this->_acl->canWriteRecord($record),
|
|
|
+ 'SHARE_POINT' => $sharePoint,
|
|
|
+ 'URL_FILE_LIST_UPDATE_AJAX' => "index-ajax.php?_zasobID={$this->_zasobID};&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_LIST&ID={$record['ID']}",
|
|
|
+ 'URL_CONNECTED_TABLE_LIST' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_CONN_TBL_LIST&ID={$record['ID']}",
|
|
|
+ // $urlFileRemoveAjax
|
|
|
+ 'URL_FILE_REMOVE_AJAX' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILE_REMOVE&ID={$record['ID']}",
|
|
|
+ ];
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ function fileListUpdateAjax{$this->_htmlID}() {
|
|
|
+ var postData = {};
|
|
|
+ var URL_FILE_LIST_UPDATE_AJAX = '{$jsArgs['URL_FILE_LIST_UPDATE_AJAX']}';
|
|
|
+ jQuery.ajax({
|
|
|
+ url: URL_FILE_LIST_UPDATE_AJAX,
|
|
|
+ type: 'POST',
|
|
|
+ data: postData,
|
|
|
+ success: function(data) {
|
|
|
+ fileListUpdate{$this->_htmlID}(data);
|
|
|
+ },
|
|
|
+ error: function(jhr, textStatus, errorThrown) {
|
|
|
+ console.log('request error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ function fileListUpdate{$this->_htmlID}(fileListJson) {
|
|
|
+ var CAN_WRITE_RECORD = {$jsArgs['CAN_WRITE_RECORD']};
|
|
|
+ var SHARE_POINT = '{$jsArgs['SHARE_POINT']}';
|
|
|
+ var URL_FILE_REMOVE_AJAX = '{$jsArgs['URL_FILE_REMOVE_AJAX']}';
|
|
|
+ var fileListNode = jQuery('#FILES_LIST_{$this->_htmlID}');
|
|
|
+ fileListNode.empty();
|
|
|
+ fileListJson.map(function(file){
|
|
|
+ var node = $('<tr></tr>');
|
|
|
+ var fFun = CAN_WRITE_RECORD
|
|
|
+ ? $('<i class=\"glyphicon glyphicon-remove\" style=\"cursor:pointer\" data-filename=\"' + file.name + '\"></i>')
|
|
|
+ : null
|
|
|
+ ;
|
|
|
+ var fNameCell = $('<td style=\"overflow: hidden;\"></td>');
|
|
|
+ var fName = $('<div style=\"overflow:hidden; white-space:nowrap;\" title=\"' + file.name + '\"></div>');
|
|
|
+ if (fFun) fName.append(fFun);
|
|
|
+ fName.append(file.name);
|
|
|
+ fName.appendTo(fNameCell);
|
|
|
+ node.append(fNameCell);
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap; text-align:center;\">' + '<a href=\"' + file.web + '\" target=\"_blank\" class=\"glyphicon glyphicon-download-alt\"></a>' + '</td>');
|
|
|
+ if (SHARE_POINT) {
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap; text-align:center;\">' + '<a href=\"' + SHARE_POINT + '/' + file.name + '\" target=\"_blank\" class=\"glyphicon glyphicon-folder-open\"></a>' + '</td>');
|
|
|
+ }
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap; text-align:right;\">' + file.sizeStr + '</td>');
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap;\">' + file.created + '</td>');
|
|
|
+ node.appendTo(fileListNode);
|
|
|
+
|
|
|
+ if (fFun) {
|
|
|
+ $(fFun).click(function(e){
|
|
|
+ var n = $(e.target);
|
|
|
+ var fname= n.data('filename');
|
|
|
+ if (!fname) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- },
|
|
|
- error: function(jhr, textStatus, errorThrown) {
|
|
|
- console.log('rm error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-function connTblListUpdateAjax<?= $this->_htmlID; ?>(connTblID) {
|
|
|
- var postData = {};
|
|
|
-
|
|
|
- // clear current file list
|
|
|
- jQuery('#FILES_CONN_TBLS_<?= $this->_htmlID; ?>').find('.files-list').empty();
|
|
|
-
|
|
|
- jQuery.ajax({
|
|
|
- url: 'index-ajax.php?_zasobID=<?= $this->_zasobID; ?>&_cls=<?= __CLASS__; ?>&_hash=<?= $this->_htmlID; ?>&_task=FILES_CONN_TBL_LIST&ID=<?= $record['ID']; ?>&connTblID=' + connTblID,
|
|
|
- type: 'POST',
|
|
|
- //dataType: 'json',
|
|
|
- //contentType: "application/json; charset=utf-8",
|
|
|
- data: postData,
|
|
|
- success: function(data) {
|
|
|
- connTblListUpdate<?= $this->_htmlID; ?>(data);
|
|
|
- },
|
|
|
- error: function(jqXHR, textStatus, errorThrown) {
|
|
|
- var txt = jqXHR.responseText || 'Error';
|
|
|
- jQuery('#FILES_CONN_TBLS_<?= $this->_htmlID; ?>').find('.files-list').html('<tr><td colspan="6"><div class="alert alert-danger">' + txt + '</div></td></tr>');
|
|
|
- if (priv.options.debug) console.log('connTblListUpdateAjax error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
+ if (confirm('Czy jesteś pewien, że chcesz usunąć plik o nazwie ' + fname + '?')) {
|
|
|
+ var postData = {filename: fname};
|
|
|
+ jQuery.ajax({
|
|
|
+ url: URL_FILE_REMOVE_AJAX,
|
|
|
+ type: 'POST',
|
|
|
+ data: postData,
|
|
|
+ success: function(data) {
|
|
|
+ if (data && data.type) {
|
|
|
+ if (data.type == 'SUCCESS') {
|
|
|
+ n.parents('tr').remove();
|
|
|
+ //console.log('TODO: SUCCESS msg: ', data.msg);
|
|
|
+ }
|
|
|
+ else if (data.type == 'error') {
|
|
|
+ console.log('TODO: ERROR msg: ', data.msg);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('TODO: ??? data: ', data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(jhr, textStatus, errorThrown) {
|
|
|
+ console.log('rm error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ function connTblListUpdateAjax{$this->_htmlID}(connTblID) {
|
|
|
+ var postData = {};
|
|
|
+ var URL_CONNECTED_TABLE_LIST = '{$jsArgs['URL_CONNECTED_TABLE_LIST']}'
|
|
|
|
|
|
-function connTblListUpdate<?php echo $this->_htmlID; ?>(fileListJson) {
|
|
|
- var fileListNode = jQuery('#FILES_CONN_TBLS_<?php echo $this->_htmlID; ?>').find('.files-list');
|
|
|
- fileListNode.empty();
|
|
|
- fileListJson.map(function(file){
|
|
|
- var node = $('<tr></tr>');
|
|
|
- var fNameCell = $('<td style="overflow: hidden;"></td>');
|
|
|
- var fName = $('<div style="overflow:hidden; white-space:nowrap;" title="' + file.name + '"></div>');
|
|
|
- fName.append(file.name);
|
|
|
- fName.appendTo(fNameCell);
|
|
|
- node.append(fNameCell);
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap; text-align:center;">' + '<a href="' + file.web + '" target="_blank" class="glyphicon glyphicon-download-alt"></a>' + '</td>');
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap; text-align:right;">' + file.sizeStr + '</td>');
|
|
|
- node.append('<td style="overflow:hidden; white-space:nowrap;">' + file.created + '</td>');
|
|
|
- node.appendTo(fileListNode);
|
|
|
- });
|
|
|
-}
|
|
|
+ // clear current file list
|
|
|
+ jQuery('#FILES_CONN_TBLS_{$this->_htmlID}').find('.files-list').empty();
|
|
|
|
|
|
-function fileListActions<?php echo $this->_htmlID; ?>() {
|
|
|
- var filePermsReload = jQuery('#FILES_LIST_ACTIONS_<?php echo $this->_htmlID; ?>');
|
|
|
+ jQuery.ajax({
|
|
|
+ url: URL_CONNECTED_TABLE_LIST + '&connTblID=' + connTblID,
|
|
|
+ type: 'POST',
|
|
|
+ data: postData,
|
|
|
+ success: function(data) {
|
|
|
+ connTblListUpdate{$this->_htmlID}(data);
|
|
|
+ },
|
|
|
+ error: function(jqXHR, textStatus, errorThrown) {
|
|
|
+ var txt = jqXHR.responseText || 'Error';
|
|
|
+ jQuery('#FILES_CONN_TBLS_{$this->_htmlID}').find('.files-list').html('<tr><td colspan=\"6\"><div class=\"alert alert-danger\">' + txt + '</div></td></tr>');
|
|
|
+ if (priv.options.debug) console.log('connTblListUpdateAjax error: ', errorThrown, ' textStatus: ', textStatus);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ function connTblListUpdate{$this->_htmlID}(fileListJson) {
|
|
|
+ var fileListNode = jQuery('#FILES_CONN_TBLS_{$this->_htmlID}').find('.files-list');
|
|
|
+ fileListNode.empty();
|
|
|
+ fileListJson.map(function(file){
|
|
|
+ var node = $('<tr></tr>');
|
|
|
+ var fNameCell = $('<td style=\"overflow: hidden;\"></td>');
|
|
|
+ var fName = $('<div style=\"overflow:hidden; white-space:nowrap;\" title=\"' + file.name + '\"></div>');
|
|
|
+ fName.append(file.name);
|
|
|
+ fName.appendTo(fNameCell);
|
|
|
+ node.append(fNameCell);
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap; text-align:center;\">' + '<a href=\"' + file.web + '\" target=\"_blank\" class=\"glyphicon glyphicon-download-alt\"></a>' + '</td>');
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap; text-align:right;\">' + file.sizeStr + '</td>');
|
|
|
+ node.append('<td style=\"overflow:hidden; white-space:nowrap;\">' + file.created + '</td>');
|
|
|
+ node.appendTo(fileListNode);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ ?>
|
|
|
+ <script>
|
|
|
+function fileListActions<?= $this->_htmlID; ?>() {
|
|
|
+ var filePermsReload = jQuery('#FILES_LIST_ACTIONS_<?= $this->_htmlID; ?>');
|
|
|
var btnReload = jQuery('<button class="btn-link btn-sm" title="odśwież uprawnienia do plików"><span class="glyphicon glyphicon-refresh"></span>Odśwież</button>');
|
|
|
btnReload.on('click', function(e) {
|
|
|
//console.log('TODO: click reload perms...');
|