001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.time.base.web;
017    
018    import org.kuali.hr.time.service.base.TkServiceLocator;
019    import org.kuali.hr.time.util.TKContext;
020    import org.kuali.hr.time.util.TKUser;
021    import org.kuali.rice.core.api.config.property.ConfigContext;
022    import org.kuali.rice.kns.web.struts.form.KualiForm;
023    
024    public class TkForm extends KualiForm {
025    
026            private static final long serialVersionUID = -3945893347262537122L;
027    
028            private String methodToCall;
029            private String principalId;
030        private String documentId;
031    
032            public String getMethodToCall() {
033                    return methodToCall;
034            }
035    
036            public void setMethodToCall(String methodToCall) {
037                    this.methodToCall = methodToCall;
038            }
039    
040            public String getPrincipalId() {
041                    return principalId;
042            }
043    
044            public void setPrincipalId(String principalId) {
045                    this.principalId = principalId;
046            }
047            
048        public String getDocumentId() {
049            return documentId;
050        }
051    
052        public void setDocumentId(String documentId) {
053            this.documentId = documentId;
054        }
055            
056            public String getWorkflowUrl(){
057                    return ConfigContext.getCurrentContextConfig().getProperty("workflow.url");
058            }
059            
060            public String getDocumentIdFromContext(){
061                    return TKContext.getCurrentTimesheetDocumentId();
062            }
063    
064        public String getDocumentStatus() {
065            return TKContext.getCurrentTimesheetDocument().getDocumentHeader().getDocumentStatus();
066        }
067    
068        public String getLeaveCalendarDocumentStatus() {
069            return TKContext.getCurrentLeaveCalendarDocument().getDocumentHeader().getDocumentStatus();
070        }
071        
072        public boolean getLeaveEnabled() {
073            boolean canViewLeaveTab= false;
074            canViewLeaveTab = this.getViewLeaveTabsWithNEStatus() || TkServiceLocator.getPermissionsService().canViewLeaveTabsWithEStatus();
075            return canViewLeaveTab; 
076        }
077        
078        public boolean getTimeEnabled() {
079            return TkServiceLocator.getPermissionsService().canViewTimeTabs();
080        }
081        
082        public String getLeaveDocumentIdFromContext(){
083                    return TKContext.getCurrentLeaveCalendarDocumentId();
084            }
085     
086        public boolean getViewLeaveTabsWithNEStatus() {
087            return TkServiceLocator.getPermissionsService().canViewLeaveTabsWithNEStatus();
088        }
089    }