| | |
| | | return copyOrMoveFiles(fromPath, toPath, fileNames, OP_MOVE); |
| | | } |
| | | |
| | | public String duplicateFile(String fromPath, String fileName) { |
| | | String result = null; |
| | | try { |
| | | File srcDir = getTargetDir(fromPath); |
| | | File srcFile = new File(srcDir, fileName); |
| | | String fnameext = srcFile.getName(); |
| | | int dotpos = fnameext.lastIndexOf(DOT); |
| | | String fname = fnameext.substring(0, dotpos); |
| | | String ext = fnameext.substring(dotpos); |
| | | File destFile = new File(srcDir, fname + "-Kopie" + ext); |
| | | int i = 1; |
| | | while(destFile.exists()) { |
| | | destFile = new File(srcDir, fname + "-Kopie-" + Integer.toString(++i) + ext); |
| | | } |
| | | FileUtils.copyFile(srcFile, destFile); |
| | | } catch (IOException ex) { |
| | | logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private String copyOrMoveFiles(String fromPath, String toPath, List fileNames, int operation) { |
| | | String result = null; |
| | | try { |
| | |
| | | "funktion": "app.fm_menu_paste" |
| | | }, |
| | | { |
| | | "titel": "Duplizieren", |
| | | "umenue": false, |
| | | "funktion": "app.fm_duplicate_file" |
| | | }, |
| | | { |
| | | "titel": "", |
| | | "umenue": false, |
| | | "verweis": "" |
| | |
| | | <button class="top-btn"><i class="icon-down-dir"></i></button> |
| | | <div class="dropdown-content"> |
| | | <a id="mi-ansehen"><i class="icon-eye"></i> Ansehen</a> |
| | | <a id="mi-duplizieren"><i class="icon-docs"></i> Duplizieren</a> |
| | | <a id="mi-neuer-ordner"><i class="icon-folder-empty"></i> Neuer Ordner</a> |
| | | <a id="mi-neuer-text"><i class="icon-doc"></i> Neuer Text</a> |
| | | <a id="mi-neues-dok"><i class="icon-doc-text"></i> Neues Dokument</a> |
| | |
| | | self.addEvtListener('#top-speichern-btn', 'click', self.fm_menu_datei_speichern); |
| | | |
| | | self.addEvtListener('#mi-ansehen', 'click', self.fm_view_file); |
| | | self.addEvtListener('#mi-duplizieren', 'click', self.fm_duplicate_file); |
| | | self.addEvtListener('#mi-neuer-ordner', 'click', self.datei_neuer_ordner); |
| | | self.addEvtListener('#mi-neuer-text', 'click', self.datei_neuer_text); |
| | | self.addEvtListener('#mi-neues-dok', 'click', self.fm_menu_neues_dokument); |
| | |
| | | } |
| | | }; |
| | | |
| | | this.fm_duplicate_file = function() { |
| | | var gewaehlte = document.querySelector('.datei-gewaehlt'); |
| | | var fname = gewaehlte.textContent; |
| | | var m = '?c=de.uhilger.filecms.api.FileMgr&m=duplicateFile&p=' + self.pfad + '&p=' + fname; |
| | | var u = '../svc' + m; |
| | | self.fm_get(u, "text", function(resp) { |
| | | // console.log('deleteFiles gab folgendes zurueck: ' + resp); |
| | | self.fm_get_list(self.pfad); |
| | | }); |
| | | }; |
| | | |
| | | /* |
| | | * Hier wird fuer eine zuvor markierte Liste von Dateien, fuer die |
| | | * Cut oder Copy gewaehlt wurde, die Operations ausgefuehrt (move oder copy) |