Browse Source

display lines of code in page footer

v0.1.8
Georg Hopp 12 years ago
parent
commit
f95c7f2fae
  1. 3
      assets/html/_footer.html
  2. 10
      assets/js/init.js
  3. 1
      include/application/application.h
  4. 1
      src/application/Makefile.am
  5. 1
      src/application/application.c
  6. 49
      src/application/controller/loc/read.c

3
assets/html/_footer.html

@ -1,5 +1,6 @@
<hr /> <hr />
&copy; 2013 Georg Hopp - &copy; 2013 Georg Hopp -
<a href="mailto:georg@steffers.org">contact-email</a>
<a href="mailto:georg@steffers.org">contact-email</a> -
<span id="loc"></span>
<!-- vim: set ts=4 sw=4: --> <!-- vim: set ts=4 sw=4: -->

10
assets/js/init.js

@ -22,7 +22,6 @@ $(document).ready(function() {
} }
$("#title").load("/_title.html"); $("#title").load("/_title.html");
$("#footer").load("/_footer.html");
$("#main").load(asset); $("#main").load(asset);
$("#menu").load("/_menu.html", function() { $("#menu").load("/_menu.html", function() {
@ -85,6 +84,15 @@ $(document).ready(function() {
}); });
}); });
$("#footer").load("/_footer.html", function (){
$.getJSON(
"/loc/",
function(data) {
$("#loc").empty().append(data.loc + " lines of C code");
}
);
});
$("#randval").click(function() { $("#randval").click(function() {
sval.stop(); sval.stop();
}); });

1
include/application/application.h

@ -59,6 +59,7 @@ CLASS(Application) {
Hash roles_resource_index; Hash roles_resource_index;
const char * version; const char * version;
const char * loc;
}; };
int applicationLogin(Application, Credential, Session); int applicationLogin(Application, Credential, Session);

1
src/application/Makefile.am

@ -24,6 +24,7 @@ CONTROLLER = controller/authenticate/create.c \
controller/user/read.c \ controller/user/read.c \
controller/signup/create.c \ controller/signup/create.c \
controller/version/read.c \ controller/version/read.c \
controller/loc/read.c \
controller/_validate_password_repeat.c \ controller/_validate_password_repeat.c \
controller/_process_user_create_args.c controller/_process_user_create_args.c

1
src/application/application.c

@ -68,6 +68,7 @@ applicationCtor(void * _this, va_list * params)
} }
this->version = VERSION; this->version = VERSION;
this->loc = LOC;
return 0; return 0;
} }

49
src/application/controller/loc/read.c

@ -0,0 +1,49 @@
/**
* \file
*
* \author Georg Hopp
*
* \copyright
* Copyright © 2013 Georg Hopp
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>
#include "application/application.h"
#include "hash.h"
#include "session.h"
#include "utils/memory.h"
#define LOC_JSON "{\"loc\":\"%s\"}"
char *
controllerLocRead(Application app, Session sess, Hash args)
{
char * buffer;
size_t nbuffer;
nbuffer = snprintf(NULL, 0, LOC_JSON, app->loc? app->loc : "");
buffer = memMalloc(nbuffer);
sprintf(buffer, LOC_JSON, app->loc? app->loc : "");
return buffer;
}
// vim: set ts=4 sw=4:
Loading…
Cancel
Save