Commit 31eb698e authored by Aashish Lokhande's avatar Aashish Lokhande
Browse files

*** empty log message ***

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+28 −0
Original line number Diff line number Diff line
# CVS default ignores begin
tags
TAGS
.make.state
.nse_depinfo
*~
#*
.#*
,*
_$*
*$
*.old
*.bak
*.BAK
*.orig
*.rej
.del-*
*.a
*.olb
*.o
*.obj
*.so
*.exe
*.Z
*.elc
*.ln
core
# CVS default ignores end

address.lisp

0 → 100755
+128 −0
Original line number Diff line number Diff line
;;;; This file is part of Aspiwork Project Data Management Server
;;;; Name:          address.lisp
;;;; Purpose:       
;;;; Programmer:    Aashish R Lokhande
;;;; Copyright (C) 2010,2011 Aashish R Lokhande
;;;; All rights reserved.
;;;;
;;;; Redistribution and use in source and binary forms, with or without
;;;; modification, are permitted provided that the following conditions
;;;; are met:
;;;; 1. Redistributions of source code must retain the above copyright
;;;;    notice, this list of conditions and the following disclaimer.
;;;; 2. Redistributions in binary form must reproduce the above copyright
;;;;    notice, this list of conditions and the following disclaimer in the
;;;;    documentation and/or other materials provided with the distribution.
;;;; 3. Neither the name of the author nor the names of its contributors
;;;;    may be used to endorse or promote products derived from this software
;;;;    without specific prior written permission.
;;;;
;;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
;;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
;;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
;;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
;;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
;;;; SUCH DAMAGE.

(defcomponent address-manipulator ()
  ((address :accessor address :initarg :address :backtrack t
	   :initform (make-instance 'address))))

(defcomponent show-address (address-manipulator)
  ())

(defmethod render ((self show-address))
  (let ((taddress (address self)))
    (<:p (<:ah "Address"))
    (in-table 
     ((<:label "Line1:") (<:ah (line1 taddress)))
     ((<:label "Line2:") (<:ah (line2 taddress)))
     ((<:label "State:") (<:ah (state taddress)))
     ((<:label "Pin:") (<:ah (pincode taddress)))
     ((<:label "Phone:") (<:ah (phone taddress)))
     ((<:label "Mobile:") (<:ah (mobile taddress)))
     ((<:label "Fax:") (<:ah (fax taddress)))
     ((<:label "Email:") (<:ah (email taddress)))
     ((<:label "Website:") (<:ah (website taddress))))))

(defcomponent get-address (address-manipulator)
  ())

(defmethod render ((self get-address))
  (let ((taddress (address self)))    
    (in-table 
     ((<:label "Line1:")
      (<ucw:input :type "text" 
		  :accessor (line1 taddress)))
     ((<:label "Line2:")
      (<ucw:input :type "text" 
		  :accessor (line2 taddress)))
     ((<:label "State:")
      (<ucw:input :type "text" 
		  :accessor (state taddress)))
     ((<:label "Pin:")
      (<ucw:input :type "text" 
		  :accessor (pincode taddress)))
     ((<:label "Phone:")
      (<ucw:input :type "text" 
		  :accessor (phone taddress)))
     ((<:label "Mobile:")
      (<ucw:input :type "text" 
		  :accessor (mobile taddress)))
     ((<:label "Fax:")
      (<ucw:input :type "text" 
		  :accessor (fax taddress)))
     ((<:label "Email:")
      (<ucw:input :type "text" 
		  :accessor (email taddress)))
     ((<:label "Website:")
      (<ucw:input :type "text" 
		  :accessor (website taddress))))))    

(defgeneric validate-address (address)
  (:documentation ""))

(defmethod validate-address ((address address))
  (let ((st "")(pn "")(ph "")(mb "")(fx "")(em ""))
    (progn
      (setf (slot-value address 'line1) (sanitize-input (line1 address)))
      (setf (slot-value address 'line2) (sanitize-input (line2 address)))      
      (when (position-if-not #'alpha-char-p (state address))
	  (setf st "State "))
      (when (position-if-not #'digit-char-p (pincode address))
	  (setf pn "Pin "))
      (when (position-if-not #'digit-char-p (phone address))
	  (setf ph "Phone "))
      (when (position-if-not #'digit-char-p (mobile address))
	  (setf mb "Mobile "))
      (when (position-if-not #'digit-char-p (fax address))
	  (setf fx "Fax "))
      (if (or (not (find #\@ (email address))) 
	      (not (find #\. (email address))))
	  (setf em "Email ")))
   (concatenate 'string st pn ph mb fx em)))

(defun next-address-id ()
  (if (= 0 (car (clsql:select [count [*]] :from [addresses] :flatp t)))
      1
      (+ 1 (car 
	    (clsql:select [max [id]] 
			  :from [addresses]
			  :flatp t)))))

(defun insert-update-address (obj)
  (if (slot-boundp obj 'id)
      (clsql:update-records-from-instance obj)
      (clsql:with-transaction ()	  
	(setf (id obj) (next-address-id))
	(clsql:update-records-from-instance obj))))

(defun address-from-id (id)
  (car (clsql:select 'address
		      :where [= [id] id]
		      :flatp t)))

agency.lisp

0 → 100755
+185 −0
Original line number Diff line number Diff line
;;;; This file is part of Aspiwork Project Data Management server
;;;; Name:          agency.lisp
;;;; Purpose:       
;;;; Programmer:    Aashish R Lokhande
;;;; Copyright (C) 2010,2011 Aashish R Lokhande
;;;; All rights reserved.
;;;;
;;;; Redistribution and use in source and binary forms, with or without
;;;; modification, are permitted provided that the following conditions
;;;; are met:
;;;; 1. Redistributions of source code must retain the above copyright
;;;;    notice, this list of conditions and the following disclaimer.
;;;; 2. Redistributions in binary form must reproduce the above copyright
;;;;    notice, this list of conditions and the following disclaimer in the
;;;;    documentation and/or other materials provided with the distribution.
;;;; 3. Neither the name of the author nor the names of its contributors
;;;;    may be used to endorse or promote products derived from this software
;;;;    without specific prior written permission.
;;;;
;;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
;;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
;;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
;;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
;;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
;;;; SUCH DAMAGE.

(defcomponent agency-manipulator ()
  ((agency :accessor agency :initarg :agency :backtrack t
            :initform (make-instance 'agency))))

(defcomponent show-agency (agency-manipulator)
  ())

(defmethod render ((self show-agency))
  (let ((tagency (agency self)))
    (<:p (<:ah "Basic Agency Information"))
    (in-table
     ((<:label "Agency Name")
      (<:ah (name tagency)))
     ((<:label "Agency Code")
      (<:ah (code tagency)))
     ((<:label "Agency Info")
      (<:ah (info tagency))))
    (<:p (<:ah "Address"))
    (render 'show-address 
	    :address (address-from-id (address-id tagency)))))

(defcomponent get-agency (agency-manipulator holder)
  ()
  (:default-initargs :message "Agency Editor"))

(defmethod render :wrapping ((self get-agency))
  (call-next-method)
  (let* ((user $user)
	 (tagency (agency self))	
	 (taddress (if (slot-boundp tagency 'id)
		       (address tagency)
		       (make-instance 'address))))
    (<ucw:form :action (update-agency self tagency taddress user) 
	       :method "post"
	       (<:p "Basic Agency Information")
	       (in-table
		((<:label "Agency Code")
		 (<ucw:input :type "text" 
			     :accessor (code tagency)))
		((<:label "Agency Name")
		 (<ucw:input :type "text" 
			     :accessor (name tagency)))		
		((<:label "Agency Info")
		 (<ucw:input :type "text" 
			     :accessor (info tagency))))
	       (<:p (<:ah "Address"))
	       (render (make-instance 'get-address :address taddress))
	       (<:table 
		:style "margin:auto;"
		(<:tr 
		 (<:td :align "right"
		       (<:input :type "submit" :value "Submit" )))))))

(defaction update-agency ((self get-agency)(tagency agency)
			  (taddress address)(user employee))
  (let ((user $user))
  (if (string= "" (name tagency))
      (setf (message self) "Error: Name")  
      (progn
	(insert-update-address taddress)
	(if (slot-boundp tagency 'id)
	    (progn
	      (setf (modifier-id tagency) (id user))
	      (setf (modified-date tagency) (clsql:get-time)))
	    (progn
	      (setf (slot-value tagency 'address-id) (id taddress))
	      (setf (creater-id tagency) (id user))
	      (setf (created-date tagency) (clsql:get-time))))
	(insert-update-agency tagency)
	(answer)))))

(defaction view-agency (id)
  (call-component $holder (make-instance 
			   'show-agency :agency (agency-from-id id))))

(defaction edit-agency (id)
  (call-component $holder (make-instance 
			   'get-agency :agency (agency-from-id id))))

(defcomponent list-agencies (holder)
  ()(:default-initargs :message "Agency List"))

(defmethod render :wrapping ((lc list-agencies))
  (call-next-method)
  (let* ((user $user)
	 (ag-list (agency-tlist))
	 (ag-id 0))
    (<ucw:a 
     :action (call-component 
	      $holder (make-instance 'get-agency))
     "New Agency")
    (<:hr)
    (<ucw:form 
     :action (edit-agency cl-id)
     (<:table 
      :border 1 :style "margin:auto;"
      (<:tr (<:th "Code") (<:th "Name") (<:th "Select"))
      (loop for (id a b) in ag-list
	 do (<:tr (<:td (<:ah a)) (<:td (<:ah b))
		  (<:td (<ucw:input :type "radio" :name "selected"
				    :accessor ag-id :value id))))
      (<:tr 
       (<:td :align "right" :colspan 3
	     (<:input :type "submit" :value "Edit")))))))

(defun next-agency-id ()
  (if (= 0 (car (clsql:select [count [*]] :from [agencies] :flatp t)))
      1
      (+ 1 (car 
	    (clsql:select [max [id]] 
			  :from [agencies]
			  :flatp t)))))

(defun insert-update-agency (obj)
  (if (slot-boundp obj 'id)
      (clsql:update-records-from-instance obj)
      (clsql:with-transaction ()	  
	(setf (id obj) (next-agency-id))
	(clsql:update-records-from-instance obj))))

(defun agency-from-id (ag-id);object
  (car (clsql:select 'agency   
		:where [=[slot-value 'agency 'id] ag-id]
		:flatp t)))

(defun agency-name-from-id (ag-id);name string  
   (car (clsql:select [slot-value 'agency 'name]
		      :from [agencies]
		      :where [=[slot-value 'agency 'id] ag-id]
		      :field-names nil)))

(defun agency-tlist ();table
  (clsql:select
   [slot-value 'agency 'id] 
   [slot-value 'agency 'code]
   [slot-value 'agency 'name]   
   :from [agencies]
   :field-names nil))

(defun agencies-from-prjid (prj-id);name-table
  (clsql:select
   [slot-value 'agency 'name]      
   :from '([agencies] [project-agencies])
   :where [and
   [= [slot-value 'project-agency 'project-id] prj-id]
   [= [slot-value 'project-agency 'agency-id] [slot-value 'agency 'id]]]
   :field-names nil))

(defun agency-ddlist ();for drop-down-list
  (clsql:select 
   [slot-value 'agency 'id] 
   [slot-value 'agency 'name]   
   :from [agencies]
   :field-names nil))
 No newline at end of file

aspiwork-pdm.asd

0 → 100644
+62 −0
Original line number Diff line number Diff line
;;;; This file is part of Aspiwork Project Data Management System
;;;; Name:          aspiwork-pdm.asd
;;;; Purpose:       
;;;; Programmer:    Aashish R Lokhande
;;;; Copyright (C) 2010,2011 Aashish R Lokhande
;;;; All rights reserved.
;;;;
;;;; Redistribution and use in source and binary forms, with or without
;;;; modification, are permitted provided that the following conditions
;;;; are met:
;;;; 1. Redistributions of source code must retain the above copyright
;;;;    notice, this list of conditions and the following disclaimer.
;;;; 2. Redistributions in binary form must reproduce the above copyright
;;;;    notice, this list of conditions and the following disclaimer in the
;;;;    documentation and/or other materials provided with the distribution.
;;;; 3. Neither the name of the author nor the names of its contributors
;;;;    may be used to endorse or promote products derived from this software
;;;;    without specific prior written permission.
;;;;
;;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
;;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
;;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
;;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
;;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
;;;; SUCH DAMAGE.

(defpackage :aspiwork-pdm.system
  (:use :cl :asdf))

(in-package :aspiwork-pdm.system)

(defsystem aspiwork-pdm
  :description "Aspiwork Product/Project Data Management Server"
  :author "Aashish Lokhande <aashish.atllp@gmail.com>"
  :version "0.4.3"
  :serial t
  :depends-on (:ucw )
  :components ((:file "package")
	       (:file "pdm-server")
	       (:file "db")
	       (:file "helper")
	       (:file "main")
	       (:file "login")
	       (:file "user-dashboard")
	       (:file "address")
	       (:file "company")
	       (:file "department")
	       (:file "designation")
	       (:file "permission")
	       (:file "person")
	       (:file "employee")
	       (:file "resource-category")
	       (:file "project")
	       (:file "project-dashboard")
	       (:file "resource")
	       (:file "customer")
	       (:file "agency")))

authors

0 → 100755
+1 −0
Original line number Diff line number Diff line
Aashish R Lokhande <aashish.atl@mtnl.net.in>
Loading