require_dependency 'xforum/application_controller' module Xforum class ForumsController < ApplicationController def the_page end def forum_ajax case params[:function] when 'get list' case params[:list] when 'admin-actions' then render json: Forum.get_forum_actions(params, current_user) when 'admin-users' then render json: PeopleList.get_forum_users(params, current_user) when 'admin-emails' then render json: PeopleList.get_forum_emails(params, current_user) when 'forum-distribution-lists', 'forum-restricted-list' then render json: PeopleList.get_forum_distribution_lists(params,current_user) else end when 'get video' render json: Photo.get_video(params) when 'forum admin action' render json: Forum.do_admin_action(params, current_user) when 'categories' render json: Category.categories(params, current_user) when 'post' render json: Forum.add_comment(params, current_user) when 'get forum photo' render json: Photo.get_photo(params) when 'add hot link' render json: Hyperlink.add_one(params) when 'get language set' render json: Language.languages(params) when 'toggle language' render json: Language.toggle_language(params, current_user) when 'get translations' render json: Translation.get_translations(params) when 'add to list' case params[:list] when 'category' response= Category.add_category(params, current_user) when 'topic' response= Topic.add_topic(params, current_user) when 'language' response= Language.activate_language(params, current_user) else end render json: response when 'get senate' render json: Forum.senate(params, current_user) when 'get topics' render json: Topic.topics(params, current_user) when 'accept', 'reject' render json: Forum.change_state(params, current_user) when 'edit forum object' case params[:which_list] when 'forum-admins-category-list' response= Category.edit_category(params, current_user) when 'forum-admins-topic-list' response=Topic.edit_topic(params, current_user) else response={} end render json: response when 'remove forum object' case params[:which_list] when 'forum-admins-category-list' response= Category.remove_object(params, current_user) when 'forum-admins-topic-list' response= Topic.remove_object(params, current_user) when 'language' response= Language.deactivate_language(params, current_user) else end render json: response when 'vote' render json: {votes: Topic.cast_vote(params[:topic], current_user, params[:vote])} when 'add voting' render json: Topic.voting_booth?(params) when 'subscribe' render json: Topic.subscribe(params[:topic], current_user) when 'get suggestions' case params[:list] when 'category' response= Category.get_suggestions(params, current_user) when 'topic' response= Topic.get_suggestions(params, current_user) when 'language' response= Language.get_suggestions(params, current_user) else end render json: response when 'suggestion' response= Category.suggestion(params, current_user) if params[:category] =='request new category' response= Topic.suggestion(params, current_user) if params[:topic] =='request new topic' response= Language.suggestion(params, current_user) if params[:language] =='request new language' render json: response when 'suggestion close' case params[:list] when 'forum-category-prososals-list' response= Category.suggestion_close(params, current_user) when 'forum-topic-prososals-list' response= Topic.suggestion_close(params, current_user) when 'forum-language-prososals-list' response= Language.suggestion_close(params, current_user) else end render json: response when 'set_the_rest' render json: Forum.set_the_rest(params, current_user) else render json: {answer: 'what did you want'} end end def newphoto Photo.upload(params,current_user) end end end