Compare commits
No commits in common. "master" and "wechat_xz" have entirely different histories.
|
|
@ -1,16 +0,0 @@
|
|||
*.swp
|
||||
/.project
|
||||
/.idea
|
||||
/.bundle
|
||||
*.swp
|
||||
/config/database.yml
|
||||
/files/*
|
||||
/log/*
|
||||
/tmp/*
|
||||
.gitignore
|
||||
/public/images/avatars/*
|
||||
/Gemfile
|
||||
/Gemfile.lock
|
||||
/db/schema.rb
|
||||
/Gemfile.lock
|
||||
/lib/plugins/acts_as_versioned/test/debug.log
|
||||
211
.metadata/.log
211
.metadata/.log
|
|
@ -1,211 +0,0 @@
|
|||
!SESSION 2014-03-11 16:33:06.446 -----------------------------------------------
|
||||
eclipse.buildId=3.4.0.201304151603
|
||||
java.version=1.6.0_24
|
||||
java.vendor=Sun Microsystems Inc.
|
||||
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
|
||||
Command-line arguments: -os win32 -ws win32 -arch x86
|
||||
|
||||
!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2014-03-11 16:33:20.829
|
||||
!MESSAGE Connection to http://download.aptana.com/studio3-rcp/plugin/update/p2.index failed on download.aptana.com. Retry attempt 0 started
|
||||
!STACK 0
|
||||
java.net.UnknownHostException: download.aptana.com
|
||||
at java.net.PlainSocketImpl.connect(Unknown Source)
|
||||
at java.net.SocksSocketImpl.connect(Unknown Source)
|
||||
at java.net.Socket.connect(Unknown Source)
|
||||
at org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventCreateUtil.createSocket(SocketEventCreateUtil.java:43)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:81)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:73)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:65)
|
||||
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
|
||||
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.performConnect(HttpClientRetrieveFileTransfer.java:1142)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.openStreams(HttpClientRetrieveFileTransfer.java:710)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:889)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:576)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.MultiProtocolRetrieveAdapter.sendRetrieveRequest(MultiProtocolRetrieveAdapter.java:106)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.sendRetrieveRequest(FileReader.java:349)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.readInto(FileReader.java:295)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.download(RepositoryTransport.java:87)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.download(RepositoryTransport.java:137)
|
||||
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
|
||||
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
|
||||
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
|
||||
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.getAvailableRepositories(UpdateChecker.java:150)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.checkForUpdates(UpdateChecker.java:128)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker$UpdateCheckThread.run(UpdateChecker.java:72)
|
||||
|
||||
!ENTRY org.eclipse.equinox.p2.transport.ecf 4 1006 2014-03-11 16:33:21.110
|
||||
!MESSAGE Unknown Host: http://download.aptana.com/studio3-rcp/plugin/update/content.xml
|
||||
!STACK 0
|
||||
java.net.UnknownHostException: download.aptana.com
|
||||
at java.net.PlainSocketImpl.connect(Unknown Source)
|
||||
at java.net.SocksSocketImpl.connect(Unknown Source)
|
||||
at java.net.Socket.connect(Unknown Source)
|
||||
at org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventCreateUtil.createSocket(SocketEventCreateUtil.java:43)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:81)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:73)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:65)
|
||||
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
|
||||
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientFileSystemBrowser.runRequest(HttpClientFileSystemBrowser.java:227)
|
||||
at org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser$DirectoryJob.run(AbstractFileSystemBrowser.java:69)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
||||
!SESSION 2014-03-11 16:46:11.935 -----------------------------------------------
|
||||
eclipse.buildId=3.4.0.201304151603
|
||||
java.version=1.6.0_24
|
||||
java.vendor=Sun Microsystems Inc.
|
||||
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
|
||||
Command-line arguments: -os win32 -ws win32 -arch x86
|
||||
|
||||
!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2014-03-11 16:46:21.061
|
||||
!MESSAGE Connection to http://download.aptana.com/studio3-rcp/plugin/update/p2.index failed on download.aptana.com. Retry attempt 0 started
|
||||
!STACK 0
|
||||
java.net.UnknownHostException: download.aptana.com
|
||||
at java.net.PlainSocketImpl.connect(Unknown Source)
|
||||
at java.net.SocksSocketImpl.connect(Unknown Source)
|
||||
at java.net.Socket.connect(Unknown Source)
|
||||
at org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventCreateUtil.createSocket(SocketEventCreateUtil.java:43)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:81)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:73)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:65)
|
||||
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
|
||||
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.performConnect(HttpClientRetrieveFileTransfer.java:1142)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.openStreams(HttpClientRetrieveFileTransfer.java:710)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:889)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:576)
|
||||
at org.eclipse.ecf.provider.filetransfer.retrieve.MultiProtocolRetrieveAdapter.sendRetrieveRequest(MultiProtocolRetrieveAdapter.java:106)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.sendRetrieveRequest(FileReader.java:349)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.readInto(FileReader.java:295)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.download(RepositoryTransport.java:87)
|
||||
at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.download(RepositoryTransport.java:137)
|
||||
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
|
||||
at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
|
||||
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
|
||||
at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.getAvailableRepositories(UpdateChecker.java:150)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.checkForUpdates(UpdateChecker.java:128)
|
||||
at org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker$UpdateCheckThread.run(UpdateChecker.java:72)
|
||||
|
||||
!ENTRY org.eclipse.equinox.p2.transport.ecf 4 1006 2014-03-11 16:46:21.311
|
||||
!MESSAGE Unknown Host: http://download.aptana.com/studio3-rcp/plugin/update/content.xml
|
||||
!STACK 0
|
||||
java.net.UnknownHostException: download.aptana.com
|
||||
at java.net.PlainSocketImpl.connect(Unknown Source)
|
||||
at java.net.SocksSocketImpl.connect(Unknown Source)
|
||||
at java.net.Socket.connect(Unknown Source)
|
||||
at org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventCreateUtil.createSocket(SocketEventCreateUtil.java:43)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:81)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:73)
|
||||
at org.eclipse.ecf.internal.provider.filetransfer.httpclient.ECFHttpClientProtocolSocketFactory.createSocket(ECFHttpClientProtocolSocketFactory.java:65)
|
||||
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
|
||||
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
|
||||
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
|
||||
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
|
||||
at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientFileSystemBrowser.runRequest(HttpClientFileSystemBrowser.java:227)
|
||||
at org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser$DirectoryJob.run(AbstractFileSystemBrowser.java:69)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
||||
|
||||
!ENTRY org.eclipse.core.resources 4 1 2014-03-11 16:49:31.442
|
||||
!MESSAGE Problems occurred while refreshing local changes
|
||||
!SUBENTRY 1 org.eclipse.core.resources 4 1 2014-03-11 16:49:31.442
|
||||
!MESSAGE Problems occurred while refreshing local changes
|
||||
!STACK 1
|
||||
org.eclipse.core.internal.resources.ResourceException: Errors occurred while refreshing resources with the local file system.
|
||||
at org.eclipse.core.internal.localstore.FileSystemResourceManager.refreshResource(FileSystemResourceManager.java:923)
|
||||
at org.eclipse.core.internal.localstore.FileSystemResourceManager.refresh(FileSystemResourceManager.java:904)
|
||||
at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1663)
|
||||
at org.eclipse.core.internal.refresh.RefreshJob.runInWorkspace(RefreshJob.java:167)
|
||||
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
||||
Contains: The project description file (.project) for 'trustie2' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
|
||||
!SUBENTRY 2 org.eclipse.core.resources 4 271 2014-03-11 16:49:31.442
|
||||
!MESSAGE Errors occurred while refreshing resources with the local file system.
|
||||
!SUBENTRY 3 org.eclipse.core.resources 4 567 2014-03-11 16:49:31.442
|
||||
!MESSAGE The project description file (.project) for 'trustie2' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
|
||||
|
||||
!ENTRY com.aptana.ruby.core 4 0 2014-03-11 17:05:47.412
|
||||
!MESSAGE (eval):1: Use RbConfig instead of obsolete and deprecated Config.
|
||||
(eval):1: warning: variable $= is no longer effective
|
||||
(eval):1: warning: variable $KCODE is no longer effective
|
||||
(eval):1: warning: variable $KCODE is no longer effective
|
||||
D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:180:in `eval': Permission denied - E:\code\trustie\trustie2\.metadata\.plugins\com.aptana.ruby.core\1184073882\4 (Errno::EACCES)
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:180:in `eval'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:180:in `block (3 levels) in <main>'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:179:in `each'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:179:in `block (2 levels) in <main>'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:178:in `open'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:178:in `block in <main>'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:152:in `each'
|
||||
from D:/Users/nudt/AppData/Local/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/93/1/.cp/ruby/core_stubber.rb:152:in `<main>'
|
||||
|
||||
|
||||
!ENTRY com.aptana.ruby.core 4 0 2014-03-11 17:05:50.704
|
||||
!MESSAGE (Build 3.4.0.201304151603) [ERROR] Not supported yet.
|
||||
!STACK 0
|
||||
java.lang.UnsupportedOperationException: Not supported yet.
|
||||
at org.jrubyparser.ast.LambdaNode.accept(LambdaNode.java:58)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitHashNode(InOrderVisitor.java:414)
|
||||
at org.jrubyparser.ast.HashNode.accept(HashNode.java:57)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitCallNode(InOrderVisitor.java:193)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitCallNode(SourceElementVisitor.java:230)
|
||||
at org.jrubyparser.ast.CallNode.accept(CallNode.java:70)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitLocalAsgnNode(InOrderVisitor.java:456)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitLocalAsgnNode(SourceElementVisitor.java:839)
|
||||
at org.jrubyparser.ast.LocalAsgnNode.accept(LocalAsgnNode.java:62)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitIfNode(InOrderVisitor.java:438)
|
||||
at org.jrubyparser.ast.IfNode.accept(IfNode.java:65)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitNewlineNode(InOrderVisitor.java:525)
|
||||
at org.jrubyparser.ast.NewlineNode.accept(NewlineNode.java:67)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitDefnNode(InOrderVisitor.java:299)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitDefnNode(SourceElementVisitor.java:346)
|
||||
at org.jrubyparser.ast.DefnNode.accept(DefnNode.java:51)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitNewlineNode(InOrderVisitor.java:525)
|
||||
at org.jrubyparser.ast.NewlineNode.accept(NewlineNode.java:67)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitClassNode(InOrderVisitor.java:213)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitClassNode(SourceElementVisitor.java:260)
|
||||
at org.jrubyparser.ast.ClassNode.accept(ClassNode.java:68)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitNewlineNode(InOrderVisitor.java:525)
|
||||
at org.jrubyparser.ast.NewlineNode.accept(NewlineNode.java:67)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitModuleNode(InOrderVisitor.java:517)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitModuleNode(SourceElementVisitor.java:824)
|
||||
at org.jrubyparser.ast.ModuleNode.accept(ModuleNode.java:66)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitNewlineNode(InOrderVisitor.java:525)
|
||||
at org.jrubyparser.ast.NewlineNode.accept(NewlineNode.java:67)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:37)
|
||||
at com.aptana.ruby.core.ast.InOrderVisitor.visitRootNode(InOrderVisitor.java:668)
|
||||
at com.aptana.ruby.core.ast.SourceElementVisitor.visitRootNode(SourceElementVisitor.java:848)
|
||||
at org.jrubyparser.ast.RootNode.accept(RootNode.java:84)
|
||||
at com.aptana.ruby.core.ast.AbstractVisitor.acceptNode(AbstractVisitor.java:53)
|
||||
at com.aptana.ruby.internal.core.index.RubyFileIndexingParticipant.indexAST(RubyFileIndexingParticipant.java:73)
|
||||
at com.aptana.ruby.internal.core.index.RubyFileIndexingParticipant.indexSource(RubyFileIndexingParticipant.java:61)
|
||||
at com.aptana.ruby.internal.core.index.RubyFileIndexingParticipant.index(RubyFileIndexingParticipant.java:37)
|
||||
at com.aptana.index.core.IndexRequestJob.indexFileStores(IndexRequestJob.java:205)
|
||||
at com.aptana.index.core.IndexContainerJob.run(IndexContainerJob.java:114)
|
||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<connections/>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="PromoteToProjectWizard">
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
class ArgumentError < StandardError
|
||||
|
||||
|
||||
|
||||
|
||||
protected
|
||||
|
||||
|
||||
private
|
||||
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
ARGV = []
|
||||
TRUE = true
|
||||
FALSE = false
|
||||
STDOUT = IO.new
|
||||
STDIN = IO.new
|
||||
STDERR = IO.new
|
||||
ENV = {}
|
||||
NIL = nil
|
||||
RUBY_PATCHLEVEL = 392
|
||||
RUBY_COPYRIGHT = 'ruby - Copyright (C) 1993-2013 Yukihiro Matsumoto'
|
||||
TOPLEVEL_BINDING = Binding.new
|
||||
RUBY_VERSION = '1.9.3'
|
||||
RUBY_PLATFORM = 'i386-mingw32'
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
$; = nil
|
||||
$-F = nil
|
||||
$@ = nil
|
||||
$! = nil
|
||||
$SAFE = 0
|
||||
$~ = nil
|
||||
$& = nil
|
||||
$` = nil
|
||||
$' = nil
|
||||
$+ = nil
|
||||
$= = false
|
||||
$KCODE = nil
|
||||
$-K = nil
|
||||
$, = nil
|
||||
$/ = "\n"
|
||||
$-0 = "\n"
|
||||
$\ = nil
|
||||
$_ = nil
|
||||
$stdin = IO.new
|
||||
$stdout = IO.new
|
||||
$stderr = IO.new
|
||||
$> = IO.new
|
||||
$< = ARGF
|
||||
$. = 0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="BasicNewProjectResourceWizard">
|
||||
<item value="E:\code" key="OUTSIDE_LOCATION"/>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<connection>
|
||||
<connection>
|
||||
<name>Default</name>
|
||||
<source>file:/C:/Users/nudt</source>
|
||||
</connection>
|
||||
</connection>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sites/>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<servers>
|
||||
<server host="0.0.0.0" port="3000" project="E:/code/demo" type="org.radrails.rails.railsServer">
|
||||
<name>demo</name>
|
||||
</server>
|
||||
</servers>
|
||||
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
|
||||
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
|
||||
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
|||
#safe table
|
||||
#Tue Mar 11 17:27:27 CST 2014
|
||||
connections=connections.9
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#safe table
|
||||
#Tue Mar 11 17:27:27 CST 2014
|
||||
defaultConnection=defaultConnection.9
|
||||
sites=sites.9
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#safe table
|
||||
#Tue Mar 11 17:27:27 CST 2014
|
||||
webservers=webservers.8
|
||||
Binary file not shown.
|
|
@ -1,15 +0,0 @@
|
|||
AbstractTextEditor.Color.Background=20,20,20
|
||||
AbstractTextEditor.Color.Background.SystemDefault=false
|
||||
AbstractTextEditor.Color.Foreground=248,248,248
|
||||
AbstractTextEditor.Color.Foreground.SystemDefault=false
|
||||
AbstractTextEditor.Color.SelectionForeground=248,248,248
|
||||
AbstractTextEditor.Color.SelectionForeground.SystemDefault=false
|
||||
CONFLICTING_COLOR=66,14,9
|
||||
INCOMING_COLOR=235,235,235
|
||||
OUTGOING_COLOR=235,235,235
|
||||
RESOLVED_COLOR=37,59,34
|
||||
additionIndicationColor=37,59,34
|
||||
changeIndicationColor=37,59,34
|
||||
currentLineColor=27,27,27
|
||||
deletionIndicationColor=66,14,9
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
activeProject=demo
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
JS_INDEX_VERSION=0.36
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
last_known_studio_version=3.4.0.1358388620
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
EDITOR_LINE_NUMBER_SET=true
|
||||
WORKSPACE_ENCODING_SET=true
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
index_version=5
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,3 +0,0 @@
|
|||
IDEHasLaunchedBefore=true
|
||||
PerspectiveVersion=103
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding=UTF-8
|
||||
refresh.enabled=true
|
||||
version=1
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.debug.ui.PREF_CHANGED_VALUE_BACKGROUND=74,65,13
|
||||
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<launchPerspectives/>\r\n
|
||||
org.eclipse.debug.ui.consoleBackground=20,20,20
|
||||
org.eclipse.debug.ui.errorColor=255,0,0
|
||||
org.eclipse.debug.ui.inColor=95,175,176
|
||||
org.eclipse.debug.ui.outColor=248,248,248
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.search.potentialMatch.fgColor=94,101,105
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
browsers=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<web-browsers current\="0">\r\n<system/>\r\n<external location\="C\:\\Program Files\\Internet Explorer\\iexplore.exe" name\="Internet Explorer"/>\r\n</web-browsers>
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
AbstractTextEditor.Color.Background=20,20,20
|
||||
AbstractTextEditor.Color.Background.SystemDefault=false
|
||||
AbstractTextEditor.Color.Foreground=248,248,248
|
||||
AbstractTextEditor.Color.Foreground.SystemDefault=false
|
||||
AbstractTextEditor.Color.SelectionBackground=60,64,67
|
||||
AbstractTextEditor.Color.SelectionBackground.SystemDefault=false
|
||||
AbstractTextEditor.Color.SelectionForeground=248,248,248
|
||||
AbstractTextEditor.Color.SelectionForeground.SystemDefault=false
|
||||
CONFLICTING_COLOR=66,14,9
|
||||
INCOMING_COLOR=235,235,235
|
||||
OUTGOING_COLOR=235,235,235
|
||||
OccurrenceIndicationColor=94,101,105
|
||||
RESOLVED_COLOR=37,59,34
|
||||
additionIndicationColor=37,59,34
|
||||
changeIndicationColor=37,59,34
|
||||
currentIPColor=14,34,49
|
||||
currentLineColor=27,27,27
|
||||
deletionIndicationColor=66,14,9
|
||||
eclipse.preferences.version=1
|
||||
htmlTagPairOccurrenceIndication=true
|
||||
htmlTagPairOccurrenceIndicationColor=94,94,94
|
||||
htmlTagPairOccurrenceIndicationHighlighting=false
|
||||
htmlTagPairOccurrenceIndicationTextStyle=BOX
|
||||
lineNumberRuler=true
|
||||
occurrenceIndicationColor=60,64,67
|
||||
pydevOccurrenceHighlighting=false
|
||||
pydevOccurrenceIndication=true
|
||||
pydevOccurrenceIndicationColor=94,94,94
|
||||
pydevOccurrenceIndicationTextStyle=BOX
|
||||
rubyBlockPairOccurrenceIndication=true
|
||||
rubyBlockPairOccurrenceIndicationColor=94,94,94
|
||||
rubyBlockPairOccurrenceIndicationHighlighting=false
|
||||
rubyBlockPairOccurrenceIndicationTextStyle=BOX
|
||||
searchResultIndicationColor=94,101,105
|
||||
secondaryIPColor=14,34,49
|
||||
writeOccurrenceIndicationColor=60,64,67
|
||||
xmlTagPairOccurrenceIndication=true
|
||||
xmlTagPairOccurrenceIndicationColor=94,94,94
|
||||
xmlTagPairOccurrenceIndicationHighlighting=false
|
||||
xmlTagPairOccurrenceIndicationTextStyle=BOX
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
PROBLEMS_FILTERS_MIGRATE=true
|
||||
SHOW_COOLBAR=true
|
||||
SHOW_PERSPECTIVEBAR=true
|
||||
eclipse.preferences.version=1
|
||||
platformState=1394526372425
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
AbstractTextEditor.Color.Background=20,20,20
|
||||
AbstractTextEditor.Color.Background.SystemDefault=false
|
||||
AbstractTextEditor.Color.Foreground=248,248,248
|
||||
AbstractTextEditor.Color.Foreground.SystemDefault=false
|
||||
AbstractTextEditor.Color.SelectionBackground=60,64,67
|
||||
AbstractTextEditor.Color.SelectionForeground=248,248,248
|
||||
AbstractTextEditor.Color.SelectionForeground.SystemDefault=false
|
||||
currentLineColor=27,27,27
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
ACTIVE_HYPERLINK_COLOR=84,143,160
|
||||
HYPERLINK_COLOR=84,143,160
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.IgnoredBackgroundColor=20,20,20
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.IgnoredForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.addedBackgroundColor=37,59,34
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.addedForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.changedBackgroundColor=74,65,13
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.changedForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.conflictBackgroundColor=20,20,20
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.conflictForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.deletedBackgroundColor=66,14,9
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.deletedForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.removedBackgroundColor=66,14,9
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.removedForegroundColor=248,248,248
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.unknownBackgroundColor=20,20,20
|
||||
com.vectrace.mercurialeclipse.ui.colorsandfonts.unknownForegroundColor=248,248,248
|
||||
eclipse.preferences.version=1
|
||||
hyperlinkColor=84,143,160
|
||||
hyperlinkColor.SystemDefault=false
|
||||
org.eclipse.egit.ui.UncommittedChangeBackgroundColor=37,59,34
|
||||
org.eclipse.egit.ui.UncommittedChangeForegroundColor=248,248,248
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType">
|
||||
<booleanAttribute key="advancedRunEnabled" value="false"/>
|
||||
<booleanAttribute key="appendProjectName" value="true"/>
|
||||
<stringAttribute key="browserExecutable" value=""/>
|
||||
<stringAttribute key="browserNature" value="Firefox"/>
|
||||
<stringAttribute key="externalBaseUrl" value=""/>
|
||||
<stringAttribute key="httpGetData" value=""/>
|
||||
<stringAttribute key="httpPostContentType" value=""/>
|
||||
<stringAttribute key="httpPostData" value=""/>
|
||||
<booleanAttribute key="overrideDebugPreferences" value="false"/>
|
||||
<intAttribute key="serverType" value="1"/>
|
||||
<intAttribute key="startActionType" value="1"/>
|
||||
<stringAttribute key="startPagePath" value=""/>
|
||||
<stringAttribute key="startPageUrl" value=""/>
|
||||
<booleanAttribute key="suspendOnDebuggerKeywords" value="true"/>
|
||||
<booleanAttribute key="suspendOnErrors" value="true"/>
|
||||
<booleanAttribute key="suspendOnExceptions" value="false"/>
|
||||
<booleanAttribute key="suspendOnFirstLine" value="false"/>
|
||||
</launchConfiguration>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType">
|
||||
<booleanAttribute key="advancedRunEnabled" value="false"/>
|
||||
<booleanAttribute key="appendProjectName" value="true"/>
|
||||
<stringAttribute key="browserExecutable" value="C:\Program Files (x86)\Internet Explorer\iexplore.exe"/>
|
||||
<stringAttribute key="browserNature" value="Internet Explorer"/>
|
||||
<stringAttribute key="externalBaseUrl" value=""/>
|
||||
<stringAttribute key="httpGetData" value=""/>
|
||||
<stringAttribute key="httpPostContentType" value=""/>
|
||||
<stringAttribute key="httpPostData" value=""/>
|
||||
<booleanAttribute key="overrideDebugPreferences" value="false"/>
|
||||
<intAttribute key="serverType" value="1"/>
|
||||
<intAttribute key="startActionType" value="1"/>
|
||||
<stringAttribute key="startPagePath" value=""/>
|
||||
<stringAttribute key="startPageUrl" value=""/>
|
||||
<booleanAttribute key="suspendOnDebuggerKeywords" value="true"/>
|
||||
<booleanAttribute key="suspendOnErrors" value="true"/>
|
||||
<booleanAttribute key="suspendOnExceptions" value="false"/>
|
||||
<booleanAttribute key="suspendOnFirstLine" value="false"/>
|
||||
</launchConfiguration>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchHistory>
|
||||
<launchGroup id="org.eclipse.ui.externaltools.launchGroup">
|
||||
<mruHistory/>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.profile">
|
||||
<mruHistory/>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
|
||||
<mruHistory>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Firefox - Internal Server"/> "/>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Internet Explorer - Internal Server"/> "/>
|
||||
</mruHistory>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
|
||||
<mruHistory>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Firefox - Internal Server"/> "/>
|
||||
<launch memento="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration local="true" path="Internet Explorer - Internal Server"/> "/>
|
||||
</mruHistory>
|
||||
<favorites/>
|
||||
</launchGroup>
|
||||
</launchHistory>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<list key="installedFeatures">
|
||||
<item value="com.aptana.feature.rcp:3.4.0.201304151603-7o7nFDBFFeFt3XrpXNucaz0uIWkY"/>
|
||||
<item value="com.aptana.feature.studio:3.4.0.201304151542-7E7G-7MEMVKUHgFcLgFbkKoz0t-7"/>
|
||||
<item value="com.aptana.feature:3.4.0.1365900908-BW7R8FBu-Ylk0DFYW1DC44EXt-dS"/>
|
||||
<item value="com.aptana.php.feature:3.3.0.201304151524-7J7E-7IOW_UXOSJY"/>
|
||||
<item value="com.aptana.pydev.feature:2.7.0.2013032300-7g9I-8Jez0cfdJcee"/>
|
||||
<item value="org.eclipse.help:1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx"/>
|
||||
<item value="org.eclipse.platform:3.7.2.v20120207-1839-9gF7UHPDFxGjd-PqDr2jX_4yKaumkoHTz04_q-q"/>
|
||||
<item value="org.eclipse.rcp:3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/>
|
||||
<item value="org.radrails.rails:3.3.0.201304151525-7e-7Q7f5GRKMDENR"/>
|
||||
</list>
|
||||
</section>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="ImportExportAction">
|
||||
<item value="com.aptana.projects.internal.wizards.PromoteToProjectWizard" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/>
|
||||
<list key="ImportExportPage.STORE_EXPANDED_IMPORT_CATEGORIES">
|
||||
<item value="org.eclipse.ui.Basic"/>
|
||||
<item value="com.aptana.git.ui.clone.category"/>
|
||||
</list>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workbench progressCount="30" version="2.0">
|
||||
<workbenchAdvisor/>
|
||||
<window height="940" maximized="true" width="1200" x="13" y="31">
|
||||
<fastViewData fastViewLocation="1024"/>
|
||||
<perspectiveBar>
|
||||
<itemSize x="160"/>
|
||||
</perspectiveBar>
|
||||
<coolbarLayout>
|
||||
<coolItem id="group.file" itemType="typeGroupMarker"/>
|
||||
<coolItem id="org.eclipse.ui.workbench.file" itemType="typeToolBarContribution" x="126" y="22"/>
|
||||
<coolItem id="additions" itemType="typeGroupMarker"/>
|
||||
<coolItem id="org.eclipse.debug.ui.launchActionSet" itemType="typeToolBarContribution" x="145" y="22"/>
|
||||
<coolItem id="org.eclipse.search.searchActionSet" itemType="typeToolBarContribution" x="88" y="22"/>
|
||||
<coolItem id="com.aptana.ui.globalActionSet" itemType="typeToolBarContribution" x="172" y="22"/>
|
||||
<coolItem id="org.eclipse.ui.edit.text.actionSet.presentation" itemType="typeToolBarContribution" x="84" y="22"/>
|
||||
<coolItem id="group.nav" itemType="typeGroupMarker"/>
|
||||
<coolItem id="org.eclipse.ui.workbench.navigate" itemType="typeToolBarContribution" x="99" y="22"/>
|
||||
<coolItem id="group.editor" itemType="typeGroupMarker"/>
|
||||
<coolItem id="group.help" itemType="typeGroupMarker"/>
|
||||
<coolItem id="org.eclipse.ui.workbench.help" itemType="typeToolBarContribution" x="-1" y="-1"/>
|
||||
</coolbarLayout>
|
||||
<page aggregateWorkingSetId="Aggregate for window 1394526806133" focus="true" label="Workspace - Web">
|
||||
<editors>
|
||||
<editorArea activeWorkbook="DefaultEditorWorkbook">
|
||||
<info part="DefaultEditorWorkbook">
|
||||
<folder appearance="1" expanded="2">
|
||||
<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"/>
|
||||
</folder>
|
||||
</info>
|
||||
</editorArea>
|
||||
</editors>
|
||||
<views>
|
||||
<view id="org.eclipse.ui.navigator.ProjectExplorer" partName="Project Explorer">
|
||||
<viewState CommonNavigator.LINKING_ENABLED="0" org.eclipse.ui.navigator.resources.workingSets.showTopLevelWorkingSets="0"/>
|
||||
</view>
|
||||
<view id="com.aptana.terminal.views.terminal:demo" partName="demo">
|
||||
<viewState>
|
||||
<title>demo</title>
|
||||
<workingDirectory>E:\code\demo</workingDirectory>
|
||||
</viewState>
|
||||
</view>
|
||||
<view id="com.aptana.snippets.ui.views.SnippetsView" partName="Snippets">
|
||||
<viewState/>
|
||||
</view>
|
||||
<view id="com.aptana.terminal.views.terminal" partName="Terminal">
|
||||
<viewState>
|
||||
<title>Terminal</title>
|
||||
<workingDirectory>C:\Users\nudt</workingDirectory>
|
||||
</viewState>
|
||||
</view>
|
||||
<view id="com.aptana.samples.ui.SamplesView" partName="Samples">
|
||||
<viewState/>
|
||||
</view>
|
||||
<view id="org.eclipse.ui.views.ProblemView" partName="Problems">
|
||||
<viewState PRIMARY_SORT_FIELD="org.eclipse.ui.ide.severityAndDescriptionField" categoryGroup="org.eclipse.ui.ide.severity" markerContentGenerator="org.eclipse.ui.ide.problemsGenerator" partName="Problems">
|
||||
<columnWidths org.eclipse.ui.ide.locationField="105" org.eclipse.ui.ide.markerType="105" org.eclipse.ui.ide.pathField="140" org.eclipse.ui.ide.resourceField="105" org.eclipse.ui.ide.severityAndDescriptionField="350"/>
|
||||
<visible IMemento.internal.id="org.eclipse.ui.ide.severityAndDescriptionField"/>
|
||||
<visible IMemento.internal.id="org.eclipse.ui.ide.resourceField"/>
|
||||
<visible IMemento.internal.id="org.eclipse.ui.ide.pathField"/>
|
||||
<visible IMemento.internal.id="org.eclipse.ui.ide.locationField"/>
|
||||
<visible IMemento.internal.id="org.eclipse.ui.ide.markerType"/>
|
||||
</viewState>
|
||||
</view>
|
||||
<view id="org.eclipse.ui.console.ConsoleView" partName="Console">
|
||||
<viewState/>
|
||||
</view>
|
||||
<view id="com.aptana.explorer.view" partName="App Explorer">
|
||||
<viewState CommonNavigator.LINKING_ENABLED="0" GitChangedFilesFilterEnabled="" activeProject="demo">
|
||||
<project name="demo">
|
||||
<selection>
|
||||
<element path="/demo/app"/>
|
||||
</selection>
|
||||
</project>
|
||||
</viewState>
|
||||
</view>
|
||||
<view id="org.eclipse.ui.views.ContentOutline" partName="Outline">
|
||||
<viewState/>
|
||||
</view>
|
||||
</views>
|
||||
<perspectives activePart="com.aptana.explorer.view" activePerspective="com.aptana.ui.WebPerspective">
|
||||
<perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016">
|
||||
<descriptor class="com.aptana.ui.internal.WebPerspectiveFactory" id="com.aptana.ui.WebPerspective" label="Web"/>
|
||||
<alwaysOnActionSet id="com.aptana.browser.actionSet"/>
|
||||
<alwaysOnActionSet id="com.aptana.ruby.debug.ui.RubyDebugActionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.cheatsheets.actionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.search.searchActionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.actionSet.keyBindings"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.actionSet.openFiles"/>
|
||||
<alwaysOnActionSet id="com.aptana.editor.common.presentation"/>
|
||||
<alwaysOnActionSet id="org.eclipse.debug.ui.launchActionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.debug.ui.breakpointActionSet"/>
|
||||
<alwaysOnActionSet id="com.aptana.js.debug.ui.actionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.NavigateActionSet"/>
|
||||
<alwaysOnActionSet id="org.eclipse.ui.edit.text.actionSet.presentation"/>
|
||||
<alwaysOnActionSet id="com.aptana.ui.globalActionSet"/>
|
||||
<alwaysOnActionSet id="com.aptana.terminal.actionSet"/>
|
||||
<show_view_action id="com.aptana.browser.views.webbrowser"/>
|
||||
<show_view_action id="com.aptana.explorer.view"/>
|
||||
<show_view_action id="org.eclipse.ui.navigator.ProjectExplorer"/>
|
||||
<show_view_action id="com.aptana.ui.io.remoteview"/>
|
||||
<show_view_action id="org.eclipse.ui.views.ContentOutline"/>
|
||||
<show_view_action id="com.aptana.samples.ui.SamplesView"/>
|
||||
<show_view_action id="com.aptana.snippets.ui.views.SnippetsView"/>
|
||||
<show_view_action id="com.aptana.terminal.views.terminal"/>
|
||||
<show_view_action id="org.eclipse.ui.console.ConsoleView"/>
|
||||
<show_view_action id="org.eclipse.pde.runtime.LogView"/>
|
||||
<show_view_action id="org.eclipse.ui.views.ProblemView"/>
|
||||
<show_view_action id="org.eclipse.ui.views.TaskList"/>
|
||||
<show_view_action id="com.aptana.webserver.ui.view"/>
|
||||
<new_wizard_action id="com.aptana.editor.php.NewPHPProjectWizard"/>
|
||||
<new_wizard_action id="com.aptana.ui.wizards.NewWebProject"/>
|
||||
<new_wizard_action id="com.aptana.ruby.core.ui.rubyProjectWizard"/>
|
||||
<new_wizard_action id="com.aptana.ui.wizards.new.file"/>
|
||||
<new_wizard_action id="org.eclipse.ui.wizards.new.folder"/>
|
||||
<new_wizard_action id="org.eclipse.ui.editors.wizards.UntitledTextFileWizard"/>
|
||||
<new_wizard_action id="org.radrails.rails.ui.projectWizard"/>
|
||||
<perspective_action id="org.eclipse.debug.ui.DebugPerspective"/>
|
||||
<hide_toolbar_item_id id="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"/>
|
||||
<view id="com.aptana.explorer.view"/>
|
||||
<view id="org.eclipse.ui.navigator.ProjectExplorer"/>
|
||||
<view id="org.eclipse.ui.console.ConsoleView"/>
|
||||
<view id="com.aptana.terminal.views.terminal"/>
|
||||
<view id="org.eclipse.ui.views.ProblemView"/>
|
||||
<view id="com.aptana.terminal.views.terminal:demo"/>
|
||||
<view id="org.eclipse.ui.views.ContentOutline"/>
|
||||
<view id="com.aptana.samples.ui.SamplesView"/>
|
||||
<view id="com.aptana.snippets.ui.views.SnippetsView"/>
|
||||
<fastViewBars/>
|
||||
<layout>
|
||||
<mainWindow>
|
||||
<info folder="true" part="left">
|
||||
<folder activePageID="com.aptana.explorer.view" appearance="2" expanded="2">
|
||||
<page content="com.aptana.explorer.view" label="App Explorer"/>
|
||||
<page content="org.eclipse.ui.navigator.ProjectExplorer" label="Project Explorer"/>
|
||||
<page content="com.aptana.ui.io.remoteview" label="LabelNotFound"/>
|
||||
<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory">
|
||||
<part id="0"/>
|
||||
<part id="1"/>
|
||||
</presentation>
|
||||
</folder>
|
||||
</info>
|
||||
<info folder="true" part="stickyFolderRight" ratio="0.7495741" ratioLeft="880" ratioRight="294" relationship="2" relative="left">
|
||||
<folder appearance="2" expanded="2">
|
||||
<page content="org.eclipse.help.ui.HelpView" label="LabelNotFound"/>
|
||||
<page content="org.eclipse.ui.internal.introview" label="LabelNotFound"/>
|
||||
<page content="org.eclipse.ui.cheatsheets.views.CheatSheetView" label="LabelNotFound"/>
|
||||
</folder>
|
||||
</info>
|
||||
<info part="org.eclipse.ui.editorss" ratio="0.19931857" ratioLeft="234" ratioRight="940" relationship="2" relative="left"/>
|
||||
<info folder="true" part="terminalArea" ratio="0.75" ratioLeft="627" ratioRight="209" relationship="4" relative="org.eclipse.ui.editorss">
|
||||
<folder activePageID="com.aptana.terminal.views.terminal:demo" appearance="2" expanded="2">
|
||||
<page content="org.eclipse.ui.console.ConsoleView" label="Console"/>
|
||||
<page content="com.aptana.terminal.views.terminal" label="Terminal"/>
|
||||
<page content="org.eclipse.ui.views.ProblemView" label="Problems"/>
|
||||
<page content="com.aptana.terminal.views.terminal:demo" label="demo"/>
|
||||
<page content="org.eclipse.pde.runtime.LogView" label="LabelNotFound"/>
|
||||
<page content="org.eclipse.ui.views.TaskList" label="LabelNotFound"/>
|
||||
<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory">
|
||||
<part id="0"/>
|
||||
<part id="1"/>
|
||||
<part id="2"/>
|
||||
<part id="3"/>
|
||||
</presentation>
|
||||
</folder>
|
||||
</info>
|
||||
<info folder="true" part="org.eclipse.ui.internal.ViewStack@d90254" ratio="0.75" ratioLeft="627" ratioRight="209" relationship="4" relative="left">
|
||||
<folder activePageID="com.aptana.snippets.ui.views.SnippetsView" appearance="2" expanded="2">
|
||||
<page content="org.eclipse.ui.views.ContentOutline" label="Outline"/>
|
||||
<page content="com.aptana.samples.ui.SamplesView" label="Samples"/>
|
||||
<page content="com.aptana.snippets.ui.views.SnippetsView" label="Snippets"/>
|
||||
<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory">
|
||||
<part id="0"/>
|
||||
<part id="1"/>
|
||||
<part id="2"/>
|
||||
</presentation>
|
||||
</folder>
|
||||
</info>
|
||||
</mainWindow>
|
||||
</layout>
|
||||
</perspective>
|
||||
</perspectives>
|
||||
<workingSets/>
|
||||
<navigationHistory/>
|
||||
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/" type="8"/>
|
||||
</page>
|
||||
<workbenchWindowAdvisor/>
|
||||
<actionBarAdvisor/>
|
||||
<trimLayout>
|
||||
<trimArea IMemento.internal.id="128">
|
||||
<trimItem IMemento.internal.id="org.eclipse.ui.internal.WorkbenchWindow.topBar"/>
|
||||
</trimArea>
|
||||
<trimArea IMemento.internal.id="1024">
|
||||
<trimItem IMemento.internal.id="org.eclise.ui.internal.FastViewBar"/>
|
||||
<trimItem IMemento.internal.id="org.eclipse.jface.action.StatusLineManager"/>
|
||||
<trimItem IMemento.internal.id="org.eclipse.ui.internal.progress.ProgressRegion"/>
|
||||
</trimArea>
|
||||
</trimLayout>
|
||||
</window>
|
||||
<mruList/>
|
||||
</workbench>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workingSetManager>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1394526806133_0" label="Window Working Set" name="Aggregate for window 1394526806133"/>
|
||||
</workingSetManager>
|
||||
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.core.runtime=1
|
||||
25
Client.html
25
Client.html
|
|
@ -1,25 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>
|
||||
Client
|
||||
</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<hr />
|
||||
<h2>这是一张图片</h2>
|
||||
<p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p>
|
||||
<hr />
|
||||
|
||||
<h2>这是一段视频</h2>
|
||||
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p>
|
||||
<hr />
|
||||
|
||||
<h2>这是一篇文章</h2>
|
||||
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p>
|
||||
<hr />
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
404
Gemfile
404
Gemfile
|
|
@ -1,124 +1,314 @@
|
|||
source 'https://rubygems.org'
|
||||
source "https://ruby.taobao.org"
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem 'rubyzip'
|
||||
gem 'zip-zip'
|
||||
#<<<<<<< HEAD
|
||||
gem 'trustie', path: '../gems/trustie'
|
||||
#gem 'rails', '4.1.11'
|
||||
#=======
|
||||
gem 'rails', '4.2.4'
|
||||
gem 'rails-deprecated_sanitizer', '~> 1.0.3'
|
||||
|
||||
# Responders respond_to and respond_with
|
||||
gem 'responders', '~> 2.0'
|
||||
#>>>>>>> abf54f230ef7ff80c0ca1baa6a3c4c3d0cbb7869
|
||||
|
||||
# Specify a sprockets version due to security issue
|
||||
# See https://groups.google.com/forum/#!topic/rubyonrails-security/doAVp0YaTqY
|
||||
gem 'sprockets', '~> 2.12.3'
|
||||
|
||||
# Default values for AR models
|
||||
gem "default_value_for", "~> 3.0.0"
|
||||
|
||||
# Supported DBs
|
||||
gem "mysql2", '~> 0.3.16', group: :mysql
|
||||
gem "pg", '~> 0.18.2', group: :postgres
|
||||
|
||||
# Authentication libraries
|
||||
gem 'devise', '~> 3.5.2'
|
||||
gem 'devise-async', '~> 0.9.0'
|
||||
gem 'doorkeeper', '~> 2.2.0'
|
||||
gem 'omniauth', '~> 1.2.2'
|
||||
gem 'omniauth-bitbucket', '~> 0.0.2'
|
||||
gem 'omniauth-facebook', '~> 3.0.0'
|
||||
gem 'omniauth-github', '~> 1.1.1'
|
||||
gem 'omniauth-gitlab', '~> 1.0.0'
|
||||
gem 'omniauth-google-oauth2', '~> 0.2.0'
|
||||
gem 'omniauth-kerberos', '~> 0.3.0', group: :kerberos
|
||||
gem 'omniauth-saml', '~> 1.4.0'
|
||||
gem 'omniauth-shibboleth', '~> 1.2.0'
|
||||
gem 'omniauth-twitter', '~> 1.2.0'
|
||||
gem 'omniauth_crowd'
|
||||
gem 'rack-oauth2', '~> 1.2.1'
|
||||
|
||||
# Two-factor authentication
|
||||
gem 'devise-two-factor', '~> 2.0.0'
|
||||
gem 'rqrcode-rails3', '~> 0.1.7'
|
||||
gem 'attr_encrypted', '~> 1.3.4'
|
||||
|
||||
# Browser detection
|
||||
gem "browser", '~> 1.0.0'
|
||||
|
||||
# Extracting information from a git repository
|
||||
# Provide access to Gitlab::Git library
|
||||
gem "gitlab_git", '~> 7.2.20'
|
||||
|
||||
# LDAP Auth
|
||||
# GitLab fork with several improvements to original library. For full list of changes
|
||||
# see https://github.com/intridea/omniauth-ldap/compare/master...gitlabhq:master
|
||||
gem 'gitlab_omniauth-ldap', '~> 1.2.1', require: "omniauth-ldap"
|
||||
|
||||
# Git Wiki
|
||||
gem 'gollum-lib', '~> 4.0.2'
|
||||
|
||||
# Language detection
|
||||
gem "github-linguist", "~> 4.7.0", require: "linguist"
|
||||
|
||||
# API
|
||||
#gem 'grape', '~> 0.13.0'
|
||||
gem 'grape-entity', '~> 0.4.2'
|
||||
gem 'rack-cors', '~> 0.4.0', require: 'rack/cors'
|
||||
|
||||
# Format dates and times
|
||||
# based on human-friendly examples
|
||||
gem "stamp", '~> 0.6.0'
|
||||
|
||||
# Pagination
|
||||
gem "kaminari", "~> 0.16.3"
|
||||
|
||||
# HAML
|
||||
gem "haml-rails", '~> 0.9.0'
|
||||
|
||||
# Files attachments
|
||||
gem "carrierwave", '~> 0.9.0'
|
||||
|
||||
# Drag and Drop UI
|
||||
gem 'dropzonejs-rails', '~> 0.7.1'
|
||||
|
||||
# for aws storage
|
||||
gem "fog", "~> 1.25.0"
|
||||
gem "unf", '~> 0.1.4'
|
||||
|
||||
# Authorization
|
||||
gem "six", '~> 0.2.0'
|
||||
|
||||
# Seed data
|
||||
gem "seed-fu", '~> 2.3.5'
|
||||
|
||||
# Markdown and HTML processing
|
||||
gem 'html-pipeline', '~> 1.11.0'
|
||||
gem 'task_list', '~> 1.0.2', require: 'task_list/railtie'
|
||||
gem 'github-markup', '~> 1.3.1'
|
||||
gem 'redcarpet', '~> 3.3.3'
|
||||
gem 'RedCloth', '~> 4.2.9'
|
||||
gem 'rdoc', '~>3.6'
|
||||
gem 'org-ruby', '~> 0.9.12'
|
||||
gem 'creole', '~> 0.5.0'
|
||||
gem 'wikicloth', '0.8.1'
|
||||
gem 'asciidoctor', '~> 1.5.2'
|
||||
gem 'net-ssh', '~> 3.0.1'
|
||||
|
||||
# Diffs
|
||||
gem 'diffy', '~> 3.0.3'
|
||||
|
||||
# Application server
|
||||
group :unicorn do
|
||||
gem "unicorn", '~> 4.8.2'
|
||||
gem 'unicorn-worker-killer', '~> 0.4.2'
|
||||
end
|
||||
|
||||
gem 'seems_rateable', path: 'lib/seems_rateable'
|
||||
gem "rails", "3.2.13"
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem "coderay", "~> 1.0.6"
|
||||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "builder", "3.0.0"
|
||||
gem 'acts-as-taggable-on', '2.4.1'
|
||||
# State machine
|
||||
gem "state_machines-activerecord", '~> 0.3.0'
|
||||
# Run events after state machine commits
|
||||
gem 'after_commit_queue'
|
||||
|
||||
# Issue tags
|
||||
gem 'acts-as-taggable-on', '~> 3.4'
|
||||
|
||||
# Background jobs
|
||||
gem 'sinatra', '~> 1.4.4', require: nil
|
||||
gem 'sidekiq', '3.3.0'
|
||||
gem 'sidetiq', '~> 0.6.3'
|
||||
|
||||
# HTTP requests
|
||||
gem "httparty", '~> 0.13.3'
|
||||
|
||||
# Colored output to console
|
||||
gem "colorize", '~> 0.7.0'
|
||||
|
||||
# GitLab settings
|
||||
gem 'settingslogic', '~> 2.0.9'
|
||||
|
||||
# Misc
|
||||
|
||||
gem 'version_sorter', '~> 2.0.0'
|
||||
|
||||
# Cache
|
||||
gem "redis-rails", '~> 4.0.0'
|
||||
|
||||
# Campfire integration
|
||||
gem 'tinder', '~> 1.10.0'
|
||||
|
||||
# HipChat integration
|
||||
gem 'hipchat', '~> 1.5.0'
|
||||
|
||||
# Flowdock integration
|
||||
gem "gitlab-flowdock-git-hook", "~> 1.0.1"
|
||||
|
||||
# Gemnasium integration
|
||||
gem "gemnasium-gitlab-service", "~> 0.2"
|
||||
|
||||
# Slack integration
|
||||
gem "slack-notifier", "~> 1.2.0"
|
||||
|
||||
# Asana integration
|
||||
gem 'asana', '~> 0.4.0'
|
||||
|
||||
# FogBugz integration
|
||||
gem 'ruby-fogbugz', '~> 0.2.1'
|
||||
|
||||
# d3
|
||||
gem 'd3_rails', '~> 3.5.5'
|
||||
|
||||
#cal-heatmap
|
||||
gem "cal-heatmap-rails", "~> 0.0.1"
|
||||
|
||||
# underscore-rails
|
||||
gem "underscore-rails", "~> 1.4.4"
|
||||
|
||||
# Sanitize user input
|
||||
gem "sanitize", '~> 2.0'
|
||||
|
||||
# Protect against bruteforcing
|
||||
gem "rack-attack", '~> 4.3.0'
|
||||
|
||||
# Ace editor
|
||||
gem 'ace-rails-ap', '~> 2.0.1'
|
||||
|
||||
# Keyboard shortcuts
|
||||
gem 'mousetrap-rails', '~> 1.4.6'
|
||||
|
||||
# Detect and convert string character encoding
|
||||
gem 'charlock_holmes', '~> 0.7.3'
|
||||
|
||||
gem "sass-rails", '~> 4.0.5'
|
||||
gem "coffee-rails", '~> 4.1.0'
|
||||
gem "uglifier", '~> 2.7.2'
|
||||
gem 'turbolinks', '~> 2.5.0'
|
||||
gem 'jquery-turbolinks', '~> 2.1.0'
|
||||
|
||||
gem 'addressable', '~> 2.3.8'
|
||||
gem 'bootstrap-sass', '~> 3.0'
|
||||
gem 'font-awesome-rails', '~> 4.2'
|
||||
gem 'gitlab_emoji', '~> 0.1'
|
||||
gem 'gon', '~> 6.0.1'
|
||||
gem 'jquery-atwho-rails', '~> 1.3.2'
|
||||
gem 'jquery-rails', '~> 3.1.3'
|
||||
gem 'jquery-scrollto-rails', '~> 1.4.3'
|
||||
gem 'jquery-ui-rails', '~> 4.2.1'
|
||||
gem 'nprogress-rails', '~> 0.1.6.7'
|
||||
gem 'raphael-rails', '~> 2.1.2'
|
||||
gem 'request_store', '~> 1.2.0'
|
||||
gem 'select2-rails', '~> 3.5.9'
|
||||
gem 'virtus', '~> 1.0.1'
|
||||
|
||||
group :development do
|
||||
gem 'better_errors', path: 'lib/better_errors'
|
||||
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
||||
if ENV['PRY']
|
||||
gem 'pry'
|
||||
gem 'pry-nav'
|
||||
end
|
||||
gem "foreman"
|
||||
gem 'brakeman', '3.0.1', require: false
|
||||
|
||||
gem "annotate", "~> 2.6.0"
|
||||
gem "letter_opener", '~> 1.1.2'
|
||||
gem 'quiet_assets', '~> 1.0.2'
|
||||
gem 'rerun', '~> 0.10.0'
|
||||
gem 'bullet', require: false
|
||||
gem 'rblineprof', platform: :mri, require: false
|
||||
gem 'web-console', '~> 2.0'
|
||||
|
||||
# Better errors handler
|
||||
gem 'better_errors', '~> 1.0.1'
|
||||
gem 'binding_of_caller', '~> 0.7.2'
|
||||
|
||||
# Docs generator
|
||||
gem "sdoc", '~> 0.3.20'
|
||||
|
||||
# thin instead webrick
|
||||
gem 'thin', '~> 1.6.1'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'byebug', platform: :mri
|
||||
gem 'pry-rails'
|
||||
|
||||
gem 'awesome_print', '~> 1.2.0'
|
||||
gem 'fuubar', '~> 2.0.0'
|
||||
|
||||
gem 'database_cleaner', '~> 1.4.0'
|
||||
gem 'factory_girl_rails', '~> 4.3.0'
|
||||
gem 'rspec-rails', '~> 3.3.0'
|
||||
gem 'spinach-rails', '~> 0.2.1'
|
||||
|
||||
# Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826)
|
||||
gem 'minitest', '~> 5.7.0'
|
||||
|
||||
# Generate Fake data
|
||||
gem 'ffaker', '~> 2.0.0'
|
||||
|
||||
gem 'capybara', '~> 2.4.0'
|
||||
gem 'capybara-screenshot', '~> 1.0.0'
|
||||
gem 'poltergeist', '~> 1.6.0'
|
||||
|
||||
gem 'teaspoon', '~> 1.0.0'
|
||||
gem 'teaspoon-jasmine', '~> 2.2.0'
|
||||
|
||||
gem 'spring', '~> 1.3.6'
|
||||
gem 'spring-commands-rspec', '~> 1.0.4'
|
||||
gem 'spring-commands-spinach', '~> 1.0.0'
|
||||
gem 'spring-commands-teaspoon', '~> 0.0.2'
|
||||
|
||||
gem 'rubocop', '~> 0.28.0', require: false
|
||||
gem 'coveralls', '~> 0.8.2', require: false
|
||||
gem 'simplecov', '~> 0.10.0', require: false
|
||||
gem 'flog', require: false
|
||||
gem 'flay', require: false
|
||||
gem 'bundler-audit', require: false
|
||||
|
||||
gem 'benchmark-ips', require: false
|
||||
#>>>>>>> abf54f230ef7ff80c0ca1baa6a3c4c3d0cbb7869
|
||||
end
|
||||
|
||||
group :test do
|
||||
#gem "shoulda", "~> 3.3.2"
|
||||
gem "shoulda", "> 3.3.2"
|
||||
gem "mocha", "~> 0.13.3"
|
||||
gem 'capybara', '~> 2.0.0'
|
||||
gem 'nokogiri', '< 1.6.0'
|
||||
gem 'shoulda-matchers', '~> 2.8.0', require: false
|
||||
gem 'email_spec', '~> 1.6.0'
|
||||
gem 'webmock', '~> 1.21.0'
|
||||
gem 'test_after_commit', '~> 0.4.2'
|
||||
gem 'sham_rack'
|
||||
end
|
||||
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.3'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
group :production do
|
||||
gem "gitlab_meta", '7.0'
|
||||
end
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
gem "net-ldap", "~> 0.3.1"
|
||||
end
|
||||
gem "newrelic_rpm", '~> 3.9.4.245'
|
||||
gem 'newrelic-grape'
|
||||
|
||||
gem 'octokit', '~> 3.7.0'
|
||||
|
||||
gem "mail_room", "~> 0.6.1"
|
||||
|
||||
gem 'email_reply_parser', '~> 0.5.8'
|
||||
|
||||
## CI
|
||||
gem 'activerecord-deprecated_finders', '~> 1.0.3'
|
||||
gem 'activerecord-session_store', '~> 0.1.0'
|
||||
gem "nested_form", '~> 0.3.2'
|
||||
|
||||
# OAuth
|
||||
gem 'oauth2', '~> 1.0.0'
|
||||
|
||||
|
||||
platforms :mri, :mingw do
|
||||
group :rmagick do
|
||||
# RMagick 2 supports ruby 1.9
|
||||
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
|
||||
# different requirements for the same gem on different platforms
|
||||
gem "rmagick", ">= 2.0.0"
|
||||
end
|
||||
end
|
||||
gem "rugments", "~> 1.0.0.beta8"
|
||||
|
||||
# Optional gem for OpenID authentication
|
||||
group :openid do
|
||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||
gem "rack-openid"
|
||||
end
|
||||
gem 'therubyracer'
|
||||
gem 'execjs'
|
||||
|
||||
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
|
||||
platforms :jruby do
|
||||
# jruby-openssl is bundled with JRuby 1.7.0
|
||||
gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
|
||||
gem "activerecord-jdbc-adapter", "1.2.5"
|
||||
end
|
||||
# Soft deletion
|
||||
gem "paranoia", "~> 2.0"
|
||||
|
||||
# Include database gems for the adapters found in the database
|
||||
# configuration file
|
||||
require 'erb'
|
||||
require 'yaml'
|
||||
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
||||
if File.exist?(database_file)
|
||||
database_config = YAML::load(ERB.new(IO.read(database_file)).result)
|
||||
adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
|
||||
if adapters.any?
|
||||
adapters.each do |adapter|
|
||||
case adapter
|
||||
when 'mysql2'
|
||||
gem "mysql2", "= 0.3.11", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
|
||||
when 'mysql'
|
||||
gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
|
||||
when /postgresql/
|
||||
gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
|
||||
when /sqlite3/
|
||||
gem "sqlite3", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
||||
when /sqlserver/
|
||||
gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
|
||||
else
|
||||
warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
|
||||
end
|
||||
end
|
||||
else
|
||||
warn("No adapter found in config/database.yml, please configure it first")
|
||||
end
|
||||
else
|
||||
warn("Please configure your config/database.yml first")
|
||||
end
|
||||
|
||||
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
|
||||
if File.exists?(local_gemfile)
|
||||
puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
|
||||
instance_eval File.read(local_gemfile)
|
||||
end
|
||||
|
||||
# Load plugins' Gemfiles
|
||||
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
|
||||
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
|
||||
instance_eval File.read(file)
|
||||
end
|
||||
|
|
|
|||
1147
Gemfile.lock
1147
Gemfile.lock
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +0,0 @@
|
|||
= Redmine
|
||||
|
||||
Redmine is a flexible project management web application written using Ruby on Rails framework.
|
||||
|
||||
More details can be found in the doc directory or on the official website http://www.redmine.org
|
||||
7
Rakefile
7
Rakefile
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
RedmineApp::Application.load_tasks
|
||||
53
ReadMe.txt
53
ReadMe.txt
|
|
@ -1,53 +0,0 @@
|
|||
patch:
|
||||
用户姓名的部分,根据issues#655。
|
||||
为了修改方便
|
||||
alias:
|
||||
方法 之前显示 调整之后
|
||||
name firstname+lastname login
|
||||
nickname xxx login
|
||||
realname xxx firstname+lastname
|
||||
|
||||
User model经过修改,已经完全集成了user_extensions的功能
|
||||
例如
|
||||
user.gender=1
|
||||
user.save
|
||||
user_extensions字段会自动保存
|
||||
不必要每次user.user_extensions.xxx以及判断是否为空
|
||||
================================================================================
|
||||
app/models/setting.rb :165
|
||||
# fixed domain url in development. tantantan's bug
|
||||
if Rails.env.development?
|
||||
methods.map do |m|
|
||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||
end
|
||||
end
|
||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||
为了开发方便,使之功能在development模式下失效。
|
||||
# => nyan
|
||||
================================================================================
|
||||
app/controller/projects_controller.rb ===> projects#fake
|
||||
fake filter: 修改了传到页面中的Count后缀的数量
|
||||
改为正确的数量,删掉fake过滤器即可
|
||||
================================================================================
|
||||
#导航栏匹配域名显示和改变
|
||||
app\helper\application_helper.rb
|
||||
# rewrite navigation
|
||||
|
||||
app\views\layouts\_base_header.html.erb
|
||||
# reset navigation by domain name and url through regular match
|
||||
================================================================================
|
||||
#首页根据域名匹配进入不同的页面
|
||||
app\controller\welcome_controller.rb
|
||||
def entry_select_user
|
||||
if request.original_url.match(/user\.trustie\.net/)
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
return 0
|
||||
end
|
||||
end
|
||||
================================================================================
|
||||
|
||||
================================================================================
|
||||
0606:新坑
|
||||
user_scores表结构有问题,需要运行
|
||||
bundle exec rake db:migrate:down VERSION=20140410021724
|
||||
bundle exec rake db:migrate:up VERSION=20140410021724
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# 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/
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the notificationcomments controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
body { background-color: #fff; color: #333; }
|
||||
|
||||
body, p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a { color: #000; }
|
||||
a:visited { color: #666; }
|
||||
a:hover { color: #fff; background-color:#000; }
|
||||
|
||||
div.field, div.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#error_explanation h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0px;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#error_explanation ul li {
|
||||
font-size: 12px;
|
||||
list-style: square;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
|
|
@ -1,375 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AccountController < ApplicationController
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
|
||||
# prevents login action to be filtered by check_if_login_required application scope filter
|
||||
skip_before_filter :check_if_login_required
|
||||
|
||||
# Login request and validation
|
||||
def login
|
||||
if request.get?
|
||||
if User.current.logged?
|
||||
redirect_to home_url
|
||||
end
|
||||
else
|
||||
authenticate_user
|
||||
end
|
||||
rescue AuthSourceException => e
|
||||
logger.error "An error occured when authenticating #{params[:username]}: #{e.message}"
|
||||
render_error :message => e.message
|
||||
end
|
||||
|
||||
# Log out current user and redirect to welcome page
|
||||
def logout
|
||||
if User.current.anonymous?
|
||||
redirect_to home_url
|
||||
elsif request.post?
|
||||
logout_user
|
||||
redirect_to home_url
|
||||
end
|
||||
# display the logout form
|
||||
end
|
||||
|
||||
# Lets user choose a new password
|
||||
def lost_password
|
||||
(redirect_to(home_url); return) unless Setting.lost_password?
|
||||
if params[:token]
|
||||
@token = Token.find_token("recovery", params[:token].to_s)
|
||||
if @token.nil? || @token.expired?
|
||||
redirect_to home_url
|
||||
return
|
||||
end
|
||||
@user = @token.user
|
||||
unless @user && @user.active?
|
||||
redirect_to home_url
|
||||
return
|
||||
end
|
||||
if request.post?
|
||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||
if @user.save
|
||||
@token.destroy
|
||||
flash[:notice] = l(:notice_account_password_updated)
|
||||
redirect_to signin_path
|
||||
return
|
||||
end
|
||||
end
|
||||
render :template => "account/password_recovery"
|
||||
return
|
||||
else
|
||||
if request.post?
|
||||
user = User.find_by_mail(params[:mail].to_s)
|
||||
# user not found or not active
|
||||
unless user && user.active?
|
||||
flash.now[:error] = l(:notice_account_unknown_email)
|
||||
return
|
||||
end
|
||||
# user cannot change its password
|
||||
unless user.change_password_allowed?
|
||||
flash.now[:error] = l(:notice_can_t_change_password)
|
||||
return
|
||||
end
|
||||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
Thread.new do
|
||||
Mailer.lost_password(token).deliver
|
||||
end
|
||||
flash[:notice] = l(:notice_account_lost_email_sent)
|
||||
redirect_to signin_path
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# User self-registration
|
||||
def register
|
||||
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||
#
|
||||
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
|
||||
if request.get?
|
||||
session[:auth_source_registration] = nil
|
||||
@user = User.new(:language => current_language.to_s)
|
||||
else
|
||||
user_params = params[:user] || {}
|
||||
@user = User.new
|
||||
@user.safe_attributes = user_params
|
||||
if params[:identity] == "2" # 2 企业
|
||||
@user.firstname = params[:enterprise_name]
|
||||
@user.lastname = l(:field_enterprise)
|
||||
end
|
||||
@user.admin = false
|
||||
@user.register
|
||||
if session[:auth_source_registration]
|
||||
@user.activate
|
||||
@user.login = session[:auth_source_registration][:login]
|
||||
@user.auth_source_id = session[:auth_source_registration][:auth_source_id]
|
||||
if @user.save
|
||||
session[:auth_source_registration] = nil
|
||||
self.logged_user = @user
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
redirect_to my_account_path
|
||||
end
|
||||
else
|
||||
@user.login = params[:user][:login]
|
||||
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
|
||||
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
|
||||
end
|
||||
|
||||
case Setting.self_registration
|
||||
when '1'
|
||||
register_by_email_activation(@user)
|
||||
when '3'
|
||||
register_automatically(@user)
|
||||
else
|
||||
register_manually_by_administrator(@user)
|
||||
end
|
||||
|
||||
#added by bai
|
||||
if @user.id != nil
|
||||
ue = @user.user_extensions ||= UserExtensions.new
|
||||
#ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => )
|
||||
ue.identity = params[:identity].to_i
|
||||
ue.technical_title = params[:technical_title]
|
||||
ue.gender = params[:gender].to_i
|
||||
ue.user_id = @user.id
|
||||
ue.student_id = params[:no]
|
||||
ue.location = params[:province] if params[:province] != nil
|
||||
ue.location_city = params[:city] if params[:city] != nil
|
||||
ue.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Token based account activation
|
||||
def activate
|
||||
(redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?
|
||||
token = Token.find_token('register', params[:token].to_s)
|
||||
(redirect_to(home_url); return) unless token and !token.expired?
|
||||
user = token.user
|
||||
(redirect_to(home_url); return) unless user.registered?
|
||||
user.activate
|
||||
if user.save
|
||||
token.destroy
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
end
|
||||
redirect_to signin_path
|
||||
end
|
||||
|
||||
def valid_ajax
|
||||
req = Hash.new(false)
|
||||
req[:message] = ''
|
||||
|
||||
valid_attr = params[:valid]
|
||||
valid_value = params[:value]
|
||||
|
||||
faker = User.new
|
||||
|
||||
if valid_attr.eql?('login')
|
||||
faker.login = valid_value
|
||||
faker.valid?
|
||||
req[:valid] = faker.errors[:login].blank?
|
||||
req[:message] = faker.errors[:login]
|
||||
end
|
||||
|
||||
if valid_attr.eql?('mail')
|
||||
faker.mail = valid_value
|
||||
faker.valid?
|
||||
req[:valid] = faker.errors[:mail].blank?
|
||||
req[:message] = faker.errors[:mail]
|
||||
end
|
||||
|
||||
req[:message] = l(:modal_valid_passing) if req[:message].blank?
|
||||
render :json => req
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def authenticate_user
|
||||
if Setting.openid? && using_open_id?
|
||||
open_id_authenticate(params[:openid_url])
|
||||
else
|
||||
password_authentication
|
||||
end
|
||||
end
|
||||
|
||||
def password_authentication
|
||||
user = User.try_to_login(params[:username], params[:password])
|
||||
|
||||
if user.nil?
|
||||
invalid_credentials
|
||||
elsif user.status == 2
|
||||
invalid_credentials_new
|
||||
elsif user.new_record?
|
||||
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
|
||||
else
|
||||
# Valid user
|
||||
successful_authentication(user)
|
||||
end
|
||||
end
|
||||
|
||||
def open_id_authenticate(openid_url)
|
||||
back_url = signin_url(:autologin => params[:autologin])
|
||||
|
||||
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => back_url, :method => :post) do |result, identity_url, registration|
|
||||
if result.successful?
|
||||
user = User.find_or_initialize_by_identity_url(identity_url)
|
||||
if user.new_record?
|
||||
# Self-registration off
|
||||
(redirect_to(home_url); return) unless Setting.self_registration?
|
||||
|
||||
# Create on the fly
|
||||
user.login = registration['nickname'] unless registration['nickname'].nil?
|
||||
user.mail = registration['email'] unless registration['email'].nil?
|
||||
user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil?
|
||||
user.random_password
|
||||
user.register
|
||||
|
||||
case Setting.self_registration
|
||||
when '1'
|
||||
register_by_email_activation(user) do
|
||||
onthefly_creation_failed(user)
|
||||
end
|
||||
when '3'
|
||||
register_automatically(user) do
|
||||
onthefly_creation_failed(user)
|
||||
end
|
||||
else
|
||||
register_manually_by_administrator(user) do
|
||||
onthefly_creation_failed(user)
|
||||
end
|
||||
end
|
||||
else
|
||||
# Existing record
|
||||
if user.active?
|
||||
successful_authentication(user)
|
||||
else
|
||||
account_pending
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def successful_authentication(user)
|
||||
logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
# Valid user
|
||||
self.logged_user = user
|
||||
# generate a key and set cookie if autologin
|
||||
if params[:autologin] && Setting.autologin?
|
||||
set_autologin_cookie(user)
|
||||
end
|
||||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||
|
||||
code = /\d*/
|
||||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if code=~params[:back_url]
|
||||
redirect_to user_activities_path(user)
|
||||
else
|
||||
#by young
|
||||
#redirect_back_or_default my_page_path
|
||||
redirect_back_or_default User.current
|
||||
#redirect_to User.current
|
||||
end
|
||||
end
|
||||
|
||||
def set_autologin_cookie(user)
|
||||
token = Token.create(:user => user, :action => 'autologin')
|
||||
cookie_options = {
|
||||
:value => token.value,
|
||||
:expires => 1.year.from_now,
|
||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||
:httponly => true
|
||||
}
|
||||
cookies[autologin_cookie_name] = cookie_options
|
||||
end
|
||||
|
||||
# Onthefly creation failed, display the registration form to fill/fix attributes
|
||||
def onthefly_creation_failed(user, auth_source_options = { })
|
||||
@user = user
|
||||
session[:auth_source_registration] = auth_source_options unless auth_source_options.empty?
|
||||
render :action => 'register'
|
||||
end
|
||||
|
||||
def invalid_credentials
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials)
|
||||
end
|
||||
|
||||
def invalid_credentials_new
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials_new)
|
||||
end
|
||||
|
||||
# Register a user for email activation.
|
||||
#
|
||||
# Pass a block for behavior when a user fails to save
|
||||
def register_by_email_activation(user, &block)
|
||||
token = Token.new(:user => user, :action => "register")
|
||||
if user.save and token.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
Mailer.register(token).deliver
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
redirect_to signin_path
|
||||
else
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
|
||||
# Automatically register a user
|
||||
#
|
||||
# Pass a block for behavior when a user fails to save
|
||||
def register_automatically(user, &block)
|
||||
# Automatic activation
|
||||
user.activate
|
||||
user.last_login_on = Time.now
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
self.logged_user = user
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
redirect_to my_account_path
|
||||
else
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
|
||||
# Manual activation by the administrator
|
||||
#
|
||||
# Pass a block for behavior when a user fails to save
|
||||
def register_manually_by_administrator(user, &block)
|
||||
if user.save
|
||||
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
||||
# Sends an email to the administrators
|
||||
Mailer.account_activation_request(user).deliver
|
||||
account_pending
|
||||
else
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
|
||||
def account_pending
|
||||
flash[:notice] = l(:notice_account_pending)
|
||||
redirect_to signin_path
|
||||
end
|
||||
end
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class ActivitiesController < ApplicationController
|
||||
menu_item :activity
|
||||
before_filter :find_optional_project, :index
|
||||
accept_rss_auth :index
|
||||
helper :Watchers
|
||||
|
||||
def index
|
||||
@days = Setting.activity_days_default.to_i
|
||||
|
||||
if params[:from]
|
||||
begin; @date_to = params[:from].to_date + 1; rescue; end
|
||||
end
|
||||
|
||||
has = {
|
||||
"show_issues" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
@date_from = @date_to - @days
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||
# 决定显示所用用户或单个用户活动
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| !has["show_#{t}"].nil?}
|
||||
#@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
|
||||
|
||||
events = @activity.events(@date_from, @date_to)
|
||||
# Added by Nie.
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@activity_count = events.size
|
||||
@activity_pages = Paginator.new @activity_count, @limit, params['page']
|
||||
@offset ||= @activity_pages.offset
|
||||
|
||||
@project_base_tag = params[:id] ? 'base_projects' : 'base'
|
||||
if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, events.size, User.current, current_language])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@events_by_day_ = events.slice(@offset,@limit)
|
||||
@events_by_day = @events_by_day_.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
#by young render :layout => false if request.xhr?
|
||||
render :layout => @project_base_tag
|
||||
}
|
||||
format.atom {
|
||||
title = l(:label_activity)
|
||||
if @author
|
||||
title = @author.name
|
||||
elsif @activity.scope.size == 1
|
||||
title = l("label_#{@activity.scope.first.singularize}_plural")
|
||||
end
|
||||
render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# TODO: refactor, duplicated in projects_controller
|
||||
def find_optional_project
|
||||
return true unless params[:id]
|
||||
@project = Project.find(params[:id])
|
||||
authorize
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AdminController < ApplicationController
|
||||
layout 'admin'
|
||||
menu_item :projects, :only => :projects
|
||||
menu_item :plugins, :only => :plugins
|
||||
menu_item :info, :only => :info
|
||||
|
||||
before_filter :require_admin
|
||||
helper :sort
|
||||
helper :Users
|
||||
include SortHelper
|
||||
|
||||
def index
|
||||
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
|
||||
end
|
||||
|
||||
def projects
|
||||
@status = params[:status] || 1
|
||||
|
||||
scope = Project.status(@status).order('lft')
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@projects = scope.all
|
||||
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def users
|
||||
@project_type = params[:project_type]
|
||||
role = params[:role]
|
||||
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
||||
case params[:format]
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||
else
|
||||
@limit = 15#per_page_option
|
||||
end
|
||||
|
||||
@status = params[:status] || 1
|
||||
has = {
|
||||
"show_changesets" => true
|
||||
}
|
||||
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
|
||||
|
||||
scope = UserStatus.visible
|
||||
case role
|
||||
when 'teacher'
|
||||
scope = UserStatus.teacher
|
||||
when 'student'
|
||||
scope = UserStatus.student
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
|
||||
# scope.each do |user|
|
||||
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
|
||||
# end
|
||||
@user_count = scope.count
|
||||
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||
#@offset ||= @user_pages.offset
|
||||
#@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
|
||||
@user_base_tag = params[:id] ? 'base_users':'base'
|
||||
if params[:user_sort_type].present?
|
||||
case params[:user_sort_type]
|
||||
when '0'
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users_statuses = scope.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users_statuses = scope.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 0
|
||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||
# @projects = @projects[@offset, @limit]
|
||||
when '1'
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 1
|
||||
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
|
||||
#@users = @users[@offset, @limit]
|
||||
when '2'
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 2
|
||||
#@users = @users[@offset, @limit]
|
||||
end
|
||||
|
||||
else
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 1
|
||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||
# @projects = @projects[@offset, @limit]
|
||||
end
|
||||
|
||||
@users = []
|
||||
@users_statuses.each do |obj|
|
||||
@users << User.find_by_id("#{obj.user_id}")
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@groups = Group.all.sort
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def plugins
|
||||
@plugins = Redmine::Plugin.all
|
||||
end
|
||||
|
||||
# Loads the default configuration
|
||||
# (roles, trackers, statuses, workflow, enumerations)
|
||||
def default_configuration
|
||||
if request.post?
|
||||
begin
|
||||
Redmine::DefaultData::Loader::load(params[:lang])
|
||||
flash[:notice] = l(:notice_default_data_loaded)
|
||||
rescue Exception => e
|
||||
flash[:error] = l(:error_can_t_load_default_data, e.message)
|
||||
end
|
||||
end
|
||||
redirect_to admin_path
|
||||
end
|
||||
|
||||
def test_email
|
||||
raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
|
||||
# Force ActionMailer to raise delivery errors so we can catch it
|
||||
ActionMailer::Base.raise_delivery_errors = true
|
||||
begin
|
||||
@test = Mailer.test_email(User.current).deliver
|
||||
flash[:notice] = l(:notice_email_sent, User.current.mail)
|
||||
rescue Exception => e
|
||||
flash[:error] = l(:notice_email_error, e.message)
|
||||
end
|
||||
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
|
||||
redirect_to settings_path(:tab => 'notifications')
|
||||
end
|
||||
|
||||
def info
|
||||
@db_adapter_name = ActiveRecord::Base.connection.adapter_name
|
||||
@checklist = [
|
||||
[:text_default_administrator_account_changed, User.default_admin_account_changed?],
|
||||
[:text_file_repository_writable, File.writable?(Attachment.storage_path)],
|
||||
[:text_plugin_assets_writable, File.writable?(Redmine::Plugin.public_directory)],
|
||||
[:text_rmagick_available, Object.const_defined?(:Magick)]
|
||||
]
|
||||
end
|
||||
#管理功能用户列表的搜索
|
||||
def search
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
||||
case params[:format]
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||
else
|
||||
@limit = 15#per_page_option
|
||||
end
|
||||
|
||||
@status = params[:status] || 1
|
||||
has = {
|
||||
"show_changesets" => true
|
||||
}
|
||||
scope = User.logged.status(@status)
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@user_count = scope.count
|
||||
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||
@user_base_tag = params[:id] ? 'base_users':'base'
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users = scope.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users = scope.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@groups = Group.all.sort
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,718 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
class Unauthorized < Exception; end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include Redmine::I18n
|
||||
include Redmine::Pagination
|
||||
include RoutesHelper
|
||||
helper :routes
|
||||
|
||||
#added by william
|
||||
helper :watchers
|
||||
|
||||
class_attribute :accept_api_auth_actions
|
||||
class_attribute :accept_rss_auth_actions
|
||||
class_attribute :model_object
|
||||
|
||||
layout 'base'
|
||||
|
||||
protect_from_forgery
|
||||
def handle_unverified_request
|
||||
super
|
||||
cookies.delete(autologin_cookie_name)
|
||||
end
|
||||
|
||||
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
||||
before_filter :user_agent
|
||||
|
||||
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
|
||||
rescue_from ::Unauthorized, :with => :deny_access
|
||||
rescue_from ::ActionView::MissingTemplate, :with => :missing_template
|
||||
|
||||
include Redmine::Search::Controller
|
||||
include Redmine::MenuManager::MenuController
|
||||
helper Redmine::MenuManager::MenuHelper
|
||||
|
||||
def user_agent
|
||||
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
|
||||
end
|
||||
|
||||
def session_expiration
|
||||
if session[:user_id]
|
||||
if session_expired? && !try_to_autologin
|
||||
reset_session
|
||||
flash[:error] = l(:error_session_expired)
|
||||
redirect_to signin_url
|
||||
else
|
||||
session[:atime] = Time.now.utc.to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def session_expired?
|
||||
if Setting.session_lifetime?
|
||||
unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= Setting.session_lifetime.to_i * 60)
|
||||
return true
|
||||
end
|
||||
end
|
||||
if Setting.session_timeout?
|
||||
unless session[:atime] && (Time.now.utc.to_i - session[:atime].to_i <= Setting.session_timeout.to_i * 60)
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def start_user_session(user)
|
||||
session[:user_id] = user.id
|
||||
session[:ctime] = Time.now.utc.to_i
|
||||
session[:atime] = Time.now.utc.to_i
|
||||
end
|
||||
|
||||
def user_setup
|
||||
# Check the settings cache for each request
|
||||
Setting.check_cache
|
||||
# Find the current user
|
||||
User.current = find_current_user
|
||||
#logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
|
||||
end
|
||||
|
||||
# Returns the current user or nil if no user is logged in
|
||||
# and starts a session if needed
|
||||
def current_user
|
||||
find_current_user
|
||||
end
|
||||
def find_current_user
|
||||
user = nil
|
||||
unless api_request?
|
||||
if session[:user_id]
|
||||
# existing session
|
||||
user = (User.active.find(session[:user_id]) rescue nil)
|
||||
elsif autologin_user = try_to_autologin
|
||||
user = autologin_user
|
||||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||||
# RSS key authentication does not start a session
|
||||
user = User.find_by_rss_key(params[:key])
|
||||
end
|
||||
end
|
||||
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
||||
if (key = api_key_from_request)
|
||||
# Use API key
|
||||
user = User.find_by_api_key(key)
|
||||
else
|
||||
# HTTP Basic, either username/password or API key/random
|
||||
authenticate_with_http_basic do |username, password|
|
||||
user = User.try_to_login(username, password) || User.find_by_api_key(username)
|
||||
end
|
||||
end
|
||||
# Switch user if requested by an admin user
|
||||
if user && user.admin? && (username = api_switch_user_from_request)
|
||||
su = User.find_by_login(username)
|
||||
if su && su.active?
|
||||
logger.info(" User switched by: #{user.login} (id=#{user.id})") if logger
|
||||
user = su
|
||||
else
|
||||
render_error :message => 'Invalid X-Redmine-Switch-User header', :status => 412
|
||||
end
|
||||
end
|
||||
end
|
||||
user
|
||||
end
|
||||
|
||||
def autologin_cookie_name
|
||||
Redmine::Configuration['autologin_cookie_name'].presence || 'autologin'
|
||||
end
|
||||
|
||||
def try_to_autologin
|
||||
if cookies[autologin_cookie_name] && Setting.autologin?
|
||||
# auto-login feature starts a new session
|
||||
user = User.try_to_autologin(cookies[autologin_cookie_name])
|
||||
if user
|
||||
reset_session
|
||||
start_user_session(user)
|
||||
end
|
||||
user
|
||||
end
|
||||
end
|
||||
|
||||
# Sets the logged in user
|
||||
def logged_user=(user)
|
||||
reset_session
|
||||
if user && user.is_a?(User)
|
||||
User.current = user
|
||||
start_user_session(user)
|
||||
else
|
||||
User.current = User.anonymous
|
||||
end
|
||||
end
|
||||
|
||||
# Logs out current user
|
||||
def logout_user
|
||||
if User.current.logged?
|
||||
cookies.delete(autologin_cookie_name)
|
||||
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
|
||||
self.logged_user = nil
|
||||
end
|
||||
end
|
||||
|
||||
# check if login is globally required to access the application
|
||||
def check_if_login_required
|
||||
# no check needed if user is already logged in
|
||||
return true if User.current.logged?
|
||||
require_login if Setting.login_required?
|
||||
end
|
||||
|
||||
def set_localization
|
||||
lang = nil
|
||||
if User.current.logged?
|
||||
lang = find_language(User.current.language)
|
||||
end
|
||||
if lang.nil? && request.env['HTTP_ACCEPT_LANGUAGE']
|
||||
accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first
|
||||
if !accept_lang.blank?
|
||||
accept_lang = accept_lang.downcase
|
||||
lang = find_language(accept_lang) || find_language(accept_lang.split('-').first)
|
||||
end
|
||||
end
|
||||
lang ||= Setting.default_language
|
||||
set_language_if_valid(lang)
|
||||
end
|
||||
|
||||
def require_login
|
||||
if !User.current.logged?
|
||||
# Extract only the basic url parameters on non-GET requests
|
||||
if request.get?
|
||||
url = url_for(params)
|
||||
else
|
||||
url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id])
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :controller => "account", :action => "login", :back_url => url }
|
||||
format.atom { redirect_to :controller => "account", :action => "login", :back_url => url }
|
||||
format.xml { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
|
||||
format.js { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
|
||||
format.json { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
|
||||
end
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def require_admin
|
||||
return unless require_login
|
||||
if !User.current.admin?
|
||||
render_403
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def deny_access
|
||||
User.current.logged? ? render_403 : require_login
|
||||
end
|
||||
|
||||
# Authorize the user for the requested action
|
||||
def authorize(ctrl = params[:controller], action = params[:action], global = false)
|
||||
#modify by NWB
|
||||
if @project
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
elsif @course
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global)
|
||||
else
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
end
|
||||
|
||||
if allowed
|
||||
true
|
||||
else
|
||||
if @project && @project.archived?
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def authorize_course(ctrl = params[:controller], action = params[:action], global = false)
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @course, :global => global)
|
||||
if allowed
|
||||
true
|
||||
else
|
||||
if @course && @course.archived?
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def authorize_course_global(ctrl = params[:controller], action = params[:action], global = true)
|
||||
authorize_course(ctrl, action, global)
|
||||
end
|
||||
|
||||
|
||||
# Authorize the user for the requested action outside a project
|
||||
def authorize_global(ctrl = params[:controller], action = params[:action], global = true)
|
||||
authorize(ctrl, action, global)
|
||||
end
|
||||
|
||||
# Find project of id params[:id]
|
||||
def find_project
|
||||
@project = Project.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Find project of id params[:project_id]
|
||||
def find_project_by_project_id
|
||||
if params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
elsif params[:course_id]
|
||||
@course = Course.find(params[:course_id])
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_contest_by_contest_id
|
||||
@contest = Contest.find(params[:contest_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
#<23><><EFBFBD>course_id<69><64>project
|
||||
def find_project_by_course_id
|
||||
@bid = Bid.find params[:course_id]
|
||||
@project = @bid.courses[0]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Find a project based on params[:project_id]
|
||||
# TODO: some subclasses override this, see about merging their logic
|
||||
def find_optional_project
|
||||
@project = Project.find(params[:project_id]) unless params[:project_id].blank?
|
||||
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
||||
allowed ? true : deny_access
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_optional_contest
|
||||
@contest = Contest.find(params[:contest_id]) unless params[:contest_id].blank?
|
||||
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @contest, :global => true)
|
||||
allowed ? true : deny_access
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Finds and sets @project based on @object.project
|
||||
def find_project_from_association
|
||||
render_404 unless @object.present?
|
||||
|
||||
@project = @object.project
|
||||
if @project == nil && @object.has_attribute?('course_id')
|
||||
@course = @object.course
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def find_contest_from_association
|
||||
render_404 unless @object.present?
|
||||
|
||||
@contest =@object.contest
|
||||
end
|
||||
|
||||
def find_model_object
|
||||
model = self.class.model_object
|
||||
if model
|
||||
@object = model.find(params[:id])
|
||||
self.instance_variable_set('@' + controller_name.singularize, @object) if @object
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
#added by nwb
|
||||
#<23><>ȡ<EFBFBD>γ<EFBFBD>
|
||||
def find_course
|
||||
@course= Course.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# def find_model_object_contest
|
||||
# model = self.class.model_object
|
||||
# if model
|
||||
# @object = model.find(params[:id])
|
||||
# self.instance_variable_set('@' + controller_name.singularize, @object) if @object
|
||||
# end
|
||||
# rescue ActiveRecord::RecordNotFound
|
||||
# render_404
|
||||
# end
|
||||
|
||||
def self.model_object(model)
|
||||
self.model_object = model
|
||||
end
|
||||
|
||||
# Find the issue whose id is the :id parameter
|
||||
# Raises a Unauthorized exception if the issue is not visible
|
||||
def find_issue
|
||||
# Issue.visible.find(...) can not be used to redirect user to the login form
|
||||
# if the issue actually exists but requires authentication
|
||||
@issue = Issue.find(params[:id])
|
||||
raise Unauthorized unless @issue.visible?
|
||||
@project = @issue.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Find issues with a single :id param or :ids array param
|
||||
# Raises a Unauthorized exception if one of the issues is not visible
|
||||
def find_issues
|
||||
@issues = Issue.find_all_by_id(params[:id] || params[:ids])
|
||||
raise ActiveRecord::RecordNotFound if @issues.empty?
|
||||
raise Unauthorized unless @issues.all?(&:visible?)
|
||||
@projects = @issues.collect(&:project).compact.uniq
|
||||
@project = @projects.first if @projects.size == 1
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_attachments
|
||||
if (attachments = params[:attachments]).present?
|
||||
att = attachments.values.collect do |attachment|
|
||||
Attachment.find_by_token( attachment[:token] ) if attachment[:token].present?
|
||||
end
|
||||
att.compact!
|
||||
end
|
||||
@attachments = att || []
|
||||
end
|
||||
|
||||
# make sure that the user is a member of the project (or admin) if project is private
|
||||
# used as a before_filter for actions that do not require any particular permission on the project
|
||||
def check_project_privacy
|
||||
if @project && !@project.archived?
|
||||
if @project.visible?
|
||||
true
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
else
|
||||
@project = nil
|
||||
render_404
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def back_url
|
||||
url = params[:back_url]
|
||||
if url.nil? && referer = request.env['HTTP_REFERER']
|
||||
url = CGI.unescape(referer.to_s)
|
||||
end
|
||||
url
|
||||
end
|
||||
|
||||
def redirect_back_or_default(default, options={})
|
||||
back_url = params[:back_url].to_s
|
||||
if back_url.present?
|
||||
begin
|
||||
uri = URI.parse(back_url)
|
||||
# do not redirect user to another host or to the login or register page
|
||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
||||
redirect_to(back_url)
|
||||
return
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
logger.warn("Could not redirect to invalid URL #{back_url}")
|
||||
# redirect to default
|
||||
end
|
||||
elsif options[:referer]
|
||||
redirect_to_referer_or default
|
||||
return
|
||||
end
|
||||
redirect_to default
|
||||
false
|
||||
end
|
||||
|
||||
# Redirects to the request referer if present, redirects to args or call block otherwise.
|
||||
def redirect_to_referer_or(*args, &block)
|
||||
redirect_to :back
|
||||
rescue ::ActionController::RedirectBackError
|
||||
if args.any?
|
||||
redirect_to *args
|
||||
elsif block_given?
|
||||
block.call
|
||||
else
|
||||
raise "#redirect_to_referer_or takes arguments or a block"
|
||||
end
|
||||
end
|
||||
|
||||
def render_403(options={})
|
||||
@project = nil
|
||||
render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
|
||||
return false
|
||||
end
|
||||
|
||||
def render_404(options={})
|
||||
render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
|
||||
return false
|
||||
end
|
||||
|
||||
# Renders an error response
|
||||
def render_error(arg)
|
||||
arg = {:message => arg} unless arg.is_a?(Hash)
|
||||
|
||||
@message = arg[:message]
|
||||
@message = l(@message) if @message.is_a?(Symbol)
|
||||
@status = arg[:status] || 500
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :template => 'common/error', :layout => use_layout, :status => @status
|
||||
}
|
||||
format.any { head @status }
|
||||
end
|
||||
end
|
||||
|
||||
# Handler for ActionView::MissingTemplate exception
|
||||
def missing_template
|
||||
logger.warn "Missing template, responding with 404"
|
||||
@project = nil
|
||||
render_404
|
||||
end
|
||||
|
||||
# Filter for actions that provide an API response
|
||||
# but have no HTML representation for non admin users
|
||||
def require_admin_or_api_request
|
||||
return true if api_request?
|
||||
if User.current.admin?
|
||||
true
|
||||
elsif User.current.logged?
|
||||
render_error(:status => 406)
|
||||
else
|
||||
deny_access
|
||||
end
|
||||
end
|
||||
|
||||
# Picks which layout to use based on the request
|
||||
#
|
||||
# @return [boolean, string] name of the layout to use or false for no layout
|
||||
def use_layout
|
||||
request.xhr? ? false : 'base'
|
||||
end
|
||||
|
||||
def invalid_authenticity_token
|
||||
if api_request?
|
||||
logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)."
|
||||
end
|
||||
render_error "Invalid form authenticity token."
|
||||
end
|
||||
|
||||
def render_feed(items, options={})
|
||||
@items = items || []
|
||||
@items.sort! {|x,y| y.event_datetime <=> x.event_datetime }
|
||||
@items = @items.slice(0, Setting.feeds_limit.to_i)
|
||||
@title = options[:title] || Setting.app_title
|
||||
render :template => "common/feed", :formats => [:atom], :layout => false,
|
||||
:content_type => 'application/atom+xml'
|
||||
end
|
||||
|
||||
def self.accept_rss_auth(*actions)
|
||||
if actions.any?
|
||||
self.accept_rss_auth_actions = actions
|
||||
else
|
||||
self.accept_rss_auth_actions || []
|
||||
end
|
||||
end
|
||||
|
||||
def accept_rss_auth?(action=action_name)
|
||||
self.class.accept_rss_auth.include?(action.to_sym)
|
||||
end
|
||||
|
||||
def self.accept_api_auth(*actions)
|
||||
if actions.any?
|
||||
self.accept_api_auth_actions = actions
|
||||
else
|
||||
self.accept_api_auth_actions || []
|
||||
end
|
||||
end
|
||||
|
||||
def accept_api_auth?(action=action_name)
|
||||
self.class.accept_api_auth.include?(action.to_sym)
|
||||
end
|
||||
|
||||
# Returns the number of objects that should be displayed
|
||||
# on the paginated list
|
||||
def per_page_option
|
||||
per_page = nil
|
||||
if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
|
||||
per_page = params[:per_page].to_s.to_i
|
||||
session[:per_page] = per_page
|
||||
elsif session[:per_page]
|
||||
per_page = session[:per_page]
|
||||
else
|
||||
per_page = Setting.per_page_options_array.first || 25
|
||||
end
|
||||
per_page
|
||||
end
|
||||
|
||||
# Returns offset and limit used to retrieve objects
|
||||
# for an API response based on offset, limit and page parameters
|
||||
def api_offset_and_limit(options=params)
|
||||
if options[:offset].present?
|
||||
offset = options[:offset].to_i
|
||||
if offset < 0
|
||||
offset = 0
|
||||
end
|
||||
end
|
||||
limit = options[:limit].to_i
|
||||
if limit < 1
|
||||
limit = 25
|
||||
elsif limit > 100
|
||||
limit = 100
|
||||
end
|
||||
if offset.nil? && options[:page].present?
|
||||
offset = (options[:page].to_i - 1) * limit
|
||||
offset = 0 if offset < 0
|
||||
offset ||= 0
|
||||
end
|
||||
|
||||
|
||||
[offset, limit]
|
||||
end
|
||||
|
||||
# qvalues http header parser
|
||||
# code taken from webrick
|
||||
def parse_qvalues(value)
|
||||
tmp = []
|
||||
if value
|
||||
parts = value.split(/,\s*/)
|
||||
parts.each {|part|
|
||||
if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
|
||||
val = m[1]
|
||||
q = (m[2] or 1).to_f
|
||||
tmp.push([val, q])
|
||||
end
|
||||
}
|
||||
tmp = tmp.sort_by{|val, q| -q}
|
||||
tmp.collect!{|val, q| val}
|
||||
end
|
||||
return tmp
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
# Returns a string that can be used as filename value in Content-Disposition header
|
||||
def filename_for_content_disposition(name)
|
||||
request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
|
||||
end
|
||||
|
||||
def api_request?
|
||||
%w(xml json).include? params[:format]
|
||||
end
|
||||
|
||||
# Returns the API key present in the request
|
||||
def api_key_from_request
|
||||
if params[:key].present?
|
||||
params[:key].to_s
|
||||
elsif request.headers["X-Redmine-API-Key"].present?
|
||||
request.headers["X-Redmine-API-Key"].to_s
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the API 'switch user' value if present
|
||||
def api_switch_user_from_request
|
||||
request.headers["X-Redmine-Switch-User"].to_s.presence
|
||||
end
|
||||
|
||||
# Renders a warning flash if obj has unsaved attachments
|
||||
def render_attachment_warning_if_needed(obj)
|
||||
flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present?
|
||||
end
|
||||
|
||||
# Sets the `flash` notice or error based the number of issues that did not save
|
||||
#
|
||||
# @param [Array, Issue] issues all of the saved and unsaved Issues
|
||||
# @param [Array, Integer] unsaved_issue_ids the issue ids that were not saved
|
||||
def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids)
|
||||
if unsaved_issue_ids.empty?
|
||||
flash[:notice] = l(:notice_successful_update) unless issues.empty?
|
||||
else
|
||||
flash[:error] = l(:notice_failed_to_save_issues,
|
||||
:count => unsaved_issue_ids.size,
|
||||
:total => issues.size,
|
||||
:ids => '#' + unsaved_issue_ids.join(', #'))
|
||||
end
|
||||
end
|
||||
|
||||
# Rescues an invalid query statement. Just in case...
|
||||
def query_statement_invalid(exception)
|
||||
logger.error "Query::StatementInvalid: #{exception.message}" if logger
|
||||
session.delete(:query)
|
||||
sort_clear if respond_to?(:sort_clear)
|
||||
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
|
||||
end
|
||||
|
||||
# Renders a 200 response for successfull updates or deletions via the API
|
||||
def render_api_ok
|
||||
render_api_head :ok
|
||||
end
|
||||
|
||||
# Renders a head API response
|
||||
def render_api_head(status)
|
||||
# #head would return a response body with one space
|
||||
render :text => '', :status => status, :layout => nil
|
||||
end
|
||||
|
||||
# Renders API response on validation failure
|
||||
def render_validation_errors(objects)
|
||||
if objects.is_a?(Array)
|
||||
@error_messages = objects.map {|object| object.errors.full_messages}.flatten
|
||||
else
|
||||
@error_messages = objects.errors.full_messages
|
||||
end
|
||||
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => nil
|
||||
end
|
||||
|
||||
# Overrides #_include_layout? so that #render with no arguments
|
||||
# doesn't use the layout for api requests
|
||||
def _include_layout?(*args)
|
||||
api_request? ? false : super
|
||||
end
|
||||
|
||||
## Please added code in html.
|
||||
# <div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
def paginateHelper obj, pre_size=20
|
||||
@obj_count = obj.count
|
||||
@obj_pages = Paginator.new @obj_count, pre_size, params['page']
|
||||
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
elsif obj.kind_of? Array
|
||||
obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
else
|
||||
logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
class AppliedProjectController < ApplicationController
|
||||
|
||||
#申请加入项目
|
||||
def applied_join_project
|
||||
@user_id = params[:user_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
end
|
||||
|
||||
#redirect_to project_path(params[:project_id])
|
||||
#redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_applied'}
|
||||
end
|
||||
end
|
||||
|
||||
#取消申请
|
||||
def unapplied_join_project
|
||||
@project = Project.find(params[:project_id])
|
||||
#@applied = AppliedProject.find(params[:id])
|
||||
#@applied.destroy
|
||||
|
||||
AppliedProject.deleteappiled(params[:user_id], params[:project_id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_applied' }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
class ApplyProjectMastersController < ApplicationController
|
||||
|
||||
before_filter :require_login, :find_apply, :only => [:create, :delete]
|
||||
|
||||
# GET /apply_project_masters
|
||||
# GET /apply_project_masters.json
|
||||
def index
|
||||
@apply_project_masters = ApplyProjectMaster.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @apply_project_masters }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/1
|
||||
# GET /apply_project_masters/1.json
|
||||
def show
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @apply_project_master }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/new
|
||||
# GET /apply_project_masters/new.json
|
||||
def new
|
||||
@apply_project_master = ApplyProjectMaster.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @apply_project_master }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /apply_project_masters/1/edit
|
||||
def edit
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /apply_project_masters
|
||||
# POST /apply_project_masters.json
|
||||
def create
|
||||
# @apply_project_master = ApplyProjectMaster.new(params[:apply_project_master])
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @apply_project_master.save
|
||||
# format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully created.' }
|
||||
# format.json { render json: @apply_project_master, status: :created, location: @apply_project_master }
|
||||
# else
|
||||
# format.html { render action: "new" }
|
||||
# format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
|
||||
set_apply(@apply, User.current, true)
|
||||
|
||||
end
|
||||
|
||||
# PUT /apply_project_masters/1
|
||||
# PUT /apply_project_masters/1.json
|
||||
def update
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @apply_project_master.update_attributes(params[:apply_project_master])
|
||||
format.html { redirect_to @apply_project_master, notice: 'Apply project master was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @apply_project_master.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /apply_project_masters/1
|
||||
# DELETE /apply_project_masters/1.json
|
||||
def destroy
|
||||
@apply_project_master = ApplyProjectMaster.find(params[:id])
|
||||
@apply_project_master.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to apply_project_masters_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
set_apply(@apply, User.current, false)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_apply
|
||||
klass = Object.const_get(params[:object_type].camelcase) rescue nil
|
||||
if klass && klass.respond_to?('applied_by')
|
||||
@apply = klass.find_all_by_id(Array.wrap(params[:object_id]))
|
||||
end
|
||||
render_404 unless @apply.present?
|
||||
end
|
||||
|
||||
#flag标注功能,为1时设置‘申请版主’,为0时设置取消
|
||||
def set_apply(objects, user, flag)
|
||||
objects.each do |object|
|
||||
object.set_apply(user, flag)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_apply', :locals => {:user => user, :objects => objects} }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,294 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AttachmentsController < ApplicationController
|
||||
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
|
||||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
before_filter :delete_authorize, :only => :destroy
|
||||
before_filter :authorize_global, :only => :upload
|
||||
|
||||
before_filter :login_without_softapplication, only: [:download]
|
||||
accept_api_auth :show, :download, :upload
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @attachment.is_diff?
|
||||
@diff = File.new(@attachment.diskfile, "rb").read
|
||||
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
|
||||
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
|
||||
# Save diff type as user preference
|
||||
if User.current.logged? && @diff_type != User.current.pref[:diff_type]
|
||||
User.current.pref[:diff_type] = @diff_type
|
||||
User.current.preference.save
|
||||
end
|
||||
render :action => 'diff'
|
||||
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||||
@content = File.new(@attachment.diskfile, "rb").read
|
||||
render :action => 'file'
|
||||
else
|
||||
download
|
||||
end
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def download
|
||||
if true || @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
|
||||
@attachment.increment_download
|
||||
end
|
||||
|
||||
if stale?(:etag => @attachment.digest)
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
end
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
#更新资源文件类型
|
||||
def updateType
|
||||
@attachment = Attachment.find(params[:attachmentid])
|
||||
if @attachment != nil
|
||||
@attachment.attachtype = params[:newtype]
|
||||
@attachment.save
|
||||
render :text =>'success'
|
||||
else
|
||||
render :text=>'error'
|
||||
end
|
||||
end
|
||||
|
||||
def thumbnail
|
||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||
if stale?(:etag => thumbnail)
|
||||
send_file thumbnail,
|
||||
:filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => 'inline'
|
||||
end
|
||||
else
|
||||
# No thumbnail for the attachment or thumbnail could not be created
|
||||
render :nothing => true, :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
def upload
|
||||
# Make sure that API users get used to set this content type
|
||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||
unless request.content_type == 'application/octet-stream'
|
||||
render :nothing => true, :status => 406
|
||||
return
|
||||
end
|
||||
|
||||
@attachment = Attachment.new(:file => request.raw_post)
|
||||
@attachment.author = User.current
|
||||
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
saved = @attachment.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.api {
|
||||
if saved
|
||||
render :action => 'upload', :status => :created
|
||||
else
|
||||
render_validation_errors(@attachment)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @attachment.container.respond_to?(:init_journal)
|
||||
@attachment.container.init_journal(User.current)
|
||||
end
|
||||
if @attachment.container
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
else
|
||||
@attachment.destroy
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
# modify by nwb
|
||||
if @attachment.container_type == 'Course'
|
||||
if @course.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or course_path(@course) }
|
||||
end
|
||||
else
|
||||
if @project.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or project_path(@project) }
|
||||
end
|
||||
end
|
||||
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_homework
|
||||
@bid = @attachment.container.bid
|
||||
# Make sure association callbacks are called
|
||||
container = @attachment.container
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
#if container.attachments.empty?
|
||||
#container.delete
|
||||
#end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or respond_path(@bid) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
# modify by nwb
|
||||
if params[:project_id]
|
||||
@project = Project.find_by_id(params[:project_id])
|
||||
elsif params[:course_id]
|
||||
@course = Course.find_by_id(params[:course_id])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_project
|
||||
classname = params[:class_name]
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Object.const_get(classname).find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_course
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Course.find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@attachment = Attachment.find(params[:id])
|
||||
# Show 404 if the filename in the url is wrong
|
||||
# modify by nwb
|
||||
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
|
||||
if @attachment.container_type == 'Course'
|
||||
@course = @attachment.course
|
||||
else
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
|
||||
@project = @attachment.project
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Checks that the file exists and is readable
|
||||
def file_readable
|
||||
if @attachment.readable?
|
||||
true
|
||||
else
|
||||
logger.error "Cannot send attachment, #{@attachment.diskfile} does not exist or is unreadable."
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
def read_authorize
|
||||
if @attachment.container_type == "HomeworkAttach" || @attachment.container_type == 'Bid'
|
||||
true
|
||||
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
|
||||
else
|
||||
@attachment.visible? ? true : deny_access
|
||||
end
|
||||
end
|
||||
|
||||
def delete_authorize
|
||||
@attachment.deletable? ? true : deny_access
|
||||
end
|
||||
|
||||
def detect_content_type(attachment)
|
||||
content_type = attachment.content_type
|
||||
if content_type.blank?
|
||||
content_type = Redmine::MimeType.of(attachment.filename)
|
||||
end
|
||||
content_type.to_s
|
||||
end
|
||||
|
||||
def login_without_softapplication
|
||||
referer = request.headers['Referer']
|
||||
require_login unless referer =~ /softapplication/
|
||||
end
|
||||
|
||||
def renderTag
|
||||
@attachmentNew = Attachment.find(params[:attchmentId])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AuthSourcesController < ApplicationController
|
||||
layout 'admin'
|
||||
menu_item :ldap_authentication
|
||||
|
||||
before_filter :require_admin
|
||||
before_filter :find_auth_source, :only => [:edit, :update, :test_connection, :destroy]
|
||||
|
||||
def index
|
||||
@auth_source_pages, @auth_sources = paginate AuthSource, :per_page => 25
|
||||
end
|
||||
|
||||
def new
|
||||
klass_name = params[:type] || 'AuthSourceLdap'
|
||||
@auth_source = AuthSource.new_subclass_instance(klass_name, params[:auth_source])
|
||||
render_404 unless @auth_source
|
||||
end
|
||||
|
||||
def create
|
||||
@auth_source = AuthSource.new_subclass_instance(params[:type], params[:auth_source])
|
||||
if @auth_source.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to auth_sources_path
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @auth_source.update_attributes(params[:auth_source])
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to auth_sources_path
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def test_connection
|
||||
begin
|
||||
@auth_source.test_connection
|
||||
flash[:notice] = l(:notice_successful_connection)
|
||||
rescue Exception => e
|
||||
flash[:error] = l(:error_unable_to_connect, e.message)
|
||||
end
|
||||
redirect_to auth_sources_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
unless @auth_source.users.exists?
|
||||
@auth_source.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
end
|
||||
redirect_to auth_sources_path
|
||||
end
|
||||
|
||||
def autocomplete_for_new_user
|
||||
results = AuthSource.search(params[:term])
|
||||
|
||||
render :json => results.map {|result| {
|
||||
'value' => result[:login],
|
||||
'label' => "#{result[:login]} (#{result[:firstname]} #{result[:lastname]})",
|
||||
'login' => result[:login].to_s,
|
||||
'firstname' => result[:firstname].to_s,
|
||||
'lastname' => result[:lastname].to_s,
|
||||
'mail' => result[:mail].to_s,
|
||||
'auth_source_id' => result[:auth_source_id].to_s
|
||||
}}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_auth_source
|
||||
@auth_source = AuthSource.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AutoCompletesController < ApplicationController
|
||||
before_filter :find_project
|
||||
|
||||
def issues
|
||||
@issues = []
|
||||
q = (params[:q] || params[:term]).to_s.strip
|
||||
if q.present?
|
||||
scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible
|
||||
if q.match(/\A#?(\d+)\z/)
|
||||
@issues << scope.find_by_id($1.to_i)
|
||||
end
|
||||
@issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).all
|
||||
@issues.compact!
|
||||
end
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_project
|
||||
if params[:project_id].present?
|
||||
@project = Project.find(params[:project_id])
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
class AvatarController < ApplicationController
|
||||
|
||||
|
||||
#before_filter :set_cache_buster
|
||||
include AvatarHelper
|
||||
|
||||
def upload
|
||||
# Make sure that API users get used to set this content type
|
||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||
unless request.content_type == 'application/octet-stream'
|
||||
render :nothing => true, :status => 406
|
||||
return
|
||||
end
|
||||
|
||||
unless request.raw_post.nil?
|
||||
@source_type = params[:source_type]
|
||||
@source_id = params[:source_id]
|
||||
@temp_file = request.raw_post
|
||||
if @temp_file.size > 0
|
||||
if @temp_file.respond_to?(:original_filename)
|
||||
@image_file = @temp_file.original_filename
|
||||
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
|
||||
else
|
||||
@image_file=params[:filename]
|
||||
end
|
||||
end
|
||||
end
|
||||
if @temp_file && (@temp_file.size > 0)
|
||||
diskfile=disk_filename(@source_type,@source_id)
|
||||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||
logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)")
|
||||
path = File.dirname(diskfile)
|
||||
unless File.directory?(path)
|
||||
FileUtils.mkdir_p(path)
|
||||
end
|
||||
md5 = Digest::MD5.new
|
||||
File.open(diskfile, "wb") do |f|
|
||||
if @temp_file.respond_to?(:read)
|
||||
buffer = ""
|
||||
while (buffer = @temp_file.read(8192))
|
||||
f.write(buffer)
|
||||
md5.update(buffer)
|
||||
end
|
||||
else
|
||||
f.write(@temp_file)
|
||||
md5.update(@temp_file)
|
||||
end
|
||||
end
|
||||
# self.digest = md5.hexdigest
|
||||
end
|
||||
@temp_file = nil
|
||||
# @avatar = Avatar.new(:receive_file => request.raw_post)
|
||||
# @avatar.source_id = User.current.id
|
||||
# @avatar.image_file = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
# saved = @avatar.save
|
||||
begin
|
||||
f = Magick::ImageList.new(diskfile)
|
||||
width = 300.0
|
||||
proportion = (width/f[0].columns)
|
||||
height = (f[0].rows*proportion)
|
||||
f.resize_to_fill!(width,height)
|
||||
# f.scale!(width,height)
|
||||
f.write(diskfile)
|
||||
rescue Exception => e
|
||||
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.api {
|
||||
if saved
|
||||
render :action => 'upload', :status => :created
|
||||
else
|
||||
render_validation_errors(@avatar)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_cache_buster
|
||||
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
|
||||
response.headers["Pragma"] = "no-cache"
|
||||
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,997 +0,0 @@
|
|||
# fq
|
||||
class BidsController < ApplicationController
|
||||
#Added by young
|
||||
menu_item l(:label_homework), :only => [:edit, :udpate]
|
||||
menu_item :respond
|
||||
menu_item :course, :only => :show_courseEx
|
||||
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
|
||||
menu_item :homework_respond, :only => :homework_respond
|
||||
menu_item :homework_statistics, :only => :homework_statistics
|
||||
#Ended by young
|
||||
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
||||
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||
# added by fq
|
||||
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
|
||||
# end
|
||||
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
||||
|
||||
before_filter :memberAccess, only: :show_project
|
||||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
include ApplicationHelper
|
||||
include BidsHelper
|
||||
|
||||
helper :projects
|
||||
helper :words
|
||||
helper :welcome
|
||||
|
||||
def find_project_by_bid_id
|
||||
@bid = Bid.find(params[:id])
|
||||
@project = @bid.courses[0]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def homework_ajax_modal
|
||||
@bid = Bid.find_by_id(params[:id])
|
||||
# find_bid
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@project_type = params[:project_type]
|
||||
# Modified by nie
|
||||
# @requirement_title = "4"
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
if @project_type == '1'
|
||||
@bids = Bid.visible.where('reward_type = ?', 3)
|
||||
# elsif
|
||||
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
|
||||
else
|
||||
@bids = Bid.visible.where('reward_type = ?', 1)
|
||||
end
|
||||
|
||||
@bids = @bids.like(params[:name]) if params[:name].present?
|
||||
@bid_count = @bids.count
|
||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
|
||||
@offset ||= @bid_pages.reverse_offset
|
||||
#added by nie
|
||||
if params[:bid_sort_type].present?
|
||||
case params[:bid_sort_type]
|
||||
when '0'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
when '1'
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
when '2'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
end
|
||||
else
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
end
|
||||
#end
|
||||
end
|
||||
#huang
|
||||
def contest
|
||||
|
||||
# Modified by nie
|
||||
# @requirement_title = "4"
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
|
||||
@bids = Bid.visible.where('reward_type = ?', 2)
|
||||
|
||||
# elsif
|
||||
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
|
||||
@bids = @bids.like(params[:name]) if params[:name].present?
|
||||
@bid_count = @bids.count
|
||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
|
||||
@offset ||= @bid_pages.reverse_offset
|
||||
#added by nie
|
||||
if params[:contest_sort_type].present?
|
||||
case params[:contest_sort_type]
|
||||
when '0'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
when '1'
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
when '2'
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
end
|
||||
else
|
||||
unless @offset == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
def fork
|
||||
@courses = []
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@membership.each do |membership|
|
||||
if membership.project.project_type == 1
|
||||
@courses << membership.project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_fork
|
||||
@homework = Bid.new
|
||||
@homework.name = params[:bid][:name]
|
||||
@homework.description = params[:bid][:description]
|
||||
@homework.reward_type = 3
|
||||
# @bid.budget = params[:bid][:budget]
|
||||
@homework.deadline = params[:bid][:deadline]
|
||||
@homework.budget = 0
|
||||
@homework.author_id = User.current.id
|
||||
@homework.commit = 0
|
||||
@homework.homework_type = 1
|
||||
@homework.is_evaluation = params[:bid][:is_evaluation]
|
||||
@homework.parent_id = @bid.id
|
||||
@homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||
# @bid.
|
||||
if @homework.save
|
||||
HomeworkForCourse.create(:course_id => params[:course], :bid_id => @homework.id)
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@homework)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
@courses = []
|
||||
@membership = User.current.coursememberships.all#(:conditions => Project.visible_condition(User.current))
|
||||
@membership.each do |membership|
|
||||
@courses << membership.course
|
||||
end
|
||||
render :action => 'fork'
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@user = @bid.author
|
||||
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
layout_file = ''
|
||||
case @bid.reward_type
|
||||
when 3
|
||||
layout_file = 'base_homework'
|
||||
when 1
|
||||
layout_file = 'base_bids'
|
||||
else
|
||||
layout_file = 'base_contest'
|
||||
end
|
||||
format.html {
|
||||
render :layout => layout_file
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def join_in_contest
|
||||
if @bid.reward_type == 2 && params[:course_password] == @bid.password
|
||||
JoinInContest.create(:user_id => User.current.id, :bid_id => @bid.id)
|
||||
@state = 0
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
# TO_DO
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||
end
|
||||
end
|
||||
|
||||
def unjoin_in_contest
|
||||
|
||||
joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id)
|
||||
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||
end
|
||||
end
|
||||
|
||||
def new_join
|
||||
# added by fq
|
||||
|
||||
|
||||
end
|
||||
|
||||
# added by bai 增加了参与者和竞赛设置
|
||||
def show_participator
|
||||
render :layout => 'base_contest'
|
||||
|
||||
end
|
||||
|
||||
def settings
|
||||
if @bid.author.id == User.current.id
|
||||
if @bid.reward_type == 2
|
||||
@contest = Bid.find_by_reward_type(@bid.reward_type)
|
||||
render :layout => 'base_contest'
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_contest_setting_authorized
|
||||
end
|
||||
end
|
||||
#end
|
||||
|
||||
# 显示课程
|
||||
def show_course
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@courses = []
|
||||
for bid in bids
|
||||
@courses << bid.courses.first
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_bid_project
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@projects = []
|
||||
for bid in bids
|
||||
@projects += bid.biding_projects
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_bid_user
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@users = []
|
||||
for bid in bids
|
||||
for project in bid.projects
|
||||
@users += project.users
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_project
|
||||
# flash[:notice] = ""
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@option = []
|
||||
@membership.each do |membership|
|
||||
unless(membership.project.project_type==1)
|
||||
membership.member_roles.each{|role|
|
||||
if(role.role_id == 3)
|
||||
@option << membership.project
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# a = [1]
|
||||
# @project = Project.where("id in []", a)
|
||||
@user = @bid.author
|
||||
@bidding_project = @bid.biding_projects.all
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@bidding_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@bidding_project = @temp
|
||||
else
|
||||
#added by nie
|
||||
@temp = []
|
||||
@bidding_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
if @temp.size > 0
|
||||
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
|
||||
end
|
||||
#ended
|
||||
end
|
||||
|
||||
if @bid.homework_type == 1
|
||||
@homework = HomeworkAttach.new
|
||||
#@homework_list = @bid.homeworks
|
||||
#增加作业按评分排序,
|
||||
@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@homework_list.each do |pro|
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@homework_list = @temp
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
# 显示作业课程
|
||||
# add by nwb
|
||||
def show_courseEx
|
||||
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
|
||||
# flash[:notice] = ""
|
||||
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||
@option = []
|
||||
@membership.each do |membership|
|
||||
membership.member_roles.each{|role|
|
||||
if(role.role_id == 3)
|
||||
@option << membership.course
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@user = @bid.author
|
||||
@bidding_project = @bid.biding_projects.all
|
||||
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@bidding_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@bidding_project = @temp
|
||||
else
|
||||
#added by nie
|
||||
@temp = []
|
||||
@bidding_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
if @temp.size > 0
|
||||
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
|
||||
end
|
||||
#ended
|
||||
end
|
||||
|
||||
if @bid.homework_type == 1
|
||||
@homework = HomeworkAttach.new
|
||||
#@homework_list = @bid.homeworks
|
||||
#增加作业按评分排序,
|
||||
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
|
||||
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
|
||||
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC")
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@homework_list.each do |pro|
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@homework_list = @temp
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
end
|
||||
|
||||
##### by huang
|
||||
def show_project_homework
|
||||
# flash[:notice] = ""
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@option = []
|
||||
@membership.each do |membership|
|
||||
end
|
||||
# a = [1]
|
||||
# @project = Project.where("id in []", a)
|
||||
@user = @bid.author
|
||||
@bidding_project = @bid.biding_projects
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
###添加应标项目
|
||||
def add
|
||||
project = Project.find(params[:bid])
|
||||
bid_message = params[:bid_for_save][:bid_message]
|
||||
if BidingProject.where("project_id = ? and bid_id = ?", project.id, @bid.id).size == 0
|
||||
if BidingProject.cerate_bidding(@bid.id, project.id, bid_message)
|
||||
|
||||
# added by bai type ==1 需求,type==2 竞赛, type==3 作业
|
||||
if @bid.reward_type == 1
|
||||
flash.now[:notice] = l(:label_bidding_succeed)
|
||||
|
||||
elsif @bid.reward_type == 2
|
||||
flash.now[:notice] = l(:label_bidding_contest_succeed)
|
||||
|
||||
else @bid.reward_type == 3
|
||||
flash.now[:notice] = l(:label_bidding_homework_succeed)
|
||||
end
|
||||
# end
|
||||
|
||||
end
|
||||
else
|
||||
if @bid.reward_type == 3
|
||||
flash.now[:error] = l(:label_bidding_homework_fail)
|
||||
else
|
||||
flash.now[:error] = l(:label_bidding_fail)
|
||||
end
|
||||
end
|
||||
@bidding_project = @bid.biding_projects
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
# format.html
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
#删除已提交的项目作业(不删项目)
|
||||
def delete
|
||||
binding_project = params[:binding_project]
|
||||
if can_delete_project_homework(BidingProject.find(binding_project),User.current)
|
||||
if BidingProject.delete(binding_project)
|
||||
redirect_to project_for_bid_path
|
||||
else
|
||||
redirect_to 403;
|
||||
end
|
||||
end
|
||||
end
|
||||
## 新建留言
|
||||
def create
|
||||
|
||||
if params[:bid_message][:message].size>0
|
||||
if params[:reference_content]
|
||||
message = params[:bid_message][:message] + "\n" + params[:reference_content]
|
||||
else
|
||||
message = params[:bid_message][:message]
|
||||
@m = message
|
||||
end
|
||||
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
||||
@bid.add_jour(User.current, message, refer_user_id)
|
||||
end
|
||||
@user = @bid.author
|
||||
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@bid.set_commit(@feedback_count)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
##删除留言
|
||||
def destroy
|
||||
@user = @bid.author
|
||||
if User.current.admin? || User.current.id == @user.id
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
end
|
||||
@jours = @bid.journals_for_messages.reverse
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
|
||||
@bid.set_commit(@feedback_count)
|
||||
# if a_message.size > 5
|
||||
# @message = a_message[-5, 5]
|
||||
# else
|
||||
# @message = a_message
|
||||
# end
|
||||
# @message_count = a_message.count
|
||||
|
||||
respond_to do |format|
|
||||
# format.html
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
#删除作业
|
||||
#by xianbo
|
||||
def homework_destroy
|
||||
@bid_to_destroy = Bid.find params[:course_id]
|
||||
(render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id
|
||||
@bid_to_destroy.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
#end by xianbo
|
||||
##引用
|
||||
def new
|
||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||
if @jour
|
||||
user = @jour.user
|
||||
text = @jour.notes
|
||||
else
|
||||
user = @bid.author
|
||||
text = @bid.description
|
||||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
##新建需求
|
||||
def new_bid
|
||||
@bid = Bid.new
|
||||
@bid.safe_attributes = params[:bid]
|
||||
end
|
||||
|
||||
#huang
|
||||
def create_contest
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.reward_type = 2
|
||||
@bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
@bid.password = params[:bid][:password] #added by bai
|
||||
@bid.author_id = User.current.id
|
||||
@bid.commit = 0
|
||||
if @bid.save
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@bid)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
render :action => 'new_bid'
|
||||
end
|
||||
end
|
||||
|
||||
# added by bai
|
||||
def update_contest
|
||||
@bid = Bid.find(params[:id])
|
||||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.reward_type = 2
|
||||
@bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
@bid.password = params[:bid][:password]
|
||||
@bid.author_id = User.current.id
|
||||
@bid.commit = 0
|
||||
if @bid.save
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@bid)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
render :action => 'new_bid'
|
||||
end
|
||||
end
|
||||
#huang
|
||||
def new_contest
|
||||
@bid = Bid.new
|
||||
@bid.safe_attributes = params[:bid]
|
||||
end
|
||||
|
||||
def create_bid
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.reward_type = 1
|
||||
@bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
@bid.author_id = User.current.id
|
||||
@bid.commit = 0
|
||||
if @bid.save
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@bid)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
render :action => 'new_bid'
|
||||
end
|
||||
end
|
||||
|
||||
def create_homework
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:bid][:name]
|
||||
@bid.description = params[:bid][:description]
|
||||
@bid.is_evaluation = params[:bid][:is_evaluation]
|
||||
@bid.proportion = params[:bid][:proportion]
|
||||
@bid.reward_type = 3
|
||||
# @bid.budget = params[:bid][:budget]
|
||||
@bid.deadline = params[:bid][:deadline]
|
||||
@bid.budget = 0
|
||||
@bid.author_id = User.current.id
|
||||
@bid.commit = 0
|
||||
@bid.homework_type = 1
|
||||
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||
# @bid.
|
||||
if @bid.save
|
||||
HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id)
|
||||
unless @bid.watched_by?(User.current)
|
||||
if @bid.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_bid_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to respond_path(@bid)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
@homework = @bid
|
||||
@course = Course.find_by_id(params[:course_id])
|
||||
@course_id = @course.id
|
||||
#respond_to do |format|
|
||||
# format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
|
||||
# format.api { render_validation_errors(@bid) }
|
||||
#end
|
||||
render file: 'courses/new_homework', layout: 'base_courses'
|
||||
end
|
||||
end
|
||||
|
||||
# modify by nwb\
|
||||
# 编辑作业
|
||||
def edit
|
||||
@bid = Bid.find(params[:bid_id])
|
||||
if (User.current.admin?||User.current.id==@bid.author_id)
|
||||
@course_id = params[:course_id]
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@course = Course.find(params[:course_id])
|
||||
@user= User.find(User.current.id)
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
end
|
||||
else
|
||||
render 403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@bid = Bid.find(params[:id])
|
||||
@course = @bid.courses.first#Project.find(params[:course_id])
|
||||
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||
if @bid.update_attributes(params[:bid]) && @bid.save
|
||||
flash[:notice] = l(:label_update_homework_succeed)
|
||||
redirect_to course_homework_path(@course)
|
||||
else
|
||||
@bid.safe_attributes = params[:bid]
|
||||
render :action => 'edit', :layout =>'base_courses'
|
||||
end
|
||||
end
|
||||
|
||||
def new_submit_homework
|
||||
#render html to prepare create submit homework
|
||||
find_bid
|
||||
render :layout => 'base_homework'
|
||||
end
|
||||
|
||||
def add_homework
|
||||
if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)
|
||||
# homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id)
|
||||
# homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||
|
||||
if hadcommittedhomework(User.current.id, @bid.id) == true
|
||||
@homework_flag = l(:label_bidding_homework_committed)
|
||||
else
|
||||
@homework = HomeworkAttach.new
|
||||
@homework.safe_attributes = params[:homeworkattach]
|
||||
@homework.bid_id = @bid.id
|
||||
@homework.user_id = User.current.id
|
||||
@homework.save_attachments(params[:attachments])
|
||||
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
@homework_flag = if @homework.save
|
||||
l(:label_bidding_homework_succeed)
|
||||
else
|
||||
l(:label_bidding_homework_failed)
|
||||
end
|
||||
|
||||
if @homework.attachments.empty?
|
||||
@homework.delete
|
||||
#flash[:error] = l(:no_attachmens_allowed)
|
||||
@homework_flag = l(:no_attachmens_allowed)
|
||||
# else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@homework_list = @bid.homeworks
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
#redirect_to project_for_bid_path, notice: @homework_flag.to_s
|
||||
flash[:notice] = @homework_flag.to_s
|
||||
redirect_back_or_default(project_for_bid_path)
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# 作业统计
|
||||
def homework_statistics
|
||||
@course = @bid.courses.first
|
||||
@member = []
|
||||
@course.memberships.each do |member|
|
||||
unless (member.roles && Role.where('id = ? ', 3)).empty?
|
||||
@member.push member
|
||||
end
|
||||
end
|
||||
if @bid.homework_type = 1
|
||||
@student = User.where("id in (select DISTINCT user_id from #{HomeworkAttach.table_name} where bid_id = ? )", @bid.id)
|
||||
@homework_type = true
|
||||
else
|
||||
|
||||
@homework_type = false
|
||||
end
|
||||
@user = @bid.author
|
||||
render :layout => 'base_homework'
|
||||
end
|
||||
|
||||
def homework_respond
|
||||
@user = @bid.author
|
||||
render :layout => 'base_homework'
|
||||
end
|
||||
|
||||
def more
|
||||
@jour = @bid.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = true
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
def back
|
||||
@jour = @bid.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
#added by william
|
||||
#used to set the bidding project reward
|
||||
def set_reward
|
||||
@b_p = nil
|
||||
@biding_project_id = nil
|
||||
|
||||
if params[:set_reward][:reward]&&((User.current.id==@bid.author_id)||User.current.admin)
|
||||
# @bid_id = params[:id]
|
||||
@biding_project_id = params[:set_reward][:b_id]
|
||||
@b_p = BidingProject.find_by_id(@biding_project_id)
|
||||
|
||||
# 把字段存进表中
|
||||
@b_p.update_reward(params[:set_reward][:reward].to_s)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# added by william
|
||||
# used to manage the bid and end the bid
|
||||
def manage
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_bid
|
||||
if params[:id]
|
||||
@bid = Bid.find(params[:id], :include => [{:homeworks => :user}])
|
||||
@user = @bid.author
|
||||
end
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
|
||||
def memberAccess
|
||||
# 是课程,则判断当前用户是否参加了课程
|
||||
return true if current_user.admin?
|
||||
#return 0 if @bid.courses.first.project_type == Project::ProjectType_project
|
||||
currentUser = User.current
|
||||
render_403 unless currentUser.member_of_cousrse?(@bid.courses.first)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class BoardsController < ApplicationController
|
||||
layout 'base_projects'#by young
|
||||
default_search_scope :messages
|
||||
before_filter :find_project_by_project_id, :find_board_if_available
|
||||
before_filter :authorize, :except => [:new, :show, :create, :index]
|
||||
accept_rss_auth :index, :show
|
||||
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :watchers
|
||||
|
||||
def index
|
||||
#modify by nwb
|
||||
if @project
|
||||
@boards = @project.boards.includes(:last_message => :author).all
|
||||
@boards = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
end
|
||||
render :layout => false if request.xhr?
|
||||
elsif @course
|
||||
@boards = @course.boards.includes(:last_message => :author).all
|
||||
@boards = [] << @boards[0] if @boards.any?
|
||||
if @boards.size == 1
|
||||
@board = @boards.first
|
||||
show and return
|
||||
end
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
sort_init 'updated_on', 'desc'
|
||||
sort_update 'created_on' => "#{Message.table_name}.created_on",
|
||||
'replies' => "#{Message.table_name}.replies_count",
|
||||
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
|
||||
|
||||
@topic_count = @board.topics.count
|
||||
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||
@topics = @board.topics.
|
||||
reorder("#{Message.table_name}.sticky DESC").
|
||||
includes(:last_reply).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
order(sort_clause).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@message = Message.new(:board => @board)
|
||||
#modify by nwb
|
||||
if @project
|
||||
render :action => 'show', :layout => !request.xhr?
|
||||
elsif @course
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
@messages = @board.messages.
|
||||
reorder('created_on DESC').
|
||||
includes(:author, :board).
|
||||
limit(Setting.feeds_limit.to_i).
|
||||
all
|
||||
if @project
|
||||
render_feed(@messages, :title => "#{@project}: #{@board}")
|
||||
elsif @course
|
||||
render_feed(@messages, :title => "#{@course}: #{@board}")
|
||||
end
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@board = @project.boards.build
|
||||
@board.safe_attributes = params[:board]
|
||||
if @project.project_type == 1
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@board = @project.boards.build
|
||||
@board.safe_attributes = params[:board]
|
||||
|
||||
if @board.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
#Modified by young
|
||||
#redirect_to_settings_in_projects
|
||||
redirect_to project_board_path(@project, @board)
|
||||
#Ended by young
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
if @project.project_type == 1
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@board.safe_attributes = params[:board]
|
||||
if @board.save
|
||||
redirect_to_settings_in_projects
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@board.destroy
|
||||
redirect_to_settings_in_projects
|
||||
end
|
||||
|
||||
private
|
||||
def redirect_to_settings_in_projects
|
||||
redirect_to settings_project_path(@project, :tab => 'boards')
|
||||
end
|
||||
|
||||
def find_board_if_available
|
||||
@board = @project.boards.find(params[:id]) if params[:id]
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue