├── .gitignore ├── .projectile ├── .travis.yml ├── README.md ├── Vagrantfile ├── bootstrap.sh ├── doc ├── apidocs │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── cn │ │ └── edu │ │ │ └── uestc │ │ │ └── acmicpc │ │ │ ├── config │ │ │ ├── ApplicationContextConfig.html │ │ │ ├── WebMVCConfig.html │ │ │ ├── WebMVCResource.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── db │ │ │ ├── condition │ │ │ │ ├── base │ │ │ │ │ ├── BaseCondition.Exp.html │ │ │ │ │ ├── BaseCondition.html │ │ │ │ │ ├── Condition.ConditionType.html │ │ │ │ │ ├── Condition.Entry.html │ │ │ │ │ ├── Condition.JoinedType.html │ │ │ │ │ ├── Condition.Order.html │ │ │ │ │ ├── Condition.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ └── impl │ │ │ │ │ ├── ContestProblemCondition.html │ │ │ │ │ ├── ContestTeamCondition.html │ │ │ │ │ ├── MessageCondition.html │ │ │ │ │ ├── ProblemCondition.html │ │ │ │ │ ├── TeamUserCondition.html │ │ │ │ │ ├── UserCondition.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ ├── criteria │ │ │ │ ├── ArticleCriteria.html │ │ │ │ ├── BaseCriteria.html │ │ │ │ ├── CodeCriteria.html │ │ │ │ ├── ContestCriteria.html │ │ │ │ ├── DepartmentCriteria.html │ │ │ │ ├── LanguageCriteria.html │ │ │ │ ├── SettingCriteria.html │ │ │ │ ├── StatusCriteria.html │ │ │ │ ├── TeamCriteria.html │ │ │ │ ├── TrainingContestCriteria.html │ │ │ │ ├── TrainingCriteria.html │ │ │ │ ├── TrainingPlatformInfoCriteria.html │ │ │ │ ├── TrainingUserCriteria.html │ │ │ │ ├── UserSerialKeyCriteria.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── dao │ │ │ │ ├── base │ │ │ │ │ ├── BaseDao.html │ │ │ │ │ ├── DaoImpl.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── iface │ │ │ │ │ ├── ArticleDao.html │ │ │ │ │ ├── CodeDao.html │ │ │ │ │ ├── CompileInfoDao.html │ │ │ │ │ ├── ContestDao.html │ │ │ │ │ ├── ContestProblemDao.html │ │ │ │ │ ├── ContestTeamDao.html │ │ │ │ │ ├── ContestUserDao.html │ │ │ │ │ ├── Dao.html │ │ │ │ │ ├── DepartmentDao.html │ │ │ │ │ ├── LanguageDao.html │ │ │ │ │ ├── MessageDao.html │ │ │ │ │ ├── ProblemDao.html │ │ │ │ │ ├── ProblemTagDao.html │ │ │ │ │ ├── SettingDao.html │ │ │ │ │ ├── StatusDao.html │ │ │ │ │ ├── TagDao.html │ │ │ │ │ ├── TeamDao.html │ │ │ │ │ ├── TeamUserDao.html │ │ │ │ │ ├── TrainingContestDao.html │ │ │ │ │ ├── TrainingDao.html │ │ │ │ │ ├── TrainingPlatformInfoDao.html │ │ │ │ │ ├── TrainingUserDao.html │ │ │ │ │ ├── UserDao.html │ │ │ │ │ ├── UserSerialKeyDao.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ └── impl │ │ │ │ │ ├── ArticleDaoImpl.html │ │ │ │ │ ├── CodeDaoImpl.html │ │ │ │ │ ├── CompileInfoDaoImpl.html │ │ │ │ │ ├── ContestDaoImpl.html │ │ │ │ │ ├── ContestProblemDaoImpl.html │ │ │ │ │ ├── ContestTeamDaoImpl.html │ │ │ │ │ ├── ContestUserDaoImpl.html │ │ │ │ │ ├── DepartmentDaoImpl.html │ │ │ │ │ ├── LanguageDaoImpl.html │ │ │ │ │ ├── MessageDaoImpl.html │ │ │ │ │ ├── ProblemDaoImpl.html │ │ │ │ │ ├── ProblemTagDaoImpl.html │ │ │ │ │ ├── SettingDaoImpl.html │ │ │ │ │ ├── StatusDaoImpl.html │ │ │ │ │ ├── TagDaoImpl.html │ │ │ │ │ ├── TeamDaoImpl.html │ │ │ │ │ ├── TeamUserDaoImpl.html │ │ │ │ │ ├── TrainingContestDaoImpl.html │ │ │ │ │ ├── TrainingDaoImpl.html │ │ │ │ │ ├── TrainingPlatformInfoDaoImpl.html │ │ │ │ │ ├── TrainingUserDaoImpl.html │ │ │ │ │ ├── UserDaoImpl.html │ │ │ │ │ ├── UserSerialKeyDaoImpl.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ ├── dto │ │ │ │ ├── BaseDto.html │ │ │ │ ├── BaseDtoBuilder.html │ │ │ │ ├── FieldProjection.ProjectionType.html │ │ │ │ ├── FieldProjection.html │ │ │ │ ├── Fields.html │ │ │ │ ├── field │ │ │ │ │ ├── ArticleFields.html │ │ │ │ │ ├── CodeFields.html │ │ │ │ │ ├── ContestFields.html │ │ │ │ │ ├── ContestUserFields.html │ │ │ │ │ ├── DepartmentFields.html │ │ │ │ │ ├── LanguageFields.html │ │ │ │ │ ├── SettingFields.html │ │ │ │ │ ├── StatusFields.html │ │ │ │ │ ├── TeamFields.html │ │ │ │ │ ├── TrainingContestFields.html │ │ │ │ │ ├── TrainingFields.html │ │ │ │ │ ├── TrainingPlatformInfoFields.html │ │ │ │ │ ├── TrainingUserFields.html │ │ │ │ │ ├── UserSerialKeyFields.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── impl │ │ │ │ │ ├── ArticleDto.Builder.html │ │ │ │ │ ├── ArticleDto.html │ │ │ │ │ ├── CodeDto.Builder.html │ │ │ │ │ ├── CodeDto.html │ │ │ │ │ ├── ContestDto.Builder.html │ │ │ │ │ ├── ContestDto.html │ │ │ │ │ ├── ContestUserDto.Builder.html │ │ │ │ │ ├── ContestUserDto.html │ │ │ │ │ ├── DepartmentDto.Builder.html │ │ │ │ │ ├── DepartmentDto.html │ │ │ │ │ ├── LanguageDto.Builder.html │ │ │ │ │ ├── LanguageDto.html │ │ │ │ │ ├── SettingDto.Builder.html │ │ │ │ │ ├── SettingDto.html │ │ │ │ │ ├── StatusDto.Builder.html │ │ │ │ │ ├── StatusDto.html │ │ │ │ │ ├── TeamDto.Builder.html │ │ │ │ │ ├── TeamDto.html │ │ │ │ │ ├── TrainingContestDto.Builder.html │ │ │ │ │ ├── TrainingContestDto.html │ │ │ │ │ ├── TrainingDto.Builder.html │ │ │ │ │ ├── TrainingDto.html │ │ │ │ │ ├── TrainingPlatformInfoDto.Builder.html │ │ │ │ │ ├── TrainingPlatformInfoDto.html │ │ │ │ │ ├── TrainingUserDto.Builder.html │ │ │ │ │ ├── TrainingUserDto.html │ │ │ │ │ ├── UserSerialKeyDto.Builder.html │ │ │ │ │ ├── UserSerialKeyDto.html │ │ │ │ │ ├── contestproblem │ │ │ │ │ │ ├── ContestProblemDetailDto.Builder.html │ │ │ │ │ │ ├── ContestProblemDetailDto.html │ │ │ │ │ │ ├── ContestProblemDto.Builder.html │ │ │ │ │ │ ├── ContestProblemDto.html │ │ │ │ │ │ ├── ContestProblemSummaryDto.Builder.html │ │ │ │ │ │ ├── ContestProblemSummaryDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ │ ├── contestteam │ │ │ │ │ │ ├── ContestTeamDto.Builder.html │ │ │ │ │ │ ├── ContestTeamDto.html │ │ │ │ │ │ ├── ContestTeamListDto.Builder.html │ │ │ │ │ │ ├── ContestTeamListDto.html │ │ │ │ │ │ ├── ContestTeamReportDto.Builder.html │ │ │ │ │ │ ├── ContestTeamReportDto.html │ │ │ │ │ │ ├── ContestTeamReviewDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ │ ├── message │ │ │ │ │ │ ├── MessageDto.Builder.html │ │ │ │ │ │ ├── MessageDto.html │ │ │ │ │ │ ├── MessageForReceiverDto.Builder.html │ │ │ │ │ │ ├── MessageForReceiverDto.html │ │ │ │ │ │ ├── MessageForUserDto.Builder.html │ │ │ │ │ │ ├── MessageForUserDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ ├── package-tree.html │ │ │ │ │ ├── problem │ │ │ │ │ │ ├── ProblemDto.Builder.html │ │ │ │ │ │ ├── ProblemDto.html │ │ │ │ │ │ ├── ProblemEditDto.html │ │ │ │ │ │ ├── ProblemListDto.Builder.html │ │ │ │ │ │ ├── ProblemListDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ │ ├── teamUser │ │ │ │ │ │ ├── TeamUserDto.Builder.html │ │ │ │ │ │ ├── TeamUserDto.html │ │ │ │ │ │ ├── TeamUserListDto.Builder.html │ │ │ │ │ │ ├── TeamUserListDto.html │ │ │ │ │ │ ├── TeamUserReportDto.Builder.html │ │ │ │ │ │ ├── TeamUserReportDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ │ └── user │ │ │ │ │ │ ├── OnsiteUserDto.html │ │ │ │ │ │ ├── UserActivateDto.Builder.html │ │ │ │ │ │ ├── UserActivateDto.html │ │ │ │ │ │ ├── UserAdminEditDto.Builder.html │ │ │ │ │ │ ├── UserAdminEditDto.html │ │ │ │ │ │ ├── UserCenterDto.Builder.html │ │ │ │ │ │ ├── UserCenterDto.html │ │ │ │ │ │ ├── UserDto.Builder.html │ │ │ │ │ │ ├── UserDto.html │ │ │ │ │ │ ├── UserEditDto.Builder.html │ │ │ │ │ │ ├── UserEditDto.html │ │ │ │ │ │ ├── UserEditorDto.Builder.html │ │ │ │ │ │ ├── UserEditorDto.html │ │ │ │ │ │ ├── UserListDto.Builder.html │ │ │ │ │ │ ├── UserListDto.html │ │ │ │ │ │ ├── UserLoginDto.Builder.html │ │ │ │ │ │ ├── UserLoginDto.html │ │ │ │ │ │ ├── UserProblemStatusDto.html │ │ │ │ │ │ ├── UserRegisterDto.Builder.html │ │ │ │ │ │ ├── UserRegisterDto.html │ │ │ │ │ │ ├── UserTypeAheadDto.Builder.html │ │ │ │ │ │ ├── UserTypeAheadDto.html │ │ │ │ │ │ ├── package-frame.html │ │ │ │ │ │ ├── package-summary.html │ │ │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── entity │ │ │ │ ├── Article.html │ │ │ │ ├── Code.html │ │ │ │ ├── CompileInfo.html │ │ │ │ ├── Contest.html │ │ │ │ ├── ContestProblem.html │ │ │ │ ├── ContestTeam.html │ │ │ │ ├── ContestUser.html │ │ │ │ ├── Department.html │ │ │ │ ├── Language.html │ │ │ │ ├── Message.html │ │ │ │ ├── Problem.html │ │ │ │ ├── ProblemTag.html │ │ │ │ ├── Setting.html │ │ │ │ ├── Status.html │ │ │ │ ├── Tag.html │ │ │ │ ├── Team.html │ │ │ │ ├── TeamUser.html │ │ │ │ ├── Training.html │ │ │ │ ├── TrainingContest.html │ │ │ │ ├── TrainingPlatformInfo.html │ │ │ │ ├── TrainingUser.html │ │ │ │ ├── User.html │ │ │ │ ├── UserSerialKey.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── judge │ │ │ ├── JudgeService.html │ │ │ ├── core │ │ │ │ ├── FakeCore.html │ │ │ │ ├── JudgeCore.html │ │ │ │ ├── JudgeResult.html │ │ │ │ ├── PylonCore.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── entity │ │ │ │ ├── Judge.html │ │ │ │ ├── JudgeItem.html │ │ │ │ ├── Scheduler.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── service │ │ │ ├── iface │ │ │ │ ├── ArticleService.html │ │ │ │ ├── CodeService.html │ │ │ │ ├── CompileInfoService.html │ │ │ │ ├── ContestImporterService.html │ │ │ │ ├── ContestProblemService.html │ │ │ │ ├── ContestRankListService.html │ │ │ │ ├── ContestService.html │ │ │ │ ├── ContestTeamService.html │ │ │ │ ├── ContestUserService.html │ │ │ │ ├── DepartmentService.html │ │ │ │ ├── EmailService.html │ │ │ │ ├── FileService.html │ │ │ │ ├── LanguageService.html │ │ │ │ ├── MessageService.html │ │ │ │ ├── PictureService.html │ │ │ │ ├── ProblemService.html │ │ │ │ ├── RecentContestService.html │ │ │ │ ├── SettingService.html │ │ │ │ ├── StatusService.html │ │ │ │ ├── TeamService.html │ │ │ │ ├── TeamUserService.html │ │ │ │ ├── TrainingContestService.html │ │ │ │ ├── TrainingPlatformInfoService.html │ │ │ │ ├── TrainingService.html │ │ │ │ ├── TrainingUserService.html │ │ │ │ ├── UserSerialKeyService.html │ │ │ │ ├── UserService.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── impl │ │ │ │ ├── AbstractService.html │ │ │ │ ├── ArticleServiceImpl.html │ │ │ │ ├── CodeServiceImpl.html │ │ │ │ ├── CompileInfoServiceImpl.html │ │ │ │ ├── ContestImporterServiceImpl.html │ │ │ │ ├── ContestProblemServiceImpl.html │ │ │ │ ├── ContestRankListServiceImpl.html │ │ │ │ ├── ContestServiceImpl.html │ │ │ │ ├── ContestTeamServiceImpl.html │ │ │ │ ├── ContestUserServiceImpl.html │ │ │ │ ├── DepartmentServiceImpl.html │ │ │ │ ├── EmailServiceImpl.html │ │ │ │ ├── FileServiceImpl.html │ │ │ │ ├── LanguageServiceImpl.html │ │ │ │ ├── MessageServiceImpl.html │ │ │ │ ├── PictureServiceImpl.html │ │ │ │ ├── ProblemServiceImpl.html │ │ │ │ ├── RecentContestServiceImpl.html │ │ │ │ ├── SettingServiceImpl.html │ │ │ │ ├── StatusServiceImpl.html │ │ │ │ ├── TeamServiceImpl.html │ │ │ │ ├── TeamUserServiceImpl.html │ │ │ │ ├── TrainingContestServiceImpl.html │ │ │ │ ├── TrainingPlatformInfoServiceImpl.html │ │ │ │ ├── TrainingServiceImpl.html │ │ │ │ ├── TrainingUserServiceImpl.html │ │ │ │ ├── UserSerialKeyServiceImpl.html │ │ │ │ ├── UserServiceImpl.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── testing │ │ │ │ ├── ArticleProvider.html │ │ │ │ ├── CodeProvider.html │ │ │ │ ├── ContestProvider.html │ │ │ │ ├── ProblemProvider.html │ │ │ │ ├── StatusProvider.html │ │ │ │ ├── TeamProvider.html │ │ │ │ ├── TeamUserProvider.html │ │ │ │ ├── TestUtil.html │ │ │ │ ├── TrainingPlatformInfoProvider.html │ │ │ │ ├── TrainingProvider.html │ │ │ │ ├── TrainingUserProvider.html │ │ │ │ ├── UserProvider.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── util │ │ │ ├── annotation │ │ │ │ ├── CSVMap.html │ │ │ │ ├── Fields.html │ │ │ │ ├── JsonMap.html │ │ │ │ ├── KeyField.html │ │ │ │ ├── LoginPermit.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── checker │ │ │ │ ├── ContestZipChecker.html │ │ │ │ ├── ZipDataChecker.html │ │ │ │ ├── base │ │ │ │ │ ├── Checker.html │ │ │ │ │ ├── package-frame.html │ │ │ │ │ ├── package-summary.html │ │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── dto │ │ │ │ ├── RecentContestDto.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── enums │ │ │ │ ├── ArticleType.html │ │ │ │ ├── AuthenticationType.html │ │ │ │ ├── ContestRegistryStatusType.html │ │ │ │ ├── ContestType.html │ │ │ │ ├── EnumType.html │ │ │ │ ├── GenderType.html │ │ │ │ ├── GradeType.html │ │ │ │ ├── OnlineJudgeResultType.html │ │ │ │ ├── OnlineJudgeReturnType.html │ │ │ │ ├── ProblemSolveStatusType.html │ │ │ │ ├── ProblemType.html │ │ │ │ ├── TShirtsSizeType.html │ │ │ │ ├── TrainingContestType.html │ │ │ │ ├── TrainingPlatformType.html │ │ │ │ ├── TrainingResultFieldType.html │ │ │ │ ├── TrainingUserType.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── exception │ │ │ │ ├── AppError.html │ │ │ │ ├── AppException.html │ │ │ │ ├── AppExceptionUtil.html │ │ │ │ ├── FieldException.html │ │ │ │ ├── FieldNotUniqueException.html │ │ │ │ ├── ParserException.html │ │ │ │ ├── ValidatorException.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── helper │ │ │ │ ├── ArrayUtil.html │ │ │ │ ├── BeanUtil.html │ │ │ │ ├── CSVUtil.html │ │ │ │ ├── DatabaseUtil.html │ │ │ │ ├── EnumTypeUtil.html │ │ │ │ ├── FileUploadUtil.html │ │ │ │ ├── FileUtil.html │ │ │ │ ├── ObjectUtil.html │ │ │ │ ├── ReflectionUtil.html │ │ │ │ ├── StringUtil.MethodType.html │ │ │ │ ├── StringUtil.html │ │ │ │ ├── ZipUtil.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── log │ │ │ │ ├── ANSIConsoleAppender.html │ │ │ │ ├── LogConstants.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── parser │ │ │ │ ├── CodeforcesRankListParser.html │ │ │ │ ├── TrainingContestResultParser.html │ │ │ │ ├── VirtualJudgeRankListParser.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── rating │ │ │ │ ├── RatingCalculator.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── settings │ │ │ │ ├── Settings.html │ │ │ │ ├── SettingsID.html │ │ │ │ ├── entity │ │ │ │ ├── EmailSetting.html │ │ │ │ ├── JudgeSetting.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── web │ │ │ ├── aspect │ │ │ ├── AuthenticationAspect.html │ │ │ ├── ControllerExceptionHandlerAspect.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── dto │ │ │ ├── FileInformationDto.Builder.html │ │ │ ├── FileInformationDto.html │ │ │ ├── FileUploadDto.Builder.html │ │ │ ├── FileUploadDto.html │ │ │ ├── PageInfo.html │ │ │ ├── TrainingRating.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── oj │ │ │ └── controller │ │ │ │ ├── admin │ │ │ │ ├── AdminController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── article │ │ │ │ ├── ArticleController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── base │ │ │ │ ├── BaseController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── contest │ │ │ │ ├── ContestController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── index │ │ │ │ ├── ErrorController.html │ │ │ │ ├── IndexController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── message │ │ │ │ ├── MessageController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── picture │ │ │ │ ├── PictureController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── problem │ │ │ │ ├── ProblemController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── status │ │ │ │ ├── StatusController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── team │ │ │ │ ├── TeamController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ ├── training │ │ │ │ ├── TrainingController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ │ └── user │ │ │ │ ├── UserController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── rank │ │ │ ├── RankList.html │ │ │ ├── RankListBuilder.html │ │ │ ├── RankListItem.html │ │ │ ├── RankListProblem.html │ │ │ ├── RankListStatus.html │ │ │ ├── RankListUser.html │ │ │ ├── TrainingRankList.html │ │ │ ├── TrainingRankListItem.html │ │ │ ├── TrainingRankListUser.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── resolver │ │ │ ├── JsonPathArgumentResolver.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── view │ │ │ ├── ContestRankListView.html │ │ │ ├── ContestRegistryReportView.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ └── xml │ │ │ ├── XmlNode.html │ │ │ ├── XmlParser.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-all.html │ ├── index.html │ ├── overview-frame.html │ ├── overview-summary.html │ ├── overview-tree.html │ ├── package-list │ ├── script.js │ ├── serialized-form.html │ └── stylesheet.css ├── cdoj.mwb ├── cdojtest.mwb ├── judgecore.class.xmi ├── maven_settings.xml └── 架构相关 │ ├── 系统基本架构.docx │ └── 系统基本架构.pdf ├── trunk ├── .gitignore ├── build.gradle ├── config │ └── checkstyle │ │ └── checkstyle.xml ├── gradle.properties.template ├── package-lock.json ├── release_template │ └── gradle.properties ├── scripts │ ├── configure_project.sh │ ├── fetch_change_log.sh │ └── format_change_log.py ├── settings.gradle ├── src │ ├── .gitignore │ ├── main │ │ ├── dto │ │ │ ├── Article.json │ │ │ ├── Code.json │ │ │ ├── Contest.json │ │ │ ├── ContestProblem.json │ │ │ ├── ContestUser.json │ │ │ ├── Department.json │ │ │ ├── Language.json │ │ │ ├── Message.json │ │ │ ├── Setting.json │ │ │ ├── Status.json │ │ │ ├── Team.json │ │ │ ├── Training.json │ │ │ ├── TrainingContest.json │ │ │ ├── TrainingPlatformInfo.json │ │ │ ├── TrainingUser.json │ │ │ ├── User.json │ │ │ └── UserSerialKey.json │ │ ├── java │ │ │ └── cn │ │ │ │ └── edu │ │ │ │ └── uestc │ │ │ │ └── acmicpc │ │ │ │ ├── config │ │ │ │ ├── ApplicationContextConfig.java │ │ │ │ ├── WebMVCConfig.java │ │ │ │ └── WebMVCResource.java │ │ │ │ ├── db │ │ │ │ ├── condition │ │ │ │ │ ├── base │ │ │ │ │ │ ├── BaseCondition.java │ │ │ │ │ │ └── Condition.java │ │ │ │ │ └── impl │ │ │ │ │ │ ├── ContestTeamCondition.java │ │ │ │ │ │ ├── ProblemCondition.java │ │ │ │ │ │ └── TeamUserCondition.java │ │ │ │ ├── criteria │ │ │ │ │ ├── ArticleCriteria.java │ │ │ │ │ ├── BaseCriteria.java │ │ │ │ │ ├── CodeCriteria.java │ │ │ │ │ ├── ContestCriteria.java │ │ │ │ │ ├── ContestProblemCriteria.java │ │ │ │ │ ├── ContestUserCriteria.java │ │ │ │ │ ├── DepartmentCriteria.java │ │ │ │ │ ├── LanguageCriteria.java │ │ │ │ │ ├── MessageCriteria.java │ │ │ │ │ ├── SettingCriteria.java │ │ │ │ │ ├── StatusCriteria.java │ │ │ │ │ ├── TeamCriteria.java │ │ │ │ │ ├── TrainingContestCriteria.java │ │ │ │ │ ├── TrainingCriteria.java │ │ │ │ │ ├── TrainingPlatformInfoCriteria.java │ │ │ │ │ ├── TrainingUserCriteria.java │ │ │ │ │ ├── UserCriteria.java │ │ │ │ │ └── UserSerialKeyCriteria.java │ │ │ │ ├── dao │ │ │ │ │ ├── base │ │ │ │ │ │ ├── BaseDao.java │ │ │ │ │ │ └── DaoImpl.java │ │ │ │ │ └── iface │ │ │ │ │ │ └── Dao.java │ │ │ │ ├── dto │ │ │ │ │ ├── BaseDto.java │ │ │ │ │ ├── BaseDtoBuilder.java │ │ │ │ │ ├── FieldProjection.java │ │ │ │ │ ├── Fields.java │ │ │ │ │ ├── FieldsUtil.java │ │ │ │ │ └── impl │ │ │ │ │ │ ├── contestteam │ │ │ │ │ │ ├── ContestTeamDto.java │ │ │ │ │ │ ├── ContestTeamListDto.java │ │ │ │ │ │ ├── ContestTeamReportDto.java │ │ │ │ │ │ └── ContestTeamReviewDto.java │ │ │ │ │ │ ├── problem │ │ │ │ │ │ ├── ProblemDto.java │ │ │ │ │ │ ├── ProblemEditDto.java │ │ │ │ │ │ └── ProblemListDto.java │ │ │ │ │ │ ├── teamUser │ │ │ │ │ │ ├── TeamUserDto.java │ │ │ │ │ │ ├── TeamUserListDto.java │ │ │ │ │ │ └── TeamUserReportDto.java │ │ │ │ │ │ └── user │ │ │ │ │ │ ├── OnsiteUserDto.java │ │ │ │ │ │ └── UserProblemStatusDto.java │ │ │ │ └── entity │ │ │ │ │ ├── Article.java │ │ │ │ │ ├── Code.java │ │ │ │ │ ├── CompileInfo.java │ │ │ │ │ ├── Contest.java │ │ │ │ │ ├── ContestProblem.java │ │ │ │ │ ├── ContestTeam.java │ │ │ │ │ ├── ContestUser.java │ │ │ │ │ ├── Department.java │ │ │ │ │ ├── Language.java │ │ │ │ │ ├── Message.java │ │ │ │ │ ├── Problem.java │ │ │ │ │ ├── ProblemTag.java │ │ │ │ │ ├── Setting.java │ │ │ │ │ ├── Status.java │ │ │ │ │ ├── Tag.java │ │ │ │ │ ├── Team.java │ │ │ │ │ ├── TeamUser.java │ │ │ │ │ ├── Training.java │ │ │ │ │ ├── TrainingContest.java │ │ │ │ │ ├── TrainingPlatformInfo.java │ │ │ │ │ ├── TrainingUser.java │ │ │ │ │ ├── User.java │ │ │ │ │ └── UserSerialKey.java │ │ │ │ ├── judge │ │ │ │ ├── JudgeService.java │ │ │ │ ├── core │ │ │ │ │ ├── AbstractJudgeCore.java │ │ │ │ │ ├── FakeCore.java │ │ │ │ │ ├── JudgeCore.java │ │ │ │ │ ├── JudgeResult.java │ │ │ │ │ ├── LrunCore.java │ │ │ │ │ └── PylonCore.java │ │ │ │ └── entity │ │ │ │ │ ├── Judge.java │ │ │ │ │ ├── JudgeItem.java │ │ │ │ │ └── Scheduler.java │ │ │ │ ├── service │ │ │ │ ├── iface │ │ │ │ │ ├── ArticleService.java │ │ │ │ │ ├── CodeService.java │ │ │ │ │ ├── CompileInfoService.java │ │ │ │ │ ├── ContestImporterService.java │ │ │ │ │ ├── ContestProblemService.java │ │ │ │ │ ├── ContestRankListService.java │ │ │ │ │ ├── ContestService.java │ │ │ │ │ ├── ContestTeamService.java │ │ │ │ │ ├── ContestUserService.java │ │ │ │ │ ├── DepartmentService.java │ │ │ │ │ ├── EmailService.java │ │ │ │ │ ├── FileService.java │ │ │ │ │ ├── LanguageService.java │ │ │ │ │ ├── MessageService.java │ │ │ │ │ ├── PictureService.java │ │ │ │ │ ├── ProblemService.java │ │ │ │ │ ├── RecentContestService.java │ │ │ │ │ ├── SettingService.java │ │ │ │ │ ├── StatusService.java │ │ │ │ │ ├── TeamService.java │ │ │ │ │ ├── TeamUserService.java │ │ │ │ │ ├── TrainingContestService.java │ │ │ │ │ ├── TrainingPlatformInfoService.java │ │ │ │ │ ├── TrainingService.java │ │ │ │ │ ├── TrainingUserService.java │ │ │ │ │ ├── UserSerialKeyService.java │ │ │ │ │ └── UserService.java │ │ │ │ ├── impl │ │ │ │ │ ├── AbstractService.java │ │ │ │ │ ├── ArticleServiceImpl.java │ │ │ │ │ ├── CodeServiceImpl.java │ │ │ │ │ ├── CompileInfoServiceImpl.java │ │ │ │ │ ├── ContestImporterServiceImpl.java │ │ │ │ │ ├── ContestProblemServiceImpl.java │ │ │ │ │ ├── ContestRankListServiceImpl.java │ │ │ │ │ ├── ContestServiceImpl.java │ │ │ │ │ ├── ContestTeamServiceImpl.java │ │ │ │ │ ├── ContestUserServiceImpl.java │ │ │ │ │ ├── DepartmentServiceImpl.java │ │ │ │ │ ├── EmailServiceImpl.java │ │ │ │ │ ├── FileServiceImpl.java │ │ │ │ │ ├── LanguageServiceImpl.java │ │ │ │ │ ├── MessageServiceImpl.java │ │ │ │ │ ├── PictureServiceImpl.java │ │ │ │ │ ├── ProblemServiceImpl.java │ │ │ │ │ ├── RecentContestServiceImpl.java │ │ │ │ │ ├── SettingServiceImpl.java │ │ │ │ │ ├── StatusServiceImpl.java │ │ │ │ │ ├── TeamServiceImpl.java │ │ │ │ │ ├── TeamUserServiceImpl.java │ │ │ │ │ ├── TrainingContestServiceImpl.java │ │ │ │ │ ├── TrainingPlatformInfoServiceImpl.java │ │ │ │ │ ├── TrainingServiceImpl.java │ │ │ │ │ ├── TrainingUserServiceImpl.java │ │ │ │ │ ├── UserSerialKeyServiceImpl.java │ │ │ │ │ └── UserServiceImpl.java │ │ │ │ └── testing │ │ │ │ │ ├── ArticleProvider.java │ │ │ │ │ ├── CodeProvider.java │ │ │ │ │ ├── ContestProvider.java │ │ │ │ │ ├── ProblemProvider.java │ │ │ │ │ ├── StatusProvider.java │ │ │ │ │ ├── TeamProvider.java │ │ │ │ │ ├── TeamUserProvider.java │ │ │ │ │ ├── TestUtil.java │ │ │ │ │ ├── TrainingPlatformInfoProvider.java │ │ │ │ │ ├── TrainingProvider.java │ │ │ │ │ ├── TrainingUserProvider.java │ │ │ │ │ └── UserProvider.java │ │ │ │ ├── util │ │ │ │ ├── annotation │ │ │ │ │ ├── CSVMap.java │ │ │ │ │ ├── Fields.java │ │ │ │ │ ├── JsonMap.java │ │ │ │ │ ├── KeyField.java │ │ │ │ │ └── LoginPermit.java │ │ │ │ ├── checker │ │ │ │ │ ├── ContestZipChecker.java │ │ │ │ │ ├── ZipDataChecker.java │ │ │ │ │ └── base │ │ │ │ │ │ └── Checker.java │ │ │ │ ├── dto │ │ │ │ │ └── RecentContestDto.java │ │ │ │ ├── enums │ │ │ │ │ ├── ArticleType.java │ │ │ │ │ ├── AuthenticationType.java │ │ │ │ │ ├── ContestRegistryStatusType.java │ │ │ │ │ ├── ContestType.java │ │ │ │ │ ├── EnumType.java │ │ │ │ │ ├── GenderType.java │ │ │ │ │ ├── GradeType.java │ │ │ │ │ ├── OnlineJudgeResultType.java │ │ │ │ │ ├── OnlineJudgeReturnType.java │ │ │ │ │ ├── ProblemSolveStatusType.java │ │ │ │ │ ├── ProblemType.java │ │ │ │ │ ├── TShirtsSizeType.java │ │ │ │ │ ├── TrainingContestType.java │ │ │ │ │ ├── TrainingPlatformType.java │ │ │ │ │ ├── TrainingResultFieldType.java │ │ │ │ │ └── TrainingUserType.java │ │ │ │ ├── exception │ │ │ │ │ ├── AppError.java │ │ │ │ │ ├── AppException.java │ │ │ │ │ ├── AppExceptionUtil.java │ │ │ │ │ ├── FieldException.java │ │ │ │ │ ├── FieldNotUniqueException.java │ │ │ │ │ ├── ParserException.java │ │ │ │ │ └── ValidatorException.java │ │ │ │ ├── helper │ │ │ │ │ ├── ArrayUtil.java │ │ │ │ │ ├── BeanUtil.java │ │ │ │ │ ├── CSVUtil.java │ │ │ │ │ ├── DatabaseUtil.java │ │ │ │ │ ├── EnumTypeUtil.java │ │ │ │ │ ├── FileUploadUtil.java │ │ │ │ │ ├── FileUtil.java │ │ │ │ │ ├── ObjectUtil.java │ │ │ │ │ ├── ReflectionUtil.java │ │ │ │ │ ├── StringUtil.java │ │ │ │ │ └── ZipUtil.java │ │ │ │ ├── log │ │ │ │ │ ├── ANSIConsoleAppender.java │ │ │ │ │ └── LogConstants.java │ │ │ │ ├── parser │ │ │ │ │ ├── CodeforcesRankListParser.java │ │ │ │ │ ├── TrainingContestResultParser.java │ │ │ │ │ └── VirtualJudgeRankListParser.java │ │ │ │ ├── rating │ │ │ │ │ └── RatingCalculator.java │ │ │ │ └── settings │ │ │ │ │ ├── Settings.java │ │ │ │ │ ├── SettingsID.java │ │ │ │ │ └── entity │ │ │ │ │ ├── EmailSetting.java │ │ │ │ │ └── JudgeSetting.java │ │ │ │ └── web │ │ │ │ ├── aspect │ │ │ │ ├── AuthenticationAspect.java │ │ │ │ └── ControllerExceptionHandlerAspect.java │ │ │ │ ├── dto │ │ │ │ ├── FileInformationDto.java │ │ │ │ ├── FileUploadDto.java │ │ │ │ ├── PageInfo.java │ │ │ │ └── TrainingRating.java │ │ │ │ ├── oj │ │ │ │ └── controller │ │ │ │ │ ├── admin │ │ │ │ │ └── AdminController.java │ │ │ │ │ ├── article │ │ │ │ │ └── ArticleController.java │ │ │ │ │ ├── base │ │ │ │ │ └── BaseController.java │ │ │ │ │ ├── contest │ │ │ │ │ └── ContestController.java │ │ │ │ │ ├── index │ │ │ │ │ ├── ErrorController.java │ │ │ │ │ └── IndexController.java │ │ │ │ │ ├── message │ │ │ │ │ └── MessageController.java │ │ │ │ │ ├── picture │ │ │ │ │ └── PictureController.java │ │ │ │ │ ├── problem │ │ │ │ │ └── ProblemController.java │ │ │ │ │ ├── status │ │ │ │ │ └── StatusController.java │ │ │ │ │ ├── team │ │ │ │ │ └── TeamController.java │ │ │ │ │ ├── training │ │ │ │ │ └── TrainingController.java │ │ │ │ │ └── user │ │ │ │ │ └── UserController.java │ │ │ │ ├── rank │ │ │ │ ├── RankList.java │ │ │ │ ├── RankListBuilder.java │ │ │ │ ├── RankListItem.java │ │ │ │ ├── RankListProblem.java │ │ │ │ ├── RankListStatus.java │ │ │ │ ├── RankListUser.java │ │ │ │ ├── TrainingRankList.java │ │ │ │ ├── TrainingRankListItem.java │ │ │ │ └── TrainingRankListUser.java │ │ │ │ ├── resolver │ │ │ │ └── JsonPathArgumentResolver.java │ │ │ │ ├── view │ │ │ │ ├── ContestRankListView.java │ │ │ │ └── ContestRegistryReportView.java │ │ │ │ └── xml │ │ │ │ ├── XmlNode.java │ │ │ │ └── XmlParser.java │ │ ├── python │ │ │ ├── generate_daos.py │ │ │ └── generate_dtos.py │ │ ├── resources │ │ │ ├── .gitignore │ │ │ ├── log4j.properties │ │ │ ├── messages.properties │ │ │ └── resources.properties.template │ │ ├── sql │ │ │ ├── patches │ │ │ │ ├── 1.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ └── 9.sql │ │ │ └── uestcoj.sql │ │ └── webapp │ │ │ ├── .gitignore │ │ │ └── WEB-INF │ │ │ ├── .gitignore │ │ │ ├── html │ │ │ ├── fuckIE.html │ │ │ ├── index.html │ │ │ └── index2.html │ │ │ └── web.xml │ └── test │ │ ├── java │ │ └── cn │ │ │ └── edu │ │ │ └── uestc │ │ │ └── acmicpc │ │ │ ├── config │ │ │ ├── IntegrationTestContext.java │ │ │ ├── TestContext.java │ │ │ └── TestListener.java │ │ │ ├── db │ │ │ ├── AOPITTest.java │ │ │ ├── condition │ │ │ │ └── base │ │ │ │ │ └── ConditionTest.java │ │ │ ├── criteria │ │ │ │ └── CriteriaITTest.java │ │ │ └── dto │ │ │ │ └── DtoTest.java │ │ │ ├── service │ │ │ ├── ArticleServiceITTest.java │ │ │ ├── CompileInfoServiceITTest.java │ │ │ ├── LanguageServiceITTest.java │ │ │ ├── ProblemServiceITTest.java │ │ │ ├── StatusServiceITTest.java │ │ │ ├── TeamServiceITTest.java │ │ │ ├── TrainingPlatformInfoServiceITTest.java │ │ │ ├── TrainingServiceITTest.java │ │ │ ├── TrainingUserServiceITTest.java │ │ │ └── UserServiceITTest.java │ │ │ ├── testing │ │ │ ├── ControllerTest.java │ │ │ └── PersistenceITTest.java │ │ │ ├── util │ │ │ ├── CompareSkipSpacesTest.java │ │ │ ├── UtilITTest.java │ │ │ ├── checker │ │ │ │ ├── ContestZipCheckerTest.java │ │ │ │ └── ZipDataCheckerTest.java │ │ │ └── helper │ │ │ │ └── ArrayUtilTest.java │ │ │ └── web │ │ │ └── oj │ │ │ └── controller │ │ │ ├── ArticleControllerTest.java │ │ │ ├── IndexControllerTest.java │ │ │ ├── ProblemControllerTest.java │ │ │ ├── TrainingControllerTest.java │ │ │ └── UserControllerTest.java │ │ ├── python │ │ ├── check_controller_not_contain_daos.py │ │ ├── check_dtos_not_contain_entities.py │ │ ├── check_testing_code_all_not_use_junit.py │ │ └── test_util.py │ │ ├── resources │ │ ├── .gitignore │ │ ├── log4j.properties │ │ └── resources.properties.template │ │ └── sql │ │ ├── uestcojtest-data0.sql │ │ └── uestcojtest.sql └── static │ ├── .gitignore │ ├── Gruntfile.coffee │ ├── README.md │ ├── bower.json │ ├── build.gradle │ ├── font │ ├── all │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ ├── other │ │ ├── OpenSans-Italic.woff │ │ ├── OpenSans-Light.woff │ │ ├── OpenSans-Semibold.woff │ │ ├── OpenSans-SemiboldItalic.woff │ │ ├── OpenSans.woff │ │ ├── OpenSansLight-Italic.woff │ │ ├── SourceCodePro-Regular.woff │ │ └── SourceCodePro-Semibold.woff │ └── windows │ │ ├── OpenSans-Italic.woff │ │ ├── OpenSans-Light.woff │ │ ├── OpenSans-Semibold.woff │ │ ├── OpenSans-SemiboldItalic.woff │ │ ├── OpenSans.woff │ │ ├── OpenSansLight-Italic.woff │ │ ├── SourceCodePro-Regular.woff │ │ └── SourceCodePro-Semibold.woff │ ├── images │ ├── .gitignore │ ├── browser.png │ ├── glyphicons-halflings-white.png │ ├── glyphicons-halflings.png │ └── logo │ │ ├── banner.png │ │ ├── banner.xcf │ │ ├── favicon.xcf │ │ ├── favicon128.png │ │ ├── favicon256.png │ │ ├── favicon512.png │ │ ├── favicon64.png │ │ ├── logo.png │ │ └── logo.xcf │ ├── package.json │ ├── src │ ├── angular │ │ ├── cdoj.coffee │ │ ├── config │ │ │ ├── ContestRouteConfig.coffee │ │ │ ├── IECacheConfig.coffee │ │ │ ├── ProblemRouteConfig.coffee │ │ │ ├── RouteConfig.coffee │ │ │ ├── TrainingRouteConfig.coffee │ │ │ └── UserRouteConfig.coffee │ │ ├── controller │ │ │ ├── AddContestModalController.coffee │ │ │ ├── AdminDashboardController.coffee │ │ │ ├── ArticleEditorController.coffee │ │ │ ├── ArticleShowController.coffee │ │ │ ├── CodeModalController.coffee │ │ │ ├── CompileInfoModalController.coffee │ │ │ ├── ErrorController.coffee │ │ │ ├── ForgetPasswordModalController.coffee │ │ │ ├── HeaderController.coffee │ │ │ ├── IndexController.coffee │ │ │ ├── ListController.coffee │ │ │ ├── MessageModalController.coffee │ │ │ ├── PasswordResetController.coffee │ │ │ ├── StatusListController.coffee │ │ │ ├── SubmitModalController.coffee │ │ │ ├── TeamEditorModalController.coffee │ │ │ ├── contest │ │ │ │ ├── ContestEditorController.coffee │ │ │ │ ├── ContestListController.coffee │ │ │ │ ├── ContestPasswordModalController.coffee │ │ │ │ ├── ContestRegisterController.coffee │ │ │ │ ├── ContestRegistryReviewModalController.coffee │ │ │ │ └── ContestShowController.coffee │ │ │ ├── problem │ │ │ │ ├── ProblemEditorController.coffee │ │ │ │ ├── ProblemListController.coffee │ │ │ │ └── ProblemShowController.coffee │ │ │ ├── training │ │ │ │ ├── TrainingContestEditorController.coffee │ │ │ │ ├── TrainingContestShowController.coffee │ │ │ │ ├── TrainingEditorController.coffee │ │ │ │ ├── TrainingListController.coffee │ │ │ │ ├── TrainingMemberEditorController.coffee │ │ │ │ └── TrainingShowController.coffee │ │ │ └── user │ │ │ │ ├── UserAdminModalController.coffee │ │ │ │ ├── UserCenterController.coffee │ │ │ │ ├── UserListController.coffee │ │ │ │ └── UserRegisterController.coffee │ │ ├── directive │ │ │ ├── ActiveLink.coffee │ │ │ ├── ArticleItem.coffee │ │ │ ├── AutoFillSync.coffee │ │ │ ├── Avatar.coffee │ │ │ ├── Code.coffee │ │ │ ├── CodeHref.coffee │ │ │ ├── Comment.coffee │ │ │ ├── ContestAdminSpan.coffee │ │ │ ├── ContestProblemHref.coffee │ │ │ ├── ContestUploader.coffee │ │ │ ├── Datetimepicker.coffee │ │ │ ├── DropdownMenu.coffee │ │ │ ├── Equals.coffee │ │ │ ├── Flandre.coffee │ │ │ ├── List.coffee │ │ │ ├── LoadingNotification.coffee │ │ │ ├── Markdown.coffee │ │ │ ├── Message.coffee │ │ │ ├── OnsiteUserFileUploader.coffee │ │ │ ├── Penalty.coffee │ │ │ ├── Problem.coffee │ │ │ ├── ProblemAdminSpan.coffee │ │ │ ├── ProblemDataUploader.coffee │ │ │ ├── Readmore.coffee │ │ │ ├── RejudgeButton.coffee │ │ │ ├── Sortable.coffee │ │ │ ├── Status.coffee │ │ │ ├── Team.coffee │ │ │ ├── Time.coffee │ │ │ ├── TimeLength.coffee │ │ │ ├── TrainingContestResultUploader.coffee │ │ │ ├── TrainingRankList.coffee │ │ │ ├── TrainingRatingChart.coffee │ │ │ ├── UserAdminSpan.coffee │ │ │ └── ValidateInfo.coffee │ │ ├── factory │ │ │ ├── Error.coffee │ │ │ └── UserProfile.coffee │ │ ├── global.coffee │ │ └── run │ │ │ ├── CurrentUser.coffee │ │ │ ├── Data.coffee │ │ │ ├── Permission.coffee │ │ │ └── Refresh.coffee │ └── less │ │ ├── cdoj.article.less │ │ ├── cdoj.chart.less │ │ ├── cdoj.code.less │ │ ├── cdoj.flandre.less │ │ ├── cdoj.font.less │ │ ├── cdoj.fontface.less │ │ ├── cdoj.form.less │ │ ├── cdoj.function.less │ │ ├── cdoj.layout.less │ │ ├── cdoj.less │ │ ├── cdoj.list.less │ │ ├── cdoj.markdown.less │ │ ├── cdoj.navbar.less │ │ ├── cdoj.rankList.less │ │ ├── cdoj.rating.less │ │ ├── cdoj.tool.less │ │ ├── cdoj.user.less │ │ └── cdoj.variable.less │ └── template │ ├── admin │ └── dashboard.html │ ├── article │ ├── article-summary.html │ ├── comment.html │ ├── editor.html │ └── show.html │ ├── contest │ ├── editor.html │ ├── list.html │ ├── register.html │ ├── show.html │ └── typeAhead.html │ ├── index │ ├── 404.html │ ├── error.html │ └── index.html │ ├── modal │ ├── add-contest-modal.html │ ├── code-modal.html │ ├── compile-info-modal.html │ ├── contest-password-modal.html │ ├── contest-registry-review-modal.html │ ├── forget-password-modal.html │ ├── message-modal.html │ ├── submit-modal.html │ ├── team-editor-modal.html │ ├── training-member-editor-modal.html │ └── user-admin-modal.html │ ├── problem │ ├── editor.html │ ├── list.html │ ├── problem.html │ └── show.html │ ├── status │ └── list.html │ ├── team │ ├── team.html │ └── typeAhead.html │ ├── training │ ├── editor.html │ ├── list.html │ ├── show.html │ ├── trainingContest.html │ ├── trainingContestEditor.html │ ├── trainingRankList.html │ └── trainingRatingChart.html │ └── user │ ├── activation.html │ ├── center.html │ ├── list.html │ ├── register.html │ └── typeAhead.html └── wiki ├── Tag.wiki └── URLFormat.wiki /.gitignore: -------------------------------------------------------------------------------- 1 | /*.box 2 | *.bak 3 | *.sw[mnop] 4 | .DS_Store 5 | nohup.out 6 | *.pyc 7 | *.py~ 8 | trunk/build/ 9 | /.idea 10 | *.iml 11 | /out 12 | *.ipr 13 | *.iws 14 | target/ 15 | /.vagrant/ 16 | *.log 17 | bazel-* -------------------------------------------------------------------------------- /.projectile: -------------------------------------------------------------------------------- 1 | - /doc/ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | 5 | install: 6 | - cd trunk 7 | - cp gradle.properties.template gradle.properties 8 | 9 | env: 10 | - TERM=dumb 11 | 12 | script: 13 | - gradle -PdbUser=travis -PdbPassword="" build 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UESTC ACM/ICPC Online Judge 2 | 3 | [](https://gitter.im/CDOJ/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [](https://travis-ci.org/UESTC-ACM/CDOJ) 5 | 6 | This project is *DEPRECATED* and refer to [Lutece](https://github.com/lutece-awesome) project (working in progress). 7 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "ubuntu/xenial64" 3 | config.vm.provider "virtualbox" do |v| 4 | v.memory = 4096 5 | v.cpus = 2 6 | end 7 | config.vm.provision "shell", inline: "bash /vagrant/bootstrap.sh" 8 | config.vm.network "forwarded_port", guest: 8080, host: 8080 9 | end 10 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | sudo apt-get update -y 4 | sudo apt-get dist-upgrade -y 5 | sudo apt-get install -y build-essential openjdk-8-jdk nodejs-legacy npm python2.7 g++-multilib 6 | curl -s "https://get.sdkman.io" | bash 7 | source "$HOME/.sdkman/bin/sdkman-init.sh" 8 | sdk install gradle 9 | 10 | echo "Boostraping completed." 11 | echo "please install mysql.sever maunally to setup password, then run mysql_secure_installation to configure it." 12 | -------------------------------------------------------------------------------- /doc/apidocs/cn/edu/uestc/acmicpc/config/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | {
13 |
14 | public CodeCriteria() {
15 | super(Code.class, CodeDto.class);
16 | }
17 |
18 | public Integer codeId;
19 |
20 | @Override
21 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
22 | if (codeId != null) {
23 | criteria.add(Restrictions.eq("codeId", codeId));
24 | }
25 | return criteria;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/ContestProblemCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.ContestProblemDto;
4 | import cn.edu.uestc.acmicpc.db.entity.ContestProblem;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 | import org.hibernate.criterion.Restrictions;
8 |
9 | public class ContestProblemCriteria extends BaseCriteria {
10 |
11 | public ContestProblemCriteria() {
12 | super(ContestProblem.class, ContestProblemDto.class);
13 | }
14 |
15 | public Integer contestId;
16 | public Integer problemId;
17 |
18 | @Override
19 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
20 | if (contestId != null) {
21 | criteria.add(Restrictions.eq("contestId", contestId));
22 | }
23 | if (problemId != null) {
24 | criteria.add(Restrictions.eq("problemId", problemId));
25 | }
26 | return criteria;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/ContestUserCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.ContestUserDto;
4 | import cn.edu.uestc.acmicpc.db.entity.ContestUser;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 | import org.hibernate.criterion.Restrictions;
8 |
9 | public class ContestUserCriteria extends BaseCriteria {
10 |
11 | public ContestUserCriteria() {
12 | super(ContestUser.class, ContestUserDto.class);
13 | }
14 |
15 | public Integer contestId;
16 | public Integer userId;
17 |
18 | @Override
19 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
20 | if (contestId != null) {
21 | criteria.add(Restrictions.eq("contestId", contestId));
22 | }
23 | if (userId != null) {
24 | criteria.add(Restrictions.eq("userId", userId));
25 | }
26 | return criteria;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/DepartmentCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.DepartmentDto;
4 | import cn.edu.uestc.acmicpc.db.entity.Department;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 |
8 | /**
9 | * Department database criteria entity.
10 | */
11 | public class DepartmentCriteria extends BaseCriteria {
12 |
13 | public DepartmentCriteria() {
14 | super(Department.class, DepartmentDto.class);
15 | }
16 |
17 | @Override
18 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
19 | return criteria;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/LanguageCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.LanguageDto;
4 | import cn.edu.uestc.acmicpc.db.entity.Language;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 |
8 | /**
9 | * Language database criteria entity.
10 | */
11 | public class LanguageCriteria extends BaseCriteria {
12 |
13 | public LanguageCriteria() {
14 | super(Language.class, LanguageDto.class);
15 | }
16 |
17 | @Override
18 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
19 | return criteria;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/SettingCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.SettingDto;
4 | import cn.edu.uestc.acmicpc.db.entity.Setting;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 | import org.hibernate.criterion.Restrictions;
8 |
9 | /**
10 | * Setting database criteria entity.
11 | */
12 | public class SettingCriteria extends BaseCriteria {
13 |
14 | public SettingCriteria() {
15 | super(Setting.class, SettingDto.class);
16 | }
17 |
18 | public Integer settingId;
19 |
20 | @Override
21 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
22 | if (settingId != null) {
23 | criteria.add(Restrictions.eq("settingId", settingId));
24 | }
25 | return criteria;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/TrainingCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.TrainingDto;
4 | import cn.edu.uestc.acmicpc.db.entity.Training;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 | import org.hibernate.criterion.Restrictions;
8 |
9 | /**
10 | * Training database criteria entity.
11 | */
12 | public class TrainingCriteria extends BaseCriteria {
13 |
14 | public TrainingCriteria() {
15 | super(Training.class, TrainingDto.class);
16 | }
17 |
18 | public Integer startId;
19 | public Integer endId;
20 | public String keyword;
21 |
22 | @Override
23 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
24 | if (startId != null) {
25 | criteria.add(Restrictions.ge("trainingId", startId));
26 | }
27 | if (endId != null) {
28 | criteria.add(Restrictions.le("trainingId", endId));
29 | }
30 | if (keyword != null) {
31 | keyword = "%" + keyword + "%";
32 | criteria.add(Restrictions.ilike("title", keyword));
33 | }
34 |
35 | return criteria;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/criteria/UserSerialKeyCriteria.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.criteria;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.UserSerialKeyDto;
4 | import cn.edu.uestc.acmicpc.db.entity.UserSerialKey;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.hibernate.criterion.DetachedCriteria;
7 | import org.hibernate.criterion.Restrictions;
8 |
9 | public class UserSerialKeyCriteria extends BaseCriteria {
10 |
11 | public UserSerialKeyCriteria() {
12 | super(UserSerialKey.class, UserSerialKeyDto.class);
13 | }
14 |
15 | public Integer userId;
16 |
17 | @Override
18 | DetachedCriteria updateCriteria(DetachedCriteria criteria) throws AppException {
19 | if (userId == null) {
20 | criteria.add(Restrictions.eq("userId", userId));
21 | }
22 | return criteria;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dao/base/BaseDao.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dao.base;
2 |
3 | import org.apache.log4j.LogManager;
4 | import org.apache.log4j.Logger;
5 | import org.hibernate.HibernateException;
6 | import org.hibernate.Session;
7 | import org.hibernate.SessionFactory;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
10 | import org.springframework.context.annotation.Scope;
11 | import org.springframework.stereotype.Repository;
12 | import org.springframework.transaction.annotation.Transactional;
13 |
14 | /**
15 | * Base DAO Implementation for Hibernate 4.
16 | */
17 | @Transactional
18 | @Repository
19 | @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
20 | public class BaseDao {
21 |
22 | private static final Logger LOGGER = LogManager.getLogger(BaseDao.class);
23 |
24 | @Autowired
25 | private SessionFactory sessionFactory;
26 |
27 | /**
28 | * Get current database session.
29 | *
30 | * @return if the IoC works, return current session, otherwise open a new
31 | * session
32 | */
33 | protected Session getSession() {
34 | Session session;
35 | try {
36 | session = sessionFactory.getCurrentSession();
37 | } catch (HibernateException e) {
38 | LOGGER.error(e);
39 | session = sessionFactory.openSession();
40 | }
41 | return session;
42 | }
43 | }
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/BaseDto.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Base Dto entity, for identified entity dto.
7 | *
8 | * @param entity type
9 | */
10 | public interface BaseDto {
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/BaseDtoBuilder.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto;
2 |
3 | import java.util.Map;
4 |
5 | /**
6 | * Dto builder interface.
7 | *
8 | * @param
9 | * data transfer object type.
10 | */
11 | public interface BaseDtoBuilder> {
12 |
13 | /**
14 | * Build Dto entity.
15 | *
16 | * @return Dto entity needed.
17 | */
18 | T build();
19 |
20 | /**
21 | * Build Dto by properties.
22 | *
23 | * @param properties
24 | * property set. .
25 | * @return Dto entity needed
26 | */
27 | T build(Map properties);
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/Fields.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto;
2 |
3 | /**
4 | * Field projection settings interface
5 | */
6 | @FunctionalInterface
7 | public interface Fields {
8 |
9 | /**
10 | * Get projection
11 | *
12 | * @return {@link cn.edu.uestc.acmicpc.db.dto.FieldProjection} entity
13 | */
14 | FieldProjection getProjection();
15 | }
16 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/FieldsUtil.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto;
2 |
3 | import com.google.common.collect.ImmutableSet;
4 | import java.util.Set;
5 |
6 | /**
7 | * Utility class for {@link Fields} related operations.
8 | */
9 | public class FieldsUtil {
10 |
11 | private FieldsUtil() {
12 | }
13 |
14 | public static Set getFieldNamesByFieldSet(Set extends Fields> fields) {
15 | ImmutableSet.Builder builder = ImmutableSet.builder();
16 | for (Fields field : fields) {
17 | builder.add(field.getProjection().getField());
18 | }
19 | return builder.build();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/impl/contestteam/ContestTeamReviewDto.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto.impl.contestteam;
2 |
3 | /**
4 | * Description
5 | */
6 | public class ContestTeamReviewDto {
7 | private Integer status;
8 | private Integer contestTeamId;
9 | private String comment;
10 |
11 | public Integer getStatus() {
12 | return status;
13 | }
14 |
15 | public void setStatus(Integer status) {
16 | this.status = status;
17 | }
18 |
19 | public Integer getContestTeamId() {
20 | return contestTeamId;
21 | }
22 |
23 | public void setContestTeamId(Integer contestTeamId) {
24 | this.contestTeamId = contestTeamId;
25 | }
26 |
27 | public String getComment() {
28 | return comment;
29 | }
30 |
31 | public void setComment(String comment) {
32 | this.comment = comment;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/db/dto/impl/user/OnsiteUserDto.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto.impl.user;
2 |
3 | import cn.edu.uestc.acmicpc.util.annotation.CSVMap;
4 |
5 | /**
6 | * User in onsite contest
7 | */
8 | public class OnsiteUserDto {
9 |
10 | @CSVMap("userName")
11 | public String userName;
12 |
13 | @CSVMap("password")
14 | public String password;
15 |
16 | @CSVMap("teamName")
17 | public String teamName;
18 |
19 | @CSVMap("members")
20 | public String members;
21 | }
22 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/judge/core/FakeCore.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.judge.core;
2 |
3 | import cn.edu.uestc.acmicpc.judge.entity.JudgeItem;
4 | import cn.edu.uestc.acmicpc.util.enums.OnlineJudgeReturnType;
5 | import java.util.Random;
6 |
7 | /**
8 | * A fake judge core that return fake result randomly.
9 | */
10 | public class FakeCore implements JudgeCore {
11 |
12 | @Override
13 | public JudgeResult judge(int currentCase, JudgeItem judgeItem) {
14 | Random random = new Random(System.currentTimeMillis());
15 | Integer timeLimit = judgeItem.getStatus().getTimeLimit();
16 | Integer memoryLimit = judgeItem.getStatus().getMemoryLimit();
17 | JudgeResult judgeResult = new JudgeResult();
18 | judgeResult.setTimeCost(random.nextInt(timeLimit));
19 | judgeResult.setMemoryCost(random.nextInt(memoryLimit));
20 | if (currentCase < judgeItem.getStatus().getDataCount() || random.nextInt(3) == 0) {
21 | judgeResult.setResult(OnlineJudgeReturnType.OJ_AC);
22 | } else {
23 | judgeResult.setResult(OnlineJudgeReturnType.getReturnType(2 + random.nextInt(14)));
24 | if (judgeResult.getResult() == OnlineJudgeReturnType.OJ_CE) {
25 | judgeResult.setCompileInfo("the compiler exits with exit_code: 127");
26 | }
27 | }
28 | return judgeResult;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/judge/core/JudgeCore.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.judge.core;
2 |
3 | import cn.edu.uestc.acmicpc.judge.entity.JudgeItem;
4 |
5 | /**
6 | * Judge core interface
7 | */
8 | public interface JudgeCore {
9 |
10 | public JudgeResult judge(int currentCase, JudgeItem judgeItem);
11 | }
12 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/judge/core/JudgeResult.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.judge.core;
2 |
3 | import cn.edu.uestc.acmicpc.util.enums.OnlineJudgeReturnType;
4 |
5 | /**
6 | * Judge result
7 | */
8 | public class JudgeResult {
9 |
10 | // Result id, see OnlineJudgeReturnType
11 | private OnlineJudgeReturnType result;
12 | private Integer memoryCost;
13 | private Integer timeCost;
14 | private String compileInfo;
15 | private String tempPath;
16 |
17 | public OnlineJudgeReturnType getResult() {
18 | return result;
19 | }
20 |
21 | public void setResult(OnlineJudgeReturnType result) {
22 | this.result = result;
23 | }
24 |
25 | public Integer getMemoryCost() {
26 | return memoryCost;
27 | }
28 |
29 | public void setMemoryCost(Integer memoryCost) {
30 | this.memoryCost = memoryCost;
31 | }
32 |
33 | public Integer getTimeCost() {
34 | return timeCost;
35 | }
36 |
37 | public void setTimeCost(Integer timeCost) {
38 | this.timeCost = timeCost;
39 | }
40 |
41 | public String getCompileInfo() {
42 | return compileInfo;
43 | }
44 |
45 | public void setCompileInfo(String compileInfo) {
46 | this.compileInfo = compileInfo;
47 | }
48 |
49 | public String gettempPath() {
50 | return tempPath;
51 | }
52 |
53 | public void settempPath(String tempPath) {
54 | this.tempPath = tempPath;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/CodeService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.CodeFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.CodeDto;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import java.util.Set;
7 |
8 | /**
9 | * Code service interface.
10 | */
11 | public interface CodeService {
12 |
13 | /**
14 | * Get {@link CodeDto} by code id.
15 | *
16 | * @param codeId code's id.
17 | * @param codeFields fields which is needed.
18 | * @return {@link CodeDto} entity.
19 | * @throws AppException
20 | */
21 | public CodeDto getCodeDto(Integer codeId, Set codeFields) throws AppException;
22 |
23 | /**
24 | * Create a new code record by {@link CodeDto}.
25 | *
26 | * @param codeDto {@link CodeDto} entity.
27 | * @return record's id.
28 | * @throws AppException
29 | */
30 | public Integer createNewCode(CodeDto codeDto) throws AppException;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/CompileInfoService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.util.exception.AppException;
4 |
5 | /**
6 | * CompileInfo service interface.
7 | */
8 | public interface CompileInfoService {
9 |
10 | /**
11 | * Get compile info by compile info id.
12 | *
13 | * @param compileInfoId compile info's id.
14 | * @return string value of compile info.
15 | * @throws AppException
16 | */
17 | public String getCompileInfo(Integer compileInfoId) throws AppException;
18 |
19 | /**
20 | * Update compile info.
21 | *
22 | * @param compileInfoId compile info's id.
23 | * @param content new content.
24 | * @throws AppException
25 | */
26 | public void updateCompileInfoContent(Integer compileInfoId, String content) throws AppException;
27 |
28 | /**
29 | * Create a new compile info record.
30 | *
31 | * @param content compile info content.
32 | * @return record's id.
33 | * @throws AppException
34 | */
35 | public Integer createCompileInfo(String content) throws AppException;
36 | }
37 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/ContestImporterService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.ContestDto;
4 | import cn.edu.uestc.acmicpc.util.exception.AppException;
5 | import cn.edu.uestc.acmicpc.web.dto.FileInformationDto;
6 |
7 | /**
8 | * Contest importer service interface.
9 | */
10 | public interface ContestImporterService {
11 |
12 | /**
13 | * Parse contest information via a ZIP fileInformationDto.
14 | *
15 | * @param fileInformationDto contest archive ZIP.
16 | * @return {@link cn.edu.uestc.acmicpc.db.dto.impl.ContestDto} a new
17 | * contest Dto.
18 | * @throws AppException
19 | */
20 | public ContestDto parseContestZipArchive(FileInformationDto fileInformationDto)
21 | throws AppException;
22 | }
23 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/ContestRankListService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.util.exception.AppException;
4 | import cn.edu.uestc.acmicpc.web.rank.RankList;
5 |
6 | /**
7 | * Contest rank list service interface.
8 | */
9 | public interface ContestRankListService {
10 |
11 | /**
12 | * Get rank list by contest's id.
13 | *
14 | * @param contestId contest's id.
15 | * @param contestType
16 | * @param frozen
17 | * @param frozenTime
18 | * @return {@link RankList} entity.
19 | * @throws AppException
20 | */
21 | public RankList getRankList(Integer contestId,
22 | Integer contestType,
23 | Boolean frozen, Integer frozenTime) throws AppException;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/ContestUserService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.ContestUserDto;
4 | import cn.edu.uestc.acmicpc.util.exception.AppException;
5 |
6 | /**
7 | * Contest user service interface
8 | */
9 | public interface ContestUserService {
10 |
11 | /**
12 | * Create a new contest user record in database by {@link ContestUserDto}
13 | * entity.
14 | *
15 | * @param contestUserDto {@link ContestUserDto} entity, specified the field value.
16 | * @return new record's id.
17 | * @throws AppException
18 | */
19 | public Integer createNewContestUser(ContestUserDto contestUserDto) throws AppException;
20 |
21 | /**
22 | * Remove all contest users (include the corresponding user record) in
23 | * database.
24 | *
25 | * @param contestId contest's id.
26 | * @throws AppException
27 | */
28 | public void removeContestUsersByContestId(Integer contestId) throws AppException;
29 |
30 | /**
31 | * Check whether a user has registered in a specified contest.
32 | *
33 | * @param userId user's id.
34 | * @param contestId contest's id.
35 | * @return true if this user has registered in this contest.
36 | * @throws AppException
37 | */
38 | public Boolean fetchOnsiteUsersByUserIdAndContestId(Integer userId, Integer contestId)
39 | throws AppException;
40 | }
41 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/DepartmentService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.DepartmentDto;
4 | import java.util.List;
5 |
6 | /**
7 | * Department service interface.
8 | */
9 | public interface DepartmentService {
10 |
11 | /**
12 | * Get department name by department id.
13 | *
14 | * @param departmentId department's id.
15 | * @return department name.
16 | */
17 | public String getDepartmentName(Integer departmentId);
18 |
19 | /**
20 | * Get {@link DepartmentDto} of all departments.
21 | *
22 | * @return list of {@link DepartmentDto}.
23 | */
24 | public List getDepartmentList();
25 | }
26 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/EmailService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.UserSerialKeyDto;
4 | import cn.edu.uestc.acmicpc.util.exception.AppException;
5 |
6 | /**
7 | * Email service interface.
8 | */
9 | public interface EmailService {
10 |
11 | /**
12 | * Send email.
13 | *
14 | * @param emailAddress recipient address.
15 | * @param title email title.
16 | * @param content email content.
17 | * @return true if this operation success.
18 | * @throws AppException
19 | */
20 | public Boolean send(String emailAddress, String title, String content) throws AppException;
21 |
22 | /**
23 | * Send user serial key by email.
24 | *
25 | * @param userSerialKeyDto Entity.
26 | * @return true if this operation success.
27 | * @throws AppException
28 | */
29 | public Boolean sendUserSerialKey(UserSerialKeyDto userSerialKeyDto) throws AppException;
30 | }
31 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/LanguageService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.LanguageDto;
4 | import java.util.List;
5 |
6 | /**
7 | * Language service interface.
8 | */
9 | public interface LanguageService {
10 |
11 | /**
12 | * Get all {@link LanguageDto} entities.
13 | *
14 | * @return list of all {@link LanguageDto} entities.
15 | */
16 | public List getLanguageList();
17 |
18 | /**
19 | * Get language extension by language id.
20 | *
21 | * @param languageId language's id.
22 | * @return language's extension.
23 | * @see LanguageDto
24 | */
25 | public String getExtension(Integer languageId);
26 |
27 | /**
28 | * Get language name by language id.
29 | *
30 | * @param languageId language's id.
31 | * @return language's name.
32 | * @see LanguageDto
33 | */
34 | public String getLanguageName(Integer languageId);
35 | }
36 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/PictureService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.util.exception.AppException;
4 | import cn.edu.uestc.acmicpc.web.dto.FileInformationDto;
5 | import cn.edu.uestc.acmicpc.web.dto.FileUploadDto;
6 |
7 | /**
8 | * Picture service interface.
9 | */
10 | public interface PictureService {
11 |
12 | /**
13 | * Upload picture into target directory.
14 | *
15 | * @param fileUploadDto {@link FileUploadDto} entity.
16 | * @param directory Directory, like "/problem/1/"
17 | * @return {@link FileInformationDto} entity.
18 | * @throws AppException
19 | */
20 | public FileInformationDto uploadPicture(FileUploadDto fileUploadDto,
21 | String directory) throws AppException;
22 |
23 | /**
24 | * When we add new problem/article, we upload images into /{category}/new/,
25 | * but after we save it we should move images into right place.
26 | *
27 | * @param content old article content
28 | * @param oldDirectory old directory, match the prefix
29 | * @param newDirectory new directory
30 | * @return modified content
31 | * @throws AppException
32 | */
33 | public String modifyPictureLocation(String content,
34 | String oldDirectory, String newDirectory) throws AppException;
35 | }
36 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/RecentContestService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.util.dto.RecentContestDto;
4 | import java.util.List;
5 |
6 | /**
7 | * Recent contest service interface
8 | */
9 | public interface RecentContestService {
10 |
11 | /**
12 | * Get recent contest list
13 | *
14 | * @return list of {@link cn.edu.uestc.acmicpc.util.dto.RecentContestDto}
15 | * entity.
16 | */
17 | public List getRecentContestList();
18 | }
19 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/SettingService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.SettingDto;
4 | import cn.edu.uestc.acmicpc.util.exception.AppException;
5 |
6 | /**
7 | * Setting service interface.
8 | */
9 | public interface SettingService {
10 |
11 | /**
12 | * Get settings detail by settings name.
13 | *
14 | * @param settingId setting's id
15 | * @return {@link cn.edu.uestc.acmicpc.db.dto.impl.SettingDto} entity.
16 | * @throws AppException
17 | */
18 | public SettingDto getSettingDto(Integer settingId) throws AppException;
19 |
20 | /**
21 | * Update setting by content of
22 | * {@link cn.edu.uestc.acmicpc.db.dto.impl.SettingDto} entity.
23 | *
24 | * @param settingDto {@link cn.edu.uestc.acmicpc.db.dto.impl.SettingDto} entity.
25 | * @throws AppException
26 | */
27 | public void updateSettingBySettingDto(SettingDto settingDto) throws AppException;
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/iface/UserSerialKeyService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.iface;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.UserSerialKeyDto;
4 | import cn.edu.uestc.acmicpc.util.exception.AppException;
5 |
6 | /**
7 | * User serial key service interface.
8 | */
9 | public interface UserSerialKeyService {
10 |
11 | /**
12 | * Get {@link UserSerialKeyDto} by user id.
13 | *
14 | * @param userId user id.
15 | * @return {@link UserSerialKeyDto} entity.
16 | * @throws AppException
17 | */
18 | public UserSerialKeyDto findUserSerialKeyDtoByUserId(Integer userId) throws AppException;
19 |
20 | /**
21 | * Generate a new user serial key record for specified user id.
22 | *
23 | * @param userId user id
24 | * @return {@link UserSerialKeyDto} entity.
25 | * @throws AppException if this user generated a user serial key in 30 minutes, throw a
26 | * exception and do nothing.
27 | */
28 | public UserSerialKeyDto generateUserSerialKey(Integer userId) throws AppException;
29 |
30 | /**
31 | * Save user serial key by {@link UserSerialKeyDto} entity.
32 | *
33 | * @param userSerialKeyDto {@link UserSerialKeyDto} entity
34 | * @throws AppException
35 | */
36 | public void updateUserSerialKey(UserSerialKeyDto userSerialKeyDto) throws AppException;
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/impl/AbstractService.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.impl;
2 |
3 | import org.springframework.beans.BeansException;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
6 | import org.springframework.context.ApplicationContext;
7 | import org.springframework.context.ApplicationContextAware;
8 | import org.springframework.context.annotation.Scope;
9 | import org.springframework.stereotype.Service;
10 |
11 | /**
12 | * Abstract service implementation.
13 | */
14 | @Service
15 | @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
16 | public abstract class AbstractService implements ApplicationContextAware {
17 |
18 | /**
19 | * Spring {@link ApplicationContext} entity for services.
20 | */
21 | @Autowired
22 | protected ApplicationContext applicationContext;
23 |
24 | @Override
25 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
26 | this.applicationContext = applicationContext;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/ArticleProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.ArticleFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.ArticleDto;
5 | import cn.edu.uestc.acmicpc.service.iface.ArticleService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Article provider for integration testing.
12 | */
13 | @Component
14 | public class ArticleProvider {
15 |
16 | @Autowired
17 | private ArticleService articleService;
18 |
19 | public ArticleDto createArticle(Integer userId) throws AppException {
20 | Integer articleId = articleService.createNewArticle(userId);
21 | return articleService.getArticleDto(articleId, ArticleFields.ALL_FIELDS);
22 | }
23 |
24 | public Integer[] createArticles(Integer userId, int count) throws AppException {
25 | Integer[] articleIds = new Integer[count];
26 | for (int i = 0; i < count; i++) {
27 | articleIds[i] = articleService.createNewArticle(userId);
28 | }
29 | return articleIds;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/CodeProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.CodeFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.CodeDto;
5 | import cn.edu.uestc.acmicpc.service.iface.CodeService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Code provider for integration testing.
12 | */
13 | @Component
14 | public class CodeProvider {
15 |
16 | @Autowired
17 | private CodeService codeService;
18 |
19 | public CodeDto createCode() throws AppException {
20 | Integer codeId = codeService.createNewCode(
21 | CodeDto.builder().setShare(false).setContent("content").build());
22 | return codeService.getCodeDto(codeId, CodeFields.ALL_FIELDS);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/ContestProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.ContestFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.ContestDto;
5 | import cn.edu.uestc.acmicpc.service.iface.ContestService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Contest provider for integration testing.
12 | */
13 | @Component
14 | public class ContestProvider {
15 |
16 | @Autowired private ContestService contestService;
17 |
18 | public ContestDto createContest() throws AppException {
19 | Integer contestId = contestService.createNewContest();
20 | return contestService.getContestDtoByContestId(contestId, ContestFields.BASIC_FIELDS);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/ProblemProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.problem.ProblemDto;
4 | import cn.edu.uestc.acmicpc.service.iface.ProblemService;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * Problem provider for integration testing.
11 | */
12 | @Component
13 | public class ProblemProvider {
14 |
15 | @Autowired
16 | private ProblemService problemService;
17 |
18 | public ProblemDto createProblem() throws AppException {
19 | Integer problemId = problemService.createNewProblem();
20 | return problemService.getProblemDtoByProblemId(problemId);
21 | }
22 |
23 | public Integer[] createProblems(int count) throws AppException {
24 | Integer[] problemIds = new Integer[count];
25 | for (int i = 0; i < count; i++) {
26 | problemIds[i] = createProblem().getProblemId();
27 | }
28 | return problemIds;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TeamProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.TeamFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.TeamDto;
5 | import cn.edu.uestc.acmicpc.service.iface.TeamService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Team provider
12 | */
13 | @Component
14 | public class TeamProvider {
15 |
16 | @Autowired private TeamService teamService;
17 |
18 | public TeamDto createTeam(Integer leaderId) throws AppException {
19 | Integer teamId = teamService.createNewTeam("Team" + TestUtil.getUniqueId(), leaderId);
20 | return teamService.getTeamDtoByTeamId(teamId, TeamFields.BASIC_FIELDS);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TeamUserProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.teamUser.TeamUserDto;
4 | import cn.edu.uestc.acmicpc.service.iface.TeamUserService;
5 | import cn.edu.uestc.acmicpc.util.exception.AppException;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * Team user provider
11 | */
12 | @Component
13 | public class TeamUserProvider {
14 |
15 | @Autowired private TeamUserService teamUserService;
16 |
17 | public void createTeamUser(Integer teamId, Integer userId) throws AppException {
18 | createTeamUser(teamId, userId, true);
19 | }
20 |
21 | public void createTeamUser(Integer teamId, Integer userId, boolean allow) throws AppException {
22 | teamUserService.createNewTeamUser(TeamUserDto.builder()
23 | .setTeamId(teamId)
24 | .setUserId(userId)
25 | .setAllow(allow)
26 | .build());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TestUtil.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | /**
4 | * Utils for test
5 | */
6 | public class TestUtil {
7 |
8 | private static long counter = 0;
9 |
10 | public static synchronized Long getUniqueId() {
11 | return ++counter;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TrainingPlatformInfoProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.TrainingPlatformInfoFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.TrainingPlatformInfoDto;
5 | import cn.edu.uestc.acmicpc.service.iface.TrainingPlatformInfoService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * TrainingPlatformInfo provider for integration testing.
12 | */
13 | @Component
14 | public class TrainingPlatformInfoProvider {
15 |
16 | @Autowired
17 | private TrainingPlatformInfoService service;
18 |
19 | @Autowired
20 | private TrainingUserProvider trainingUserProvider;
21 |
22 | public TrainingPlatformInfoDto createTrainingPlatformInfo() throws AppException {
23 | Integer id = service.createNewTrainingPlatformInfo(
24 | trainingUserProvider.createTrainingUser().getTrainingUserId());
25 | return service.getTrainingPlatformInfoDto(id, TrainingPlatformInfoFields.ALL_FIELDS);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TrainingProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.TrainingFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.TrainingDto;
5 | import cn.edu.uestc.acmicpc.service.iface.TrainingService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Training provider for integration testing.
12 | */
13 | @Component
14 | public class TrainingProvider {
15 |
16 | @Autowired
17 | private TrainingService service;
18 |
19 | public TrainingDto createTraining() throws AppException {
20 | Integer id = service.createNewTraining("training " + TestUtil.getUniqueId());
21 | return service.getTrainingDto(id, TrainingFields.ALL_FIELDS);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/service/testing/TrainingUserProvider.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.service.testing;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.field.TrainingUserFields;
4 | import cn.edu.uestc.acmicpc.db.dto.impl.TrainingUserDto;
5 | import cn.edu.uestc.acmicpc.service.iface.TrainingUserService;
6 | import cn.edu.uestc.acmicpc.util.exception.AppException;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * TrainingUser provider for integration testing.
12 | */
13 | @Component
14 | public class TrainingUserProvider {
15 |
16 | @Autowired
17 | private TrainingUserService service;
18 |
19 | @Autowired
20 | private UserProvider userProvider;
21 |
22 | @Autowired
23 | private TrainingProvider trainingProvider;
24 |
25 | public TrainingUserDto createTrainingUser() throws AppException {
26 | Integer id = service.createNewTrainingUser(
27 | userProvider.createUser().getUserId(),
28 | trainingProvider.createTraining().getTrainingId());
29 | return service.getTrainingUserDto(id, TrainingUserFields.ALL_FIELDS);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/annotation/CSVMap.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Map a field to column in CSV file
11 | */
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Target(ElementType.FIELD)
14 | @Documented
15 | public @interface CSVMap {
16 |
17 | /**
18 | * Mapping column name.
19 | *
20 | * @return mapping column name.
21 | */
22 | public String value() default "";
23 | }
24 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/annotation/Fields.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Dto's DB fields for DB query.
11 | */
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Target(ElementType.TYPE)
14 | @Documented
15 | public @interface Fields {
16 |
17 | String[] value();
18 | }
19 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/annotation/JsonMap.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Annotation for marking the argument need resolved from json data.
11 | */
12 | @Target(ElementType.PARAMETER)
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Documented
15 | public @interface JsonMap {
16 | public String value() default "";
17 | }
18 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/annotation/KeyField.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * Key field annotation for database entity.
11 | */
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Target(ElementType.TYPE)
14 | @Documented
15 | public @interface KeyField {
16 |
17 | public String value();
18 | }
19 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/annotation/LoginPermit.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.annotation;
2 |
3 | import cn.edu.uestc.acmicpc.util.enums.AuthenticationType;
4 | import java.lang.annotation.Documented;
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * Login permission controller.
12 | *
13 | * Use this annotation to validate users' types.
14 | */
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Target(ElementType.METHOD)
17 | @Documented
18 | public @interface LoginPermit {
19 |
20 | /**
21 | * Set user type needed. The user type can refer to {@link AuthenticationType}
22 | * .
23 | *
24 | * @return User type needed.
25 | * @see AuthenticationType
26 | */
27 | public AuthenticationType value() default AuthenticationType.NORMAL;
28 |
29 | /**
30 | * Need user toLogin or not
31 | *
32 | * @return if this action will need user toLogin, set it true.
33 | */
34 | public boolean NeedLogin() default true;
35 | }
36 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/checker/base/Checker.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.checker.base;
2 |
3 | import cn.edu.uestc.acmicpc.util.exception.AppException;
4 |
5 | /**
6 | * Checker for file uploader or unzip tools.
7 | *
8 | * We can use {@code Checker} Entity when upload files or unzip a {@code zip}
9 | * file.
10 | *
11 | * Override {@code check} method for checker working.
12 | *
13 | * @param
14 | * Entity type
15 | */
16 | public interface Checker {
17 |
18 | /**
19 | * Check certain entity, if the entity is invalid, throws an
20 | * {@code AppException} object.
21 | *
22 | * @param entity
23 | * entity to be checked
24 | * @throws AppException
25 | * if the entity is invalid.
26 | */
27 | public void check(E entity) throws AppException;
28 | }
29 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/dto/RecentContestDto.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.dto;
2 |
3 | import java.sql.Timestamp;
4 |
5 | /**
6 | * Description
7 | */
8 | public class RecentContestDto {
9 | private Integer id;
10 | private String oj;
11 | private String link;
12 | private String name;
13 | private Timestamp startTime;
14 | private String week;
15 | private String access;
16 |
17 | public Integer getId() {
18 | return id;
19 | }
20 |
21 | public void setId(Integer id) {
22 | this.id = id;
23 | }
24 |
25 | public String getOj() {
26 | return oj;
27 | }
28 |
29 | public void setOj(String oj) {
30 | this.oj = oj;
31 | }
32 |
33 | public String getLink() {
34 | return link;
35 | }
36 |
37 | public void setLink(String link) {
38 | this.link = link;
39 | }
40 |
41 | public String getName() {
42 | return name;
43 | }
44 |
45 | public void setName(String name) {
46 | this.name = name;
47 | }
48 |
49 | public Timestamp getStartTime() {
50 | return startTime;
51 | }
52 |
53 | public void setStartTime(Timestamp start_time) {
54 | this.startTime = start_time;
55 | }
56 |
57 | public String getWeek() {
58 | return week;
59 | }
60 |
61 | public void setWeek(String week) {
62 | this.week = week;
63 | }
64 |
65 | public String getAccess() {
66 | return access;
67 | }
68 |
69 | public void setAccess(String access) {
70 | this.access = access;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/ArticleType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Article type
5 | */
6 | public enum ArticleType implements EnumType {
7 | NOTICE("Notice"), ARTICLE("Article"), COMMENT("Comment");
8 | private final String description;
9 |
10 | @Override
11 | public String getDescription() {
12 | return description;
13 | }
14 |
15 | ArticleType(String description) {
16 | this.description = description;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/AuthenticationType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * User's authentication type(`type` column in user entity).
5 | */
6 | public enum AuthenticationType implements EnumType {
7 | NORMAL("Normal user"), ADMIN("Administrator"), CONSTANT("Constant user"), INTERNAL("Internal user");
8 |
9 | private final String description;
10 |
11 | private AuthenticationType(String description) {
12 | this.description = description;
13 | }
14 |
15 | @Override
16 | public String getDescription() {
17 | return description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/ContestRegistryStatusType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Contest register request status type
5 | */
6 | public enum ContestRegistryStatusType implements EnumType {
7 | PENDING("Pending"), ACCEPTED("Accepted"), REFUSED("Refused");
8 |
9 | private final String description;
10 |
11 | private ContestRegistryStatusType(String description) {
12 | this.description = description;
13 | }
14 |
15 | @Override
16 | public String getDescription() {
17 | return description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/ContestType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Contest type for contest entity
5 | */
6 | public enum ContestType implements EnumType {
7 | PUBLIC("Public"), PRIVATE("Private"), DIY("DIY"), INVITED("Invited"),
8 | INHERIT("Inherit"), ONSITE("Onsite");
9 |
10 | private final String description;
11 |
12 | private ContestType(String description) {
13 | this.description = description;
14 | }
15 |
16 | @Override
17 | public String getDescription() {
18 | return description;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/EnumType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Enum type interface
5 | */
6 | public interface EnumType {
7 | public String getDescription();
8 | }
9 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/GenderType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * User's gender type
5 | */
6 | public enum GenderType implements EnumType {
7 | MALE("Male"), FEMALE("Female");
8 |
9 | private final String description;
10 |
11 | private GenderType(String description) {
12 | this.description = description;
13 | }
14 |
15 | @Override
16 | public String getDescription() {
17 | return description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/GradeType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * User's grade type
5 | */
6 | public enum GradeType implements EnumType {
7 | SENIOR_ONE("Senior one"), SENIOR_TWO("Senior two"), SENIOR_THREE("Senior three"),
8 | FRESHMAN("Freshman"), SOPHOMORE("Sophomore"), JUNIOR("Junior"),
9 | FOURTH_YEAR_OF_UNIVERSITY("Fourth year of university"), GRADUATE("Graduate");
10 |
11 | private final String description;
12 |
13 | private GradeType(String description) {
14 | this.description = description;
15 | }
16 |
17 | @Override
18 | public String getDescription() {
19 | return description;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/ProblemSolveStatusType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Problem status for author problem flag.
5 | */
6 | public enum ProblemSolveStatusType implements EnumType {
7 | NONE("Not tried"), PASS("Passed"), FAIL("Tried but failed"), FB("First blood");
8 |
9 | private final String description;
10 |
11 | @Override
12 | public String getDescription() {
13 | return this.description;
14 | }
15 |
16 | private ProblemSolveStatusType(String description) {
17 | this.description = description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/ProblemType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 | public enum ProblemType implements EnumType {
3 | NORMAL("Normal problem"),
4 | INTERNAL("Internal problem");
5 | private final String description;
6 | private ProblemType(String description) {
7 | this.description = description;
8 | }
9 | @Override
10 | public String getDescription() {
11 | return description;
12 | }
13 | }
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/TShirtsSizeType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * User's t-shirts size type
5 | */
6 | public enum TShirtsSizeType implements EnumType {
7 | XS("XS"), S("S"), M("M"), L("L"), XL("XL"), XXL("XXL");
8 |
9 | private final String description;
10 |
11 | private TShirtsSizeType(String description) {
12 | this.description = description;
13 | }
14 |
15 | @Override
16 | public String getDescription() {
17 | return description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/TrainingContestType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Type of training contest.
5 | */
6 | public enum TrainingContestType implements EnumType {
7 | CONTEST("Contest"), ADJUST("Rating adjust");
8 |
9 | private final String description;
10 |
11 | @Override
12 | public String getDescription() {
13 | return description;
14 | }
15 |
16 | private TrainingContestType(String description) {
17 | this.description = description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/TrainingPlatformType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Type of training platform
5 | */
6 | public enum TrainingPlatformType implements EnumType {
7 | TC("TopCoder"), CF("Codeforces"), HDOJ("HDU Online Judge"),
8 | CDOJ("UESTC Online Judge"), VJ("Virtual Judge");
9 |
10 | private final String description;
11 |
12 | @Override
13 | public String getDescription() {
14 | return description;
15 | }
16 |
17 | TrainingPlatformType(String description) {
18 | this.description = description;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/TrainingResultFieldType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Type of fields in training contest rank list.
5 | */
6 | public enum TrainingResultFieldType implements EnumType {
7 | UNUSED("Unused"), USERNAME("User name"), PROBLEM("Problem"),
8 | PENALTY("Penalty"), SOLVED("Solved"), SCORE("Score"), SUCCESSFUL_HACK("Successful hack"),
9 | UNSUCCESSFUL_HACK("Unsuccessful hack"), TYPE("Type"), DEDUCT("Deduct rating");
10 |
11 | private final String description;
12 |
13 | @Override
14 | public String getDescription() {
15 | return description;
16 | }
17 |
18 | TrainingResultFieldType(String description) {
19 | this.description = description;
20 | }
21 | }
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/enums/TrainingUserType.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.enums;
2 |
3 | /**
4 | * Type of training user
5 | */
6 | public enum TrainingUserType implements EnumType {
7 | PERSONAL("Personal"), TEAM("team");
8 |
9 | private final String description;
10 |
11 | @Override
12 | public String getDescription() {
13 | return description;
14 | }
15 |
16 | TrainingUserType(String description) {
17 | this.description = description;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/exception/ParserException.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.exception;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * A simple exception for Rank list Parser.
7 | */
8 | public class ParserException extends Exception implements Serializable {
9 |
10 | private static final long serialVersionUID = -7175100990197608823L;
11 |
12 | /**
13 | * Creates a new {@link ParserException} with {@code null} as its detail
14 | * message and cause.
15 | */
16 | public ParserException() {
17 | super();
18 | }
19 |
20 | /**
21 | * Creates a new {@link ParserException} with its detail message.
22 | *
23 | * @param message
24 | * message for error.
25 | */
26 | public ParserException(String message) {
27 | super(message);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/exception/ValidatorException.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.exception;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * A simple exception implement for JSON inside.
8 | */
9 | public class ValidatorException extends Exception {
10 |
11 | private static final long serialVersionUID = 2653305329765940347L;
12 | private final Map json;
13 |
14 | /**
15 | * Creates a {@link ValidatorException} with multiple keys and values
16 | *
17 | * @param json
18 | * JSON Mapping
19 | */
20 | public ValidatorException(Map json) {
21 | super();
22 | this.json = json;
23 | }
24 |
25 | /**
26 | * Creates a {@link ValidatorException} with single key and value.
27 | *
28 | * @param key
29 | * JSON key
30 | * @param value
31 | * JSON value
32 | */
33 | public ValidatorException(String key, String value) {
34 | super();
35 | json = new HashMap<>();
36 | json.put(key, value);
37 | }
38 |
39 | /**
40 | * @return key to value map in JSON format in the exception.
41 | */
42 | public Map getJson() {
43 | return json;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/helper/BeanUtil.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.helper;
2 |
3 | import javax.servlet.ServletContext;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.context.ApplicationContext;
6 | import org.springframework.stereotype.Component;
7 | import org.springframework.web.context.WebApplicationContext;
8 | import org.springframework.web.context.support.WebApplicationContextUtils;
9 |
10 | /**
11 | * Manage methods for Spring Beans.
12 | */
13 | @Component
14 | public class BeanUtil {
15 |
16 | @Autowired
17 | private static ApplicationContext applicationContext;
18 |
19 | /**
20 | * Get specific bean by bean name and servletContext.
21 | *
22 | * @param beanName
23 | * bean's name
24 | * @param servletContext
25 | * servlet application
26 | * @return specific bean
27 | */
28 | public static Object getBeanByServletContext(String beanName, ServletContext servletContext) {
29 | WebApplicationContext wc = WebApplicationContextUtils.getWebApplicationContext(servletContext);
30 | return wc.getBean(beanName);
31 | }
32 |
33 | /**
34 | * Get specific bean by bean class.
35 | *
36 | * @param beanClass
37 | * bean's class
38 | * @return specific bean
39 | */
40 | public static T getBean(Class beanClass) {
41 | return applicationContext.getBean(beanClass);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/helper/ReflectionUtil.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.helper;
2 |
3 | import java.lang.reflect.Method;
4 |
5 | /**
6 | * Global method for get method and field from objects.
7 | */
8 | public class ReflectionUtil {
9 |
10 | @SuppressWarnings({ "unchecked", "rawtypes" })
11 | public static Method getMethodByAnnotation(Class> clazz, Class annotation) {
12 | Method[] methods = clazz.getMethods();
13 | for (Method method : methods) {
14 | if (method.getAnnotation(annotation) != null) {
15 | return method;
16 | }
17 | }
18 | return null;
19 | }
20 |
21 | /**
22 | * Convert a string value to specific type.
23 | *
24 | * @param value
25 | * string value
26 | * @param targetType
27 | * target type class
28 | * @return target value
29 | */
30 | public static Object valueOf(String value, Class> targetType) {
31 | try {
32 | Method convertMethod = targetType.getMethod("valueOf", String.class);
33 | return convertMethod.invoke(null, value);
34 | } catch (Exception e) {
35 | return value;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/log/ANSIConsoleAppender.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.log;
2 |
3 | import org.apache.log4j.ConsoleAppender;
4 | import org.apache.log4j.Level;
5 | import org.apache.log4j.Priority;
6 | import org.apache.log4j.spi.LoggingEvent;
7 |
8 | /**
9 | * Color-coded console appender for log4j.
10 | */
11 | public class ANSIConsoleAppender extends ConsoleAppender {
12 |
13 | @Override
14 | protected void subAppend(LoggingEvent event) {
15 | this.qw.write(getColor(event.getLevel()));
16 | super.subAppend(event);
17 | this.qw.write(LogConstants.END_COLOR);
18 |
19 | if (this.immediateFlush) {
20 | this.qw.flush();
21 | }
22 | }
23 |
24 | /**
25 | * Get the appropriate control characters to change the color for the
26 | * specified logging level.
27 | *
28 | * @param level
29 | * log level.
30 | * @return color prefix for the level.
31 | */
32 | private String getColor(Level level) {
33 | switch (level.toInt()) {
34 | case Priority.FATAL_INT:
35 | return LogConstants.FATAL_COLOR;
36 | case Priority.ERROR_INT:
37 | return LogConstants.ERROR_COLOR;
38 | case Priority.WARN_INT:
39 | return LogConstants.WARN_COLOR;
40 | case Priority.INFO_INT:
41 | return LogConstants.INFO_COLOR;
42 | case Priority.DEBUG_INT:
43 | return LogConstants.DEBUG_COLOR;
44 | default:
45 | return LogConstants.TRACE_COLOR;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/settings/SettingsID.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.settings;
2 |
3 | /**
4 | * Settings id map.
5 | */
6 | public enum SettingsID {
7 | HOST(1),
8 | ENCODING(2),
9 | @Deprecated
10 | UPLOAD_FOLDER(3),
11 | @Deprecated
12 | PICTURE_FOLDER(4),
13 | JUDGE_CORE(5),
14 | @Deprecated
15 | DATA_PATH(6),
16 | @Deprecated
17 | WORK_PATH(7),
18 | JUDGES(8),
19 | EMAIL(9),
20 | RECORD_PER_PAGE(10);
21 |
22 | private Integer id;
23 |
24 | SettingsID(Integer id) {
25 | this.id = id;
26 | }
27 |
28 | public Integer getId() {
29 | return id;
30 | }
31 |
32 | public void setId(Integer id) {
33 | this.id = id;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/settings/entity/EmailSetting.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.settings.entity;
2 |
3 | /**
4 | * Email setting entity
5 | */
6 | public class EmailSetting {
7 | private String address;
8 | private String userName;
9 | private String password;
10 | private String smtpServer;
11 |
12 | public String getAddress() {
13 | return address;
14 | }
15 |
16 | public void setAddress(String address) {
17 | this.address = address;
18 | }
19 |
20 | public String getUserName() {
21 | return userName;
22 | }
23 |
24 | public void setUserName(String userName) {
25 | this.userName = userName;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSmtpServer() {
37 | return smtpServer;
38 | }
39 |
40 | public void setSmtpServer(String smtpServer) {
41 | this.smtpServer = smtpServer;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/util/settings/entity/JudgeSetting.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.util.settings.entity;
2 |
3 | /**
4 | * Judge setting entity
5 | */
6 | public class JudgeSetting {
7 | private String name;
8 |
9 | public String getName() {
10 | return name;
11 | }
12 |
13 | public void setName(String name) {
14 | this.name = name;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/dto/FileUploadDto.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.dto;
2 |
3 | import java.util.List;
4 | import org.springframework.web.multipart.MultipartFile;
5 |
6 | /**
7 | * Dto post from file upload form.
8 | */
9 | public class FileUploadDto {
10 |
11 | private List files;
12 |
13 | public List getFiles() {
14 | return files;
15 | }
16 |
17 | public void setFiles(List files) {
18 | this.files = files;
19 | }
20 |
21 | public FileUploadDto(List files) {
22 | this.files = files;
23 | }
24 |
25 | public static Builder builder() {
26 | return new Builder();
27 | }
28 |
29 | public static class Builder {
30 |
31 | public Builder() {
32 | }
33 |
34 | public FileUploadDto build() {
35 | return new FileUploadDto(files);
36 | }
37 |
38 | List files;
39 |
40 | public Builder setFiles(List files) {
41 | this.files = files;
42 | return this;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/dto/TrainingRating.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.dto;
2 |
3 | /**
4 | * Training rating record
5 | */
6 | public class TrainingRating {
7 | public Double rating;
8 | public Double volatility;
9 | public Integer rank;
10 | public Double ratingVary;
11 | public Double volatilityVary;
12 | public Integer trainingContestId;
13 |
14 | public TrainingRating() {
15 | }
16 |
17 | public TrainingRating(Double rating, Double volatility, Integer rank, Double ratingVary, Double volatilityVary, Integer trainingContestId) {
18 | this.rating = rating;
19 | this.volatility = volatility;
20 | this.rank = rank;
21 | this.ratingVary = ratingVary;
22 | this.volatilityVary = volatilityVary;
23 | this.trainingContestId = trainingContestId;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/oj/controller/admin/AdminController.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.oj.controller.admin;
2 |
3 | import cn.edu.uestc.acmicpc.util.annotation.LoginPermit;
4 | import cn.edu.uestc.acmicpc.util.enums.AuthenticationType;
5 | import cn.edu.uestc.acmicpc.web.oj.controller.base.BaseController;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 |
9 | /**
10 | * Administrator controller.
11 | */
12 | @Controller
13 | @RequestMapping("/admin")
14 | public class AdminController extends BaseController {
15 |
16 | public AdminController() {
17 | }
18 |
19 | @RequestMapping(value = { "index", "/" })
20 | @LoginPermit(AuthenticationType.ADMIN)
21 | public String index() {
22 | return "admin/index";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/oj/controller/index/ErrorController.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.oj.controller.index;
2 |
3 | import cn.edu.uestc.acmicpc.web.oj.controller.base.BaseController;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | /**
8 | * Controller for error information
9 | */
10 | @Controller
11 | @RequestMapping("/error")
12 | public class ErrorController extends BaseController {
13 |
14 | public ErrorController() {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/RankList.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | import java.sql.Timestamp;
4 |
5 | /**
6 | * Description
7 | */
8 | public class RankList {
9 | public RankListProblem[] problemList;
10 | public RankListUser[] rankList;
11 | public Timestamp lastFetched;
12 | }
13 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/RankListItem.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | /**
4 | * Description
5 | */
6 | public class RankListItem {
7 | public Boolean solved;
8 | public Integer tried;
9 | public Long solvedTime;
10 | public Long penalty;
11 | public Boolean firstBlood;
12 | public Boolean triedAfterFrozen;
13 | }
14 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/RankListProblem.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | /**
4 | * Description
5 | */
6 | public class RankListProblem {
7 | public String title;
8 | public Integer solved;
9 | public Integer tried;
10 | public Integer firstSolvedTime;
11 | public Double maximalScore;
12 |
13 | public RankListProblem() {
14 | }
15 |
16 | public RankListProblem(String title, Integer solved, Integer tried) {
17 | this.title = title;
18 | this.solved = solved;
19 | this.tried = tried;
20 | this.firstSolvedTime = Integer.MAX_VALUE;
21 | this.maximalScore = 0.0;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/RankListStatus.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | /**
4 | * Description
5 | */
6 | public class RankListStatus {
7 | public Integer tried;
8 | public Integer result;
9 | public String problemTitle;
10 | public String userName;
11 | public String nickName;
12 | public String reallyName;
13 | public String email;
14 | public Long time;
15 |
16 | public RankListStatus(Integer tried,
17 | Integer result,
18 | String problemTitle,
19 | String userName,
20 | String nickName,
21 | String email,
22 | String reallyName,
23 | Long time) {
24 | this.tried = tried;
25 | this.result = result;
26 | this.problemTitle = problemTitle;
27 | this.userName = userName;
28 | this.nickName = nickName;
29 | this.email = email;
30 | this.reallyName = reallyName;
31 | this.time = time;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/RankListUser.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.teamUser.TeamUserListDto;
4 | import java.util.List;
5 |
6 | /**
7 | * Description
8 | */
9 | public class RankListUser implements Comparable {
10 | public String name;
11 | public String nickName;
12 | public String reallyName;
13 | public String email;
14 | public List teamUsers;
15 | public Integer rank;
16 | public Integer solved;
17 | public Integer tried;
18 | public Long penalty;
19 | public RankListItem[] itemList;
20 |
21 | @Override
22 | public int compareTo(RankListUser b) {
23 | if (b == null) {
24 | return -1;
25 | }
26 | if (this.solved > b.solved) {
27 | return -1;
28 | } else if (this.solved < b.solved) {
29 | return 1;
30 | } else {
31 | return this.penalty.compareTo(b.penalty);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/TrainingRankList.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | public class TrainingRankList {
4 | public String[] fields;
5 | public Integer[] fieldType;
6 | public TrainingRankListUser[] users;
7 | public RankListProblem[] problems;
8 | }
9 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/TrainingRankListItem.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | import cn.edu.uestc.acmicpc.util.enums.ProblemSolveStatusType;
4 |
5 | public class TrainingRankListItem {
6 | public ProblemSolveStatusType status;
7 | public Integer solvedTime;
8 | public Integer tried;
9 | public Integer penalty;
10 | public Double score;
11 |
12 | public TrainingRankListItem() {
13 | }
14 |
15 | public TrainingRankListItem(
16 | ProblemSolveStatusType status,
17 | Integer solvedTime,
18 | Integer tried,
19 | Integer penalty) {
20 | this.status = status;
21 | this.solvedTime = solvedTime;
22 | this.tried = tried;
23 | this.penalty = penalty;
24 | }
25 |
26 | public TrainingRankListItem(ProblemSolveStatusType status, Double score) {
27 | this.status = status;
28 | this.score = score;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/trunk/src/main/java/cn/edu/uestc/acmicpc/web/rank/TrainingRankListUser.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.rank;
2 |
3 | import cn.edu.uestc.acmicpc.db.dto.impl.TrainingUserDto;
4 |
5 | public class TrainingRankListUser {
6 | public TrainingUserDto[] users;
7 | public Integer rank;
8 | public Integer solved;
9 | public Double score;
10 | public Integer successfulHack;
11 | public Integer unsuccessfulHack;
12 | public Long penalty;
13 | public TrainingRankListItem[] itemList;
14 | public String[] rawData;
15 | public String userName;
16 | public String type;
17 | public Integer deductRating;
18 | }
19 |
--------------------------------------------------------------------------------
/trunk/src/main/resources/.gitignore:
--------------------------------------------------------------------------------
1 | resources.properties
2 |
--------------------------------------------------------------------------------
/trunk/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.appender.stderr=cn.edu.uestc.acmicpc.util.log.ANSIConsoleAppender
2 | log4j.appender.stderr.Target=System.err
3 | log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
4 | log4j.appender.stderr.layout.ConversionPattern=[%t] %-5p %l %x - %m%n
5 |
6 | log4j.appender.fileout=org.apache.log4j.RollingFileAppender
7 | log4j.appender.fileout.File=build/application.log
8 | log4j.appender.fileout.MaxFileSize=10240KB
9 | log4j.appender.fileout.MaxBackupIndex=10
10 | log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
11 | log4j.appender.fileout.layout.ConversionPattern=[%t] %-5p %l %x - %m%n
12 |
13 | log4j.rootCategory=WARN, fileout
14 |
15 | log4j.logger.cn.edu.uestc.acmicpc.service=DEBUG, stderr
16 | log4j.logger.cn.edu.uestc.acmicpc.web=DEBUG, stderr
17 | log4j.logger.cn.edu.uestc.acmicpc.config=DEBUG, stderr
18 | log4j.logger.cn.edu.uestc.acmicpc.db=DEBUG, stderr
19 | log4j.logger.cn.edu.uestc.acmicpc.judge=DEBUG, stderr
20 |
--------------------------------------------------------------------------------
/trunk/src/main/resources/messages.properties:
--------------------------------------------------------------------------------
1 | error.userName.validation=Please enter 4-24 characters consist of A-Z, a-z, 0-9 and '_'.
2 | error.password.validation=Please enter 6-20 characters.
3 | error.passwordRepeat.validation=Password do not match.
4 | error.nickName.validation=Please enter 4-20 characters.
5 | error.email.validation=Please enter a validation email address.
6 | error.school.validation=Please enter your school.
7 | error.department.validation=Please choose a validate department.
8 | error.type.validation=Please choose a validate type.
9 | error.studentId.validation=Please enter your student id.
10 |
11 | error.trainingUserName.validation=Please enter 2-14 characters.
12 |
13 | error.title.validation=Please enter title.
14 | error.timeLimit.validation=Time limit should between 0 to 60000 ms.
15 | error.memoryLimit.validation=Memory limit should between 0 to 262144 KB.
16 | error.outputLimit.validation=Output limit should between 0 to 262144 KB.
17 |
18 | error.contestTitle.validation=Please enter title.
19 |
--------------------------------------------------------------------------------
/trunk/src/main/resources/resources.properties.template:
--------------------------------------------------------------------------------
1 | hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
2 | hibernate.show_sql=false
3 | hibernate.format_sql=false
4 | hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
5 |
6 |
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/10.sql:
--------------------------------------------------------------------------------
1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
4 |
5 | START TRANSACTION;
6 | USE `uestcoj`;
7 | INSERT INTO `uestcoj`.`department` (`departmentId`, `name`, `OPTLOCK`) VALUES (19, 'UoG-UESTC Joint School', 0);
8 | INSERT INTO `uestcoj`.`department` (`departmentId`, `name`, `OPTLOCK`) VALUES (20, 'School of Resources and Environment', 0);
9 | INSERT INTO `uestcoj`.`department` (`departmentId`, `name`, `OPTLOCK`) VALUES (21, 'School of Medicine', 0);
10 | INSERT INTO `uestcoj`.`department` (`departmentId`, `name`, `OPTLOCK`) VALUES (22, 'Institute of Fundamental and Frontier Sciences', 0);
11 | INSERT INTO `uestcoj`.`department` (`departmentId`, `name`, `OPTLOCK`) VALUES (23, 'School of Energy Science and Engineering', 0);
12 |
13 | COMMIT;
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/2.sql:
--------------------------------------------------------------------------------
1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
4 |
5 | ALTER TABLE `uestcoj`.`contestTeamInfo` ADD COLUMN `studentId` VARCHAR(100) NOT NULL DEFAULT '' AFTER `grade` ;
6 |
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/4.sql:
--------------------------------------------------------------------------------
1 | -- Elongate description field in contest
2 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
3 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
4 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
5 |
6 | ALTER TABLE `uestcoj`.`contest`
7 | CHANGE COLUMN `description` `description` TEXT NOT NULL ;
8 |
9 |
10 | SET SQL_MODE=@OLD_SQL_MODE;
11 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
12 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
13 |
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/5.sql:
--------------------------------------------------------------------------------
1 | -- Add fileds needed in contest permission check
2 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
3 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
4 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
5 |
6 | ALTER TABLE `uestcoj`.`contest`
7 | ADD COLUMN `password` VARCHAR(40) NULL DEFAULT NULL AFTER `OPTLOCK` ,
8 | ADD COLUMN `parentId` INT(11) NULL DEFAULT NULL AFTER `password` ,
9 | ADD CONSTRAINT `FK_parentId_on_contest_idx`
10 | FOREIGN KEY (`parentId` )
11 | REFERENCES `uestcoj`.`contest` (`contestId` )
12 | ON DELETE CASCADE
13 | ON UPDATE CASCADE,
14 | ADD INDEX `FK_parentId_on_contest_idx_idx` (`parentId` ASC) ;
15 |
16 | SET SQL_MODE=@OLD_SQL_MODE;
17 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
18 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
19 |
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/7.sql:
--------------------------------------------------------------------------------
1 | -- Add fileds needed in contest board frozen feature
2 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
3 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
4 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
5 |
6 | ALTER TABLE `uestcoj`.`contest`
7 | ADD COLUMN `frozenTime` INT(11) NOT NULL DEFAULT 0 AFTER `parentId` ;
8 |
9 | SET SQL_MODE=@OLD_SQL_MODE;
10 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
11 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
12 |
13 |
--------------------------------------------------------------------------------
/trunk/src/main/sql/patches/9.sql:
--------------------------------------------------------------------------------
1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
4 |
5 | ALTER TABLE `uestcoj`.`problem` ADD COLUMN `type` INT NOT NULL DEFAULT 0 AFTER `difficulty` ;
--------------------------------------------------------------------------------
/trunk/src/main/webapp/.gitignore:
--------------------------------------------------------------------------------
1 | /temp
2 | /images/user/
3 |
--------------------------------------------------------------------------------
/trunk/src/main/webapp/WEB-INF/.gitignore:
--------------------------------------------------------------------------------
1 | data
2 |
--------------------------------------------------------------------------------
/trunk/src/main/webapp/WEB-INF/html/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/trunk/src/test/java/cn/edu/uestc/acmicpc/config/IntegrationTestContext.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.config;
2 |
3 | import cn.edu.uestc.acmicpc.judge.JudgeService;
4 | import javax.servlet.http.HttpServletRequest;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.ComponentScan;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.context.annotation.PropertySource;
9 | import org.springframework.transaction.annotation.EnableTransactionManagement;
10 |
11 | /**
12 | * Integration test context configurations.
13 | */
14 | @Configuration
15 | @ComponentScan(basePackages = {
16 | "cn.edu.uestc.acmicpc.db",
17 | "cn.edu.uestc.acmicpc.judge",
18 | "cn.edu.uestc.acmicpc.util",
19 | "cn.edu.uestc.acmicpc.service"
20 | })
21 | @PropertySource("classpath:resources.properties")
22 | @EnableTransactionManagement
23 | public class IntegrationTestContext extends ApplicationContextConfig {
24 |
25 | @Bean(name = "judgeService")
26 | @Override
27 | public JudgeService judgeService() {
28 | return null;
29 | }
30 |
31 | @Bean(name = "httpServletRequest")
32 | public HttpServletRequest httpServletRequest() {
33 | return null;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/trunk/src/test/java/cn/edu/uestc/acmicpc/db/dto/DtoTest.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.db.dto;
2 |
3 | import static com.google.common.truth.Truth.assertThat;
4 |
5 | import cn.edu.uestc.acmicpc.db.dto.impl.ArticleDto;
6 | import org.testng.annotations.Test;
7 |
8 | /**
9 | * Test for generated dtos
10 | */
11 | public class DtoTest {
12 |
13 | @Test
14 | public void testToString() {
15 | ArticleDto articleDto = ArticleDto.builder()
16 | .setArticleId(1).setClicked(0).setContent("\"Test<>;;;;{{}{}{}").setTitle("Test").build();
17 | assertThat(articleDto.toString()).isEqualTo(
18 | "{\"articleId\":1,\"clicked\":0,\"content\":\"\\\"Test<>;;;;{{}{}{}\",\"title\":\"Test\"}");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/trunk/src/test/java/cn/edu/uestc/acmicpc/web/oj/controller/IndexControllerTest.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.oj.controller;
2 |
3 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
4 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
5 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
6 |
7 | import cn.edu.uestc.acmicpc.testing.ControllerTest;
8 | import cn.edu.uestc.acmicpc.web.oj.controller.index.IndexController;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.testng.annotations.BeforeMethod;
11 | import org.testng.annotations.Test;
12 |
13 | /**
14 | * Test cases for {@link IndexController}.
15 | */
16 | public class IndexControllerTest extends ControllerTest {
17 |
18 | @Autowired private IndexController indexController;
19 |
20 | @Override
21 | @BeforeMethod
22 | public void init() {
23 | super.init();
24 | mockMvc = initControllers(indexController);
25 | }
26 |
27 | @Test
28 | public void testVisitIndex() throws Exception {
29 | mockMvc.perform(get("/"))
30 | .andExpect(status().isOk())
31 | .andExpect(view().name("index"));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/trunk/src/test/java/cn/edu/uestc/acmicpc/web/oj/controller/ProblemControllerTest.java:
--------------------------------------------------------------------------------
1 | package cn.edu.uestc.acmicpc.web.oj.controller;
2 |
3 | import cn.edu.uestc.acmicpc.testing.ControllerTest;
4 | import cn.edu.uestc.acmicpc.web.oj.controller.problem.ProblemController;
5 | import java.util.UUID;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.mock.web.MockHttpSession;
8 | import org.testng.annotations.BeforeMethod;
9 |
10 | /**
11 | * Mock test for {@link ProblemController}.
12 | */
13 | public class ProblemControllerTest extends ControllerTest {
14 |
15 | @Autowired private ProblemController problemController;
16 |
17 | @Override
18 | @BeforeMethod
19 | public void init() {
20 | super.init();
21 | mockMvc = initControllers(problemController);
22 | session = new MockHttpSession(context.getServletContext(), UUID.randomUUID().toString());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/trunk/src/test/resources/.gitignore:
--------------------------------------------------------------------------------
1 | resources.properties
2 |
--------------------------------------------------------------------------------
/trunk/src/test/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.appender.stderr=cn.edu.uestc.acmicpc.util.log.ANSIConsoleAppender
2 | log4j.appender.stderr.Target=System.err
3 | log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
4 | log4j.appender.stderr.layout.ConversionPattern=[%t] %-5p %l %x - %m%n
5 |
6 | log4j.appender.fileout=org.apache.log4j.RollingFileAppender
7 | log4j.appender.fileout.File=build/testing.log
8 | log4j.appender.fileout.MaxFileSize=10240KB
9 | log4j.appender.fileout.MaxBackupIndex=10
10 | log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
11 | log4j.appender.fileout.layout.ConversionPattern=[%t] %-5p %l %x - %m%n
12 |
13 | log4j.rootCategory=WARN, fileout
14 |
15 | log4j.logger.cn.edu.uestc.acmicpc.service=DEBUG, stderr
16 | log4j.logger.cn.edu.uestc.acmicpc.web=DEBUG, stderr
17 | log4j.logger.cn.edu.uestc.acmicpc.config=DEBUG, stderr
18 | log4j.logger.cn.edu.uestc.acmicpc.db=DEBUG, stderr
19 | log4j.logger.cn.edu.uestc.acmicpc.judge=DEBUG, stderr
20 |
--------------------------------------------------------------------------------
/trunk/src/test/resources/resources.properties.template:
--------------------------------------------------------------------------------
1 | hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
2 | hibernate.show_sql=false
3 | hibernate.format_sql=false
4 | hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
5 |
6 |
--------------------------------------------------------------------------------
/trunk/static/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /.idea
3 | /.gradle
4 | *.xmi
5 | /temp
6 | /bower_components
7 | /dist
8 | /build/
9 | package-lock.json
10 |
--------------------------------------------------------------------------------
/trunk/static/README.md:
--------------------------------------------------------------------------------
1 | #CDOJ-UI
2 |
3 | fuck
4 |
--------------------------------------------------------------------------------
/trunk/static/build.gradle:
--------------------------------------------------------------------------------
1 | // NodeJS plugin
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.moowork.gradle:gradle-node-plugin:0.8'
8 | }
9 | }
10 | apply plugin: 'com.moowork.node'
11 |
12 | // Grunt plugin
13 | buildscript {
14 | repositories {
15 | jcenter()
16 | }
17 | dependencies {
18 | classpath 'com.moowork.gradle:gradle-grunt-plugin:0.6'
19 | }
20 | }
21 | apply plugin: 'grunt'
22 |
23 | task build {
24 | doLast{
25 | nodeSetup.execute()
26 | installGrunt.setArgs(['install', 'grunt-cli@1.1.0', 'grunt@~0.4.2'])
27 | installGrunt.execute()
28 | npmInstall.execute()
29 | grunt_build.execute()
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/trunk/static/font/all/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/all/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/trunk/static/font/all/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/all/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/trunk/static/font/all/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/all/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSans-Italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSans-Italic.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSans-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSans-Light.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSans-Semibold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSans-Semibold.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSans-SemiboldItalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSans-SemiboldItalic.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSans.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSans.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/OpenSansLight-Italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/OpenSansLight-Italic.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/SourceCodePro-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/SourceCodePro-Regular.woff
--------------------------------------------------------------------------------
/trunk/static/font/other/SourceCodePro-Semibold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/other/SourceCodePro-Semibold.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSans-Italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSans-Italic.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSans-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSans-Light.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSans-Semibold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSans-Semibold.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSans-SemiboldItalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSans-SemiboldItalic.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSans.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSans.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/OpenSansLight-Italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/OpenSansLight-Italic.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/SourceCodePro-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/SourceCodePro-Regular.woff
--------------------------------------------------------------------------------
/trunk/static/font/windows/SourceCodePro-Semibold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/font/windows/SourceCodePro-Semibold.woff
--------------------------------------------------------------------------------
/trunk/static/images/.gitignore:
--------------------------------------------------------------------------------
1 | problem/
2 | article/
3 | contest/
4 | training/
5 |
--------------------------------------------------------------------------------
/trunk/static/images/browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/browser.png
--------------------------------------------------------------------------------
/trunk/static/images/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/trunk/static/images/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/glyphicons-halflings.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/banner.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/banner.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/banner.xcf
--------------------------------------------------------------------------------
/trunk/static/images/logo/favicon.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/favicon.xcf
--------------------------------------------------------------------------------
/trunk/static/images/logo/favicon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/favicon128.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/favicon256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/favicon256.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/favicon512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/favicon512.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/favicon64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/favicon64.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/logo.png
--------------------------------------------------------------------------------
/trunk/static/images/logo/logo.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UESTC-ACM/CDOJ/d2e786b83ad23399e8a064e228fc98f2809df1c2/trunk/static/images/logo/logo.xcf
--------------------------------------------------------------------------------
/trunk/static/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cdoj-UI",
3 | "version": "1.0.0",
4 | "description": "Styles and js for cdoj",
5 | "main": "Gruntfile.coffee",
6 | "scripts": {
7 | "postinstall": "./node_modules/.bin/bower install"
8 | },
9 | "repository": "",
10 | "author": "mzry1992",
11 | "license": "BSD",
12 | "devDependencies": {
13 | "bower": "*",
14 | "grunt": "^0.4.5",
15 | "grunt-cmd-concat": "~0.2.8",
16 | "grunt-coffeelint": "~0.0.16",
17 | "grunt-contrib-coffee": "~1.0.0",
18 | "grunt-contrib-concat": "~1.0.1",
19 | "grunt-contrib-less": "~1.4.1",
20 | "grunt-contrib-watch": "~1.0.0",
21 | "grunt-yui-compressor": "~0.4.0"
22 | },
23 | "dependencies": {
24 | "grunt-cli": "^1.1.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/cdoj.coffee:
--------------------------------------------------------------------------------
1 | _.mixin(_.str.exports())
2 |
3 | cdoj = angular.module('cdoj', [
4 | "ui.bootstrap"
5 | "ngRoute"
6 | "ngCookies"
7 | "monospaced.elastic"
8 | "toggle-switch"
9 | "ui.sortable"
10 | "pasvaz.bindonce"
11 | ])
12 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/config/IECacheConfig.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .config([
3 | "$httpProvider",
4 | ($httpProvider) ->
5 | #initialize get if not there
6 | if (!$httpProvider.defaults.headers.get)
7 | $httpProvider.defaults.headers.get = {}
8 | #disable IE ajax request caching
9 | $httpProvider.defaults.headers.get["Cache-Control"] = "no-cache"
10 | $httpProvider.defaults.headers.get["Pragma"] = "no-cache"
11 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/config/RouteConfig.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .config([
3 | "$routeProvider",
4 | ($routeProvider) ->
5 | $routeProvider.when("/",
6 | templateUrl: "template/index/index.html"
7 | controller: "IndexController"
8 | ).when("/status/list",
9 | templateUrl: "template/status/list.html"
10 | controller: "StatusListController"
11 | ).when("/article/show/:articleId",
12 | templateUrl: "template/article/show.html"
13 | controller: "ArticleShowController"
14 | ).when("/article/editor/:userName/:action",
15 | templateUrl: "template/article/editor.html"
16 | controller: "ArticleEditorController"
17 | ).when("/admin/dashboard",
18 | templateUrl: "template/admin/dashboard.html"
19 | controller: "AdminDashboardController"
20 | ).when("/404/",
21 | templateUrl: "template/index/404.html"
22 | ).when("/error/:message",
23 | templateUrl: "template/index/error.html"
24 | controller: "ErrorController"
25 | ).otherwise(
26 | redirectTo: "/404/"
27 | )
28 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/AddContestModalController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("AddContestModalController", [
3 | "$scope", "$rootScope", "$modalInstance", "$window"
4 | ($scope, $rootScope, $modalInstance, $window) ->
5 | $scope.$on("$routeChangeStart", ->
6 | $modalInstance.close()
7 | )
8 | $scope.$on("contestUploader:complete", (e, contestId) ->
9 | $window.location.href = "/#/contest/show/#{contestId}"
10 | )
11 | $scope.$on("$routeChangeStart", ->
12 | $modalInstance.dismiss()
13 | )
14 | ])
15 | cdoj
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/ArticleShowController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("ArticleShowController", [
3 | "$scope", "$rootScope", "$routeParams", "$http", "$window"
4 | ($scope, $rootScope, $routeParams, $http, $window) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 |
11 | $scope.article =
12 | content: ""
13 | title: ""
14 |
15 | articleId = angular.copy($routeParams.articleId)
16 | $http.get("/article/data/#{articleId}").success((data) ->
17 | if data.result == "success"
18 | $scope.article = data.article
19 | $rootScope.title = $scope.article.title
20 | $scope.article.content =
21 | $scope.article.content.replace("!!!more!!!", "")
22 | else
23 | $window.alert data.error_msg
24 | ).error(->
25 | $window.alert "Network error, please refresh page manually."
26 | )
27 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/CodeModalController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("CodeModalController", [
3 | "$scope", "$http", "$modalInstance", "statusId"
4 | ($scope, $http, $modalInstance, statusId) ->
5 | $scope.code = "Loading..."
6 | $http.post("/status/info/#{statusId}").success((data) ->
7 | compileInfo = ""
8 | if data.result == "success"
9 | compileInfo = data.compileInfo
10 | else
11 | compileInfo = data.error_msg
12 | code = ""
13 | if data.result == "success"
14 | code = data.code
15 | else
16 | code = data.error_msg
17 | $scope.code = code
18 | ).error(->
19 | $scope.code = "Network error."
20 | )
21 | $scope.$on("$routeChangeStart", ->
22 | $modalInstance.dismiss()
23 | )
24 | ])
25 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/CompileInfoModalController.coffee:
--------------------------------------------------------------------------------
1 | cdoj.controller("CompileInfoModalController", [
2 | "$scope", "$http", "$modalInstance", "statusId"
3 | ($scope, $http, $modalInstance, statusId) ->
4 | $scope.compileInfo = "Loading..."
5 | $http.post("/status/info/#{statusId}").success((data) ->
6 | compileInfo = ""
7 | if data.result == "success"
8 | compileInfo = data.compileInfo
9 | else
10 | compileInfo = data.error_msg
11 | $scope.compileInfo = compileInfo
12 | ).error(->
13 | $scope.compileInfo = "Network error."
14 | )
15 | $scope.$on("$routeChangeStart", ->
16 | $modalInstance.dismiss()
17 | )
18 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/ErrorController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("ErrorController", [
3 | "$routeParams", "$scope"
4 | ($routeParams, $scope) ->
5 | $scope.message = $routeParams.message
6 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/PasswordResetController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("PasswordResetController", [
3 | "$scope", "$http", "$window", "$routeParams", "$rootScope"
4 | ($scope, $http, $window, $routeParams, $rootScope) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 |
11 | $scope.userActivateDTO =
12 | userName: $routeParams.userName
13 | serialKey: $routeParams.serialKey
14 | password: ""
15 | passwordRepeat: ""
16 | $scope.filedInfo = []
17 | $scope.submit = ->
18 | userActivateDTO = angular.copy($scope.userActivateDTO)
19 | password =
20 | CryptoJS.SHA1(userActivateDTO.password).toString()
21 | userActivateDTO.password = password
22 | passwordRepeat =
23 | CryptoJS.SHA1(userActivateDTO.passwordRepeat).toString()
24 | userActivateDTO.passwordRepeat = passwordRepeat
25 | $http.post("/user/resetPassword", userActivateDTO).success((data) ->
26 | if data.result == "success"
27 | $window.alert("Success, please login manually!")
28 | $window.location.href = "/"
29 | else if data.result == "field_error"
30 | $scope.fieldInfo = data.field
31 | else
32 | $window.alert data.error_msg
33 | ).error(->
34 | $window.alert "Network error."
35 | )
36 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/StatusListController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("StatusListController", [
3 | "$scope", "$rootScope", "$window"
4 | ($scope, $rootScope, $window) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 | $scope.refresh = ->
11 | $scope.$broadcast("list:refresh:status")
12 | $scope.resetStatusCondition = ->
13 | $scope.$broadcast("list:reset:status")
14 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/SubmitModalController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("SubmitModalController", [
3 | "$scope", "$rootScope", "$window", "$http", "$modalInstance", "submitDTO",
4 | "title"
5 | ($scope, $rootScope, $window, $http, $modalInstance, submitDTO,
6 | title) ->
7 | $scope.submitDTO = submitDTO
8 | $scope.title = title
9 |
10 | $scope.submit = ->
11 | submitDTO = angular.copy($scope.submitDTO)
12 | if angular.isUndefined submitDTO.codeContent then return
13 | if $rootScope.hasLogin == false
14 | $window.alert "Please login first!"
15 | $modalInstance.dismiss("close")
16 | else
17 | $http.post("/status/submit", submitDTO).success((data) ->
18 | if data.result == "success"
19 | $modalInstance.close("success")
20 | else if data.result == "field_error"
21 | $scope.fieldInfo = data.field
22 | else
23 | $window.alert data.error_msg
24 | ).error(->
25 | $window.alert "Network error."
26 | )
27 | $scope.close = ->
28 | $modalInstance.dismiss("close")
29 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/contest/ContestPasswordModalController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("ContestPasswordModalController", [
3 | "$scope", "$rootScope", "$window", "$modalInstance", "contest", "$http"
4 | ($scope, $rootScope, $window, $modalInstance, contest, $http) ->
5 | $scope.contest = contest
6 | $scope.fieldInfo = []
7 |
8 | $scope.enter = ->
9 | contestLoginDTO =
10 | contestId: contest.contestId
11 | password: CryptoJS.SHA1(contest.password).toString()
12 | $http.post(
13 | "/contest/loginContest"
14 | contestLoginDTO
15 | ).success((data) ->
16 | if data.result == "success"
17 | # Success!
18 | $modalInstance.close()
19 | $window.location.href = "/#/contest/show/" + contest.contestId
20 | else if data.result == "field_error"
21 | $scope.fieldInfo = data.field
22 | else
23 | $window.alert data.error_msg
24 | ).error(-> $window.alert "Network error!")
25 | $scope.cancel = ->
26 | $modalInstance.dismiss()
27 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/problem/ProblemListController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("ProblemListController", [
3 | "$scope", "$rootScope", "$window"
4 | ($scope, $rootScope, $window) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 | $rootScope.title = "Problem list"
11 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/problem/ProblemShowController.coffee:
--------------------------------------------------------------------------------
1 | cdoj.controller("ProblemShowController", [
2 | "$scope", "$rootScope", "$window", "$modal", "problem"
3 | ($scope, $rootScope, $window, $modal, problem) ->
4 | $scope.$emit(
5 | "permission:setPermission"
6 | $rootScope.AuthenticationType.NOOP
7 | )
8 | $window.scrollTo(0, 0)
9 |
10 | $scope.problem = problem
11 |
12 | $scope.openSubmitModal = ->
13 | $modal.open(
14 | templateUrl: "template/modal/submit-modal.html"
15 | controller: "SubmitModalController"
16 | resolve:
17 | submitDTO: ->
18 | codeContent: ""
19 | problemId: $scope.problem.problemId
20 | contestId: null
21 | languageId: 2 #default C++
22 | title: ->
23 | "#{$scope.problem.title}"
24 | ).result.then (result) ->
25 | if result == "success"
26 | $window.location.href = "/#/status/list?problemId=" +
27 | $scope.problem.problemId
28 | $scope.gotoStatusList = ->
29 | # TODO
30 | $window.location.href = "/#/status/list?problemId=" +
31 | $scope.problem.problemId
32 | ])
33 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/training/TrainingContestShowController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("TrainingContestShowController", [
3 | "$scope", "$http", "trainingContestData"
4 | ($scope, $http, trainingContestData) ->
5 |
6 | $scope.trainingContestDto = trainingContestData.trainingContestDto
7 | $scope.rankList = trainingContestData.rankList
8 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/training/TrainingEditorController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("TrainingEditorController", [
3 | "$scope", "$http", "$rootScope", "$window", "trainingDto"
4 | ($scope, $http, $rootScope, $window, trainingDto) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.ADMIN
8 | )
9 | $window.scrollTo(0, 0)
10 |
11 | $scope.trainingDto = trainingDto
12 | $scope.fieldInfo = []
13 | $scope.action = trainingDto.action
14 |
15 | if $scope.action != "new"
16 | $scope.title = "Edit training " + $scope.action
17 | else
18 | $scope.title = "New training"
19 |
20 | $scope.submit = ->
21 | trainingEditDto = angular.copy($scope.trainingDto)
22 |
23 | $http.post("/training/edit",
24 | action: angular.copy($scope.action)
25 | trainingEditDto: trainingEditDto
26 | ).success((data) ->
27 | if data.result == "success"
28 | $window.location.href = "/#/training/show/#{data.trainingId}"
29 | else if data.result == "field_error"
30 | $scope.fieldInfo = data.field
31 | else
32 | $window.alert data.error_msg
33 | ).error(->
34 | $window.alert "Network error."
35 | )
36 |
37 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/training/TrainingListController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("TrainingListController", [
3 | "$scope", "$rootScope", "$window"
4 | ($scope, $rootScope, $window) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 | $rootScope.title = "Training list"
11 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/controller/user/UserListController.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .controller("UserListController", [
3 | "$scope", "$rootScope", "$window"
4 | ($scope, $rootScope, $window) ->
5 | $scope.$emit(
6 | "permission:setPermission"
7 | $rootScope.AuthenticationType.NOOP
8 | )
9 | $window.scrollTo(0, 0)
10 | $rootScope.title = "User list"
11 | $scope.resetStatusCondition = ->
12 | $scope.$broadcast("list:reset:user")
13 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ActiveLink.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("activeLink", [
3 | "$location"
4 | ($location) ->
5 | restrict: "A"
6 | link: ($scope, $element, $attr) ->
7 | position = $attr.activeLink
8 | $scope.location = $location
9 | $scope.$watch("location.path()", (newPath) ->
10 | currentPosition = newPath.split("/")[1]
11 | currentPosition = "" if angular.isUndefined(currentPosition)
12 | if currentPosition == position
13 | $element.addClass("active")
14 | else
15 | $element.removeClass("active")
16 | )
17 | ])
18 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ArticleItem.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("articleItem",
3 | ->
4 | restrict: "E"
5 | scope:
6 | article: "="
7 | templateUrl: "template/article/article-summary.html"
8 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/AutoFillSync.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("autoFillSync", [
3 | "$timeout",
4 | ($timeout) ->
5 | require: "ngModel"
6 | link: ($scope, $elem, $attrs, $ngModel) ->
7 | $timeout(->
8 | newVal = $elem.val()
9 | if ($ngModel.$pristine)
10 | $ngModel.$setViewValue(newVal)
11 | , 500)
12 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Avatar.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiAvatar",
3 | ->
4 | restrict: "A"
5 | scope:
6 | email: "="
7 | rating: "@"
8 | image: "@"
9 | size: "@"
10 | controller: [
11 | "$scope", "$element",
12 | ($scope, $element) ->
13 | $scope.$watch(
14 | "email"
15 | ->
16 | if (
17 | angular.isUndefined($scope.email) ||
18 | $scope.email == null ||
19 | $scope.email == ""
20 | ) then return
21 | $scope.size = $($element).width() if $scope.size == undefined
22 | $scope.image = "retro" if $scope.image == undefined
23 | $scope.rating = "pg" if $scope.rating == undefined
24 | url = "http://www.gravatar.com/avatar/" +
25 | CryptoJS.MD5($scope.email).toString() + ".jpg?" +
26 | (if $scope.size then "s=" + $scope.size + "&" else "") +
27 | (if $scope.rating then "r=" + $scope.rating + "&" else "") +
28 | (
29 | if $scope.image
30 | "d=" + encodeURIComponent($scope.image)
31 | else
32 | ""
33 | )
34 | $element.attr("src", url)
35 | )
36 | ]
37 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Code.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiCode",
3 | ->
4 | restrict: "E"
5 | scope:
6 | code: "="
7 | link: ($scope, $element) ->
8 | $scope.$watch("code", ->
9 | result = prettyPrintOne($scope.code.trim().escapeHTML())
10 | $($element).empty().append(result)
11 | )
12 | template: """
13 |
14 | """
15 | replace: true
16 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/CodeHref.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiCodeHref",
3 | ->
4 | restrict: "A"
5 | scope:
6 | status: "="
7 | alwaysShowHref: "@"
8 | controller: [
9 | "$scope", "$rootScope", "$http", "$modal"
10 | ($scope, $rootScope, $http, $modal) ->
11 | $scope.showHref = false
12 | checkShowHref = ->
13 | if $scope.alwaysShowHref
14 | $scope.showHref = true
15 | else if (
16 | $rootScope.hasLogin && (
17 | $rootScope.currentUser.type == 1 ||
18 | $rootScope.currentUser.userName == $scope.status.userName
19 | )
20 | )
21 | $scope.showHref = true
22 | else
23 | $scope.showHref = false
24 | checkShowHref()
25 | $scope.$on("currentUser:changed", ->
26 | checkShowHref()
27 | )
28 | $scope.showCode = ->
29 | statusId = $scope.status.statusId
30 | $modal.open(
31 | templateUrl: "template/modal/code-modal.html"
32 | controller: "CodeModalController"
33 | size: "lg"
34 | resolve:
35 | statusId: ->
36 | statusId
37 | )
38 | ]
39 | template: """
40 | {{status.length}} B
43 | {{status.length}} B
44 | """
45 | )
46 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ContestAdminSpan.coffee:
--------------------------------------------------------------------------------
1 | cdoj.directive("uiContestAdminSpan",
2 | ->
3 | restrict: "A"
4 | scope:
5 | contestId: "="
6 | isVisible: "="
7 | controller: [
8 | "$scope", "$http", "$window"
9 | ($scope, $http, $window) ->
10 | $scope.editVisible = ->
11 | queryString = "/contest/operator/" + $scope.contestId + "/isVisible/" +
12 | (!$scope.isVisible)
13 | $http.post(queryString).success((data) ->
14 | if data.result == "success"
15 | $scope.isVisible = !$scope.isVisible
16 | else
17 | $window.alert data.error_msg
18 | ).error(->
19 | $window.alert "Network error."
20 | )
21 | ]
22 | template: """
23 |
42 | """
43 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ContestProblemHref.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiContestProblemHref"
3 | ->
4 | restrict: "E"
5 | scope:
6 | problemId: "="
7 | problemList: "="
8 | controller: [
9 | "$scope"
10 | ($scope) ->
11 | $scope.order = -1
12 | $scope.orderCharacter = "-"
13 | $scope.$watch("problemId + problemList", ->
14 | target = _.findWhere(
15 | $scope.problemList
16 | "problemId": $scope.problemId
17 | )
18 | if target != undefined
19 | $scope.orderCharacter = target.orderCharacter
20 | $scope.order = target.order
21 | )
22 | $scope.select = ->
23 | if $scope.order != -1
24 | $scope.$emit("contestShow:showProblemTab", $scope.order)
25 | ]
26 | template: """
27 |
28 | """
29 | replace: true
30 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ContestUploader.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiContestUploader", [
3 | "$window"
4 | ($window) ->
5 | restrict: "E"
6 | replace: true
7 | link: ($scope, $element) ->
8 | contestUploader = new qq.FineUploaderBasic(
9 | button: $($element)[0]
10 | request:
11 | endpoint: "/contest/createContestByArchiveFile"
12 | inputName: "uploadFile"
13 | validation:
14 | allowedExtensions: ["zip"],
15 | sizeLimit: 100 * 1000 * 1000 # 100 MB
16 | multiple: false
17 | callbacks:
18 | onComplete: (id, fileName, data) ->
19 | if data.success == "true"
20 | $scope.$emit("contestUploader:complete", data.contestId)
21 | else
22 | $window.alert data.error_msg
23 | )
24 | template: """
25 |
26 | """
27 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Datetimepicker.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiDatetimepicker",
3 | ->
4 | restrict: 'A'
5 | require: "ngModel"
6 | link: ($scope, $element, $attrs, $controller) ->
7 | $($element).datetimepicker().on("changeDate", (e) ->
8 | $scope.$apply ->
9 | # Date time picker use UTC locale, we need convert it manually.
10 | time = e.date.valueOf() - 8 * 60 * 60 * 1000
11 | $controller.$setViewValue time
12 | )
13 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/DropdownMenu.coffee:
--------------------------------------------------------------------------------
1 | # Prevent close dropdown menu when click form input
2 | cdoj
3 | .directive("uiDropdownMenu",
4 | ->
5 | restrict: "A"
6 | link: ($scope, $element) ->
7 | $element.find("form").on("click", (e) ->
8 | e.stopPropagation()
9 | )
10 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Equals.coffee:
--------------------------------------------------------------------------------
1 | cdoj.directive("equals",
2 | ->
3 | restrict: "A"
4 | require: "?ngModel"
5 | link: ($scope, $element, $attrs, $ngModel) ->
6 | if angular.isUndefined $ngModel then return
7 | # watch own value and re-validate on change
8 | $scope.$watch($attrs.ngModel, ->
9 | validate())
10 |
11 | # observe the other value and re-validate on change
12 | $attrs.$observe("equals", ->
13 | validate())
14 |
15 | validate = ->
16 | val1 = angular.copy($ngModel.$viewValue)
17 | val2 = angular.copy($attrs.equals)
18 |
19 | val2 = "" if angular.isUndefined val2
20 | val1 = "" if angular.isUndefined val1
21 | # set validity
22 | $ngModel.$setValidity("equals", val1 == val2)
23 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/List.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("list",
3 | ->
4 | restrict: "EA"
5 | replace: true
6 | transclude: true
7 | scope:
8 | condition: "="
9 | requestUrl: "@"
10 | name: "@"
11 | controller: "ListController"
12 | template: """
13 |
14 |
15 |
25 |
26 |
27 |
28 | """
29 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Markdown.coffee:
--------------------------------------------------------------------------------
1 | MathJax.Hub.Config(
2 | tex2jax:
3 | inlineMath: [
4 | [ '$', '$' ],
5 | [ '\\[', '\\]' ]
6 | ]
7 | )
8 |
9 | cdoj
10 | .directive("markdown",
11 | ->
12 | restrict: "EA"
13 | scope:
14 | content: "="
15 | link: ($scope, $element) ->
16 | if angular.isDefined $scope.content
17 | $scope.$watch("content",
18 | ->
19 | content = angular.copy($scope.content)
20 | # replace
21 | content =
22 | content.replace /@([a-zA-Z0-9_]{4,24})\s/g, "[@$1](/#/user/center/$1)"
23 | content = marked(content)
24 | $element.empty().append(content)
25 | MathJax.Hub.Queue(["Typeset", MathJax.Hub, $element[0]])
26 | $($element).find("pre").each (id, el) ->
27 | $el = $(el)
28 | if $el.attr("type") != "no-prettify"
29 | text = prettyPrintOne($el[0].innerText.escapeHTML())
30 | $el.empty().append(text)
31 | , true)
32 | template: """
33 |
34 | """
35 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Message.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("messagelink",
3 | ->
4 | restrict: "EA"
5 | scope:
6 | message: "="
7 | replace: true
8 | controller: [
9 | "$scope", "$modal", "$rootScope"
10 | ($scope, $modal, $rootScope) ->
11 | $scope.readMessage = ->
12 | $rootScope.$broadcast("list:refresh:message")
13 | $rootScope.$broadcast("data:refresh")
14 | $modal.open(
15 | templateUrl: "template/modal/message-modal.html"
16 | controller: "MessageModalController"
17 | resolve:
18 | message: ->
19 | $scope.message
20 | )
21 | ]
22 | template: """
23 |
26 | """
27 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/OnsiteUserFileUploader.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiOnsiteUserFileUploader", [
3 | "$window"
4 | ($window) ->
5 | restrict: "E"
6 | replace: true
7 | link: ($scope, $element) ->
8 | $scope.label = "Load from CSV file"
9 | onsiteUserFileUploader = new qq.FineUploaderBasic(
10 | button: $($element)[0]
11 | request:
12 | endpoint: "/contest/uploadOnsiteUserFile"
13 | inputName: "uploadFile"
14 | validation:
15 | allowedExtensions: ["csv", "txt"],
16 | sizeLimit: 10 * 1000 * 1000 # 10 MB
17 | multiple: false
18 | callbacks:
19 | onSubmit: ->
20 | $scope.$apply(->
21 | $scope.label = "Uploading..."
22 | )
23 | onComplete: (id, fileName, data) ->
24 | if data.success == "true"
25 | $scope.$apply(->
26 | $scope.$emit("onsiteUserFileUploader:complete", data.list)
27 | $scope.label = "Load from CSV file"
28 | )
29 | onError: (id, fileName, errorReason) ->
30 | $window.alert errorReason
31 | )
32 | template: """
33 |
34 | """
35 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Penalty.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiPenalty",
3 | ->
4 | restrict: "A"
5 | scope:
6 | penalty: "="
7 | controller: ["$scope",
8 | ($scope) ->
9 | $scope.timeString = ""
10 | $scope.$watch("penalty", ->
11 | penalty = $scope.penalty
12 | length = parseInt(penalty)
13 | second = length % 60
14 | length = (length - second) / 60
15 |
16 | minute = length % 60
17 | length = (length - minute) / 60
18 |
19 | hours = length
20 | $scope.timeString = _.sprintf("%d:%02d:%02d", hours, minute, second)
21 | )
22 | ]
23 | template: """
24 | {{timeString}}
25 | """
26 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Problem.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("problem",
3 | ->
4 | restrict: "E"
5 | replace: true
6 | transclude: true
7 | scope:
8 | problem: "="
9 | link: ($scope) ->
10 | $scope.$watch("problem",
11 | ->
12 | _sampleInput = $scope.problem.sampleInput
13 | try
14 | _sampleInput = JSON.parse _sampleInput
15 |
16 | if _sampleInput not instanceof Array
17 | _sampleInput = [_sampleInput]
18 |
19 | _sampleOutput = $scope.problem.sampleOutput
20 | try
21 | _sampleOutput = JSON.parse _sampleOutput
22 |
23 | if _sampleOutput not instanceof Array
24 | _sampleOutput = [_sampleOutput]
25 |
26 | if _sampleInput.length != _sampleOutput.length
27 | alert "Sample input has not same number of cases with sample output!"
28 | else
29 | $scope.samples = _.map(
30 | _.zip(_sampleInput, _sampleOutput)
31 | (sample) ->
32 | input: sample[0].toString()
33 | output: sample[1].toString()
34 | )
35 | , true)
36 | templateUrl: "template/problem/problem.html"
37 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/Readmore.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiReadmore",
3 | ->
4 | restrict: "A"
5 | scope:
6 | hasMore: "="
7 | articleId: "="
8 | link: ($scope, $element) ->
9 | if $scope.hasMore
10 | $element.empty().append(
11 | "Read more >>"
12 | )
13 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/RejudgeButton.coffee:
--------------------------------------------------------------------------------
1 | cdoj.directive(
2 | "uiRejudgeButton"
3 | ->
4 | restrict: "A"
5 | scope:
6 | condition: "="
7 | controller: [
8 | "$scope", "$rootScope", "$http", "$window"
9 | ($scope, $rootScope, $http, $window) ->
10 | $scope.rejudge = ->
11 | $http.post(
12 | "/status/rejudgeStatusCount"
13 | $scope.condition
14 | ).success((data) ->
15 | if data.result == "success"
16 | if confirm("Rejudge all #{data.count} records")
17 | $http.post(
18 | "/status/rejudge"
19 | $scope.condition
20 | ).success((data) ->
21 | if data.result == "success"
22 | $window.alert "Done!"
23 | else
24 | $window.alert data.error_msg
25 | ).error(->
26 | $window.alert "Network error."
27 | )
28 | else
29 | $window.alert data.error_msg
30 | ).error(->
31 | $window.alert "Network error."
32 | )
33 | ]
34 | template: """
35 | Rejudge
39 | """
40 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/TimeLength.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiTimeLength",
3 | ->
4 | restrict: "A"
5 | scope:
6 | length: "="
7 | controller: [
8 | "$scope",
9 | ($scope) ->
10 | $scope.timeString = ""
11 | $scope.$watch("length", ->
12 | $scope.showTimeLength()
13 | )
14 | $scope.showTimeLength = ->
15 | length = Math.floor(parseInt($scope.length) / 1000)
16 | second = length % 60
17 | length = (length - second) / 60
18 |
19 | minute = length % 60
20 | length = (length - minute) / 60
21 |
22 | hours = length % 24
23 | length = (length - hours) / 24
24 | days = length
25 | $scope.timeString = ""
26 | if days > 0
27 | $scope.timeString =
28 | $scope.timeString + days +
29 | " #{if days == 1 then "day" else "days"} "
30 | $scope.timeString =
31 | $scope.timeString +
32 | _.sprintf("%d:%02d:%02d", hours, minute, second)
33 | ]
34 | template: """
35 | {{timeString}}
36 | """
37 | )
38 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/TrainingRankList.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiTrainingRankList"
3 | ->
4 | restrict: "E"
5 | scope:
6 | rankList: "="
7 | type: "="
8 | platformType: "="
9 | controller: ["$scope",
10 | ($scope) ->
11 | ]
12 | replace: true
13 | templateUrl: "template/training/trainingRankList.html"
14 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/UserAdminSpan.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiUserAdminSpan",
3 | ->
4 | restrict: "E"
5 | scope:
6 | user: "="
7 | controller: [
8 | "$scope", "$http", "$modal", "$window", "UserProfile",
9 | ($scope, $http, $modal, $window, $userProfile) ->
10 | $scope.showEditor = ->
11 | $userProfile.setProfile $scope.user.userName
12 | $modal.open(
13 | templateUrl: "template/modal/user-admin-modal.html"
14 | controller: "UserAdminModalController"
15 | )
16 | ]
17 | template: """
18 |
30 | """
31 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/directive/ValidateInfo.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .directive("uiValidateInfo",
3 | ->
4 | restrict: "E"
5 | scope:
6 | value: "="
7 | for: "@"
8 | link: ($scope) ->
9 | $scope.isInvalid = false
10 | $scope.message = ""
11 | $scope.$watch(
12 | "value"
13 | ->
14 | v = _.findWhere($scope.value, {field: $scope.for})
15 | if v != undefined
16 | $scope.message = v.defaultMessage
17 | $scope.isInvalid = true
18 | else
19 | $scope.message = ""
20 | $scope.isInvalid = false
21 | )
22 | template: """
23 |
24 | """
25 | )
--------------------------------------------------------------------------------
/trunk/static/src/angular/factory/Error.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .factory("Error", [
3 | "$location"
4 | ($location) ->
5 | error: (message) ->
6 | $location.path("/error/" + message.escapeURL())
7 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/factory/UserProfile.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .factory("UserProfile", [
3 | "$http", "$window", "$rootScope"
4 | ($http, $window, $rootScope) ->
5 | userProfile = 0
6 |
7 | setProfile: (userName) ->
8 | $http.get("/user/profile/#{userName}").success((data) ->
9 | if data.result == "success"
10 | userProfile = data.user
11 | $rootScope.$broadcast("UserProfile:success")
12 | else
13 | $window.alert data.error_msg
14 | )
15 | getProfile: ->
16 | userProfile
17 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/run/CurrentUser.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .run([
3 | "$rootScope"
4 | ($rootScope) ->
5 | $rootScope.hasLogin = false
6 | $rootScope.currentUser =
7 | email: ""
8 | $rootScope.isAdmin = false
9 |
10 | $rootScope.$on("currentUser:login", (e, currentUser) ->
11 | _.extend($rootScope.currentUser, currentUser)
12 | $rootScope.hasLogin = true
13 | $rootScope.$broadcast("currentUser:changed")
14 | )
15 | $rootScope.$on("currentUser:logout", ->
16 | $rootScope.hasLogin = false
17 | $rootScope.currentUser =
18 | email: ""
19 | $rootScope.$broadcast("currentUser:changed")
20 | )
21 | $rootScope.$on("currentUser:changed", ->
22 | $rootScope.$broadcast("currentUser:updated")
23 | )
24 | $rootScope.$on("currentUser:updated", ->
25 | if $rootScope.hasLogin && $rootScope.currentUser.type == 1
26 | $rootScope.isAdmin = true
27 | else
28 | $rootScope.isAdmin = false
29 | # Check permission after current user changed
30 | $rootScope.$broadcast("permission:check")
31 | )
32 | ])
--------------------------------------------------------------------------------
/trunk/static/src/angular/run/Data.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .run([
3 | "$rootScope", "$http", "$timeout", "$window"
4 | ($rootScope, $http, $timeout, $window) ->
5 | _.extend($rootScope, GlobalVariables)
6 | _.extend($rootScope, GlobalConditions)
7 |
8 | $rootScope.finalTitle = "UESTC Online Judge"
9 |
10 | fetchGlobalData = ->
11 | $http.get("/globalData").success((data) ->
12 | _.extend($rootScope, data)
13 | ).error(->
14 | $timeout(fetchGlobalData, 500)
15 | )
16 | fetchData = ->
17 | $http.get("/data").success((data) ->
18 | if data.result == "success"
19 | if $rootScope.hasLogin && data.hasLogin == false
20 | $window.alert "You has been logged out by server."
21 | $rootScope.$broadcast("currentUser:logout")
22 | _.extend($rootScope, data)
23 | $rootScope.$broadcast("currentUser:updated")
24 | $timeout(fetchData, 10000)
25 | ).error(->
26 | $timeout(fetchData, 500)
27 | )
28 |
29 | # Refresh event
30 | $rootScope.$on("globalData:refresh", ->
31 | $timeout(fetchGlobalData, 0)
32 | )
33 | $rootScope.$on("data:refresh", ->
34 | $timeout(fetchData, 0)
35 | )
36 | ])
37 |
--------------------------------------------------------------------------------
/trunk/static/src/angular/run/Refresh.coffee:
--------------------------------------------------------------------------------
1 | cdoj
2 | .run([
3 | "$rootScope"
4 | ($rootScope) ->
5 | $rootScope.$on("all:refresh", ->
6 | $rootScope.$broadcast("data:refresh")
7 | $rootScope.$broadcast("globalData:refresh")
8 | $rootScope.$broadcast("list:refresh")
9 | )
10 |
11 | # Fetch the data at the begining
12 | $rootScope.$broadcast("all:refresh")
13 | ])
14 |
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.article.less:
--------------------------------------------------------------------------------
1 | .cdoj-article {
2 | .cdoj-article-summary {
3 | border-left: 4px solid @cdoj-blue0;
4 | padding-left: 1em;
5 | margin-top: 1em;
6 | }
7 | }
8 |
9 | #article-content {
10 | padding-top: 1em;
11 | margin-top: 1em;
12 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.chart.less:
--------------------------------------------------------------------------------
1 | .axis path,
2 | .axis line {
3 | fill: none;
4 | stroke: #A9A9A9;
5 | shape-rendering: crispEdges;
6 | }
7 |
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.flandre.less:
--------------------------------------------------------------------------------
1 | .flandre-heading {
2 | padding: 2px 15px;
3 | }
4 | .flandre-editor,
5 | .flandre-preview {
6 | &:focus {
7 | outline: none;
8 | }
9 | display: none;
10 | height: auto;
11 | max-height: 500px;
12 | overflow-y: auto;
13 | width: 100%;
14 | padding: 6px 12px;
15 | font-size: 14px;
16 | line-height: 1.428571429;
17 | color: #555;
18 | vertical-align: middle;
19 | background-color: #fff;
20 | background-image: none;
21 | }
22 | .flandre-editor.flandre-show,
23 | .flandre-preview.flandre-show{
24 | display: block;
25 | }
26 | .flandre-editor {
27 | overflow-y:visible;
28 | border-top-left-radius: 0;
29 | border-top-right-radius: 0;
30 | }
31 | .flandre-preview {
32 | p:last-child {
33 | margin-bottom: 0;
34 | }
35 | }
36 | .modal-title {
37 | ul > li > a {
38 | padding: 2px 6px;
39 | }
40 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.form.less:
--------------------------------------------------------------------------------
1 | .cdoj-submit-area {
2 | resize: none;
3 | width: 100%;
4 | height: 390px;
5 | font-family: @cdoj-codefont;
6 | }
7 | .cdoj-input {
8 | background-color: transparent;
9 | border: none;
10 | }
11 | input.ng-invalid {
12 | background-color: @cdoj-red2;
13 | border-color: @cdoj-red0;
14 | }
15 | .validate-info {
16 | color: @cdoj-red0;
17 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.function.less:
--------------------------------------------------------------------------------
1 | .image-size(@size) {
2 | width: @size;
3 | height: @size;
4 | min-height: @size;
5 | min-width: @size;
6 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.layout.less:
--------------------------------------------------------------------------------
1 | #cdoj-layout {
2 | margin-top: @cdoj-navbar-top-height;
3 | }
4 | body {
5 | background-color: @cdoj-background;
6 | }
7 | #cdoj-container {
8 | padding: 0 15px;
9 | }
10 | #cdoj-layout {
11 | padding-left: @cdoj-navbar-width;
12 | }
13 | img {
14 | max-width: 100%;
15 | height: auto;
16 | }
17 | #cdoj-best-solutions {
18 | margin-left: 260px;
19 | }
20 | @media (max-width: @screen-xs-max) {
21 | #cdoj-layout {
22 | padding-left: @cdoj-navbar-width-tiny;
23 | }
24 |
25 | .cdoj-form-menu {
26 | position: fixed;
27 | top: 15px;
28 | right: 15px;
29 | left: 15px;
30 | bottom: 15px;
31 | overflow-y: auto;
32 | }
33 |
34 | body, html {
35 | overflow-x: hidden;
36 | }
37 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.less:
--------------------------------------------------------------------------------
1 | /* Common variable */
2 | @import "cdoj.variable.less";
3 | @import "cdoj.fontface.less";
4 | @import "cdoj.function.less";
5 |
6 | @import "cdoj.user.less";
7 | @import "cdoj.rankList.less";
8 | @import "cdoj.code.less";
9 | @import "cdoj.flandre.less";
10 | @import "cdoj.font.less";
11 | @import "cdoj.navbar.less";
12 | @import "cdoj.form.less";
13 | @import "cdoj.article.less";
14 | @import "cdoj.layout.less";
15 | @import "cdoj.markdown.less";
16 | @import "cdoj.tool.less";
17 | @import "cdoj.list.less";
18 | @import "cdoj.rating.less";
19 | @import "cdoj.chart.less";
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.list.less:
--------------------------------------------------------------------------------
1 | .pagination {
2 | margin: 15px 0 0 0;
3 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.markdown.less:
--------------------------------------------------------------------------------
1 | hr {
2 | border:1px solid #ddd;
3 | }
4 | .cdoj-markdown-table {
5 | width: auto;
6 | margin-left: auto;
7 | margin-right: auto;
8 | }
9 | .cdoj-markdown-img {
10 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.rankList.less:
--------------------------------------------------------------------------------
1 | #rank-list {
2 | td {
3 | border: 2px white solid;
4 | }
5 | td.rank, td.user-name, td.solved, td.penalty {
6 | background-color: @cdoj-blue2;
7 | }
8 | td.my {
9 | background-color: @cdoj-blue0;
10 | color: white;
11 | }
12 | td.rank-list-first-blood {
13 | background-color: @cdoj-green0;
14 | }
15 | td.rank-list-solved {
16 | background-color: @cdoj-green2;
17 | }
18 | td.rank-list-tried {
19 | background-color: @cdoj-red2;
20 | }
21 | td.rank-list-frozen {
22 | background-color: @cdoj-yellow1;
23 | }
24 | tr.rank-foot {
25 |
26 | }
27 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.rating.less:
--------------------------------------------------------------------------------
1 | .rating-red {
2 | color: #EE0000;
3 | }
4 |
5 | .rating-yellow {
6 | color: #DDCC00;
7 | }
8 |
9 | .rating-blue {
10 | color: #6666FF;
11 | }
12 |
13 | .rating-green {
14 | color: #00A900;
15 | }
16 |
17 | .rating-gray {
18 | color: #999999;
19 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.tool.less:
--------------------------------------------------------------------------------
1 | .admin-span {
2 | margin-top: -6px;
3 | margin-left: 15px;
4 | }
5 | .panel-body {
6 | padding: 12px;
7 | }
8 | .no-margin-right {
9 | margin-right: 0;
10 | }
--------------------------------------------------------------------------------
/trunk/static/src/less/cdoj.user.less:
--------------------------------------------------------------------------------
1 | .cdoj-users-avatar {
2 | .image-size(64px)
3 | }
4 | #currentUser {
5 | font-size: 14px;
6 | }
7 | #cdoj-user-avatar-large {
8 | .image-size(190px)
9 | }
10 | #cdoj-user-center-summary {
11 | padding-top: 20px;
12 | }
13 | .cdoj-label {
14 | padding: .2em .6em .3em;
15 | font-weight: bold;
16 | line-height: 1;
17 | width: 3em;
18 | text-align: center;
19 | float: left;
20 | margin: .1em;
21 | a {
22 | color: #ffffff;
23 | }
24 | }
25 | .cdoj-user-status-label {
26 | }
--------------------------------------------------------------------------------
/trunk/static/template/admin/dashboard.html:
--------------------------------------------------------------------------------
1 |
2 |
36 |
--------------------------------------------------------------------------------
/trunk/static/template/article/article-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
9 | Edit
10 |
11 | visited, create by
12 |
13 | , last modified at
14 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/trunk/static/template/article/editor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 's blog
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/trunk/static/template/article/show.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/trunk/static/template/contest/typeAhead.html:
--------------------------------------------------------------------------------
1 |
2 | {{match.model.contestId}} - {{match.model.title}}
3 |
--------------------------------------------------------------------------------
/trunk/static/template/index/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | 404!
4 |
5 |
--------------------------------------------------------------------------------
/trunk/static/template/index/error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{message}}
4 |
5 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/add-contest-modal.html:
--------------------------------------------------------------------------------
1 |
2 | Create new contest
3 |
4 |
5 |
6 |
7 | Create manually
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/code-modal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/compile-info-modal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/contest-password-modal.html:
--------------------------------------------------------------------------------
1 |
2 | Login contest
3 |
4 |
5 |
6 |
7 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/forget-password-modal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Forget password
4 |
5 |
6 |
22 |
23 |
--------------------------------------------------------------------------------
/trunk/static/template/modal/submit-modal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/trunk/static/template/problem/show.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{problem.title}}
7 |
8 |
9 | Edit
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/trunk/static/template/team/typeAhead.html:
--------------------------------------------------------------------------------
1 |
2 | {{match.model.teamName}}
3 |
--------------------------------------------------------------------------------
/trunk/static/template/training/editor.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/trunk/static/template/training/trainingContest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{trainingContestDto.title}}
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/trunk/static/template/training/trainingRatingChart.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/trunk/static/template/user/typeAhead.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/wiki/Tag.wiki:
--------------------------------------------------------------------------------
1 | #labels Phase-Design,Phase-Implementation
2 | = Tags in cdoj.tld =
3 |
4 | == pagination ==
5 | show a simple pagination.
6 |
7 | === usage ===
8 | {{{
9 |
10 | }}}
11 |
12 | === example ===
13 | {{{
14 |
15 |
16 | }}}
17 |
18 | === result ===
19 | It will display a pagination like this:
20 | {{{
21 | ← First | « | {pages} | » | Last →
22 | }}}
23 | and {pages} is:
24 |
25 | *situation 1:* the total pages is small than 3+displayDist*2
26 | {{{
27 | 1 | 2 | --- | total
28 | }}}
29 | *situation 2:* the current pages is small than 2+dispalyDist
30 | {{{
31 | midPage
32 | 1 | midPage-displayDist | --- | ? | 2+displayDist | ? | --- | 2+2*displayDist | ...
33 | }}}
34 | *situation 3:* the current pages is big than total-1-displayDist
35 | {{{
36 | midPage
37 | ...| total-1-2*displayDist | --- | ? | total-1-displayDist | ? | --- | total-1 | total
38 | }}}
39 | *other situations:*
40 | {{{
41 | midPage
42 | ...| current-displayDist | --- | ? | current | ? | --- | current+displayDist | ...
43 | }}}
44 |
--------------------------------------------------------------------------------
/wiki/URLFormat.wiki:
--------------------------------------------------------------------------------
1 | #labels Phase-Design,Phase-Implementation
2 | = URL format standard =
3 |
4 | || *Router address* || Action || ||
5 | || */* || index/indexAction || index page of CDOJ ||
6 | || */index/* || index/indexAction || index page of CDOJ ||
7 | || */problemset/page/* || problem/ProblemListAction || problem list, page 1 ||
8 | || */problemset/page/{page}* || problem/ProblemListAction || problem list, {page} defined the page to show ||
9 | || */problemset/problem/{id}* || problem/ProblemAction || show problem{id} ||
10 | || */problemset/problem/{id}/submit* || problem/ProblemAction || submit problem{id} ||
11 | || */user/register* || user/RegisterAction || register page ||
12 |
13 | == TODO ==
14 | || *Router address* || ||
15 | || */index/{id}* || show articles ||
16 | || */contest/pages/* || contest list, like *problemset/pages/* ||
17 | || */contest/pages/{page}* || contest list, like *problemset/pages/{page}* ||
18 | || */contest/show/{id}* || show contest{id} ||
19 | || */contest/show/{id}/ranklist* || ranklist of contest{id} ||
20 | || */contest/show/{id}/status* || ||
21 | || */contest/show/{id}/problem/{id}* || problem{id} of contest{id} ||
22 | || */contest/show/{id}/problem/{id}/submit/* || ||
23 | || */contest/show/{id}/problem/{id}/status/* || ||
--------------------------------------------------------------------------------