Class PortalController
In: test/functional/portal_controller_test.rb
app/controllers/portal_controller.rb
Parent: Object

Methods

Public Instance methods

[Source]

    # File app/controllers/portal_controller.rb, line 73
73:   def about
74:     @about = AdminMessage.text('About')
75:   end

[Source]

     # File app/controllers/portal_controller.rb, line 88
 88:   def archives
 89:     @cadmin = User.find_central_admin
 90:     @year = params[:year]
 91:     @month = params[:month]
 92:     month_start = Time.gm(@year, @month)
 93:     month_end = month_start.at_end_of_month
 94:     logger.debug("Versions for archives #{['version <> 0 and created_on >= ? and created_on < ?', month_start, month_end].inspect}")
 95:     @versions = UserVersion.find(:all, :order => 'created_on ASC', :conditions => ['created_on >= ? and created_on < ?',month_start, month_end])
 96:     @comments = Comment.find(:all, :order => 'created_on ASC', :conditions => ['created_on >= ? and created_on < ?',month_start, month_end])
 97:     @uploads = Upload.find(:all, :order => 'created_on ASC', :conditions => ['created_on >= ? and created_on < ?',month_start, month_end])
 98:     @updates = Update.find(:all, :order => 'created_on ASC', :conditions => ['created_on >= ? and created_on < ?',month_start, month_end])
 99:     @pages = WikiPage.find(:all, :order => 'created_on ASC', :conditions => ['created_on >= ? and created_on < ? and tool = ?',month_start, month_end, 'Wiki'])    
100:     @tabitems = []
101:     @tabitems << {:text => "Discussion (#{@comments.size.to_s})", :id => 'discussion'} 
102:     @tabitems << {:text => "Changes (#{@versions.size.to_s})", :id => 'changes'} 
103:     @tabitems << {:text => "Uploads (#{@uploads.size.to_s})", :id => 'uploads'} 
104:     @tabitems << {:text => "Updates (#{@updates.size.to_s})", :id => 'updates'} 
105:     @tabitems << {:text => "Pages (#{@pages.size.to_s})", :id => 'pages'}     
106:   end

[Source]

     # File app/controllers/portal_controller.rb, line 108
108:   def feedback
109:     @help = AdminMessage.text('Help')
110:     if request.get?
111:       @feedback = Feedback.new
112:     else  
113:       @feedback = Feedback.new(params[:feedback].merge(:user => session['user']))
114:       if @feedback.save
115:         Notifier::deliver_feedback(@feedback)
116:         flash['success'] = "Your feedback or question was succesfully sent. <br>Thanks for your interest in #{ENV['EPFWIKI_APP_NAME']}!"
117:         redirect_to '/'
118:       end
119:     end
120:   end

See also RssController.index

[Source]

    # File app/controllers/portal_controller.rb, line 26
26:   def home
27:     if User.count > 0
28:       @cadmin = User.find_central_admin
29:       #@versions = Version.find(:all, :order => 'created_on DESC', :conditions => ['version <> 0 and created_on > ?',Time.now - 1.month])
30:       @versions = Version.find(:all, :order => 'created_on DESC', :conditions => ['baseline_process_id is null and version is not null'], :limit => 15)
31:       #@comments = Comment.find(:all, :order => 'created_on DESC', :conditions => ['created_on > ?',Time.now - 1.month])
32:       @comments = Comment.find(:all, :order => 'created_on DESC', :limit => 15)
33:       @templates = Site.templates
34:       @uploads = Upload.find(:all, :order => 'created_on DESC', :limit => 15)
35:       @pages = WikiPage.find(:all, :order => 'created_on DESC', :limit => 15, :conditions => ['tool = ?', 'Wiki'])
36:       @welcome = AdminMessage.text('Welcome')
37:       @tabitems = []
38:       @tabitems << {:text => "Discussion", :id => 'discussion'} 
39:       @tabitems << {:text => "Changes", :id => 'changes'} 
40:       @tabitems << {:text => "Uploads", :id => 'uploads'} 
41:       @tabitems << {:text => "Pages", :id => 'pages'} 
42:     else
43:       redirect_to :controller => 'login'
44:     end
45:   end

[Source]

     # File app/controllers/portal_controller.rb, line 122
122:   def privacypolicy
123:     render :inline => "<% @heading = 'Privacy Policy'  %><h2>Privacy Policy</h2><%= @privacypolicy %>", :layout => 'portal'
124:   end

[Source]

    # File test/functional/portal_controller_test.rb, line 18
18:                         def rescue_action(e) raise e end

[Source]

     # File app/controllers/portal_controller.rb, line 126
126:   def termsofuse
127:     render :inline => "<% @heading = 'Terms of Use' %><h2>Terms of Use</h2><%= @termsofuse %>", :layout => 'portal'
128:   end

[Source]

    # File app/controllers/portal_controller.rb, line 51
51:   def users
52:     version_counts = UserVersion.count(:group => 'user_id')
53:     comment_counts = Comment.count(:group => 'user_id')
54:     upload_counts = Upload.count(:group => 'user_id')
55:     new_page_counts = WikiPage.count(:group => 'user_id', :conditions => ['tool=?','Wiki'])
56:     @contributors = []
57:     User.find(:all).each do |user|
58:       version_count = 0
59:       comment_count = 0
60:       upload_count = 0
61:       new_page_count = 0
62:       count = 0
63:       version_count = version_counts.assoc(user.id)[1] unless version_counts.assoc(user.id).nil?
64:       comment_count = comment_counts.assoc(user.id)[1] unless comment_counts.assoc(user.id).nil?      
65:       upload_count = upload_counts.assoc(user.id)[1] unless upload_counts.assoc(user.id).nil?
66:       new_page_count = new_page_counts.assoc(user.id)[1] unless new_page_counts.assoc(user.id).nil?
67:       count = version_count + comment_count + upload_count + new_page_count
68:       @contributors << {:user => user, :version_count => version_count, :comment_count => comment_count, :upload_count => upload_count, :new_page_count => new_page_count, :count => count}
69:     end
70:     @contributors = @contributors.sort_by {|c|-c[:count]}
71:   end

[Source]

    # File app/controllers/portal_controller.rb, line 47
47:   def wikis
48:     @wikis = Wiki.find(:all, :conditions => ['obsolete_on is null'])
49:   end

[Validate]