Commit 390eaccf authored by Matthieu Le Corre's avatar Matthieu Le Corre
Browse files

Add filename choice


Signed-off-by: Matthieu Le Corre's avatarMatthieu Le Corre <matthieu.lecorre@univ-nantes.fr>
parent 5ff12b66
......@@ -6,6 +6,9 @@
[#21](https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/21#)
- Error in public page breaks edition and menu
[#22](https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/22#)
- Fix config is not readable if not admin
[#24](https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/24#)
[#26](https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/26#)
### Added
- New Admin section to configure some styling option, engines and fileslist
......
......@@ -21,8 +21,10 @@
return [
'routes' => [
[ 'name' => 'config#getConfig', 'url' => '/config', 'verb' => 'GET' ],
[ 'name' => 'config#setConfig', 'url' => '/config', 'verb' => 'POST' ]
[ 'name' => 'config#getConfig', 'url' => '/config', 'verb' => 'GET' ],
[ 'name' => 'config#setConfig', 'url' => '/config', 'verb' => 'POST' ],
[ 'name' => 'config#addFileName', 'url' => '/config/filenames/{zone}/{file}', 'verb' => 'PUT' ],
[ 'name' => 'config#removeFileName','url' => '/config/filenames/{zone}/{file}', 'verb' => 'DELETE' ]
]
];
.icon-inline {
display: inline-flex;
margin-right: 5px ;
float: right ;
}
.readmeMD-filelist {
border-bottom: 1px solid silver ;
margin-bottom: 4px ;
width: 20em ;
}
#readmeMD-filelist input {
width: 200px ;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var c=t[r]={i:r,l:!1,exports:{}};return e[r].call(c.exports,c,c.exports,n),c.l=!0,c.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(r,c,function(t){return e[t]}.bind(null,c));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=26)}({26:function(e,t){
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 26);
/******/ })
/************************************************************************/
/******/ ({
/***/ 26:
/***/ (function(module, exports) {
/**
* @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>
*
......@@ -18,5 +108,113 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$(document).ready(function(){$("#readmeMD-appearance-txt").click(function(e){$.post(OC.generateUrl("apps/files_readmemd/config"),{key:"show_title",value:e.target.checked}).success(function(e){})}),$("#readmeMD-appearance-color").click(function(e){$.post(OC.generateUrl("apps/files_readmemd/config"),{key:"yellow_back",value:e.target.checked}).success(function(e){})}),$("#readmeMD-appearance-refresh").click(function(e){$.post(OC.generateUrl("apps/files_readmemd/config"),{key:"auto_refresh",value:e.target.checked}).success(function(e){})}),$("#readmeMD-engine-asciidoc").click(function(e){$.post(OC.generateUrl("apps/files_readmemd/config"),{key:"show_asciidoc",value:e.target.checked}).success(function(e){})}),$("#readmeMD-engine-html").click(function(e){$.post(OC.generateUrl("apps/files_readmemd/config"),{key:"show_html",value:e.target.checked}).success(function(e){})})})}});
$(document).ready(function () {
//Appearance
$("#readmeMD-appearance-txt").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "show_title", value: Event.target.checked})
.success(function (json) {
//console.log(json) ;
})
}) ;
$("#readmeMD-appearance-color").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "yellow_back", value: Event.target.checked})
.success(function (json) {
//console.log(json) ;
})
}) ;
$("#readmeMD-appearance-refresh").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "auto_refresh", value: Event.target.checked})
.success(function (json) {
//console.log(json) ;
})
}) ;
//Engines
$("#readmeMD-engine-asciidoc").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "show_asciidoc", value: Event.target.checked})
.success(function (json) {
//console.log(json) ;
})
}) ;
$("#readmeMD-engine-html").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "show_html", value: Event.target.checked})
.success(function (json) {
//console.log(json) ;
})
}) ;
// Fileslists
// DELETE
$(".readmeMD-filelist_delete").on("click",function(Event){
var self =this ;
var fn = Event.target.dataset.filename ;
var zone = Event.target.dataset.zone ;
//console.log( "Deleting " + zone + " -> " + fn ) ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'DELETE',
success: function(data) {
$(self).parent().remove() ;
}
})
}) ;
//ADD
$("#readmeMD-filelist_submit-footer").on("click",function(Event){
var fn = $("#readmeMD-filelist_name-footer")[0].value ;
var zone = "footer" ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'PUT',
success: function(data) {
$("#readmeMD-filelist_footer").append(
'<li class="readmeMD-filelist" id="readmeMD-filelist-'+fn+'">'
+'<a data-zone="footer" data-filename="'+fn+'" class="readmeMD-filelist_delete icon-inline icon icon-delete"></a>'
+fn+'</li>')
}
})
}) ;
$("#readmeMD-filelist_submit-header").on("click",function(Event){
var fn = $("#readmeMD-filelist_name-header")[0].value ;
var zone = "header" ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'PUT',
success: function(data) {
$("#readmeMD-filelist_header").append(
'<li class="readmeMD-filelist" id="readmeMD-filelist-'+fn+'">'
+'<a data-zone="header" data-filename="'+fn+'" class="readmeMD-filelist_delete icon-inline icon icon-delete"></a>'
+fn+'</li>')
}
})
}) ;
});
/***/ })
/******/ });
//# sourceMappingURL=config.js.map
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","document","ready","click","Event","post","OC","generateUrl","target","checked","success","json"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAzB,EAAA6B,EAAA,SAAA1B,GACA,IAAAS,EAAAT,KAAAqB,WACA,WAA2B,OAAArB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD/B,EAAAkC,EAAA,GAIAlC,IAAAmC,EAAA;;;;;;;;;;;;;;;;;;;;AC9DAC,EAAAC,UAAAC,MAAA,WAEAF,EAAA,4BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,aAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,QAKAX,EAAA,8BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,cAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,QAKAX,EAAA,gCAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,eAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,QAKAX,EAAA,6BAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,gBAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC,QAKAX,EAAA,yBAAAG,MAAA,SAAAC,GACAJ,EAAAK,KAAAC,GAAAC,YAAA,+BAA6DhB,IAAA,YAAAN,MAAAmB,EAAAI,OAAAC,UAC7DC,QAAA,SAAAC","file":"config.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","/**\n * @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>\n *\n * @license GNU AGPL version 3 or any later version\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n $(document).ready(function () {\n\n $(\"#readmeMD-appearance-txt\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_title\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-color\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"yellow_back\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-refresh\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"auto_refresh\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-engine-asciidoc\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_asciidoc\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-engine-html\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_html\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n }) ;"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,6DAA6D,+CAA+C;AAC5G;AACA;AACA,iBAAiB;AACjB,KAAK;;AAEL;AACA,6DAA6D,gDAAgD;AAC7G;AACA;AACA,iBAAiB;AACjB,KAAK;;AAEL;AACA,6DAA6D,iDAAiD;AAC9G;AACA;AACA,iBAAiB;AACjB,KAAK;;;AAGL;;;AAGA;AACA,6DAA6D,kDAAkD;AAC/G;AACA;AACA,iBAAiB;AACjB,KAAK;;AAEL;AACA,6DAA6D,8CAA8C;AAC3G;AACA;AACA,iBAAiB;AACjB,KAAK;;;AAGL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,qC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA,qC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;;AAEL,EAAE,E","file":"config.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","/**\n * @author Matthieu Le Corre <matthieu.lecorre@univ-nantes.fr>\n *\n * @license GNU AGPL version 3 or any later version\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n $(document).ready(function () {\n\n //Appearance\n\n $(\"#readmeMD-appearance-txt\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_title\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-color\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"yellow_back\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-appearance-refresh\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"auto_refresh\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n\n //Engines\n\n\n $(\"#readmeMD-engine-asciidoc\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_asciidoc\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n $(\"#readmeMD-engine-html\").click(function(Event){\n $.post(OC.generateUrl(\"apps/files_readmemd/config\"),{key: \"show_html\", value: Event.target.checked})\n .success(function (json) {\n //console.log(json) ;\n })\n }) ;\n\n\n // Fileslists\n\n // DELETE\n $(\".readmeMD-filelist_delete\").on(\"click\",function(Event){\n var self =this ;\n\n var fn = Event.target.dataset.filename ;\n var zone = Event.target.dataset.zone ;\n\n //console.log( \"Deleting \" + zone + \" -> \" + fn ) ;\n\n $.ajax({\n url:OC.generateUrl(\"apps/files_readmemd/config/filenames/\" + zone + \"/\" + fn ),\n type: 'DELETE',\n success: function(data) {\n $(self).parent().remove() ;\n }\n })\n\n }) ;\n\n //ADD\n\n $(\"#readmeMD-filelist_submit-footer\").on(\"click\",function(Event){\n \n var fn = $(\"#readmeMD-filelist_name-footer\")[0].value ;\n var zone = \"footer\" ;\n\n $.ajax({\n url:OC.generateUrl(\"apps/files_readmemd/config/filenames/\" + zone + \"/\" + fn ),\n type: 'PUT',\n success: function(data) { \n $(\"#readmeMD-filelist_footer\").append(\n '<li class=\"readmeMD-filelist\" id=\"readmeMD-filelist-'+fn+'\">'\n +'<a data-zone=\"footer\" data-filename=\"'+fn+'\" class=\"readmeMD-filelist_delete icon-inline icon icon-delete\"></a>'\n +fn+'</li>')\n }\n })\n\n }) ;\n\n $(\"#readmeMD-filelist_submit-header\").on(\"click\",function(Event){\n \n var fn = $(\"#readmeMD-filelist_name-header\")[0].value ;\n var zone = \"header\" ;\n\n $.ajax({\n url:OC.generateUrl(\"apps/files_readmemd/config/filenames/\" + zone + \"/\" + fn ),\n type: 'PUT',\n success: function(data) { \n $(\"#readmeMD-filelist_header\").append(\n '<li class=\"readmeMD-filelist\" id=\"readmeMD-filelist-'+fn+'\">'\n +'<a data-zone=\"header\" data-filename=\"'+fn+'\" class=\"readmeMD-filelist_delete icon-inline icon icon-delete\"></a>'\n +fn+'</li>')\n }\n })\n\n }) ;\n\n }); "],"sourceRoot":""}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -44,8 +44,8 @@ class ConfigController extends Controller {
"yellow_back" => $this->config->getAppValue("yellow_back") ,
"show_title" => $this->config->getAppValue("show_title") ,
"auto_refresh" => $this->config->getAppValue("auto_refresh") ,
"fileslist_header" => $this->config->getAppValue('fileslist_header'),
"fileslist_footer" => $this->config->getAppValue('fileslist_footer')
"fileslist_header" => json_decode($this->config->getAppValue('fileslist_header')),
"fileslist_footer" => json_decode($this->config->getAppValue('fileslist_footer'))
];
return $params ;
}
......@@ -56,4 +56,44 @@ class ConfigController extends Controller {
return $this->config->getAppValue($key) ;
}
public function removeFileName($file,$zone) {
if ($zone == "header") {
$FL = json_decode($this->config->getAppValue('fileslist_header')) ;
$idx = array_search($file,$FL) ;
if ($idx !== false) {
array_splice($FL,$idx,1) ;
$resultat = $this->config->setAppValue('fileslist_header',json_encode($FL)) ;
}
}
if ($zone == "footer") {
$FL = json_decode($this->config->getAppValue('fileslist_footer')) ;
$idx = array_search($file,$FL) ;
if ($idx !== false) {
array_splice($FL,$idx,1) ;
$resultat = $this->config->setAppValue('fileslist_footer',json_encode($FL)) ;
return $resultat ;
}
}
}
public function addFileName ($file,$zone) {
if ($zone == "header") {
$FL = json_decode($this->config->getAppValue('fileslist_header')) ;
array_push($FL,$file) ;
$this->setConfig('fileslist_header',json_encode($FL)) ;
}
if ($zone == "footer") {
$FL = json_decode($this->config->getAppValue('fileslist_footer')) ;
array_push($FL,$file) ;
$this->setConfig('fileslist_footer',json_encode($FL)) ;
return "success" ;
}
}
}
\ No newline at end of file
......@@ -58,6 +58,14 @@ class Config {
$this->setAppValue('yellow_back','false') ;
}
if (null == json_decode($this->getAppValue('fileslist_header')) ){
$this->setAppValue('fileslist_header',json_encode(array('HEADER'))) ;
}
if (null == json_decode($this->getAppValue('fileslist_footer')) ){
$this->setAppValue('fileslist_footer',json_encode(array('README'))) ;
}
}
public function getAppValue($key) {
......@@ -68,11 +76,4 @@ class Config {
$this->config->setAppValue($this->appName, $key, $value);
}
public function getFilesList() {
return $this->config->getAppValue($this->appName,"fileslist") ;
}
}
\ No newline at end of file
......@@ -62,11 +62,12 @@ class Filelist implements ISettings {
*/
public function getForm() {
$filesList = $this->config->getFilesList() ;
$parameters = [
"fileslist_header" => json_decode($this->config->getAppValue('fileslist_header')),
"fileslist_footer" => json_decode($this->config->getAppValue('fileslist_footer'))
] ;
$filesList = array("README.md") ;
return new TemplateResponse('files_readmemd', 'Filelist', $filesList);
return new TemplateResponse('files_readmemd', 'Filelist', $parameters);
}
}
\ No newline at end of file
......@@ -20,6 +20,8 @@
$(document).ready(function () {
//Appearance
$("#readmeMD-appearance-txt").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "show_title", value: Event.target.checked})
.success(function (json) {
......@@ -41,6 +43,10 @@
})
}) ;
//Engines
$("#readmeMD-engine-asciidoc").click(function(Event){
$.post(OC.generateUrl("apps/files_readmemd/config"),{key: "show_asciidoc", value: Event.target.checked})
.success(function (json) {
......@@ -55,4 +61,64 @@
})
}) ;
}) ;
\ No newline at end of file
// Fileslists
// DELETE
$(".readmeMD-filelist_delete").on("click",function(Event){
var self =this ;
var fn = Event.target.dataset.filename ;
var zone = Event.target.dataset.zone ;
//console.log( "Deleting " + zone + " -> " + fn ) ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'DELETE',
success: function(data) {
$(self).parent().remove() ;
}
})
}) ;
//ADD
$("#readmeMD-filelist_submit-footer").on("click",function(Event){
var fn = $("#readmeMD-filelist_name-footer")[0].value ;
var zone = "footer" ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'PUT',
success: function(data) {
$("#readmeMD-filelist_footer").append(
'<li class="readmeMD-filelist" id="readmeMD-filelist-'+fn+'">'
+'<a data-zone="footer" data-filename="'+fn+'" class="readmeMD-filelist_delete icon-inline icon icon-delete"></a>'
+fn+'</li>')
}
})
}) ;
$("#readmeMD-filelist_submit-header").on("click",function(Event){
var fn = $("#readmeMD-filelist_name-header")[0].value ;
var zone = "header" ;
$.ajax({
url:OC.generateUrl("apps/files_readmemd/config/filenames/" + zone + "/" + fn ),
type: 'PUT',
success: function(data) {
$("#readmeMD-filelist_header").append(
'<li class="readmeMD-filelist" id="readmeMD-filelist-'+fn+'">'
+'<a data-zone="header" data-filename="'+fn+'" class="readmeMD-filelist_delete icon-inline icon icon-delete"></a>'
+fn+'</li>')
}
})
}) ;
});
\ No newline at end of file
......@@ -32,8 +32,8 @@ OCA.ReadmeMD.App = {
/**
* Holds the MDs objects
*/
header: null,
readme: null,
//header: null,
//readme: null,
/**
* Setup on page load
......@@ -42,9 +42,9 @@ OCA.ReadmeMD.App = {
var self = this ;
this.appReady = false ;
this.configReady = false ;
this.appVisible = true ;
//this.appVisible = true ;
//public share or private view
this.mode = mode ;
......@@ -100,8 +100,11 @@ OCA.ReadmeMD.App = {
if ( json.yellow_back == "false") {
self.readme.container.removeClass("yellowish") ;
} ;
self.fileslist_header = json.fileslist_header ;
self.fileslist_footer = json.fileslist_footer ;
self.appReady = true ;
self.configReady = true ;
}) ;
},
......@@ -154,58 +157,63 @@ OCA.ReadmeMD.App = {
* Generate FileNames lists corresponding to configs
**/
generateFileNames(zone) {
FFNames = [
"README.md",
"README.markdown",
".README.md",
".README.markdown"
] ;
HFNames = [
"HEADER.md",
"HEADER.markdown",
".HEADER.md",
".HEADER.markdown"
] ;
if (this.show_asciidoc == "true") {
Array.prototype.push.apply(HFNames,
[
"HEADER.adoc",
"HEADER.asciidoc",
".HEADER.adoc",
".HEADER.asciidoc"
]) ;
Array.prototype.push.apply(FFNames,
[
"README.adoc",
"README.asciidoc",
".README.adoc",
".README.asciidoc"
]) ;
var FFNames = [] ;
this.fileslist_footer.forEach(function(fn){
Array.prototype.push.apply(FFNames,[
fn+".md",
fn+".markdown",
"."+fn+".md",
"."+fn+".markdown"
])
if (this.show_asciidoc == "true"){
Array.prototype.push.apply(FFNames,[
fn+".adoc",
fn+".asciidoc",
"."+fn+".adoc",
"."+fn+".asciidoc"
])
}
}
if (this.show_html == "true") {
Array.prototype.push.apply(FFNames,[
fn+".htm",
fn+".html",
"."+fn+".htm",
"."+fn+".html"
])
}
})
var HFNames = [] ;
this.fileslist_header.forEach(function(fn){
Array.prototype.push.apply(HFNames,[
fn+".md",
fn+".markdown",
"."+fn+".md",
"."+fn+".markdown"
])
if (this.show_asciidoc == "true"){
Array.prototype.push.apply(HFNames,[
fn+".adoc",
fn+".asciidoc",
"."+fn+".adoc",
"."+fn+".asciidoc"
])
}
if (this.show_html == "true") {
Array.prototype.push.apply(HFNames,
[
"HEADER.htm",
"HEADER.html",
".HEADER.htm",
".HEADER.html"
]) ;
Array.prototype.push.apply(FFNames,
[
"README.htm",
"README.html",
".README.htm",
".README.html"
]) ;
if (this.show_html == "true") {