Index: sakai-lamstwo/.classpath =================================================================== diff -u --- sakai-lamstwo/.classpath (revision 0) +++ sakai-lamstwo/.classpath (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: sakai-lamstwo/.cvsignore =================================================================== diff -u --- sakai-lamstwo/.cvsignore (revision 0) +++ sakai-lamstwo/.cvsignore (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,2 @@ +*.class +target \ No newline at end of file Index: sakai-lamstwo/.project =================================================================== diff -u --- sakai-lamstwo/.project (revision 0) +++ sakai-lamstwo/.project (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,19 @@ + + + lamstwo + + + component-api + component-impl + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + Index: sakai-lamstwo/.sakaiapp =================================================================== diff -u --- sakai-lamstwo/.sakaiapp (revision 0) +++ sakai-lamstwo/.sakaiapp (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,10 @@ +This project initially constructed by Sakai App Builder Plugin +Used the following settings: +Project Name: lamstwo +Project Key: lamstwo +Project CamelCase Key: Lamstwo +Project lowerCamelCase Key: lamstwo +Project Type: JSF +Project Impl: CRUD + +Sakai App Builder by Aaron Zeckoski (aaronz@vt.edu) \ No newline at end of file Index: sakai-lamstwo/.svnignore =================================================================== diff -u --- sakai-lamstwo/.svnignore (revision 0) +++ sakai-lamstwo/.svnignore (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,2 @@ +target +bin Index: sakai-lamstwo/README.txt =================================================================== diff -u --- sakai-lamstwo/README.txt (revision 0) +++ sakai-lamstwo/README.txt (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,25 @@ +This project was generated by Sakai App Builder -AZ +To use this project, you should copy this entire folder and all the files +into your sakai source directory. If you do not know what that is you may +want to check this website out: + http://bugs.sakaiproject.org/confluence/display/BOOT + +Now that you have copied this over to your sakai source directory (or maybe it +was already there), you should run the following command from within the root directory of your new project to download all the +dependencies using maven and compile the code: + maven bld + +Now you can import the project into eclipse (using the current location) +or continue using it in eclipse if you created it in your sakai source tree. + +Frequently Asked Questions: +Q: I have missing dependencies in the project I just created in Eclipse, what do I do? +A: You need to run 'maven bld' in the project root directory first to download the +dependencies using maven. Then do a clean and build in Eclipse and the errors will +go away. + +Q: How do I create multiple eclipse projects like some Sakai tools do? +A: This plugin does not support that practice. You are welcome to split things +apart if you like though I do not recommend that. + +Comments or questions about the plugin should go to Aaron Zeckoski (aaronz@vt.edu) \ No newline at end of file Index: sakai-lamstwo/api/logic/project.xml =================================================================== diff -u --- sakai-lamstwo/api/logic/project.xml (revision 0) +++ sakai-lamstwo/api/logic/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,62 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-logic-api + sakaiproject + sakai-lamstwo-logic-api + ${sakai.version} + + Sakai Project + http://www.sakaiproject.org/ + + 2006 + + + + jar + shared + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + sakaiproject + sakai-lamstwo-model-api + ${sakai.version} + + + + + generic-dao + generic-dao + 0.8 + http://source.edtech.vt.edu/maven/ + + + + + sakaiproject + sakai-entity-api + ${sakai.version} + + + + + + src/java + + + + Index: sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/dao/LamstwoDao.java =================================================================== diff -u --- sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/dao/LamstwoDao.java (revision 0) +++ sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/dao/LamstwoDao.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,23 @@ +/****************************************************************************** + * LamstwoDao.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.dao; + +import org.sakaiproject.genericdao.api.CompleteGenericDao; + +/** + * This is a specialized DAO that allows the developer to extend + * the functionality of the generic dao package + * @author Sakai App Builder -AZ + */ +public interface LamstwoDao extends CompleteGenericDao { + +} Index: sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/LamstwoLogic.java =================================================================== diff -u --- sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/LamstwoLogic.java (revision 0) +++ sakai-lamstwo/api/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/LamstwoLogic.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,193 @@ +/****************************************************************************** + * LamstwoLogic.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic; + +import java.util.List; + +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; + +/** + * This is the interface for the app Logic, + * @author Sakai App Builder -AZ + */ +public interface LamstwoLogic { + + /** + * This returns an item based on an id + * @param id the id of the item to fetch + * @return a LamstwoItem or null if none found + */ + public LamstwoItem getItemById(Long id); + + /** + * Check if the current user can write this item in the current site + * @param item to be modifed or removed + * @return true if item can be modified, false otherwise + */ + public boolean canWriteItem(LamstwoItem item); + + /** + * Check if a specified user can write this item in a specified site + * @param item to be modified or removed + * @param siteId the Sakai id of the site + * @param userId the Sakai id of the user + * @return true if item can be modified, false otherwise + */ + public boolean canWriteItem(LamstwoItem item, String siteId, String userId); + + /** + * This returns a List of items for the current site that are + * visible to the current user + * @return a List of LamstwoItem objects + */ + public List getAllVisibleItems(); + + /** + * This returns a List of items for a specified site that are + * visible to the specified user + * @param siteId siteId of the site + * @param userId the Sakai id of the user + * @return a List of LamstwoItem objects + */ + public List getAllVisibleItems(String siteId, String userId); + + /** + * Save (Create or Update) an item (uses the current site) + * @param item the LamstwoItem to create or update + */ + public void saveItem(LamstwoItem item); + + /** + * Remove an item + * @param item the LamstwoItem to remove + */ + public void removeItem(LamstwoItem item); + + /** + * Get the display name for the current user + * @return display name (probably firstname lastname) + */ + public String getCurrentUserDisplayName(); + + /** + * Get all available learning designs from LAMS + * @param username + * @param courseID + * @param mode + * @param countryCode + * @param langCode + * @return LAMS learning designs + */ + public String getLearningDesigns(Integer mode); + /** + * Start a lesson + * @param username + * @param ldId + * @param courseId + * @param title + * @param desc + * @param countryCode + * @param langCode + * @return LAMS ?? + */ + public Long startLesson(long ldId, + String title, String desc); + + /** + * Schedule a lesson + * @param username + * @param ldId + * @param courseId + * @param title + * @param desc + * @param startDate + * @param countryCode + * @param langCode + * @return LAMS ?? + */ + public Long scheduleLesson(long ldId, + String title, String desc, String startDate); + + /** + * Delete a Lesson + * @param username + * @param lsId + * @return ?? + */ + public boolean deleteLesson(long lsId); + + + /** + * Get the LAMS Server ID from sakai.properties + * @return LAMS Server ID + */ + public String getServerID(); + + /** + * Get the LAMS Server Key from sakai.properties + * @return LAMS Server Key + */ + public String getServerKey(); + + /** + * Get the LAMS Server Address from sakai.properties + * @return LAMS Server Address + */ + public String getServerAddress(); + + /** + * Get the Request Source from sakai.properties + * @return Request Source + */ + public String getRequestSource(); + + /** + * Generates a hash of the the strings in element in the order they are presented + * and compares this to hash + * + * @param elements An ordered collection of strings used to generate the hash + * @param hash The hash to compare against + * @return Whether the two hashes match + */ + public boolean isHashValid(String[] elements, String hash); + + /** + * + * @param username A sakai user + * @return A comma separated list of values containing the users information + */ + public String getUserInfo(String username); + + /** + * Connstructs URL to open the LAMS authoring environment + * @return LAMS authoring URL + */ + public String getAuthorURL(); + + /** + * Connstructs URL to open the LAMS Learning environment + * @return LAMS learning URL + */ + public String getLearnerURL(); + + /** + * Connstructs URL to open the LAMS monitoring environment + * @return LAMS monitoring URL + */ + public String getMonitorURL(); + + /** + * Checks whether user can create a new item. + * @return True if user has a maintainer role, otherwise false. + */ + public Boolean canCreateItem(); +} Index: sakai-lamstwo/api/model/project.xml =================================================================== diff -u --- sakai-lamstwo/api/model/project.xml (revision 0) +++ sakai-lamstwo/api/model/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,31 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-model-api + sakaiproject + sakai-lamstwo-model-api + ${sakai.version} + + Sakai Project + http://www.sakaiproject.org/ + + 2006 + + + + jar + shared + + + + + + + + src/java + + + + Index: sakai-lamstwo/api/model/src/java/model-readme.txt =================================================================== diff -u --- sakai-lamstwo/api/model/src/java/model-readme.txt (revision 0) +++ sakai-lamstwo/api/model/src/java/model-readme.txt (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,39 @@ +This file generated by Sakai App Builder -AZ +POJOs can be generated using the Hibernate Tools available here: +http://tools.hibernate.org/ + +Steps to generate are as follows: +1) Make sure you have a hibernate properties file +(use the one that already exists in your project if there is one) +* It is best to get one from another project if possible, here is sample text: +# This properties file defines the connection to the HSQLDB database +hibernate.connection.driver_class=org.hsqldb.jdbcDriver + +hibernate.connection.url=jdbc:hsqldb:. +hibernate.connection.username=sa +hibernate.connection.password= + +hibernate.dialect=org.hibernate.dialect.HSQLDialect + +#hibernate.show_sql=true +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create +hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider + +2) Make sure you have a Hibernate config file in the eclipse project somewhere +* Create one using File -> New -> Other -> Hibernate -> Hibernate Config File +(Use the one that already exists if you already have one) +3) Make sure you have a Hibernate console config in the eclipse project somewhere +* Create one using File -> New -> Other -> Hibernate -> Hibernate Console Config +** Select your created property file +** Select your created configuration file +** Add all the mapping files in the project to the list of mapping files +** Add in the HSQL driver jar (probably in your maven repository) +4) Run -> Hibernate Code Generation -> Hibernate Code Generation +5) Create a new generator (call it evaluation_generator or something like that) +6) Set the output directory to the root source directory of the model directory +* Example: model/src/java +7) Check the Domain code box under the exporters tab +8) Run the code generator to create the POJOs + +*Instructions by Aaron Zeckoski (aaronz@vt.edu)* \ No newline at end of file Index: sakai-lamstwo/api/model/src/java/org/lamsfoundation/lams/integrations/sakai/model/LamstwoItem.java =================================================================== diff -u --- sakai-lamstwo/api/model/src/java/org/lamsfoundation/lams/integrations/sakai/model/LamstwoItem.java (revision 0) +++ sakai-lamstwo/api/model/src/java/org/lamsfoundation/lams/integrations/sakai/model/LamstwoItem.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,139 @@ +/****************************************************************************** + * LamstwoItem.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.model; + +import java.util.Date; + +/** + * This is a sample POJO (data storage object) + * @author Sakai App Builder -AZ + */ +public class LamstwoItem { + + private Long id; + private String title; + private String introduction; + private Long sequenceId; + private Long lessonId; + private String ownerId; // Sakai userId + private String siteId; // Sakai siteId + private Boolean hidden; // only visible to owner if true + private Boolean schedule; + private Date startDate; + private Date dateCreated; + + /** + * Default constructor + */ + public LamstwoItem() { + } + + /** + * Minimal constructor + */ + public LamstwoItem(String title, String introduction, + String ownerId, String siteId) { + this.title = title; + this.introduction = introduction; + this.ownerId = ownerId; + this.siteId = siteId; + } + + /** + * Full constructor + */ + public LamstwoItem(String title, String introduction, + Long sequenceId, Long lessonId, String ownerId, String siteId, + Boolean hidden, Boolean schedule, Date startDate, + Date dateCreated) { + this.title = title; + this.introduction = introduction; + this.sequenceId = sequenceId; + this.lessonId = lessonId; + this.ownerId = ownerId; + this.siteId = siteId; + this.hidden = hidden; + this.schedule = schedule; + this.startDate = startDate; + this.dateCreated = dateCreated; + } + + /** + * Getters and Setters + */ + public Boolean getHidden() { + return hidden; + } + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public String getIntroduction() { + return this.introduction; + } + public void setIntroduction(String introduction) { + this.introduction = introduction; + } + public Long getSequenceId() { + return sequenceId; + } + public void setSequenceId(Long sequenceId) { + this.sequenceId = sequenceId; + } + public Long getLessonId() { + return lessonId; + } + public void setLessonId(Long lessonId) { + this.lessonId = lessonId; + } + public Date getDateCreated() { + return dateCreated; + } + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + public String getOwnerId() { + return ownerId; + } + public void setOwnerId(String ownerId) { + this.ownerId = ownerId; + } + public String getSiteId() { + return siteId; + } + public void setSiteId(String siteId) { + this.siteId = siteId; + } + public Boolean getSchedule() { + return schedule; + } + public void setSchedule(Boolean schedule) { + this.schedule = schedule; + } + public Date getStartDate() { + return startDate; + } + public void setStartDate(Date startDate) { + this.startDate = startDate; + } +} Index: sakai-lamstwo/impl/dao/project.xml =================================================================== diff -u --- sakai-lamstwo/impl/dao/project.xml (revision 0) +++ sakai-lamstwo/impl/dao/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,173 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-dao-impl + sakaiproject + sakai-lamstwo-dao-impl + ${sakai.version} + + Sakai Project + http://www.sakaiproject.org/ + + 2006 + + + + jar + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + sakaiproject + sakai-lamstwo-model-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-logic-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-hbm + ${sakai.version} + + + + + generic-dao + generic-dao + 0.8 + http://source.edtech.vt.edu/maven/ + + + + + ${sakai.spring.groupId} + ${sakai.spring.artifactId} + ${sakai.spring.version} + + + + ${sakai.hibernate.groupId} + ${sakai.hibernate.artifactId} + ${sakai.hibernate.version} + + + + + antlr + antlr + 2.7.6 + + + + + commons-logging + commons-logging + 1.0.4 + + + + + ${sakai.spring.groupId} + ${sakai.spring.mock.artifactId} + ${sakai.spring.mock.version} + + + + hsqldb + hsqldb + 1.8.0.5 + + + + dom4j + dom4j + 1.6.1 + + + + jta + jta + h2.1.8 + + + + cglib + cglib-nodep + 2.1_3 + + + + commons-codec + commons-codec + 1.3 + + + + commons-collections + commons-collections + 3.1 + + + + ehcache + ehcache + 1.1 + + + + easymock + easymock + 1.2_Java1.3 + + + + + + + + src/java + + + src/test + + + **/*Test.java + + + + ${basedir}/../pack/src/webapp/WEB-INF + + spring-hibernate.xml + + + + ${basedir}/src/test + + hibernate-test.xml + hibernate.properties + + + + + + + + + Index: sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/LamstwoDaoImpl.java =================================================================== diff -u --- sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/LamstwoDaoImpl.java (revision 0) +++ sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/LamstwoDaoImpl.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,37 @@ +/****************************************************************************** + * LamstwoDaoImpl.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.dao.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao; +import org.sakaiproject.genericdao.hibernate.HibernateCompleteGenericDao; + + +/** + * Implementations of any specialized DAO methods from the specialized DAO + * that allows the developer to extend the functionality of the generic dao package + * @author Sakai App Builder -AZ + */ +public class LamstwoDaoImpl + extends HibernateCompleteGenericDao + implements LamstwoDao { + + private static Log log = LogFactory.getLog(LamstwoDaoImpl.class); + + public void init() { + log.debug("init"); + super.init(); + } + +} Index: sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/PreloadDataImpl.java =================================================================== diff -u --- sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/PreloadDataImpl.java (revision 0) +++ sakai-lamstwo/impl/dao/src/java/org/lamsfoundation/lams/integrations/sakai/dao/impl/PreloadDataImpl.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,54 @@ +/****************************************************************************** + * PreloadDataImpl.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.dao.impl; + +import java.util.Date; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao; +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; + +/** + * This checks and preloads any data that is needed for this app + * @author Sakai App Builder -AZ + */ +public class PreloadDataImpl { + + private static Log log = LogFactory.getLog(PreloadDataImpl.class); + + private LamstwoDao dao; + public void setDao(LamstwoDao dao) { + this.dao = dao; + } + + public void init() { + preloadItems(); + } + + /** + * Preload some items into the database + */ + public void preloadItems() { + + // check if there are any items present, load some if not + if(dao.findAll(LamstwoItem.class).isEmpty()){ + + // use the dao to preload some data here + dao.save( new LamstwoItem("Preload Title", "Preloader Introduction", 0L, + 0L, "Preload Owner", "Preload Site", Boolean.TRUE, Boolean.FALSE, new Date(), new Date()) ); + + log.info("Preloaded " + dao.countAll(LamstwoItem.class) + " items"); + } + } +} Index: sakai-lamstwo/impl/dao/src/test/hibernate-test.xml =================================================================== diff -u --- sakai-lamstwo/impl/dao/src/test/hibernate-test.xml (revision 0) +++ sakai-lamstwo/impl/dao/src/test/hibernate-test.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,56 @@ + + + + + + + + + + + classpath:/hibernate.properties + + + + + + + ${hibernate.connection.driver_class} + ${hibernate.connection.url} + ${hibernate.connection.username} + ${hibernate.connection.password} + + + + + + + + org/lamsfoundation/lams/integrations/sakai/hbm/LamstwoItem.hbm.xml + + + + + ${hibernate.dialect} + ${hibernate.show_sql} + ${hibernate.cache.provider_class} + true 1, false 0 + ${hibernate.hbm2ddl.auto} + + + + + + + + + + \ No newline at end of file Index: sakai-lamstwo/impl/dao/src/test/hibernate.properties =================================================================== diff -u --- sakai-lamstwo/impl/dao/src/test/hibernate.properties (revision 0) +++ sakai-lamstwo/impl/dao/src/test/hibernate.properties (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,20 @@ +# This file generated by Sakai App Builder -AZ +# This properties file defines the connection to the HSQLDB database +hibernate.connection.driver_class=org.hsqldb.jdbcDriver + +hibernate.connection.url=jdbc:hsqldb:. +hibernate.connection.username=sa +hibernate.connection.password= + +hibernate.dialect=org.hibernate.dialect.HSQLDialect + +#hibernate.show_sql=true +hibernate.show_sql=false + +hibernate.hbm2ddl.auto=create + +hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider + +# Needed for Hibernate 3 if you are using old HQL syntax +# (you have to in Sakai 2.2.x or lower) -AZ +# hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory Index: sakai-lamstwo/impl/dao/src/test/org/lamsfoundation/lams/integrations/sakai/dao/test/LamstwoDaoImplTest.java =================================================================== diff -u --- sakai-lamstwo/impl/dao/src/test/org/lamsfoundation/lams/integrations/sakai/dao/test/LamstwoDaoImplTest.java (revision 0) +++ sakai-lamstwo/impl/dao/src/test/org/lamsfoundation/lams/integrations/sakai/dao/test/LamstwoDaoImplTest.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,122 @@ +/****************************************************************************** + * LamstwoDaoImplTest.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.dao.test; + +import java.util.Date; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao; +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; + +import org.springframework.test.AbstractTransactionalSpringContextTests; + +import junit.framework.Assert; + +/** + * Testing for the specialized DAO methods (do not test the Generic Dao methods) + * @author Sakai App Builder -AZ + */ +public class LamstwoDaoImplTest extends AbstractTransactionalSpringContextTests { + + private static Log log = LogFactory.getLog(LamstwoDaoImplTest.class); + + protected LamstwoDao dao; + + private LamstwoItem item; + + private final static String ITEM_TITLE = "New Title"; + private final static String ITEM_INTRODUCTION = "New Introduction"; + private final static String ITEM_OWNER = "11111111"; + private final static String ITEM_SITE = "22222222"; + private final static Boolean ITEM_HIDDEN = Boolean.FALSE; + + + protected String[] getConfigLocations() { + // point to the needed spring config files, must be on the classpath + // (add component/src/webapp/WEB-INF to the build path in Eclipse), + // they also need to be referenced in the project.xml file + return new String[] {"hibernate-test.xml", "spring-hibernate.xml"}; + } + + // run this before each test starts + protected void onSetUpBeforeTransaction() throws Exception { + // create test objects + item = new LamstwoItem(ITEM_TITLE, ITEM_INTRODUCTION,ITEM_OWNER, ITEM_SITE, ITEM_HIDDEN, new Date()); + } + + // run this before each test starts and as part of the transaction + protected void onSetUpInTransaction() { + // load the spring created dao class bean from the Spring Application Context + dao = (LamstwoDao) applicationContext. + getBean("org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao"); + if (dao == null) { + log.error("onSetUpInTransaction: DAO could not be retrieved from spring context"); + } + + // init the class if needed + + // check the preloaded data + Assert.assertTrue("Error preloading data", dao.countAll(LamstwoItem.class) > 0); + + // preload data if desired + dao.save(item); + } + + + /** + * ADD unit tests below here, use testMethod as the name of the unit test, + * Note that if a method is overloaded you should include the arguments in the + * test name like so: testMethodClassInt (for method(Class, int); + */ + + + // THESE ARE SAMPLE UNIT TESTS WHICH SHOULD BE REMOVED LATER -AZ + /** + * TODO - Remove this sample unit test + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.dao.impl.GenericHibernateDao#save(java.lang.Object)}. + */ + public void testSave() { + LamstwoItem item1 = new LamstwoItem("New item1", ITEM_INTRODUCTION, ITEM_OWNER, ITEM_SITE, ITEM_HIDDEN, new Date()); + dao.save(item1); + Long itemId = item1.getId(); + Assert.assertNotNull(itemId); + Assert.assertEquals(dao.countAll(LamstwoItem.class), 3); + } + + /** + * TODO - Remove this sample unit test + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.dao.impl.GenericHibernateDao#delete(java.lang.Object)}. + */ + public void testDelete() { + Assert.assertEquals(dao.countAll(LamstwoItem.class), 2); + dao.delete(item); + Assert.assertEquals(dao.countAll(LamstwoItem.class), 1); + } + + /** + * TODO - Remove this sample unit test + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.dao.impl.GenericHibernateDao#findById(java.lang.Class, java.io.Serializable)}. + */ + public void testFindById() { + Long id = item.getId(); + Assert.assertNotNull(id); + LamstwoItem item1 = (LamstwoItem) dao.findById(LamstwoItem.class, id); + Assert.assertNotNull(item1); + Assert.assertEquals(item, item1); + } + + /** + * Add anything that supports the unit tests below here + */ +} Index: sakai-lamstwo/impl/hbm/project.xml =================================================================== diff -u --- sakai-lamstwo/impl/hbm/project.xml (revision 0) +++ sakai-lamstwo/impl/hbm/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,39 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-hbm + sakaiproject + sakai-lamstwo-hbm + ${sakai.version} + + Sakai Project + http://sakaiproject.org/ + + 2006 + + + + jar + shared + + + + + + + + src/java + + + src/java + + **/*.xml + + + + + + + Index: sakai-lamstwo/impl/hbm/src/java/org/lamsfoundation/lams/integrations/sakai/hbm/LamstwoItem.hbm.xml =================================================================== diff -u --- sakai-lamstwo/impl/hbm/src/java/org/lamsfoundation/lams/integrations/sakai/hbm/LamstwoItem.hbm.xml (revision 0) +++ sakai-lamstwo/impl/hbm/src/java/org/lamsfoundation/lams/integrations/sakai/hbm/LamstwoItem.hbm.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,29 @@ + + + + + + + + + + + + lamstwo_ITEM_ID_SEQ + + + + + + + + + + + + + + Index: sakai-lamstwo/impl/logic/project.xml =================================================================== diff -u --- sakai-lamstwo/impl/logic/project.xml (revision 0) +++ sakai-lamstwo/impl/logic/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,247 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-logic-impl + sakaiproject + sakai-lamstwo-logic-impl + ${sakai.version} + + Sakai Project + http://www.sakaiproject.org/ + + 2006 + + + + jar + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + sakaiproject + sakai-lamstwo-model-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-logic-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-dao-impl + ${sakai.version} + + + + + generic-dao + generic-dao + 0.8 + http://source.edtech.vt.edu/maven/ + + + + + ${sakai.spring.groupId} + ${sakai.spring.artifactId} + ${sakai.spring.version} + + + + ${sakai.hibernate.groupId} + ${sakai.hibernate.artifactId} + ${sakai.hibernate.version} + + + + + antlr + antlr + 2.7.6 + + + + + sakaiproject + sakai-authz-api + ${sakai.version} + + + + sakaiproject + sakai-entity-api + ${sakai.version} + + + + sakaiproject + sakai-site-api + ${sakai.version} + + + + sakaiproject + sakai-tool-api + ${sakai.version} + + + + sakaiproject + sakai-user-api + ${sakai.version} + + + + sakaiproject + sakai-util-api + ${sakai.version} + + + + sakaiproject + sakai-component-api + ${sakai.version} + + + + sakaiproject + sakai-util + ${sakai.version} + + + + + commons-logging + commons-logging + 1.0.4 + + + + commons-codec + commons-codec + 1.3 + + + + + axis + axis + 1.4 + + + + axis + axis-jaxrpc + 1.4 + + + + + ${sakai.spring.groupId} + ${sakai.spring.mock.artifactId} + ${sakai.spring.mock.version} + + + + hsqldb + hsqldb + 1.8.0.5 + + + + dom4j + dom4j + 1.6.1 + + + + jta + jta + h2.1.8 + + + + cglib + cglib-nodep + 2.1_3 + + + + commons-codec + commons-codec + 1.3 + + + + commons-collections + commons-collections + 3.1 + + + + ehcache + ehcache + 1.1 + + + + easymock + easymock + 1.2_Java1.3 + + + + + sakaiproject + sakai-lamstwo-hbm + ${sakai.version} + + + + + + + src/java + + + src/test + + + **/*Test.java + + + + ${basedir}/../pack/src/webapp/WEB-INF + + spring-hibernate.xml + + + + ${basedir}/../dao/src/test + + hibernate-test.xml + hibernate.properties + + + + + + + + + Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/CSVUtil.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/CSVUtil.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/CSVUtil.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,161 @@ +/****************************************************************************** + * CSVUtil.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic.impl; + +import java.text.ParseException; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.*; + +/** + * CSVUtil Provides "Comma Seperated Value" writing and parsing. + * The two methods write() and parse() will perform writing to and parse from + * the CSV format + * + * @author Anthony Xiao + */ +public class CSVUtil { + + private static final char QUOTE = '"'; + private static final char COMMA = ','; + + /* precompile the patterns to speed up the search */ + + // should we put quotes around a value? + //private static final Pattern CONTAINS_NEWLINE = Pattern.compile(".*(\\n|\\r)+.*"); + + // should we put quotes around a value? + private static final Pattern CONTAINS_COMMA = Pattern.compile(".*(,)+.*"); + + // should we escape the quotes? + private static final Pattern CONTAINS_QUOTE = Pattern.compile("\""); + + // how should we wrap qoutes around comma or newline? + //private static final String WRAP_QOUTE = "\"$0\""; + + // how should we escape the value if it has qoutes? + private static final String ESCAPE_QUOTE = "\"\""; + + // has this value been wrapped with quotes + private static final Pattern WRAPPED_QUOTE = Pattern.compile("^\"(.*((,|\\n|\\r)+).*)\"$"); + + // has this value been escaped by ESCAPE_QUOTE + private static final Pattern ESCAPED_QUOTE = Pattern.compile("\"\""); + + // how should we unescape the the ESCAPED_QUOTE? + private static final String UNWRAP_QOUTE = "$1"; + + // how should we unescape the the ESCAPED_COMMA? + private static final String UNESCAPE_QUOTE = "\""; + + /* + * NOTE: why are we using \\n|\\r in CONTAINS_NEWLINE and WRAPPED_QUOTE? + * javadoc says "." represents "Any character (may or may not match line terminators)" + * and we want to make sure terminiators such as newline (\n) gets matched as well + * if we dont match it then ,\n, will get written as ","\n"," + */ + + /** + * Writes a array of String into CSV format + * @param vals - The array of string to be written into CSV format + * @return + */ + public static String write(String[] vals){ + String str = ""; + int lastIndex = vals.length - 1; + for(int i=0; i res = new LinkedList(); + int startIndex = 0; + boolean openQuote = false; + + str += ","; //end the last value with comma, so last value can be found correctly + + for(int i=0; i= 0; i--) { + LamstwoItem item = (LamstwoItem) l.get(i); + if ( item.getHidden().booleanValue() && + !item.getOwnerId().equals(userId) ) { + l.remove(item); + } + } + } + return l; + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#removeItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem) + */ + public void removeItem(LamstwoItem item) { + log.debug("In removeItem with item:" + item.getId() + ":" + item.getTitle()); + // check if current user can remove this item + if ( canWriteItem(item) ) { + dao.delete(item); + log.info("Removing item: " + item.getId() + ":" + item.getTitle()); + } else { + throw new SecurityException("Current user cannot remove item " + + item.getId() + " because they do not have permission"); + } + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#saveItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem) + */ + public void saveItem(LamstwoItem item) { + log.debug("In saveItem with item:" + item.getTitle()); + // set the owner and site to current if they are not set + if (item.getOwnerId() == null) { + item.setOwnerId( getCurrentUserId() ); + } + if (item.getSiteId() == null) { + item.setSiteId( getCurrentContext() ); + } + if (item.getDateCreated() == null) { + item.setDateCreated( new Date() ); + } + // save item if new OR check if the current user can update the existing item + if ( (item.getId() == null) || canWriteItem(item) ) { + dao.save(item); + log.info("Saving item: " + item.getId() + ":" + item.getTitle()); + } else { + throw new SecurityException("Current user cannot update item " + + item.getId() + " because they do not have permission"); + } + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getCurrentUserDisplayName() + */ + public String getCurrentUserDisplayName() { + return userDirectoryService.getCurrentUser().getDisplayName(); + } + + /** + * Get the context of the location the current user is in + *
Note: This is only public so it can be tested and should not be used outside the impl + * @return a context + */ + public String getCurrentContext() { + return toolManager.getCurrentPlacement().getContext(); + } + + /** + * Get the internal Sakai userId of the current user + *
Note: This is only public so it can be tested and should not be used outside the impl + * @return a userId (not necessarily username) + */ + public String getCurrentUserId() { + return userDirectoryService.getCurrentUser().getId(); + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#deleteLesson() + */ + public boolean deleteLesson(long lsId) { + String serverID = getServerID(); + String serverAddress = getServerAddress(); + String serverKey = getServerKey(); + + String username = getCurrentUserId(); + + if (serverID == null || serverAddress == null || serverKey == null ) { + log.error("Unable to delete LAMS lesson: lsid = " + lsId + ", one or more lams configuration properties is null"); + return false; + } + + try { + String datetime = new Date().toString(); + String hashValue = LamstwoUtils.generateAuthenticationHash(serverID, serverKey, username, datetime); + LessonManagerService service = new LessonManagerServiceLocator(); + LessonManager lessonManager = service.getLessonManagerService(new URL(serverAddress + "/services/LessonManagerService")); + lessonManager.deleteLesson(serverID, datetime, hashValue, username, lsId); + + return true; + + } catch (MalformedURLException e) { + log.error("Unable to delete LAMS lesson, lsid = " + lsId + ": ', bad URL: '" + + serverAddress + + "', please check sakai.properties"); + } catch (ServiceException e) { + log.error("Unable to start LAMS lesson, RPC Service Exception"); + e.printStackTrace(); + } catch (RemoteException e) { + log.error("Unable to start LAMS lesson, RMI Remote Exception"); + e.printStackTrace(); + } + return false; + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getLearningDesigns() + */ + public String getLearningDesigns(Integer mode) { + + + String serverID = getServerID(); + String serverAddress = getServerAddress(); + String serverKey = getServerKey(); + + String username = getCurrentUserId(); + String siteId = getCurrentContext(); + + if (serverID == null || serverAddress == null || serverKey == null ) { + log.error("Unable to retrieve learning designs from LAMS, one or more lams configuration properties is null"); + return null; + } + + try { + String datetime = new Date().toString(); + String hashValue = LamstwoUtils.generateAuthenticationHash(serverID, serverKey, username, datetime); + + LearningDesignRepositoryService service = new LearningDesignRepositoryServiceLocator(); + LearningDesignRepository ldr = service.getLearningDesignRepository(new URL(serverAddress + "/services/LearningDesignRepositoryService")); + String result = ldr.getLearningDesigns(serverID, datetime, hashValue, username, siteId, mode, getCountryCode(), getLanguageCode()); + + // TODO check if result is valid ?? + + String pattern = "'(\\d+)'"; + String replacement = "'javascript:selectSequence($1)'"; + + result = result.replaceAll(pattern, replacement); + + return result; + + } catch (MalformedURLException e) { + log.error("Unable to retrieve learning designs from LAMS, bad URL: '" + + serverAddress + + "', please check sakai.properties"); + } catch (ServiceException e) { + log.error("Unable to retrieve learning designs from LAMS, RPC Service Exception"); + e.printStackTrace(); + } catch (RemoteException e) { + log.error("Unable to retrieve learning designs from LAMS, RMI Remote Exception"); + e.printStackTrace(); + } + return null; + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#scheduleLesson() + */ + public Long scheduleLesson(long ldId, String title, String desc, String startDate) { + + + String serverID = getServerID(); + String serverAddress = getServerAddress(); + String serverKey = getServerKey(); + + String username = getCurrentUserId(); + String siteId = getCurrentContext(); + + if (serverID == null || serverAddress == null || serverKey == null ) { + log.error("Unable to retrieve learning designs from LAMS, one or more lams configuration properties is null"); + return null; + } + + try { + + String datetime = new Date().toString(); + String hashValue = LamstwoUtils.generateAuthenticationHash(serverID, serverKey, username, datetime); + + LessonManagerService service = new LessonManagerServiceLocator(); + LessonManager lessonManager = service.getLessonManagerService(new URL(serverAddress + "/services/LessonManagerService")); + Long lessonId = lessonManager.scheduleLesson(serverID, datetime, hashValue, username, ldId, siteId, title, desc, startDate, getCountryCode(), getLanguageCode()); + + return lessonId; + + } catch (MalformedURLException e) { + log.error("Unable to schedule LAMS lesson, bad URL: '" + + serverAddress + + "', please check sakai.properties"); + } catch (ServiceException e) { + log.error("Unable to schedule LAMS lesson, RPC Service Exception"); + e.printStackTrace(); + } catch (RemoteException e) { + log.error("Unable to schedule LAMS lesson, RMI Remote Exception"); + e.printStackTrace(); + } + return null; + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#startLesson() + */ + public Long startLesson(long ldId, String title, String desc) { + + String serverID = getServerID(); + String serverAddress = getServerAddress(); + String serverKey = getServerKey(); + + String username = getCurrentUserId(); + String siteId = getCurrentContext(); + + if (serverID == null || serverAddress == null || serverKey == null ) { + log.error("Unable to retrieve learning designs from LAMS, one or more lams configuration properties is null"); + return null; + } + + try { + + String datetime = new Date().toString(); + String hashValue = LamstwoUtils.generateAuthenticationHash(serverID, serverKey, username, datetime); + + LessonManagerService service = new LessonManagerServiceLocator(); + LessonManager lessonManager = service.getLessonManagerService(new URL(serverAddress + "/services/LessonManagerService")); + Long lessonId = lessonManager.startLesson(serverID, datetime, hashValue, username, ldId, siteId, title, desc, getCountryCode(), getLanguageCode()); + + return lessonId; + + } catch (MalformedURLException e) { + log.error("Unable to start LAMS lesson, bad URL: '" + + serverAddress + + "', please check sakai.properties"); + } catch (ServiceException e) { + log.error("Unable to start LAMS lesson, RPC Service Exception"); + e.printStackTrace(); + } catch (RemoteException e) { + log.error("Unable to start LAMS lesson, RMI Remote Exception"); + e.printStackTrace(); + } + return null; + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getServerAddress() + */ + public String getServerAddress() { + return ServerConfigurationService.getString(LamstwoConstants.CONF_SERVER_ADDRRESS); + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getServerID() + */ + public String getServerID() { + return ServerConfigurationService.getString(LamstwoConstants.CONF_SERVER_ID); + } + + /* (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getServerKey() + */ + public String getServerKey() { + return ServerConfigurationService.getString(LamstwoConstants.CONF_SERVER_KEY); + } + + /* + * (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getRequestSource() + */ + public String getRequestSource() { + return ServerConfigurationService.getString(LamstwoConstants.CONF_REQUEST_SOURCE); + } + + public boolean isHashValid(String[] elements, String hash) { + String generatedHash = generateHash(elements); + log.debug("hash=" + hash + " , generated hash="+ generatedHash); + return generatedHash.equals(hash); + } + + public String generateHash(String[] elements) { + String plaintext = new String(); + for (String str : elements) { + plaintext += str.trim().toLowerCase(); + } + return LamstwoUtils.sha1(plaintext); + } + + public String getUserInfo(String username) { + User user = null; + + try { + user = userDirectoryService.getUser(username); + } catch (UserNotDefinedException e) { + log.error("Could not find user with id: " + username); + return null; + } + + String[] valList = {"", + user.getFirstName(), + user.getLastName(), + "", + "", + "", + "", + "", + "", + "", + "", + user.getEmail(), + "", + "" + }; + + return CSVUtil.write(valList); + } + + private String createURL(String method) { + String timestamp = new Long(java.lang.System.currentTimeMillis()).toString(); + String uid = getCurrentUserId(); + String [] plaintext = {timestamp, uid, method, getServerID(), getServerKey()}; + String hash = generateHash(plaintext); + + ResourceLoader rl = new ResourceLoader(); + Locale locale = rl.getLocale(); + + String siteID = getCurrentContext(); + + String url; + try { + url = getServerAddress() + "/LoginRequest?" + + "uid=" + URLEncoder.encode(uid, "UTF8") + + "&method=" + method + + "&ts=" + timestamp + + "&sid=" + getServerID() + + "&hash=" + hash + + "&courseid=" + URLEncoder.encode(siteID, "UTF8") + + "&country=" + locale.getCountry() + + "&lang=" + locale.getLanguage() + + "&requestSrc=" + URLEncoder.encode(getRequestSource(), "UTF8"); + } catch (UnsupportedEncodingException e) { + log.error("Unable to encode URL"); + throw new RuntimeException(); + } + return url; + } + + private String getCountryCode() { + return new ResourceLoader().getLocale().getCountry(); + + } + + private String getLanguageCode() { + return new ResourceLoader().getLocale().getLanguage(); + } + + /* + * (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getAuthorURL() + */ + public String getAuthorURL() { + return createURL("author"); + } + + /* + * (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getLearnerURL() + */ + public String getLearnerURL() { + return createURL("learner"); + } + + /* + * (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#getMonitorURL() + */ + public String getMonitorURL() { + return createURL("monitor"); + } + + /* + * (non-Javadoc) + * @see org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic#canCreateItem() + */ + public Boolean canCreateItem() { + String siteId = getCurrentContext(); + String userId = getCurrentUserId(); + log.debug("checking if can create new LAMS item for: " + userId + ", " + siteId ); + String siteRef = siteService.siteReference(siteId); + if ( securityService.isSuperUser(userId) ) { + // the system super user can modify any item + return true; + } else if (securityService.unlock(userId, ITEM_CREATE, siteRef) ) { + // users with permission in the specified site can modify items from that site + return true; + } + return false; + } +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/LamstwoUtils.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/LamstwoUtils.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/integrations/sakai/logic/impl/LamstwoUtils.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,44 @@ +/****************************************************************************** + * LamstwoUtils.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic.impl; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import org.apache.commons.codec.binary.Hex; + +public class LamstwoUtils { + + public static String generateAuthenticationHash(String serverID, String serverKey, + String username, String datetime) { + String plaintext = datetime.toLowerCase().trim() + + username.toLowerCase().trim() + serverID.toLowerCase().trim() + + serverKey.toLowerCase().trim(); + + return sha1(plaintext); + } + + public static String generateUserAuthenticationHash(String timestamp, String username, String serverID, String serverKey) { + String plaintext = timestamp + username + serverID + serverKey; + return sha1(plaintext); + } + + public static String sha1(String str) { + try { + MessageDigest md = MessageDigest.getInstance("SHA1"); + return new String(Hex.encodeHex(md.digest(str.getBytes()))); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepository.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,23 @@ +/****************************************************************************** + * LearningDesignRepository.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LearningDesignRepository.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public interface LearningDesignRepository extends java.rmi.Remote { + public java.lang.String getLearningDesigns(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, java.lang.String courseId, java.lang.Integer mode, java.lang.String country, java.lang.String lang) throws java.rmi.RemoteException; +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryService.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,27 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LearningDesignRepositoryService.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public interface LearningDesignRepositoryService extends javax.xml.rpc.Service { + public java.lang.String getLearningDesignRepositoryAddress(); + + public org.lamsfoundation.lams.webservice.LearningDesignRepository getLearningDesignRepository() throws javax.xml.rpc.ServiceException; + + public org.lamsfoundation.lams.webservice.LearningDesignRepository getLearningDesignRepository(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryServiceLocator.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryServiceLocator.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositoryServiceLocator.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,153 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LearningDesignRepositoryServiceLocator.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public class LearningDesignRepositoryServiceLocator extends org.apache.axis.client.Service implements org.lamsfoundation.lams.webservice.LearningDesignRepositoryService { + + public LearningDesignRepositoryServiceLocator() { + } + + + public LearningDesignRepositoryServiceLocator(org.apache.axis.EngineConfiguration config) { + super(config); + } + + public LearningDesignRepositoryServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { + super(wsdlLoc, sName); + } + + // Use to get a proxy class for LearningDesignRepository + private java.lang.String LearningDesignRepository_address = "http://localhost:8080/lams/services/LearningDesignRepositoryService"; + + public java.lang.String getLearningDesignRepositoryAddress() { + return LearningDesignRepository_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String LearningDesignRepositoryWSDDServiceName = "LearningDesignRepository"; + + public java.lang.String getLearningDesignRepositoryWSDDServiceName() { + return LearningDesignRepositoryWSDDServiceName; + } + + public void setLearningDesignRepositoryWSDDServiceName(java.lang.String name) { + LearningDesignRepositoryWSDDServiceName = name; + } + + public org.lamsfoundation.lams.webservice.LearningDesignRepository getLearningDesignRepository() throws javax.xml.rpc.ServiceException { + java.net.URL endpoint; + try { + endpoint = new java.net.URL(LearningDesignRepository_address); + } + catch (java.net.MalformedURLException e) { + throw new javax.xml.rpc.ServiceException(e); + } + return getLearningDesignRepository(endpoint); + } + + public org.lamsfoundation.lams.webservice.LearningDesignRepository getLearningDesignRepository(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { + try { + org.lamsfoundation.lams.webservice.LearningDesignRepositorySoapBindingStub _stub = new org.lamsfoundation.lams.webservice.LearningDesignRepositorySoapBindingStub(portAddress, this); + _stub.setPortName(getLearningDesignRepositoryWSDDServiceName()); + return _stub; + } + catch (org.apache.axis.AxisFault e) { + return null; + } + } + + public void setLearningDesignRepositoryEndpointAddress(java.lang.String address) { + LearningDesignRepository_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + try { + if (org.lamsfoundation.lams.webservice.LearningDesignRepository.class.isAssignableFrom(serviceEndpointInterface)) { + org.lamsfoundation.lams.webservice.LearningDesignRepositorySoapBindingStub _stub = new org.lamsfoundation.lams.webservice.LearningDesignRepositorySoapBindingStub(new java.net.URL(LearningDesignRepository_address), this); + _stub.setPortName(getLearningDesignRepositoryWSDDServiceName()); + return _stub; + } + } + catch (java.lang.Throwable t) { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + if (portName == null) { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("LearningDesignRepository".equals(inputPortName)) { + return getLearningDesignRepository(); + } + else { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() { + return new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "LearningDesignRepositoryService"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() { + if (ports == null) { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "LearningDesignRepository")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + +if ("LearningDesignRepository".equals(portName)) { + setLearningDesignRepositoryEndpointAddress(address); + } + else +{ // Unknown Port Name + throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } + +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingStub.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingStub.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LearningDesignRepositorySoapBindingStub.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,146 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LearningDesignRepositorySoapBindingStub.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public class LearningDesignRepositorySoapBindingStub extends org.apache.axis.client.Stub implements org.lamsfoundation.lams.webservice.LearningDesignRepository { + private java.util.Vector cachedSerClasses = new java.util.Vector(); + private java.util.Vector cachedSerQNames = new java.util.Vector(); + private java.util.Vector cachedSerFactories = new java.util.Vector(); + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + static org.apache.axis.description.OperationDesc [] _operations; + + static { + _operations = new org.apache.axis.description.OperationDesc[1]; + _initOperationDesc1(); + } + + private static void _initOperationDesc1(){ + org.apache.axis.description.OperationDesc oper; + org.apache.axis.description.ParameterDesc param; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getLearningDesigns"); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "serverId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "datetime"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "hashValue"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "courseId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "mode"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "country"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "lang"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + oper.setReturnType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string")); + oper.setReturnClass(java.lang.String.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getLearningDesignsReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[0] = oper; + + } + + public LearningDesignRepositorySoapBindingStub() throws org.apache.axis.AxisFault { + this(null); + } + + public LearningDesignRepositorySoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + this(service); + super.cachedEndpoint = endpointURL; + } + + public LearningDesignRepositorySoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + if (service == null) { + super.service = new org.apache.axis.client.Service(); + } else { + super.service = service; + } + ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2"); + } + + protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException { + try { + org.apache.axis.client.Call _call = super._createCall(); + if (super.maintainSessionSet) { + _call.setMaintainSession(super.maintainSession); + } + if (super.cachedUsername != null) { + _call.setUsername(super.cachedUsername); + } + if (super.cachedPassword != null) { + _call.setPassword(super.cachedPassword); + } + if (super.cachedEndpoint != null) { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + if (super.cachedTimeout != null) { + _call.setTimeout(super.cachedTimeout); + } + if (super.cachedPortName != null) { + _call.setPortName(super.cachedPortName); + } + java.util.Enumeration keys = super.cachedProperties.keys(); + while (keys.hasMoreElements()) { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + return _call; + } + catch (java.lang.Throwable _t) { + throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t); + } + } + + public java.lang.String getLearningDesigns(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, java.lang.String courseId, java.lang.Integer mode, java.lang.String country, java.lang.String lang) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "getLearningDesigns")); + + setRequestHeaders(_call); + setAttachments(_call); + try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {serverId, datetime, hashValue, username, courseId, mode, country, lang}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (java.lang.String) _resp; + } catch (java.lang.Exception _exception) { + return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class); + } + } + } catch (org.apache.axis.AxisFault axisFaultException) { + throw axisFaultException; +} + } + +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManager.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManager.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManager.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,25 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LessonManager.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public interface LessonManager extends java.rmi.Remote { + public java.lang.Long startLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long ldId, java.lang.String courseId, java.lang.String title, java.lang.String desc, java.lang.String countryIsoCode, java.lang.String langIsoCode) throws java.rmi.RemoteException; + public java.lang.Long scheduleLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long ldId, java.lang.String courseId, java.lang.String title, java.lang.String desc, java.lang.String startDate, java.lang.String countryIsoCode, java.lang.String langIsoCode) throws java.rmi.RemoteException; + public boolean deleteLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long lsId) throws java.rmi.RemoteException; +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerService.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,27 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LessonManagerService.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public interface LessonManagerService extends javax.xml.rpc.Service { + public java.lang.String getLessonManagerServiceAddress(); + + public org.lamsfoundation.lams.webservice.LessonManager getLessonManagerService() throws javax.xml.rpc.ServiceException; + + public org.lamsfoundation.lams.webservice.LessonManager getLessonManagerService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceLocator.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceLocator.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceLocator.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,153 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LessonManagerServiceLocator.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public class LessonManagerServiceLocator extends org.apache.axis.client.Service implements org.lamsfoundation.lams.webservice.LessonManagerService { + + public LessonManagerServiceLocator() { + } + + + public LessonManagerServiceLocator(org.apache.axis.EngineConfiguration config) { + super(config); + } + + public LessonManagerServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { + super(wsdlLoc, sName); + } + + // Use to get a proxy class for LessonManagerService + private java.lang.String LessonManagerService_address = "http://localhost:8080/lams/services/LessonManagerService"; + + public java.lang.String getLessonManagerServiceAddress() { + return LessonManagerService_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String LessonManagerServiceWSDDServiceName = "LessonManagerService"; + + public java.lang.String getLessonManagerServiceWSDDServiceName() { + return LessonManagerServiceWSDDServiceName; + } + + public void setLessonManagerServiceWSDDServiceName(java.lang.String name) { + LessonManagerServiceWSDDServiceName = name; + } + + public org.lamsfoundation.lams.webservice.LessonManager getLessonManagerService() throws javax.xml.rpc.ServiceException { + java.net.URL endpoint; + try { + endpoint = new java.net.URL(LessonManagerService_address); + } + catch (java.net.MalformedURLException e) { + throw new javax.xml.rpc.ServiceException(e); + } + return getLessonManagerService(endpoint); + } + + public org.lamsfoundation.lams.webservice.LessonManager getLessonManagerService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { + try { + org.lamsfoundation.lams.webservice.LessonManagerServiceSoapBindingStub _stub = new org.lamsfoundation.lams.webservice.LessonManagerServiceSoapBindingStub(portAddress, this); + _stub.setPortName(getLessonManagerServiceWSDDServiceName()); + return _stub; + } + catch (org.apache.axis.AxisFault e) { + return null; + } + } + + public void setLessonManagerServiceEndpointAddress(java.lang.String address) { + LessonManagerService_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + try { + if (org.lamsfoundation.lams.webservice.LessonManager.class.isAssignableFrom(serviceEndpointInterface)) { + org.lamsfoundation.lams.webservice.LessonManagerServiceSoapBindingStub _stub = new org.lamsfoundation.lams.webservice.LessonManagerServiceSoapBindingStub(new java.net.URL(LessonManagerService_address), this); + _stub.setPortName(getLessonManagerServiceWSDDServiceName()); + return _stub; + } + } + catch (java.lang.Throwable t) { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + if (portName == null) { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("LessonManagerService".equals(inputPortName)) { + return getLessonManagerService(); + } + else { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() { + return new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "LessonManagerService"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() { + if (ports == null) { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "LessonManagerService")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + +if ("LessonManagerService".equals(portName)) { + setLessonManagerServiceEndpointAddress(address); + } + else +{ // Unknown Port Name + throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } + +} Index: sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceSoapBindingStub.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceSoapBindingStub.java (revision 0) +++ sakai-lamstwo/impl/logic/src/java/org/lamsfoundation/lams/webservice/LessonManagerServiceSoapBindingStub.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,262 @@ +/****************************************************************************** + * LamstwoConfigurationException.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +/** + * LessonManagerServiceSoapBindingStub.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. + */ + +package org.lamsfoundation.lams.webservice; + +public class LessonManagerServiceSoapBindingStub extends org.apache.axis.client.Stub implements org.lamsfoundation.lams.webservice.LessonManager { + private java.util.Vector cachedSerClasses = new java.util.Vector(); + private java.util.Vector cachedSerQNames = new java.util.Vector(); + private java.util.Vector cachedSerFactories = new java.util.Vector(); + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + static org.apache.axis.description.OperationDesc [] _operations; + + static { + _operations = new org.apache.axis.description.OperationDesc[3]; + _initOperationDesc1(); + } + + private static void _initOperationDesc1(){ + org.apache.axis.description.OperationDesc oper; + org.apache.axis.description.ParameterDesc param; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("startLesson"); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "serverId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "datetime"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "hashValue"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "ldId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), long.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "courseId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "title"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "desc"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "countryIsoCode"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "langIsoCode"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + oper.setReturnType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "long")); + oper.setReturnClass(java.lang.Long.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "startLessonReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[0] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("scheduleLesson"); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "serverId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "datetime"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "hashValue"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "ldId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), long.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "courseId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "title"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "desc"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "startDate"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "countryIsoCode"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "langIsoCode"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + oper.setReturnType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "long")); + oper.setReturnClass(java.lang.Long.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "scheduleLessonReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[1] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("deleteLesson"); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "serverId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "datetime"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "hashValue"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "username"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false); + oper.addParameter(param); + param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "lsId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), long.class, false, false); + oper.addParameter(param); + oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean")); + oper.setReturnClass(boolean.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "deleteLessonReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[2] = oper; + + } + + public LessonManagerServiceSoapBindingStub() throws org.apache.axis.AxisFault { + this(null); + } + + public LessonManagerServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + this(service); + super.cachedEndpoint = endpointURL; + } + + public LessonManagerServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + if (service == null) { + super.service = new org.apache.axis.client.Service(); + } else { + super.service = service; + } + ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2"); + } + + protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException { + try { + org.apache.axis.client.Call _call = super._createCall(); + if (super.maintainSessionSet) { + _call.setMaintainSession(super.maintainSession); + } + if (super.cachedUsername != null) { + _call.setUsername(super.cachedUsername); + } + if (super.cachedPassword != null) { + _call.setPassword(super.cachedPassword); + } + if (super.cachedEndpoint != null) { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + if (super.cachedTimeout != null) { + _call.setTimeout(super.cachedTimeout); + } + if (super.cachedPortName != null) { + _call.setPortName(super.cachedPortName); + } + java.util.Enumeration keys = super.cachedProperties.keys(); + while (keys.hasMoreElements()) { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + return _call; + } + catch (java.lang.Throwable _t) { + throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t); + } + } + + public java.lang.Long startLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long ldId, java.lang.String courseId, java.lang.String title, java.lang.String desc, java.lang.String countryIsoCode, java.lang.String langIsoCode) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "startLesson")); + + setRequestHeaders(_call); + setAttachments(_call); + try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {serverId, datetime, hashValue, username, new java.lang.Long(ldId), courseId, title, desc, countryIsoCode, langIsoCode}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (java.lang.Long) _resp; + } catch (java.lang.Exception _exception) { + return (java.lang.Long) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.Long.class); + } + } + } catch (org.apache.axis.AxisFault axisFaultException) { + throw axisFaultException; +} + } + + public java.lang.Long scheduleLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long ldId, java.lang.String courseId, java.lang.String title, java.lang.String desc, java.lang.String startDate, java.lang.String countryIsoCode, java.lang.String langIsoCode) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[1]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "scheduleLesson")); + + setRequestHeaders(_call); + setAttachments(_call); + try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {serverId, datetime, hashValue, username, new java.lang.Long(ldId), courseId, title, desc, startDate, countryIsoCode, langIsoCode}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (java.lang.Long) _resp; + } catch (java.lang.Exception _exception) { + return (java.lang.Long) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.Long.class); + } + } + } catch (org.apache.axis.AxisFault axisFaultException) { + throw axisFaultException; +} + } + + public boolean deleteLesson(java.lang.String serverId, java.lang.String datetime, java.lang.String hashValue, java.lang.String username, long lsId) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[2]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("http://webservice.lams.lamsfoundation.org", "deleteLesson")); + + setRequestHeaders(_call); + setAttachments(_call); + try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {serverId, datetime, hashValue, username, new java.lang.Long(lsId)}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return ((java.lang.Boolean) _resp).booleanValue(); + } catch (java.lang.Exception _exception) { + return ((java.lang.Boolean) org.apache.axis.utils.JavaUtils.convert(_resp, boolean.class)).booleanValue(); + } + } + } catch (org.apache.axis.AxisFault axisFaultException) { + throw axisFaultException; +} + } + +} Index: sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/LamstwoLogicImplTest.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/LamstwoLogicImplTest.java (revision 0) +++ sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/LamstwoLogicImplTest.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,489 @@ +/****************************************************************************** + * LamstwoLogicImplTest.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic.test; + +import java.util.Date; +import java.util.List; + +import junit.framework.Assert; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.easymock.MockControl; +import org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao; +import org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl; +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; +import org.sakaiproject.authz.api.SecurityService; +import org.sakaiproject.site.api.SiteService; +import org.sakaiproject.tool.api.ToolManager; +import org.sakaiproject.user.api.UserDirectoryService; +import org.springframework.test.AbstractTransactionalSpringContextTests; + + +/** + * Testing the Logic implementation methods + * @author Sakai App Builder -AZ + */ +public class LamstwoLogicImplTest extends + AbstractTransactionalSpringContextTests { + + private static Log log = LogFactory.getLog(LamstwoLogicImplTest.class); + + protected LamstwoLogicImpl logicImpl; + + private ToolManager toolManager; + private MockControl toolManagerControl; + private UserDirectoryService userDirectoryService; + private MockControl userDirectoryServiceControl; + private SecurityService securityService; + private MockControl securityServiceControl; + private SiteService siteService; + private MockControl siteServiceControl; + + private LamstwoItem item1; + private LamstwoItem item2; + private LamstwoItem adminitem; + private LamstwoItem maintitem; + + private final static String USER_NAME = "aaronz"; + private final static String USER_DISPLAY = "Aaron Zeckoski"; + private final static String USER_ID = "user-11111111"; + private final static String OTHER_USER_ID = "user-999999999"; + private final static String ADMIN_USER_ID = "admin"; + private final static String MAINT_USER_ID = "maintainer"; + private final static String SITE_ID = "site-1111111"; + private final static String SITE_REF = "siteref-1111111"; + private final static String SITE2_ID = "site-22222222"; + private final static String SITE2_REF = "siteref-22222222"; + private final static String ITEM_TITLE = "New Title"; + private final static String ITEM_INTRODUCTION = "New Introduction"; + private final static Boolean ITEM_HIDDEN = Boolean.FALSE; + + + protected String[] getConfigLocations() { + // point to the needed spring config files, must be on the classpath + // (add component/src/webapp/WEB-INF to the build path in Eclipse), + // they also need to be referenced in the project.xml file + return new String[] {"hibernate-test.xml", "spring-hibernate.xml"}; + } + + // run this before each test starts + protected void onSetUpBeforeTransaction() throws Exception { + // create test objects + item1 = new LamstwoItem(ITEM_TITLE, ITEM_INTRODUCTION, USER_ID, SITE_ID, ITEM_HIDDEN, new Date()); + item2 = new LamstwoItem(ITEM_TITLE, ITEM_INTRODUCTION, USER_ID, SITE2_ID, ITEM_HIDDEN, new Date()); + maintitem = new LamstwoItem("New maint item title", ITEM_INTRODUCTION, MAINT_USER_ID, SITE_ID, ITEM_HIDDEN, new Date()); + adminitem = new LamstwoItem("New admin item title", ITEM_INTRODUCTION, ADMIN_USER_ID, SITE2_ID, ITEM_HIDDEN, new Date()); + } + + // run this before each test starts and as part of the transaction + protected void onSetUpInTransaction() { + // load the spring created dao class bean from the Spring Application Context + LamstwoDao dao = (LamstwoDao) applicationContext. + getBean("org.lamsfoundation.lams.integrations.sakai.dao.LamstwoDao"); + if (dao == null) { + log.error("onSetUpInTransaction: DAO could not be retrieved from spring context"); + } + + // init the class if needed + + // setup the mock objects + toolManagerControl = MockControl.createControl(ToolManager.class); + toolManager = (ToolManager) toolManagerControl.getMock(); + + userDirectoryServiceControl = MockControl.createControl(UserDirectoryService.class); + userDirectoryService = (UserDirectoryService) userDirectoryServiceControl.getMock(); + + securityServiceControl = MockControl.createControl(SecurityService.class); + securityService = (SecurityService) securityServiceControl.getMock(); + + siteServiceControl = MockControl.createControl(SiteService.class); + siteService = (SiteService) siteServiceControl.getMock(); + + // create and setup the object to be tested + logicImpl = new LamstwoLogicImpl(); + logicImpl.setDao(dao); + logicImpl.setToolManager(toolManager); + logicImpl.setUserDirectoryService(userDirectoryService); + logicImpl.setSecurityService(securityService); + logicImpl.setSiteService(siteService); + + // can set up the default mock object returns here if desired + // Note: Still need to activate them in the test methods though + userDirectoryService.getCurrentUser(); // expect this to be called + userDirectoryServiceControl.setDefaultReturnValue(new TestUser(USER_ID)); + + toolManager.getCurrentPlacement(); // expect this to be called + toolManagerControl.setDefaultReturnValue(new TestPlacement(SITE_ID)); + + siteService.siteReference(SITE_ID); // expect this to be called + siteServiceControl.setReturnValue(SITE_REF, MockControl.ZERO_OR_MORE); // return for above param + siteService.siteReference(SITE2_ID); // expect this to be called + siteServiceControl.setReturnValue(SITE2_REF, MockControl.ZERO_OR_MORE); // return for above param + + securityService.isSuperUser(USER_ID); // normal user + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); // return for above param + securityService.isSuperUser(MAINT_USER_ID); // maintain user + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); // return for above param + securityService.isSuperUser(ADMIN_USER_ID); // admin user + securityServiceControl.setReturnValue(true, MockControl.ZERO_OR_MORE); // return for above param + + // preload the DB for testing + dao.save(item1); + dao.save(item2); + dao.save(adminitem); + dao.save(maintitem); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getItemById(java.lang.Long)}. + */ + public void testGetItemById() { + LamstwoItem item = logicImpl.getItemById(item1.getId()); + Assert.assertNotNull(item); + Assert.assertEquals(item, item1); + + LamstwoItem baditem = logicImpl.getItemById( new Long(9999999) ); + Assert.assertNull(baditem); + + try { + logicImpl.getItemById(null); + Assert.fail("Should have thrown IllegalArgumentException"); + } catch (IllegalArgumentException e) { + Assert.assertNotNull(e.getMessage()); + log.info("Could not get null item (this is correct)"); + } + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#canWriteItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem)}. + */ + public void testCanWriteItemLamstwoItem() { + // minimal testing for convenience methods + + // activate the mock objects + userDirectoryServiceControl.replay(); + toolManagerControl.replay(); + siteServiceControl.replay(); + + // mock objects needed here + Assert.assertTrue( logicImpl.canWriteItem(item1) ); + Assert.assertTrue( logicImpl.canWriteItem(item2) ); + + // verify the mock objects were used + userDirectoryServiceControl.verify(); + toolManagerControl.verify(); + siteServiceControl.verify(); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#canWriteItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem, java.lang.String, java.lang.String)}. + */ + public void testCanWriteItemLamstwoItemStringString() { + // set up mock objects with return values + securityService.unlock(USER_ID, LamstwoLogicImpl.ITEM_WRITE_ANY, SITE_REF); + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); + securityService.unlock(MAINT_USER_ID, LamstwoLogicImpl.ITEM_WRITE_ANY, SITE_REF); + securityServiceControl.setReturnValue(true, MockControl.ZERO_OR_MORE); + + // activate the mock objects + securityServiceControl.replay(); + siteServiceControl.replay(); + + // mock objects needed here + // testing perms as a normal user + Assert.assertFalse( logicImpl.canWriteItem(adminitem, SITE_ID, USER_ID) ); + Assert.assertFalse( logicImpl.canWriteItem(maintitem, SITE_ID, USER_ID) ); + Assert.assertTrue( logicImpl.canWriteItem(item1, SITE_ID, USER_ID) ); + + // testing perms as user with special perms + Assert.assertFalse( logicImpl.canWriteItem(adminitem, SITE_ID, MAINT_USER_ID) ); + Assert.assertTrue( logicImpl.canWriteItem(maintitem, SITE_ID, MAINT_USER_ID) ); + Assert.assertTrue( logicImpl.canWriteItem(item1, SITE_ID, MAINT_USER_ID) ); + + // testing perms as admin user + Assert.assertTrue( logicImpl.canWriteItem(adminitem, SITE_ID, ADMIN_USER_ID) ); + Assert.assertTrue( logicImpl.canWriteItem(maintitem, SITE_ID, ADMIN_USER_ID) ); + Assert.assertTrue( logicImpl.canWriteItem(item1, SITE_ID, ADMIN_USER_ID) ); + + // verify the mock objects were used + securityServiceControl.verify(); + siteServiceControl.verify(); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getAllVisibleItems()}. + */ + public void testGetAllVisibleItems() { + // minimal testing for convenience methods + + // set up mock objects with return values + securityService.unlock(USER_ID, LamstwoLogicImpl.ITEM_READ_HIDDEN, SITE_REF); + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); + + // activate the mock objects + userDirectoryServiceControl.replay(); + securityServiceControl.replay(); + toolManagerControl.replay(); + siteServiceControl.replay(); + + // mock objects needed below here + List l = logicImpl.getAllVisibleItems(SITE_ID, USER_ID); // test normal user + + Assert.assertNotNull(l); + Assert.assertTrue(l.size() > 0); + Assert.assertTrue(l.contains(item1)); + Assert.assertTrue(! l.contains(item2)); + + // verify the mock objects were used + userDirectoryServiceControl.verify(); + securityServiceControl.verify(); + toolManagerControl.verify(); + siteServiceControl.verify(); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getAllVisibleItems(java.lang.String, java.lang.String)}. + */ + public void testGetAllVisibleItemsStringString() { + // always match the mock call regardless of corrent param values + //securityServiceControl.setDefaultMatcher(MockControl.ALWAYS_MATCHER); + + // set up mock objects with return values + securityService.unlock(USER_ID, LamstwoLogicImpl.ITEM_READ_HIDDEN, SITE_REF); + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); + securityService.unlock(MAINT_USER_ID, LamstwoLogicImpl.ITEM_READ_HIDDEN, SITE_REF); + securityServiceControl.setReturnValue(true, MockControl.ZERO_OR_MORE); + + // add 2 items to test if we can see the visible one and not the hidden one + LamstwoItem itemHidden = new LamstwoItem("New item title", ITEM_INTRODUCTION, + OTHER_USER_ID, SITE_ID, Boolean.TRUE, new Date()); + logicImpl.saveItem(itemHidden); + LamstwoItem itemVisible = new LamstwoItem("New item title", ITEM_INTRODUCTION, + OTHER_USER_ID, SITE_ID, Boolean.FALSE, new Date()); + logicImpl.saveItem(itemVisible); + + // activate the mock objects + userDirectoryServiceControl.replay(); + securityServiceControl.replay(); + toolManagerControl.replay(); + siteServiceControl.replay(); + + // mock objects needed below here + List l = logicImpl.getAllVisibleItems(SITE_ID, USER_ID); // test normal user + + Assert.assertNotNull(l); + Assert.assertTrue(l.size() > 0); + Assert.assertTrue(l.contains(item1)); + Assert.assertTrue(! l.contains(item2)); + Assert.assertTrue(l.contains(itemVisible)); + Assert.assertTrue(! l.contains(itemHidden)); + + List lmaintain = logicImpl.getAllVisibleItems(SITE_ID, MAINT_USER_ID); // test maintainer + + Assert.assertNotNull(lmaintain); + Assert.assertTrue(lmaintain.size() > 0); + Assert.assertTrue(lmaintain.contains(item1)); + Assert.assertTrue(! lmaintain.contains(item2)); + Assert.assertTrue(lmaintain.contains(itemVisible)); + Assert.assertTrue(lmaintain.contains(itemHidden)); + + List ladmin = logicImpl.getAllVisibleItems(SITE_ID, ADMIN_USER_ID); // test admin + + Assert.assertNotNull(ladmin); + Assert.assertTrue(ladmin.size() > 0); + Assert.assertTrue(ladmin.contains(item1)); + Assert.assertTrue(! ladmin.contains(item2)); + Assert.assertTrue(ladmin.contains(itemVisible)); + Assert.assertTrue(ladmin.contains(itemHidden)); + + // verify the mock objects were used + userDirectoryServiceControl.verify(); + securityServiceControl.verify(); + toolManagerControl.verify(); + siteServiceControl.verify(); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#removeItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem)}. + */ + public void testRemoveItem() { + // set up mock objects with return values + userDirectoryService.getCurrentUser(); // expect this to be called + userDirectoryServiceControl.setReturnValue(new TestUser(USER_ID)); + userDirectoryServiceControl.setReturnValue(new TestUser(MAINT_USER_ID)); + userDirectoryServiceControl.setReturnValue(new TestUser(ADMIN_USER_ID)); + userDirectoryServiceControl.setReturnValue(new TestUser(MAINT_USER_ID)); + userDirectoryServiceControl.setReturnValue(new TestUser(USER_ID)); + + securityService.unlock(new TestUser(USER_ID), LamstwoLogicImpl.ITEM_WRITE_ANY, SITE_REF); + securityServiceControl.setReturnValue(false, MockControl.ZERO_OR_MORE); + securityService.unlock(new TestUser(MAINT_USER_ID), LamstwoLogicImpl.ITEM_WRITE_ANY, SITE_REF); + securityServiceControl.setReturnValue(true, MockControl.ZERO_OR_MORE); + + // activate the mock objects + userDirectoryServiceControl.replay(); + securityServiceControl.replay(); + toolManagerControl.replay(); + siteServiceControl.replay(); + + // mock object is needed here + try { + logicImpl.removeItem(adminitem); // user cannot delete this + Assert.fail("Should have thrown SecurityException"); + } catch (SecurityException e) { + Assert.assertNotNull(e.getMessage()); + log.info("Could not remove item (this is correct)"); + } + + try { + logicImpl.removeItem(adminitem); // permed user cannot delete this + Assert.fail("Should have thrown SecurityException"); + } catch (SecurityException e) { + Assert.assertNotNull(e.getMessage()); + log.info("Could not remove item (this is correct)"); + } + + LamstwoItem item; + + logicImpl.removeItem(adminitem); // admin can delete this + item = logicImpl.getItemById(adminitem.getId()); + Assert.assertNull(item); + + logicImpl.removeItem(maintitem); // permed user can delete this + item = logicImpl.getItemById(maintitem.getId()); + Assert.assertNull(item); + + logicImpl.removeItem(item1); // user can delete this + item = logicImpl.getItemById(item1.getId()); + Assert.assertNull(item); + + // verify the mock objects were used + userDirectoryServiceControl.verify(); + securityServiceControl.verify(); + toolManagerControl.verify(); + siteServiceControl.verify(); + } + + /** + * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#saveItem(org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem)}. + */ + public void testSaveItem() { + // set up the mock objects + userDirectoryService.getCurrentUser(); // expect this to be called + userDirectoryServiceControl.setReturnValue(new TestUser(USER_ID)); // return this + + toolManager.getCurrentPlacement(); // expect this to be called + toolManagerControl.setReturnValue(new TestPlacement(SITE_ID)); // return this + + LamstwoItem item = new LamstwoItem("New item title", ITEM_INTRODUCTION, USER_ID, SITE_ID, ITEM_HIDDEN, new Date()); + logicImpl.saveItem(item); + Long itemId = item.getId(); + Assert.assertNotNull(itemId); + + // test saving an incomplete item + LamstwoItem incompleteItem = new LamstwoItem(); + incompleteItem.setTitle("New incomplete item"); + incompleteItem.setHidden(ITEM_HIDDEN); + + // activate the mock objects + userDirectoryServiceControl.replay(); + toolManagerControl.replay(); + + // mock object is needed here + logicImpl.saveItem(incompleteItem); + + Long incItemId = item.getId(); + Assert.assertNotNull(incItemId); + + item = logicImpl.getItemById(incItemId); + Assert.assertNotNull(item); + Assert.assertEquals(item.getOwnerId(), USER_ID); + Assert.assertEquals(item.getSiteId(), SITE_ID); + + // test saving a null value for failure + try { + logicImpl.saveItem(null); + Assert.fail("Should have thrown NullPointerException"); + } catch (NullPointerException e) { + Assert.assertNotNull(e.getStackTrace()); + log.info("Could not save null item (this is correct)"); + } + + // verify the mock object was used + userDirectoryServiceControl.verify(); + toolManagerControl.verify(); + } + +// /** +// * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getCurrentSiteId()}. +// */ +// public void testGetCurrentSiteId() { +// // set up this mock object +// toolManager.getCurrentPlacement(); // expect this to be called +// toolManagerControl.setReturnValue(new TestPlacement(SITE_ID)); // return this +// +// // activate the mock object +// toolManagerControl.replay(); +// +// // mock object is needed here +// String siteId = logicImpl.getCurrentContext(); +// +// // verify the mock object was used +// toolManagerControl.verify(); +// +// Assert.assertNotNull(siteId); +// Assert.assertEquals(siteId, SITE_ID); +// } +// +// /** +// * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getCurrentUserDisplayName()}. +// */ +// public void testGetCurrentUserDisplayName() { +// userDirectoryService.getCurrentUser(); // expect this to be called +// userDirectoryServiceControl.setReturnValue(new TestUser(USER_ID, USER_NAME, USER_DISPLAY)); // return this +// +// // activate the mock object +// userDirectoryServiceControl.replay(); +// +// // mock object is needed here +// String userDisplayName = logicImpl.getCurrentUserDisplayName(); +// +// // verify the mock object was used +// userDirectoryServiceControl.verify(); +// +// Assert.assertNotNull(userDisplayName); +// Assert.assertEquals(userDisplayName, USER_DISPLAY); +// } +// +// /** +// * Test method for {@link org.lamsfoundation.lams.integrations.sakai.logic.impl.LamstwoLogicImpl#getCurrentUserId()}. +// */ +// public void testGetCurrentUserId() { +// // set up this mock object +// userDirectoryService.getCurrentUser(); // expect this to be called +// userDirectoryServiceControl.setReturnValue(new TestUser(USER_ID)); // return this +// +// // activate the mock object +// userDirectoryServiceControl.replay(); +// +// // mock object is needed here +// String userId = logicImpl.getCurrentUserId(); +// +// // verify the mock object was used +// userDirectoryServiceControl.verify(); +// +// Assert.assertNotNull(userId); +// Assert.assertEquals(userId, USER_ID); +// } + +} Index: sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestPlacement.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestPlacement.java (revision 0) +++ sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestPlacement.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,85 @@ +/****************************************************************************** + * TestPlacement.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic.test; + +import java.util.Properties; + +import org.sakaiproject.tool.api.Placement; +import org.sakaiproject.tool.api.Tool; + +/** + * Test class for the Sakai Placement object
+ * This has to be here since I cannot create a Placement object in Sakai for some + * reason... sure would be nice if I could though -AZ + * @author Sakai App Builder -AZ + */ +public class TestPlacement implements Placement { + + private String id = "FAKE12345"; + private String context; // a.k.a. siteId + private String title; + private Tool tool; + private String toolId; + + /** + * Construct a test Placement object with a context (siteId) set + * @param context a String representing a site context (siteId) + */ + public TestPlacement(String context) { + this.context = context; + } + + + public Properties getConfig() { + // TODO Auto-generated method stub + return null; + } + + public String getContext() { + return context; + } + + public String getId() { + return id; + } + + public Properties getPlacementConfig() { + // TODO Auto-generated method stub + return null; + } + + public String getTitle() { + return this.title; + } + + public Tool getTool() { + return tool; + } + + public String getToolId() { + return toolId; + } + + public void save() { + // TODO Auto-generated method stub + } + + public void setTitle(String title) { + this.title = title; + } + + public void setTool(String toolId, Tool tool) { + this.tool = tool; + this.toolId = toolId; + } + +} \ No newline at end of file Index: sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestUser.java =================================================================== diff -u --- sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestUser.java (revision 0) +++ sakai-lamstwo/impl/logic/src/test/org/lamsfoundation/lams/integrations/sakai/logic/test/TestUser.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,165 @@ +/****************************************************************************** + * TestUser.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.logic.test; + +import java.util.Stack; + +import org.sakaiproject.entity.api.ResourceProperties; +import org.sakaiproject.time.api.Time; +import org.sakaiproject.user.api.User; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Test class for the Sakai User object
+ * This has to be here since I cannot create a User object in Sakai for some + * reason... sure would be nice if I could though -AZ + * @author Sakai App Builder -AZ + */ +public class TestUser implements User { + private String userId; + private String userEid = "fakeEid"; + private String displayName = "Fake DisplayName"; + + /** + * Construct an empty test user with an id set + * @param userId a id string + */ + public TestUser(String userId) { + this.userId = userId; + } + + /** + * Construct an empty test user with an id and eid set + * @param userId a id string + * @param userEid a username string + */ + public TestUser(String userId, String userEid) { + this.userId = userId; + this.userEid = userEid; + } + + /** + * Construct an empty test user with an id and eid set + * @param userId a id string + * @param userEid a username string + * @param displayName a user display name + */ + public TestUser(String userId, String userEid, String displayName) { + this.userId = userId; + this.userEid = userEid; + this.displayName = displayName; + } + + + public boolean checkPassword(String pw) { + // TODO Auto-generated method stub + return false; + } + + public User getCreatedBy() { + // TODO Auto-generated method stub + return null; + } + + public String getDisplayId() { + // TODO Auto-generated method stub + return null; + } + + public String getDisplayName() { + return this.displayName; + } + + public String getEid() { + return this.userEid; + } + + public String getEmail() { + // TODO Auto-generated method stub + return null; + } + + public String getFirstName() { + // TODO Auto-generated method stub + return null; + } + + public String getLastName() { + // TODO Auto-generated method stub + return null; + } + + public User getModifiedBy() { + // TODO Auto-generated method stub + return null; + } + + public String getSortName() { + // TODO Auto-generated method stub + return null; + } + + public String getType() { + // TODO Auto-generated method stub + return null; + } + + public String getId() { + return userId; + } + + public ResourceProperties getProperties() { + // TODO Auto-generated method stub + return null; + } + + public String getReference() { + // TODO Auto-generated method stub + return null; + } + + public String getReference(String rootProperty) { + // TODO Auto-generated method stub + return null; + } + + public String getUrl() { + // TODO Auto-generated method stub + return null; + } + + public String getUrl(String rootProperty) { + // TODO Auto-generated method stub + return null; + } + + public Element toXml(Document doc, Stack stack) { + // TODO Auto-generated method stub + return null; + } + + public int compareTo(Object arg0) { + // TODO Auto-generated method stub + return 0; + } + + public Time getCreatedTime() { + // TODO Auto-generated method stub + return null; + } + + public Time getModifiedTime() { + // TODO Auto-generated method stub + return null; + } +} Index: sakai-lamstwo/impl/pack/project.xml =================================================================== diff -u --- sakai-lamstwo/impl/pack/project.xml (revision 0) +++ sakai-lamstwo/impl/pack/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,136 @@ + + + + 3 + ../../../master/project.xml + sakai-lamstwo-pack + sakaiproject + sakai-lamstwo-pack + ${sakai.version} + + Sakai Project + http://www.sakaiproject.org/ + + 2006 + + + + components + + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + sakaiproject + sakai-lamstwo-logic-impl + ${sakai.version} + + true + + + + + sakaiproject + sakai-lamstwo-dao-impl + ${sakai.version} + + true + + + + + sakaiproject + sakai-util + ${sakai.version} + + true + + + + + + generic-dao + generic-dao + 0.8 + http://source.edtech.vt.edu/maven/ + + shared + + + + + + axis + axis + 1.4 + + true + + + + + axis + axis-jaxrpc + 1.4 + + true + + + + + axis + axis-saaj + 1.4 + + true + + + + + axis + axis-wsdl4j + 1.5.1 + + true + + + + + + commons-codec + commons-codec + 1.3 + + true + + + + + commons-discovery + commons-discovery + 0.4 + + true + + + + + + + + + + Index: sakai-lamstwo/impl/pack/src/webapp/WEB-INF/components.xml =================================================================== diff -u --- sakai-lamstwo/impl/pack/src/webapp/WEB-INF/components.xml (revision 0) +++ sakai-lamstwo/impl/pack/src/webapp/WEB-INF/components.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Index: sakai-lamstwo/impl/pack/src/webapp/WEB-INF/hibernate-hbms.xml =================================================================== diff -u --- sakai-lamstwo/impl/pack/src/webapp/WEB-INF/hibernate-hbms.xml (revision 0) +++ sakai-lamstwo/impl/pack/src/webapp/WEB-INF/hibernate-hbms.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,19 @@ + + + + + + + + + + + org/lamsfoundation/lams/integrations/sakai/hbm/LamstwoItem.hbm.xml + + + + + Index: sakai-lamstwo/impl/pack/src/webapp/WEB-INF/spring-hibernate.xml =================================================================== diff -u --- sakai-lamstwo/impl/pack/src/webapp/WEB-INF/spring-hibernate.xml (revision 0) +++ sakai-lamstwo/impl/pack/src/webapp/WEB-INF/spring-hibernate.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,43 @@ + + + + + + + + + + + + org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem + + + + + + + + + + + PROPAGATION_REQUIRED + + + + + + + + + + Index: sakai-lamstwo/project.xml =================================================================== diff -u --- sakai-lamstwo/project.xml (revision 0) +++ sakai-lamstwo/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,30 @@ + + + + 3 + ../master/project.xml + Sakai Lamstwo + sakaiproject + sakai-lamstwo + ${sakai.version} + + Sakai Project + http://sakaiproject.org/ + + 2006 + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + + Index: sakai-lamstwo/tool/project.xml =================================================================== diff -u --- sakai-lamstwo/tool/project.xml (revision 0) +++ sakai-lamstwo/tool/project.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,211 @@ + + + + 3 + ../../master/project.xml + sakai-lamstwo-tool + sakaiproject + sakai-lamstwo-tool + ${sakai.version} + + Sakai Project + http://sakaiproject.org/ + + 2006 + + + + war + + + + + + + sakaiproject + sakai + ${sakai.plugin.version} + plugin + + + + + sakaiproject + sakai-lamstwo-model-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-logic-api + ${sakai.version} + + + + sakaiproject + sakai-lamstwo-logic-impl + ${sakai.version} + + + + + sakaiproject + sakai-user-api + ${sakai.version} + + + + sakaiproject + sakai-entity-api + ${sakai.version} + + + + + sakaiproject + sakai-component + ${sakai.version} + + + + + servletapi + servletapi + 2.4 + + + + + sakaiproject + sakai-util + ${sakai.version} + + true + + + + + + sakaiproject + sakai-jsf-widgets + ${sakai.version} + http://sakaiproject.org/ + + true + + + + + + sakaiproject + sakai-jsf-widgets-myfaces + ${sakai.version} + http://sakaiproject.org/ + + true + + + + + + myfaces + myfaces-all + 1.1.1 + + true + + + + + myfaces + tomahawk + 1.1.1 + + true + + + + + + sakaiproject + sakai-jsf-tool + ${sakai.version} + + true + + + + + sakaiproject + sakai-jsf-app + ${sakai.version} + + true + + + + + + + commons-digester + commons-digester + 1.6 + + true + + + + + commons-beanutils + commons-beanutils + 1.7.0 + + true + + + + + commons-codec + commons-codec + 1.3 + + true + + + + + + commons-lang + commons-lang + ${sakai.commons.lang.version} + + + + commons-logging + commons-logging + 1.0.4 + + + + + + + src/java + + + ${basedir}/src/bundle + + **/*.properties + + + + ${basedir}/src/java + + **/*.xml + + + + + + Index: sakai-lamstwo/tool/src/bundle/Messages.properties =================================================================== diff -u --- sakai-lamstwo/tool/src/bundle/Messages.properties (revision 0) +++ sakai-lamstwo/tool/src/bundle/Messages.properties (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,24 @@ +# This file generated by Sakai App Builder -AZ +lamstwo_title=Lamstwo +lamstwo_text=Title +lamstwo_introduction=Introduction +lamstwo_id=ID +lamstwo_hidden=Hidden +lamstwo_schedule=Schedule +lamstwo_owner=Owner +lamstwo_date=Creation Date + +lamstwo_new=New Lesson +lamstwo_edit=Edit +lamstwo_author=Author +lamstwo_monitor=Monitor +lamstwo_startdate=Start Date + +lamstwo_add=Add/Update Item +lamstwo_delete=Delete +lamstwo_list=List Items + +lamstwo_next=Next +lamstwo_previous=Previous + +lamstwo_open_author = Open Author Index: sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoBean.java =================================================================== diff -u --- sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoBean.java (revision 0) +++ sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoBean.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,313 @@ +/****************************************************************************** + * LamstwoBean.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.tool.jsf; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.faces.model.DataModel; +import javax.faces.model.ListDataModel; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic; +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; + +/** + * This is a backing bean for the JSF app which handles the events and + * sends the information from the logic layer to the UI + * @author Sakai App Builder -AZ + */ +public class LamstwoBean { + + private static Log log = LogFactory.getLog(LamstwoBean.class); + + private static final String TEXT_DEFAULT = ""; + private static final String INTRODUCTION_DEFAULT = ""; + private static final Long SEQUENCE_ID_DEFAULT = 0L; + private static final Long LESSON_ID_DEFAULT = 0L; + private static final Boolean HIDDEN_DEFAULT = Boolean.FALSE; + private static final Boolean SCHEDULE_DEFAULT = Boolean.FALSE; + private static final Date START_DATE_DEFAULT = new Date(0); // TODO do we need this ? + + private static final long ONE_WEEK = 604800000; // Number of milliseconds in a week. + + private static final Integer AUTHORING_MODE = new Integer(1); + private static final Integer MONITORING_MODE = new Integer(2); + + private DataModel itemsModel; + private LamstwoItemWrapper currentItem = null; + + private LamstwoLogic logic; + public void setLogic(LamstwoLogic logic) { + this.logic = logic; + } + + private String itemText = TEXT_DEFAULT; + public String getItemText() { + return itemText; + } + public void setItemText(String itemText) { + this.itemText = itemText; + } + + private String itemIntroduction = INTRODUCTION_DEFAULT; + public String getItemIntroduction() { + return itemIntroduction; + } + public void setItemIntroduction(String itemIntroduction) { + this.itemIntroduction = itemIntroduction; + } + + private Long itemSequenceId = SEQUENCE_ID_DEFAULT; + public Long getItemSequenceId() { + return itemSequenceId; + } + public void setItemSequenceId(Long itemSequenceId) { + this.itemSequenceId = itemSequenceId; + } + + private Long itemLessonId = LESSON_ID_DEFAULT; + public Long getItemLessonId() { + return itemLessonId; + } + public void setItemLessonId(Long itemLessonId) { + this.itemLessonId = itemLessonId; + } + + private Boolean itemHidden = HIDDEN_DEFAULT; + public Boolean getItemHidden() { + return itemHidden; + } + public void setItemHidden(Boolean itemHidden) { + this.itemHidden = itemHidden; + } + + private Boolean itemSchedule = SCHEDULE_DEFAULT; + public Boolean getItemSchedule() { + return itemSchedule; + } + public void setItemSchedule(Boolean itemSchedule) { + this.itemSchedule = itemSchedule; + } + + private Date itemStartDate = START_DATE_DEFAULT; + public Date getItemStartDate() { + return itemStartDate; + } + public void setItemStartDate(Date itemStartDate) { + this.itemStartDate = itemStartDate; + } + + private String learningDesigns; + public String getLearningDesigns() { + return learningDesigns; + } + public void setLearningDesigns(String learningDesigns) { + this.learningDesigns = learningDesigns; + } + + private Boolean lessonCreated; + public Boolean getLessonCreated() { + return lessonCreated; + } + public void setLessonCreated(Boolean lessonCreated) { + this.lessonCreated = lessonCreated; + } + + public String getCurrentUserDisplayName() { + return logic.getCurrentUserDisplayName(); + } + + public String getAuthorURL() { + return logic.getAuthorURL(); + } + + public String getMonitorURL() { + String url = logic.getMonitorURL(); + url = url + "&lsid=" + itemLessonId; + return url; + } + + public String getLearnerURL() { + String url = logic.getLearnerURL(); + url = url + "&lsid=" + itemLessonId; + return url; + } + + + public LamstwoBean() { + } + + public DataModel getAllItems() { + log.debug("wrapping items for JSF datatable..."); + List wrappedItems = new ArrayList(); + + List items = logic.getAllVisibleItems(); + for (Iterator iter = items.iterator(); iter.hasNext(); ) { + LamstwoItemWrapper wrapper = + new LamstwoItemWrapper((LamstwoItem) iter.next()); + // Mark the item if the current user owns it and can delete it + if( logic.canWriteItem(wrapper.getItem()) ) { + wrapper.setCanDelete(true); + } else { + wrapper.setCanDelete(false); + } + wrappedItems.add(wrapper); + } + itemsModel = new ListDataModel(wrappedItems); + return itemsModel; + } + + private static final String LAMS_DATE_FORMAT = "dd/M/yyyy h:mm a"; + private static String convertToLamsDateFormat(Date date) { + SimpleDateFormat formatter = new SimpleDateFormat(LAMS_DATE_FORMAT); + return formatter.format(date); + } + + public String processActionAdd() { + log.debug("in process action add..."); + FacesContext fc = FacesContext.getCurrentInstance(); + // Test for empty items and don't add them + if (itemText != null && !itemText.equals("")) { + String message; + LamstwoItem item; + if (currentItem == null) { + item = new LamstwoItem(); + // ownerId, siteId, and dateCreated are set in the logic.saveItem + message = "Added new item:" + itemText; + } else { + item = currentItem.getItem(); + message = "Updated item:" + itemText; + } + item.setTitle(itemText); + item.setIntroduction(itemIntroduction); + item.setSequenceId(itemSequenceId); + item.setSchedule(itemSchedule); + item.setStartDate(itemStartDate); + + if (itemHidden == null) { itemHidden = Boolean.FALSE; } + item.setHidden(itemHidden); + + String startDate = convertToLamsDateFormat(itemStartDate); + log.debug(startDate); + Long lessonId = null; + if (item.getDateCreated() == null) { + // We are creating a new item + if (itemSchedule) { + lessonId = logic.scheduleLesson(itemSequenceId, itemText, itemIntroduction, startDate); + } else { + lessonId = logic.startLesson(itemSequenceId, itemText, itemIntroduction); + } + + if (lessonId == null) { + log.error("LAMS did not return a lessonId, Unable to save lesson"); + // TODO need to send something more meaningful to the user than a stack trace. + throw new RuntimeException(); + } + + item.setLessonId(lessonId); + } + + logic.saveItem(item); + + fc.addMessage("items", new FacesMessage(FacesMessage.SEVERITY_INFO, message, message)); + + // Reset text + itemText = ""; + itemIntroduction = ""; + itemSequenceId = 0L; // TODO is this right ??? + itemLessonId = 0L; + } else { + String message = "Could not add item without a title"; + fc.addMessage("items", new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); + } + // TODO need to check fields + + return "addedItem"; + } + + public String processActionDelete() { + log.debug("in process action delete..."); + FacesContext fc = FacesContext.getCurrentInstance(); + List items = (List) itemsModel.getWrappedData(); + int itemsRemoved = 0; + for (Iterator iter = items.iterator(); iter.hasNext(); ) { + LamstwoItemWrapper wrapper = + (LamstwoItemWrapper) iter.next(); + if(wrapper.isSelected()) { + logic.deleteLesson(wrapper.getItem().getLessonId()); + logic.removeItem(wrapper.getItem()); + itemsRemoved++; + } + } + String message = "Removed " + itemsRemoved + " items"; + fc.addMessage("items", new FacesMessage(FacesMessage.SEVERITY_INFO, message, message)); + return "deleteItems"; + } + + + public String processActionNew() { + log.debug("in process action new..."); + currentItem = null; + // set the values to the new defaults + itemText = TEXT_DEFAULT; + itemIntroduction = INTRODUCTION_DEFAULT; + itemSequenceId = SEQUENCE_ID_DEFAULT; + itemStartDate = new Date(System.currentTimeMillis() + ONE_WEEK); + itemHidden = HIDDEN_DEFAULT; + learningDesigns = logic.getLearningDesigns(MONITORING_MODE); + lessonCreated = Boolean.FALSE; + return "newItem"; + } + + public String processActionUpdate() { + log.debug("in process action update..."); + currentItem = (LamstwoItemWrapper) itemsModel.getRowData(); // gets the user selected item + // set the values to those of the selected item + itemText = currentItem.getItem().getTitle(); + itemIntroduction = currentItem.getItem().getIntroduction(); + itemSequenceId = currentItem.getItem().getSequenceId(); //TODO temp just for now, we shouldn't be able to change this. + // NB: itemStartDate can not be updated once a lesson has been scheduled or started. + itemHidden = currentItem.getItem().getHidden(); + lessonCreated = Boolean.TRUE; + return "updateItem"; + } + + public String processActionList() { + log.debug("in process action list..."); + return "listItems"; + } + + public String processActionLearner() { + log.debug("in process action learner..."); + currentItem = (LamstwoItemWrapper) itemsModel.getRowData(); // gets the user selected item + itemLessonId = currentItem.getItem().getLessonId(); + return "openLearner"; + } + + public String processActionMonitor() { + log.debug("in process action monitor..."); + currentItem = (LamstwoItemWrapper) itemsModel.getRowData(); // gets the user selected item + itemLessonId = currentItem.getItem().getLessonId(); + return "openMonitor"; + } + + public Boolean getCanCreateItem() { + return logic.canCreateItem(); + } +} Index: sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoItemWrapper.java =================================================================== diff -u --- sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoItemWrapper.java (revision 0) +++ sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/jsf/LamstwoItemWrapper.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,64 @@ +/****************************************************************************** + * LamstwoItemWrapper.java - created by Sakai App Builder -AZ + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.tool.jsf; + +import org.lamsfoundation.lams.integrations.sakai.model.LamstwoItem; + + +/** + * This is a wrapper class which is required to get the interactions from the user + * without storing UI dependent information in the data POJO + * @author Sakai App Builder -AZ + */ +public class LamstwoItemWrapper { + + private LamstwoItem item; + private boolean canDelete; // can this item be deleted + private boolean isSelected; // is this item selected by the user + + /** + * Constructor which accepts the object we are wrapping + * @param item the LamstwoItem we are wrapping + */ + public LamstwoItemWrapper(LamstwoItem item) { + this.item = item; + } + + + /** + * Basic setters and getters + */ + public LamstwoItem getItem() { + return item; + } + + public void setItem(LamstwoItem item) { + this.item = item; + } + + public boolean isCanDelete() { + return canDelete; + } + + public void setCanDelete(boolean canDelete) { + this.canDelete = canDelete; + } + + public boolean isSelected() { + return isSelected; + } + + public void setSelected(boolean isSelected) { + this.isSelected = isSelected; + } + +} Index: sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/servlet/UserDataServlet.java =================================================================== diff -u --- sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/servlet/UserDataServlet.java (revision 0) +++ sakai-lamstwo/tool/src/java/org/lamsfoundation/lams/integrations/sakai/tool/servlet/UserDataServlet.java (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,84 @@ +/****************************************************************************** + * UserDataServlet.java + * + * Copyright (c) 2007 LAMS Foundation + * Licensed under the Educational Community License version 1.0 + * + * A copy of the Educational Community License has been included in this + * distribution and is available at: http://www.opensource.org/licenses/ecl1.php + * + *****************************************************************************/ + +package org.lamsfoundation.lams.integrations.sakai.tool.servlet; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic; +import org.sakaiproject.component.cover.ComponentManager; + +public class UserDataServlet extends HttpServlet { + + private static final long serialVersionUID = 1182398377731015444L; + + private static Log log = LogFactory.getLog(UserDataServlet.class); + + private static final String PARAM_USERNAME = "username"; + private static final String PARAM_TIMESTAMP = "timestamp"; + private static final String PARAM_HASH = "hash"; + + @Override + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + + LamstwoLogic logic = (LamstwoLogic)ComponentManager.get("org.lamsfoundation.lams.integrations.sakai.logic.LamstwoLogic"); + + // get parameters + String usernameParam = request.getParameter(PARAM_USERNAME); + String timestampParam = request.getParameter(PARAM_TIMESTAMP); + String hashParam = request.getParameter(PARAM_HASH); + + // check parameters + if (usernameParam == null || timestampParam == null + || hashParam == null) { + String message = "missing expected parameters"; + log.error("Unable to retrieve user data: missing expected parameters"); + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, + message); + return; + } + + String serverKey = logic.getServerKey(); + String serverID = logic.getServerID(); + + if (serverID == null || serverKey == null) { + log.error("Unable to retrieve user data, server id or server key is null"); + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + "LAMS tool configuration error"); + } + + // check whether hash is valid + String[] elements = {timestampParam, usernameParam, serverID, serverKey}; + if (!logic.isHashValid(elements, hashParam)) { + log.error("Unable to process request, invalid hash"); + response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "authentication failed"); + } + + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + String userInfo = logic.getUserInfo(usernameParam); + + if (userInfo == null) { + throw new ServletException("Could not find user with id: " + usernameParam); + } + out.println(userInfo); + } +} \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/WEB-INF/applicationContext.xml =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/WEB-INF/applicationContext.xml (revision 0) +++ sakai-lamstwo/tool/src/webapp/WEB-INF/applicationContext.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/WEB-INF/faces-config.xml =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/WEB-INF/faces-config.xml (revision 0) +++ sakai-lamstwo/tool/src/webapp/WEB-INF/faces-config.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,74 @@ + + + + + + + + + Messages + + en + + + + + + /lamstwo/LamstwoItems.jsp + + newItem + /lamstwo/LamstwoAddItem.jsp + + + updateItem + /lamstwo/LamstwoAddItem.jsp + + + deleteItems + /lamstwo/LamstwoItems.jsp + + + * + /lamstwo/LamstwoItems.jsp + + + openLearner + /lamstwo/LamstwoLearner.jsp + + + openMonitor + /lamstwo/LamstwoMonitor.jsp + + + + + /lamstwo/LamstwoAddItem.jsp + + addedItem + /lamstwo/LamstwoItems.jsp + + + listItems + /lamstwo/LamstwoItems.jsp + + + * + /lamstwo/LamstwoItems.jsp + + + + + + Lamstwo Tool: Lamstwo Bean + LamstwoBean + org.lamsfoundation.lams.integrations.sakai.tool.jsf.LamstwoBean + session + + Lamstwo Logic + logic + #{org_lamsfoundation_lams_integrations_sakai_logic_LamstwoLogic} + + + + \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/WEB-INF/sakai-jsf.tld =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/WEB-INF/sakai-jsf.tld (revision 0) +++ sakai-lamstwo/tool/src/webapp/WEB-INF/sakai-jsf.tld (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,3684 @@ + + + + + + + 1.9 + 1.2 + sakai + http://sakaiproject.org/jsf/sakai + +Sakai style guide.]]> + + + + view + org.sakaiproject.jsf.tag.ViewTag + JSP + + Outermost container for a Sakai tool. Parent should be a f:view tag. + Contains all other Sakai tags. Responsible for rendering the HTML, + HEAD, and BODY tags (if necessary in the rendering context). If the + tool is being rendered as a fragment of HTML, this tag will detect + this and not render the HTML, HEAD, and BODY. + + + + title + false + false + + The page title. Rendered as the HTML title of the tool page, unless + the tool is being aggreggated and doesn't have its own HTML document. + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + view_container + org.sakaiproject.jsf.tag.ViewTag + JSP + DEPRECATED - Use sakai:view tag instead. + ]]> + + + + title + false + false + + The page title. Rendered as the HTML title of the tool page, unless + the tool is being aggreggated and doesn't have its own HTML document. + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + view_content + org.sakaiproject.jsf.tag.ViewContentTag + JSP + DEPRECATED - no longer necessary. This tag has been + phased out and is only here for compatibility with older Sakai tools. + ]]> + + + + + view_title + org.sakaiproject.jsf.tag.ViewTitleTag + empty + + Output a view title according to the Sakai Style Guide. Usually displayed at the + top of a tool page. + + + indent + false + false + + The integer intentation level at which to display this component - See the Sakai Style Guide. + Default is no special indentation. + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + value + false + false + java.lang.String + + The text of the title to display. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + ]]> + + + + + + tool_bar + org.sakaiproject.jsf.tag.ToolBarTag + JSP + + Renders a Sakai style toolbar at the top of the tool. + Should be contained in an h:form tag. Children are tool_bar_ttem or tool_bar_spacer tags. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean. + + + + + id + false + false + + The component identifier for this component. This value must be unique + within the closest parent component that is a naming container. + + + + + + + tool_bar_item + org.sakaiproject.jsf.tag.ToolBarItemTag + empty + + Renders a Sakai style toolbar item (or button). Parent should be a tool_bar tag. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean. + + + + + id + false + false + + The component identifier for this component. This value must be unique + within the closest parent component that is a naming container. + + + + + action + false + false + java.lang.String + MethodBinding representing the application action to invoke when this + component is activated by the user. The expression must evaluate to a public method + that takes no parameters, and returns a String (the logical outcome) which is passed + to the NavigationHandler for this application. + + + + + value + false + false + java.lang.String + The displayed label of the toolbar item. + + + + disabled + false + false + boolean + If true, the toolbar item is disabled. Clicking on the item does nothing. + + + + immediate + false + false + boolean + Flag indicating that, if this component is activated by the user, + notifications should be delivered to interested listeners and actions immediately + (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. + + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + + tool_bar_spacer + org.sakaiproject.jsf.tag.ToolBarSpacerTag + empty + + Renders a spacer (separator) in a Sakai style toolbar. Parent should be a tool_bar tag. + + + + + + tool_bar_message + org.sakaiproject.jsf.tag.ToolBarMessageTag + empty + + Renders a message in the toolbar location. Typically used instead of a toolbar. + Parent should usually be an h:form tag. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean. + + + + + id + false + false + + The component identifier for this component. This value must be unique + within the closest parent component that is a naming container. + + + + + value + false + false + + The text of the message. + + + + + + + instruction_message + org.sakaiproject.jsf.tag.InstructionMessageTag + empty + + Render an instructional message. Should be contained in a sakai:view tag. + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + value + false + false + + The message text + + + + + + + + messages + org.sakaiproject.jsf.tag.MessagesTag + empty + + Output JSF messages (Sakai alert messages). Parent should be a sakai:view tag. + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + input_date + org.sakaiproject.jsf.tag.InputDateTag + JSP + + + + + + + + id + false + false + + Component id of this component. + + + + showDate + false + false + + If true, enable input for user to enter the date. Default is true. + + + + showTime + false + false + + If true, enable input for user to enter the time. Default is true. + + + + showSecond + false + false + + If true, and showTime is true, input seconds. + Default is false. + If false, default to zero seconds. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + value + false + false + + The current value of this component. + + + + rendered + false + false + + Flag indicating that this element should be rendered. + Default is true; + + + + disabled + false + false + + Flag indicating that this element must never + receive focus or be included in a subsequent + submit. + + + + + + + + + + output_date + org.sakaiproject.jsf.tag.OutputDateTag + empty + + Output a date in the Sakai date format, for example 2003-Mar-07 07:42:00 pm. + See the Sakai Style Guide, under topic Date/Time Entry. + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + value + false + false + + The current value of this component. + + + + showTime + false + false + + If true, show time. Default is true. + If false, no time will be shown. + + + + showDate + false + false + + If true, show date. Default is true. + If false, no date will be shown. + + + + showSeconds + false + false + + If true and showTime is true, show seconds. + Default value is false. + + + + + + + button_bar + org.sakaiproject.jsf.tag.ButtonBarTag + JSP + + Render Sakai style button ("action") bar at the bottom of the tool. + See the Sakai Style Guide, "Item Summary Detail" and "Aggregated Item Summary". + Children are button_bar_item tags. + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + + + button_bar_item + org.sakaiproject.jsf.tag.ButtonBarItemTag + empty + + Render an item in a Sakai style button bar. Parent should be a sakai:button_bar tag. + + + + active + false + false + + Whether this component is the "active" button (maybe the default button?). Default is false. + + + + styleClass + false + false + + To allow adding the css class of 'active' to the button in the button_bar that is most likely to be the default + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + action + false + false + java.lang.String + + MethodBinding representing the application action to invoke when this component + is activated by the user. The expression must evaluate to a public method that + takes no parameters, and returns a String (the logical outcome) which is passed + to the NavigationHandler for this application. + + + + value + false + false + java.lang.String + + The current value of this component. + + + + disabled + false + false + boolean + + Flag indicating that this element must never receive focus or be included in a subsequent submit. + + + + immediate + false + false + boolean + + Flag indicating that, if this component is activated by the user, + notifications should be delivered to interested listeners and actions + immediately (that is, during Apply Request Values phase) rather than + waiting until Invoke Application phase. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + accesskey + false + false + + Access key that, when pressed, transfers focus to this element. + + + + tabindex + false + false + + Position of this element in the tabbing order for the current document. + This value must be an integer between 0 and 32767. + + + + title + false + false + + Advisory title information about markup elements generated for this component. + + + + + + peer_refresh + org.sakaiproject.jsf.tag.PeerRefreshTag + empty + + Adds a javascript refresh to a peer html element to the rendering. + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + value + false + false + + The name of the peer element. + + + + + + + courier + org.sakaiproject.jsf.tag.CourierTag + empty + + Place a Sakai Courier in the response. + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + refresh + false + false + + The refresh interval, in seconds + + + + + + flat_list + org.sakaiproject.jsf.tag.FlatListTag + JSP + + Render a flat (non-hierarchical) list. See the Sakai Style Guide, + under topics "List" and "Actionable List". + + + + binding + false + false + + Component reference expression for this component. + + + + + styleClass + false + false + + Pass throught styleClass for this widget + + + + + columnClasses + false + false + + Pass throught columnClasses for this widget + + + + + summary + false + false + + Pass throught summary for this widget + + + + + + id + false + false + + Component id of this component. + + + + + value + false + false + + + + + + var + false + false + + + + + + + + doc_properties + org.sakaiproject.jsf.tag.DocPropertiesTag + JSP + + A 2 column name / value set of properties for a document + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + + + doc_section_title + org.sakaiproject.jsf.tag.DocSectionTitleTag + JSP + + A document section title + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + + + doc_section + org.sakaiproject.jsf.tag.DocSectionTag + JSP + + A document section + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + + + group_box + org.sakaiproject.jsf.tag.GroupBoxTag + JSP + DEPRECATED - use panel_titled instead. + ]]> + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + title + false + false + + The group box title + + + + + + panel_titled + org.sakaiproject.jsf.tag.GroupBoxTag + JSP + + Container that renders children components inside a titled grouping box. + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + title + false + false + + The group box title + + + + + + + panel_edit + org.sakaiproject.jsf.tag.PanelEditTag + JSP + + Setup an editing panel. 2 column layout. + + + + binding + false + false + + Component reference expression for this component. + + + + + id + false + false + + Component id of this component. + + + + + + + rich_text_area + org.sakaiproject.jsf.tag.RichTextAreaTag + JSP + + DEPRECATED - use inputRichText tag instead. Only present + here for compatibility with older Sakai tools. + Renders a WYSIWYG text editor. Allows the user to edit HTML formatted text. + The JavaScript widget is based on the open-source + HTMLArea project. + ]]> + + + + value + false + false + + + + + + binding + false + false + + + + + + columns + false + false + + Number of columns in the textarea (in character units). Complements the the 'width' attribute. + + + + + rows + false + false + + Number of rows in the textarea (in character units). Complements the 'height' attribute. + + + + + width + false + false + + Width of the widget (in pixel units). Complements the 'columns' attribute. + + + + + height + false + false + + Height of the widget (in pixel units). Complements the 'rows' attribute. + + + + + toolbarButtonRows + false + false + + Number of rows of buttons in the toolbar. Defaults to 2. Valid values are 0, 2, or 3. + + + + + javascriptLibrary + false + false + + The URL to the directory of the HTMLArea JavaScript library. + Defaults to the Sakai legacy customized HTMLArea. May be a relative URL. + + + + + autoConfig + false + false + + Whether to recalculate the configuration - defaults to false. If true, + the width, height, and toolbarButtonRows will be recalculated based on + the values given. + + + + + justArea + false + false + + DEPRECATED]]> - use toolbarButtonRows=0 instead. + If true, the WYSIWYG toolbar is not shown. The text is still editable. + Keyboard shortcuts for formatting (like Ctrl-B for bold) still work. + + + + + + inputRichText + org.sakaiproject.jsf.tag.InputRichTextTag + JSP + + HTMLArea project. + HTMLArea is copyright + InteractiveTools.com + and Dynarch.com and it is released + under a BSD-style license. +
+
+ HTMLArea was created and developed up to + version 2.03 by InteractiveTools.com. Version 3.0 is a full rewrite, + developed by Mihai Bazon. + It contains code sponsored by third-party + companies as well. Please see our About Box for details about + who sponsored what plugins. + ]]> +
+ + + value + false + false + + The editable HTML displayed inside the textarea. + + + + + cols + false + false + + Number of columns in the textarea (in character units). Defaults to 80. + Complements the the 'width' attribute. Passes through to the HTML textarea element. + + + + + rows + false + false + + Number of rows in the textarea (in character units). Defaults to 15. + Complements the 'height' attribute. Passes through to the HTML textarea element. + + + + + width + false + false + + Width of the widget (in pixel units). + If this attribute is not specified, the width is controlled by the 'cols' attribute. + + + + + height + false + false + + Height of the widget (in pixel units). + If this attribute is not specified, the width is controlled by the 'rows' attribute. + + + + + textareaOnly + false + false + + If true, only the textarea will be rendered. Defaults to false. + If true, the rich text toolbar + and external HTMLArea JavaScript will not be rendered. Attributes that + affect the textarea element will be rendered (for example style, styleClass). + This widget is then rendered as just a plain-old textarea. + + + + + buttonSet + false + false + + Select toolbar from among a number precanned lists of command buttons. + Allowed values are: "none", "small", "medium", "large". (values tentative). + Defaults to "medium", which has 2 rows of buttons. For fine-grained + control of which buttons are shown, use the buttonList attribute + instead. "small" has 1 row + of buttons. "large" has 3 rows of buttons, almost everything available. + "none" has 0 rows of buttons, no buttons at all - The text is still editable; + Keyboard shortcuts for formatting (like Ctrl-B for bold) still work. + + + + + buttonList + false + false + + Comma delimited list of toolbar command buttons registered with + component. If not specified, will default to a defined list. + + + + + javascriptLibraryExtensionURL + false + false + + URL to an external JavaScript file with additional + JavaScript to execute beyond the default, for example + extra command button definitions. May be a relative URL. + Default is nothing. + + + + + javascriptLibraryURL + false + false + + The URL to the directory of the HTMLArea JavaScript library. + This allows overriding the default HTMLArea JavaScript library + that comes with this component. + May be a relative URL. + + + + + showXPath + false + false + + If true show XPath at bottom of editor. Default is true. + + + + + hideAble + false + false + + Show sub control allowing you to hide editor. + Default is false. + + + + + autoConfig + false + false + + ___TODO: This is here for legacy purposes - is it really necessary anymore?___ + Whether to recalculate the configuration - defaults to false. If true, + the width, height, and toolbar buttons will be recalculated based on + the values given. + + + + + binding + false + false + + + + + + converter + false + false + + Converter instance registered with this component. + + + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + + immediate + false + false + + Flag indicating that this component's value must be + converted and validated immediately (that is, during + Apply Request Values phase), rather than waiting + until Process Validations phase. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + required + false + false + + Flag indicating that the user is required to provide a submitted + value for this input component. + + + + validator + false + false + + MethodBinding representing a validator method that will be called + during Process Validations to perform correctness checks on the + value of this component. The expression must evaluate to a public + method that takes FacesContext, UIComponent, and Object parameters, + with a return type of void. + + + + value + false + false + + The current value of this component. + + + + valueChangeListener + false + false + + MethodBinding representing a value change listener method that will be + notified when a new value has been set for this input component. The + expression must evaluate to a public method that takes a + ValueChangeEvent parameter, with a return type of void. + + + + accesskey + false + false + + Access key that, when pressed, transfers focus + to this element. + + + + dir + false + false + + Direction indication for text that does not inherit directionality. + Valid values are "LTR" (left-to-right) and "RTL" (right-to-left). + + + + disabled + false + false + + Flag indicating that this element must never + receive focus or be included in a subsequent + submit. + + + + lang + false + false + + Code describing the language used in the generated markup + for this component. + + + + readonly + false + false + + Flag indicating that this component will prohibit + changes by the user. The element may receive focus + unless it has also been disabled. + + + + style + false + false + + CSS style(s) to be applied to the underlying textarea when it is rendered. + + + + styleClass + false + false + + Space-separated list of CSS style class(es) to be applied when + the underlying textarea is rendered. This value must be passed through + as the "class" attribute on generated markup. + + + + tabindex + false + false + + Position of the underlying textarea element in the tabbing order + for the current document. This value must be + an integer between 0 and 32767. + + + + title + false + false + + Advisory title information about markup elements generated + for this component. + + + + attachedFiles + false + false + + A list of SelectItems or a Map of link to label strings that + will be rendered as a list on the editor. + + +
+ + + inputFileUpload + org.sakaiproject.jsf.tag.InputFileUploadTag + JSP + + Widget that allows the user to upload a file. The uploaded + file is available through the value of the component, through the FileItem + interface. See the Apache commons-fileupload 1.0 API for details at + http://jakarta.apache.org/commons/fileupload/. The recommended use of this + widget is to use the valueChangeListener attribute to call a method that + will process the uploaded file. The uploaded file is NOT persisted to + storage automatically; the application is responsible for that, not the + widget. + + The widget needs a filter configured in web.xml. The Sakai + RequestFilter is recommended; however, a custom filter is permissable. + The widget is compatible with the MyFaces filter ("extensionsFilter") as an alternative. + A custom filter must expose the uploaded file though the commons-fileupload 1.0 + FileItem interface, in one of two ways. It must be made available + either as a request attribute with the + field name, and would be accessible as follows: + FileItem item = (FileItem) request.getAttribute(fieldName); + OR as a method on a request wrapper with the following signature: + public org.apache.commons.fileupload.FileItem getFileItem(String fieldName) + + + + value + false + false + + The current value of this component. If the "directory" attribute is not + used, the value of the component is the uploaded FileItem. If the "directory" + attribute is used, the value of the component is the server-side absolute + path to the uploaded file. + + + + + directory + false + false + + If present, the directory to which to persist uploaded files. Use of this + attribute is discouraged. If this attribute is used, a tool which contains + the tag will not + be cluster-safe since different application servers probably do not share + the same filesystem. If a file already exists and another file of the same + name is uploaded, the existing file will be overwritten. + + + + + valueChangeListener + false + false + + This is the recommended way to access the uploaded file. The valueChangeListener + will be called when a file is uploaded.MethodBinding representing a value change + listener method that will be + notified when a new value has been set for this input component. The + expression must evaluate to a public method that takes a + ValueChangeEvent parameter, with a return type of void. + + + + + style + false + false + + CSS style(s) to be applied to the underlying input tag when it is rendered. + + + + styleClass + false + false + + Space-separated list of CSS style class(es) to be applied when + the underlying input tag is rendered. This value must be passed through + as the "class" attribute on generated markup. + + + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + + binding + false + false + + + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + immediate + false + false + + Flag indicating that this component's value must be + converted and validated immediately (that is, during + Apply Request Values phase), rather than waiting + until Process Validations phase. + + + + + required + false + false + + Flag indicating that the user is required to provide a submitted + value for this input component. + + + + + validator + false + false + + MethodBinding representing a validator method that will be called + during Process Validations to perform correctness checks on the + value of this component. The expression must evaluate to a public + method that takes FacesContext, UIComponent, and Object parameters, + with a return type of void. + + + + + accept + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + align + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + accesskey + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + maxlength + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + size + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + + disabled + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + readonly + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + tabindex + false + false + + Pass-through attribute. Will be output as-is on the underlying input element. + + + + + + + + + + + + In web.xml: + + sakai.request + org.sakaiproject.util.RequestFilter + + upload.enabled + true + + + + In ExampleBean.java: + public void processFileUpload(ValueChangeEvent event) throws AbortProcessingException + { + try + { + FileItem item = (FileItem) event.getNewValue(); + String fieldName = item.getFieldName(); + String fileName = item.getName(); + long fileSize = item.getSize(); + System.out.println("processFileUpload(): item: " + item + " fieldname: " + fieldName + " filename: " + fileName + " length: " + fileSize); + + // Read the file as a stream (may be more memory-efficient) + InputStream fileAsStream = item.getInputStream(); + + // OR INSTEAD read the contents as a byte array (probably less memory-efficient) + byte[] fileContents = item.get(); + + // now process the file. Do application-specific processing + // such as parsing the file, storing it in the database, + // or whatever needs to happen with the uploaded file. + } + catch (Exception ex) + { + // handle exception + } + } + ]]> + + + + + + pager + org.sakaiproject.jsf.tag.PagerTag + JSP + + Pager widget that provides UI controls for paging a table. See the + Sakai style guide, under heading "List Navigator UI Components". + + + totalItems + true + false + + Total number of items in the list. This attribute is read-only; + the widget will get this value, but not set it. + + + + firstItem + false + false + The item number (0-based) of the first item displayed. + This attribute is read-write; the widget will get this value, and set it when + it is changed. Alternate to using the value attribute. + + + pageSize + false + false + + Number of items to display in a single page of items. + Default is 20. This attribute is read-write; the widget will get this value, and set it when + it is changed. Alternate to using the value attribute. + + + + accesskeys + false + false + + Whether to have HTML "accesskey" attributes for the buttons. Default is false. + + + + value + false + false + + The value (which is the paging state of this widget) is two numbers + in a String, of the form "firstItem,pageSize". + See attributes firstItem and pageSize. + + + + lastItem + false + false + One past the last item displayed (eg, items 1-10 would have lastItem=10). + This attribute is write-only; the widget calculates this attribute + and sets it when it has changed. + + + + valueChangeListener + false + false + + Register a listener that will be called when the widget value (the paging state) changes. + See the value attribute. + + + + + + pageSizes + false + false + + String which is a list of options of number of items per page. Default is "5,10,20,50,100". + + + + renderFirst + false + false + Whether to display the "first item" button. Default is true. + + + renderPrev + false + false + Whether to display the "previous item" button. Default is true. + + + renderNext + false + false + Whether to display the "next item" button. Default is true. + + + renderLast + false + false + Whether to display the "last item" button. Default is true. + + + renderPageSize + false + false + Whether to display the select page size dropdown. Default is true. + + + textFirst + false + false + Text to display on the button which goes to the first page of items. Default is "|<". + + + textPrev + false + false + Text to display on the button which goes to the previous page of items. Default is "<". + + + textNext + false + false + Text to display on the button which goes to the next page of items. Default is ">". + + + textLast + false + false + Text to display on the button which goes to the last page of items. Default is ">|". + + + textPageSize + false + false + Text message to display for selecting page size. Default is "Show {0}". + + + textItem + false + false + Word that describes the items. Default is "items". This might be (for example) "students". + + + textStatus + false + false + Text message to display the status of paging. Default is "Viewing {0} to {1} of {2} {3}". + + + + binding + false + false + + Component reference expression for this component. + + + + id + false + false + + Component id of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + immediate + false + false + + Flag indicating that this component's value must be + converted and validated immediately (that is, during + Apply Request Values phase), rather than waiting + until Process Validations phase. + + + + + + Example #2 (Common usage): + + + + + + + + + Example #3 (Advanced customization): + + ]]> + + + + + + debug + org.sakaiproject.jsf.tag.DebugTag + empty + + This tag is strictly for debugging purposes. It outputs information + on various JSF variables and scopes, and should not be used in production. + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + applet + org.sakaiproject.jsf.tag.AppletTag + JSP + + render applet. +

]]> +
+ + name + false + false + + The applet name. + + + + version + false + false + + The applet version. + + + + codebase + false + false + + The applet codebase. + + + + width + false + false + + The applet width. + + + + height + false + false + + The applet height. + + + + hspace + false + false + + The applet horizontal space. + + + + vspace + false + false + + The applet vertical space. + + + + javaClass + false + false + + The applet Java class. + + + + javaArchive + false + false + + The applet Java archive. + + + + paramList + false + false + + The applet parameters in a comma separated key=value format. + TODO: escaping quoting etc. + + +
+ + + + dataLine + org.sakaiproject.jsf.tag.DataLineTag + JSP + + Analogous to the data table in iterating over a list, + but without creating a surrounding table or using columns. "Rows" + are the data rows of the underlying data, not table rows. +

]]> +
+ + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + separator + false + false + + If not empty, the contents of this attribute are interpolated + between each iteration. + + + + first + false + false + + Zero-relative row number of the first row to be displayed. If this + property is set to zero, rendering will begin with the first row of + the underlying data. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + rows + false + false + + The number of rows of the underlying data model to be displayed, + starting with the one identified by the + "first" property. If this value is set to zero, all available rows + in the underlying data model will be displayed. + + + + value + false + false + + The current value of this component. + + + + var + false + false + + Name of a request-scope attribute under which the model data for the + row selected by the current value of the "rowIndex" property (i.e. + also the current value of the "rowData" property) will be exposed. + + + + lang + false + false + + Code describing the language used in the generated markup + for this component. + + + + onclick + false + false + + Javascript code executed when a pointer button is + clicked over this element. + + + + ondblclick + false + false + + Javascript code executed when a pointer button is + double clicked over this element. + + + + onkeydown + false + false + + Javascript code executed when a key is + pressed down over this element. + + + + onkeypress + false + false + + Javascript code executed when a key is + pressed and released over this element. + + + + onkeyup + false + false + + Javascript code executed when a key is + released over this element. + + + + onmousedown + false + false + + Javascript code executed when a pointer button is + pressed down over this element. + + + + onmousemove + false + false + + Javascript code executed when a pointer button is + moved within this element. + + + + onmouseout + false + false + + Javascript code executed when a pointer button is + moved away from this element. + + + + onmouseover + false + false + + Javascript code executed when a pointer button is + moved onto this element. + + + + onmouseup + false + false + + Javascript code executed when a pointer button is + released over this element. + + + + style + false + false + + CSS style(s) to be applied when this component is rendered. + + + + styleClass + false + false + + Space-separated list of CSS style class(es) to be applied when + this element is rendered. This value must be passed through + as the "class" attribute on generated markup. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean + + +
+ + + dynaTable + org.sakaiproject.jsf.tag.DynaTableTag + JSP + + Analogous to the data table in iterating over a list, + but without creating a surrounding table or using columns. "Rows" + are the data rows of the underlying data, not table rows. +

]]> +
+ + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + first + false + false + + Zero-relative row number of the first row to be displayed. If this + property is set to zero, rendering will begin with the first row of + the underlying data. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + rows + false + false + + The number of rows of the underlying data model to be displayed, + starting with the one identified by the + "first" property. If this value is set to zero, all available rows + in the underlying data model will be displayed. + + + + value + false + false + + The current value of this component. + + + + var + false + false + + Name of a request-scope attribute under which the model data for the + row selected by the current value of the "rowIndex" property (i.e. + also the current value of the "rowData" property) will be exposed. + + + + + lang + false + false + + Code describing the language used in the generated markup + for this component. + + + + onclick + false + false + + Javascript code executed when a pointer button is + clicked over this element. + + + + ondblclick + false + false + + Javascript code executed when a pointer button is + double clicked over this element. + + + + onkeydown + false + false + + Javascript code executed when a key is + pressed down over this element. + + + + onkeypress + false + false + + Javascript code executed when a key is + pressed and released over this element. + + + + onkeyup + false + false + + Javascript code executed when a key is + released over this element. + + + + onmousedown + false + false + + Javascript code executed when a pointer button is + pressed down over this element. + + + + onmousemove + false + false + + Javascript code executed when a pointer button is + moved within this element. + + + + onmouseout + false + false + + Javascript code executed when a pointer button is + moved away from this element. + + + + onmouseover + false + false + + Javascript code executed when a pointer button is + moved onto this element. + + + + onmouseup + false + false + + Javascript code executed when a pointer button is + released over this element. + + + + style + false + false + + CSS style(s) to be applied when this component is rendered. + + + + styleClass + false + false + + Space-separated list of CSS style class(es) to be applied when + this element is rendered. This value must be passed through + as the "class" attribute on generated markup. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean + + +
+ + multiColumn + org.sakaiproject.jsf.tag.MultiColumnTag + JSP + + Analogous to the data table in iterating over a list, + this is a 'non-visual' container for itnerated columns. +

+ This is recognized by dynaTable. +

]]> +
+ + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + first + false + false + + Zero-relative row number of the first row to be displayed. If this + property is set to zero, rendering will begin with the first row of + the underlying data. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + rows + false + false + + The number of rows of the underlying data model to be displayed, + starting with the one identified by the + "first" property. If this value is set to zero, all available rows + in the underlying data model will be displayed. + + + + value + false + false + + The current value of this component. + + + + var + false + false + + Name of a request-scope attribute under which the model data for the + row selected by the current value of the "rowIndex" property (i.e. + also the current value of the "rowData" property) will be exposed. + + +
+ + stylesheet + org.sakaiproject.jsf.tag.StylesheetTag + JSP + + Render a reference to a context resolved external CSS file. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + path + true + false + + Context resolved path to a external CSS file. + + + + contextBase + false + false + + Alternattive context to resolve path to a external CSS file. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + script + org.sakaiproject.jsf.tag.ScriptTag + JSP + + Render a reference to a context resolved external JavaScript file. + + + id + false + false + + Render a reference to a context resolved external JavaScript file. + + + + path + true + false + + Context resolved path to an external JavaScript file. + + + + contextBase + false + false + + Alternative context to resolve path to an external JavaScript file. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + inputColor + org.sakaiproject.jsf.tag.InputColorTag + JSP + + Render a sample-color bar and a color picker icon, as well as + an hidden field with the component value. Clicking icon + causes color picker to popup. Transfer chosen + color picker value to hidden field and render bar in that color. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + value + false + false + + The current value of this component. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + hideDivision + org.sakaiproject.jsf.tag.HideDivisionTag + JSP + + Surround child components with a division. + Present a title bar and clickable icon, + Clicking icon causes the division to toggle + btween visible and invisibele. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + title + true + false + + Title for title bar. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + onclick + false + false + + Javascript code executed when a pointer button is + clicked over this element, after the internal + JavaScript. + + + + ondblclick + false + false + + Javascript code executed when a pointer button is + double clicked over this element, after the internal + JavaScript. + + + + onkeydown + false + false + + Javascript code executed when a key is + pressed down over this element. + + + + onkeypress + false + false + + Javascript code executed when a key is + pressed and released over this element. + + + + onkeyup + false + false + + Javascript code executed when a key is + released over this element. + + + + onmousedown + false + false + + Javascript code executed when a pointer button is + pressed down over this element. + + + + onmousemove + false + false + + Javascript code executed when a pointer button is + moved within this element. + + + + onmouseout + false + false + + Javascript code executed when a pointer button is + moved away from this element. + + + + onmouseover + false + false + + Javascript code executed when a pointer button is + moved onto this element. + + + + onmouseup + false + false + + Javascript code executed when a pointer button is + released over this element. + + + + + timerBar + org.sakaiproject.jsf.tag.TimerBarTag + JSP + + Display a moving bar that keeps track of elapsed time. + + + height + true + false + + Timer bar height. + + + + width + true + false + + Timer bar width. + + + + wait + true + false + + Total number of seconds duration for timer bar. + This is the total time that it will take if elapsed + is zero. + + + + elapsed + true + false + + Total number of tenths of a second elapsed. + Countdown will begin with wait time diminished + by elapsed times 10, progress will show appropriate + percentage remaining. + + + + elapsedColor + false + false + + Color indicating elapsed time on bar. + Valid values are supported HTML color names or RGB values. + Default: "gray". + + + + remainingColor + false + false + + Color indicating remaining time on bar. + Valid values are supported HTML color names or RGB values. + Default: "green". + + + + expireScript + true + false + + JavaScript expriration handling code. + + + + expireMessage + true + false + + JavaScript popup message. + + + + expireHandling + false + false + + Enable JavaScript expiration handlers. + If false, disables expireMessage and expireScript; + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + progressBar + org.sakaiproject.jsf.tag.ProgressBarTag + JSP + + Display a moving bar indicating a wait. + Similar to timerBar, but without the options. + + + wait + true + false + + Total number of seconds duration for progress bar. + This is the total time that it will take if elapsed + is zero. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + + popup + org.sakaiproject.jsf.tag.PopupTag + JSP + + Popup another window upon clicking a button or link. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + + url + true + false + + Valid URL for the contents of popup. + + + + useButton + false + false + + Instead of rendering children, display button. + Default is false or no. + + + + title + false + false + + The title text if a link, the button text if a button. + + + + target + false + false + + The name of target window. Default is "sakai_popup". + + + + toolbar + false + false + + Does the popup display a toolbar? Default is "no" or "false". + + + + menubar + false + false + + Does the popup display a menubar? Default is "no" or "false". + + + + personalbar + false + false + + Does the popup display a personalbar? Default is "no" or "false". + + + + scrollbars + false + false + + Does the popup display scrollbars? Default is "no" or "false". + + + + width + false + false + + Width of the popup. Default is 650. + + + + height + false + false + + Height of the popup. Default is 375. + + + + scrollbars + false + false + + Does the popup display scrollbars? Default is "no" or "false". + + + + resizable + false + false + + Is the popup display resizable? Default is "yes" or "true". + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + alphaIndex + org.sakaiproject.jsf.tag.AlphaIndexTag + JSP + + Create a set of internal links to, or advance to something + starting with a different letter. + TODO: PLACEHOLDER. NEED TO DETERMINE INTEGRATION INTO SORT/PAGING. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + initials + false + false + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + anchorReference + org.sakaiproject.jsf.tag.AnchorReferenceTag + JSP + + Render an HTML anchor tag with an name attribute. + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + name + true + false + + The name for the anchor. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + + selectCommand + org.sakaiproject.jsf.tag.SelectCommandTag + + JSP + + Render an HTML option list with + onchange action behavior that acts like a + form submit button when clicked.

+

Decode Behavior

    +

    See the "Decode + Behavior for UISelectOne Components" section as well as for + "Decode + Behavior for UICommand Components". +

    Obtain the Map from the "requestParameterMap" + property of the ExternalContext. +If the value in theMap for the value of the "clientId" property of the + component is null, create a String by concatenating + the value of the "clientId" property of the component with the + String ".x" (without the quotes). Create another String in the + same manner, but concatenate ".y" (without the quotes). Ifnull is the value in the Map for both + Strings, return from decode(). If the value in theMap for the value of the "clientId" property of the + component is not null, get the value of the "type" + attribute, and convert it to lower case. If the result is equal + to the String "reset" (without the quotes), return fromdecode(). Otherwise, create ajavax.faces.event.ActionEvent around the component, + and pass it to the queueEvent() method of the + component, which must be an instance ofUICommand. + + + +

Encode Behavior

    Render an HTML "select" element. Render the clientId of the + component as the value of the "name" attribute. If the + "styleClass" attribute is specified, render its value as the value + of the "class" attribute on the "select" element. If the component + to be rendered is a UISelectMany, render "true" as the value of + the "multiple" attribute. Use the number of items as the value of + the "size" attribute. See the "Rendering + the option elements" specification forListboxRenderer for more detail on how to render the "option" elements in this renderer.

]]> +
+ + converter + false + false + + Converter instance registered with this component. + + + + id + false + false + + The component identifier for this component. This value must be + unique within the closest parent component that is a naming + container. + + + + immediate + false + false + + Flag indicating that this component's value must be + converted and validated immediately (that is, during + Apply Request Values phase), rather than waiting + until Process Validations phase. + + + + rendered + false + false + + Flag indicating whether or not this component should be rendered + (during Render Response Phase), or processed on any subsequent + form submit. + + + + actionListener + false + false + + MethodBinding representing an action listener method that will be + notified when this component is activated by the user. The + expression must evaluate to a public method that takes an + ActionEvent parameter, with a return type of void. + + + + required + false + false + + Flag indicating that the user is required to provide a submitted + value for this input component. + + + + validator + false + false + + MethodBinding representing a validator method that will be called + during Process Validations to perform correctness checks on the + value of this component. The expression must evaluate to a public + method that takes FacesContext, UIComponent, and Object parameters, + with a return type of void. + + + + value + false + false + + The current value of this component. + + + + valueChangeListener + false + false + + MethodBinding representing a value change listener method that will be + notified when a new value has been set for this input component. The + expression must evaluate to a public method that takes a + ValueChangeEvent parameter, with a return type of void. + + + + accesskey + false + false + + + Access key that, when pressed, transfers focus + to this element. + + + + dir + false + false + + + Direction indication for text that does not inherit directionality. + Valid values are "LTR" (left-to-right) and "RTL" (right-to-left). + + + + disabled + false + false + + Flag indicating that this element must never + receive focus or be included in a subsequent + submit. + + + + disabledClass + false + false + + CSS style class to apply to the rendered label + on disabled options. + + + + enabledClass + false + false + + CSS style class to apply to the rendered label + on enabled options. + + + + lang + false + false + + Code describing the language used in the generated markup + for this component. + + + + onblur + false + false + + Javascript code executed when this element loses focus. + + + + onchange + false + false + + Javascript code executed when this element loses focus + and its value has been modified since gaining focus. + + + + onclick + false + false + + Javascript code executed when a pointer button is + clicked over this element. + + + + ondblclick + false + false + + Javascript code executed when a pointer button is + double clicked over this element. + + + + onfocus + false + false + + Javascript code executed when this element receives focus. + + + + onkeydown + false + false + + Javascript code executed when a key is + pressed down over this element. + + + + onkeypress + false + false + + Javascript code executed when a key is + pressed and released over this element. + + + + onkeyup + false + false + + Javascript code executed when a key is + released over this element. + + + + onmousedown + false + false + + Javascript code executed when a pointer button is + pressed down over this element. + + + + onmousemove + false + false + + Javascript code executed when a pointer button is + moved within this element. + + + + onmouseout + false + false + + Javascript code executed when a pointer button is + moved away from this element. + + + + onmouseover + false + false + + + Javascript code executed when a pointer button is + moved onto this element. + + + + onmouseup + false + false + + Javascript code executed when a pointer button is + released over this element. + + + + onselect + false + false + + Javascript code executed when text within this + element is selected by the user. + + + + readonly + false + false + + Flag indicating that this component will prohibit + changes by the user. The element may receive focus + unless it has also been disabled. + + + + style + false + false + + CSS style(s) to be applied when this component is rendered. + + + + styleClass + false + false + + Space-separated list of CSS style class(es) to be applied when + this element is rendered. This value must be passed through + as the "class" attribute on generated markup. + + + + tabindex + false + false + + Position of this element in the tabbing order + for the current document. This value must be + an integer between 0 and 32767. + + + + title + false + false + + Advisory title information about markup elements generated + for this component. + + + + binding + false + false + + The value binding expression linking this component to a property in a backing bean + + +
+ + + flowState + org.sakaiproject.jsf.tag.FlowStateTag + JSP + + id + false + false + + + bean + true + false + + + + + contentTypeMap + org.sakaiproject.jsf.tag.JsfContentTypeMapTag + empty + + Exposes a map of the file types: images, names and extensions. + If image is the mapType, the returned value will be the file name for the fileType icon. + If name is the mapType, the returned value will be the display name for the fileType. + If extension is the mapType, the returned value will be the extension for the fileType + + + fileType + false + false + + String representation of the mime type (like "text/xml") + + + + mapType + false + false + + Accepted values are image, name, extension + + + + pathPrefix + false + false + + Path prefix for where the image lives (only needed if mapType is image) + + + + var + true + false + + Name of a request-scope attribute under which the return value will be exposed. + + + + +
+ + Index: sakai-lamstwo/tool/src/webapp/WEB-INF/web.xml =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/WEB-INF/web.xml (revision 0) +++ sakai-lamstwo/tool/src/webapp/WEB-INF/web.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,87 @@ + + + + sakai-lamstwo + Sakai Lamstwo + + + javax.faces.STATE_SAVING_METHOD + client + + + + com.sun.faces.validateXml + false + + + + com.sun.faces.verifyObjects + false + + + + + sakai.request + org.sakaiproject.util.RequestFilter + + + sakai.request + FacesServlet + REQUEST + FORWARD + INCLUDE + + + + + + sakai.lamstwo + org.sakaiproject.jsf.util.JsfTool + + default + LamstwoItems + + + path + /lamstwo + + + default.last.view + true + + 1 + + + + + FacesServlet + javax.faces.webapp.FacesServlet + 2 + + + FacesServlet + *.jsf + + + + + UserDataServlet + sakai.lamstwo.UserDataServlet + org.lamsfoundation.lams.integrations.sakai.tool.servlet.UserDataServlet + + + sakai.lamstwo.UserDataServlet + /servlet/UserDataServlet + + + + + org.sakaiproject.util.ToolListener + + + org.sakaiproject.util.ContextLoaderListener + + + \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/css/Lamstwo.css =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/css/Lamstwo.css (revision 0) +++ sakai-lamstwo/tool/src/webapp/css/Lamstwo.css (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,47 @@ +/* This file generated by Sakai App Builder -AZ */ +.firstColumn { + width: 5%; + text-align: center; +} +.secondColumn { + width: 15%; + text-align: left; +} +.thirdColumn { + width: 30%; + text-align: left; +} +.fourthColumn { + width: 10%; + text-align: center; +} +.fifthColumn { + width: 10%; + text-align: center; +} +.sixthColumn { + width: 10%; + text-align: left; +} +.seventhColumn { + width: 20%; + text-align: left; +} + +.portletBody { + min-height: 450px; +} + +.firstHeader { + text-align: center; +} +.secondtHeader { + text-align: left; +} +.thirdHeader { + text-align: center; +} +.fourthHeader { + text-align: left; +} + Index: sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoAddItem.jsp =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoAddItem.jsp (revision 0) +++ sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoAddItem.jsp (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,154 @@ +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %> +<%-- This file generated by Sakai App Builder --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- Only render tigra tree when we are creating a new lesson --%> + + + + + + + + + + + + + + + + Index: sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoItems.jsp =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoItems.jsp (revision 0) +++ sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoItems.jsp (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,102 @@ +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %> +<%-- This file generated by Sakai App Builder --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoLearner.jsp =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoLearner.jsp (revision 0) +++ sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoLearner.jsp (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,22 @@ +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %> +<%-- This file generated by Sakai App Builder --%> + + + + + + + + + + + Index: sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoMonitor.jsp =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoMonitor.jsp (revision 0) +++ sakai-lamstwo/tool/src/webapp/lamstwo/LamstwoMonitor.jsp (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,21 @@ +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %> +<%-- This file generated by Sakai App Builder --%> + + + + + + + + + + + \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/lib/tigra/tree.js =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lib/tigra/tree.js (revision 0) +++ sakai-lamstwo/tool/src/webapp/lib/tigra/tree.js (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,8 @@ +// Title: Tigra Tree +// Description: See the demo at url +// URL: http://www.softcomplex.com/products/tigra_menu_tree/ +// Version: 1.1 (size optimized) +// Date: 11-12-2002 (mm-dd-yyyy) +// Notes: This script is free. Visit official site for further details. + +function tree(tm0,tm1){this.tm2=tm1;this.tm3=tm0;this.tm4=this;this.tm5=[];this.tm6=null;this.tm7=-1;var tm8=new Image(),tm9=new Image();tm8.src=tm1['icon_e'];tm9.src=tm1['icon_l'];tm1['im_e']=tm8;tm1['im_l']=tm9;for(var i=0;i<64;i++)if(tm1['icon_'+i]){var tmA=new Image();tm1['im_'+i]=tmA;tmA.src=tm1['icon_'+i]}this.tmB=function(tmC){var tmD=this.tm5[tmC];tmD.tmE(tmD.tmF)};this.tmG=function(tmC){return this.tm5[tmC].tmG()};this.tmH=function(tmC){this.tm5[tmC].tmI(true)};this.tmJ=function(tmC){this.tm5[tmC].tmI()};this.tmK=[];for(var i=0;i1;i--){tme[i]='';tmf=tmf.tmN}return '
'+(this.tm7?tme.join('')+(this.tmK.length?'':''):'')+''+this.tm3[0]+'
'+(this.tmK.length?'':'')}function tmQ(tmg){return this.tm4.tm2['icon_'+((this.tm7?0:32)+(this.tmK.length?16:0)+(this.tmK.length&&this.tmF?8:0)+(!tmg&&this.tm4.tm6==this?4:0)+(tmg?2:0)+(tmg&&this.tmV()?1:0))]}var trees=[];tmY=document.all?function(tmh){return document.all[tmh]}:function(tmh){return document.getElementById(tmh)}; \ No newline at end of file Index: sakai-lamstwo/tool/src/webapp/lib/tigra/tree_tpl.js =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/lib/tigra/tree_tpl.js (revision 0) +++ sakai-lamstwo/tool/src/webapp/lib/tigra/tree_tpl.js (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,36 @@ +/* + Feel free to use your custom treeicons for the tree. Make sure they are all of the same size. + User treeicons collections are welcome, we'll publish them giving all regards. +*/ + +var TREE_TPL = { + 'target' : '_self', // name of the frame links will be opened in + // other possible values are: _blank, _parent, _search, _self and _top + + 'icon_e' : 'lib/tigra/treeicons/empty.gif', // empty image + 'icon_l' : 'lib/tigra/treeicons/line.gif', // vertical line + + 'icon_32' : 'lib/tigra/treeicons/base.gif', // root leaf icon normal + 'icon_36' : 'lib/tigra/treeicons/base.gif', // root leaf icon selected + + 'icon_48' : 'lib/tigra/treeicons/base.gif', // root icon normal + 'icon_52' : 'lib/tigra/treeicons/base.gif', // root icon selected + 'icon_56' : 'lib/tigra/treeicons/base.gif', // root icon opened + 'icon_60' : 'lib/tigra/treeicons/base.gif', // root icon selected + + 'icon_16' : 'lib/tigra/treeicons/folder.gif', // node icon normal + 'icon_20' : 'lib/tigra/treeicons/folderopen.gif', // node icon selected + 'icon_24' : 'lib/tigra/treeicons/folderopen.gif', // node icon opened + 'icon_28' : 'lib/tigra/treeicons/folderopen.gif', // node icon selected opened + + 'icon_0' : 'lib/tigra/treeicons/page.gif', // leaf icon normal + 'icon_4' : 'lib/tigra/treeicons/page.gif', // leaf icon selected + + 'icon_2' : 'lib/tigra/treeicons/joinbottom.gif', // junction for leaf + 'icon_3' : 'lib/tigra/treeicons/join.gif', // junction for last leaf + 'icon_18' : 'lib/tigra/treeicons/plusbottom.gif', // junction for closed node + 'icon_19' : 'lib/tigra/treeicons/plus.gif', // junctioin for last closed node + 'icon_26' : 'lib/tigra/treeicons/minusbottom.gif',// junction for opened node + 'icon_27' : 'lib/tigra/treeicons/minus.gif' // junctioin for last opended node +}; + Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/Thumbs.db =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/base.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/empty.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/folder.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/folderopen.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/join.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/joinbottom.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/line.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/minus.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/minusbottom.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/page.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/plus.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/lib/tigra/treeicons/plusbottom.gif =================================================================== diff -u Binary files differ Index: sakai-lamstwo/tool/src/webapp/tools/sakai.lamstwo.xml =================================================================== diff -u --- sakai-lamstwo/tool/src/webapp/tools/sakai.lamstwo.xml (revision 0) +++ sakai-lamstwo/tool/src/webapp/tools/sakai.lamstwo.xml (revision c144f53e688b530044b19ff807e502a41d33039a) @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file