diff --git a/Makefile b/Makefile index 2ef696b..6a2af46 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # File-system location (directory) of static media. # See HTURI for the web-visible component. -HTDOCS = /var/www/htdocs +HTDOCS = /usr/local/www/bouquins/ # URL location (path) of static media. # See HTDOCS. @@ -13,11 +13,11 @@ HTURI = # File-system location (directory) of CGI script. # See CGIURI. -CGIBIN = /var/www/cgi-bin +CGIBIN = /usr/local/www/bouquins/cgi-bin # File-system location of database. # See RDDIR. -DATADIR = /var/www/data +DATADIR = /usr/local/www/data # Web-server relative location of system log file. # This will have all logging messages by the system. @@ -59,8 +59,13 @@ sinclude GNUmakefile.local DATABASE = metadata.db OBJS = db.o json.o main.o + HTMLS = index.html -JSMINS = index.min.js +JSMINS = index.min.js +EXTJS = externals/vue.min.js +CSS = externals/bootstrap.min.css +FONTS = externals/fonts/* + CFLAGS += -g -W -Wall -O2 $(SECURE) CFLAGS += -DLOGFILE=\"$(LOGFILE)\" CFLAGS += -DDATADIR=\"$(RDDIR)\" @@ -72,8 +77,11 @@ all: $(TARGET) $(HTMLS) $(JSMINS) api: swagger.json installwww: all - mkdir -p $(HTDOCS) - install -m 0444 $(HTMLS) $(JSMINS) $(HTDOCS) + mkdir -p $(HTDOCS) $(HTDOCS)/css $(HTDOCS)/fonts $(HTDOCS)/js + install -m 0444 $(HTMLS) $(HTDOCS) + install -m 0444 $(JSMINS) $(EXTJS) $(HTDOCS)/js + install -m 0444 $(CSS) $(HTDOCS)/css + install -m 0444 $(FONTS) $(HTDOCS)/fonts installapi: api mkdir -p $(APIDOCS) @@ -82,6 +90,7 @@ installapi: api updatecgi: all mkdir -p $(CGIBIN) install -m 0555 $(TARGET) $(CGIBIN)/$(CGINAME) + install -m 0555 $(OBJS) $(CGIBIN)/ installcgi: updatecgi mkdir -p $(DATADIR) @@ -97,7 +106,7 @@ clean: -e "s!@CGIURI@!$(CGIURI)!g" $< >$@ $(TARGET): $(OBJS) - $(CC) $(STATIC) -o $@ $(OBJS) ksql.o $(LDFLAGS) -lkcgi -lkcgijson -lz -lsqlite3 -pthread + $(CC) $(STATIC) -o $@ $(OBJS) externals/ksql.o $(LDFLAGS) -lkcgi -lkcgijson -lz -lsqlite3 -pthread $(OBJS): extern.h diff --git a/bootstrap.min.css b/externals/bootstrap.min.css similarity index 100% rename from bootstrap.min.css rename to externals/bootstrap.min.css diff --git a/index.html b/index.html index 7f28be4..5aac353 100644 --- a/index.html +++ b/index.html @@ -4,43 +4,42 @@ Bouquins - - - - - - - + + + + +

Bouquins

Cette bibliothèque contient actuellement {{ booksCount }} livres et BD en format papier ou électronique.

-
-
+ +
+
- + - - + +
TitreSerie Auteur(s)Serie
{{ book.title }} - {{ book.series ? book.series.name : '' }} - {{ book.series ? book.series.idx : '' }} - {{ book.title }} + {{ book.series ? book.series.name : '' }} + {{ book.series ? book.series.idx : '' }} +
- - + + diff --git a/index.js b/index.js index fb2f1d9..93098de 100644 --- a/index.js +++ b/index.js @@ -32,16 +32,25 @@ console.log('ERROR ' + code + ': ' + resp); } - function indexSuccess(resp) { + function booksSuccess(resp) { app.books = resp; - app.booksCount = app.books.length; + } + + function indexSuccess(resp) { + app.booksCount = 9999; //TODO } function loadIndex() { + // TODO load books count sendQuery('cgi-bin/bouquins/books', stdError, indexSuccess); } + function loadBooks() { + sendQuery('cgi-bin/bouquins/books', stdError, booksSuccess); + } + root.loadIndex = loadIndex; + root.loadBooks = loadBooks; })(this); var app = new Vue({ diff --git a/vue.min.js b/vue.min.js deleted file mode 100644 index 0e55298..0000000 --- a/vue.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * Vue.js v2.1.6 - * (c) 2014-2016 Evan You - * Released under the MIT License. - */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Vue=t()}(this,function(){"use strict";function e(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function t(e){var t=parseFloat(e,10);return t||0===t?t:e}function n(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}function i(e,t){return Yr.call(e,t)}function a(e){return"string"==typeof e||"number"==typeof e}function o(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function s(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function c(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function l(e,t){for(var n in t)e[n]=t[n];return e}function u(e){return null!==e&&"object"==typeof e}function f(e){return ri.call(e)===ii}function d(e){for(var t={},n=0;n=0&&Li[n].id>e.id;)n--;Li.splice(Math.max(n,Ri)+1,0,e)}else Li.push(e);Mi||(Mi=!0,_i(B))}}function V(e){Ui.clear(),J(e,Ui)}function J(e,t){var n,r,i=Array.isArray(e);if((i||u(e))&&Object.isExtensible(e)){if(e.__ob__){var a=e.__ob__.dep.id;if(t.has(a))return;t.add(a)}if(i)for(n=e.length;n--;)J(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)J(e[r[n]],t)}}function K(e){e._watchers=[];var t=e.$options;t.props&&q(e,t.props),t.methods&&Y(e,t.methods),t.data?W(e):k(e._data={},!0),t.computed&&Z(e,t.computed),t.watch&&Q(e,t.watch)}function q(e,t){var n=e.$options.propsData||{},r=e.$options._propKeys=Object.keys(t),i=!e.$parent;Si.shouldConvert=i;for(var a=function(i){var a=r[i];A(e,a,R(a,t,n,e))},o=0;o1?c(n):n;for(var r=c(arguments,1),i=0,a=n.length;i-1:e.test(t)}function qe(e){var t={};t.get=function(){return si},Object.defineProperty(e,"config",t),e.util=Ni,e.set=O,e.delete=S,e.nextTick=_i,e.options=Object.create(null),si._assetTypes.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,l(e.options.components,Yi),Be(e),ze(e),Ve(e),Je(e)}function We(e){for(var t=e.data,n=e,r=e;r.child;)r=r.child._vnode,r.data&&(t=Ze(r.data,t));for(;n=n.parent;)n.data&&(t=Ze(t,n.data));return Ge(t)}function Ze(e,t){return{staticClass:Ye(e.staticClass,t.staticClass),class:e.class?[e.class,t.class]:t.class}}function Ge(e){var t=e.class,n=e.staticClass;return n||t?Ye(n,Qe(t)):""}function Ye(e,t){return e?t?e+" "+t:e:t||""}function Qe(e){var t="";if(!e)return t;if("string"==typeof e)return e;if(Array.isArray(e)){for(var n,r=0,i=e.length;r-1?pa[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:pa[e]=/HTMLUnknownElement/.test(t.toString())}function tt(e){if("string"==typeof e){if(e=document.querySelector(e),!e)return document.createElement("div")}return e}function nt(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&"multiple"in t.data.attrs&&n.setAttribute("multiple","multiple"),n)}function rt(e,t){return document.createElementNS(ca[e],t)}function it(e){return document.createTextNode(e)}function at(e){return document.createComment(e)}function ot(e,t,n){e.insertBefore(t,n)}function st(e,t){e.removeChild(t)}function ct(e,t){e.appendChild(t)}function lt(e){return e.parentNode}function ut(e){return e.nextSibling}function ft(e){return e.tagName}function dt(e,t){e.textContent=t}function pt(e,t,n){e.setAttribute(t,n)}function vt(e,t){var n=e.data.ref;if(n){var i=e.context,a=e.child||e.elm,o=i.$refs;t?Array.isArray(o[n])?r(o[n],a):o[n]===a&&(o[n]=void 0):e.data.refInFor?Array.isArray(o[n])&&o[n].indexOf(a)<0?o[n].push(a):o[n]=[a]:o[n]=a}}function ht(e){return null==e}function mt(e){return null!=e}function gt(e,t){return e.key===t.key&&e.tag===t.tag&&e.isComment===t.isComment&&!e.data==!t.data}function yt(e,t,n){var r,i,a={};for(r=t;r<=n;++r)i=e[r].key,mt(i)&&(a[i]=r);return a}function _t(e){function t(e){return new zi(O.tagName(e).toLowerCase(),{},[],void 0,e)}function r(e,t){function n(){0===--n.listeners&&i(e)}return n.listeners=t,n}function i(e){var t=O.parentNode(e);t&&O.removeChild(t,e)}function o(e,t,n,r,i){if(e.isRootInsert=!i,!s(e,t,n,r)){var a=e.data,o=e.children,c=e.tag;mt(c)?(e.elm=e.ns?O.createElementNS(e.ns,c):O.createElement(c,e),v(e),u(e,o,t),mt(a)&&d(e,t),l(n,e.elm,r)):e.isComment?(e.elm=O.createComment(e.text),l(n,e.elm,r)):(e.elm=O.createTextNode(e.text),l(n,e.elm,r))}}function s(e,t,n,r){var i=e.data;if(mt(i)){var a=mt(e.child)&&i.keepAlive;if(mt(i=i.hook)&&mt(i=i.init)&&i(e,!1,n,r),mt(e.child))return p(e,t),a&&c(e,t,n,r),!0}}function c(e,t,n,r){for(var i,a=e;a.child;)if(a=a.child._vnode,mt(i=a.data)&&mt(i=i.transition)){for(i=0;id?(l=ht(n[m+1])?null:n[m+1].elm,h(e,l,n,f,m,r)):f>m&&g(e,t,u,d)}function b(e,t,n,r){if(e!==t){if(t.isStatic&&e.isStatic&&t.key===e.key&&(t.isCloned||t.isOnce))return t.elm=e.elm,void(t.child=e.child);var i,a=t.data,o=mt(a);o&&mt(i=a.hook)&&mt(i=i.prepatch)&&i(e,t);var s=t.elm=e.elm,c=e.children,l=t.children;if(o&&f(t)){for(i=0;i-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+e.getAttribute("class")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function It(e,t){if(t&&t.trim())if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+e.getAttribute("class")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Ft(e){Fa(function(){Fa(e)})}function Ht(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Rt(e,t)}function Ut(e,t){e._transitionClasses&&r(e._transitionClasses,t),It(e,t)}function Bt(e,t,n){var r=zt(e,t),i=r.type,a=r.timeout,o=r.propCount;if(!i)return n();var s=i===La?Pa:Ia,c=0,l=function(){e.removeEventListener(s,u),n()},u=function(t){t.target===e&&++c>=o&&l()};setTimeout(function(){c0&&(n=La,u=o,f=a.length):t===Da?l>0&&(n=Da,u=l,f=c.length):(u=Math.max(o,l),n=u>0?o>l?La:Da:null,f=n?n===La?a.length:c.length:0);var d=n===La&&Ha.test(r[Ma+"Property"]);return{type:n,timeout:u,propCount:f,hasTransform:d}}function Vt(e,t){for(;e.length1,T=n._enterCb=Zt(function(){O&&Ut(n,w),T.cancelled?(O&&Ut(n,$), -A&&A(n)):k&&k(n),n._enterCb=null});e.data.show||ae(e.data.hook||(e.data.hook={}),"insert",function(){var t=n.parentNode,r=t&&t._pending&&t._pending[e.key];r&&r.context===e.context&&r.tag===e.tag&&r.elm._leaveCb&&r.elm._leaveCb(),C&&C(n,T)},"transition-insert"),x&&x(n),O&&(Ht(n,$),Ht(n,w),Ft(function(){Ut(n,$),T.cancelled||S||Bt(n,a,T)})),e.data.show&&(t&&t(),C&&C(n,T)),O||S||T()}}}function qt(e,t){function n(){m.cancelled||(e.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[e.key]=e),l&&l(r),v&&(Ht(r,s),Ht(r,c),Ft(function(){Ut(r,s),m.cancelled||h||Bt(r,o,m)})),u&&u(r,m),v||h||m())}var r=e.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var i=Wt(e.data.transition);if(!i)return t();if(!r._leaveCb&&1===r.nodeType){var a=i.css,o=i.type,s=i.leaveClass,c=i.leaveActiveClass,l=i.beforeLeave,u=i.leave,f=i.afterLeave,d=i.leaveCancelled,p=i.delayLeave,v=a!==!1&&!pi,h=u&&(u._length||u.length)>1,m=r._leaveCb=Zt(function(){r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[e.key]=null),v&&Ut(r,c),m.cancelled?(v&&Ut(r,s),d&&d(r)):(t(),f&&f(r)),r._leaveCb=null});p?p(n):n()}}function Wt(e){if(e){if("object"==typeof e){var t={};return e.css!==!1&&l(t,Ua(e.name||"v")),l(t,e),t}return"string"==typeof e?Ua(e):void 0}}function Zt(e){var t=!1;return function(){t||(t=!0,e())}}function Gt(e,t){t.data.show||Kt(t)}function Yt(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var a,o,s=0,c=e.options.length;s-1,o.selected!==a&&(o.selected=a);else if(h(Xt(o),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Qt(e,t){for(var n=0,r=t.length;n',n.innerHTML.indexOf(t)>0}function pn(e){return eo=eo||document.createElement("div"),eo.innerHTML=e,eo.textContent}function vn(e,t){return t&&(e=e.replace(Zo,"\n")),e.replace(qo,"<").replace(Wo,">").replace(Go,"&").replace(Yo,'"')}function hn(e,t){function n(t){f+=t,e=e.substring(t)}function r(){var t=e.match(fo);if(t){var r={tagName:t[1],attrs:[],start:f};n(t[0].length);for(var i,a;!(i=e.match(po))&&(a=e.match(co));)n(a[0].length),r.attrs.push(a);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=f,r}}function i(e){var n=e.tagName,r=e.unarySlash;l&&("p"===s&&io(n)&&a("",s),ro(n)&&s===n&&a("",n));for(var i=u(n)||"html"===n&&"head"===s||!!r,o=e.attrs.length,f=new Array(o),d=0;d=0&&c[a].tag.toLowerCase()!==o;a--);}else a=0;if(a>=0){for(var l=c.length-1;l>=a;l--)t.end&&t.end(c[l].tag,r,i);c.length=a,s=a&&c[a-1].tag}else"br"===n.toLowerCase()?t.start&&t.start(n,[],!0,r,i):"p"===n.toLowerCase()&&(t.start&&t.start(n,[],!1,r,i),t.end&&t.end(n,r,i))}for(var o,s,c=[],l=t.expectHTML,u=t.isUnaryTag||ai,f=0;e;){if(o=e,s&&Jo(s,t.sfc,c)){var d=s.toLowerCase(),p=Ko[d]||(Ko[d]=new RegExp("([\\s\\S]*?)(]*>)","i")),v=0,h=e.replace(p,function(e,n,r){return v=r.length,"script"!==d&&"style"!==d&&"noscript"!==d&&(n=n.replace(//g,"$1").replace(//g,"$1")),t.chars&&t.chars(n),""});f+=e.length-h.length,e=h,a("",d,f-v,f)}else{var m=e.indexOf("<");if(0===m){if(mo.test(e)){var g=e.indexOf("-->");if(g>=0){n(g+3);continue}}if(go.test(e)){var y=e.indexOf("]>");if(y>=0){n(y+2);continue}}var _=e.match(ho);if(_){n(_[0].length);continue}var b=e.match(vo);if(b){var $=f;n(b[0].length),a(b[0],b[1],$,f);continue}var w=r();if(w){i(w);continue}}var x=void 0,C=void 0,k=void 0;if(m>0){for(C=e.slice(m);!(vo.test(C)||fo.test(C)||mo.test(C)||go.test(C)||(k=C.indexOf("<",1),k<0));)m+=k,C=e.slice(m);x=e.substring(0,m),n(m)}m<0&&(x=e,e=""),t.chars&&x&&t.chars(x)}if(e===o&&t.chars){t.chars(e);break}}a()}function mn(e){function t(){(o||(o=[])).push(e.slice(v,i).trim()),v=i+1}var n,r,i,a,o,s=!1,c=!1,l=!1,u=!1,f=0,d=0,p=0,v=0;for(i=0;i=0&&(m=e.charAt(h)," "===m);h--);m&&/[\w$]/.test(m)||(u=!0)}}else void 0===a?(v=i+1,a=e.slice(0,i).trim()):t();if(void 0===a?a=e.slice(0,i).trim():0!==v&&t(),o)for(i=0;io&&a.push(JSON.stringify(e.slice(o,i)));var s=mn(r[1].trim());a.push("_s("+s+")"),o=i+r[0].length}return o=_o}function En(e){return 34===e||39===e}function jn(e){var t=1;for(xo=wo;!Tn();)if(e=Sn(),En(e))Nn(e);else if(91===e&&t++,93===e&&t--,0===t){Co=wo;break}}function Nn(e){for(var t=e;!Tn()&&(e=Sn(),e!==t););}function Ln(e,t){ko=t.warn||_n,Ao=t.getTagNamespace||ai,Oo=t.mustUseProp||ai,So=t.isPreTag||ai,To=bn(t.modules,"preTransformNode"),Eo=bn(t.modules,"transformNode"),jo=bn(t.modules,"postTransformNode"),No=t.delimiters;var n,r,i=[],a=t.preserveWhitespace!==!1,o=!1,s=!1;return hn(e,{expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,shouldDecodeNewlines:t.shouldDecodeNewlines,start:function(e,a,c){function l(e){}var u=r&&r.ns||Ao(e);di&&"svg"===u&&(a=Yn(a));var f={type:1,tag:e,attrsList:a,attrsMap:Wn(a),parent:r,children:[]};u&&(f.ns=u),Gn(f)&&!gi()&&(f.forbidden=!0);for(var d=0;d-1:_q("+t+","+a+")"),Cn(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+a+"):("+o+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$c){$$i<0&&("+t+"=$$a.concat($$v))}else{$$i>-1&&("+t+"=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{"+t+"=$$c}",null,!0)}function Ir(e,t,n){var r=n&&n.number,i=kn(e,"value")||"null";i=r?"_n("+i+")":i,$n(e,"checked","_q("+t+","+i+")"),Cn(e,"change",Ur(t,i),null,!0)}function Fr(e,t,n){var r=e.attrsMap.type,i=n||{},a=i.lazy,o=i.number,s=i.trim,c=a||di&&"range"===r?"change":"input",l=!a&&"range"!==r,u="input"===e.tag||"textarea"===e.tag,f=u?"$event.target.value"+(s?".trim()":""):s?"(typeof $event === 'string' ? $event.trim() : $event)":"$event";f=o||"number"===r?"_n("+f+")":f;var d=Ur(t,f);u&&l&&(d="if($event.target.composing)return;"+d),$n(e,"value",u?"_s("+t+")":"("+t+")"),Cn(e,c,d,null,!0),(s||o||"number"===r)&&Cn(e,"blur","$forceUpdate()")}function Hr(e,t,n){var r=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(r?"_n(val)":"val")+"})"+(null==e.attrsMap.multiple?"[0]":""),a=Ur(t,i);Cn(e,"change",a,null,!0)}function Ur(e,t){var n=On(e);return null===n.idx?e+"="+t:"var $$exp = "+n.exp+", $$idx = "+n.idx+";if (!Array.isArray($$exp)){"+e+"="+t+"}else{$$exp.splice($$idx, 1, "+t+")}"}function Br(e,t){t.value&&$n(e,"textContent","_s("+t.value+")")}function zr(e,t){t.value&&$n(e,"innerHTML","_s("+t.value+")")}function Vr(e,t){return t=t?l(l({},ws),t):ws,jr(e,t)}function Jr(e,t,n){var r=(t&&t.warn||$i,t&&t.delimiters?String(t.delimiters)+e:e);if($s[r])return $s[r];var i={},a=Vr(e,t);i.render=Kr(a.render);var o=a.staticRenderFns.length;i.staticRenderFns=new Array(o);for(var s=0;s0,vi=fi&&fi.indexOf("edge/")>0,hi=fi&&fi.indexOf("android")>0,mi=fi&&/iphone|ipad|ipod|ios/.test(fi),gi=function(){return void 0===Wr&&(Wr=!ui&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),Wr},yi=ui&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,_i=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t1&&(t[n[0].trim()]=n[1].trim())}}),t}),Aa=/^--/,Oa=/\s*!important$/,Sa=function(e,t,n){Aa.test(t)?e.style.setProperty(t,n):Oa.test(n)?e.style.setProperty(t,n.replace(Oa,""),"important"):e.style[Ea(t)]=n},Ta=["Webkit","Moz","ms"],Ea=o(function(e){if(Xi=Xi||document.createElement("div"),e=Xr(e),"filter"!==e&&e in Xi.style)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n\/=]+)/,oo=/(?:=)/,so=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],co=new RegExp("^\\s*"+ao.source+"(?:\\s*("+oo.source+")\\s*(?:"+so.join("|")+"))?"),lo="[a-zA-Z_][\\w\\-\\.]*",uo="((?:"+lo+"\\:)?"+lo+")",fo=new RegExp("^<"+uo),po=/^\s*(\/?)>/,vo=new RegExp("^<\\/"+uo+"[^>]*>"),ho=/^]+>/i,mo=/^