diff options
author | prathamesh | 2014-12-03 17:52:45 +0530 |
---|---|---|
committer | prathamesh | 2014-12-03 17:52:45 +0530 |
commit | a95aa2c17662269bcc8525e8bb3fb3ab64fa69df (patch) | |
tree | 6615439bef032d0d28bb11d2ab824ad18416e9e6 | |
parent | f7b2912723053a46023712c9dd8bc7307d6cf9fa (diff) | |
download | certificate-generator-a95aa2c17662269bcc8525e8bb3fb3ab64fa69df.tar.gz certificate-generator-a95aa2c17662269bcc8525e8bb3fb3ab64fa69df.tar.bz2 certificate-generator-a95aa2c17662269bcc8525e8bb3fb3ab64fa69df.zip |
Auto-generation of certificates
Currently, for scilab conference.
22 files changed, 1047 insertions, 42 deletions
diff --git a/certificate/certificate_template/Makefile b/certificate/certificate_template/Makefile new file mode 100644 index 0000000..a032d23 --- /dev/null +++ b/certificate/certificate_template/Makefile @@ -0,0 +1,41 @@ +# Makefile for Certificate + +# bashful package available @ +# http://www.ctan.org/tex-archive/macros/latex/contrib/bashful + +# pst-barcode package available @ +# http://www.ctan.org/tex-archive/graphics/pstricks/contrib/pst-barcode + +# target is not a real file +.PHONY: help certificate clean + +# default help +help: + @echo "current make version is: "$(MAKE_VERSION) + @echo "Please use \`make <target>' where <target> is one of" + @echo "" + @echo "certificate Generate certificate." + @echo "clean clean all tmp and pdf files." + @echo "help Show this help." + @echo "" + +# certificate +participant_cert: SLC2014Pcertificate.pdf + +SLC2014Pcertificate.pdf: SLC2014Pcertificate.tex fossee-logo.png bashful.sty + pdflatex -shell-escape SLC2014Pcertificate.tex + +paper_cert: SLC2014Acertificate.pdf + +SLC2014Acertificate.pdf: SLC2014Acertificate.tex fossee-logo.png bashful.sty + pdflatex -shell-escape SLC2014Acertificate.tex + +workshop_cert: SLC2014Wcertificate.pdf + +SLC2014Wcertificate.pdf: SLC2014Wcertificate.tex fossee-logo.png bashful.sty + pdflatex -shell-escape SLC2014Wcertificate.tex + +clean: + @echo "removing all tmp+pdf files" + -rm -rvf *.pdf *~ *.aux *.log *.vrb *.out *.toc *.nav *.snm + -rm -rvf *.std* *.sh diff --git a/certificate/certificate_template/ReadMe.org b/certificate/certificate_template/ReadMe.org new file mode 100644 index 0000000..3371830 --- /dev/null +++ b/certificate/certificate_template/ReadMe.org @@ -0,0 +1,21 @@ +* certificate template + +** Usage + - To generate a PDF file type, + #+BEGIN_SRC sh + make $command + #+END_SRC sh + + - To clean the project + #+BEGIN_SRC sh + make clean + #+END_SRC sh + +** License + The tex file and all the images within this project are entirely + PRIVATE. It's usage outside the `Fossee Project` is an legal + offense and will be subject to suitable punishment by Indian law. + + +** Website + [[http://fossee.in]] diff --git a/certificate/certificate_template/bashful.sty b/certificate/certificate_template/bashful.sty new file mode 100644 index 0000000..21b6f43 --- /dev/null +++ b/certificate/certificate_template/bashful.sty @@ -0,0 +1,544 @@ +% Copyright (C) 2011,2012 by Yossi Gil yogi@cs.technion.ac.il +% --------------------------------------------------------------------------- +% This work may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3 of this license or +% (at your option) any later version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all +% distributions of LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Yossi Gil. +% +% This work consists of the files bashful.tex and bashful.sty and the derived +% bashful.pdf + +\NeedsTeXFormat{LaTeX2e}% + +% Auxiliary identification information +\newcommand\date@bashful{2012/03/08}% +\newcommand\version@bashful{V 0.93}% +\newcommand\author@bashful{Yossi Gil}% +\newcommand\mail@bashful{yogi@cs.technion.ac.il}% +\newcommand\signature@bashful{% + bashful \version@bashful{} by + \author@bashful{} \mail@bashful +}% + +% Identify this package +\ProvidesPackage{bashful}[\date@bashful{} \signature@bashful: + Write and execute a bash script within LaTeX, with, or + without displaying the script and/or its output. +] +\PackageInfo{bashful}{This is bashful, \signature@bashful}% + +\RequirePackage{xcolor} +\RequirePackage{catchfile} +\RequirePackage{xkeyval} % Use xkeyval for retrieving parameters +\RequirePackage{textcomp} % For upquote + +% If true, all activities take place in a designated directory. +\newif\if@hide@BL@\@hide@BL@false + +% \if@unique@BL@ is a Boolean flag, telling us whether unique names should be +% generated for the auxiliary files (XX.sh, XX.stdout, XX.stderr and +% XX.exitCode) in each invocation of the \bash command. +\newif\if@unique@BL@\@unique@BL@false +\def\unique@BL{\if@unique@BL@ @\the\inputlineno\fi} + +% This is the default name for a directory in which processing should +% take place if \@hide@BL@true. +\def\directory@BL{_00} + +% Use listing to display bash scripts. +\RequirePackage{listings}% + + % listings style for the script, can be redefined by client + \lstdefinestyle{bashfulScript}{ + basicstyle=\ttfamily, + keywords={}, + upquote=true, + showstringspaces=false}% + % listings style for the standard output file, can be redefined by client + \lstdefinestyle{bashfulStdout}{ + basicstyle=\sl\ttfamily, + keywords={}, + upquote=true, + showstringspaces=false + }% + % listings style for the standard error file, can be redefined by client + \lstdefinestyle{bashfulStderr}{ + basicstyle=\sl\ttfamily\color{red}, + keywords={}, + upquote=true, + showstringspaces=false + }% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Keys generating file names in alphabetical order: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% dir: String = \directory@BL: Name of directory in which execution is going +% to take place +\define@cmdkey{bashful}[BL@]{dir}{\def\directory@BL{#1}}% + +% exitCodeFile: String = \BL@exitCodeFile: In which file should the exit code +% be stored if it is not zero. +\def\BL@exitCodeFile{\jobname\unique@BL.exitCode}% +\define@cmdkey{bashful}[BL@]{exitCodeFile}{}% + +% scriptFile: String = \BL@scriptFile: In which file should the script be +% saved? +\def\BL@scriptFile{\jobname\unique@BL.sh}% +\define@cmdkey{bashful}[BL@]{scriptFile}{}% + +% stderrFile: String = \BL@stderrFile: In which file should the standard +% error stream be saved? +\def\BL@stderrFile{\jobname\unique@BL.stderr}% +\define@cmdkey{bashful}[BL@]{stderrFile}{}% + +% stdoutFile: String = \BL@stdoutFile: In which file should the standard +% output stream be saved? +\def\BL@stdoutFile{\jobname\unique@BL.stdout}% +\define@cmdkey{bashful}[BL@]{stdoutFile}{}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% List configuration boolean keys +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% list: Boolean = \ifBL@script: Should we list the script we generate? +\define@boolkey{bashful}[BL@]{script}[true]{}% + +% stdout: Boolean = \ifBL@stderr: Should we list the standard error? +\define@boolkey{bashful}[BL@]{stderr}[true]{}% + +% stdout: Boolean = \ifBL@stdout: Should we list the standard output? +\define@boolkey{bashful}[BL@]{stdout}[true]{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Error checking Boolean keys. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% stdout: Boolean = \ifBL@ignoreExitCode: Should we ignore the exit +% code? +\define@boolkey{bashful}[BL@]{ignoreExitCode}[true]{} + +% stdout: Boolean = \ifBL@ignoreStderr: Should we ignore the exit +% code? +\define@boolkey{bashful}[BL@]{ignoreStderr}[true]{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Miscelaneous keys +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% environment: String = \BL@environment: Which environment should we wrap +% the listings +\def\BL@environment{none@BL}% +\define@cmdkey{bashful}[BL@]{environment}{}% +\newenvironment{none@BL}{}{} % Default, empty environment for wrapping + % the listings + +% prefix: String = \BL@prefix: What prefix should be printed before a listing. +\def\BL@prefix{\@percentchar\space}% +\define@cmdkey{bashful}[BL@]{prefix}{}% + +% shell: String = \BL@shell: Which shell should be used for execution? +\def\BL@shell{bash}% +\define@cmdkey{bashful}[BL@]{shell}{}% + +% verbose: Boolean = \ifBL@verbose: Log every step we do +\define@boolkey{bashful}[BL@]{verbose}[true]{}% + +% The "unique" package flag that tells the package to generated unique names +% for the auxiliary files. If true the generated files (XX.sh, XX.stdout, +% XX.stderr and XX.exitCode) are given unique names in each invocation of the +% \bash command. Unique names are generated by the pattern JOB@LINE.EXTENSION, +% where JOB is the job's name, LINE is the number of the line in the input in +% which the \bash command was invoked, and EXTENSION is one of "sh", "stdout", +% "stderr" and "exitCode". +\DeclareOptionX{unique} {\@unique@BL@true} +\DeclareOptionX{hide} {\@hide@BL@true} +\DeclareOptionX{dir} {\@hide@BL@true\def\directory@BL{#1}} +\DeclareOptionX{verbose} {\BL@verbosetrue} + +\ExecuteOptionsX{} +\ProcessOptionsX\relax + +% \bash: the main command we define. It chains to \bashI which chains to +% \bashII, etc. +\begingroup + %\where@BL + \catcode`\^^M\active% + \gdef\bash{% + \logBL{Beginning a group so that all cat code changes are local}% + \begingroup% + \logBL{Making \^\^M a true newline}% + \catcode`\^^M\active% + \def^^M{^^J}% + \logBL{Checking for optional arguments}% + \@ifnextchar[{\bashI}{\bashI[]}% + }% +\endgroup + +% \bashI: Process the optional arguments and continue +\def\bashI[#1]{\setKeys@BL{#1}\bashII} + +% \bashII: Set category codes of all characters to special, and proceed. +\begingroup + \catcode`\^^M\active% + \gdef\bashII{% + \logBL{bashII: Making \^\^M a true new line}% + \catcode`\^^M\active% + \def^^M{^^J}% + \logBL{bashII: Making all characters other}% + \let\do\@makeother% + \dospecials% + \bashIII}% +\endgroup + +% \bashIII: Consume all tokens until \END (but ignoring the preceding and +% terminating newline), and proceed. +\begingroup + \catcode`\@=0\relax + \catcode`\^^M\active + @catcode`@\=12@relax% + @gdef@bashIII^^M#1^^M% + \END{@bashIV{#1}@bashV{#1}@logBL{bashV: Done!}@endgroup}@endgroup + +% \bashIV: Process the tokens by storing them in a script file, and executing +% this file, +\newcommand\bashIV[1]{% + \logBL{BashIV: begin}% + \makeDirectory@BL + \generateScriptFile@BL{#1}\relax + \executeScriptFile@BL + \logBL{BashIV: done}% +}% + +% \logBL: record a log message in verbose mode +\newcommand\logBL[1]{\ifBL@verbose\typeout{L\the\inputlineno: #1}\fi} + +% A macro to create a new directory +\def\makeDirectory@BL{% + \if@hide@BL@ + \logBL{Making directory \directory@BL}% + \immediate\write18{mkdir -p \directory@BL}% + \else + \logBL{Using current directory}% + \fi +} + +\newcommand\splice[1]{% + \bashIV{#1}% + \expandFileName@BL{\BL@stdoutFile}% + \CatchFileDef{\BL@file@contents}{\BL@stdoutFile}{\relax}% + \ignorespaces\BL@file@contents\unskip +} + +% listing the script file if required, and presenting the standard output and +% standard error files if required. +\newcommand\bashV[1]{% + \logBL{Wrapping up after execution}% + \storeToFile@BL{\BL@prefix#1}{\BL@scriptFile}% + \expandFileName@BL\BL@scriptFile + \expandFileName@BL\BL@stdoutFile + \expandFileName@BL\BL@stderrFile + \logBL{Files are: \BL@scriptFile, \BL@stdoutFile, and \BL@stderrFile}% + \checkScriptErrors@BL + \listEverything@BL + \defineMacros@BL + \logBL{Wrap up done}} + +\def\expandFileName@BL#1{% + \logBL{Setting, if necessary, correct path of \noexpand#1 }% + \if@hide@BL@ + \logBL{Prepending path (\directory@BL) to #1}% + \edef#1{\directory@BL/#1}% + \logBL{Obtained #1}% + \fi +} + +\def\setKeys@BL#1{% + \logBL{Processing key=val pairs in options string [#1]}\relax + \setkeys{bashful}{#1}% +}% + +% Store the list of tokens in the first argument into our script file +\newcommand\generateScriptFile@BL[1]{% + \logBL{Generating script file \BL@scriptFile} + \storeToFile@BL{#1}{\BL@scriptFile}% +}% + +\newwrite\writer@BL +% Store the list of tokens in the first argument into the file given +% in the second argument; prepend directory if necessary +\newcommand\storeToFile@BL[2]{% + \logBL{ #2 :=^^J#1^^J}% + \if@hide@BL@ + \logBL{File #2 will be created in \directory@BL}% + \storeToFileI@BL{#1}{\directory@BL/#2} + \else + \logBL{File #2 will be created in current directory}% + \storeToFileI@BL{#1}{#2}% + \fi + \logBL{Writing done!}% +}% + +% Store the list of tokens in the first argument into the file given +% in the second argument; the second argument could be qualified with +% a directory name. +\newcommand\storeToFileI@BL[2]{% + \logBL{Writing to file #2...}% + \immediate\openout\writer@BL#2% + \immediate\write\writer@BL{#1}% + \immediate\closeout\writer@BL +}% + +% Execute the content of our script file. +\newcommand\executeScriptFile@BL{% + \edef\command@BL{\BL@shell \space \BL@scriptFile}% + \if@hide@BL@ + \logBL{Adding a "cd command"}% + \edef\command@BL{cd \directory@BL;\command@BL} + \fi% + \edef\command@BL{\command@BL \space >\BL@stdoutFile \space 2>\BL@stderrFile}% + \edef\command@BL{\command@BL \space || echo $? >\BL@exitCodeFile}% + \edef\command@BL{\BL@shell\space -c "\command@BL"}% + \logBL{Executing:^^J \command@BL}% + \immediate\write18{\command@BL}% +}% + +\newread\reader@BL + +% Issue an error message if errors found during execution +\newcommand\checkScriptErrors@BL{% + \logBL{Checking for script errors}% +% \begingroup + \newif\ifErrorsFound@\ErrorsFound@false + \checkExitCodeFile@BL + \ifdefined\exitCode@BL + \logBL{Non zero exit code found (\exitCode@BL), and I was not instructed to + ignore it} + \ErrorsFound@true + \fi + \def\eoln{\par} + \def\firstErrorLine{\par} + \checkStderrFile@BL + \logBL{I will now print the contents of file \BL@stderrFile\space (if found)} + \ifx\firstErrorLine\eoln + \relax + \else + \logBL{Standard error was not empty, and I was not instructed to ignore it} + \message{Standard error not empty. Here is how + ^^Jfile \BL@stderrFile\space begins: + ^^J>>>>\firstErrorLine + ^^J>>>>\space + ^^Jbut, you really ought to examine this file yourself!} + \ErrorsFound@true + \fi + \ifErrorsFound@ + \logBL{Issuing an error message since \BL@stderrFile\space was not empty}% + \errmessage{Your shell script failed...}% + \BL@verbosetrue + \logBL{Switching to verbose mode}% + \else + \logBL{File \BL@stderrFile\space was empty}% + \logBL{Proceeding as usual}% + \fi +% \endgroup +}% + +\newcommand\checkExitCodeFile@BL{% + \logBL{Considering \BL@exitCodeFile}% + \ifBL@ignoreExitCode + \logBL{Ignoring \BL@exitCodeFile, as per command flag}% + \else + \logBL{Opening \BL@exitCodeFile}% + \openin\reader@BL=\BL@exitCodeFile + \ifeof\reader@BL + \logBL{File \BL@exitCodeFile\space is missing, exit code was probably 0} + \closein\reader@BL + \else + \logBL{File \BL@exitCodeFile\space exists, let's get the exit code}% + \logBL{Reading first line of \BL@exitCodeFile}% + \catcode`\^^M=5 + \read\reader@BL to \exitCode@BL + \closein\reader@BL + \fi + \fi +} + +\newcommand\checkStderrFile@BL{% + \ifBL@stderr + \logBL{Will be listing \BL@stderrFile, so erroneous content is ignored}% + \else + \ifBL@ignoreStderr + \logBL{Ignoring \BL@stderrFile, as per command flag}% + \else + \checkStderrFileI@BL + \fi + \fi +} + +\newcommand\checkStderrFileI@BL{% + \logBL{Opening \BL@stderrFile}% + \openin\reader@BL=\BL@stderrFile\relax + \ifeof\reader@BL + \logBL{Hmm... \BL@stderrFile\space does not exist (probably a package bug)}% + \logBL{Switching to verbose mode}% + \BL@verbosetrue + \else + \logBL{Reading first line of \BL@stderrFile}% + \catcode`\^^M=5 + \read\reader@BL to \firstErrorLine + \ifeof\reader@BL + \ifx\firstErrorLine\eoln + \logBL{File \BL@stderrFile\space is empty} + \else + \logBL{File \BL@stderrFile\space has one line [\firstErrorLine]}% + \ErrorsFound@true + \fi + \else + \logBL{File \BL@stderrFile\space has two lines or more}% + \ErrorsFound@true + \fi + \fi + \closein\reader@BL +} + +% List the contents of the script, stdout and stderr, as per the flags. +\newcommand\listEverything@BL{% + \logBL{Checking whether any listings are required}% + \newif\if@listSomething@BL@ + \ifBL@script\@listSomething@BL@true\fi + \ifBL@stdout\@listSomething@BL@true\fi + \ifBL@stderr\@listSomething@BL@true\fi + \if@listSomething@BL@ + \beginWrappingEnvironment@BL + \listEverythingWithinEnvironment@BL + \endWrappingEnvironment@BL + \else + \logBL{Nothing has to be listed}% + \fi +} + +% Auxiliary macro to list the contents of the script, stdout and stderr, as per +% the flags. +\newcommand\listEverythingWithinEnvironment@BL{% + \logBL{Laying out the correct \noexpand\lstinputlisting commands}%1 + \ifBL@script\listScript@BL\BL@scriptFile\fi + \ifBL@stdout\listStdout@BL\BL@stdoutFile\fi + \ifBL@stderr\listStderr@BL\BL@stderrFile\fi +}% + +\newcommand\listScript@BL[1]{% + \logBL{Listing script: #1} + \def\flags@BL{style=bashfulScript} + \logBL{Initial flags for listing #1 are \flags@BL} + \ifBL@stdout\edef\flags@BL{\flags@BL, belowskip=0pt}\fi + \ifBL@stderr\edef\flags@BL{\flags@BL, belowskip=0pt}\fi + \doList@BL#1\flags@BL +} + +\newcommand\listStdout@BL[1]{% + \logBL{Listing stdout: #1} + \edef\flags@BL{style=bashfulStdout} + \logBL{Initial flags for listing stdout file are \flags@BL} + \ifBL@script\edef\flags@BL{\flags@BL, aboveskip=0pt}\fi + \ifBL@stderr\edef\flags@BL{\flags@BL, belowskip=0pt}\fi + \doList@BL#1\flags@BL +}% + +\newcommand\listStderr@BL[1]{% + \logBL{Listing stderr: #1}% + \def\flags@BL{style=bashfulStderr}% + \logBL{Initial flags for listing stderr file are \flags@BL} + \ifBL@script\edef\flags@BL{\flags@BL, aboveskip=0pt}\fi + \ifBL@stdout\edef\flags@BL{\flags@BL, aboveskip=0pt}\fi + \doList@BL#1\flags@BL +}% + +\newcommand\doList@BL[2]{% + \logBL{Flags for listing #1 are #2}% + \expandafter\lstset\expandafter{#2}% + \lstinputlisting{#1}% + }% + +\def\beginWrappingEnvironment@BL{% + \logBL{Beginning environment \BL@environment}% + \expandafter\csname\BL@environment\endcsname + \forceLTR@BL + \fixPolyglossiaBug@BL +}% + +\def\endWrappingEnvironment@BL{% + \expandafter\csname end\BL@environment\endcsname +}% + +% Define the \bashStdout and \bashStderr macro. +\newcommand\defineMacros@BL{% + \logBL{Defining macro for the contents of the standard output file}% + \immediate\openin\reader@BL=\BL@stdoutFile + \logBL{Opened file \BL@stdoutFile}% + \begingroup + \endlinechar=-1% + \ifeof\reader@BL + \logBL{File \BL@stdoutFile was empty}% + \global\let\bashStdout\relax + \else + \logBL{Reading contents of \BL@stdoutFile}% + \immediate\read\reader@BL to \BL@temp + \global\let\bashStdout\BL@temp + \fi + \typeout{after EOF}% + \logBL{bashStdout :=^^J\bashStdout^^J}% + \endgroup + \logBL{Closing file \BL@stdoutFile}% + \immediate\closein\reader@BL + \logBL{Defining macro for the contents of the standard error file}% + \immediate\openin\reader@BL=\BL@stderrFile + \logBL{Opened file \BL@stderrFile}% + \begingroup + \endlinechar=-1% + \ifeof\reader@BL + \logBL{File \BL@stdoutFile was empty}% + \global\let\bashStdout\relax + \else + \logBL{Reading contents of \BL@stderrFile}% + \immediate\read\reader@BL to \BL@temp + \global\let\bashStderr\BL@temp + \fi + \logBL{bashStderr :=^^J\bashStderr^^J}% + \endgroup + \logBL{Closing file \BL@stderrFile}% + \immediate\closein\reader@BL +} + +\newcommand\fixPolyglossiaBug@BL{% + \logBL{Trying to fix a Polyglossia package bug}% + \ifdefined\ttfamilylatin + \logBL{Replacing \noexpand\ttfamily with \noexpand\ttfamilylatin}% + \let\ttfamily=\ttfamilylatin + \logBL{Replacing \noexpand\rmfamily with \noexpand\rmfamilylatin}% + \let\rmfamily=\rmfamilylatin + \logBL{Replacing \noexpand\sffamily with \noexpand\sffamilylatin}% + \let\sffamily=\sffamilylatin + \logBL{Replacing \noexpand\normalfont with \noexpand\normalfontlatin}% + \let\normalfont=\normalfontlatin + \else + \logBL{Polyglossia package probably not loaded}% + \relax + \fi +}% + +\newcommand\forceLTR@BL{% + \logBL{Making sure we are not in right-to-left mode}% + \ifdefined\setLTR + \logBL{Command \noexpand\setLTR is defined, invoking it}% + \setLTR + \else + \logBL{Command \noexpand\setLTR is not defined, we are probably LTR}% + \relax + \fi +}% diff --git a/certificate/certificate_template/dbp-sign.png b/certificate/certificate_template/dbp-sign.png Binary files differnew file mode 100644 index 0000000..6feda2d --- /dev/null +++ b/certificate/certificate_template/dbp-sign.png diff --git a/certificate/certificate_template/fossee-logo.png b/certificate/certificate_template/fossee-logo.png Binary files differnew file mode 100644 index 0000000..6feda2d --- /dev/null +++ b/certificate/certificate_template/fossee-logo.png diff --git a/certificate/certificate_template/iitb-logo.png b/certificate/certificate_template/iitb-logo.png Binary files differnew file mode 100644 index 0000000..89ec1cc --- /dev/null +++ b/certificate/certificate_template/iitb-logo.png diff --git a/certificate/certificate_template/kannan-moudgalya-sign.png b/certificate/certificate_template/kannan-moudgalya-sign.png Binary files differnew file mode 100644 index 0000000..6feda2d --- /dev/null +++ b/certificate/certificate_template/kannan-moudgalya-sign.png diff --git a/certificate/certificate_template/pst-barcode.sty b/certificate/certificate_template/pst-barcode.sty new file mode 100644 index 0000000..ed02c1e --- /dev/null +++ b/certificate/certificate_template/pst-barcode.sty @@ -0,0 +1,11 @@ +\RequirePackage{pstricks} +\ProvidesPackage{pst-barcode}[2012/11/16 package wrapper for + pst-barcode.tex (hv)] +\input{pst-barcode.tex} +\ProvidesFile{pst-barcode.tex} + [\filedate\space v\fileversion\space `PST-barcode' (hv)] +\IfFileExists{pst-barcode.pro}{% + \ProvidesFile{pst-barcode.pro} + [2011/03/12 PostScript prologue file (hv)] + \@addtofilelist{pst-barcode.pro}}{}% +\endinput diff --git a/certificate/certificate_template/scilab.png b/certificate/certificate_template/scilab.png Binary files differnew file mode 100644 index 0000000..acafb43 --- /dev/null +++ b/certificate/certificate_template/scilab.png diff --git a/certificate/certificate_template/template_SLC2014Acertificate b/certificate/certificate_template/template_SLC2014Acertificate new file mode 100644 index 0000000..3371830 --- /dev/null +++ b/certificate/certificate_template/template_SLC2014Acertificate @@ -0,0 +1,21 @@ +* certificate template + +** Usage + - To generate a PDF file type, + #+BEGIN_SRC sh + make $command + #+END_SRC sh + + - To clean the project + #+BEGIN_SRC sh + make clean + #+END_SRC sh + +** License + The tex file and all the images within this project are entirely + PRIVATE. It's usage outside the `Fossee Project` is an legal + offense and will be subject to suitable punishment by Indian law. + + +** Website + [[http://fossee.in]] diff --git a/certificate/certificate_template/template_SLC2014Pcertificate b/certificate/certificate_template/template_SLC2014Pcertificate new file mode 100644 index 0000000..3371830 --- /dev/null +++ b/certificate/certificate_template/template_SLC2014Pcertificate @@ -0,0 +1,21 @@ +* certificate template + +** Usage + - To generate a PDF file type, + #+BEGIN_SRC sh + make $command + #+END_SRC sh + + - To clean the project + #+BEGIN_SRC sh + make clean + #+END_SRC sh + +** License + The tex file and all the images within this project are entirely + PRIVATE. It's usage outside the `Fossee Project` is an legal + offense and will be subject to suitable punishment by Indian law. + + +** Website + [[http://fossee.in]] diff --git a/certificate/certificate_template/template_SLC2014Wcertificate b/certificate/certificate_template/template_SLC2014Wcertificate new file mode 100644 index 0000000..3371830 --- /dev/null +++ b/certificate/certificate_template/template_SLC2014Wcertificate @@ -0,0 +1,21 @@ +* certificate template + +** Usage + - To generate a PDF file type, + #+BEGIN_SRC sh + make $command + #+END_SRC sh + + - To clean the project + #+BEGIN_SRC sh + make clean + #+END_SRC sh + +** License + The tex file and all the images within this project are entirely + PRIVATE. It's usage outside the `Fossee Project` is an legal + offense and will be subject to suitable punishment by Indian law. + + +** Website + [[http://fossee.in]] diff --git a/certificate/certificate_template/template_certificate b/certificate/certificate_template/template_certificate new file mode 100644 index 0000000..2898eab --- /dev/null +++ b/certificate/certificate_template/template_certificate @@ -0,0 +1,109 @@ +%% Certificate template
+\documentclass[landscape]{article}
+\usepackage{wallpaper}
+\usepackage{niceframe}
+\usepackage{xcolor}
+\usepackage{ulem}
+\usepackage{graphicx}
+\usepackage{geometry}
+\usepackage{chancery}
+\usepackage[T1]{fontenc}
+%% package to execute bash commands
+%% \usepackage{bashful}
+
+%% generate QR code
+\usepackage{pst-barcode}
+\usepackage{auto-pst-pdf}
+
+\geometry{tmargin=.5cm,bmargin=.5cm,
+ lmargin=.5cm, rmargin=.5cm}
+\usepackage{multicol}
+\setlength{\columnseprule}{0.8pt}
+\columnwidth=0.3\textwidth
+
+\begin{document}
+
+%% create MD5 hash of tex file and insert it in PDF
+%% \bash
+%% md5sum asd_cert.tex | cut -d " " -f 1
+%% \END
+
+%\TileWallPaper{4cm}{2cm}{aakash-logo.png}
+
+\centering
+\scalebox{3.07}{\color{red!30!black!60}
+\begin{minipage}{.33\textwidth}
+\font\border=umrandb
+\generalframe
+{\border \char119} % up left
+{\border \char119} % up
+{\border \char119} % up right
+{\border \char119} % left
+{\border \char119} % right
+{\border \char119} % lower left
+{\border \char119} % bottom
+{\border \char119} % lower right
+{\centering
+
+%% logo - top
+\begin{minipage}{0.9\textwidth}
+\centering
+\includegraphics[height=0.8cm]{fossee-logo.png}
+\end{minipage}
+\vspace{-9mm}
+
+\curlyframe[.9\columnwidth]{
+
+\textcolor{red!10!black!90}
+{\tiny Scilab Conference 2014}\\
+
+\textcolor{red!30!black!90}
+{\textsc{Certificate of Participation}}
+
+\textcolor{green!10!black!90}{\tiny This is to certify that}
+
+{\textcolor{black}
+\bf {$name}} \medskip
+
+{\tiny {\color{black} has participated in{\color{blue} Scilab Conference},
+ organized by Indian Institute of Technology Bombay, Scilab, FOSSEE Team\\
+ from 3 December 2014 to 5 December 2014} \par}
+
+\vspace{2.0mm}
+
+{\color{blue!40!black}
+\scalebox{.7}{
+ \begin{tabular}{c c c}
+ \includegraphics[height=0.7cm]{kannan-moudgalya-sign.png} && \includegraphics[height=0.7cm]{dbp-sign.png} \\
+ %% \cline{1-1}
+ %% \cline{5-5}
+ \vspace{0mm}
+ \small{Prof. Kannan M. Moudgalya} && \small{~~~~~~~~Prof. Deepak B. Phatak~~~~~~~~} \\
+ \vspace{0mm}
+ \small{Project in-charge} && \small{Project in-charge} \\
+ \end{tabular}
+}}}
+
+%% iitb logo - bottom
+\vspace{-12mm}
+\begin{minipage}{0.9\textwidth}
+\centering
+\includegraphics[height=0.6cm]{iitb-logo.png}
+\end{minipage}
+
+%% QR code
+%% md5sum of 'aakash-logo.png' as encoding
+\hspace{0.6 mm}
+\begin{pspicture}(0.1cm,0.1cm)
+ \psbarcode{
+$code
+VERIFY AT: http://fossee.in/certificate/verify
+}{eclevel=L width=0.15 height=0.15}{qrcode}
+\end{pspicture}
+
+%% MD5 hash
+%% {\tiny \color{lightgray}{\bashStdout}}
+}
+\end{minipage}
+}
+\end{document}
diff --git a/certificate/certificate_template/white.jpg b/certificate/certificate_template/white.jpg Binary files differnew file mode 100644 index 0000000..5965b16 --- /dev/null +++ b/certificate/certificate_template/white.jpg diff --git a/certificate/models.py b/certificate/models.py index b7b8142..5f89e06 100644 --- a/certificate/models.py +++ b/certificate/models.py @@ -27,7 +27,7 @@ class Certificate(models.Model): serial_no = models.CharField(max_length=50) #purpose+uin+1stletter counter = models.IntegerField() -class Scilab_import(models.Model): +class Scilab_participant(models.Model): ''' Autogenerated model file csvimport Mon Dec 1 07:46:00 2014 ''' id = models.IntegerField(primary_key=True, null=False) ticket_number = models.IntegerField(default=0, null=False, blank=False) @@ -37,7 +37,29 @@ class Scilab_import(models.Model): date = models.CharField(max_length=50, null=True, blank=True) order_id = models.IntegerField(default=0, null=True, blank=True) purpose = models.CharField(max_length=10, default='SLC') - + attendance = models.BooleanField(default=False) class Meta: managed = True + +class Scilab_speaker(models.Model): + ''' Autogenerated model file csvimport Wed Dec 3 05:36:56 2014 ''' + + id = models.IntegerField(default=0, null=False, primary_key=True, blank=False) + name = models.CharField(max_length=300) + email = models.CharField(max_length=300) + ticket = models.CharField(max_length=100) + paper = models.CharField(max_length=300) + purpose = models.CharField(max_length=10, default='SLC') + attendance = models.BooleanField(default=False) + +class Scilab_workshop(models.Model): + ''' Autogenerated model file csvimport Wed Dec 3 06:31:59 2014 ''' + + id = models.IntegerField(null=False, primary_key=True, blank=False) + name = models.CharField(max_length=300) + ticket_number = models.IntegerField(null=True) + email = models.CharField(max_length=300) + workshops = models.CharField(max_length=300) + purpose = models.CharField(max_length=10, default='SLC') + attendance = models.BooleanField(default=False) diff --git a/certificate/templates/base.html b/certificate/templates/base.html index 2e437f3..09bc0aa 100644 --- a/certificate/templates/base.html +++ b/certificate/templates/base.html @@ -1,5 +1,3 @@ -{% load compress %} -{% load static %} <html> <head> <title> @@ -7,9 +5,9 @@ FOSSEE Project {% endblock %} </title> - {% compress css %} - <link rel="stylesheet" href="{% static 'website/css/bootstrap.min.css' %}" type="text/css" media="screen" charset="utf-8" /> - {% endcompress %} + {% block css %} + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> + {% endblock %} </head> <body> <div id="page-wrapper"> @@ -20,7 +18,7 @@ <div id="footer-wrapper" class="container"> <div class="pull-left"> - ©2013 <a href="http://fossee.in" target="_blank">fossee.in</a> + ©2014 <a href="http://fossee.in" target="_blank">fossee.in</a> </div> <div class="pull-right"> Developed at IIT Bombay @@ -28,12 +26,12 @@ </div> <!-- /#footer-wrapper --> </div> <!-- /#page-wrapper --> - {% compress js %} - <script src="{% static 'website/js/jquery.min.js' %}"></script> - <script src="{% static 'website/js/bootstrap.min.js' %}"></script> + {% block js %} + <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> {% block javascript %} <!-- overide with custom javascript --> {% endblock %} - {% endcompress %} + {% endblock %} </body> </html> diff --git a/certificate/templates/download.html b/certificate/templates/download.html index bb34fb8..829c2e8 100644 --- a/certificate/templates/download.html +++ b/certificate/templates/download.html @@ -1,17 +1,54 @@ -<html> - <body> - <form action="" method="post"> +{% extends 'base.html' %} + +{% block content %} + <form action="" method="post"> {% csrf_token %} {{error}} - <center><table class=span1> - Email: <input type=text name=email> - <br> - <input type="radio" name="type" value="P">Participant - <input type="radio" name="type" value="A">Paper - <input type="radio" name="type" value="W">Workshop - </table></center> - <center><button class="btn" type="submit">Submit</button></center> + <center> + <table class=span1 align='left'> + Email: <input type=text id="email" name=email> + <br> + <input type="radio" name="type" id="P" value="P" checked="True">Participant + <input type="radio" name="type" id="A" value="A">Paper + <input type="radio" name="type" id="W" value="W">Workshop + {% if user_papers %} + <br><br> + <span><h3>Papers presented</h3><span> + {% for user in user_papers %} + <br> + <input type="radio" name="paper" value="{{ user.paper }}">{{ user.paper }} + {% endfor %} + {% endif %} + {% if workshops %} + <br><br> + <span><h3>Workshop Attended</h3><span> + {% for user in workshops %} + <br> + <input type="radio" name="workshop" value="{{ user.workshops }}">{{ user.workshops }} + {% endfor %} + {% endif %} + </table> + </center> + + <center><a href="{% url 'certificate:download' %}" class="btn" >Clear</a><button class="btn" type="submit">Get Certificate</button></center> </form> - </body> -<html> +{% endblock %} + +{% block javascript %} +<script> + $(document).ready(function(){ + value = "{{ v }}" + email = "" + if(value == "paper"){ + $('#A').prop('checked', true) + email = "{{ user_papers.0.email }}"; + } + if(value == "workshop"){ + $('#W').prop('checked', true) + email = "{{ workshops.0.email }}" + } + $('#email').val(email); + }); +</script> +{% endblock %} diff --git a/certificate/templates/verify.html b/certificate/templates/verify.html index 55668d5..856ae36 100644 --- a/certificate/templates/verify.html +++ b/certificate/templates/verify.html @@ -1,12 +1,12 @@ -<html> - <body> +{% extends 'base.html' %} + +{% block content %} <form action="" method="post"> {{detail}} {% csrf_token %} <center><table class=span1> Serial Number: <input type=text name=serial_no> </table></center> - <center><button class="btn" type="submit">Submit</button></center> + <center><a href="{% url 'certificate:verify' %}" class="btn" >Clear</a><button class="btn" type="submit">Submit</button></center> </form> - </body> -<html> +{% endblock %} diff --git a/certificate/views.py b/certificate/views.py index e598143..ddab500 100644 --- a/certificate/views.py +++ b/certificate/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext -from certificate.models import Scilab_import, Certificate, Event +from certificate.models import Scilab_participant, Certificate, Event, Scilab_speaker, Scilab_workshop import subprocess import os from string import Template @@ -16,14 +16,47 @@ def download(request): certificate_path = '{0}/certificate_template/'.format(cur_path) if request.method == 'POST': - email = request.POST.get('email') + paper = request.POST.get('paper', None) + workshop = request.POST.get('workshop', None) + email = request.POST.get('email').strip() type = request.POST.get('type') if type == 'P': - user = Scilab_import.objects.filter(email=email) + user = Scilab_participant.objects.filter(email=email) if not user: return HttpResponse('Entered email is not registered') else: user = user[0] + elif type == 'A': + if paper: + user = Scilab_speaker.objects.filter(email=email, paper=paper) + user = [user[0]] + else: + user = Scilab_speaker.objects.filter(email=email) + if not user: + return HttpResponse('Entered email is not registered') + if len(user) > 1: + context['user_papers'] = user + context['v'] = 'paper' + return render_to_response('download.html', context, context_instance=ci) + else: + user = user[0] + paper = user.paper + elif type == 'W': + if workshop: + user = Scilab_workshop.objects.filter(email=email, workshops=workshop) + user = [user[0]] + else: + user = Scilab_workshop.objects.filter(email=email) + if not user: + return HttpResponse('Entered email is not registered') + print user + if len(user) > 1: + context['workshops'] = user + context['v'] = 'workshop' + return render_to_response('download.html', context, context_instance=ci) + else: + user = user[0] + workshop = user.workshops name = user.name purpose = user.purpose year = '14' @@ -33,13 +66,13 @@ def download(request): qrcode = '{0}\n{1}'.format(name, serial_no) try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) - certificate = create_certificate(certificate_path, name, qrcode, type) + certificate = create_certificate(certificate_path, name, qrcode, type, paper, workshop) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() return certificate[0] except Certificate.DoesNotExist: - certificate = create_certificate(certificate_path, name, qrcode, type) + certificate = create_certificate(certificate_path, name, qrcode, type, paper, workshop) if not certificate[1]: certi_obj = Certificate(name=name, email=email, serial_no=serial_no, counter=1) certi_obj.save() @@ -56,7 +89,7 @@ def verify(request): ci = RequestContext(request) detail = None if request.method == 'POST': - serial_no = request.POST.get('serial_no') + serial_no = request.POST.get('serial_no').strip() try: certificate = Certificate.objects.get(serial_no=serial_no) except Certificate.DoesNotExist: @@ -68,10 +101,9 @@ def verify(request): detail = '{0} had attended {1} {2}'.format(name, purpose, year) elif type == 'A': detail = '{0} had presented paper in the {1} {2}'.format(name, purpose, year) - elif type == 'E': + elif type == 'W': detail = '{0} had attended workshop in the {1} {2}'.format(name, purpose, year) context['detail'] = detail - print detail return render_to_response('verify.html', context, ci) return render_to_response('verify.html',{}, ci) @@ -96,18 +128,31 @@ def _get_detail(serial_no): return purpose, year, serial_no[-1] -def create_certificate(certificate_path, name, qrcode, type): +def create_certificate(certificate_path, name, qrcode, type, paper=None, workshop=None): error = False try: if type == 'P': template = 'template_SLC2014Pcertificate' file_name = 'SLC2014Pcertificate' + elif type == 'A': + template = 'template_SLC2014Acertificate' + file_name = 'SLC2014Acertificate' + elif type == 'W': + template = 'template_SLC2014Wcertificate' + file_name = 'SLC2014Wcertificate' template_file = open('{0}{1}'.format\ (certificate_path, template), 'r') content = Template(template_file.read()) template_file.close() - content_tex = content.safe_substitute(name=name, code=qrcode) + if type == 'P': + content_tex = content.safe_substitute(name=name, code=qrcode) + elif type == 'A': + content_tex = content.safe_substitute(name=name, code=qrcode, + paper=paper) + elif type == 'W': + content_tex = content.safe_substitute(name=name, code=qrcode, + workshop=workshop) create_tex = open('{0}{1}.tex'.format\ (certificate_path, file_name), 'w') create_tex.write(content_tex) @@ -136,9 +181,12 @@ def _clean_certificate_certificate(path): def _make_certificate_certificate(path, type): if type == 'P': command = 'participant_cert' + elif type == 'A': + command = 'paper_cert' + elif type == 'W': + command = 'workshop_cert' process = subprocess.Popen('timeout 15 make -C {0} {1}'.format(path, command), stderr = subprocess.PIPE, shell = True) err = process.communicate()[1] return process.returncode, err - return HttpResponse("DOWNLAOD") diff --git a/fossee_project/settings.py b/fossee_project/settings.py new file mode 100644 index 0000000..d5a2576 --- /dev/null +++ b/fossee_project/settings.py @@ -0,0 +1,96 @@ +""" +Django settings for fossee_project project. + +For more information on this file, see +https://docs.djangoproject.com/en/1.6/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.6/ref/settings/ +""" +from local.py import DBNAME, DBUSER, DBPASS +from os.path import * +PROJDIR = abspath(dirname(__file__)) +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'j_4@2e^e*byl1c2@^=^)bo75r5h$l01aa8*)ladv7+8druq6f*' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = [] + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + join(PROJDIR, '../certificate/templates'), +) + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + #'south', + 'certificate', + 'csvimport.app.CSVImportConf', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'fossee_project.urls' + +WSGI_APPLICATION = 'fossee_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME' : DBNAME, + #'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'USER' : DBUSER, + 'PASSWORD': DBPASS, + } +} + +# Internationalization +# https://docs.djangoproject.com/en/1.6/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.6/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/fossee_project/urls.py b/fossee_project/urls.py index 162dd5d..8ab701f 100644 --- a/fossee_project/urls.py +++ b/fossee_project/urls.py @@ -9,5 +9,5 @@ urlpatterns = patterns('', # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), - url(r'^certificate/', include('certificate.urls')), + url(r'^certificate/', include('certificate.urls', namespace='certificate')), ) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5849891 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,15 @@ +Django==1.7.1 +MySQL-python==1.2.5 +argparse==1.2.1 +chardet==2.1.1 +django-appconf==0.6 +django-csvimport==2.4 +json-table-schema==0.1 +lxml==3.4.1 +messytables==0.14.1 +python-dateutil==1.5 +python-magic==0.4.6 +requests==2.4.3 +six==1.8.0 +wsgiref==0.1.2 +xlrd==0.9.3 |