Merge branch 'develop' into dev_linda

This commit is contained in:
Linda 2017-04-24 09:58:41 +08:00
commit b318e0c4e4
146 changed files with 11675 additions and 1468 deletions

288
.idea/bigdate.iml Normal file
View File

@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="CompassSettings">
<option name="compassSupportEnabled" value="true" />
</component>
<component name="FacetManager">
<facet type="RailsFacetType" name="Ruby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</component>
<component name="ModuleRunConfigurationManager">
<configuration default="false" name="test: bigdate" type="RakeRunConfigurationType" factoryName="Rake">
<module name="bigdate" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs>
<env name="RAILS_ENV" value="test" />
</envs>
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="spec: bigdate" type="RakeRunConfigurationType" factoryName="Rake">
<module name="bigdate" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Production: bigdate" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="bigdate" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="127.0.0.1" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Development: bigdate" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="bigdate" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="127.0.0.1" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="gitlab (v3.2.0, E:/bigdate/lib/gitlab-cli) [path][gem]">
<CLASSES>
<root url="file://$MODULE_DIR$/lib/gitlab-cli/bin" />
<root url="file://$MODULE_DIR$/lib/gitlab-cli/lib" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/lib/gitlab-cli/bin" />
<root url="file://$MODULE_DIR$/lib/gitlab-cli/lib" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="grack (v2.0.2, E:/bigdate/lib/grack) [path][gem]">
<CLASSES>
<root url="file://$MODULE_DIR$/lib/grack/bin" />
<root url="file://$MODULE_DIR$/lib/grack/lib" />
<root url="file://$MODULE_DIR$/lib/grack/tests" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/lib/grack/bin" />
<root url="file://$MODULE_DIR$/lib/grack/lib" />
<root url="file://$MODULE_DIR$/lib/grack/tests" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="rails_kindeditor (v0.4.5, E:/bigdate/lib/rails_kindeditor) [path][gem]">
<CLASSES>
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/app" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/lib" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/config" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/vendor" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/screenshots" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/app" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/lib" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/config" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/vendor" />
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/screenshots" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="wechat (v[path], E:/bigdate/lib/wechat) [path][gem]">
<CLASSES>
<root url="file://$MODULE_DIR$/lib/wechat/bin" />
<root url="file://$MODULE_DIR$/lib/wechat/lib" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/lib/wechat/bin" />
<root url="file://$MODULE_DIR$/lib/wechat/lib" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activeresource (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="acts-as-taggable-on (v2.4.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.4.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="arel (v3.0.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="axiom-types (v0.1.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="better_errors (v1.1.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="binding_of_caller (v0.7.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.0.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="carrierwave (v0.10.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="chinese_pinyin (v1.0.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="climate_control (v0.0.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="cocaine (v0.5.7, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coercible (v1.0.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v3.2.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.9.1.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="daemons (v1.2.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="debug_inspector (v0.0.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="delayed_job (v4.0.6, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="delayed_job_active_record (v4.0.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="descendants_tracker (v0.0.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.24, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="elasticsearch (v1.0.14, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="elasticsearch-api (v1.0.14, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="elasticsearch-model (v0.1.8, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="elasticsearch-rails (v0.1.8, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="elasticsearch-transport (v1.0.14, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="equalizer (v0.0.11, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.5.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="factory_girl (v4.5.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="factory_girl_rails (v4.5.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="faraday (v0.9.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="fastercsv (v1.5.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.8, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="grape (v0.9.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="grape-entity (v0.4.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="grape-swagger (v0.10.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="hashie (v3.4.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="hike (v1.2.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="htmlentities (v4.3.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="http-form_data (v1.0.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.13.7, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.11, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="journey (v1.0.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v2.0.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="kaminari (v0.16.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mail (v2.5.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types (v1.25.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_magick (v4.2.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.11.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.3.18, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-ldap (v0.3.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.10.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="paperclip (v3.5.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="polyglot (v0.3.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v1.4.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-accept (v0.4.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-cache (v1.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-mini-profiler (v0.9.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-mount (v0.8.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-openid (v1.4.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-raw-upload (v1.1.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-ssl (v1.3.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v3.2.16, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rdoc (v3.12.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis (v3.2.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis-actionpack (v3.2.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis-activesupport (v3.2.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis-rack (v1.4.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis-rails (v3.2.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="redis-store (v1.1.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rest-client (v1.8.0, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rich (v1.4.6, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.2.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.2.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.2.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-rails (v3.2.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.2.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-ole (v1.2.11.8, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-openid (v2.1.8, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v1.1.7, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.13, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v3.2.6, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="seems_rateable (v1.0.13, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="spreadsheet (v1.0.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets (v2.2.3, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="terminal-table (v1.5.2, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tilt (v1.4.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="treetop (v1.4.15, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.44, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uglifier (v2.7.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.7.1, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="virtus (v1.0.5, ruby-1.9.3-p392) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="win32console (v1.3.2, ruby-1.9.3-p392) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
</module>

30
.idea/dataSources.xml Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" hash="1691105180">
<data-source source="LOCAL" name="Rails bigdate: production" uuid="adee68b8-199d-47ec-bc4e-eaf7d580fa6c">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/test</jdbc-url>
<user-name>root</user-name>
<user-password>dfcbdfc6dfcbdfc4dfc6dfc5dfc4dfcd</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdate: development" uuid="f43a223e-937a-457d-9c1a-d91100b6257b">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/test</jdbc-url>
<user-name>root</user-name>
<user-password>dfcbdfc6dfcbdfc4dfc6dfc5dfc4dfcd</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdate: test" uuid="e85434eb-4b0f-4e83-a8a4-933a0fed85bc">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/test</jdbc-url>
<user-name>root</user-name>
<user-password>dfcbdfc6dfcbdfc4dfc6dfc5dfc4dfcd</user-password>
<libraries />
</data-source>
</component>
</project>

5
.idea/encodings.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="DebuggerStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

55
.idea/misc.xml Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JsBowerSettings">
<exe-path />
<config-path />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>Data flow issuesJavaScript</id>
</State>
<State>
<id>Error handlingJavaScript</id>
</State>
<State>
<id>JavaScript</id>
</State>
<State>
<id>JavaScript validity issuesJavaScript</id>
</State>
<State>
<id>Ruby</id>
</State>
</expanded-state>
<selected-state>
<State>
<id>DebuggerStatementJS</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-1.9.3-p392" project-jdk-type="RUBY_SDK" />
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

9
.idea/modules.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/bigdate.iml" filepath="$PROJECT_DIR$/.idea/bigdate.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

7
.idea/vcs.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the Department controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -22,6 +22,10 @@ class AccountController < ApplicationController
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_filter :check_if_login_required
before_filter :auth_login1, :only => [:avatar, :authentication, :security_settings, :change_psd]
before_filter :require_login, only: [:avatar, :authentication, :security_settings, :change_psd]
# Login request and validation
def login
if params[:type] == "activated"
@ -317,24 +321,25 @@ class AccountController < ApplicationController
req = Hash.new(false)
req[:valid] = false
type = params[:type].to_i
if type == 1 || type == 2 || params[:phone] =~ /^1\d{10}$/
code = VerificationCode.where(:phone => params[:phone], :code => params[:code], :code_type => (params[:type].to_i != 1 && params[:type].to_i != 2) ? 2 : params[:type].to_i ).last
if type == 1 || type == 2 || type == 4 || params[:phone] =~ /^1\d{10}$/
code = VerificationCode.where(:phone => params[:phone], :code => params[:code], :code_type => (params[:type].to_i != 1 && params[:type].to_i != 2 && params[:type].to_i != 4) ? 2 : params[:type].to_i ).last
else
code = VerificationCode.where(:email => params[:phone], :code => params[:code], :code_type => 3).last
code = VerificationCode.where(:email => params[:phone], :code => params[:code], :code_type => params[:type].to_i).last
end
req[:valid] = !code.nil? && (Time.now.to_i - code.created_at.to_i) <= 10*60
render :json => req
end
# 发送验证码type 1注册手机验证码 2找回密码手机验证码 3找回密码邮箱验证码
# 发送验证码type 1注册手机验证码 2找回密码手机验证码 3找回密码邮箱验证码 4绑定手机 5绑定邮箱
def get_verification_code
code = %W(0 1 2 3 4 5 6 7 8 9)
type = params[:type].to_i
req = Hash.new(false)
req[:status] = 0
req[:msg] = ''
if type == 1
if User.where(:phone => params[:value]).count > 0
req[:status] = 2
req[:status] = 2 #已注册
else
begin
verification_code = code.sample(6).join
@ -347,10 +352,10 @@ class AccountController < ApplicationController
end
req[:status] = 1
end
else
elsif type == 2 || type == 3
if params[:value] =~ /^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
if User.where(:mail => params[:value]).count == 0
req[:status] = 2
req[:status] = 2 #未注册
else
begin
verification_code = code.sample(6).join
@ -384,11 +389,90 @@ class AccountController < ApplicationController
else
req[:status] = 2
end
else
if params[:value] =~ /^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
if User.where(:mail => params[:value]).count > 0
req[:status] = 2 #已绑定
req[:msg] = '该邮箱已被绑定'
else
begin
verification_code = code.sample(6).join
user = User.current
token = Token.new(:user => user, :action => "bind")
if token.save
Mailer.run.bind_email(token, verification_code)
VerificationCode.create(:email => params[:value], :status => 1, :code_type => 5, :code => verification_code)
end
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end
req[:status] = 3
req[:link] = params[:value].split("@")[1]
end
elsif params[:value] =~ /^1\d{10}$/
if User.where(:phone => params[:value]).count > 0
req[:status] = 2
req[:msg] = '该手机号已被绑定'
else
begin
verification_code = code.sample(6).join
status = Trustie::Sms.send(mobile: params[:value], code: verification_code)
if status
VerificationCode.create(:phone => params[:value], :status => 1, :code_type => 4, :code => verification_code)
end
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end
req[:status] = 1
end
else
req[:status] = 2
end
end
render :json => req
end
def avatar
@user = User.current
@setting_type = 2
render :layout => 'base_edu_account'
end
def authentication
@setting_type = 3
render :layout => 'base_edu_account'
end
def security_settings
@user = User.current
@setting_type = 4
render :layout => 'base_edu_account'
end
def change_psd
@user = User.current
@setting_type = 5
render :layout => 'base_edu_account'
end
def change_or_bind
@user = User.current
@type = params[:type]
@setting_type = 4
render :layout => 'base_edu_account'
end
def bind_email_or_phone
@user = User.current
if params[:type] == "phone"
@user.update_attributes(:phone => params[:value])
else
@user.update_attributes(:mail => params[:value])
end
redirect_to security_settings_path
end
def wechat_bind
respond_to do |format|
format.html { render :layout => "login_bigdata"}

View File

@ -718,7 +718,7 @@ class AdminController < ApplicationController
def applied_schools
# 更新消息状态
if params[:flag]
applied_message = AppliedMessage.where(:id => params[:applied_message_id]).first
applied_message = AppliedMessage.where(:id => params[:applied_message_id], :applied_type => 'ApplyAddSchools').first
applied_message.update_attribute(:viewed, true)
end
@ -790,6 +790,8 @@ class AdminController < ApplicationController
if aas.school_id != school[0].id.to_i
aas.school.destroy
end
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school[0].id)
Department.where(:school_id => aas.school_id).update_all(:school_id => school[0].id)
aas.update_attribute(:school_id, school[0].id)
rescue Exception => e
puts e
@ -825,13 +827,18 @@ class AdminController < ApplicationController
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 3)
applied_school.update_attribute(:status, 3)
# 单位对应的部门审核也应做删除处理
applied_departments = ApplyAddDepartment.where(:school_id => applied_school.school_id)
applied_departments.update_all(:status => 3)
AppliedMessage.where(:applied_id => applied_departments.map(&:id), :applied_type => "ApplyAddDepartment").update_all(:status => 3)
# 未审批删除
if params[:tip] == "unapplied"
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
# 删除学校的用户
users = UserExtensions.where("school_id = #{applied_school.school_id}")
users.update_all(:school_id => nil)
users.update_all(:school_id => nil, :department_id => nil)
applied_school.school.destroy
applied_school.school.departments.destroy_all
redirect_to unapplied_schools_url
# 已审批删除
elsif params[:tip] == "applied"
@ -840,6 +847,75 @@ class AdminController < ApplicationController
end
end
# 部门审核
# 未审批tab页
# status: 0 未审批; 1 已批阅; 2已更改 3拒绝
def applied_departments
# 更新消息状态
if params[:flag]
applied_message = AppliedMessage.where(:id => params[:applied_message_id], :applied_type => 'ApplyAddDepartment').first
applied_message.update_attribute(:viewed, true)
end
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@apply_status = ApplyAddDepartment.where("status = 0 and name like '%#{condition}%'").order('created_at desc')
@apply_count = @apply_status.count
@apply_pages = Paginator.new @apply_count, 30, params['page'] || 1
@apply_status = paginateHelper @apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
def has_applied_departments
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@has_apply_status = ApplyAddDepartment.where("(status = 1 or status = 2) and name like '%#{condition}%'").order('created_at desc')
@has_apply_count = @has_apply_status.count
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1
@has_apply_status = paginateHelper @has_apply_status, 30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
def approve_applied_departments
applied_department = ApplyAddDepartment.find params[:id]
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 1)
applied_department.update_column('status', 1) unless applied_department.nil?
AppliedMessage.create(:user_id => applied_department.user_id, :status => 1, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
respond_to do |format|
format.html{ redirect_to unapplied_departments_path }
end
end
def delete_applied_departments
applied_department = ApplyAddDepartment.find params[:id]
applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment")
applied_message.update_all(:status => 3)
applied_department.update_attribute(:status, 3)
# 未审批删除
if params[:tip] == "unapplied"
AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name )
# 删除学校的用户
users = UserExtensions.where("department_id = #{applied_department.department_id}")
users.update_all(:department_id => nil)
applied_department.department.destroy
redirect_to unapplied_departments_path
# 已审批删除
elsif params[:tip] == "applied"
applied_department.destroy
redirect_to applied_departments_path
end
end
#移动端版本管理
def mobile_version
@versions = PhoneAppVersion.reorder('created_at desc')

View File

@ -10,7 +10,7 @@ class AvatarController < ApplicationController
unless request.content_type == 'application/octet-stream'
@source_type = params[:source_type]
@source_id = params[:source_id]
@temp_file = params[:avatar][:image]
@temp_file = params[:img] || params[:avatar][:image]
@image_file = @temp_file.original_filename
@is_direct = params[:is_direct]
else
@ -32,7 +32,7 @@ class AvatarController < ApplicationController
end
size = @temp_file.size
if @temp_file && (@temp_file.size > 0)
if @temp_file && (@temp_file.size > 0)
if @temp_file.size > Setting.upload_avatar_max_size.to_i
@status = 1
@msg = l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i))
@ -80,15 +80,6 @@ class AvatarController < ApplicationController
end
@temp_file = nil
sleep(3)
unless File.size(diskfile) < size
logger.info("###############################################################sleep")
sleep(0.5)
end
#@src_file = diskfile
respond_to do |format|
format.json{
render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'

View File

@ -43,6 +43,7 @@ class BlogCommentsController < ApplicationController
update_messsages_to_viewed("BlogMessage", params[:blog_id])
@article = BlogComment.find(params[:id])
update_visiti_count @article
@replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies

View File

@ -115,6 +115,17 @@ class ChallengesController < ApplicationController
ChallengeTag.create(:name => input, :challenge_id => @challenge.id)
end
end
# 向jenkins端发送请求构建pipeline片段实时返回结果
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
params = {:challengeStage => "#{@challenge.position}", :challengeType => "#{@challenge.evaluation_way.to_i}", :challengeProgramName => "#{@challenge.path}", :trainingID => "#{@shixun.id}"}
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/generatePipelineScriptForChallenge")
res = uri_exec uri, {challengeInfo: params.to_json}
if res['code'] == 0
@challenge.update_attribute(:pipeline_script, res['msg'])
else
logger.error("res['code'] is #{res['code']}, res['msg'] is #{res['code']}")
raise("脚本构建失败")
end
end
format.html {redirect_to shixun_challenge_path(@challenge, :shixun_id => @shixun), notice: '更新成功!'}
format.json { head :no_content }

View File

@ -0,0 +1,88 @@
class DepartmentController < ApplicationController
#根据部门名字或者拼音来查询
def on_search
condition = "#{params[:name].strip}".gsub(" ","")
#获取拼音的第一次出现的位置
if(condition == '')
@departments = Department.order("CONVERT(name USING gbk) COLLATE gbk_chinese_ci asc").page((params[:page].to_i || 1) - 1).per(100)
@department_count = Department.count
else
@departments = Department.where("name like '%#{condition}%'").order("CONVERT(name USING gbk) COLLATE gbk_chinese_ci asc").page((params[:page].to_i || 1) - 1).per(100)
@department_count = School.where("name like '%#{condition}%'").count
end
render :json =>{ :departments => @departments,:count=>@department_count}.to_json
end
#申请学院或部门(单位) name:名称 remarks:备注
def apply_add_department
school = School.find params[:school_id]
data = {result:0,name:params[:name],department_id:0}
#0 成功 1参数错误 2名称已存在 3.失败
data[:result] = 0
if school
#检验参数
if params[:name] == ""
data[:result] = 1
else
department = Department.where(:school_id => school.id, :name => params[:name]).first
if department
data[:result] = 2
else
department = Department.new
department.name = params[:name].strip
department.school = school
#status 0未处理 1通过 2拒绝
apply_department = ApplyAddDepartment.new
#用belongs_to 可以一起存数据库
apply_department.department = department
apply_department.school = department.school
apply_department.name = department.name
apply_department.remarks = params[:remarks]
apply_department.user_id = User.current.id
if apply_department.save
data[:department_id] = department.id
user_extention = User.current.extensions
user_extention.department_id = department.id
user_extention.save!
# 向管理员发送信息
users = User.where(:admin => 1)
users.each do |user|
AppliedMessage.create(:user_id => user.id, :status => 0, :applied_user_id => User.current.id, :viewed => 0, :applied_id => apply_department.id, :applied_type => "ApplyAddDepartment", :name => department.name )
end
else
data[:result] = 3
end
end
end
end
render :json =>data
end
def search_repeat_departmentname
status = 0 #没有重复的
name = params[:name]
school = School.where(:id => params[:school_id].to_i).first
if school
if name
department = school.departments.where(:name => name).first
if department
status = 1 #有重复的
end
end
else
status = 2
end
render :json =>status
end
end

View File

@ -62,6 +62,7 @@ class GamesController < ApplicationController
@test_sets = test_set_static_data(test_sets)
end
@consume_time = (@game.status == 2 ? game_spend_time(@game.open_time, @game.updated_at) : game_spend_time(@game.open_time, Time.now))
logger.info("#################################{@public_test_sets}")
@test_sets_count = test_sets.count
@test_sets_hidden_count = test_sets.where(:is_public => false).count
@ -173,11 +174,12 @@ class GamesController < ApplicationController
# 出错的测试用例序号
error_position = Output.where(:game_id => @game.id, :result => false).last
static_error_position = error_position.blank? ? 0 : error_position.try(:test_set_position).to_i
consume_time = @game.status == 2 ? game_spend_time(@game.open_time, @game.updated_at) : game_spend_time(@game.open_time, Time.now)
# 异常结果
latest_output = error_position.try(:out_put)
render :json => {test_sets: total_test_sets, status: @game.status, had_done: had_done, latest_output: latest_output, error_position: static_error_position,
had_passed_testsests:had_passed_testsests, test_sets_count:test_sets_count, test_sets_hidden_count:test_sets_hidden_count,
final_score:final_score, had_tested:had_tested}
final_score:final_score, had_tested:had_tested, consume_time: consume_time}
end
def change_status
@ -197,7 +199,7 @@ class GamesController < ApplicationController
next_game = @game.next_game
next_game.update_attributes(:status => 0, :open_time => Time.now) if next_game.status == 3
redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)
redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)
end

View File

@ -145,15 +145,21 @@ class MyController < ApplicationController
applied_message = AppliedMessage.where(:id => params[:applied_message_id]).first
applied_message.update_attribute(:viewed, true)
end
@user = User.current
# 基本资料不完善 @force为false 完善 @force为true
@force = false
if params[:tip]
@force = true
else
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
@force = true
elsif user.identity == 3 && user.school_id.nil?
@force = true
end
end
@user = User.current
lg = @user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
@ -225,7 +231,8 @@ class MyController < ApplicationController
File.delete(diskfile1) if File.exist?(diskfile1)
end
render :layout => 'new_base_user'
@setting_type = 1
render :layout => 'base_edu_account'
end
# Destroys user's account
@ -278,7 +285,8 @@ class MyController < ApplicationController
end
flash.now[:error] = l(:notice_account_old_wrong_password)
end
render :template => 'my/account',:layout=>'new_base_user'
@setting_type = 5
render :template => 'account/change_psd',:layout=>'base_edu_account'
end
# Create a new feeds key

View File

@ -29,6 +29,19 @@ class SyllabusMemberController < ApplicationController
end
end
def change_manager
@syllabus = Syllabus.find(params[:syllabus])
if params[:chooseteacher]
man_member = SyllabusMember.where(:syllabus_id => @syllabus.id, :user_id => @syllabus.user_id).first
cha_member = @syllabus.syllabus_members.where(:id => params[:chooseteacher].to_i).first
if man_member && cha_member
man_member.update_attributes(:rank => cha_member.rank)
cha_member.update_attributes(:rank => 1)
@syllabus.update_attributes(:user_id => cha_member.user_id)
end
end
end
def destroy
member = SyllabusMember.find(params[:id])
@syllabus = member.syllabus

View File

@ -28,9 +28,13 @@ class SyllabusesController < ApplicationController
def create
if User.current.user_extensions.identity
@syllabus = Syllabus.new
@syllabus.title = params[:title]
@syllabus.title = params[:title].to_s.strip
@syllabus.eng_name = params[:eng_name]
@syllabus.user_id = User.current.id
@syllabus.major_level = params[:major_level].to_i
@syllabus.discipline_category_id = params[:discipline_category_id].to_i
@syllabus.first_level_discipline_id = params[:first_level_discipline_id].to_i
@syllabus.syllabus_type = params[:syllabus_type].to_i
@syllabus.description = Message.where("id = 19412").first.nil? ? '' : Message.where("id = 19412").first.content
if @syllabus && @syllabus.save
member = SyllabusMember.create(:user_id => @syllabus.user_id, :rank => 1)
@ -50,19 +54,46 @@ class SyllabusesController < ApplicationController
end
end
def regex_syllabus_name
data = {result:1}
if Syllabus.where(:user_id => User.current.id, :name => params[:name]).count > 0
data[:result] = 0
end
render :json => data
end
def edit
respond_to do |format|
format.html{render :layout => 'base_syllabus'}
end
end
def delete_syllabus
def update
title = @syllabus.title
@syllabus.title = params[:title].to_s.strip
@syllabus.eng_name = params[:eng_name]
@syllabus.major_level = params[:major_level].to_i
@syllabus.discipline_category_id = params[:discipline_category_id].to_i
@syllabus.first_level_discipline_id = params[:first_level_discipline_id].to_i
@syllabus.syllabus_type = params[:syllabus_type].to_i
if @syllabus.save
if title != params[:title].to_s.strip
@syllabus.courses.each do |course|
course.name.gsub!(/^#{title}/, params[:title].to_s.strip)
course.save
end
end
end
redirect_to syllabus_path(@syllabus)
end
def edit_des
respond_to do |format|
format.js
format.html{render :layout => 'base_syllabus'}
end
end
def update
def update_des
@syllabus.description = params[:syllabus][:description]
@syllabus.des_status = 1
@syllabus.save_attachments(params[:attachments])
@ -77,6 +108,12 @@ class SyllabusesController < ApplicationController
end
end
def delete_syllabus
respond_to do |format|
format.js
end
end
#删除课程大纲的描述
def delete_des
if @syllabus
@ -183,6 +220,40 @@ class SyllabusesController < ApplicationController
end
end
def get_discipline_categories
data = {result:0,options:[]}
if params[:major_level]
if DisciplineCategory.where(:major_level => params[:major_level].to_i).count > 0
data[:result] = 1
DisciplineCategory.where(:major_level => params[:major_level].to_i).each do |dis|
option = []
option << dis.name.to_s
option << dis.id
data[:options] << option
end
end
end
render :json =>data
end
def get_first_level_disciplines
data = {result:0,options:[]}
if params[:discipline_category_id]
if FirstLevelDiscipline.where(:discipline_category_id => params[:discipline_category_id].to_i).count > 0
data[:result] = 1
FirstLevelDiscipline.where(:discipline_category_id => params[:discipline_category_id].to_i).each do |dis|
option = []
option << dis.name.to_s
option << dis.id
data[:options] << option
end
end
end
render :json =>data
end
private
def find_syllabus
@syllabus = Syllabus.find params[:id]

View File

@ -2097,147 +2097,161 @@ class UsersController < ApplicationController
end
def show
if User.current == @user
# 点击小铃铛,更新点击时间
update_onclick_time if params[:click_user_message] == 'true'
# 全部设为已读
# 自己的主页显示消息
messages_all = MessageAll.where(:user_id => @user.id)
@message_count = messages_all.count
# REDO:已删除的内容应该在页面中显示不点击
@message_all_pages = Paginator.new @message_count, per_page_option, params['page']
@message_alls = messages_all.includes(:message).
limit(@message_all_pages.per_page).
offset(@message_all_pages.offset).
reorder("#{MessageAll.table_name}.created_at desc")
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# 用户待完成的作业
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@unfinished_homework_count = homeworks.count - student_works.count
# 用户待完成的测验
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
@unfinished_test_count = exercises.count - exercise_users.count
# 用户待完成的问卷
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
@unfinished_poll_count = polls.count - poll_users.count
# 用户待匿评的作品
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2")
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
@anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count
# 待评阅的作业 暂不做
# @unreview_homework = 1
# 待审批的申请
#applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
#applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count
# applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count
# @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
user_id = User.current.id
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
(ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
(ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );"
message_alls = MessageAll.find_by_sql(sql)
@applied_message_alls_count = message_alls.count
else
# 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
join_course_messages.update_all(:viewed => true)
end
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
container_type = ''
act_type = ''
# 他的动态
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
if params[:type].present?
case params[:type]
when "course_homework"
container_type = 'Course'
act_type = 'HomeworkCommon'
when "course_news"
container_type = 'Course'
act_type = 'News'
when "course_message"
container_type = 'Course'
act_type = 'Message'
when "course_poll"
container_type = 'Course'
act_type = 'Poll'
when "course_journals"
container_type = 'Course'
act_type = 'JournalsForMessage'
when "project_issue"
container_type = 'Project'
act_type = 'Issue'
when "project_message"
container_type = 'Project'
act_type = 'Message'
when "user_journals"
container_type = 'Principal'
act_type = 'JournalsForMessage'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
end
end
if container_type != '' && container_type != 'all'
if container_type == 'Course'
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
elsif container_type == 'Project'
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
if User.current != @user
blog_ids = "("+@user.blog.id.to_s+")"
else
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
end
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end
end
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
@type = params[:type]
end
@blog_list = @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_at desc")
@blog_count = @blog_list.count
@blog_list = @blog_list.limit(3)
watch_query = User.watched_by(@user.id);
@user_watchlist_count = watch_query.count();
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12);
fan_query = @user.watcher_users;
@user_fanlist_count = fan_query.count();
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12);
@courses = @user.courses.visible.not_deleted
@courses_count = @courses.count
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc").limit(8)
@shixuns = []
@shixuns_count = 0
# if User.current == @user
# # 点击小铃铛,更新点击时间
# update_onclick_time if params[:click_user_message] == 'true'
# # 全部设为已读
# # 自己的主页显示消息
# messages_all = MessageAll.where(:user_id => @user.id)
# @message_count = messages_all.count
# # REDO:已删除的内容应该在页面中显示不点击
# @message_all_pages = Paginator.new @message_count, per_page_option, params['page']
# @message_alls = messages_all.includes(:message).
# limit(@message_all_pages.per_page).
# offset(@message_all_pages.offset).
# reorder("#{MessageAll.table_name}.created_at desc")
#
# @unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
#
# my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
# where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# # 用户待完成的作业
# homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
# homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
# student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
# @unfinished_homework_count = homeworks.count - student_works.count
# # 用户待完成的测验
# exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
# exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
# @unfinished_test_count = exercises.count - exercise_users.count
# # 用户待完成的问卷
# polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
# poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
# @unfinished_poll_count = polls.count - poll_users.count
# # 用户待匿评的作品
# homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2")
# student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
# anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
# unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
# @anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count
# # 待评阅的作业 暂不做
# # @unreview_homework = 1
#
# # 待审批的申请
# #applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
# #applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count
# # applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count
# # @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
# user_id = User.current.id
# sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
# left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
# where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
# (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
# (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );"
# message_alls = MessageAll.find_by_sql(sql)
# @applied_message_alls_count = message_alls.count
# else
# # 看别人的主页显示动态
# #更新用户申请成为课程老师或教辅消息的状态
# if params[:course_id] != nil
# join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
# params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
# join_course_messages.update_all(:viewed => true)
# end
# shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
# shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
# @page = params[:page] ? params[:page].to_i + 1 : 0
# user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
# user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
# course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
# project_types = "('Message','Issue','Project')"
# principal_types = "JournalsForMessage"
# container_type = ''
# act_type = ''
# # 他的动态
# sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
# if params[:type].present?
# case params[:type]
# when "course_homework"
# container_type = 'Course'
# act_type = 'HomeworkCommon'
# when "course_news"
# container_type = 'Course'
# act_type = 'News'
# when "course_message"
# container_type = 'Course'
# act_type = 'Message'
# when "course_poll"
# container_type = 'Course'
# act_type = 'Poll'
# when "course_journals"
# container_type = 'Course'
# act_type = 'JournalsForMessage'
# when "project_issue"
# container_type = 'Project'
# act_type = 'Issue'
# when "project_message"
# container_type = 'Project'
# act_type = 'Message'
# when "user_journals"
# container_type = 'Principal'
# act_type = 'JournalsForMessage'
# when "current_user"
# container_type = 'Principal'
# act_type = 'Principal'
# when "all"
# container_type = 'all'
# act_type = 'all'
# end
# end
# if container_type != '' && container_type != 'all'
# if container_type == 'Course'
# sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
# elsif container_type == 'Project'
# sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
# elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
# sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
# elsif container_type == 'Principal' && act_type == 'Principal'
# sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
# end
# if User.current != @user
# sql += " and user_id = #{@user.id}"
# end
# else
# if User.current != @user
# blog_ids = "("+@user.blog.id.to_s+")"
# else
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# end
# sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
# "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
# "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
# "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
# if container_type != 'all' && User.current != @user
# sql = "user_id = #{@user.id} and(" + sql + ")"
# end
# end
# @user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
# @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
# @type = params[:type]
# end
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
format.html {render :layout => 'base_edu_user'}
end
end

View File

@ -39,6 +39,12 @@ class WatchersController < ApplicationController
else
if params[:target_id]
@user = User.find(params[:target_id])
watch_query = User.watched_by(@user.id);
@user_watchlist_count = watch_query.count();
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12);
fan_query = @user.watcher_users;
@user_fanlist_count = fan_query.count();
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12);
end
end
@ -82,6 +88,12 @@ class WatchersController < ApplicationController
else
if params[:target_id]
@user = User.find(params[:target_id])
watch_query = User.watched_by(@user.id);
@user_watchlist_count = watch_query.count();
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc").limit(12);
fan_query = @user.watcher_users;
@user_fanlist_count = fan_query.count();
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12);
end
end
if params[:object_type] == 'project'

View File

@ -1118,7 +1118,7 @@ module ApplicationHelper
def render_flash_messages
s = ''
flash.each do |k,v|
s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
s << content_tag('div', v.html_safe, :class => "alert alert-orange mb15 mt15", :id => "flash_#{k}")
end
s.html_safe
end
@ -4280,6 +4280,57 @@ def get_contest_group_member_names work
result
end
def major_level_option
content = []
option0 = []
option0 << "选择课程所属专业层级"
option0 << 0
option1 = []
option1 << "专科"
option1 << 3
option2 = []
option2 << "本科"
option2 << 2
option3 = []
option3 << "研究生"
option3 << 1
content << option0
content << option1
content << option2
content << option3
content
end
def discipline_category_option major_level = 3
content = []
option0 = []
option0 << "选择课程所属学科门类"
option0 << 0
content << option0
DisciplineCategory.where(:major_level => major_level).each do |dis|
option = []
option << dis.name.to_s
option << dis.id
content << option
end
content
end
def first_level_discipline_option disc_ca = 27
content = []
option0 = []
option0 << "选择课程所属一级学科"
option0 << 0
content << option0
FirstLevelDiscipline.where(:discipline_category_id => disc_ca).each do |fir_dis|
option = []
option << fir_dis.name.to_s
option << fir_dis.id
content << option
end
content
end
def course_syllabus_option user = User.current
syllabus_members = SyllabusMember.where("user_id = #{user.id}")
syllabus_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|mem| mem.syllabus_id}.join(',') + ")"

View File

@ -0,0 +1,2 @@
module DepartmentHelper
end

View File

@ -262,11 +262,25 @@ module WatchersHelper
content.present? ? content_tag('ul', content, :class => 'watchers') : content
end
#用户关注、取消关注
def watcher_link_for_user(target, user)
return '' unless user && user.logged?
watched = target.watched_by?(user)
text = watched ? '已关注' : '添加关注'
url = watch_path(:object_type => 'user',
:object_id => target.id,
:target_id => target.id)
method = watched ? 'delete' : 'post'
id = watched ? 'cancel_watch' : ''
title = watched ? '取消关注' : '添加关注'
if target != user
link_to text, url, :remote => true, :method => method, :remote => true,
:class => "fl font-14 user_watch",:id => id, :title => title
else
link_to "关注", "javascript:void(0)", :remote => true, :method => method,
:class => "fl font-14 user_watch", :id => id, :title => title
end
end
# 缺陷跟踪者列表复选框生成
def watchers_checkboxes(object, users, checked=nil)

View File

@ -4,6 +4,7 @@ class AppliedMessage < ActiveRecord::Base
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name
belongs_to :applied ,:polymorphic => true
belongs_to :apply_add_schools
belongs_to :apply_add_department
belongs_to :user
has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy

View File

@ -0,0 +1,7 @@
class ApplyAddDepartment < ActiveRecord::Base
belongs_to :school
belongs_to :user
attr_accessible :name, :remarks, :status, :school_id, :user_id
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
belongs_to :department
end

View File

@ -29,6 +29,7 @@ class Attachment < ActiveRecord::Base
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
belongs_to :resource_bank
# 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
has_many :forwards, :as => :from, :dependent => :destroy

View File

@ -2,8 +2,8 @@ class Blog < ActiveRecord::Base
# attr_accessible :title, :body
include Redmine::SafeAttributes
belongs_to :user
has_many :articles, :class_name => 'BlogComment', :conditions => "#{BlogComment.table_name}.parent_id IS NULL ", :order => "#{BlogComment.table_name}.created_on DESC"
has_many :blog_comments, :dependent => :destroy, :order => "#{BlogComment.table_name}.created_on DESC"
has_many :articles, :class_name => 'BlogComment', :conditions => "#{BlogComment.table_name}.parent_id IS NULL ", :order => "#{BlogComment.table_name}.created_at DESC"
has_many :blog_comments, :dependent => :destroy, :order => "#{BlogComment.table_name}.created_at DESC"
belongs_to :last_comment, :class_name => 'BlogComment', :foreign_key => :last_comment_id
acts_as_tree :dependent => :nullify
#acts_as_list :scope => '(user_id = #{user_id} AND parent_id #{user_id ? = "#{parent_id}" : "IS NULL"})'

View File

@ -20,7 +20,7 @@ class BlogComment < ActiveRecord::Base
validates_presence_of :title, :content
validates_length_of :title, :maximum => 255
#validate :cannot_reply_to_locked_comment, :on => :create
safe_attributes 'title', 'content',"sticky", "locked", "root_id"
safe_attributes 'title', 'content',"sticky", "locked", "root_id", 'visits'
after_save :add_user_activity
after_update :update_activity

4
app/models/department.rb Normal file
View File

@ -0,0 +1,4 @@
class Department < ActiveRecord::Base
belongs_to :school
attr_accessible :name, :school_id
end

View File

@ -0,0 +1,5 @@
class DisciplineCategory < ActiveRecord::Base
attr_accessible :major_level, :name
has_many :first_level_disciplines
end

View File

@ -0,0 +1,5 @@
class FirstLevelDiscipline < ActiveRecord::Base
belongs_to :discipline_category
attr_accessible :name
has_many :syllabuses
end

View File

@ -837,6 +837,15 @@ class Mailer < ActionMailer::Base
:subject => l(:mail_subject_register, Setting.app_title)
end
def bind_email(token, code="111111")
set_language_if_valid(token.user.language)
@login = token.user.try(:login)
@token = token
@code = code
mail :to => token.user.mail,
:subject => l(:mail_subject_bind_mail, Setting.app_title+"("+Setting.host_name+")")
end
def lost_password(token, code="111111")
set_language_if_valid(token.user.language)
@login = token.user.try(:login)

View File

@ -0,0 +1,4 @@
class ReferenceMaterial < ActiveRecord::Base
belongs_to :syllabus
attr_accessible :book, :editor, :press, :syllabus_id
end

View File

@ -0,0 +1,5 @@
class ResourceBank < ActiveRecord::Base
belongs_to :course
belongs_to :user
attr_accessible :course_id, :user_id, :applicable_syllabus, :copy_from, :description, :digest, :discipline_category_id, :disk_directory, :disk_filename, :downloads, :filename, :filesize, :first_level_discipline_id, :is_public, :major_level, :quotes, :attachment_id
end

View File

@ -1,6 +1,7 @@
class School < ActiveRecord::Base
attr_accessible :name, :province,:pinyin
has_many :courses
has_many :departments, :dependent => :destroy
def to_s
self.name.to_s

View File

@ -20,12 +20,15 @@ class Syllabus < ActiveRecord::Base
belongs_to :user
has_many :courses
has_many :reference_materials, :dependent => :destroy
has_many :syllabus_update_records, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :syllabus_members, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'
belongs_to :first_level_discipline
attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course, :major_level, :discipline_category_id, :first_level_discipline_id
safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course', 'major_level', 'discipline_category_id', "first_level_discipline_id"
validates :title, :user_id, presence: true
@ -48,7 +51,21 @@ class Syllabus < ActiveRecord::Base
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS
end
def syllabus_major_level
type = ""
case self.major_level
when 1
type = "研究生/博士"
when 2
type = "本科"
when 3
type = "专科"
end
type
end
def syllabus_type_str
type = ""
case self.syllabus_type
when 1
type = "公共必修课"

View File

@ -0,0 +1,6 @@
class SyllabusUpdateRecord < ActiveRecord::Base
belongs_to :user
belongs_to :syllabus
#property 1描述 2参考资料
attr_accessible :property, :syllabus_id, :user_id
end

View File

@ -605,6 +605,16 @@ class User < Principal
name_formatter[:order].map {|field| "#{table}.#{field}"}
end
# 186***2342
def user_phone
phone.nil? || (phone && phone.empty?) ? "" : phone.gsub(/(\d{3})\d{4}(\d{4})/, '\1****\2')
end
# 8***2@qq.com
def user_mail
mail.nil? || (mail && mail.empty?) ? "" : mail.gsub(/(.{1}).+(.{1}@.+)/, '\1****\2')
end
# Return user's full name for display
def realname(formatter = nil)
f = self.class.name_formatter(formatter)
@ -1198,7 +1208,9 @@ class User < Principal
'language',
'custom_field_values',
'custom_fields',
'identity_url'
'identity_url',
'phone',
'authentication'
safe_attributes 'status',
'auth_source_id',

View File

@ -11,6 +11,7 @@ class UserExtensions < ActiveRecord::Base
belongs_to :user
belongs_to :school, :class_name => 'School', :foreign_key => :school_id
belongs_to :department
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
validates_length_of :description, :maximum => 255
validates_length_of :brief_introduction, :maximum => 255

View File

@ -0,0 +1,136 @@
<script src="../head/jquery.min.js"></script>
<link href="../head/cropper.min.css" rel="stylesheet">
<link href="../head/sitelogo.css" rel="stylesheet">
<script src="../head/bootstrap.min.js"></script>
<script src="../head/cropper.js"></script>
<script src="../head/sitelogo.js"></script>
<script src="../head/html2canvas.min.js" type="text/javascript" charset="utf-8"></script>
<div class="panel-user-right-con clearfix ">
<div class="modal fade mt50" id="avatar-modal" aria-hidden="true" aria-labelledby="avatar-modal-label" role="dialog" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<form class="avatar-form">
<div class="modal-body">
<div class="avatar-body">
<div class="avatar-upload">
<input class="avatar-src" name="avatar_src" type="hidden">
<input class="avatar-data" name="avatar_data" type="hidden">
<a href="javascript:void(0);" class="task-btn task-btn-blue ml5" type="button" style="height: 35px;" onClick="$('input[id=avatarInput]').click();">本地上传</a>
<span id="avatar-name"></span>
<input class="avatar-input" style="display:none;" id="avatarInput" name="avatar_file" type="file">
<input type="hidden" id="source_id" value="<%= @user.id %>"/>
<input type="hidden" id="source_type" value="User"/>
</div>
<div class="row clearfix">
<div class="task-form-45 fl panel-box-sizing">
<div class="avatar-wrapper"></div>
</div>
<div class="task-form-50 panel-box-sizing fr color-grey" style=" text-align: center; padding-top:30px;">
<span>预览(请注意是否清晰)<br/></span>
<div class="fl ">
<div class="avatar-preview preview-lg" id="imageHead">
</div>
<span>尺寸240*240像素</span>
</div>
<div class="fl ml15">
<div class="avatar-preview preview-md" id="imageHead"></div>
<span>尺寸100*100像素</span>
<div class="avatar-preview preview-sm" id="imageHead"></div>
<span>尺寸40*40像素</span>
</div>
</div>
</div>
<div class="row avatar-btns">
<div class="task-form-50 fl">
<div class="btn-group">
<a href="javascript:void(0);" class="task-btn fa fa-undo fl" data-method="rotate" data-option="-90" type="button" title="Rotate -90 degrees">
向左旋转</a>
</div>
<div class="btn-group">
<a href="javascript:void(0);" class="task-btn fa fa-repeat fl ml10" data-method="rotate" data-option="90" type="button" title="Rotate 90 degrees">
向右旋转</a>
</div>
<div class="cl"></div>
</div>
<div class=" fr">
<a href="javascript:void(0);" class="avatar-save task-btn task-btn-blue fa fa-save mt5" data-dismiss="modal"> 保存修改</a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
//---------------------------头像上传-----------------------------//
//做个下简易的验证 大小 格式
$('#avatarInput').on('change', function(e) {
var filemaxsize = 1024 * 5;//5M
var target = $(e.target);
var Size = target[0].files[0].size / 1024;
if(Size > filemaxsize) {
alert('图片过大,请重新选择!');
$(".avatar-wrapper").children().remove;
return false;
}
if(!this.files[0].type.match(/image.*/)) {
alert('请选择正确的图片!')
} else {
var filename = document.querySelector("#avatar-name");
var texts = document.querySelector("#avatarInput").value;
var teststr = texts; //你这里的路径写错了
testend = teststr.match(/[^\\]+\.[^\(]+/i); //直接完整文件名的
filename.innerHTML = testend;
$(filename).css("color", '#333');
}
});
$(".avatar-save").on("click", function() {
var img_lg = document.getElementById('imageHead');
if($(img_lg).html().trim() == ""){
$("#avatar-name").html("请先选择图片上传").css("color", 'red');
} else {
$("#avatar-name").html("").css("color", '#333');
// 截图小的显示框内的内容
html2canvas(img_lg, {
allowTaint: true,
taintTest: false,
onrendered: function(canvas) {
canvas.id = "mycanvas";
//生成base64图片数据
var dataUrl = canvas.toDataURL("image/jpeg");
var newImg = document.createElement("img");
newImg.src = dataUrl;
imagesAjax(dataUrl);
$(".avatar-save").attr("disabled","true");
}
});
}
});
function imagesAjax(src) {
var data = {};
data.img = src;
data.source_id = $('#source_id').val();
data.source_type = $('#source_type').val();
data.is_direct = 0;
$.ajax({
url: "<%= upload_avatar_path() %>",
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: data,
type: "POST",
success: function (re) {
}
});
}
</script>

View File

@ -0,0 +1,85 @@
<div class="panel-user-right-con clearfix">
<div class="panel-user-test mt30">
<%= form_tag(bind_email_or_phone_path, :id => 'bind_email_or_phone_form') do %>
<input type="hidden" name="type" id="change_type" value="<%= @type %>">
<% if @type == 'phone' %>
<h3 class="mb20 font-20"><i class="fa fa-mobile color-light-grey font-24 mr5"></i>手机绑定</h3>
<div class="alert alert-orange">
<button data-dismiss="alert" class="task-close fr" type="button">×</button>
设置新手机号,并验证
</div>
<div class="new_login_box clearfix">
<div class="new_login_form">
<ul>
<li class="new_loggin_users">
<input type="text" id="user_phone_num" name="value" class="new_loggin_input" autocomplete="off" placeholder="请输入真实有效的11位手机号码">
<i class="fa font-16 mr5" id="user_phone_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_phone_notice"></p>
</div>
</li>
<li class="pr">
<div id="drag" class="drag_slider"></div>
<div class="new-login-error" style="display: none;">
<p id="user_verification_notice"></p>
</div>
</li>
<li class="pr">
<input type="text" id="phone_verification_code" class="new_loggin_input_test fl" placeholder="输入短信验证码">
<a href="javascript:void(0);" class="fr task-btn-ver" id="get_verification_code">获取验证码</a>
<div class="new-login-error" style="display: none;">
<p id="phone_verification_code_notice"></p>
</div>
<div class="cl"></div>
</li>
<p id="send_success_notice" class="none" style="margin-top: -15px; margin-bottom: 10px;"></p>
<li><a href="javascript:void(0);" class="new-user-submit" id="bind_email_or_phone_form_submit">保存</a></li>
</ul>
</div>
</div>
<% elsif @type == 'mail' %>
<h3 class="mb20 font-20"><i class="fa fa-envelope-o color-light-grey mr5"></i>邮箱绑定</h3>
<div class="alert alert-orange">
<button data-dismiss="alert" class="task-close fr" type="button">×</button>
设置新邮箱地址,并验证
</div>
<div class="new_login_box clearfix">
<div class="new_login_form">
<ul>
<li class="new_loggin_users ">
<input type="text" id="user_email_addr" name="value" class="new_loggin_input" placeholder="请输入真实有效的邮箱">
<i class="fa font-16 mr5" id="user_email_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_phone_notice"></p>
</div>
</li>
<li class="pr">
<div id="drag" class="drag_slider"></div>
<div class="new-login-error" style="display: none;">
<p id="user_verification_notice"></p>
</div>
</li>
<li class="pr">
<input type="text" id="phone_verification_code" class="new_loggin_input_test fl" placeholder="输入邮箱验证码">
<a href="javascript:void(0);" class="fr task-btn-ver" id="get_verification_code">获取验证码</a>
<div class="new-login-error" style="display: none;">
<p id="phone_verification_code_notice"></p>
</div>
<div class="cl"></div>
</li>
<p id="send_success_notice" class="none" style="margin-top: -15px; margin-bottom: 10px;"></p>
<li><a href="javascript:void(0);" class="new-user-submit" id="bind_email_or_phone_form_submit">保存</a></li>
</ul>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<script type="text/javascript">
$('#drag').drag();
</script>

View File

@ -0,0 +1,38 @@
<div class="panel-user-right-con clearfix">
<% if( !@act.nil? && @act == 'password') %>
<%= render_flash_messages %>
<% end %>
<div class="panel-user-test mt30 ">
<div class="new_login_box clearfix">
<div class="new_login_form">
<%= form_tag(my_password_path,:id => 'my_password_form') do %>
<ul >
<li class="new_loggin_users">
<input id="password" type="password" name="password" autocomplete="off" class="new_loggin_input" placeholder="原始密码">
<i class="fa font-16 ml20" id="user_password_1_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_password_1_notice"></p>
</div>
</li>
<li class="new_loggin_users">
<input id="new_password" type="password" name="new_password" class="new_loggin_input" placeholder="新密码">
<i class="fa font-16 ml20" id="user_password_2_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_password_2_notice"></p>
</div>
</li>
<li class="new_loggin_users">
<input id="new_password_confirmation" name="new_password_confirmation" type="password" class="new_loggin_input" placeholder="确认密码">
<i class="fa font-16 ml20" id="user_password_3_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_password_3_notice"></p>
</div>
</li>
<li><a href="javascript:void(0);" id="reset_password_submit" class="new-user-submit">保存</a></li>
</ul>
<% end %>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,40 @@
<div class="panel-user-setting mt30 ml30 mr30">
<ul class="panel-user-setting-ul clearfix">
<li class="font-20 "><i class="fa fa-mobile color-grey font-24 mr5 " ></i>手机绑定</li>
<% if @user.phone.blank? %>
<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>
<li class="font-14 mt10">&nbsp;</li>
<li><a href="<%= change_or_bind_path(:type => 'phone') %>" class="task-btn task-btn-blue">绑定</a></li>
<% else %>
<li class="font-14 mt10 color-grey"><i class="fa fa-check-circle color-green mr5"></i>已绑定</li>
<li class="font-14 mt10 t_l color-grey">您绑定的手机:<%= @user.user_phone %></li>
<li><a href="<%= change_or_bind_path(:type => 'phone') %>" class="task-btn">更改</a></li>
<% end %>
</ul>
<ul class="panel-user-setting-ul clearfix">
<li class="font-20"><i class="fa fa-envelope-o color-grey font-16 mr5"></i>邮箱绑定</li>
<% if @user.mail.blank? %>
<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>
<li class="font-14 mt10">&nbsp;</li>
<li><a href="<%= change_or_bind_path(:type => 'mail') %>" class="task-btn task-btn-blue">绑定</a></li>\
<% else %>
<li class="font-14 mt10 color-grey"><i class="fa fa-check-circle color-green mr5"></i>已绑定</li>
<li class="font-14 mt10 t_l color-grey">您绑定的邮箱:<%= @user.user_mail %></li>
<li><a href="<%= change_or_bind_path(:type => 'mail') %>" class="task-btn">更改</a></li>
<% end %>
</ul>
<!--<ul class="panel-user-setting-ul clearfix">-->
<!--<li class="font-20"><i class="fa fa-wechat color-grey font-16 mr5"></i>微信绑定</li>-->
<!--<li class="font-14 mt10 color-grey"><i class="fa fa-exclamation-circle color-orange mr5"></i>未绑定</li>-->
<!--<li class="font-14 mt10">&nbsp;</li>-->
<!--<li><a href="#" class=" task-btn task-btn-blue">绑定</a></li>-->
<!--</ul>-->
<!--<ul class="panel-user-setting-ul clearfix">-->
<!--<li class="font-20"><i class="fa fa-wechat color-grey font-16 mr5 " ></i>微信绑定</li>-->
<!--<li class="font-14 mt10 color-grey"><i class="fa fa-check-circle color-green mr5"></i>已绑定</li>-->
<!--<li class="font-14 mt10 t_l color-grey" >您绑定的微信昵称:<span class="panel-span-name task-hide " >莎莎莎莎莎莎莎莎</span></li>-->
<!--<li><a href="#" class=" task-btn " >更改</a></li>-->
<!--</ul>-->
</div>
<div class="cl"></div>

View File

@ -9,7 +9,7 @@
</div>
<div class="new_login_con">
<div class="new_login_box clearfix">
<ul class="new_login_weixin fl" >
<ul class="new_login_weixin fl">
<li id="login_weixin_nav_1" class="login_weixin_nav_hover" onclick="bigDataHoverLi(1);">
<a href="javascript:void(0);" class="login_weixin_nav_nomal"><i class="fa fa-mobile-phone font-16 mr10 mt3"></i>手机注册</a>
</li>
@ -190,7 +190,7 @@
if (/^1\d{10}$/.test(this.value) == false){
$('#user_phone_notice').html('请输入有效的11位手机号码');
$('#user_phone_notice').parent().show();
$("#user_phone_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_phone_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
return false;
}
else{
@ -202,12 +202,12 @@
if (data.valid) {
$('#user_phone_notice').html('');
$('#user_phone_notice').parent().hide();
$("#user_phone_check").removeClass("fa-times-circle").removeClass("color-orenge").addClass("fa-check").addClass("color-light-green");
$("#user_phone_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check").addClass("color-light-green");
$phone_correct = true;
} else {
$('#user_phone_notice').html('该手机号已被注册');
$('#user_phone_notice').parent().show();
$("#user_phone_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_phone_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$phone_correct = false;
}
});
@ -219,7 +219,7 @@
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
$('#user_email_addr_notice').html('邮箱地址格式不对');
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_email_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$mail_correct = false;
return ;
}
@ -231,12 +231,12 @@
if (data.valid) {
$('#user_email_addr_notice').html('');
$('#user_email_addr_notice').parent().hide();
$("#user_email_check").removeClass("fa-times-circle").removeClass("color-orenge").addClass("fa-check").addClass("color-light-green");
$("#user_email_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check").addClass("color-light-green");
$mail_correct = true;
} else {
$('#user_email_addr_notice').html(data.message);
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_email_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$mail_correct = false;
}
});
@ -248,13 +248,13 @@
if (pas1.length >= password_min_length) {
$('#user_password_1_notice').html('');
$('#user_password_1_notice').parent().hide();
$("#user_password_1_check").removeClass("fa-times-circle").removeClass("color-orenge").addClass("fa-check").addClass("color-light-green");
$("#user_password_1_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check").addClass("color-light-green");
$passwd_1_correct = true;
}
else {
$('#user_password_1_notice').html('<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>');
$('#user_password_1_notice').parent().show();
$("#user_password_1_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_password_1_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$passwd_1_correct = false;
}
});
@ -265,13 +265,13 @@
if (pas1.length >= password_min_length) {
$('#user_password_2_notice').html('');
$('#user_password_2_notice').parent().hide();
$("#user_password_2_check").removeClass("fa-times-circle").removeClass("color-orenge").addClass("fa-check").addClass("color-light-green");
$("#user_password_2_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check").addClass("color-light-green");
$passwd_2_correct = true;
}
else {
$('#user_password_2_notice').html('<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>');
$('#user_password_2_notice').parent().show();
$("#user_password_2_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orenge");
$("#user_password_2_check").removeClass("fa-check").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$passwd_2_correct = false;
}
});

View File

@ -0,0 +1,6 @@
<div class="tabs">
<ul>
<li><%= link_to '未审批', {:action => 'applied_departments'}, class: "#{current_page?(unapplied_departments_path)? 'selected' : nil }" %></li>
<li><%= link_to '已审批', {:action => 'has_applied_departments'}, class: "#{current_page?(applied_departments_path)? 'selected' : nil }" %></li>
</ul>
</div>

View File

@ -0,0 +1,94 @@
<h3>
<%=l(:label_applied_departments)%>
</h3>
<%= render 'tab_applied_departments' %>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
部门名称:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入部门名称进行搜索' %>
<%= submit_tag l(:button_apply ), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'applied_departments'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll" id = "applied_school">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 20px;">
序号
</th>
<th style="width: 100px;">
部门名称
</th>
<th style="width: 105px;">
单位名称
</th>
<th style="width: 70px;">
申请者
</th>
<th style="width: 30px;">
用户
</th>
<th style="width: 60px;">
创建时间
</th>
<th style="width: 75px;">
操作
</th>
</tr>
</thead>
<tbody>
<% @apply_status.each do |apply| %>
<% if apply.status == 0 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= apply.id %>
</td>
<td class="name" title='<%=apply.name%>' >
<%= apply.name %>
</td>
<td class="name" title='<%=apply.school.name%>' >
<%= apply.school.name %>
</td>
<td class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
<% end %>
</td>
<td class="center">
<% count = UserExtensions.where("department_id = #{apply.department_id}").count %>
<%= count %>
</td>
<td class="center">
<%= format_date(apply.created_at) %>
</td>
<td class="center">
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_departments', :id => apply.id }, :class => "application-default-link" ) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_departments', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
</td>
</tr>
<% unless apply.remarks.blank? %>
<tr class="odd">
<td>
</td>
<td style="text-align: left;" colspan="7">
<%= apply.remarks %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @apply_pages, @apply_count ,:per_page_links => true, :remote => false, :flag => true %>
</ul>

View File

@ -0,0 +1,83 @@
<h3>
<%=l(:label_applied_departments)%>
</h3>
<%= render 'tab_applied_departments' %>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
部门名称:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入部门名称进行搜索' %>
<%= submit_tag l(:button_apply ), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'has_applied_departments'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 20px;">
序号
</th>
<th style="width: 100px;">
部门名称
</th>
<th style="width: 105px;">
单位名称
</th>
<th style="width: 70px;">
申请者
</th>
<th style="width: 30px;">
用户
</th>
<th style="width: 60px;">
创建时间
</th>
<th style="width: 75px;">
操作
</th>
</tr>
</thead>
<tbody>
<% @has_apply_status.each do |apply| %>
<% if apply.status == 1 || apply.status == 2%>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= apply.id %>
</td>
<td class="name" title='<%=apply.name%>' >
<%= apply.name %>
</td>
<td class="center">
<%= apply.school.name %>
</td>
<td class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
<% end %>
</td>
<td class="center">
<% count = UserExtensions.where("department_id = #{apply.department_id}").count %>
<%= count %>
</td>
<td class="center">
<%= format_date(apply.created_at) %>
</td>
<td class="center">
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @has_apply_pages, @has_apply_count ,:per_page_links => true, :remote => false, :flag => true %>
</ul>

View File

@ -2,7 +2,10 @@
var imgSpan = $("img[nhname='avatar_image']");
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% else %>
var imgSpan = jQuery('#avatar_image');
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% if @source_type=='User' %>
var imgSpan = jQuery('#nh_user_logo');
<% else %>
var imgSpan = jQuery('#avatar_image');
<% end %>
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% end %>

View File

@ -1,35 +1,33 @@
<div id="sy_popup_box" style="width:460px;">
<div class="sy_popup_top">
<h3 class="fl">欢迎加入班级</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
<div class="task-popup" style="width:460px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
<h3 class="fl ">欢迎加入班级</h3>
<a href="javascript:void(0);" onclick="hideModal()"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="sy_popup_con">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<ul class="sy_popup_add ">
<li>
<label>班级邀请码:</label>
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
<div class="cl"></div>
</li>
<li>
<label>身份:</label>
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml5 mr5 "/><span class="mr10">教师</span>
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
<div class="cl"></div>
</li>
<p id="none_checked_notice" class="c_red none f12" style="margin-left: 42px;">请至少选择一个身份</p>
<li class="mt10">
<label>&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="submit_join_course();">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
<% end %>
<div class="task_popup_con mt15 ml30">
<div class="panel-form mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<ul>
<li class="clearfix">
<label class="panel-form-label fl">班级邀请码:</label>
<input type="text" class="task-form-60 task-height-40 panel-box-sizing fl" name="invite_code" placeholder="请输入五位班级邀请码">
</li>
<li class="clearfix">
<label class="panel-form-label">身份:</label>
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml-3 mr5 "/><span class="mr10">教师</span>
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
</li>
<p id="none_checked_notice" class="color-red none f12" style="margin-left: 54px;">请至少选择一个身份</p>
<li class="clearfix mt10">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr mr60" onclick="submit_join_course();">确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hideModal()">取消</a>
</li>
</ul>
<% end %>
</div>
</div>
</div>
<script>
function submit_join_course(){
if ($("input[name='role[]']:checked").length >= 1){

View File

@ -3,90 +3,36 @@
<%# end %>
<% if @state %>
<% if @state == 0 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box_redirect("<%=course_path(@course.id) %>", "加入成功");
<% elsif @state == 1 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("确定");
<% elsif @state == 2 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)");
<% elsif @state == 3 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box_redirect("<%=course_path(@course.id) %>", "您已经加入了班级");
<% elsif @state == 4 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("您输入的邀请码错误");
<% elsif @state == 5 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("您还未登录");
<% elsif @state == 6 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("申请成功,请等待审核");
<% elsif @state == 7%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("您已经发送过申请了,请耐心等待");
<% elsif @state == 8%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box_redirect("<%=course_path(@course.id) %>", "您已经是该班级的教师了");
<% elsif @state == 9%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box_redirect("<%=course_path(@course.id) %>", "您已经是该班级的教辅了");
<% elsif @state == 10%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box_redirect("<%=course_path(@course.id) %>", "您已经是该班级的管理员了");
<% elsif @state == 11%>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">该班级已归档,请联系老师</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("该班级已归档,请联系老师");
<% elsif @state == 12 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("您已经发送过申请了,请耐心等待");
<% elsif @state == 13 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("申请成功,请等待审核");
<% elsif @state == 14 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">此邀请码已停用,请与老师联系</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("此邀请码已停用,请与老师联系");
<% else %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
notice_box("未知错误,请稍后再试");
<% end %>
<% end %>
function refresh_current_course(){
hideModal();
<% if @course %>
window.location.href= "<%=course_path(@course.id) %>";
<% end %>
}
<% end %>

View File

@ -1,4 +1,4 @@
<span class="mt10 -flex c_grey ml15">耗时:<%= game_spend_time(@game.open_time, @game.updated_at) %></span>
<span class="mt10 -flex c_grey ml15" id="time-consuming">耗时:<%= @consume_time %></span>
<div id="code_estimate">
<% if @game.status == 0 %>
<a href="javascript:void(0)" class="task-btn task-btn-blue mr15 mt8" id="code_test" onclick="training_task_submmit();">评测</a>
@ -17,6 +17,7 @@
</div>
<script>
function training_task_submmit(){
$('#file_update_id').submit();
var i = 0;
//$("#ajax-indicator").show();
$("#code_estimate").html("<a class='task-btn mb10 mt6 mr15'>评测中..</a>");
@ -53,7 +54,7 @@
test_sets_count: data.test_sets_count,
test_sets_hidden_count: data.test_sets_hidden_count,
final_score: data.final_score,
had_passed_testsests: data.had_passed_testsests,
passed_teststest: data.had_passed_testsests,
latest_output: data.latest_output,
game_outputs_count: data.had_tested
});
@ -62,6 +63,7 @@
if(data.status == 2){
console.log("####");
console.log(data);
$("#time-consuming").html('耗时:'+data.consume_time);
if( data.had_done == 0 ) {
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='code_test' data-remote='true'>下 一 步</a>");
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";

View File

@ -1,161 +1,95 @@
<div class="header_con">
<div class="header_con clearfix">
<div class="fl clearfix new-logo">
<%= link_to image_tag("../images/bigdata/bigdata-logo.png",width:"51px", height: "45px", alt:"高校智能化教学与实训平台", class:"fl "), home_path %>
<%= link_to image_tag("../images/bigdata/bigdata-logo.png",width:"45px", height: "45px", alt:"高校教育大数据服务平台", class:"fl "), home_path %>
</div>
<ul class="fr inner-nav-user" id="my_account_info">
<li>
<img src="/images/inner/male.jpg" width="45" height="45" class="inner-nav-user-img"alt="高校智能化教学与实训平台"></a>
<font></font>
<ul class="my_account_info" id="my_account_info_ul">
<font></font>
<ul class="mt5 mb5">
<li class="li_bottom_border hidden" style="max-width: 150px;"><span style="color: #888;">当前账号:<span style="font-weight: bold;color: #888;"><%= User.current.show_name %></span></span></li>
<li><%= link_to "我 的 主 页", user_path(User.current), :class => "menuGreyNew" %></li>
<li><%= link_to '我 的 课 程',{:controller => "users", :action => "user_courselist", :id => User.current}, :class => "menuGreyNew" %></li>
<li><%= link_to '我 的 项 目', {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "menuGreyNew" %></li>
<li class="li_bottom_border"><%= link_to '我 的 竞 赛', {:controller => "users", :action => "user_contestlist", :id => @user}, :id => 'user_contest_list', :class => "menuGreyNew" %></li>
<li><%= link_to "修 改 资 料", my_account_path, :class => "menuGreyNew"%></li>
<li><%= link_to "退 出",logout_url_without_domain,:class => "menuGreyNew",:method => "post", :id => "logout_trustie" %></li>
</ul>
<div class="header-search fl mt10 ml15 mr15">
<dropdown class="fl">
<input id="toggle2" type="checkbox" name="search_type" value="1">
<label for="toggle2" class="animate" id="all_status_show"><font id="all_status_show_value">课程</font><i class="fa fa-sort-down fr mt3"></i></label>
<ul class="animate" id="all_status" style="display: none;">
<li class="animate">课程</li>
<li class="animate">班级</li>
<li class="animate">实训</li>
<li class="animate">问答</li>
<li class="animate">用户</li>
<li class="animate">资源</li>
</ul>
</li>
</dropdown>
</ul>
<ul class="fr inner-nav-mes" id="user_messages">
<li>
<i class="fa fa-bell" onclick="window.location.href='<%= user_path(User.current) %>'" style="cursor: pointer;"></i>
<% new_message_count = User.current.count_new_message.to_i %>
<% if new_message_count > 0 %>
<span class="inner-nav-cir"><%= new_message_count %></span>
<% end %>
<div class="shadowbox_news" id="user_messages_list">
<%= render :partial => 'layouts/message_loading' %>
</div>
</li>
</ul>
<div id="navHomepageSearch">
<% name = name%>
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name %>" id="navHomepageSearchInput" class="new-search fl ml10 mr10" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<!--<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>-->
<% end %>
<input type="text" placeholder="请输入关键词进行搜索" class="header-search-input fl">
<a href="#"><i class="fa fa-search font-16 mt8 mr10"></i></a>
</div>
<!--<input type="text" placeholder="请输入关键词进行搜索" class="new-search fl ml15 mr10">-->
<ul class="fl innner-nav">
<li>
<%= link_to "课程", user_course_community_path(User.current), :class => "new-nav-a", :target => "_blank" %>
</li>
<li>
<%= link_to "项目", user_project_community_path(User.current), :class => "new-nav-a", :target => "_blank" %>
</li>
<li>
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "new-nav-a", :target => "_blank" %>
</li>
<!--<li>-->
<!--<%#= link_to "智能实训", user_shixuns_user_path(User.current), :class => "new-nav-a", :target => "_blank" %>-->
<!--</li>-->
<li>
<%= link_to "问吧", forums_path, :class =>"new-nav-a", :target => "_blank" %>
</li>
<li><%= link_to "智能课堂", user_course_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
<li><%= link_to "游戏实训", user_project_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
<li><%= link_to "有问有答", forums_path, :class =>"new-nav-a", :target => "_blank" %></li>
<li><%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "new-nav-a", :target=>"_blank" %></li>
<div class="cl"></div>
</ul>
</div>
<ul class="fr inner-nav-user">
<li>
<%= link_to image_tag(url_to_avatar(User.current), :width =>"45", :height => "45", :class => "inner-nav-user-img fl", :alt=>"头像", :id => "nh_user_logo"),user_path(User.current)%>
<i class="fa fa-sort-down fl color_white mt10 ml5"></i>
<div class="cl"></div>
</li>
<div class="task-user-dropdown">
<font></font>
<ul class="task-user-dropdown-nav">
<li><%= link_to User.current.show_name, user_path(User.current), :class => "task-index-name task-hide" %></li>
<li class="task-line"></li>
<li><%= link_to '我的主页', user_path(User.current) %></li>
<li><%= link_to '我的课程', {:controller => "users", :action => "user_courselist", :id => User.current} %></li>
<li><%= link_to '我的实训', {:controller => "users", :action => "user_projectlist", :id => @user} %></li>
<li><%= link_to '待办任务', "" %></li>
<li class="task-line"></li>
<li><%= link_to '修改资料', my_account_path %></li>
<li><%= link_to '退出', logout_url_without_domain %></li>
</ul>
</div>
</ul>
<a href="#" class="fr inner-nav-mes mt10" style="color:#fff;">
<li class="fl">
<i class="fa fa-bell "></i>
<span class="inner-nav-cir">0</span>
</li>
</a>
</div>
<script type="text/javascript">
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
var name = $.trim($('#navHomepageSearchInput').val());
if (e.keyCode == '13' && name != "" && name.length != 0) {
//$('#type').val($('input[type=radio]:checked').val());
$(this).parent().submit();
}
})
});
function search_in_header(obj){
var name = $.trim($('#navHomepageSearchInput').val());
if (name != "" && name.length != 0) {
//$('#type').val($('input[type=radio]:checked').val());
obj.parent().submit();
}
}
var onUserMessages = false;
var onNotice = false;
//搜索相关
$("#navHomepageSearch").mouseover(function(){
$("#navHomepageSearchType").show();
}).mouseout(function(){
$("#navHomepageSearchType").hide();
});
<% unless @force %>
$("#user_messages").mouseenter(function(){
onNotice = true;
$("#user_messages_list").show();
if($("#message_list_detail").length == 0){
$.get('<%=user_messages_unviewed_users_path %>');
$("#ajax-indicator").hide();
<script>
$(function() {
var oUl = document.getElementById("all_status");
var oUt = document.getElementById("all_status_show");
oUl.onclick = function (ev) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
if (target.nodeName.toLowerCase() == 'li') {
$("#all_status_show_value").html($(target).html());
$(oUl).hide();
switch ($(target).html()){
case '课程':
$("#toggle2").val('1');
break;
case '班级':
$("#toggle2").val('2');
break;
case '实训':
$("#toggle2").val('3');
break;
case '问答':
$("#toggle2").val('4');
break;
case '用户':
$("#toggle2").val('5');
break;
case '资源':
$("#toggle2").val('6');
break;
}
}
}
oUt.onclick = function (ev) {
$(oUl).toggle();
}
var obj = $("#user_messages_list");
clearTimeout(obj.timer);
}).mouseleave(function(){
onNotice = false;
var obj = $("#user_messages_list");
setTimeout(function(){
if(!onNotice && !onUserMessages) {
obj.hide();
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
} }, 500);
});
<% end %>
$("#message_list_detail").mouseenter(function(event){
event.stopPropagation();
onUserMessages = true;
}).mouseleave(function(){
onUserMessages = false;
});
var onUserAccount = false;
var onNoticeAccount = false;
$("#my_account_info").mouseenter(function(){
onNoticeAccount = true;
$("#my_account_info_ul").show();
var obj = $("#my_account_info_ul");
clearTimeout(obj.timer);
}).mouseleave(function(){
onNoticeAccount = false;
var obj = $("#my_account_info_ul");
setTimeout(function(){
if(!onNoticeAccount && !onUserAccount) {
obj.hide();
} }, 500);
});
$("#my_account_info_ul").mouseenter(function(event){
event.stopPropagation();
onUserAccount = true;
}).mouseleave(function(){
onUserAccount = false;
});
$("#navHomepageProfile").mouseenter(function(){
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
$("#topnav_login_list").show();
});
$("#navHomepageProfile").mouseleave(function(){
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
$("#topnav_login_list").hide();
});
function signout(){
$.post(
'<%= signout_path%>',
{}
);
}
</script>
</script>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>

View File

@ -19,7 +19,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','css/syllabus', 'css/moduel', 'css/font-awesome','css/contest' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','css/syllabus', 'css/moduel', 'css/font-awesome','css/contest' %>
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome', 'css/bigdata-common', "css/bigdata-public", "css/bigdata-user", 'css/bigdata-popup', 'css/magic-check', :media => 'all' %>
<%= javascript_heads %>
<%= javascript_include_tag "bigdata/application","bigdata/account"%>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<div class="header">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div id="Container" class="panel-content clearfix">
<div class="panel-user-left fl">
<ul class="panel-user-leftnav">
<h3 class="mb15 ml15 mt15">账户管理</h3>
<li><a href="<%= my_account_path %>" id="account_setting_1">基本资料</a></li>
<li><a href="<%= avatar_account_path %>" id="account_setting_2">修改头像</a></li>
<!--<li><a href="<%#= authentication_account_path %>" id="account_setting_3">身份认证</a></li>-->
<li><a href="<%= security_settings_path %>" id="account_setting_4">安全设置</a></li>
<li><a href="<%= change_psd_path %>" id="account_setting_5">修改密码</a></li>
</ul>
</div>
<div class="panel-user-right fl panel-box-sizing">
<%= yield %>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
</body>
</html>
<script type="text/javascript" charset="utf-8">
$(function(){
$("#account_setting_<%= @setting_type %>").addClass("active");
});
</script>

View File

@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome', 'css/bigdata-common', "css/bigdata-public", "css/bigdata-user", 'css/bigdata-popup', :media => 'all' %>
<%= javascript_heads %>
<%= javascript_include_tag "bigdata/application","bigdata/user"%>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<div class="header">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div id="Container">
<%= yield %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
</body>
</html>

View File

@ -11,7 +11,7 @@
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup', 'css/font-awesome','css/moduel', 'css/font-awesome', :media => 'all'%>
<%= stylesheet_link_tag 'css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common','css/structure','css/public','css/forum','css/popup', 'css/font-awesome','css/moduel', 'css/font-awesome', :media => 'all'%>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>

View File

@ -9,7 +9,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -9,14 +9,16 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/bigdata-common','css/bigdata-public', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/bigdata-tooltipster' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common', 'css/taskstyle', 'css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome', 'css/bigdata-tooltipster' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body onload="prettyPrint();">
<div class="navContainer"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="header">
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
</div>
<div id="shixun_top">
<%= render :partial => 'shixuns/shixun_top' %>
</div>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','css/syllabus','sy_public','css/moduel', 'css/font-awesome',:media => 'all'%>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common','css/public','css/structure','css/courses','css/popup','prettify','css/syllabus','css/sy_public','css/moduel', 'css/font-awesome',:media => 'all'%>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'css/bigdata-showpage', 'css/font-awesome', 'css/bigdata-common', 'css/bigdata-login', 'css/bigdata-popup' %>
<%= stylesheet_link_tag 'css/bigdata-showpage', 'css/font-awesome', 'css/bigdata-common', 'css/bigdata-login', 'css/bigdata-public', 'css/bigdata-popup' %>
<%#= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap", "bigdata" %>
<%= javascript_include_tag "bootstrap", "bigdata", 'bigdata/application' %>
</head>
<body>
<% if @welcome %>

View File

@ -14,7 +14,7 @@
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'css/common','css/structure', 'css/public', 'css/courses','prettify', 'css/org', 'css/syllabus', 'css/font-awesome' %>
<%= javascript_include_tag "course","header",'prettify','contest' %>
<%= javascript_include_tag "course","header",'prettify','contest','bigdata/syllabus' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user','css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/bigdata-popup','css/bigdata-common', "css/bigdata-public",'css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user','css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>

View File

@ -0,0 +1,67 @@
<html>
<head>
<meta charset="utf-8">
<title>邮箱验证码发送</title>
<style type="text/css">
/* 邮箱验证链接页面 */
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#eaebec;}
div,img,tr,td,table{ border:0;}
table,tr,td{border:0;}
ol,ul,li{ list-style-type:none}
.new_content{ background:#fff; width: 100%;}
.email-page-link{ }
.email-link-top{ }
.c_white{ color:#fff;}
.email-link-con{ }
.email-link-line{ }
.email-link-footer{ padding:15px; color:#333; line-height: 1.9; }
.c_grey02{ color: #888;}
.fb{ font-weight: normal;}
.f14{ }
</style>
</head>
<body style="background:#fff;">
<div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="bdweb.trustie.net" >
<img src="http://bdweb.trustie.org/images/bigdata/new-logo.png?1485311929" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">高校大数据教育平台</p>
</a>
<div style="clear:both; overflow:hidden;"></div>
</div>
<div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:50px 20px; color:#333; line-height: 1.9;">
<p style="color:#333; font-size:16px; margin-bottom:15px;">
亲爱的<span style="font-weight:bold;color:#3b94d6; margin-left:5px; margin-right:5px;"><%= @login %></span>,您好!
</p>
<p style="color:#333;">
您的绑定验证码如下,请在<span style=" color:#e72c37;"> 10 分钟</span>内在邮箱绑定页输入此验证码,并进行下一步操作。
</p>
<div style="text-align: center;">
<div style="display:block; height: 45px; line-height:45px;padding:0 30px; width:100px; font-size: 20px; font-weight: bold; background:#ffd9d9; color:#e72c37; margin:30px auto;">
<p><%= @code %></p>
</div>
<span style="font-weight: normal;color:#666;">
此邮件为系统所发,请勿直接回复。<br/>
要解决问题或了解您的帐户详情,您可以访问 <a href="http://bdweb.trustie.org/forums/1/memos/1168" style="font-weight: normal; color:#3b94d6;">帮助中心</a>。
</span>
</div>
<p style="color:#666; margin-top:30px;">
如果您并未发过此请求,则可能是因为其他用户在绑定邮箱时误输了您的邮件地址,而使您收到了这封邮件,那么您可以放心的忽略此邮件,无需进一步采取任何操作。
</p>
</div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="http://bdweb.trustie.org/" style="font-weight: normal; color:#fff;">bdweb.trustie.org</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,2 @@
<%= l(:mail_subject_bind_mail) %>
<%= @url %>

View File

@ -28,8 +28,8 @@
<div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="www.trustie.net" >
<img src="http://www.trustie.org/images/bigdata/new-logo.png?1485311929" width="45" height="45" style=" float:left;" >
<a href="bdweb.trustie.net" >
<img src="http://bdweb.trustie.org/images/bigdata/new-logo.png?1485311929" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">高校大数据教育平台</p>
</a>
<div style="clear:both; overflow:hidden;"></div>
@ -42,13 +42,13 @@
您此次找回密码的验证码如下,请在<span style=" color:#e72c37;"> 10 分钟</span>内在找回密码页输入此验证码,并进行下一步操作。
如非你本人操作,请忽略此邮件。<br/>
</p>
<div style="text-align: center;">
<div style="text-align: center;">
<div style="display:block; height: 45px; line-height:45px;padding:0 30px; width:100px; font-size: 20px; font-weight: bold; background:#ffd9d9; color:#e72c37; margin:30px auto;">
<p><%= @code %></p>
</div>
<span style="font-weight: normal;color:#666;">
此邮件为系统所发,请勿直接回复。<br/>
要解决问题或了解您的帐户详情,您可以访问 <a href="http://www.trustie.org/forums/1/memos/1168" style="font-weight: normal; color:#3b94d6;">帮助中心</a>。
要解决问题或了解您的帐户详情,您可以访问 <a href="http://bdweb.trustie.org/forums/1/memos/1168" style="font-weight: normal; color:#3b94d6;">帮助中心</a>。
</span>
</div>
<p style="color:#666; margin-top:30px;">
@ -56,7 +56,7 @@
</p>
</div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="http://www.trustie.org/" style="font-weight: normal; color:#fff;">www.trustie.org</a>
<a href="http://bdweb.trustie.org/" style="font-weight: normal; color:#fff;">bdweb.trustie.org</a>
</div>
</div>
</div>

View File

View File

@ -0,0 +1,690 @@
<% if @force %>
<% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %>
<% unless message.nil? %>
<div class="homepageRightBanner">
<div class="polls_head" style="font-size:8px;">&nbsp;&nbsp;消息:&nbsp;&nbsp;您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!</div>
<% message.update_attribute(:viewed, true)%>
</div>
<% end %>
<div class="alert alert-orange mb10 mt10" >
<div>&nbsp;&nbsp;提示:&nbsp;&nbsp;您尚未完善您的基本资料,完善后可使用更多功能</div>
</div>
<% end %>
<div id="RSide" style="margin-left:0px; margin-bottom:0px; width:728px;">
<div id="users_tb_" class="users_tb_">
<ul>
<li id="users_tb_1" class="users_hovertab" onclick="x:HoverLi(1);">基本资料</li>
<li id="users_tb_2" class="users_normaltab" onclick="i:HoverLi(2);">密码管理</li>
</ul>
</div><!--tb_ end-->
<div class="cl"></div>
<div class="users_ctt">
<%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %>
<div class="users_dis" id="users_tbc_01">
<% if( @act.nil? || @act != 'password') %>
<%= render_flash_messages %>
<%= error_messages_for 'user',@user.user_extensions %>
<% end %>
<ul class="setting_left">
<li><span style="color:red;">*</span>&nbsp;&nbsp;登录名&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;邮箱&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;职业&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;姓名&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;单位名称&nbsp;:&nbsp;</li>
<li>地区&nbsp;:&nbsp;</li>
<!--<li>邮件通知&nbsp;:&nbsp;</li>-->
<!--<li>个人签名&nbsp;:&nbsp;</li>-->
<li>个人主页&nbsp;:&nbsp;</li>
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
<li>
<%= f.text_field :login,
:no_label => true,
:required => true,
:style => "color:grey",
:nh_required => "1",
:name => "login",
:class => "w210"
%>
</li>
<% if @force %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%></li>
<% else %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<% end %>
<li>
<select onchange="showtechnical_title(this.value);" required = "true" nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<option value="-1">
<%= l(:label_account_identity_choose) %>
</option>
<option value="0">
<%= l(:label_account_identity_teacher) %>
</option>
<option value="1">
<%= l(:label_account_identity_student) %>
</option>
<option value="3">
<%= l(:label_account_identity_developer) %>
</option>
</select>
<select nhname="tag_1" nh_tag_0="true" name="technical_title" id="userTechnical_title" class="w70" style='display:none;height:28px;'>
<option value="教授">教授</option>
<option value="副教授">副教授</option>
<option value="讲师">讲师</option>
<option value="助教">助教</option>
</select>
<span nhname="tag_1" nh_tag_1="true" style='display:none;'>
<% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style => "width:127px;" %>
<% else %>
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID), :style => "60px" %></span>
<% end %>
</span>
<span id="identity_hint" style="display: none"></span>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
<input type="radio" id="sex" value="0" name="sex" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" checked="checked" class="fl "><label class="fl ">女</label>
<% else %>
<input type="radio" id="sex" value="0" name="sex" checked="checked" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" class="fl "><label class="fl ">女</label>
<% end %>
<select style = "display: none;" class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<!-- 基本资料页面单位审核显示 -->
<% if User.current.user_extensions.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<!-- 从业者选择单位名称 -->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<% if User.current.user_extensions.school_id.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.try(:id) %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<% end %>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" value="<%= User.current.user_extensions.school %>" />
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<% end %>
</li>
<li>
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location" style="height:28px;margin-left:2px;">
<option value="">--请选择省份--</option>
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="广东">广东</option>
<option value="江苏">江苏</option>
<option value="浙江">浙江</option>
<option value="重庆">重庆</option>
<option value="安徽">安徽</option>
<option value="福建">福建</option>
<option value="甘肃">甘肃</option>
<option value="广西">广西</option>
<option value="贵州">贵州</option>
<option value="海南">海南</option>
<option value="河北">河北</option>
<option value="黑龙江">黑龙江</option>
<option value="河南">河南</option>
<option value="湖北">湖北</option>
<option value="湖南">湖南</option>
<option value="江西">江西</option>
<option value="吉林">吉林</option>
<option value="辽宁">辽宁</option>
<option value="内蒙古">内蒙古</option>
<option value="宁夏">宁夏</option>
<option value="青海">青海</option>
<option value="山东">山东</option>
<option value="山西">山西</option>
<option value="陕西">陕西</option>
<option value="四川">四川</option>
<option value="天津">天津</option>
<option value="新疆">新疆</option>
<option value="西藏">西藏</option>
<option value="云南">云南</option>
<option value="香港">香港特别行政区</option>
<option value="澳门">澳门特别行政区</option>
<option value="台湾">台湾</option>
<option value="海外">海外</option>
</select>
<select name="city" id="userCity" class="location" style="height:28px;"></select>
</li>
<!-- <li>
<%#= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label class="ml10"><%#= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified], :style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
</li> -->
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
<li style="height:auto;">
<% if @user.homepage && !@user.homepage.article_homepages.empty? %>
<% if @user.base_homepage %>
<%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %>
<% else %>
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
<% end %>
<% else %>
<p class="nodata" style="height: 22px; font-size: 14px; text-align: left; line-height: 20px;">您还没有创建属于自己的个人主页。
<% if user_data_complete @user %>
<%= link_to '新建', new_user_homepage_article_homepage_path(:user_id => @user.id,
:homepage_id => @user.homepage.id),
:onclick=>"my_account_form_submit();",
:target => "_blank",
:class => 'linkBlue' %>
<% end %>
</p>
<% end %>
<!--<textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea>-->
</li>
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
<li class="ml2">
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" onclick="my_account_form_submit();" style="background: #3b94d6; padding: 0 25px;">确定</a>
<input type="submit" id="my_account_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
</li>
</ul>
<div class="cl"></div>
</div><!--tbc_01 end-->
<% end %>
<%= form_tag({:action => "password"},:id => 'my_password_form') do %>
<div class="users_undis" id="users_tbc_02">
<% if( !@act.nil? && @act == 'password') %>
<%= render_flash_messages %>
<%= error_messages_for 'user' %>
<% end %>
<ul class="setting_left">
<li>原始密码&nbsp;:&nbsp;</li>
<li>新密码&nbsp;:&nbsp;</li>
<li>确认密码&nbsp;:&nbsp;</li>
</ul>
<ul class="setting_right ">
<input style="display:none;">
<li><input id="password" name="password" autocomplete="off" class="w210" type="password" required="true" nh_required="1"></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">
<a href="javascript:;" id="my_password_form_link" class="blue_btn fl">确认</a>
<input type="submit" id="my_password_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
</li>
</ul>
<div class="cl"></div>
</div><!--tbc_02 end-->
<div class="cl"></div>
<% end %>
</div><!--ctt end-->
<!--users_setting end-->
</div>
<div id="search_school_result_list" style="width: 205px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div id="WOpenWindow">
<a class="modal_close" href="#"></a>
<h2 style="margin: 10px"><%= l(:lable_school_list)%></h2>
&nbsp;&nbsp;
<div class="pcontent">
<ul id="provincelist" class="school_list">
<% @ss = School.find_by_sql("select distinct province from schools") %>
<% @ss.each do |s| %>
<li style="width: 15%; float: left;">
<a style="cursor: pointer;" onclick="get_options('<%= s.province %>')"><%= s.province %>
</a>
</li>
<% end %>
</ul>
</div>
<div class="content" style="font-size: 13px">
<ul id="schoollist" class="school_list">
</ul>
</div>
</div>
<%= stylesheet_link_tag 'nyan' %>
<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %>
<% if !User.current.user_extensions.nil? %>
<% province = User.current.user_extensions.location %>
<% city = User.current.user_extensions.location_city %>
<% identity = User.current.user_extensions.identity %>
<% occupation1 = User.current.user_extensions.occupation %>
<% occupation = User.current.user_extensions.occupation %>
<% title = User.current.user_extensions.technical_title %>
<% gender = User.current.user_extensions.gender %>
<% language = User.current.language %>
<% else %>
<% province = "湖南省" %>
<% city = "长沙"%>
<% identity = ""%>
<% occupation1 = ""%>
<% title = "" %>
<% language = ""%>
<% end %>
<script type="text/javascript">
function showtechnical_title(val){
$("*[nhname='tag_1']").each(function(){
$("*[nh_required='1']",$(this)).attr("required",false);
$(this).hide()
});
$("*[nh_tag_"+val+"='true']").each(function(){
$("*[nh_required='1']",$(this)).attr("required",true);
$(this).show()
});
$("#identity_hint").hide();
}
function init_identity_and_title(pField, identity, cField, title, language) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == identity) {
pField.selectedIndex = i;
}
}
showtechnical_title(identity, cField);
if(language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
break;
case 'Associate professor' :
title1 = '副教授';
break;
case 'Lecturer' :
title1 = '讲师';
break;
case 'Teaching assistant' :
title1 = '助教';
break;
default :
title1 = title;
break;
}
}
else {
switch (title) {
case '教授' :
title1 = 'Professor';
break;
case '副教授' :
title1 = 'Associate professor';
break;
case '讲师' :
title1 = 'Lecturer';
break;
case '助教' :
title1 = 'Teaching assistant';
break;
default :
title1 = title;
break;
}
}
for (var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value == title1) {
cField.selectedIndex = i;
}
}
}
function get_options(value) {
var prefix = "";
if(location.href.indexOf('ros')>=0)
{
prefix = "/ros"
}
$.ajax({
type: "POST",
url: prefix + '/school/get_options/' + encodeURIComponent(value),
data: 'text',
success: function (data) {
$("#province").val(value);
$("#schoollist").html(data);
}
});
}
function test(id, name) {
//$("#occupation").html("<option value='"+id+"'>"+name+"</option>");
$("#occupation").val(id);
$("#occupation_name").val(name);
$("#lean_overlay").hide();
$("#WOpenWindow").hide();
}
function init_province_and_city(pField, province, cField, city) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == province) {
pField.selectedIndex = i;
}
}
showcity(province, cField);
for (var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value == city) {
cField.selectedIndex = i;
}
}
}
function init_gender(pField, gender) {
for (var i=0; i<pField.options.length; i++) {
if (pField.options[i].value == gender) {
pField.selectedIndex = i;
}
}
}
function changeValue(value,data){
//console.log(value+","+data)
$("input[name='province']").val(value);
$("input[name='occupation']").val(data);
$("#search_school_result_list").hide();
$("#hint").hide();
$("#errortip").hide();
}
function apply_add_school(){
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
pop_up_box(htmlvalue,580,20,48);
$("#schoolname").val($("input[name='province']").val());
}
function add_school(name){
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name,
type: 'post',
success: function (data) {
}
});
}
var lastSearchCondition = '';
var page = 1; //唯一控制页码 变量
var count = 0; //查询结果的总量
var maxPage = 0 ;//最大页面值
$(function() {
$("#search_school_result_list").scroll(function(e){
nScrollHight = $(this)[0].scrollHeight;
nScrollTop = $(this)[0].scrollTop;
var nDivHight = $(this).height();
if(nScrollTop + nDivHight >= nScrollHight) //到底部了,
{
//判断页码是否是最大值,如果是的,就不去请求了
if(page >= maxPage){
return;
}else{ //如果不是,那就请求下一页,请求数据处理
page ++;
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + $("input[name='province']").val() + '&page=' + page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
if (schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
} else {
}
}
});
}
}
});
//查询学校
$("input[name='province']").on('input', function (e) {
throttle(shcool_search_fn,window,e);
});
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
function shcool_search_fn(e){
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){//如果输入框没有改变或者输入框为空就返回
return;
}
$("input[name='occupation']").val(''); //一旦有输入就清空id。
lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
$("#hint").hide();
$("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
}
}
});
}
$(document.body).click(function(e){
if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province')
{
$("#search_school_result_list").hide();
$("#errortip").hide();
}
});
$("input[name='province']").on('focus', function (e) {
if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
return;
}
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
$("#hint").hide();
$("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
}
}
});
});
// $("#province").leanModal({top: 100, closeButton: ".modal_close"});
//地区
var province = "<%= "#{province}" %>"
var city = "<%= "#{city}" %>"
init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
//select
var identity = "<%= "#{identity}" %>"
var title = "<%= "#{title}" %>"
var language = "<%= "#{language}" %>"
var occupation1 = "<%= "#{occupation}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
//sex
var gender = "<%= "#{gender}" %>"
init_gender(document.getElementById('gender'), gender);
$("#userIdentity").change();
<% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click();
<% end %>
// $('#my_account_form_link').on("click",(function(e){
// //$('#my_account_form_link').click(function(e){
// if($("#userIdentity").val() == -1 ) {
// $("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
// e.stopImmediatePropagation();
// return;
// }
// if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
// $("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
// e.stopImmediatePropagation();
// return;
// }
//
// //姓名不能为空
// if( $("#lastname").val() == '' ){
// $("#lastname").focus();
// $("#last_name_notice").show();
// e.stopImmediatePropagation();
// return;
// }
//
// if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
// $("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
// e.stopImmediatePropagation();
// return;
// }
//
// if($("#no").is(":visible") == true && $("#no").val() == ""){
// $("#no").focus();
// e.stopImmediatePropagation();
// return;
// }
//
// $('#my_account_form').submit();
// }));
$('#my_password_form_link').click(function(){
$('#my_password_form_btn').click();
});
});
// 基本资料页面提交表单时,判断身份与单位是否合法
function my_account_form_submit(){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation(); // 阻止事件冒泡
return;
}
// 单位或高校必须从下拉列表中选择
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();
return;
}
//姓名不能为空
if( $("#lastname").val() == '' ){
$("#lastname").focus();
$("#last_name_notice").show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
$("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
e.stopImmediatePropagation();
return;
}
if($("#no").is(":visible") == true && $("#no").val() == ""){
$("#no").focus();
e.stopImmediatePropagation();
return;
}
$('#my_account_form').submit();
}
$("#province").blur(function(){
if($(this).val() == ""){
$(this).attr("placeholder","--请搜索您所在的高校(单位)--");
}
})
</script>
<script type="text/javascript">
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){g('users_tb_'+i).className='users_normaltab';g('users_tbc_0'+i).className='users_undis';}g('users_tbc_0'+n).className='users_dis';g('users_tb_'+n).className='users_hovertab';
}
</script>

View File

@ -1,149 +1,84 @@
<% if @force %>
<% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %>
<% unless message.nil? %>
<div class="homepageRightBanner">
<div class="polls_head" style="font-size:8px;">&nbsp;&nbsp;消息:&nbsp;&nbsp;您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!</div>
<% message.update_attribute(:viewed, true)%>
</div>
<% end %>
<div class="alert alert-orange mb10 mt10" >
<div >&nbsp;&nbsp;提示:&nbsp;&nbsp;您尚未完善您的基本资料,完善后可使用更多功能</div>
</div>
<% end %>
<div id="RSide" style="margin-left:0px; margin-bottom:0px; width:728px;">
<div id="users_tb_" class="users_tb_">
<ul>
<li id="users_tb_1" class="users_hovertab" onclick="x:HoverLi(1);">基本资料</li>
<li id="users_tb_2" class="users_normaltab" onclick="i:HoverLi(2);">密码管理</li>
</ul>
</div><!--tb_ end-->
<div class="cl"></div>
<div class="users_ctt">
<%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %>
<div class="users_dis" id="users_tbc_01">
<% if( @act.nil? || @act != 'password') %>
<%= render_flash_messages %>
<%= error_messages_for 'user',@user.user_extensions %>
<% end %>
<ul class="setting_left">
<li><span style="color:red;">*</span>&nbsp;&nbsp;登录名&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;邮箱&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;职业&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;姓名&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;单位名称&nbsp;:&nbsp;</li>
<li>地区&nbsp;:&nbsp;</li>
<!--<li>邮件通知&nbsp;:&nbsp;</li>-->
<!--<li>个人签名&nbsp;:&nbsp;</li>-->
<li>个人主页&nbsp;:&nbsp;</li>
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
<li>
<%= f.text_field :login,
:no_label => true,
:required => true,
:style => "color:grey",
:nh_required => "1",
:name => "login",
:class => "w210"
%>
</li>
<% if @force %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%></li>
<% else %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<div class="panel-user-right-con clearfix">
<div id="edit_account_div" class="<%= @force ? '' : 'none' %>">
<% if @force %>
<% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %>
<% unless message.nil? %>
<div class="alert alert-orange mb15 mt15" id="account_tip">
<a data-dismiss="alert" class="task-close fr" type="button" onclick="$(this).parent().remove();">×</a>
<p>您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!</p>
<% message.update_attribute(:viewed, true) %>
</div>
<% end %>
<li>
<select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<option value="-1">
<%= l(:label_account_identity_choose) %>
</option>
<option value="0">
<%= l(:label_account_identity_teacher) %>
</option>
<option value="1">
<%= l(:label_account_identity_student) %>
</option>
<% end %>
<div class="panel-form ml30">
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>真实姓名:</label>
<input type="text" name="lastname" nh_required="1" required="required" class="input-height select-width panel-box-sizing fl" placeholder="填写您的真实姓名" value="<%= @user.lastname+@user.firstname %>">
<option value="3">
<%= l(:label_account_identity_developer) %>
</option>
</select>
<select nhname="tag_1" nh_tag_0="true" name="technical_title" id="userTechnical_title" class="w70" style='display:none;height:28px;'>
<option value="教授">教授</option>
<option value="副教授">副教授</option>
<option value="讲师">讲师</option>
<option value="助教">助教</option>
</select>
<span nhname="tag_1" nh_tag_1="true" style='display:none;'>
<% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style => "width:127px;" %>
<% else %>
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID), :style => "60px" %></span>
<% end %>
</span>
<span id="identity_hint" style="display: none"></span>
<div class="cl"></div>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<li class="clearfix mb10">
<label class=" panel-form-label fl "><span class="color-red mr5">*</span>我的性别:</label>
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
<input type="radio" id="sex" value="0" name="sex" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" checked="checked" class="fl "><label class="fl ">女</label>
<span class="fl mt10 mr15">
<input class="magic-radio" type="radio" name="sex" value="0">
<label>男</label>
</span>
<span class="fl mt10 ">
<input class="magic-radio" type="radio" name="sex" value="1" checked>
<label>女</label>
</span>
<% else %>
<input type="radio" id="sex" value="0" name="sex" checked="checked" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" class="fl "><label class="fl ">女</label>
<span class="fl mt10 mr15">
<input class="magic-radio" type="radio" name="sex" value="0" checked>
<label>男</label>
</span>
<span class="fl mt10 ">
<input class="magic-radio" type="radio" name="sex" value="1">
<label>女</label>
</span>
<% end %>
<select style = "display: none;" class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
<div class="cl"></div>
</li>
<li class="clearfix mb10 hascontont">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>职业:</label>
<select id="duty" name="identity" required="required" nh_required="1" class="fl input-height mr15 select-width">
<option value="-1" style="display:none">请选择职业</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">专业人士</option>
</select>
<select id="teacher" name="technical_title" class="fl input-height select-width">
<option style="display:none">请选择职称</option>
<option>教授</option>
<option>副教授</option>
<option>讲师</option>
<option>助教</option>
</select>
<select id="profession" name="enterp_title" class="fl input-height select-width">
<option style="display:none">请选择职称</option>
<option>企业管理者</option>
<option>部门管理者</option>
<option>高级工程师</option>
<option>工程师</option>
<option>助理工程师</option>
</select>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<!-- 基本资料页面单位审核显示 -->
<% if User.current.user_extensions.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<!-- 从业者选择单位名称 -->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<% if User.current.user_extensions.school_id.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.try(:id) %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<% end %>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" value="<%= User.current.user_extensions.school %>" />
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<% end %>
<div class="cl"></div>
<span class="color-orange fl hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>请选择你职业</span>
</li>
<li class="clearfix mb10" id="number">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>学号:</label>
<input type="text" class="input-height select-width panel-box-sizing fl" name="no" value="<%= @user.user_extensions.student_id %>" placeholder="填写您的学号">
<li>
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location" style="height:28px;margin-left:2px;">
<option value="">--请选择省份--</option>
<div class="cl"></div>
</li>
<li class="clearfix mb10">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>地区:</label>
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="fl input-height mr15 select-width">
<option value="">请选择所在省份</option>
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="广东">广东</option>
@ -180,105 +115,88 @@
<option value="台湾">台湾</option>
<option value="海外">海外</option>
</select>
<select name="city" id="userCity" class="location" style="height:28px;"></select>
</li>
<select id="userCity" class="fl input-height select-width" name="city">
<option>请选择所在城市</option>
</select>
<!-- <li>
<%#= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label class="ml10"><%#= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified], :style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
</li> -->
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
<li style="height:auto;">
<% if @user.homepage && !@user.homepage.article_homepages.empty? %>
<% if @user.base_homepage %>
<%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %>
<% else %>
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
<% end %>
<% else %>
<p class="nodata" style="height: 22px; font-size: 14px; text-align: left; line-height: 20px;">您还没有创建属于自己的个人主页。
<% if user_data_complete @user %>
<%= link_to '新建', new_user_homepage_article_homepage_path(:user_id => @user.id,
:homepage_id => @user.homepage.id),
:onclick=>"my_account_form_submit();",
:target => "_blank",
:class => 'linkBlue' %>
<% end %>
</p>
<% end %>
<!--<textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea>-->
<div class="cl"></div>
<span class="color-orange fl" style="margin-left:90px; "><i class="fa fa-exclamation-circle mr5"></i>请选择你所在的省份</span>
</li>
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
<li class="ml2">
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" onclick="my_account_form_submit();" style="background: #3b94d6; padding: 0 25px;">确定</a>
<input type="submit" id="my_account_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
<li class="clearfix">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>单位名称:</label>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-form-40 task-height-40 panel-box-sizing fl" type="text" value="<%= User.current.user_extensions.school.try(:name) %>" placeholder="在校师生请写所在学校,其它用户填写所在工作单位"/>
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" type="text" value="<%= @user.user_extensions.school.try(:id) %>"/> <!-- 单位名称的test框选中下拉列表框的id -->
<input type="text" autocomplete="off" id="department" name="department" class="task-form-40 task-height-40 panel-box-sizing fl ml15" placeholder="所在学院或者所在部门" value="<%= @user.user_extensions.department.try(:name) %>">
<input nhname="tag" nh_tag_4="true" id="deparentment_id" name="deparentment_id" style="display: none;" type="text" value="<%= @user.user_extensions.department.try(:id) %>"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
</li>
<li class="clearfix" id="">
<label class="panel-form-label fl">&nbsp;</label>
<p>你的单位不在列表中?请点击<a href="#" class="link-color-blue">申请添加</a></p>
</li>
<li class="clearfix mb10">
<label class=" panel-form-label fl">介绍:</label>
<textarea class="task-form-80 task-height-150 panel-box-sizing fl" style="width:82%;"> 一句话介绍一下自己吧~最多100个字符
</textarea>
<div class="cl"></div>
</li>
<li class="clearfix" style="margin-right:60px;">
<a href="#" class=" task-btn task-btn-blue fr ">保存</a>
<a href="#" class=" task-btn fr mr10">取消</a>
</li>
</ul>
<div class="cl"></div>
</div><!--tbc_01 end-->
<% end %>
<%= form_tag({:action => "password"},:id => 'my_password_form') do %>
<div class="users_undis" id="users_tbc_02">
<% if( !@act.nil? && @act == 'password') %>
<%= render_flash_messages %>
<%= error_messages_for 'user' %>
<% end %>
<ul class="setting_left">
<li>原始密码&nbsp;:&nbsp;</li>
<li>新密码&nbsp;:&nbsp;</li>
<li>确认密码&nbsp;:&nbsp;</li>
</ul>
<ul class="setting_right ">
<input style="display:none;">
<li><input id="password" name="password" autocomplete="off" class="w210" type="password" required="true" nh_required="1"></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">
<a href="javascript:;" id="my_password_form_link" class="blue_btn fl">确认</a>
<input type="submit" id="my_password_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
</li>
</ul>
<div class="cl"></div>
</div><!--tbc_02 end-->
<div class="cl"></div>
<% end %>
</div><!--ctt end-->
<!--users_setting end-->
</div>
<div id="search_school_result_list" style="width: 205px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div id="WOpenWindow">
<a class="modal_close" href="#"></a>
<h2 style="margin: 10px"><%= l(:lable_school_list)%></h2>
&nbsp;&nbsp;
<div class="pcontent">
<ul id="provincelist" class="school_list">
<% @ss = School.find_by_sql("select distinct province from schools") %>
<% @ss.each do |s| %>
<li style="width: 15%; float: left;">
<a style="cursor: pointer;" onclick="get_options('<%= s.province %>')"><%= s.province %>
</a>
</li>
<% end %>
</ul>
</div>
</div>
<div class="content" style="font-size: 13px">
<ul id="schoollist" class="school_list">
<div id="show_account_div" class="<%= @force ? 'none' : '' %>">
<div class="panel-form mr15 mt30">
<a href="javascript:void(0);" class="fr mb10" title="编辑资料"><i class="fa fa-edit font-16 "></i></a>
</ul>
<div class="cl"></div>
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>真实姓名:</label>
<p class="fl task-bg-grey02 panel-box-sizing "><%= @user.lastname + @user.firstname %></p>
</li>
<li class="clearfix mb10">
<label class=" panel-form-label fl "><span class="color-red mr5">*</span>我的性别:</label>
<p class="fl task-bg-grey02 panel-box-sizing"><%= @user.user_extensions && @user.user_extensions.gender && @user.user_extensions.gender == 1 ? '女' : '男' %></p>
</li>
<li class="clearfix mb10">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>职业:</label>
<p class="fl task-bg-grey02 panel-box-sizing">学生</p>
</li>
<li class="clearfix mb10">
<label class=" panel-form-label fl"><span class="color-red mr5">*</span>学号:</label>
<p class="fl task-bg-grey02 panel-box-sizing">2158462</p>
</li>
<li class="clearfix mb10">
<label class=" panel-form-label fl"><span class="color-red mr5">*</span>地区:</label>
<p class="fl task-bg-grey02 panel-box-sizing"><span class="mr15">湖南省</span><span>长沙市</span></p>
</li>
<li class="clearfix mb10">
<label class="panel-form-label fl"><span class="color-red mr5">*</span>单位名称:</label>
<p class="fl task-bg-grey02 panel-box-sizing">国防科学技术大学</p>
</li>
<li class="clearfix mb10">
<label class=" panel-form-label fl">介绍:</label>
<p class="fl task-bg-grey02 panel-box-sizing">我的对手只有我自己,要想爬得更高,只应该自己往上走,而不应该把别人往下压我的对手只有我自己,要想爬得更高,只应该自己往上走,而不应该把别人往下压我的对手只有我自己,要想爬得更高,只应该自己往上走,而不应该把别人往下压我的对手只有我自己,要想爬得更高,只应该自己往上走,而不应该把别人往下压</p>
</li>
</ul>
</div>
</div>
</div>
<div class="cl"></div>
<%= stylesheet_link_tag 'nyan' %>
<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %>
<% if !User.current.user_extensions.nil? %>
<% province = User.current.user_extensions.location %>
<% city = User.current.user_extensions.location_city %>
@ -290,22 +208,22 @@
<% language = User.current.language %>
<% else %>
<% province = "湖南省" %>
<% city = "长沙"%>
<% identity = ""%>
<% occupation1 = ""%>
<% city = "长沙" %>
<% identity = "" %>
<% occupation1 = "" %>
<% title = "" %>
<% language = ""%>
<% language = "" %>
<% end %>
<script type="text/javascript">
function showtechnical_title(val){
$("*[nhname='tag_1']").each(function(){
$("*[nh_required='1']",$(this)).attr("required",false);
function showtechnical_title(val) {
$("*[nhname='tag_1']").each(function () {
$("*[nh_required='1']", $(this)).attr("required", false);
$(this).hide()
});
$("*[nh_tag_"+val+"='true']").each(function(){
$("*[nh_required='1']",$(this)).attr("required",true);
$("*[nh_tag_" + val + "='true']").each(function () {
$("*[nh_required='1']", $(this)).attr("required", true);
$(this).show()
});
$("#identity_hint").hide();
@ -318,7 +236,7 @@
}
showtechnical_title(identity, cField);
if(language == 'zh') {
if (language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
@ -365,8 +283,7 @@
}
function get_options(value) {
var prefix = "";
if(location.href.indexOf('ros')>=0)
{
if (location.href.indexOf('ros') >= 0) {
prefix = "/ros"
}
$.ajax({
@ -401,13 +318,13 @@
}
}
function init_gender(pField, gender) {
for (var i=0; i<pField.options.length; i++) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == gender) {
pField.selectedIndex = i;
}
}
}
function changeValue(value,data){
function changeValue(value, data) {
//console.log(value+","+data)
$("input[name='province']").val(value);
$("input[name='occupation']").val(data);
@ -417,12 +334,12 @@
}
function apply_add_school(){
function apply_add_school() {
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
pop_up_box(htmlvalue,580,20,48);
pop_up_box(htmlvalue, 580, 20, 48);
$("#schoolname").val($("input[name='province']").val());
}
function add_school(name){
function add_school(name) {
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name,
type: 'post',
@ -434,19 +351,19 @@
var lastSearchCondition = '';
var page = 1; //唯一控制页码 变量
var count = 0; //查询结果的总量
var maxPage = 0 ;//最大页面值
$(function() {
$("#search_school_result_list").scroll(function(e){
var maxPage = 0;//最大页面值
$(function () {
$("#search_school_result_list").scroll(function (e) {
nScrollHight = $(this)[0].scrollHeight;
nScrollTop = $(this)[0].scrollTop;
var nDivHight = $(this).height();
if(nScrollTop + nDivHight >= nScrollHight) //到底部了,
if (nScrollTop + nDivHight >= nScrollHight) //到底部了,
{
//判断页码是否是最大值,如果是的,就不去请求了
if(page >= maxPage){
if (page >= maxPage) {
return;
}else{ //如果不是,那就请求下一页,请求数据处理
page ++;
} else { //如果不是,那就请求下一页,请求数据处理
page++;
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + $("input[name='province']").val() + '&page=' + page,
type: 'post',
@ -469,54 +386,54 @@
});
//查询学校
$("input[name='province']").on('input', function (e) {
throttle(shcool_search_fn,window,e);
throttle(shcool_search_fn, window, e);
});
function throttle(method,context,e){
function throttle(method, context, e) {
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
method.tId = setTimeout(function () {
method.call(context, e);
}, 500);
}
function shcool_search_fn(e){
function shcool_search_fn(e) {
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){//如果输入框没有改变或者输入框为空就返回
if ($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
$("input[name='occupation']").val(''); //一旦有输入就清空id。
lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&page=' + page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
maxPage = Math.ceil(count / 100) //最大页码值
if (schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
if ($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
} else {
$("#hint").hide();
$("#errortip").hide();
}
}else{
} else {
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
str = e.target.value.length > 4 ? e.target.value.substr(0, 4) + "..." : e.target.value;
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
@ -524,48 +441,48 @@
}
});
}
$(document.body).click(function(e){
if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province')
{
$(document.body).click(function (e) {
if ($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province') {
$("#search_school_result_list").hide();
$("#errortip").hide();
}
});
$("input[name='province']").on('focus', function (e) {
if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
if ($("input[name='occupation']").val() != '') { //如果已经有id了。肯定存在不用去找了。
return;
}
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&page=' + page,
type: 'post',
success: function (data) {
schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
maxPage = Math.ceil(count / 100) //最大页码值
if (schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < schoolsResult.length; i++) {
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
if ($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value;
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
$("#errortip").hide();
}else{
} else {
$("#hint").hide();
$("#errortip").hide();
}
}else{
} else {
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
str = e.target.value.length > 4 ? e.target.value.substr(0, 4) + "..." : e.target.value;
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
@ -574,99 +491,62 @@
});
});
// $("#province").leanModal({top: 100, closeButton: ".modal_close"});
//地区
var province = "<%= "#{province}" %>"
var city = "<%= "#{city}" %>"
init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
//init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
//select
var identity = "<%= "#{identity}" %>"
var title = "<%= "#{title}" %>"
var language = "<%= "#{language}" %>"
var occupation1 = "<%= "#{occupation}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
//init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
//sex
var gender = "<%= "#{gender}" %>"
init_gender(document.getElementById('gender'), gender);
//init_gender(document.getElementById('gender'), gender);
$("#userIdentity").change();
<% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click();
<% end %>
// $('#my_account_form_link').on("click",(function(e){
// //$('#my_account_form_link').click(function(e){
// if($("#userIdentity").val() == -1 ) {
// $("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
// e.stopImmediatePropagation();
// return;
// }
// if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
// $("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
// e.stopImmediatePropagation();
// return;
// }
//
// //姓名不能为空
// if( $("#lastname").val() == '' ){
// $("#lastname").focus();
// $("#last_name_notice").show();
// e.stopImmediatePropagation();
// return;
// }
//
// if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
// $("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
// e.stopImmediatePropagation();
// return;
// }
//
// if($("#no").is(":visible") == true && $("#no").val() == ""){
// $("#no").focus();
// e.stopImmediatePropagation();
// return;
// }
//
// $('#my_account_form').submit();
// }));
$('#my_password_form_link').click(function(){
$('#my_password_form_link').click(function () {
$('#my_password_form_btn').click();
});
});
// 基本资料页面提交表单时,判断身份与单位是否合法
function my_account_form_submit(){
if($("#userIdentity").val() == -1 ) {
function my_account_form_submit() {
if ($("#userIdentity").val() == -1) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation(); // 阻止事件冒泡
return;
}
// 单位或高校必须从下拉列表中选择
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
if ($("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == '') { //学校名字和id不对的话
$("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();
return;
}
//姓名不能为空
if( $("#lastname").val() == '' ){
if ($("#lastname").val() == '') {
$("#lastname").focus();
$("#last_name_notice").show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
if ($("input[name='province']").val().trim() == '') { //学校名字必须填写
$("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
e.stopImmediatePropagation();
return;
}
if($("#no").is(":visible") == true && $("#no").val() == ""){
if ($("#no").is(":visible") == true && $("#no").val() == "") {
$("#no").focus();
e.stopImmediatePropagation();
return;
@ -674,16 +554,10 @@
$('#my_account_form').submit();
}
$("#province").blur(function(){
if($(this).val() == ""){
$(this).attr("placeholder","--请搜索您所在的高校(单位)--");
$("#province").blur(function () {
if ($(this).val() == "") {
$(this).attr("placeholder", "在校师生请写所在学校,其它用户填写所在工作单位");
}
})
</script>
<script type="text/javascript">
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){g('users_tb_'+i).className='users_normaltab';g('users_tbc_0'+i).className='users_undis';}g('users_tbc_0'+n).className='users_dis';g('users_tb_'+n).className='users_hovertab';
}
</script>

View File

@ -4,6 +4,18 @@
<div class="hwork_new pr">
<ul>
<%= labelled_form_for @syllabus do |f| %>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;专业层级&nbsp;&nbsp;</label>
<%= select_tag :major_level,options_for_select(major_level_option,@syllabus.major_level), {:id=>"major_level", :class=>"syllabus_input w300 h28"} %>
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;学科门类&nbsp;&nbsp;</label>
<%= select_tag :discipline_category_id,options_for_select(discipline_category_option,@syllabus.discipline_category_id), {:id=>"discipline_category_id", :class=>"syllabus_input w300 h28"} %>
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;一级学科&nbsp;&nbsp;</label>
<%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option,@syllabus.first_level_discipline_id), {:id=>"first_level_discipline_id", :class=>"syllabus_input w300 h28"} %>
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;课程名称&nbsp;&nbsp;</label>
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();">
@ -36,4 +48,8 @@
</p>
</div>
</div><!--talknew end-->
<div class="cl"></div>
<div class="cl"></div>
<script>
</script>

View File

@ -0,0 +1,61 @@
<% str = current_user ? '我' : 'TA' %>
<p class="p1">
<span class="span1 font-14" id="my_watchlist_span">
<%= str %>的关注
<i class="color-grey" id="follow"><%= @user_watchlist_count %></i>
</span>
<span class="font-14" id="my_fanlist_span">
<%= str %>的粉丝
<i class="color-grey" id="fens"><%= @user_fanlist_count %></i>
</span>
</p>
<div id="my_watchlist">
<% if @user_watchlist_count == 0 %>
<p class="p2 font-16">
<% if current_user %>
<span>你还没有关注任何人,</span>
<a href="javascript:void(0);" class="changecolor">去找找感兴趣的用户</a>
<% else %>
<span>TA还没有关注任何人</span>
<% end %>
</p>
<% else %>
<div class="fens clearfix">
<% @user_watchlist.each do |user| %>
<dl class="list fl">
<dt><%= link_to image_tag(url_to_avatar(user), :width => "56", :height => "56", :class => "touxiang", :alt => "头像"), user_path(user), :target => '_blank', :class => "" %></dt>
<dd class="mb10"><%= link_to user.show_name, user_path(user), :target => '_blank' %></dd>
</dl>
<% end %>
<% if @user_watchlist_count > 12 %>
<%= link_to '查看更多', user_watchlist_user_path(@user), :target => '_blank', :class => 'color-grey many' %>
<% end %>
</div>
<% end %>
</div>
<div id="my_fanlist" class="none">
<% if @user_fanlist_count == 0 %>
<p class="p2 font-16">
<% if current_user %>
<span>还没有人关注你,</span>
<a href="javascript:void(0);" class="changecolor">去让大家认识下你吧</a>
<% else %>
<span>TA还没有粉丝</span>
<% end %>
</p>
<% else %>
<div class="fens clearfix">
<% @user_fanlist.each do |user| %>
<dl class="list fl">
<dt><%= link_to image_tag(url_to_avatar(user), :width => "56", :height => "56", :class => "touxiang", :alt => "头像"), user_path(user), :target => '_blank', :class => "" %></dt>
<dd class="mb10"><%= link_to user.show_name, user_path(user), :target => '_blank' %></dd>
</dl>
<% end %>
<% if @user_fanlist_count > 12 %>
<%= link_to '查看更多', user_fanslist_user_path(@user), :target => '_blank', :class => 'color-grey many' %>
<% end %>
</div>
<% end %>
</div>

View File

@ -1,4 +1 @@
$("#user_brief_introduction_show").html("<%= escape_javascript render(:partial => "layouts/user_brief_introduction", :locals => {:user => @user}) %>");
$("#user_brief_introduction_show").show();
$("#user_brief_introduction_edit").hide();
autoUrl("user_brief_introduction_show");

View File

@ -1,48 +1,241 @@
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
<input type="hidden" value="<%= @type %>" name="type" id="user_activities_type">
<script>
$(function(){
$($(".homepage_tab_div")[$(".homepage_tab_div").length - 1]).css("border", "none");
});
// 个人主页的tab
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
// g('message_all_list').className='undis';
//如果有N个标签,就将i<=N;
for(var i = 1; i <= 6; i++){
if (g('user_homepage_tab_'+i) != null)
g('user_homepage_tab_'+i).className='flex-cell_homepage';
// if(g('message_list_content_'+i) != null)
// g('message_list_content_'+i).className='undis';
}
// g('message_list_content_'+n).className='dis';
g('user_homepage_tab_'+n).className='homepageClickBackground';
}
</script>
<% if is_current_user %>
<% if task_count(@unsolved_issues_count, @unfinished_homework_count, @unfinished_test_count, @unfinished_poll_count, @anonymous_evaluation_count, @applied_message_alls_count) > 0 %>
<div class="homepagetopBanner mb10" style="width:748px;">
<div class="flex-container_homepage">
<%= render :partial => "users/task_tip" %>
<% current_user = @user == User.current %>
<% str = current_user ? '我' : 'TA' %>
<div class="-task-con">
<div class="-task-con-per cl">
<div class="photo fl">
<%= image_tag(url_to_avatar(@user), :class => "person", :alt => "头像") %>
<% if current_user %>
<div class="changephoto font-14"><div class="subchange">更换头像</div></div>
<% end %>
</div>
<div class="-task-con-data fl">
<div class="top cl">
<div class="top-left fl">
<p class="p1 font-16 ">
<span><%= @user.login %></span>
<% if @user.user_extensions && @user.user_extensions.gender && @user.user_extensions.gender == 1 %>
<i class="pl20 fa fa-venus color-orange" aria-hidden="true"></i>
<% else %>
<i class="pl20 fa fa-mars color-blue" aria-hidden="true"></i>
<% end %>
</p>
<p class="p2 font-16">
<span class="wordbold">
<%= @user.show_name %>
<% if @user.user_extensions && @user.user_extensions.identity %>
(<%= get_user_roll @user %>)
<% end %>
</span>
<span class="pl20 pr20">
<% if !@user.user_extensions.school_id.blank? && @user.user_extensions.school %>
<%= @user.user_extensions.school.name %>
<% end %>
</span>
<% if @user.authentication %>
<span class="color-green">
<i class="fa fa-check-circle-o" aria-hidden="true"></i>
已认证
</span>
<% else %>
<span class="color-grey">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
未认证
</span>
<% end %>
</p>
</div>
<div class="top-right fr font-16 mr10">
<% if current_user %>
<div class="mynew">
<p>
<%= link_to '编辑我的资料', my_account_path %>
</p>
<p class="p2 font-14">
<i class="fa fa-eye" aria-hidden="true"></i>
<% update_visiti_count @user %>
<span><%= @user.visits.to_i %></span> 次访问
</p>
<p class="font-14">帐户安全:
<a class="<%= @user.phone.blank? ? 'color-grey' : 'color-green' %>" href="<%= security_settings_path %>">
<i class="fa fa-mobile pr10" aria-hidden="true"></i>
</a>
<a class="<%= @user.mail.blank? ? 'color-grey' : 'color-green' %>" href="<%= security_settings_path %>">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</a>
</p>
</div>
<% else %>
<div class="itnew">
<p class="p2 font-14 color-grey mt10 mb10">
<i class="fa fa-eye" aria-hidden="true"></i>
<span><%= @user.visits.to_i %></span> 次访问
</p>
<p class="sub clearfix">
<% if(@user.watched_by?(User.current)) %>
<%= link_to "已关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id),
:class => "fl font-14 user_watch ml30",
:id => "cancel_watch",
:method => "delete",
:remote => "true",
:title => "取消关注" %>
<% else %>
<%= link_to "添加关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id),
:class => "fl font-14 user_watch ml30",
:method => "post",
:remote => "true",
:title => "添加关注" %>
<% end %>
<a href="<%= feedback_path(@user, :host=> Setting.host_user) %>" class="fr font-14">给ta留言</a>
</p>
<!--<div class="alert">-->
<!--<p>你确定不再关注<span>kosasa</span>?</p>-->
<!--<p><span>确定</span><span>取消</span></p>-->
<!--</div>-->
</div>
<% end %>
</div>
</div>
<div class="bot">
<% if current_user %>
<input type="hidden" id="current_user_id" value="<%= @user.id %>">
<input type="text" class="font-14 task-hide color-grey" id="user_breif_introduction" placeholder="一句话介绍一下自己吧~" value="<%= @user.user_extensions.brief_introduction %>"/>
<% else %>
<p class="font-14 task-hide color-grey" title="<%= @user.user_extensions.brief_introduction.blank? ? "这家伙很懒,什么都没留下~" : @user.user_extensions.brief_introduction %>">
<%= @user.user_extensions.brief_introduction.blank? ? "这家伙很懒,什么都没留下~" : @user.user_extensions.brief_introduction %>
</p>
<% end %>
</div>
</div>
</div>
<div class="-task-con-int">
<div class="blog">
<p class="p1 font-14 "><%= str %>的博客
<span class="font-12 color-grey" id="blog"><%= @blog_count %></span>
</p>
<% if @blog_count == 0 %>
<p class="p2 font-16 ">
<% if current_user %>
<span>你一篇博客也没写过,</span>
<a href="<%= user_blogs_path(:user_id => @user) %>" target="_blank" class="changecolor">现在写博客</a>
<% else %>
<span><%= @user.show_name %>很懒,一篇博客也没写过</span>
<% end %>
</p>
<% else %>
<div class="p3 clearfix">
<% if @blog_count > 3 %>
<%= link_to '查看更多', user_blogs_path(:user_id => @user), :target => '_blank', :class => 'check color-grey' %>
<% end %>
<% @blog_list.each_with_index do |blog, index| %>
<div class="blognew fl pl10 <%= index == 0 ? '' : 'hasborder' %>">
<%= link_to blog.title.to_s.html_safe, user_blog_blog_comment_path(:user_id => blog.author, :blog_id => blog.blog.id, :id => blog), :class => "font-14" %>
<p>
<span calss="font-12 color-grey pr10"><%= format_time blog.created_at %>&nbsp;发布</span>
<i class="fa fa-eye font-12 color-grey" aria-hidden="true"></i>
<span class="font-12 color-grey"><%= blog.visits %></span>
</p>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="favour" id="watcher_fan_list">
<%= render :partial => 'edu_user_watch_fan_list', :locals => {:current_user => current_user} %>
</div>
<div class="passageway mt15">
<div class="hint">
<div class="pr10 color-blue play">
<i class="fa fa-sort-down zhuan mr5" aria-hidden="true"></i>开始
</div>
<div class="list">
<div>
<p><%= link_to '创建课程', new_syllabus_path(:host => Setting.host_course), :target => "_blank" %></p>
<p><%= link_to '创建班级', new_course_path(:host => Setting.host_course), :target => "_blank" %></p>
<p><%= link_to "加入班级", join_private_courses_courses_path, :remote => true, :method => "post" %></p>
<p><%= link_to "发现实训", '', :target => "_blank" %></p>
<p><%= link_to '发起求助', new_forum_memo_path(:forum_id => Forum.first.id, :forum_index => true), :target => "_blank" %></p>
</div>
</div>
</div>
<% if @courses_count == 0 && @shixuns_count == 0 %>
<div class="kong">
<p class="p1 font-14 cl color-grey">
<span class="fl">快速入口</span>
</p>
<div class="p2 font-14 color-grey">
<img src="../images/edu_user/edu-nodata.png"/>
<p>显示你常用的课堂社区、实训社区列表</p>
<p class="pb20 font-14">你还没有参与任何社区</p>
</div>
</div>
<% else %>
<div class="hascon">
<p class="title">
<% if @courses_count == 0 %>
<span class="font-14" id="my_shixuns_span">实训<i class="ml10"><%= @shixuns_count %></i></span>
<% elsif @shixuns_count == 0 %>
<span class="font-14" id="my_courses_span">课堂<i class="ml10"><%= @courses_count %></i></span>
<% else %>
<span class="font-14" id="my_courses_span">课堂<i class="ml10"><%= @courses_count %></i></span>
<span class="font-14" id="my_shixuns_span">实训<i class="ml10"><%= @shixuns_count %></i></span>
<% end %>
</p>
<div class="lesson ml10 mr10" id="my_courses_list">
<% @courses.each do |course| %>
<p class="clearfix">
<a href="<%= course_path(course) %>" target="_blank" class="font-16 first"><i class="fa fa-circle qian" aria-hidden="true"></i>&nbsp;&nbsp;<%= course.name %></a>
<span class="font-14 hasmargin">课程:<a href="<%= syllabus_path(course.syllabus) %>" target="_blank"><%= course.syllabus.title %></a></span>
<span class="font-14 haspadding">更新时间:<%= format_time course.updatetime %></span>
<span class="font-14 last fr">分享&nbsp;&nbsp;<i class="fa fa-weixin font-14 color-green" aria-hidden="true"></i></span>
</p>
<% end %>
<% if @courses_count > 8 %>
<a href="<%= user_course_community_path(@user) %>" target="_blank" class="font-18 color-grey expand">点击查看全部</a>
<% end %>
</div>
<div class="train ml10 mr10 none" id="my_shixuns_list">
<% @shixuns.each do |shixun| %>
<p>
<span class="font-16 first"><i class="fa fa-circle qian" aria-hidden="true"></i>&nbsp;&nbsp;胡莎莎/Helloword:java实训入门</span>
<span class="hasmargin font-14">已解锁第<i>2</i>关/共<i>8</i>关</span>
<span class="font-14 last">上次离开时间2017-02-09 15:21</span>
</p>
<% end %>
<% if @shixuns_count > 8 %>
<a href="<%= user_course_community_path(@user) %>" target="_blank" class="font-18 color-grey expand">点击查看全部</a>
<% end %>
</div>
</div>
<% end %>
<div id="user_homepage_message_list">
<%= render :partial => 'users/user_message_list'%>
</div>
<% else %>
<div class="homepageRightBanner">
<div class="NewsBannerName">Ta的动态</div>
</div>
<!--显示个人主页-->
<% if @user_activities_count > 0 %>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} %>
<% else %>
<div class="mb10">
<%= render :partial => 'users/no_data' %>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<!-------------------侧边提示区域-------------------------->
<div class="-task-sidebar">
<div class="feedback" tooltips="意见反馈">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</div>
<div class="scan" tooltips="快来扫一扫">
<i class="fa fa-qrcode" aria-hidden="true"></i>
</div>
<div class="consult" tooltips="在线咨询">
<a target="_blank" class="color_white" href="http://shang.qq.com/wpa/qunwpa?idkey=064e805dac955b8aea158c4b0dd3f033b8841bcee175fd619613f0e4ac4d8151"><i class="fa fa-qq" aria-hidden="true"></i></a>
</div>
<div class="gotop" tooltips="返回顶部">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</div>
</div>

View File

@ -2,7 +2,8 @@
//点击头像下面的添加关注按钮
<% if( params[:target_id] == params[:object_id] ) %>
<% if @user %>
$("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>");
$(".user_watch").replaceWith("<%= escape_javascript watcher_link_for_user(@user, User.current)%>");
$("#watcher_fan_list").html("<%= escape_javascript(render :partial => 'users/edu_user_watch_fan_list', :locals => {:current_user => (@user == User.current)}) %>");
<% end %>
$("#user_fans_number").html("<%= watched.first.watcher_users.count.to_s%>");
$(".add_cancel_watch_<%= watched.first.id %>").html("<%= escape_javascript (render :partial => 'users/watch_btn_for_picture', :locals => {:user => watched.first}) %>");

View File

@ -3,5 +3,6 @@
// $('#project-'+'<%=@project.id%>'+'-watcher').html('取消关注');
$('#project-'+'<%=@project.id%>'+'-watcher').replaceWith("<%= escape_javascript watcher_link_for_project(@project, User.current)%>");
<% else %>
$('#fans_num').html('<%= j(@user.watcher_users.count) %>');
$(".user_watch").replaceWith("<%= escape_javascript watcher_link_for_user(@users, User.current)%>");
$("#watcher_fan_list").html("<%= escape_javascript(render :partial => 'edu_user_watch_fan_list', :locals => {:current_user => (@user == User.current)}) %>");
<% end %>

View File

@ -51,6 +51,7 @@ en:
error_session_expired: "Your session has expired. Please login again."
warning_attachments_not_saved: "%{count} file(s) could not be saved."
mail_subject_bind_mail: "%{value} Email binding"
mail_subject_lost_password: "%{value} Your password"
mail_body_lost_password: 'To change your password, click on the following link:'
mail_subject_register: "Your %{value} account activation"

View File

@ -90,6 +90,7 @@ zh:
error_unable_to_connect: "无法连接 (%{value})"
warning_attachments_not_saved: "%{count} 个文件保存失败"
mail_subject_bind_mail: "%{value} 绑定邮箱验证码"
mail_subject_lost_password: "%{value} 您的密码"
mail_body_lost_password: '请点击以下链接来修改您的密码:'
mail_subject_register: "%{value}帐号激活"
@ -392,6 +393,7 @@ zh:
label_organization_list: 组织列表
label_school_plural: 学校列表
label_applied_shcools: 单位审核
label_applied_departments: 部门审核
label_organization_new: 新建组织
label_edit_organization: 编辑组织
label_organization_edit: 修改组织

View File

@ -290,6 +290,18 @@ RedmineApp::Application.routes.draw do
end
end
resources :department do
collection do
get 'search_repeat_departmentname'
post 'apply_add_department'
post 'on_search'
end
member do
end
end
resources :homework_attach do
collection do
get 'get_homework_member_list'
@ -592,6 +604,12 @@ RedmineApp::Application.routes.draw do
match 'account/reset_psd', :via => [:get, :post]
match 'account/email_valid', :to => 'account#email_valid', :via => :get
match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail'
match 'account/avatar', :to => 'account#avatar', :via => :get, :as => "avatar_account"
match 'account/authentication', :to => 'account#authentication', :via => :get, :as => "authentication_account"
match 'account/security_settings', :to => 'account#security_settings', :via => :get, :as => "security_settings"
match 'account/change_psd', :to => 'account#change_psd', :via => :get, :as => "change_psd"
match 'account/change_or_bind', :to => 'account#change_or_bind', :via => :get, :as => "change_or_bind"
match 'account/bind_email_or_phone', :to => 'account#bind_email_or_phone', :via => :post, :as => "bind_email_or_phone"
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
@ -813,7 +831,7 @@ RedmineApp::Application.routes.draw do
match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list"
match 'sort_project_list', :to => 'users#sort_project_list', :via => :get, :as => "sort_project_list"
get 'edit_brief_introduction'
post 'edit_brief_introduction'
get "user_resource"
match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
@ -1398,6 +1416,10 @@ RedmineApp::Application.routes.draw do
get 'admin/all_schools'
get 'admin/apply_shcool_sort', as: :apply_shcool_sort
delete 'admin/delete_applied_schools'
get 'admin/applied_departments', as: :unapplied_departments
get 'admin/has_applied_departments', as: :applied_departments
get 'admin/approve_applied_departments'
delete 'admin/delete_applied_departments'
get 'admin/leave_messages'
match 'admin/messages_list', as: :messages_list
@ -1437,7 +1459,9 @@ RedmineApp::Application.routes.draw do
end
collection do
get 'get_discipline_categories'
get 'get_first_level_disciplines'
get 'regex_syllabus_name'
end
end
@ -1448,6 +1472,7 @@ RedmineApp::Application.routes.draw do
collection do
get 'syl_member_autocomplete'
post 'change_manager'
end
end

View File

@ -1,43 +1,43 @@
class HomeworkBankMigration < ActiveRecord::Migration
def up
# add_column :homework_commons, :homework_bank_id, :integer
# add_column :homework_commons, :is_update, :boolean, :default => false
#
# count =Course.all.count / 30 + 2
# transaction do
# for i in 1 ... count do i
# Course.page(i).per(30).each do |course|
# if course.is_delete == 0
# course.homework_commons.each do |homework|
# unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
# homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
# :quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
# if homework.homework_type == 2 && homework.homework_detail_programing
# homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
# homework.homework_tests.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: true
# )
# end
# homework.homework_samples.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: false
# )
# end
# elsif homework.homework_type == 3 && homework.homework_detail_group
# homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
# end
# homework.update_column('homework_bank_id', homework_bank.id)
# end
# end
# end
# end
# end
# end
add_column :homework_commons, :homework_bank_id, :integer
add_column :homework_commons, :is_update, :boolean, :default => false
count =Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
if course.is_delete == 0
course.homework_commons.each do |homework|
unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
:quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
homework.homework_tests.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: true
)
end
homework.homework_samples.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: false
)
end
elsif homework.homework_type == 3 && homework.homework_detail_group
homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
end
homework.update_column('homework_bank_id', homework_bank.id)
end
end
end
end
end
end
end
def down

View File

@ -0,0 +1,11 @@
class CreateDepartments < ActiveRecord::Migration
def change
create_table :departments do |t|
t.string :name
t.references :school
t.timestamps
end
add_index :departments, :school_id
end
end

View File

@ -0,0 +1,17 @@
class CreateApplyAddDepartments < ActiveRecord::Migration
def change
create_table :apply_add_departments do |t|
t.string :name
t.references :department
t.references :school
t.text :remarks
t.references :user
t.integer :status
t.timestamps
end
add_index :apply_add_departments, :department_id
add_index :apply_add_departments, :school_id
add_index :apply_add_departments, :user_id
end
end

View File

@ -0,0 +1,11 @@
class AddColumnSchool < ActiveRecord::Migration
def up
add_column :schools, :city, :string
add_column :schools, :address, :string
add_column :user_extensions, :department_id, :integer
end
def down
end
end

View File

@ -0,0 +1,8 @@
class CreateDisciplineCategories < ActiveRecord::Migration
def change
create_table :discipline_categories do |t|
t.integer :major_level
t.string :name
end
end
end

View File

@ -0,0 +1,9 @@
class CreateFirstLevelDisciplines < ActiveRecord::Migration
def change
create_table :first_level_disciplines do |t|
t.references :discipline_category
t.string :name
end
add_index :first_level_disciplines, :discipline_category_id
end
end

View File

@ -0,0 +1,7 @@
class AddColumnsToSyllabus < ActiveRecord::Migration
def change
add_column :syllabuses, :major_level, :integer
add_column :syllabuses, :discipline_category_id, :integer
add_column :syllabuses, :first_level_discipline_id, :integer
end
end

View File

@ -0,0 +1,13 @@
class CreateReferenceMaterials < ActiveRecord::Migration
def change
create_table :reference_materials do |t|
t.string :book
t.string :editor
t.string :press
t.references :syllabus
t.timestamps
end
add_index :reference_materials, :syllabus_id
end
end

View File

@ -0,0 +1,13 @@
class CreateSyllabusUpdateRecords < ActiveRecord::Migration
def change
create_table :syllabus_update_records do |t|
t.references :user
t.references :syllabus
t.integer :property
t.timestamps
end
add_index :syllabus_update_records, :user_id
add_index :syllabus_update_records, :syllabus_id
end
end

View File

@ -0,0 +1,27 @@
class CreateResourceBanks < ActiveRecord::Migration
def change
create_table :resource_banks do |t|
t.references :course
t.integer :attachment_id
t.string :filename
t.string :disk_filename
t.integer :filesize
t.string :digest
t.integer :downloads
t.references :user
t.text :description
t.string :disk_directory
t.boolean :is_public
t.integer :copy_from
t.integer :quotes
t.string :applicable_syllabus
t.integer :major_level
t.integer :discipline_category_id
t.integer :first_level_discipline_id
t.timestamps
end
add_index :resource_banks, :course_id
add_index :resource_banks, :user_id
end
end

View File

@ -0,0 +1,24 @@
class ResourceBankMigration < ActiveRecord::Migration
def up
add_column :attachments, :resource_bank_id, :integer
count =Attachment.where(:container_type => 'Course').count / 30 + 2
transaction do
for i in 1 ... count do i
Attachment.where(:container_type => 'Course').page(i).per(30).each do |atta|
if atta.course && atta.course.syllabus
course = atta.course
syllabus = course.syllabus
resource_bank = ResourceBank.create(:course_id => course.id, :attachment_id => atta.id, :filename => atta.filename, :disk_filename => atta.disk_filename, :filesize => atta.filesize, :digest => atta.digest, :downloads => 0,
:user_id => atta.author_id, :description => atta.description, :disk_directory => atta.disk_directory, :is_public => atta.is_public, :copy_from => atta.copy_from,
:quotes => 1, :applicable_syllabus => syllabus.title, :major_level => syllabus.major_level, :discipline_category_id => syllabus.discipline_category_id, :first_level_discipline_id => syllabus.first_level_discipline_id, :created_at => atta.created_on)
atta.update_column('resource_bank_id', resource_bank.id)
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,6 @@
class AddColumnToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication, :boolean, :default => 0
add_column :blog_comments, :visits, :integer, :default => 0
end
end

View File

@ -384,6 +384,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools
menu.push :applied_departments, {:controller => 'admin', :action => 'applied_departments'}, :caption => :label_applied_departments
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural

7
public/head/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

3004
public/head/cropper.js Normal file

File diff suppressed because it is too large Load Diff

9
public/head/cropper.min.css vendored Normal file
View File

@ -0,0 +1,9 @@
/*!
* Cropper v0.9.1
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2015-03-21T04:58:27.265Z
*/.cropper-container{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-modal{background-color:#000;filter:alpha(opacity=50);opacity:.5}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#69f solid 1px;outline-color:rgba(102,153,255,.75)}.cropper-dashed{position:absolute;display:block;filter:alpha(opacity=50);border:0 dashed #fff;opacity:.5}.cropper-dashed.dashed-h{top:33.33333333%;left:0;width:100%;height:33.33333333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333333%;width:33.33333333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;cursor:move;background-color:#fff}.cropper-line{background-color:#69f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;background-color:#69f;filter:alpha(opacity=75);opacity:.75}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#69f;filter:alpha(opacity=0);opacity:0}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;filter:alpha(opacity=75);opacity:.75}}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-hide{position:fixed;top:0;left:0;z-index:-1;width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;filter:alpha(opacity=0);opacity:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-canvas,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}

8
public/head/html2canvas.min.js vendored Normal file

File diff suppressed because one or more lines are too long

6
public/head/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More