diff --git a/.gitignore b/.gitignore index c4c691c..cdf8f3d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ *.swo *.swp local.py +env/* +*.sqlite3 diff --git a/certificate/forms.py b/certificate/forms.py index 396da11..f67e1c7 100644 --- a/certificate/forms.py +++ b/certificate/forms.py @@ -1,5 +1,6 @@ from django import forms from certificate.models import FeedBack +import datetime class FeedBackForm(forms.Form): name = forms.CharField(max_length=30) @@ -16,3 +17,23 @@ class FeedBackForm(forms.Form): # (max_length=30, required=False) #state = forms.CharField\ # (max_length=128) + +email_subject_choice = [ +('Certificate not Awarded','Certificate not Awarded'), +('Change in Name','Change in Name'), +('Issue with Workshop Date','Issue with Workshop Date'), +('Invalid Email Address','Invalid Email Address'), +('Others','Others')] +ws_type_choice = [ +('iscp','Introduction to Scientific Computing using Python(ISCP)'), +('3day','Basic Programming using Python'), +('sel','Self Learning(Basics of Python)')] + +class ContactForm(forms.Form): + name = forms.CharField(label= 'Full Name',max_length=30) + email = forms.EmailField() + date = forms.DateField(label="Workshop Date",initial=datetime.date.today) + category = forms.CharField(widget=forms.Select(choices=ws_type_choice)) + subject = forms.CharField(widget=forms.Select(choices=email_subject_choice)) + message = forms.CharField(label='Message',widget=forms.Textarea) + \ No newline at end of file diff --git a/certificate/migrations/0001_initial.py b/certificate/migrations/0001_initial.py deleted file mode 100644 index b802da2..0000000 --- a/certificate/migrations/0001_initial.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -from django.conf import settings - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Certificate', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('email', models.CharField(max_length=50, null=True, blank=True)), - ('serial_no', models.CharField(max_length=50)), - ('counter', models.IntegerField()), - ], - options={ - }, - bases=(models.Model,), - ), - migrations.CreateModel( - name='Event', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('purpose', models.CharField(max_length=25, choices=[(b'SLC', b'Scilab Conference'), (b'SPC', b'Scipy Conference'), (b'PTC', b'Python Textbook Companion'), (b'STC', b'Scilab Textbook Companion')])), - ('start_date', models.DateTimeField()), - ('end_date', models.DateTimeField()), - ], - options={ - }, - bases=(models.Model,), - ), - migrations.CreateModel( - name='Profile', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('uin', models.CharField(max_length=50)), - ('attendance', models.NullBooleanField()), - ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)), - ], - options={ - }, - bases=(models.Model,), - ), - migrations.CreateModel( - name='Scilab_import', - fields=[ - ('id', models.IntegerField(serialize=False, primary_key=True)), - ('ticket_number', models.IntegerField(default=0)), - ('name', models.CharField(max_length=50, null=True, blank=True)), - ('email', models.CharField(max_length=50, null=True, blank=True)), - ('ticket', models.CharField(max_length=50, null=True, blank=True)), - ('date', models.CharField(max_length=50, null=True, blank=True)), - ('order_id', models.IntegerField(default=0, null=True, blank=True)), - ('purpose', models.CharField(default=b'SLC', max_length=10)), - ], - options={ - 'managed': True, - }, - bases=(models.Model,), - ), - ] diff --git a/certificate/migrations/0002_certificate_name.py b/certificate/migrations/0002_certificate_name.py deleted file mode 100644 index 99f6efc..0000000 --- a/certificate/migrations/0002_certificate_name.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('certificate', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='certificate', - name='name', - field=models.CharField(default='ABC', max_length=100), - preserve_default=False, - ), - ] diff --git a/certificate/models.py b/certificate/models.py index 13b1483..47ae47b 100755 --- a/certificate/models.py +++ b/certificate/models.py @@ -1,5 +1,6 @@ from django.db import models from django.contrib.auth.models import User +from datetime import datetime # Create your models here. events = ( @@ -16,6 +17,9 @@ ('OWS', 'Osdag Workshop'), ('EWS', 'eSim Workshop'), ('DRP', 'Drupal Workshop'), + ('OMW', 'OpenModelica Workshop'), + ('PWS', 'Python Workshop'), + ('S17', 'Scipy 2017 Conference') ) class Profile(models.Model): @@ -159,12 +163,22 @@ class Esim_faculty(models.Model): class Osdag_WS(models.Model): name = models.CharField(max_length=200) email = models.EmailField() + college = models.CharField(max_length=200, null=True, blank=True) + start_date = models.DateField(default='2016-01-01') + end_date = models.DateField(default='2016-01-01') purpose = models.CharField(max_length=10, default='OWS') class Drupal_WS(models.Model): name = models.CharField(max_length=200) email = models.EmailField() purpose = models.CharField(max_length=10, default='DRP') + status = models.BooleanField(default=False) + date = models.DateField(default='2016-01-01') + +class OpenModelica_WS(models.Model): + name = models.CharField(max_length=200) + email = models.EmailField() + purpose = models.CharField(max_length=10, default='OMW') class eSim_WS(models.Model): name = models.CharField(max_length=200) @@ -218,6 +232,28 @@ class OpenFOAM_Symposium_speaker_2016(models.Model): paper = models.CharField(max_length=300) purpose = models.CharField(max_length=10, default='OFC') +class Python_Workshop(models.Model): + name = models.CharField(max_length=300) + email = models.CharField(max_length=300) + paper = models.CharField(max_length=300) #grades + purpose = models.CharField(max_length=10, default='PWS') + college = models.CharField(max_length = 200) + ws_date = models.CharField(max_length = 100, null=True, blank=True) + is_coordinator = models.BooleanField(default=False) + + +class Python_Workshop_BPPy(models.Model): + """ + 3day python workshop user details + """ + name = models.CharField(max_length=300) + email = models.CharField(max_length=300) + paper = models.CharField(max_length=300) #grades + purpose = models.CharField(max_length=10, default='PWS') + college = models.CharField(max_length = 200) + ws_date = models.CharField(max_length = 100, null=True, blank=True) + is_coordinator = models.BooleanField(default=False) + class Internship_participant(models.Model): name = models.CharField(max_length=200) @@ -239,3 +275,18 @@ class Internship16_participant(models.Model): project_title = models.CharField(max_length=1000) internship_project_duration = models.CharField(max_length=500, null=True, blank=True) purpose = models.CharField(max_length=10, default='F16') + + +attendee_types = ( + ('P','Participants'), + ('A','Speaker'), + ('W','Workshop'), + ('T','Organizers') + ) + +class Scipy_2017(models.Model): + name = models.CharField(max_length=300) + email = models.CharField(max_length=300) + paper = models.CharField(max_length=300) + purpose = models.CharField(max_length=10, default='S17') + attendee_type = models.CharField(max_length=25, choices=attendee_types) \ No newline at end of file diff --git a/certificate/openmodelica_workshop_template/Makefile b/certificate/openmodelica_workshop_template/Makefile new file mode 100755 index 0000000..2216589 --- /dev/null +++ b/certificate/openmodelica_workshop_template/Makefile @@ -0,0 +1,36 @@ +# 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 + +# following line is because on server texlive is not installed system-wide +export PATH := /usr/local/texlive/2015/bin/x86_64-linux:$(PATH) +# default help +help: + @echo "current make version is: "$(MAKE_VERSION) + @echo "Please use \`make ' where is one of" + @echo "" + @echo "participant_cert file_name=xyz Generate certificate." + @echo "clean clean all tmp and pdf files." + @echo "help Show this help." + @echo "" + +name = $(file_name) + +# certificate +participant_cert: $(name).tex bashful.sty + pdflatex -shell-escape $(name).tex + +paper_cert: $(name).tex bashful.sty + pdflatex -shell-escape $(name).tex + +clean: + @echo "removing all tmp+pdf files" + -rm -rvf $(name)*.pdf *~ $(name).aux $(name).log $(name).tex *.vrb *.out *.toc *.nav *.snm + -rm -rvf *.std* *.sh diff --git a/certificate/openmodelica_workshop_template/bashful.sty b/certificate/openmodelica_workshop_template/bashful.sty new file mode 100755 index 0000000..21b6f43 --- /dev/null +++ b/certificate/openmodelica_workshop_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/openmodelica_workshop_template/bottom_line.png b/certificate/openmodelica_workshop_template/bottom_line.png new file mode 100644 index 0000000..688bb72 Binary files /dev/null and b/certificate/openmodelica_workshop_template/bottom_line.png differ diff --git a/certificate/openmodelica_workshop_template/kannan-moudgalya-sign.png b/certificate/openmodelica_workshop_template/kannan-moudgalya-sign.png new file mode 100755 index 0000000..6feda2d Binary files /dev/null and b/certificate/openmodelica_workshop_template/kannan-moudgalya-sign.png differ diff --git a/certificate/migrations/__init__.py b/certificate/openmodelica_workshop_template/missfont.log old mode 100644 new mode 100755 similarity index 100% rename from certificate/migrations/__init__.py rename to certificate/openmodelica_workshop_template/missfont.log diff --git a/certificate/openmodelica_workshop_template/niceframe.sty b/certificate/openmodelica_workshop_template/niceframe.sty new file mode 100755 index 0000000..20afd01 --- /dev/null +++ b/certificate/openmodelica_workshop_template/niceframe.sty @@ -0,0 +1,140 @@ +%% +%% This is file `niceframe.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% niceframe.dtx (with options: `package') +%% +%% This file 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. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, 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 Marcus Ohlhaut. +%% +%% This work consists of the files niceframe.dtx and niceframe.ins +%% and the derived file niceframe.sty. +%% +%% Copyright (C) 2009 Marcus Ohlhaut (marcus@ohlhaut.de). +%% All rights reserved. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\def\fileversion{1.1c} +\def\filedate{2009/31/08} +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{niceframe}[\filedate\space v\fileversion\space niceframe package (MO)] +\typeout{Package: niceframe v\fileversion\space <\filedate> (Marcus Ohlhaut)} +\RequirePackage{calc} +\font\ding dingbat scaled 1200 +\newlength{\nicefr@mechar} +\settowidth{\nicefr@mechar}{\ding\char'141} +\newlength{\nicefr@mewidth} +\setlength{\nicefr@mewidth}{\hsize} +\newlength{\nicefr@meheight} +\setlength{\nicefr@meheight}{\vsize} +\newlength{\@ldhsize} +\setlength{\@ldhsize}{\hsize} +\newcommand{\upd@ublerulefill}{\xleaders\hbox to 10pt + {\hss\ding\char'142 \hss}\hfill} +\newcommand{\dnd@ublerulefill}{\xleaders\hbox to 10pt + {\hss\ding\char'147 \hss}\hfill} +\newcommand{\ltd@ublerulefill}{\xleaders\vbox to 10pt + {\vss\hbox{\ding\char'144}\vss}\vfill} +\newcommand{\rtd@ublerulefill}{\xleaders\vbox to 10pt + {\vss\hbox{\ding\char'145}\vss}\vfill} +\newcommand{\niceframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'141\upd@ublerulefill\char'143} + \hbox to\nicefr@mewidth{\vbox to\nicefr@meheight{\ltd@ublerulefill} + \hss\raise\dp0\box0\hss + \vbox to\nicefr@meheight{\rtd@ublerulefill}} + \hbox to\nicefr@mewidth{\ding\char'146\dnd@ublerulefill\char'150} + } +}} +\newcommand{\curlyframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'105\hfill\char'106} + \vskip-\baselineskip + \hbox to\nicefr@mewidth{\hss\raise\dp0\box0\hss} + \vskip-\baselineskip + \hbox to\nicefr@mewidth{\ding\char'110\hfill\char'107} + } +}} +\newcommand{\artdecoframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'115\hfill\char'114} + \hbox to\nicefr@mewidth{\hss\raise\dp0\box0\hss} + \hbox to\nicefr@mewidth{\ding\char'112\hfill\char'113} + } +}} +\newcounter{times} +\newlength{\fr@mecharTT} +\newlength{\fr@mecharLL} +\newlength{\fr@mewidth} +\newlength{\fr@meheight} +\newcommand{\generalframe}[9]{{ + \settowidth{\fr@mecharTT}{#2} + \settoheight{\fr@mecharLL}{#4} + \setcounter{times}{1 * \ratio{\hsize}{\fr@mecharTT}} + \setlength{\fr@mewidth}{\fr@mecharTT * \value{times}} + \setlength{\hsize}{\fr@mewidth - 2\fr@mecharTT - 2\fboxsep} + \setbox0=\vbox{#9} + \setlength{\fr@meheight}{\ht0 + \dp0 + 2\fboxsep} + \setcounter{times}{1 * \ratio{\fr@meheight}{\fr@mecharLL}} + \setcounter{times}{\value{times} + 1} + \setlength{\fr@meheight}{\fr@mecharLL * \value{times}} + \newcommand{\up@fill}{\leaders\hbox{#2}\hfill} + \newcommand{\lt@fill}{\leaders\vbox{\hbox{#4}}\vfill} + \newcommand{\rt@fill}{\leaders\vbox{\hbox{#5}}\vfill} + \newcommand{\dn@fill}{\leaders\hbox{#7}\hfill} + \vbox{% + \hbox to\fr@mewidth{#1\up@fill#3}\nointerlineskip + \hbox to\fr@mewidth{\vbox to\fr@meheight{\lt@fill}% + \hfill% + \vbox to\fr@meheight{\vfill\box0\vfill}% + \hfill% + \vbox to\fr@meheight{\rt@fill}% + }\nointerlineskip + \hbox to\fr@mewidth{#6\dn@fill#8}\nointerlineskip + } +}} +\endinput +%% +%% End of file `niceframe.sty'. diff --git a/certificate/openmodelica_workshop_template/template_OMW2017Pcertificate b/certificate/openmodelica_workshop_template/template_OMW2017Pcertificate new file mode 100644 index 0000000..c040b96 --- /dev/null +++ b/certificate/openmodelica_workshop_template/template_OMW2017Pcertificate @@ -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/openmodelica_workshop_template/wallpaper.sty b/certificate/openmodelica_workshop_template/wallpaper.sty new file mode 100755 index 0000000..c64e8c6 --- /dev/null +++ b/certificate/openmodelica_workshop_template/wallpaper.sty @@ -0,0 +1,250 @@ +%% +%% This is file `wallpaper.sty' v 1.10 +%% +%% Author Michael H.F. Wilkinson +%% April 21, 2006 +%% +%% Create background, either centered, tiled, or in any corner +%% relies heavily on eso-pic.sty, corrects for changes in \hoffset +%% by classes such as sciposter.cls +%% Problems, bugs and comments to +%% michael@cs.rug.nl +%% version 1.10, 2006/04/21: +%% - Commands added for corner wallpapers +%% +%% version 1.01, 2005/01/18: +%% - \providecommand{\LenToUnit} included to be compatible +%% with earlier versions of eso-pic.sty +%% +%% version 1.00, 2004/12/22: +%% - first release +%% +%% +\ProvidesPackage{wallpaper}[2005/01/18, v1.01 easy wallpaper formatting (MHFW)] +\NeedsTeXFormat{LaTeX2e}[1995/06/01] + +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{eso-pic} +\RequirePackage{graphicx} + +\providecommand{\LenToUnit}[1]{#1\@gobble} + + +\newlength{\wpXoffset} +\setlength{\wpXoffset}{-\hoffset} +\newlength{\wpYoffset} +\setlength{\wpYoffset}{0pt} +\newlength{\tileXoffset} +\newlength{\tileYoffset} +\newlength{\tilewidth} +\newlength{\tileheight} +\newlength{\tileX} +\newlength{\tileY} + +\newcommand{\LLCornerWallPaper}[2]{% +\AddToShipoutPicture{% + \AtPageLowerLeft{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } +} + +\newcommand{\ThisLLCornerWallPaper}[2]{% +\AddToShipoutPicture*{% + \AtPageLowerLeft{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } +} + +\newcommand{\ULCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{#1\paperwidth}{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\ThisULCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{#1\paperwidth}{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\LRCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } + } +} + +\newcommand{\ThisLRCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } + } +} + +\newcommand{\URCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} +\newcommand{\ThisURCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\CenterWallPaper}[2]{% +\AddToShipoutPicture{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% + \parbox[b][\paperheight]{\paperwidth}{% + \vfill + \centering + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill + }} + } +} + +\newcommand{\ThisCenterWallPaper}[2]{% +\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% + \parbox[b][\paperheight]{\paperwidth}{% + \vfill + \centering + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill + }}} +} + + + +\newcommand{\TileSquareWallPaper}[2]{% +\AddToShipoutPicture{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{\paperwidth/#1}% + \setlength{\tileheight}{\tilewidth}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#2}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ThisTileSquareWallPaper}[2]{% +\AddToShipoutPicture*{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{\paperwidth/#1}% + \setlength{\tileheight}{\tilewidth}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#2}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + + +\newcommand{\TileWallPaper}[3]{% +\AddToShipoutPicture{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{#1}% + \setlength{\tileheight}{#2}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#3}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ThisTileWallPaper}[3]{% +\AddToShipoutPicture*{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{#1}% + \setlength{\tileheight}{#2}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#3}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ClearWallPaper}{\ClearShipoutPicture} \ No newline at end of file diff --git a/certificate/python_workshop_template/Makefile b/certificate/python_workshop_template/Makefile new file mode 100755 index 0000000..2216589 --- /dev/null +++ b/certificate/python_workshop_template/Makefile @@ -0,0 +1,36 @@ +# 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 + +# following line is because on server texlive is not installed system-wide +export PATH := /usr/local/texlive/2015/bin/x86_64-linux:$(PATH) +# default help +help: + @echo "current make version is: "$(MAKE_VERSION) + @echo "Please use \`make ' where is one of" + @echo "" + @echo "participant_cert file_name=xyz Generate certificate." + @echo "clean clean all tmp and pdf files." + @echo "help Show this help." + @echo "" + +name = $(file_name) + +# certificate +participant_cert: $(name).tex bashful.sty + pdflatex -shell-escape $(name).tex + +paper_cert: $(name).tex bashful.sty + pdflatex -shell-escape $(name).tex + +clean: + @echo "removing all tmp+pdf files" + -rm -rvf $(name)*.pdf *~ $(name).aux $(name).log $(name).tex *.vrb *.out *.toc *.nav *.snm + -rm -rvf *.std* *.sh diff --git a/certificate/python_workshop_template/bashful.sty b/certificate/python_workshop_template/bashful.sty new file mode 100755 index 0000000..21b6f43 --- /dev/null +++ b/certificate/python_workshop_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/python_workshop_template/bottom_line.png b/certificate/python_workshop_template/bottom_line.png new file mode 100644 index 0000000..688bb72 Binary files /dev/null and b/certificate/python_workshop_template/bottom_line.png differ diff --git a/certificate/python_workshop_template/coordinator_template_PWS2017Pcertificate b/certificate/python_workshop_template/coordinator_template_PWS2017Pcertificate new file mode 100644 index 0000000..8d47ae5 --- /dev/null +++ b/certificate/python_workshop_template/coordinator_template_PWS2017Pcertificate @@ -0,0 +1,22 @@ + +* 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]] \ No newline at end of file diff --git a/certificate/python_workshop_template/kannan-moudgalya-sign.png b/certificate/python_workshop_template/kannan-moudgalya-sign.png new file mode 100755 index 0000000..6feda2d Binary files /dev/null and b/certificate/python_workshop_template/kannan-moudgalya-sign.png differ diff --git a/certificate/python_workshop_template/missfont.log b/certificate/python_workshop_template/missfont.log new file mode 100755 index 0000000..e69de29 diff --git a/certificate/python_workshop_template/niceframe.sty b/certificate/python_workshop_template/niceframe.sty new file mode 100755 index 0000000..20afd01 --- /dev/null +++ b/certificate/python_workshop_template/niceframe.sty @@ -0,0 +1,140 @@ +%% +%% This is file `niceframe.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% niceframe.dtx (with options: `package') +%% +%% This file 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. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, 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 Marcus Ohlhaut. +%% +%% This work consists of the files niceframe.dtx and niceframe.ins +%% and the derived file niceframe.sty. +%% +%% Copyright (C) 2009 Marcus Ohlhaut (marcus@ohlhaut.de). +%% All rights reserved. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\def\fileversion{1.1c} +\def\filedate{2009/31/08} +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{niceframe}[\filedate\space v\fileversion\space niceframe package (MO)] +\typeout{Package: niceframe v\fileversion\space <\filedate> (Marcus Ohlhaut)} +\RequirePackage{calc} +\font\ding dingbat scaled 1200 +\newlength{\nicefr@mechar} +\settowidth{\nicefr@mechar}{\ding\char'141} +\newlength{\nicefr@mewidth} +\setlength{\nicefr@mewidth}{\hsize} +\newlength{\nicefr@meheight} +\setlength{\nicefr@meheight}{\vsize} +\newlength{\@ldhsize} +\setlength{\@ldhsize}{\hsize} +\newcommand{\upd@ublerulefill}{\xleaders\hbox to 10pt + {\hss\ding\char'142 \hss}\hfill} +\newcommand{\dnd@ublerulefill}{\xleaders\hbox to 10pt + {\hss\ding\char'147 \hss}\hfill} +\newcommand{\ltd@ublerulefill}{\xleaders\vbox to 10pt + {\vss\hbox{\ding\char'144}\vss}\vfill} +\newcommand{\rtd@ublerulefill}{\xleaders\vbox to 10pt + {\vss\hbox{\ding\char'145}\vss}\vfill} +\newcommand{\niceframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'141\upd@ublerulefill\char'143} + \hbox to\nicefr@mewidth{\vbox to\nicefr@meheight{\ltd@ublerulefill} + \hss\raise\dp0\box0\hss + \vbox to\nicefr@meheight{\rtd@ublerulefill}} + \hbox to\nicefr@mewidth{\ding\char'146\dnd@ublerulefill\char'150} + } +}} +\newcommand{\curlyframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'105\hfill\char'106} + \vskip-\baselineskip + \hbox to\nicefr@mewidth{\hss\raise\dp0\box0\hss} + \vskip-\baselineskip + \hbox to\nicefr@mewidth{\ding\char'110\hfill\char'107} + } +}} +\newcommand{\artdecoframe}[2][\textwidth]{{ + \setlength{\hsize}{#1 - 2\nicefr@mechar} + \setbox0=\vbox{#2} + \setlength{\nicefr@meheight}{\ht0 + \dp0} + \setlength{\nicefr@mewidth}{\wd0 + 2\nicefr@mechar} + \vbox{% + \hbox to\nicefr@mewidth{\ding\char'115\hfill\char'114} + \hbox to\nicefr@mewidth{\hss\raise\dp0\box0\hss} + \hbox to\nicefr@mewidth{\ding\char'112\hfill\char'113} + } +}} +\newcounter{times} +\newlength{\fr@mecharTT} +\newlength{\fr@mecharLL} +\newlength{\fr@mewidth} +\newlength{\fr@meheight} +\newcommand{\generalframe}[9]{{ + \settowidth{\fr@mecharTT}{#2} + \settoheight{\fr@mecharLL}{#4} + \setcounter{times}{1 * \ratio{\hsize}{\fr@mecharTT}} + \setlength{\fr@mewidth}{\fr@mecharTT * \value{times}} + \setlength{\hsize}{\fr@mewidth - 2\fr@mecharTT - 2\fboxsep} + \setbox0=\vbox{#9} + \setlength{\fr@meheight}{\ht0 + \dp0 + 2\fboxsep} + \setcounter{times}{1 * \ratio{\fr@meheight}{\fr@mecharLL}} + \setcounter{times}{\value{times} + 1} + \setlength{\fr@meheight}{\fr@mecharLL * \value{times}} + \newcommand{\up@fill}{\leaders\hbox{#2}\hfill} + \newcommand{\lt@fill}{\leaders\vbox{\hbox{#4}}\vfill} + \newcommand{\rt@fill}{\leaders\vbox{\hbox{#5}}\vfill} + \newcommand{\dn@fill}{\leaders\hbox{#7}\hfill} + \vbox{% + \hbox to\fr@mewidth{#1\up@fill#3}\nointerlineskip + \hbox to\fr@mewidth{\vbox to\fr@meheight{\lt@fill}% + \hfill% + \vbox to\fr@meheight{\vfill\box0\vfill}% + \hfill% + \vbox to\fr@meheight{\rt@fill}% + }\nointerlineskip + \hbox to\fr@mewidth{#6\dn@fill#8}\nointerlineskip + } +}} +\endinput +%% +%% End of file `niceframe.sty'. diff --git a/certificate/python_workshop_template/wallpaper.sty b/certificate/python_workshop_template/wallpaper.sty new file mode 100755 index 0000000..c64e8c6 --- /dev/null +++ b/certificate/python_workshop_template/wallpaper.sty @@ -0,0 +1,250 @@ +%% +%% This is file `wallpaper.sty' v 1.10 +%% +%% Author Michael H.F. Wilkinson +%% April 21, 2006 +%% +%% Create background, either centered, tiled, or in any corner +%% relies heavily on eso-pic.sty, corrects for changes in \hoffset +%% by classes such as sciposter.cls +%% Problems, bugs and comments to +%% michael@cs.rug.nl +%% version 1.10, 2006/04/21: +%% - Commands added for corner wallpapers +%% +%% version 1.01, 2005/01/18: +%% - \providecommand{\LenToUnit} included to be compatible +%% with earlier versions of eso-pic.sty +%% +%% version 1.00, 2004/12/22: +%% - first release +%% +%% +\ProvidesPackage{wallpaper}[2005/01/18, v1.01 easy wallpaper formatting (MHFW)] +\NeedsTeXFormat{LaTeX2e}[1995/06/01] + +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{eso-pic} +\RequirePackage{graphicx} + +\providecommand{\LenToUnit}[1]{#1\@gobble} + + +\newlength{\wpXoffset} +\setlength{\wpXoffset}{-\hoffset} +\newlength{\wpYoffset} +\setlength{\wpYoffset}{0pt} +\newlength{\tileXoffset} +\newlength{\tileYoffset} +\newlength{\tilewidth} +\newlength{\tileheight} +\newlength{\tileX} +\newlength{\tileY} + +\newcommand{\LLCornerWallPaper}[2]{% +\AddToShipoutPicture{% + \AtPageLowerLeft{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } +} + +\newcommand{\ThisLLCornerWallPaper}[2]{% +\AddToShipoutPicture*{% + \AtPageLowerLeft{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } +} + +\newcommand{\ULCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{#1\paperwidth}{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\ThisULCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{#1\paperwidth}{% + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\LRCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } + } +} + +\newcommand{\ThisLRCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + } + } + } +} + +\newcommand{\URCornerWallPaper}[2]{% + \AddToShipoutPicture{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} +\newcommand{\ThisURCornerWallPaper}[2]{% + \AddToShipoutPicture*{% + \AtPageLowerLeft{% + \parbox[b][\paperheight]{\paperwidth}{% + \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill% + } + } + } +} + +\newcommand{\CenterWallPaper}[2]{% +\AddToShipoutPicture{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% + \parbox[b][\paperheight]{\paperwidth}{% + \vfill + \centering + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill + }} + } +} + +\newcommand{\ThisCenterWallPaper}[2]{% +\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% + \parbox[b][\paperheight]{\paperwidth}{% + \vfill + \centering + \includegraphics[width=#1\paperwidth,height=#1\paperheight,% + keepaspectratio]{#2}% + \vfill + }}} +} + + + +\newcommand{\TileSquareWallPaper}[2]{% +\AddToShipoutPicture{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{\paperwidth/#1}% + \setlength{\tileheight}{\tilewidth}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#2}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ThisTileSquareWallPaper}[2]{% +\AddToShipoutPicture*{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{\paperwidth/#1}% + \setlength{\tileheight}{\tilewidth}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#2}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + + +\newcommand{\TileWallPaper}[3]{% +\AddToShipoutPicture{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{#1}% + \setlength{\tileheight}{#2}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#3}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ThisTileWallPaper}[3]{% +\AddToShipoutPicture*{% + \begingroup + \setlength{\tileYoffset}{\wpYoffset} + \setlength{\tilewidth}{#1}% + \setlength{\tileheight}{#2}% + \setlength{\tileY}{0pt}% + \whiledo{\lengthtest{\tileY < \paperheight}}{% + \setlength{\tileX}{0pt}% + \setlength{\tileXoffset}{\wpXoffset}% + \whiledo{\lengthtest{\tileX < \paperwidth}}{% + \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){% + \includegraphics[height=\tileheight,width=\tilewidth]{#3}}% + \addtolength{\tileX}{\tilewidth} + \addtolength{\tileXoffset}{\tilewidth} + }% + \addtolength{\tileY}{\tileheight} + \addtolength{\tileYoffset}{\tileheight} + }% + \endgroup +}% +} + +\newcommand{\ClearWallPaper}{\ClearShipoutPicture} \ No newline at end of file diff --git a/certificate/scipy_template_2016/cert_bg_1.png b/certificate/scipy_template_2016/cert_bg_1.png new file mode 100644 index 0000000..fae8300 Binary files /dev/null and b/certificate/scipy_template_2016/cert_bg_1.png differ diff --git a/certificate/scipy_template_2016/template_SPC2016Acertificate b/certificate/scipy_template_2016/template_SPC2016Acertificate index 3371830..689fd18 100644 --- a/certificate/scipy_template_2016/template_SPC2016Acertificate +++ b/certificate/scipy_template_2016/template_SPC2016Acertificate @@ -1,21 +1,71 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** 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. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cert_bg_1.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Presentation}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ +{\scriptsize {\color{black} Participated in SciPy India Conference 2016\\ +as a teaching assistant in the Satellite Centre : {\textcolor{blue}{$paper.}} \\ +The event was organized by FOSSEE at Indian Institute of Technology Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{1}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{pr_sign.png}} & \small{} & \small{} & \hspace{2cm} &\small{\begin{pspicture}(0.3cm,0.3cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}} \\ + \small{} & \small{} & \small{} & \small{} & \tiny{\color{black}\texttt{$serial_key}} + \end{tabular} + +}} +\\ + +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ + + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2016/template_SPC2016Pcertificate b/certificate/scipy_template_2016/template_SPC2016Pcertificate old mode 100644 new mode 100755 index 3371830..221932b --- a/certificate/scipy_template_2016/template_SPC2016Pcertificate +++ b/certificate/scipy_template_2016/template_SPC2016Pcertificate @@ -1,21 +1,71 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** 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. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cert_bg_1.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Participation}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ + +{\scriptsize {\color{black} Participated in SciPy India Conference 2016\\ +organized by FOSSEE at Indian Institute of Technology Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{1}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{pr_sign.png}} & \small{} & \small{} & \hspace{2cm} &\small{\begin{pspicture}(0.3cm,0.3cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}} \\ + \small{} & \small{} & \small{} & \small{} & \tiny{\color{black}\texttt{$serial_key}} + \end{tabular} + +}} +\\ + +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ + + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2016/template_SPC2016Tcertificate b/certificate/scipy_template_2016/template_SPC2016Tcertificate index 3371830..c25de66 100644 --- a/certificate/scipy_template_2016/template_SPC2016Tcertificate +++ b/certificate/scipy_template_2016/template_SPC2016Tcertificate @@ -1,21 +1,71 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** 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. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cert_bg_1.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Teaching Assistantship}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ +{\scriptsize {\color{black} Participated in SciPy India Conference 2016\\ +as a teaching assistant in the Satellite Centre : {\textcolor{blue}{$paper.}} \\ +The event was organized by FOSSEE at Indian Institute of Technology Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{1}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{pr_sign.png}} & \small{} & \small{} & \hspace{2cm} &\small{\begin{pspicture}(0.3cm,0.3cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}} \\ + \small{} & \small{} & \small{} & \small{} & \tiny{\color{black}\texttt{$serial_key}} + \end{tabular} + +}} +\\ + +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ + + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2016/template_SPC2016Wcertificate b/certificate/scipy_template_2016/template_SPC2016Wcertificate index 3371830..4de8aaf 100644 --- a/certificate/scipy_template_2016/template_SPC2016Wcertificate +++ b/certificate/scipy_template_2016/template_SPC2016Wcertificate @@ -1,21 +1,71 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** 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. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cert_bg_1.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Assistantship}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ +{\scriptsize {\color{black} Participated in SciPy India Conference 2016\\ +as a teaching assistant in the Satellite Centre : {\textcolor{blue}{$paper.}} \\ +The event was organized by FOSSEE at Indian Institute of Technology, Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{1}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} & \small{} & \small{} & \hspace{2cm} &\small{\begin{pspicture}(0.3cm,0.3cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}} \\ + \small{} & \small{} & \small{} & \small{} & \tiny{\color{black}\texttt{$serial_key}} + \end{tabular} + +}} +\\ + +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ + + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2017/Makefile b/certificate/scipy_template_2017/Makefile new file mode 100644 index 0000000..2c97e56 --- /dev/null +++ b/certificate/scipy_template_2017/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 + +# following line is because on server texlive is not installed system-wide +#export PATH := /usr/local/texlive/2014/bin/x86_64-linux:$(PATH) + +# default help +help: + @echo "current make version is: "$(MAKE_VERSION) + @echo "Please use \`make ' where is one of" + @echo "" + @echo "participant_cert file_name=xyz Generate certificate." + @echo "clean clean all tmp and pdf files." + @echo "help Show this help." + @echo "" + +name = $(file_name) + +# certificate +participant_cert: $(name).tex fossee-logo.png bashful.sty + pdflatex -shell-escape $(name).tex + +paper_cert: $(name).tex fossee-logo.png bashful.sty + pdflatex -shell-escape $(name).tex + +workshop_cert: $(name).tex fossee-logo.png bashful.sty + pdflatex -shell-escape $(name).tex + + +clean: + @echo "removing all tmp+pdf files" + -rm -rvf $(name)*.pdf *~ $(name).aux $(name).log $(name).tex *.vrb *.out *.toc *.nav *.snm + -rm -rvf *.std* *.sh diff --git a/certificate/scipy_template_2017/bashful.sty b/certificate/scipy_template_2017/bashful.sty new file mode 100755 index 0000000..21b6f43 --- /dev/null +++ b/certificate/scipy_template_2017/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/scipy_template_2017/cert_bg_3.png b/certificate/scipy_template_2017/cert_bg_3.png new file mode 100644 index 0000000..f6c221d Binary files /dev/null and b/certificate/scipy_template_2017/cert_bg_3.png differ diff --git a/certificate/scipy_template_2017/fossee-logo.png b/certificate/scipy_template_2017/fossee-logo.png new file mode 100755 index 0000000..0f57874 Binary files /dev/null and b/certificate/scipy_template_2017/fossee-logo.png differ diff --git a/certificate/scipy_template_2017/pr_sign.png b/certificate/scipy_template_2017/pr_sign.png new file mode 100755 index 0000000..0f57874 Binary files /dev/null and b/certificate/scipy_template_2017/pr_sign.png differ diff --git a/certificate/scipy_template_2017/template_SPC2017Acertificate b/certificate/scipy_template_2017/template_SPC2017Acertificate new file mode 100644 index 0000000..51d7d5c --- /dev/null +++ b/certificate/scipy_template_2017/template_SPC2017Acertificate @@ -0,0 +1 @@ +Please put your latex code here diff --git a/certificate/scipy_template_2017/template_SPC2017Pcertificate b/certificate/scipy_template_2017/template_SPC2017Pcertificate new file mode 100755 index 0000000..51d7d5c --- /dev/null +++ b/certificate/scipy_template_2017/template_SPC2017Pcertificate @@ -0,0 +1 @@ +Please put your latex code here diff --git a/certificate/scipy_template_2017/template_SPC2017Tcertificate b/certificate/scipy_template_2017/template_SPC2017Tcertificate new file mode 100644 index 0000000..51d7d5c --- /dev/null +++ b/certificate/scipy_template_2017/template_SPC2017Tcertificate @@ -0,0 +1 @@ +Please put your latex code here diff --git a/certificate/scipy_template_2017/template_SPC2017Wcertificate b/certificate/scipy_template_2017/template_SPC2017Wcertificate new file mode 100644 index 0000000..51d7d5c --- /dev/null +++ b/certificate/scipy_template_2017/template_SPC2017Wcertificate @@ -0,0 +1 @@ +Please put your latex code here diff --git a/certificate/sending_emails.py b/certificate/sending_emails.py new file mode 100644 index 0000000..017b3ba --- /dev/null +++ b/certificate/sending_emails.py @@ -0,0 +1,31 @@ +import smtplib +from email.mime.text import MIMEText +from django.conf import settings + + +TO = 'certificates@fossee.in' +EMAIL_HOST = settings.EMAIL_HOST +EMAIL_PORT = settings.EMAIL_PORT +AUTH = 'LOGIN DIGEST-MD5 PLAIN' +EMAIL_HOST_USER = settings.EMAIL_HOST_USER +EMAIL_HOST_PASSWORD = settings.EMAIL_HOST_PASSWORD + + +def send_email(subject="Dummy", FROM_EMAIL="certificates@fossee.in", + MESSAGE="Testing"): + smtpserver = smtplib.SMTP(EMAIL_HOST, EMAIL_PORT) + smtpserver.ehlo() + smtpserver.starttls() + smtpserver.ehlo() + smtpserver.esmtp_features['auth'] = AUTH + smtpserver.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD) + msg = MIMEText(MESSAGE) + msg['Subject'] = subject + msg['From'] = FROM_EMAIL + msg['To'] = TO + try: + smtpserver.sendmail(EMAIL_HOST_USER, TO, msg.as_string()) + smtpserver.close() + return True + except Exception as e: + return False diff --git a/certificate/static/css/contact.css b/certificate/static/css/contact.css new file mode 100644 index 0000000..7eb47f4 --- /dev/null +++ b/certificate/static/css/contact.css @@ -0,0 +1,31 @@ +body {font-family: Arial, Helvetica, sans-serif;} + +input[type=text],input[type=email],input[type=date],select, textarea { + width: 100%; + padding: 12px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; + margin-top: 6px; + margin-bottom: 16px; + resize: vertical; +} + +input[type=submit] { + background-color: #4CAF50; + color: white; + padding: 12px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} + +input[type=submit]:hover { + background-color: #45a049; +} + +.container { + border-radius: 5px; + background-color: #f2f2f2; + padding: 20px; +} diff --git a/certificate/static/img/fb.png b/certificate/static/img/fb.png new file mode 100644 index 0000000..20a4be7 Binary files /dev/null and b/certificate/static/img/fb.png differ diff --git a/certificate/static/img/tw.png b/certificate/static/img/tw.png new file mode 100644 index 0000000..41a543c Binary files /dev/null and b/certificate/static/img/tw.png differ diff --git a/certificate/static/img/yt.png b/certificate/static/img/yt.png new file mode 100644 index 0000000..276317c Binary files /dev/null and b/certificate/static/img/yt.png differ diff --git a/certificate/templates/base.html b/certificate/templates/base.html index 9d4284d..975cfd4 100644 --- a/certificate/templates/base.html +++ b/certificate/templates/base.html @@ -1,4 +1,6 @@ + + {% block title %} diff --git a/certificate/templates/contact_us.html b/certificate/templates/contact_us.html new file mode 100644 index 0000000..c130be1 --- /dev/null +++ b/certificate/templates/contact_us.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> +{% load staticfiles %} +<meta name="viewport" content="width=device-width, initial-scale=1"> +<link rel="stylesheet" href="{% static 'css/contact.css' %}"> +<script src='https://www.google.com/recaptcha/api.js'></script> +</head> +<body> + +<h3 align="center">Contact FOSSEE</h3> + +<div class="container"> + <form action="./contact" method="POST"> + {{form}} + +<div class="g-recaptcha" data-sitekey="6LcDdk0UAAAAABBY5xQkDvwvbRrwVxGSxh09R9uf"></div> + <input type="submit" value="Submit"> + </form> +</div> + +</body> +</html> + diff --git a/certificate/templates/drupal_download.html b/certificate/templates/drupal_download.html index 8b3baac..8950404 100644 --- a/certificate/templates/drupal_download.html +++ b/certificate/templates/drupal_download.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block header%} - <h1> Drupal Camp Mumbai 2015 </h1> + <h1> Drupal Camp Mumbai</h1> {% endblock %} {% block content %} <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> diff --git a/certificate/templates/drupal_workshop_download.html b/certificate/templates/drupal_workshop_download.html index b35f70e..3081562 100644 --- a/certificate/templates/drupal_workshop_download.html +++ b/certificate/templates/drupal_workshop_download.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block header%} - <h1> Drupal Workshop 2016</h1> + <h1> Drupal Workshop</h1> {% endblock %} {% block content %} <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> diff --git a/certificate/templates/fossee_internship16_cerificate_download.html b/certificate/templates/fossee_internship16_cerificate_download.html index 4928c2e..20a315b 100644 --- a/certificate/templates/fossee_internship16_cerificate_download.html +++ b/certificate/templates/fossee_internship16_cerificate_download.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block header%} - <h1> FOSSEE Internship Certificate</h1> + <h1> FOSSEE FELLOWSHIP Certificate</h1> {% endblock %} {% block content %} <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> @@ -16,7 +16,7 @@ <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> </div> </div> </div> - <form class="col-lg-12" action="{% url 'certificate:fossee_internship16_cerificate_download' %}" method="post"> + <form class="col-lg-12" action="{% url 'certificate:fossee_internship_cerificate_download' %}" method="post"> {% csrf_token %} {{ message }} <hr> diff --git a/certificate/templates/index.html b/certificate/templates/index.html index b2b8062..e4d111c 100755 --- a/certificate/templates/index.html +++ b/certificate/templates/index.html @@ -4,26 +4,65 @@ <h1> FOSSEE Certificates </h1> {% endblock %} {% block content %} -<div style="margin:auto; width:45%"> - <p>Below links will take you to a feedback form.<br> Please fill the feedback form and download your <b>e-certificate</b>.</h5></p> +<div style="margin:auto;"> + <p>Below links will take you to a feedback form.<br> Please fill the feedback form and download your <b>e-certificate</b>.</h5> + <div> + </p> <ul class="nav nav-list"> + <li><a href="{% url 'certificate:python_workshop_download' %}" >Python Workshop</a></li> + <li><a href="{% url 'certificate:openmodelica_feedback_2017' %}" >OpenModelica Workshop 2017</a></li> <li><a href="{% url 'certificate:scipy_feedback_2016' %}" >SciPy India Conference 2016</a></li> - <li><a href="{% url 'certificate:drupal_workshop_download' %}" >Drupal Workshop 2016</a></li> + <li><a href="{% url 'certificate:drupal_workshop_download' %}" >Drupal Workshop</a></li> <li><a href="{% url 'certificate:esim_workshop_feedback' %}" >eSim Workshop 2016</a></li> - <li><a href="{% url 'certificate:osdag_workshop_feedback' %}" >Osdag Workshop 2016</a></li> + <li><a href="{% url 'certificate:osdag_workshop_download' %}" >Osdag Workshop</a></li> <li><a href="{% url 'certificate:openfoam_symposium_feedback_2016' %}" >OpenFOAM Symposium 2016</a></li> - <li><a href="{% url 'certificate:fossee_internship16_cerificate_download' %}" >Internship Certificate 2016</a></li> - <li><a href="{% url 'certificate:fossee_internship_cerificate_download' %}" >Internship Certificate 2015</a></li> + <li><a href="{% url 'certificate:fossee_internship_cerificate_download' %}" >FOSSEE FELLOWSHIP Certificate</a></li> <li><a href="{% url 'certificate:scipy_feedback_2015' %}" >SciPy India Conference 2015</a></li> <li><a href="{% url 'certificate:esim_google_feedback' %}" >eSim Faculty Meet 2015</a></li> <li><a href="{% url 'certificate:arduino_google_feedback' %}" >Scilab Arduino Workshop 2015</a></li> <li><a href="{% url 'certificate:dwsim_feedback' %}" >DWSIM Workshop 2015</a></li> <li><a href="{% url 'certificate:tbc_freeeda_download' %}" >FreeEDA Textbook Companion</a></li> - <li><a href="{% url 'certificate:drupal_feedback' %}" >Drupal Camp Mumbai 2015</a></li> + <li><a href="{% url 'certificate:drupal_feedback' %}" >Drupal Camp Mumbai</a></li> <li><a href="{% url 'certificate:scipy_feedback' %}" >SciPy India Conference 2014</a></li> <li><a href="{% url 'certificate:feedback' %}" >Scilab India Conference 2014</a></li> + <li><a href="{% url 'certificate:scipy_feedback_2017' %}" >Scilab India Conference 2017 Feedback</a></li> </ul> - <div> -{% endblock %} - - +</div> +<div class="row" id="bottom" style="background-color: #373434"> + <div class="col-md-4"> + <br><br> + <h4 style="color: #000000">Organized By:</h4> + <img height="52.99" width="142.986" src="http://fossee.in/sites/all/themes/software_responsive_theme/img/logo.png" > +     + <img height="55" width="47" src="http://fossee.in/sites/all/themes/software_responsive_theme/img/iitb-logo.png"> + </div> + <!-- /.col-md-4 --> + <div class="col-md-4"> + <br> + <h3 style="color: #000000">Related Links</h3> + <a href="http://fossee.in" target="_blank">fossee.in</a><br> + <a href="http://yaksh.fossee.in" target="_blank">yaksh.fossee.in</a><br> + <a href="http://python.fossee.in" target="_blank">python.fossee.in</a> + </div> + + <div class="col-md-4" style="color: #000000"> + <h3>Contact Us</h3> + FOSSEE, IIT-Bombay<br> + Mumbai, India <br> + Phone: (+91) 22 2576 4133<br> + Email: workshops[at]fossee[dot]in + <div id="social" style="padding-bottom: 2%; padding-top: 2%"> + <a href="https://www.facebook.com/FOSSEENMEICT/" target="_blank" class="fa fa-facebook"> + <img height="25" width="25" src="/static/img/fb.png" style="padding-right: 10px;padding-left: 10px;width: 45px;"> + </a>   + <a href="https://twitter.com/FOSSEENMEICT" target="_blank" class="fa fa-google"> + <img height="25" width="25" src="/static/img/tw.png" style="padding-right: 10px; width: 35px;"/> + </a>   + <a href="https://www.youtube.com/channel/UCMtt6exSCmZI7JU73S6Wz_A" target="_blank" class="fa fa-youtube"> + <img height="25" width="25" src="/static/img/yt.png" style="padding-right: 10px; width: 35px;"/> + </a> <br> + </div> + </div> + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/certificate/templates/fossee_internship_cerificate_download.html b/certificate/templates/openmodelica_download_2017.html similarity index 57% rename from certificate/templates/fossee_internship_cerificate_download.html rename to certificate/templates/openmodelica_download_2017.html index bbff94d..3de3627 100644 --- a/certificate/templates/fossee_internship_cerificate_download.html +++ b/certificate/templates/openmodelica_download_2017.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block header%} - <h1> FOSSEE Internship Certificate</h1> + <h1> OpenModelica Workshop 2017 </h1> {% endblock %} {% block content %} <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> @@ -8,60 +8,59 @@ <h1> FOSSEE Internship Certificate</h1> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> - <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> + <h4 class="modal-title" id="invalidModalLabel">Invalid User/Email</h4> </div> <div class="modal-body"> - The requested certificate is unavailable for your email address. Please select the appropriate category and retry. + {% if notregistered == 1 %} + Please enter a proper email address. + {% else %} + You have not attended the Drupal Camp Mumbai 2015. + {% endif %} </div> </div> </div> </div> - <form class="col-lg-12" action="{% url 'certificate:fossee_internship_cerificate_download' %}" method="post"> + <form class="col-lg-12" action="{% url 'certificate:openmodelica_download_2017' %}" method="post"> {% csrf_token %} {{ message }} - <hr> -   <input type="hidden" name="type" id="A" value="A" checked="True"> <hr> - <div id ="paper"> - {% if user_project %} - <span><h3>Papers presented</h3><span> - <div class="radio" style="padding-left:350px;text-align:left"> - {% for user in user_project %} - <input type="hidden" name="paper" value="{{ user.project_title }}">{{ user.project_title }}<br> - {% endfor %} - </div> - {% endif %} - <input type="hidden" name="paper" value="{{ user.project_title }}">{{ user.project_title }}<br> - </div> <div class="input-group" style="width:340px;text-align:center;margin:0 auto;"> <input style="width:450;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit">Download Certificate</button></span> </div> </form> <center><h4>Problem in downloading the certificate? Write to us at <a href="mailto:certificates@fossee.in">certificates[at]fossee[dot]in</a></h4> + + <div class="modal fade" id="errorModal" tabindex="-1" role="dialog" aria-labelledby="errorModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="invalidModalLabel">Problem in downloading</h4> + </div> + <div class="modal-body"> + Sorry could not process your certificate. Kindly contact the FOSSEE team. + </div> + </div> + </div> + </div> {% endblock %} {% block javascript %} <script> $(document).ready(function(){ - value = "{{ v }}" - email = "" error = "{{ error }}" if(error == "True"){ - $("#invalidModal").modal(); + console.log("edfed") + $("#errorModal").modal(); } - if(value == "paper"){ - $('#A').prop('checked', true) - email = "{{ user_project.0.email }}"; - } - $('#email').val(email); notreg = "{{ notregistered }}"; if(notreg == "1"){ $("#invalidModal").modal(); } - $("[name=type]").change(function(){ - $("#paper").remove(); - }); + if(notreg == "2"){ + $("#invalidModal").modal(); + } }); </script> {% endblock %} diff --git a/certificate/templates/openmodelica_feedback_2017.html b/certificate/templates/openmodelica_feedback_2017.html new file mode 100644 index 0000000..dd1fdad --- /dev/null +++ b/certificate/templates/openmodelica_feedback_2017.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} + +{% block header %} + <h1> OpenModelica Conference 2017 </h1> +{% endblock %} + +{% block content %} +<p> Your feedback will help us improve our services. Thank you for your time. </p> + <div> + <div class="embed-responsive embed-responsive-16by9" style="width:100%;height:2000px"> + <iframe class="embed-responsive-item" src=https://docs.google.com/forms/d/1KUx0xgkLEceiTFj4DBWf9ej971TbMjDPp81BKKeRqI0/viewform?edit_requested=true"></iframe> + </div> + <br> + <a class="btn btn-lg btn-primary" style="float:right" href = "{% url 'certificate:openmodelica_download_2017' %}">Skip and access the certificate</a> + </div> +{% endblock %} diff --git a/certificate/templates/osdag_workshop_download.html b/certificate/templates/osdag_workshop_download.html index 79bd3cf..f000346 100755 --- a/certificate/templates/osdag_workshop_download.html +++ b/certificate/templates/osdag_workshop_download.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block header%} - <h1> Osdag Workshop 2016</h1> + <h1> Osdag Workshop</h1> {% endblock %} {% block content %} <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> @@ -25,6 +25,9 @@ <h4 class="modal-title" id="invalidModalLabel">Invalid User/Email</h4> <div class="input-group" style="width:340px;text-align:center;margin:0 auto;"> <input style="width:450;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit">Download Certificate</button></span> + </div><br> + <div> + Select the workshop date: <input style="width:150;height:25" type="date" name='ws_date' value="2018-01-01" required> </div> </form> <center><h4>Problem in downloading the certificate? Write to us at <a href="mailto:certificates@fossee.in">certificates[at]fossee[dot]in</a></h4> diff --git a/certificate/templates/python_workshop_download.html b/certificate/templates/python_workshop_download.html new file mode 100644 index 0000000..975781e --- /dev/null +++ b/certificate/templates/python_workshop_download.html @@ -0,0 +1,117 @@ +{% extends 'base.html' %} +{% block header%} + <h1> Python Workshop </h1> +{% endblock %} +{% block content %} +<style> +.radioLeft { + padding-top:30px; + display: block; + text-align: left; + padding-left: 10cm; +} +</style> + <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="invalidModalLabel">Invalid User/Email</h4> + </div> + <div class="modal-body"> + {% if notregistered == 1 %} + Please enter a proper email address. + {% endif %} + </div> + </div> + </div> + </div> + <div class="modal fade" id="failModal" tabindex="-1" role="dialog" aria-labelledby="failModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title" id="invalidModalLabel">Certificate not Awarded</h4> + </div> + <div class="modal-body"> + {% if failed == 1 %} + As per our records, you have not secured sufficient marks to get a certificate. Please try our <a href="https://python-workshops.fossee.in/self_workshop">self-learning course</a> to improve your knowledge of Python. + {% endif %} + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> + </div> + </div> + <form class="col-lg-12" action="{% url 'certificate:python_workshop_download' %}" method="post"> + {% csrf_token %} + {{ message }} + <hr> + <div class="input-group" style="width:340px;text-align:center;margin:0 auto;"> + <input style="width:450;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> + <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit">Download Certificate</button></span> + </div><br> + <div> + <select name="format" onchange="myFunction(event)" required> + <option disabled selected>Select the workshop category</option> + <option value="iscp">Introduction to Scientific Computing using Python(ISCP)</option> + <option value="3day">Basic Programming using Python</option> + <option value="sel">Self Learning(Basics of Python)</option> + </select> + </div><br> + <div id='WsDate'></div> + + </form> + <center><h4>Problem in downloading the certificate? <a href="./contact">Write to us</a></h4> + <center><h4>To get more details on upcoming workshops, follow us on<a href="https://www.facebook.com/FOSSEENMEICT/"> facebook</a></h4> + <div class="modal fade" id="errorModal" tabindex="-1" role="dialog" aria-labelledby="errorModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="invalidModalLabel">Problem in downloading</h4> + </div> + <div class="modal-body"> + Sorry could not process your certificate. Kindly contact the FOSSEE team. + </div> + </div> + </div> + </div> + <script> + function myFunction(e) { + var date_input; + if (e.target.value === 'sel') { + date_input = 'Workshop month: <input id="myText" type="month" name="ws_date" value="2018-01" style="width:150;height:25" required>' + } + else { + date_input = 'Workshop date: <input id="myText" type="date" name="ws_date" value="2018-01-01" style="width:150;height:25" required>' + } + document.getElementById("WsDate").innerHTML = date_input; + } + </script> +{% endblock %} + +{% block javascript %} +<script> + $(document).ready(function(){ + error = "{{ error }}" + if(error == "True"){ + console.log("edfed") + $("#errorModal").modal(); + } + notreg = "{{ notregistered }}"; + if(notreg == "1"){ + $("#invalidModal").modal(); + } + if(notreg == "2"){ + $("#invalidModal").modal(); + } + fail = "{{ failed }}"; + if(fail == "1"){ + $("#failModal").modal(); + } + }); +</script> + +{% endblock %} diff --git a/certificate/templates/scipy_download_2016.html b/certificate/templates/scipy_download_2016.html index 29e42e1..3664999 100644 --- a/certificate/templates/scipy_download_2016.html +++ b/certificate/templates/scipy_download_2016.html @@ -1,4 +1,6 @@ {% extends 'base.html' %} +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + {% block header%} <h1> SciPy India Conference 2016 </h1> {% endblock %} @@ -16,6 +18,19 @@ <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> </div> </div> </div> + <div class="modal fade" id="notregModal" tabindex="-1" role="dialog" aria-labelledby="notregModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="notregModalLabel">Registration Error</h4> + </div> + <div class="modal-body"> + The email id you have provided is not registred. Please provide a registered email id. + </div> + </div> + </div> + </div> <form class="col-lg-12" action="{% url 'certificate:scipy_download_2016' %}" method="post"> {% csrf_token %} {{ message }} @@ -23,7 +38,7 @@ <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> <p>Please choose the appropriate category</p> <input type="radio" name="type" id="P" value="P" checked="True">Participant   <input type="radio" name="type" id="A" value="A">Speaker -   <input type="radio" name="type" id="W" value="W">Workshop Instructor + <!--   <input type="radio" name="type" id="W" value="W">Workshop Instructor -->   <input type="radio" name="type" id="T" value="T">TA <hr> <div id ="paper"> @@ -36,10 +51,12 @@ <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> </div> {% endif %} </div> - <div class="input-group" style="width:340px;text-align:center;margin:0 auto;"> - <input style="width:450;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> - <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit" id = 'myBtn' data-toggle = "modal">Mail Certificate</button></span> - + + <div class="input-group" style="width:60%;text-align:center;margin:0 auto;"> + <input style="width:100%;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> + <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit" id = 'myBtn' data-toggle = "modal">Email Certificate</button></span> + </div> + <center><h4>Problem in downloading the certificate? Write to us at <a href="mailto:certificates@fossee.in">certificates[at]fossee[dot]in</a></h4> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> @@ -57,7 +74,7 @@ <h4 class="modal-title" id="myModalLabel">Certificate Mailed</h4> </div> </form> - <center><h4>Problem in downloading the certificate? Write to us at <a href="mailto:certificates@fossee.in">certificates[at]fossee[dot]in</a></h4> + {% endblock %} {% block javascript %} @@ -80,7 +97,7 @@ <h4 class="modal-title" id="myModalLabel">Certificate Mailed</h4> $('#email').val(email); notreg = "{{ notregistered }}"; if(notreg == "1"){ - $("#invalidModal").modal(); + $("#notregModal").modal(); } $("[name=type]").change(function(){ $("#paper").remove(); diff --git a/certificate/templates/scipy_download_2017.html b/certificate/templates/scipy_download_2017.html new file mode 100644 index 0000000..c78bee9 --- /dev/null +++ b/certificate/templates/scipy_download_2017.html @@ -0,0 +1,124 @@ +{% extends 'base.html' %} +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +{% block header%} + <h1> SciPy India Conference 2017 </h1> +{% endblock %} +{% block content %} + <div class="modal fade" id="invalidModal" tabindex="-1" role="dialog" aria-labelledby="invalidModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="invalidModalLabel">Invalid Category</h4> + </div> + <div class="modal-body"> + The requested certificate is unavailable for your email address. Please select the appropriate category and retry. + </div> + </div> + </div> + </div> + <div class="modal fade" id="notregModal" tabindex="-1" role="dialog" aria-labelledby="notregModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="notregModalLabel">Registration Error</h4> + </div> + <div class="modal-body"> + The email id you have provided is not registred. Please provide a registered email id. + </div> + </div> + </div> + </div> + <div class="modal fade" id="duplicateModal" tabindex="-1" role="dialog" aria-labelledby="duplicateModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="duplicateModalLabel">Duplicate Registration Error</h4> + </div> + <div class="modal-body"> + More than one record found for the given email id. Please contact certificates[at]fossee[dot]in + </div> + </div> + </div> + </div> + <form class="col-lg-12" action="{% url 'certificate:scipy_download_2017' %}" method="post"> + {% csrf_token %} + {{ message }} + <hr> + <p>Please choose the appropriate category</p> + <input type="radio" name="type" id="P" value="P" checked="True">Participant +   <input type="radio" name="type" id="A" value="A">Speaker +   <input type="radio" name="type" id="W" value="W">Workshop Instructor + <!--   <input type="radio" name="type" id="T" value="T">TA --> + <hr> + <div id ="paper"> + {% if user_papers %} + <span><h3>Papers presented</h3><span> + <div class="radio" style="padding-left:350px;text-align:left"> + {% for user in user_papers %} + <input type="radio" name="paper" value="{{ user.paper }}">{{ user.paper }}<br> + {% endfor %} + </div> + {% endif %} + </div> + + <div class="input-group" style="width:60%;text-align:center;margin:0 auto;"> + <input style="width:100%;" class="form-control input-lg" placeholder="Enter the email address you used for registration" type="text" id="email" name=email> + <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit" id = 'myBtn' data-toggle = "modal">Download Certificate</button></span> + </div> + <center><h4>Problem in downloading the certificate? Write to us at <a href="mailto:certificates@fossee.in">certificates[at]fossee[dot]in</a></h4> + <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="myModalLabel">Certificate Mailed</h4> + + </div> + <div class="modal-body">The certificate is mailed to your email id.</div> + + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button> + </div> + </div> + </div> + + </form> + +{% endblock %} + +{% block javascript %} +<script> + $(document).ready(function(){ + value = "{{ v }}" + email = "" + error = "{{ error }}" + duplicate = "{{duplicate}}" + + if(error == "True"){ + $("#invalidModal").modal(); + } + if(error == "False"){ + $("#myModal").modal(); + } + if(duplicate == "True"){ + $("#duplicateModal").modal(); + } + if(value == "paper"){ + $('#A').prop('checked', true) + email = "{{ user_papers.0.email }}"; + } + $('#email').val(email); + notreg = "{{ notregistered }}"; + if(notreg == "1"){ + $("#notregModal").modal(); + } + $("[name=type]").change(function(){ + $("#paper").remove(); + }); + }); +</script> +{% endblock %} diff --git a/certificate/templates/scipy_feedback_2016.html b/certificate/templates/scipy_feedback_2016.html index 5293418..7f90dfb 100644 --- a/certificate/templates/scipy_feedback_2016.html +++ b/certificate/templates/scipy_feedback_2016.html @@ -1,16 +1,16 @@ {% extends 'base.html' %} {% block header %} - <h1> SciPy India Conference 2016 </h1> + <h1> SciPy India Conference 2016</h1> {% endblock %} {% block content %} <p> Your feedback will help us improve our services. Thank you for your time. </p> <div> - <div class="embed-responsive embed-responsive-16by9" style="width:100%;height:2000px"> + <div class="embed-responsive embed-responsive-16by9" style="width:100%;height:600px"> <iframe class="embed-responsive-item" src="https://docs.google.com/forms/d/e/1FAIpQLSc58NmRJFBtfdrkbDXCTcIX8IszHhqeOO5vPlmyLgxGJLJ8Yw/viewform"></iframe> </div> <br> - <a class="btn" style="float:right" href = "{% url 'certificate:scipy_download_2016' %}">Click here to download certificate</a> + <a class="btn btn-lg btn-primary" style="float:right" href = "{% url 'certificate:scipy_download_2016' %}">Click here to download certificate</a> </div> {% endblock %} diff --git a/certificate/templates/scipy_feedback_2017.html b/certificate/templates/scipy_feedback_2017.html new file mode 100644 index 0000000..f4d231f --- /dev/null +++ b/certificate/templates/scipy_feedback_2017.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} + +{% block header %} + <h1> SciPy India Conference 2017</h1> +{% endblock %} + +{% block content %} +<p> Your feedback will help us improve our services. Thank you for your time. </p> + <div> + <div class="embed-responsive embed-responsive-16by9" style="width:100%;height:600px"> + <iframe class="embed-responsive-item" src="https://docs.google.com/forms/d/1CNF0jcs00qsb3EQObuZkFyXC_ytG95YCLOfWzrYZzPo/viewform"></iframe> + </div> + <br> + <a class="btn btn-lg btn-primary" style="float:right" href = "{% url 'certificate:scipy_download_2017' %}">Click here to download certificate</a> + </div> +{% endblock %} diff --git a/certificate/urls.py b/certificate/urls.py index 845cd0e..73f67da 100755 --- a/certificate/urls.py +++ b/certificate/urls.py @@ -16,6 +16,9 @@ url(r'^scipy_feedback/$', 'scipy_feedback', name='scipy_feedback'), url(r'^scipy_feedback_2015/$', 'scipy_feedback_2015', name='scipy_feedback_2015'), url(r'^scipy_feedback_2016/$', 'scipy_feedback_2016', name='scipy_feedback_2016'), + url(r'^openmodelica_feedback_2017/$', 'openmodelica_feedback_2017', name='openmodelica_feedback_2017'), + url(r'^openmodelica_download_2017/$', 'openmodelica_download_2017', name='openmodelica_download_2017'), + url(r'^python_workshop_download/$', 'python_workshop_download', name='python_workshop_download'), url(r'^drupal_feedback/$', 'drupal_feedback', name='drupal_feedback'), url(r'^dwsim_feedback/$', 'dwsim_feedback', name='dwsim_feedback'), url(r'^arduino_feedback/$', 'arduino_feedback', name='arduino_feedback'), @@ -35,9 +38,10 @@ url(r'^scipy_download_2016/$', 'scipy_download_2016', name='scipy_download_2016'), url(r'^openfoam_symposium_download_2016/$', 'openfoam_symposium_download_2016', name='openfoam_symposium_download_2016'), url(r'^openfoam_symposium_feedback_2016/$', 'openfoam_symposium_feedback_2016', name='openfoam_symposium_feedback_2016'), - url(r'^fossee_internship_cerificate_download/$', 'fossee_internship_cerificate_download', name='fossee_internship_cerificate_download'), - url(r'^fossee_internship16_cerificate_download/$', 'fossee_internship16_cerificate_download', name='fossee_internship16_cerificate_download'), + url(r'^fossee_internship_cerificate_download/$', 'fossee_internship16_cerificate_download', name='fossee_internship_cerificate_download'), url(r'^drupal_workshop_download/$', 'drupal_workshop_download', name='drupal_workshop_download'), - - + url(r'^scipy_download_2017/$', 'scipy_download_2017', name='scipy_download_2017'), + url(r'^scipy_feedback_2017/$', 'scipy_feedback_2017', name='scipy_feedback_2017'), + url(r'^python_workshop_download/contact$', 'contact', name='contact'), + ) diff --git a/certificate/views.py b/certificate/views.py index 19c161b..cc28798 100755 --- a/certificate/views.py +++ b/certificate/views.py @@ -1,23 +1,45 @@ -from django.shortcuts import render -from django.http import HttpResponse -from django.shortcuts import render_to_response, redirect -from django.template import RequestContext -from certificate.models import Drupal_WS, Osdag_WS, Scipy_TA_2016, Scipy_participant_2016, Scipy_speaker_2016, Scipy_workshop_2016, eSim_WS, Internship_participant,Internship16_participant, Scilab_participant, Certificate, Event, Scilab_speaker, Scilab_workshop, Question, Answer, FeedBack, Scipy_participant, Scipy_speaker, Drupal_camp, Tbc_freeeda, Dwsim_participant, Scilab_arduino, Esim_faculty, Scipy_participant_2015, Scipy_speaker_2015, OpenFOAM_Symposium_participant_2016, OpenFOAM_Symposium_speaker_2016 import subprocess import os from string import Template import hashlib -from certificate.forms import FeedBackForm +from django.shortcuts import render +from django.http import HttpResponse +from django.shortcuts import render_to_response, redirect +from django.template import RequestContext +from certificate.forms import FeedBackForm, ContactForm from collections import OrderedDict from django.core.mail import EmailMultiAlternatives from django.views.decorators.csrf import csrf_exempt +import calendar +from datetime import datetime +from django.http import HttpResponseRedirect +import json +import urllib +import urllib2 +from django.conf import settings +import sending_emails +from certificate.models import Python_Workshop,\ +Python_Workshop_BPPy, OpenModelica_WS, Drupal_WS,\ +Osdag_WS, Scipy_TA_2016, Scipy_participant_2016,\ +Scipy_speaker_2016, Scipy_workshop_2016, eSim_WS,\ +Internship_participant, Internship16_participant,\ +Scilab_participant, Certificate, Event, Scilab_speaker,\ +Scilab_workshop, Question, Answer, FeedBack,\ +Scipy_participant, Scipy_speaker, Drupal_camp,\ +Tbc_freeeda, Dwsim_participant, Scilab_arduino,\ +Esim_faculty, Scipy_participant_2015,\ +Scipy_speaker_2015, OpenFOAM_Symposium_participant_2016,\ +OpenFOAM_Symposium_speaker_2016, Scipy_2017 + # Create your views here. + def index(request): return render_to_response('index.html') + def download(request): context = {} err = "" @@ -34,7 +56,8 @@ def download(request): user = Scilab_participant.objects.filter(email=email) if not user: context["notregistered"] = 1 - return render_to_response('download.html', context, context_instance=ci) + return render_to_response('download.html', context, + context_instance=ci) else: user = user[0] elif type == 'A': @@ -46,54 +69,66 @@ def download(request): user = Scilab_speaker.objects.filter(email=email) if not user: context["notregistered"] = 1 - return render_to_response('download.html', context, context_instance=ci) + return render_to_response('download.html', context, + context_instance=ci) if len(user) > 1: context['user_papers'] = user context['v'] = 'paper' - return render_to_response('download.html', context, context_instance=ci) + 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 = Scilab_workshop.objects.filter(email=email, + workshops=workshop) if user: user = [user[0]] else: user = Scilab_workshop.objects.filter(email=email) if not user: context["notregistered"] = 1 - return render_to_response('download.html', context, context_instance=ci) + return render_to_response('download.html', context, + context_instance=ci) if len(user) > 1: context['workshops'] = user context['v'] = 'workshop' - return render_to_response('download.html', context, context_instance=ci) + 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' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) qrcode = 'NAME: {0}; SERIAL-NO: {1}; '.format(name, serial_no) - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: - old_user = Certificate.objects.get(email=email, serial_no=serial_no) - certificate = create_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name) + old_user = Certificate.objects.get(email=email, + serial_no=serial_no) + certificate = create_certificate(certificate_path, + name, qrcode, type, paper, + workshop, file_name) 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, paper, workshop, file_name) + certificate = create_certificate(certificate_path, + name, qrcode, type, paper, + workshop, file_name) if not certificate[1]: - certi_obj = Certificate(name=name, email=email, serial_no=serial_no, counter=1, workshop=workshop, paper=paper) + certi_obj = Certificate(name=name, email=email, + serial_no=serial_no, + counter=1, workshop=workshop, + paper=paper) certi_obj.save() return certificate[0] - if certificate[1]: _clean_certificate_certificate(certificate_path, file_name) context['error'] = True @@ -101,6 +136,7 @@ def download(request): context['message'] = '' return render_to_response('download.html', context, ci) + def verification(serial, _type): context = {} if _type == 'key': @@ -113,40 +149,123 @@ def verification(serial, _type): certificate.verified += 1 certificate.save() purpose, year, type = _get_detail(serial_no) + if purpose == 'SciPy India 2017': + detail_list = [ + ('Name', name), ('Event', purpose), + ('Days', '29 - 30 November'), + ('Year', year) + ] + if not type == 'P': + detail_list.append(('Paper', paper)) + + detail = OrderedDict(detail_list) + context['serial_key'] = True + context['detail'] = detail + return context + if type == 'P': if purpose == 'DWSIM Workshop': dwsim_user = Dwsim_participant.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), - ('Event', purpose), ('Days', '29 - 30 May'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '29 - 30 May'), + ('Year', year) + ]) elif purpose == 'Scilab Arduino Workshop': arduino_user = Scilab_arduino.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '3 - 4 July'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '3 - 4 July'), + ('Year', year) + ]) elif purpose == 'eSim Faculty Meet': faculty = Esim_faculty.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '22 August'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '22 August'), + ('Year', year) + ]) elif purpose == 'Osdag Workshop': - faculty = Osdag_WS.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '4 June'), ('Year', year)]) + osdag_workshop = Osdag_WS.objects.get(email=certificate.email) + days = '%s to %s' % (datetime.strftime(osdag_workshop.start_date, '%d %b'), + datetime.strftime(osdag_workshop.end_date, '%d %b')) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', days), + ('Year', year) + ]) elif purpose == 'Drupal Workshop': - faculty = Drupal_WS.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '30 July'), ('Year', year)]) + drupal_ws = Drupal_WS.objects.get(email=certificate.email) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Date', drupal_ws.date), + ]) + elif purpose == 'OpenModelica Workshop': + faculty = OpenModelica_WS.objects.get(email=certificate.email) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '4-5 January'), + ('Year', year) + ]) + elif purpose == 'Python Workshop': + faculty = Python_Workshop.objects.get(email=certificate.email) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', faculty.ws_date), + ('Year', year) + ]) + elif purpose == 'Python 3day Workshop': + faculty = Python_Workshop_BPPy.objects.get(email=certificate.email, purpose='P3W') + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', faculty.ws_date), + ('Year', year) + ]) + elif purpose == 'Self Learning': + self_workshop = Python_Workshop_BPPy.objects.get(email=certificate.email, purpose='sel') + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', self_workshop.ws_date), + ('Year', year) + ]) elif purpose == 'eSim Workshop': faculty = eSim_WS.objects.get(email=certificate.email) - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '11 June'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '11 June'), + ('Year', year) + ]) elif purpose == 'SciPy India': - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '14 - 16 December'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '14 - 16 December'), + ('Year', year) + ]) elif purpose == 'SciPy India 2016': - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '10 - 11 December'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '10 - 11 December'), + ('Year', year) + ]) elif purpose == 'OpenFOAM Symposium': - detail = OrderedDict([('Name', name), ('Event', purpose), - ('Days', '27 February'), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Event', purpose), + ('Days', '27 February'), + ('Year', year) + ]) elif purpose == 'DrupalCamp Mumbai': drupal_user = Drupal_camp.objects.get(email=certificate.email) DAY = drupal_user.attendance @@ -156,18 +275,24 @@ def verification(serial, _type): day = 'Day 2' elif DAY == 3: day = 'Day 1 and Day 2' - detail = OrderedDict([('Name', name), ('Attended', day), - ('Event', purpose), ('Year', year)]) + detail = OrderedDict([ + ('Name', name), + ('Attended', day), + ('Event', purpose), + ('Year', year) + ]) elif purpose == 'FreeEDA Textbook Companion': user_books = Tbc_freeeda.objects.filter(email=certificate.email).values_list('book') - books = [ book[0] for book in user_books ] - detail = OrderedDict([('Name', name), ('Participant', 'Yes'), - ('Project', 'FreeEDA Textbook Companion'), ('Books completed', ','.join(books))]) + books = [book[0] for book in user_books] + detail = OrderedDict([ + ('Name', name), + ('Participant', 'Yes'), + ('Project', 'FreeEDA Textbook Companion'), + ('Books completed', ','.join(books))]) else: detail = '{0} had attended {1} {2}'.format(name, purpose, year) elif type == 'A' or type == 'T': - detail = '{0} had presented paper on {3} in the {1} {2}'.format\ - (name, purpose, year, paper) + detail = '{0} had presented paper on {3} in the {1} {2}'.format(name, purpose, year, paper) if purpose == 'SciPy India': detail = OrderedDict([('Name', name), ('Event', purpose), ('paper', paper), ('Days', '14 - 16 December'), ('Year', year)]) elif purpose == 'SciPy India 2016': @@ -177,23 +302,20 @@ def verification(serial, _type): elif purpose == 'FOSSEE Internship': intership_detail = Internship_participant.objects.get(email=certificate.email) user_project_title = Internship_participant.objects.filter(email=certificate.email) - context['intern_ship'] = True + context['intern_ship'] = True detail = OrderedDict([('Name', name), ('Internship Completed', 'Yes'), - ('Project', intership_detail.project_title), ('Internship Duration', intership_detail.internship_project_duration), ('Superviser Name', intership_detail.superviser_name_detail)]) + ('Project', intership_detail.project_title), ('Internship Duration', intership_detail.internship_project_duration), ('Superviser Name', intership_detail.superviser_name_detail)]) elif purpose == 'FOSSEE Internship 2016': intership_detail = Internship16_participant.objects.get(email=certificate.email) user_project_title = Internship16_participant.objects.filter(email=certificate.email) - context['intern_ship'] = True + context['intern_ship'] = True detail = OrderedDict([('Name', name), ('Internship Completed', 'Yes'), - ('Project', intership_detail.project_title), ('Internship Duration', intership_detail.internship_project_duration)]) - + ('Project', intership_detail.project_title), ('Internship Duration', intership_detail.internship_project_duration)]) else: detail = '{0} had attended {1} {2}'.format(name, purpose, year) elif type == 'W': - detail = '{0} had attended workshop on {3} in the {1} {2}'.format\ - (name, purpose, year, workshop) + detail = '{0} had attended workshop on {3} in the {1} {2}'.format(name, purpose, year, workshop) context['serial_key'] = True - except Certificate.DoesNotExist: detail = 'User does not exist' context["invalidserial"] = 1 @@ -227,7 +349,7 @@ def verification(serial, _type): detail = '{0} had attended {1} {2}'.format(name, purpose, year) elif type == 'A' or type == 'T': detail = '{0} had presented paper on {3} in the {1} {2}'.format(name, purpose, year, paper) - elif type == 'W' : + elif type == 'W': detail = '{0} had attended workshop on {3} in the {1} {2}'.format(name, purpose, year, workshop) context['detail'] = detail except Certificate.DoesNotExist: @@ -245,10 +367,11 @@ def verify(request, serial_key=None): if request.method == 'POST': serial_no = request.POST.get('serial_no').strip() context = verification(serial_no, 'number') - if 'invalidserial' in context: + if 'invalidserial' in context: context = verification(serial_no, 'key') return render_to_response('verify.html', context, ci) - return render_to_response('verify.html',{}, ci) + return render_to_response('verify.html', {}, ci) + def _get_detail(serial_no): purpose = None @@ -272,6 +395,12 @@ def _get_detail(serial_no): purpose = 'Osdag Workshop' elif serial_no[0:3] == 'DRP': purpose = 'Drupal Workshop' + elif serial_no[0:3] == 'OMW': + purpose = 'OpenModelica Workshop' + elif serial_no[0:3] == 'PWS': + purpose = 'Python Workshop' + elif serial_no[0:3] == 'P3W': + purpose = 'Python 3day Workshop' elif serial_no[0:3] == 'EWS': purpose = 'eSim Workshop' elif serial_no[0:3] == 'OFC': @@ -280,13 +409,12 @@ def _get_detail(serial_no): purpose = 'FOSSEE Internship' elif serial_no[0:3] == 'F16': purpose = 'FOSSEE Internship 2016' + elif serial_no[0:3] == 'S17': + purpose = 'SciPy India 2017' + elif serial_no[0:3] == 'sel': + purpose = 'Self Learning' - if serial_no[3:5] == '14': - year = '2014' - elif serial_no[3:5] == '15': - year = '2015' - elif serial_no[3:5] == '16': - year = '2016' + year = '20%s' % serial_no[3:5] return purpose, year, serial_no[-1] @@ -304,42 +432,42 @@ def create_certificate(certificate_path, name, qrcode, type, paper, workshop, fi template = 'template_SLC2014Wcertificate' download_file_name = 'SLC2014Wcertificate.pdf' - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + template_file = open('{0}{1}'.format(certificate_path, template), 'r') content = Template(template_file.read()) template_file.close() if type == 'P': content_tex = content.safe_substitute(name=name.title(), qr_code=qrcode) elif type == 'A': content_tex = content.safe_substitute(name=name.title(), qr_code=qrcode, - paper=paper) + paper=paper) elif type == 'W': content_tex = content.safe_substitute(name=name.title(), qr_code=qrcode, - workshop=workshop) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + workshop=workshop) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) response.write(pdf.read()) _clean_certificate_certificate(certificate_path, file_name) - return [response, False] + return [response, False] else: error = True except Exception, e: error = True return [None, error] + def _clean_certificate_certificate(path, file_name): clean_process = subprocess.Popen('make -C {0} clean file_name={1}'.format(path, file_name), - shell=True) + shell=True) clean_process.wait() + def _make_certificate_certificate(path, type, file_name): if type == 'P': command = 'participant_cert' @@ -350,10 +478,11 @@ def _make_certificate_certificate(path, type, file_name): elif type == 'T': command = 'workshop_cert' process = subprocess.Popen('timeout 15 make -C {0} {1} file_name={2}'.format(path, command, file_name), - stderr = subprocess.PIPE, shell = True) + stderr=subprocess.PIPE, shell=True) err = process.communicate()[1] return process.returncode, err + def feedback(request): context = {} ci = RequestContext(request) @@ -466,11 +595,11 @@ def scipy_download(request): name = user.name purpose = user.purpose year = '14' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) qrcode = 'NAME: {0}; SERIAL-NO: {1}; '.format(name, serial_no) - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) @@ -504,23 +633,20 @@ def create_scipy_certificate(certificate_path, name, qrcode, type, paper, worksh elif type == 'A': template = 'template_SPC2014Acertificate' download_file_name = 'SPC2014Acertificate.pdf' - - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + template_file = open('{0}{1}'.format(certificate_path, template), 'r') content = Template(template_file.read()) template_file.close() if type == 'P': content_tex = content.safe_substitute(name=name.title(), qr_code=qrcode) elif type == 'A': content_tex = content.safe_substitute(name=name.title(), qr_code=qrcode, - paper=paper) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + paper=paper) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -570,6 +696,7 @@ def drupal_feedback(request): return render_to_response('drupal_feedback.html', context, ci) + def drupal_download(request): context = {} err = "" @@ -587,7 +714,7 @@ def drupal_download(request): if not user: context["notregistered"] = 1 return render_to_response('drupal_download.html', - context, context_instance=ci) + context, context_instance=ci) else: user = user[0] fname = user.firstname @@ -604,20 +731,20 @@ def drupal_download(request): else: context['notregistered'] = 2 return render_to_response('drupal_download.html', context, - context_instance=ci) + context_instance=ci) year = '15' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + qrcode = 'https://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'day': day, 'serial_key': old_user.short_key} certificate = create_drupal_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -632,14 +759,17 @@ def drupal_download(request): uniqueness = True else: num += 1 - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) + qrcode = 'https://fossee.in/certificates/verify/{0} '.format(short_key) details = {'name': name, 'day': day, 'serial_key': short_key} certificate = create_drupal_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, + counter=1, workshop=workshop, + paper=paper, + serial_key=serial_key, + short_key=short_key) certi_obj.save() return certificate[0] @@ -658,21 +788,20 @@ def create_drupal_certificate(certificate_path, name, qrcode, type, paper, works template = 'template_DCM2015Pcertificate' download_file_name = 'DCM2015Pcertificate.pdf' - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + 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['name'].title(), - day=name['day'], serial_key = name['serial_key'], qr_code=qrcode) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + day=name['day'], + serial_key=name['serial_key'], + qr_code=qrcode) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -686,7 +815,6 @@ def create_drupal_certificate(certificate_path, name, qrcode, type, paper, works return [None, error] - def tbc_freeeda_download(request): context = {} err = "" @@ -704,27 +832,27 @@ def tbc_freeeda_download(request): if not user: context["notregistered"] = 1 return render_to_response('tbc_freeeda_download.html', - context, context_instance=ci) + context, context_instance=ci) else: user = user[0] name = user.name college = user.college book = user.book - author =user.author + author = user.author purpose = user.purpose year = '15' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'book': book, 'college': college, 'author': author, 'serial_key': old_user.short_key} certificate = create_freeeda_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -742,11 +870,11 @@ def tbc_freeeda_download(request): qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) details = {'name': name, 'book': book, 'college': college, 'author': author, 'serial_key': short_key} certificate = create_freeeda_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() return certificate[0] @@ -764,23 +892,20 @@ def create_freeeda_certificate(certificate_path, name, qrcode, type, paper, work download_file_name = None template = 'template_FET2015Pcertificate' download_file_name = 'FET2015Pcertificate.pdf' - - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + 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['name'].title(), - book=name['book'], author=name['author'], college=name['college'], - serial_key=name['serial_key'], qr_code=qrcode) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + book=name['book'], author=name['author'], college=name['college'], + serial_key=name['serial_key'], qr_code=qrcode) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -830,6 +955,7 @@ def dwsim_feedback(request): return render_to_response('dwsim_feedback.html', context, ci) + def dwsim_download(request): context = {} err = "" @@ -847,24 +973,24 @@ def dwsim_download(request): if not user: context["notregistered"] = 1 return render_to_response('dwsim_download.html', - context, context_instance=ci) + context, context_instance=ci) else: user = user[0] name = user.name purpose = user.purpose year = '15' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'serial_key': old_user.short_key} certificate = create_dwsim_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -882,11 +1008,11 @@ def dwsim_download(request): qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) details = {'name': name, 'serial_key': short_key} certificate = create_dwsim_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() return certificate[0] @@ -905,21 +1031,19 @@ def create_dwsim_certificate(certificate_path, name, qrcode, type, paper, worksh template = 'template_DWS2015Pcertificate' download_file_name = 'DWS2015Pcertificate.pdf' - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + 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['name'].title(), - serial_key = name['serial_key'], qr_code=qrcode) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + serial_key=name['serial_key'], qr_code=qrcode) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -973,6 +1097,7 @@ def arduino_feedback(request): return render_to_response('arduino_feedback.html', context, ci) + def arduino_download(request): context = {} err = "" @@ -990,24 +1115,24 @@ def arduino_download(request): if not user: context["notregistered"] = 1 return render_to_response('arduino_download.html', - context, context_instance=ci) + context, context_instance=ci) else: user = user[0] name = user.name purpose = user.purpose year = '15' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'serial_key': old_user.short_key} certificate = create_arduino_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -1025,11 +1150,11 @@ def arduino_download(request): qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) details = {'name': name, 'serial_key': short_key} certificate = create_arduino_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() return certificate[0] @@ -1048,21 +1173,19 @@ def create_arduino_certificate(certificate_path, name, qrcode, type, paper, work template = 'template_SCA2015Pcertificate' download_file_name = 'SCA2015Pcertificate.pdf' - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + 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['name'].title(), - serial_key = name['serial_key'], qr_code=qrcode) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + serial_key=name['serial_key'], qr_code=qrcode) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -1086,31 +1209,39 @@ def osdag_workshop_download(request): if request.method == 'POST': email = request.POST.get('email').strip() type = request.POST.get('type', 'P') + ws_date = request.POST.get('ws_date') + ws_date = datetime.strptime(ws_date, '%Y-%m-%d') paper = None workshop = None if type == 'P': - user = Osdag_WS.objects.filter(email=email) - if not user: + users = Osdag_WS.objects.filter(email=email, start_date=ws_date) + if not users: context["notregistered"] = 1 return render_to_response('osdag_workshop_download.html', - context, context_instance=ci) + context, context_instance=ci) else: - user = user[0] + user = users[0] name = user.name purpose = user.purpose - year = '16' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() - serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) + year = user.start_date.year + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() + serial_no = '{0}{1}{2}{3}'.format(purpose, str(year)[2:], hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') + details = { + 'name': name, 'year': year, + 'college': user.college, + 'start_date': datetime.strftime(user.start_date, '%d %B'), + 'end_date': datetime.strftime(user.end_date, '%d %b') + } try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) - details = {'name': name, 'serial_key': old_user.short_key} + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + details.update({'serial_key': old_user.short_key}) certificate = create_osdag_workshop_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -1122,17 +1253,17 @@ def osdag_workshop_download(request): present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) if not present: short_key = serial_key[0:num] + details.update({'serial_key': short_key}) uniqueness = True else: num += 1 - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) - details = {'name': name, 'serial_key': short_key} + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(short_key) certificate = create_osdag_workshop_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() return certificate[0] @@ -1143,6 +1274,7 @@ def osdag_workshop_download(request): context['message'] = '' return render_to_response('osdag_workshop_download.html', context, ci) + def osdag_workshop_feedback(request): context = {} ci = RequestContext(request) @@ -1180,28 +1312,25 @@ def osdag_workshop_feedback(request): return render_to_response('osdag_workshop_feedback.html', context, ci) -def create_osdag_workshop_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name): +def create_osdag_workshop_certificate(certificate_path, details, qrcode, type, paper, workshop, file_name): error = False try: - download_file_name = None template = 'template_OWS2016Pcertificate' - download_file_name = 'OWS2016Pcertificate.pdf' - - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + download_file_name = 'OWS%sPcertificate.pdf' % (details['year']) + 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['name'].title(), - serial_key = name['serial_key'], qr_code=qrcode) + content_tex = content.safe_substitute(name=details['name'].title(), + serial_key = details['serial_key'], qr_code=qrcode, college=details['college'], + date='%s %s' % (details['start_date'], details['year'])) create_tex = open('{0}{1}.tex'.format\ (certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: - pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name), 'r') response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; \ filename=%s' % (download_file_name) @@ -1214,6 +1343,7 @@ def create_osdag_workshop_certificate(certificate_path, name, qrcode, type, pape error = True return [None, error] + def drupal_workshop_download(request): context = {} err = "" @@ -1231,24 +1361,30 @@ def drupal_workshop_download(request): if not user: context["notregistered"] = 1 return render_to_response('drupal_workshop_download.html', - context, context_instance=ci) + context, context_instance=ci) else: user = user[0] name = user.name purpose = user.purpose - year = '16' - id = int(user.id) - hexa = hex(id).replace('0x','').zfill(6).upper() + status = 'successfully completed' if user.status else 'participated in' + ws_date = user.date + ws_date = datetime.strftime(ws_date, '%d %B %Y') + year = ws_date[-2:] + id = int(user.id) + hexa = hex(id).replace('0x', '').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) serial_key = (hashlib.sha1(serial_no)).hexdigest() - file_name = '{0}{1}'.format(email,id) + file_name = '{0}{1}'.format(email, id) file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) - details = {'name': name, 'serial_key': old_user.short_key} + qrcode = 'https://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + details = { + 'name': name, 'serial_key': old_user.short_key, + 'status': status, 'ws_date': ws_date + } certificate = create_drupal_workshop_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() @@ -1263,14 +1399,17 @@ def drupal_workshop_download(request): uniqueness = True else: num += 1 - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) - details = {'name': name, 'serial_key': short_key} + qrcode = 'https://fossee.in/certificates/verify/{0} '.format(short_key) + details = { + 'name': name, 'serial_key': short_key, + 'status': status, 'ws_date': ws_date + } certificate = create_drupal_workshop_certificate(certificate_path, details, - qrcode, type, paper, workshop, file_name) + qrcode, type, paper, workshop, file_name) if not certificate[1]: certi_obj = Certificate(name=name, email=email, - serial_no=serial_no, counter=1, workshop=workshop, - paper=paper, serial_key=serial_key, short_key=short_key) + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() return certificate[0] @@ -1282,27 +1421,29 @@ def drupal_workshop_download(request): context['message'] = '' return render_to_response('drupal_workshop_download.html', context, ci) -def create_drupal_workshop_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name): + +def create_drupal_workshop_certificate(certificate_path, detail, qrcode, type, paper, workshop, file_name): error = False err = None try: + year = detail["ws_date"][-4:] download_file_name = None - template = 'template_DWS2016Pcertificate' - download_file_name = 'DWS2016Pcertificate.pdf' + template = 'template_DWS2018Pcertificate' + download_file_name = 'DWS%sPcertificate.pdf'% year - template_file = open('{0}{1}'.format\ - (certificate_path, template), 'r') + 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['name'].title(), - serial_key = name['serial_key'], qr_code=qrcode) - create_tex = open('{0}{1}.tex'.format\ - (certificate_path, file_name), 'w') + content_tex = content.safe_substitute(name=detail['name'].title(), + serial_key=detail['serial_key'], qr_code=qrcode, + status=detail['status'], ws_date=detail['ws_date'] + ) + create_tex = open('{0}{1}.tex'.format(certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, - type, file_name) + type, file_name) if return_value == 0: pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') response = HttpResponse(content_type='application/pdf') @@ -1902,14 +2043,14 @@ def create_scipy_certificate_2016(certificate_path, name, qrcode, type, paper, w subject = "SciPy India 2016 - Certificate" to = ['scipy@fossee.in', name['email'],] - message = """ Dear Participant,<br>Please find attached the participation certificate for SciPy India 2016.<br>If you wish to print this certificate, for optimal printing, please follow these instructions:<br><br>Recommended Paper: Ivory (Matt or Glossy) White <br>Recommended GSM: Minimum of 170<br>Size: Letter size (8.5 x 11 in)<br>Print Settings: Fit to page<br><br>Regards,<br>SciPy India Team - """ + message_text = """Dear Participant,\n\nPlease find attached the participation certificate for SciPy India 2016.\nIf you wish to print this certificate, for optimal printing, please follow these instructions:\n\nRecommended Paper: Ivory (Matt or Glossy) White \nRecommended GSM: Minimum of 170\nSize: Letter size (8.5 x 11 in)\nPrint Settings: Fit to page\n\nRegards,\nSciPy India Team.""" + message_html = """Dear Participant,<br><br>Please find attached the participation certificate for SciPy India 2016.<br>If you wish to print this certificate, for optimal printing, please follow these instructions:<br><br>Recommended Paper: Ivory (Matt or Glossy) White <br>Recommended GSM: Minimum of 170<br>Size: Letter size (8.5 x 11 in)<br>Print Settings: Fit to page<br><br>Regards,<br>SciPy India Team.""" email = EmailMultiAlternatives( - subject,'', + subject,message_text, sender_email, to, headers={"Content-type":"text/html;charset=iso-8859-1"} ) - email.attach_alternative(message, "text/html") + email.attach_alternative(message_html, "text/html") email.attach_file(path) email.send(fail_silently=True) @@ -1925,6 +2066,123 @@ def create_scipy_certificate_2016(certificate_path, name, qrcode, type, paper, w return [None, error] + + +@csrf_exempt +def openmodelica_feedback_2017(request): + return render_to_response('openmodelica_feedback_2017.html') + +@csrf_exempt +def openmodelica_download_2017(request): + context = {} + err = "" + ci = RequestContext(request) + cur_path = os.path.dirname(os.path.realpath(__file__)) + certificate_path = '{0}/openmodelica_workshop_template/'.format(cur_path) + + if request.method == 'POST': + email = request.POST.get('email').strip() + type = request.POST.get('type', 'P') + paper = None + workshop = None + if type == 'P': + user = OpenModelica_WS.objects.filter(email=email) + if not user: + context["notregistered"] = 1 + return render_to_response('openmodelica_download_2017.html', + context, context_instance=ci) + else: + user = user[0] + name = user.name + purpose = user.purpose + year = '17' + id = int(user.id) + hexa = hex(id).replace('0x','').zfill(6).upper() + serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) + serial_key = (hashlib.sha1(serial_no)).hexdigest() + file_name = '{0}{1}'.format(email,id) + file_name = file_name.replace('.', '') + try: + old_user = Certificate.objects.get(email=email, serial_no=serial_no) + qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + details = {'name': name, 'serial_key': old_user.short_key} + certificate = create_openmodelica_workshop_certificate(certificate_path, details, + qrcode, type, paper, workshop, file_name) + if not certificate[1]: + old_user.counter = old_user.counter + 1 + old_user.save() + return certificate[0] + except Certificate.DoesNotExist: + uniqueness = False + num = 5 + while not uniqueness: + present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) + if not present: + short_key = serial_key[0:num] + uniqueness = True + else: + num += 1 + qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) + details = {'name': name, 'serial_key': short_key} + certificate = create_openmodelica_workshop_certificate(certificate_path, details, + qrcode, type, paper, workshop, file_name) + if not certificate[1]: + certi_obj = Certificate(name=name, email=email, + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) + certi_obj.save() + return certificate[0] + + if certificate[1]: + _clean_certificate_certificate(certificate_path, file_name) + context['error'] = True + context['err'] = certificate[0] + return render_to_response('openmodelica_download_2017.html', context, ci) + context['message'] = '' + return render_to_response('openmodelica_download_2017.html', context, ci) + +def create_openmodelica_workshop_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name): + error = False + err = None + try: + download_file_name = None + template = 'template_OMW2017Pcertificate' + download_file_name = 'OMW2017Pcertificate.pdf' + + 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['name'].title(), + serial_key = name['serial_key'], qr_code=qrcode) + create_tex = open('{0}{1}.tex'.format\ + (certificate_path, file_name), 'w') + create_tex.write(content_tex) + create_tex.close() + return_value, err = _make_certificate_certificate(certificate_path, + type, file_name) + if return_value == 0: + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + response = HttpResponse(content_type='application/pdf') + response['Content-Disposition'] = 'attachment; \ + filename=%s' % (download_file_name) + response.write(pdf.read()) + _clean_certificate_certificate(certificate_path, file_name) + return [response, False] + else: + error = True + except Exception, e: + error = True + return [None, error] + + + + + + + + ############################################################################### # OpenFOAM Symposium 2016 ############################################################################### @@ -2180,25 +2438,32 @@ def fossee_internship_cerificate_download(request): return render_to_response('fossee_internship_cerificate_download.html', context, ci) -def create_fossee_internship_cerificate(certificate_path, name, qrcode, type, paper, internship_project_duration, student_edu_detail, student_institute_detail, superviser_name_detail, workshop, file_name): +def create_fossee_internship_cerificate( + certificate_path, name, qrcode, + wtype, paper, internship_project_duration, student_edu_detail, + student_institute_detail, superviser_name_detail, + workshop, file_name): error = False try: download_file_name = None - if type == 'P': + year = internship_project_duration.split()[2] + if wtype == 'P': template = 'template_FIC2016Pcertificate' download_file_name = 'FIC2016Pcertificate.pdf' - elif type == 'A': + elif wtype == 'A': template = 'template_FIC2016Acertificate' - download_file_name = 'FIC2016Acertificate.pdf' + if year == '2018': + template = 'template_FIC2018Acertificate' + download_file_name = 'FIC{0}Acertificate.pdf'.format(year) template_file = open('{0}{1}'.format\ (certificate_path, template), 'r') content = Template(template_file.read()) template_file.close() - if type == 'P': + if wtype == 'P': content_tex = content.safe_substitute(name=name['name'].title(), serial_key=name['serial_key'], qr_code=qrcode) - elif type == 'A': + elif wtype == 'A': content_tex = content.safe_substitute(name=name['name'].title(), serial_key=name['serial_key'], qr_code=qrcode, paper=paper, internship_project_duration=internship_project_duration, @@ -2209,7 +2474,8 @@ def create_fossee_internship_cerificate(certificate_path, name, qrcode, type, pa (certificate_path, file_name), 'w') create_tex.write(content_tex) create_tex.close() - return_value, err = _make_certificate_certificate(certificate_path, type, file_name) + return_value, err = _make_certificate_certificate(certificate_path, + wtype, file_name) if return_value == 0: pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') response = HttpResponse(content_type='application/pdf') @@ -2276,7 +2542,7 @@ def fossee_internship16_cerificate_download(request): file_name = file_name.replace('.', '') try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'serial_key': old_user.short_key} certificate = create_fossee_internship_cerificate(certificate_path, details, qrcode, type, paper, internship_project_duration, student_edu_detail, student_institute_detail, superviser_name_detail, workshop, file_name) @@ -2294,7 +2560,7 @@ def fossee_internship16_cerificate_download(request): uniqueness = True else: num += 1 - qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(short_key) details = {'name': name, 'serial_key': short_key} certificate = create_fossee_internship_cerificate(certificate_path, details, qrcode, type, paper, internship_project_duration, student_edu_detail, student_institute_detail, superviser_name_detail, workshop, file_name) @@ -2355,3 +2621,294 @@ def create_fossee_internship16_cerificate(certificate_path, name, qrcode, type, error = True return [None, error] +# def python_workshop_download(request): +# return render_to_response("python_workshop_download.html") + + +@csrf_exempt +def python_workshop_download(request): + context = {} + err = "" + ci = RequestContext(request) + cur_path = os.path.dirname(os.path.realpath(__file__)) + certificate_path = '{0}/python_workshop_template/'.format(cur_path) + if request.method == 'POST': + email = request.POST.get('email').strip() + type = request.POST.get('type', 'P') + format = request.POST.get('format','iscp') + ws_date = request.POST.get('ws_date').split('-') + ws_date[1] = calendar.month_name[int(ws_date[1])] + ws_date.reverse() + ws_date = ' '.join(ws_date) + paper = None + workshop = None + if type == 'P': + if format=='iscp': + user = Python_Workshop.objects.filter(email=email, ws_date=ws_date) + elif format=='sel': + user = Python_Workshop_BPPy.objects.filter(email=email, purpose=format, ws_date=ws_date) + else: + user = Python_Workshop_BPPy.objects.filter(email=email, ws_date=ws_date) + if not user: + context["notregistered"] = 1 + return render_to_response('python_workshop_download.html', + context, context_instance=ci) + else: + user = user[0] + if user.paper == 'F': + context["failed"] = 1 + return render_to_response('python_workshop_download.html', + context, context_instance=ci) + name = user.name + college = user.college + purpose = user.purpose + ws_date = user.ws_date + paper = user.paper + is_coordinator = user.is_coordinator + year = ws_date.split()[-1][2:] + id = int(user.id) + hexa = hex(id).replace('0x','').zfill(6).upper() + serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) + serial_key = (hashlib.sha1(serial_no)).hexdigest() + file_name = '{0}{1}'.format(email,id) + file_name = file_name.replace('.', '') + try: + old_user = Certificate.objects.get(email=email, serial_no=serial_no) + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + details = {'name': name, 'serial_key': old_user.short_key} + certificate = create_python_workshop_certificate(certificate_path, details, + qrcode, type, paper, workshop, file_name, college, ws_date, is_coordinator,format) + if not certificate[1]: + old_user.counter = old_user.counter + 1 + old_user.save() + return certificate[0] + except Certificate.DoesNotExist: + uniqueness = False + num = 5 + while not uniqueness: + present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) + if not present: + short_key = serial_key[0:num] + uniqueness = True + else: + num += 1 + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(short_key) + details = {'name': name, 'serial_key': short_key} + certificate = create_python_workshop_certificate(certificate_path, details, + qrcode, type, paper, workshop, file_name, college, ws_date, is_coordinator,format) + if not certificate[1]: + certi_obj = Certificate(name=name, email=email, + serial_no=serial_no, counter=1, workshop=workshop, + paper=paper, serial_key=serial_key, short_key=short_key) + certi_obj.save() + return certificate[0] + + if certificate[1]: + _clean_certificate_certificate(certificate_path, file_name) + context['error'] = True + context['err'] = certificate[0] + return render_to_response('python_workshop_download.html', context, ci) + context['message'] = '' + return render_to_response('python_workshop_download.html', context, ci) + +def create_python_workshop_certificate(certificate_path, name, qrcode, type, paper, workshop, file_name, college, ws_date, is_coordinator=False,format='iscp'): + error = False + err = None + try: + download_file_name = None + if format=='iscp': # use templates based on 3day or 1day workshop + if is_coordinator: + template = 'coordinator_template_PWS2017Pcertificate' + else: + template = 'template_PWS2017Pcertificate' + elif format=='sel': + template = '3day_template_self_certificate' + else: + if is_coordinator: + template = '3day_coordinator_template_PWS2017Pcertificate' + else: + template = '3day_template_PWS2017Pcertificate' + + download_file_name = 'PWS%sPcertificate.pdf' % ws_date.split()[-1] + 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['name'].title(), + serial_key=name['serial_key'], qr_code=qrcode, college=college, paper=paper, ws_date=ws_date) + create_tex = open('{0}{1}.tex'.format\ + (certificate_path, file_name), 'w') + create_tex.write(content_tex) + create_tex.close() + return_value, err = _make_certificate_certificate(certificate_path, + type, file_name) + if return_value == 0: + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + response = HttpResponse(content_type='application/pdf') + response['Content-Disposition'] = 'attachment; \ + filename=%s' % (download_file_name) + response.write(pdf.read()) + _clean_certificate_certificate(certificate_path, file_name) + return [response, False] + else: + error = True + except Exception, e: + error = True + return [None, error] + + +@csrf_exempt +def scipy_feedback_2017(request): + return render_to_response('scipy_feedback_2017.html') + +@csrf_exempt +def scipy_download_2017(request): + context = {} + err = "" + ci = RequestContext(request) + cur_path = os.path.dirname(os.path.realpath(__file__)) + certificate_path = '{0}/scipy_template_2017/'.format(cur_path) + + if request.method == 'POST': + paper = request.POST.get('paper', None) + workshop = None + email = request.POST.get('email').strip() + attendee_type = request.POST.get('type') + user = Scipy_2017.objects.filter(email=email, attendee_type=attendee_type) + if not user: + context["notregistered"] = 1 + return render_to_response('scipy_download_2017.html', context, context_instance=ci) + elif len(user) > 1: + context["duplicate"] = True + return render_to_response('scipy_download_2017.html', context, context_instance=ci) + else: + user = user[0] + name = user.name + email = user.email + purpose = user.purpose + paper = user.paper + year = '17' + id = int(user.id) + hexa = hex(id).replace('0x','').zfill(6).upper() + serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, attendee_type) + serial_key = (hashlib.sha1(serial_no)).hexdigest() + file_name = '{0}{1}'.format(email,id) + file_name = file_name.replace('.', '') + + + try: + old_user = Certificate.objects.get(email=email, serial_no=serial_no) + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + details = {'name': name, 'serial_key': old_user.short_key, 'email' : email} + certificate = create_scipy_certificate_2017(certificate_path, details, qrcode, attendee_type, paper, workshop, file_name) + if not certificate[1]: + old_user.counter = old_user.counter + 1 + old_user.save() + #context['error'] = False + return certificate[0] + #render_to_response( 'scipy_download_2017.html', context) + except Certificate.DoesNotExist: + uniqueness = False + num = 5 + while not uniqueness: + present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) + if not present: + short_key = serial_key[0:num] + uniqueness = True + else: + num += 1 + qrcode = 'http://fossee.in/certificates/verify/{0} '.format(short_key) + details = {'name': name, 'serial_key': short_key, 'email': email} + certificate = create_scipy_certificate_2017(certificate_path, details, + qrcode, attendee_type, paper, workshop, file_name) + if not certificate[1]: + certi_obj = Certificate(name=name, email=email, serial_no=serial_no, + counter=1, workshop=workshop, paper=paper, serial_key=serial_key, short_key=short_key) + certi_obj.save() + return certificate[0] #render(request, 'scipy_download_2017.html') + + if certificate[1]: + _clean_certificate_certificate(certificate_path, file_name) + context['error'] = True + return render_to_response('scipy_download_2017.html', context, ci) + context['message'] = '' + return render_to_response('scipy_download_2017.html', context, ci) + + +@csrf_exempt +def create_scipy_certificate_2017(certificate_path, name, qrcode, attendee_type, paper, workshop, file_name): + error = False + try: + template = 'template_SPC2017%scertificate' % attendee_type + download_file_name = 'SPC2017%scertificate.pdf' % attendee_type + template_file = open('{0}{1}'.format\ + (certificate_path, template), 'r') + content = Template(template_file.read()) + template_file.close() + if attendee_type == 'P' or attendee_type == 'T': + content_tex = content.safe_substitute(name=name['name'].title(), + serial_key=name['serial_key'], qr_code=qrcode) + else: + content_tex = content.safe_substitute(name=name['name'].title(), + serial_key=name['serial_key'], qr_code=qrcode, paper=paper) + create_tex = open('{0}{1}.tex'.format\ + (certificate_path, file_name), 'w') + create_tex.write(content_tex) + create_tex.close() + return_value, err = _make_certificate_certificate(certificate_path, attendee_type, file_name) + + + if return_value == 0: + pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + response = HttpResponse(content_type='application/pdf') + response['Content-Disposition'] = 'attachment; \ + filename=%s' % (download_file_name) + response.write(pdf.read()) + _clean_certificate_certificate(certificate_path, file_name) + return [response, False] + else: + error = True + except Exception, e: + error = True + return [None, error] + +@csrf_exempt +def contact(request): + """ +This view function is used to submit contact form, It used Google's reCAPTCHA validation +""" + + if request.method == 'POST': + form = ContactForm(request.POST) + if form.is_valid(): + name = form.cleaned_data['name'] + from_email = form.cleaned_data['email'] + ws_date = form.cleaned_data['date'] + category = form.cleaned_data['category'] + subject = form.cleaned_data['subject'] + message = form.cleaned_data['message'] + msg = "Name : {0} \n Workshop Date:{1} \n Category:{2} \n Message:{3}".format(name,ws_date,category,message) + recaptcha_response = request.POST.get('g-recaptcha-response') + url = 'https://www.google.com/recaptcha/api/siteverify' + values = { + 'secret': settings.GOOGLE_RECAPTCHA_SECRET_KEY, + 'response': recaptcha_response + } + data = urllib.urlencode(values) + req = urllib2.Request(url, data=data) + response = urllib2.urlopen(req) + result = json.load(response) + if result['success']: + done = sending_emails.send_email(subject,from_email,msg) + if done: + return HttpResponse('We have received your message and would like to thank you for writing to us. We will reply by email as soon as possible.') + else: + return HttpResponse('Email your query/issue to certificates[at]fossee[dot]in') + else: + return render(request,'contact_us.html',{'form':form}) + else: + return render(request,'contact_us.html',{'form':form}) + else: + form = ContactForm() + return render(request,'contact_us.html',{'form':form}) diff --git a/fossee_project/settings.py b/fossee_project/settings.py index 4731d89..a9f9eff 100644 --- a/fossee_project/settings.py +++ b/fossee_project/settings.py @@ -1,18 +1,17 @@ """ 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 import DBNAME, DBUSER, DBPASS +#from local 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__)) +from certificate.google_secret import GOOGLE_RECAPTCHA_SECRET_KEY # Quick-start development settings - unsuitable for production @@ -22,7 +21,7 @@ SECRET_KEY = 'j_4@2e^e*byl1c2@^=^)bo75r5h$l01aa8*)ladv7+8druq6f*' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False TEMPLATE_DEBUG = True @@ -74,6 +73,11 @@ 'USER' : DBUSER, 'PASSWORD': DBPASS, } + + # 'default': { + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': 'mydatabase', + # } } # Internationalization @@ -94,3 +98,33 @@ # https://docs.djangoproject.com/en/1.6/howto/static-files/ STATIC_URL = '/static/' +# Set this varable to <True> if smtp-server is not allowing to send email. +EMAIL_USE_TLS = True + +EMAIL_HOST = 'smtp-auth.iitb.ac.in' + +EMAIL_PORT = 25 + +EMAIL_HOST_USER = '' + +EMAIL_HOST_PASSWORD = '' + +# Set EMAIL_BACKEND to 'django.core.mail.backends.smtp.EmailBackend' +# in production +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' + + +# SENDER_EMAIL, REPLY_EMAIL, PRODUCTION_URL, IS_DEVELOPMENT are used in email +# verification. Set the variables accordingly to avoid errors in production + +# This email id will be used as <from address> for sending emails. +# For example no_reply@<your_organization>.in can be used. +#SENDER_EMAIL = 'your_email' + +# Organisation/Indivudual Name. +#SENDER_NAME = '' + +# This email id will be used by users to send their queries +# For example queries@<your_organization>.in can be used. +#REPLY_EMAIL = '' +