diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3310e49..83439b9 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,8 +42,9 @@ m.save # current_url1({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" language_path(locale: target_locale) end + def ffi1_icon (name) - content_tag("i","", class: "ficon ffi1-"+name ) + content_tag("i", "", class: "ficon ffi1-" + name ) end def ffi2_icon (name) @@ -54,8 +55,11 @@ m.save end def fa_stack(icon1, icon2) - content_tag("span", content_tag("span", content_tag("i","", class: "ficon "+" fa-"+icon1+" fa fa-stack-1x" ) + content_tag("i","", class: "ficon "+" fa-"+icon2+" fa fa-stack-2x" ),class: "fa-stack "),class:"fa-stack-sm") - + h_1 = content_tag("span", content_tag("i","", class: "ficon "+" fa-"+icon1+" fa fa-stack-1x" ) + content_tag("i","", class: "ficon "+" fa-"+icon2+" fa fa-stack-2x" ),class: "fa-stack ") + + h_2 = content_tag("span", h_1 ,class: "fa-stack-sm") + + h_2 end def ffi1_list y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon1.yml") diff --git a/doc/app/Ability.html b/doc/app/Ability.html new file mode 100644 index 0000000..18d7a54 --- /dev/null +++ b/doc/app/Ability.html @@ -0,0 +1,689 @@ + + + +
+ + +Object
+ ++# File app/models/ability.rb, line 4 + def initialize(user,request=nil,key=nil) + tunet=IPAddr.new("128.131.95.0/24") +local=IPAddr.new("127.0.0.1") + loggedin=!(user.nil?) + unless key.nil? + k=Key.find_by_uuid(key) + if !k.nil? && k.is_valid && k.typ == 0 + user=k.user + end + end + user ||= User.new # guest user (not logged in) + if (user.has_role?("fetuser") || user.has_role?("fetadmin") || tunet.include?(IPAddr.new(request.remote_ip)) || local.include?(IPAddr.new(request.remote_ip))) + can :infoscreen, User + end + + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can [:show,:answer, :create,:new, :create_from_template, :flag], Survey::Question + can [:edit, :update, :flag_delete], Survey::Question, :flag_locked=>false + can :flag_locked, Survey::Question, :user_id=>user.id + can [:show,:new], Survey::Choice + can [:edit,:update, :delete,:create], Survey::Choice, :question=>{:flag_locked=>false} + can :manage, Survey::Answer + end + if user.has_role?("fetadmin") + can [:delete,:flag_template], Survey::Question + end + #--------------------------------------------------- + + can [:index,:hide], Comment + can :show, Comment + + if loggedin + can [:create,:new], Comment + can [:comment], Comment + end + + # can :manage, Comment + unless user.has_role?("fetadmin") + cannot :delete, Comment +cannot :destroy, Comment + end + #----------------------------------------------------- + # Rechteverwaltung fuer Studien Modul + can [:show, :index], Studium, :visible=>true + can [:show], Modulgruppe + can [:show, :index], Modul + can [:show, :index, :beispiel_sammlung], Lva + can [:create, :show], Beispiel, flag_delete: false + if loggedin + can :like, Beispiel + can :dislike, Beispiel + end + if ((user.has_role?("moderator",Beispiel)) || user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :flag, Beispiel + can [:create, :show], Beispiel, flag_delete: true + + can [:edit, :update], Beispiel + can :flag, Beispiel + can :set_lecturer, Beispiel + can :flag_delete, Beispiel + can :flag_goodquality, Beispiel + can :flag_badquality, Beispiel + + end + if (user.has_role?("moderator",Lva)) + can [:verwalten, :edit, :compare_tiss, :load_tiss, :update], Lva + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Modulgruppe + can :manage, Modul + can :manage, Lva + can :manage, Studium + #can :manage, Beispiel + can :comment, Beispiel + + can :manage, Lecturer + + end + unless user.has_role?("fetadmin") + cannot :delete, Studium + cannot :delete, Modulgruppe + cannot :delete, Modul + + end + if user.has_role?("fetadmin") + can [:index, :parse, :show], Crawlobject +end + #----------------------------------------------------- + # Rechteverwaltung fuer Informationen + can [:show, :index,:faqs], Themengruppe, :public=>true + can [:show], Thema, :isdraft=>false, :themengruppe=>{:public=>true} + can :show, Frage + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Frage + can :showdraft , Thema + can :showintern, Thema + can :manage, Thema + can [:index, :faqs, :show,:new,:edit, :verwalten_all, :verwalten, :sort_themengruppen, :sort_themen, :create, :update ], Themengruppe + can :manage, Attachment + end + can [:update,:edit,:verwalten, :showdraft], Thema, :id=>Thema.with_role(:editor, user).pluck(:id) + can [:index, :faqs, :show,:new,:edit, :verwalten_all, :verwalten, :sort_themengruppen, :sort_themen, :create, :update, :delete], Thema, :themengruppe_id=>Themengruppe.with_role(:admin,user).pluck(:id) + can :delete, Themengruppe, :id=>Themengruppe.with_role(:admin,user).pluck(:id) + if user.has_role?("fetadmin") + can :delete, Themengruppe + can :delete, Thema + end + + unless user.has_role?("fetadmin") + cannot :delete, Themengruppe + cannot :delete, Thema + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Fotos + +# can [:show,:index], Gallery, :intern=>false + can [:show,:index], Gallery + can :show, Foto + + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Gallery + can :manage, Foto + end + unless user.has_role?("fetadmin") + cannot :delete, Gallery + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Mitarbeiter + can [:show, :index], Fetprofile + can [:show, :index],Gremium + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Fetprofile + can :manage, Gremium + can :manage, Membership + end + unless user.has_role?("fetadmin") + cannot :delete, Fetprofile + cannot :delete ,Gremium + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Neuigkeiten + can :index, Rubrik + can [:show], Rubrik, :public=>true + can [:list], Neuigkeit, :cache_is_published=>true, :rubrik=>{:public=>true} + can :show, Neuigkeit, :cache_is_published=>true, :rubrik=>{:public=>true} + + if loggedin + can :show, :id => user.id + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + + can :showversions, Neuigkeit + can :showintern, Neuigkeit + can :showintern, Rubrik + can :seeintern, User + can :set_preferred_theme, user + can :list, Neuigkeit + can :shownonpublic, Rubrik + can :manage, Nlink + end + if user.has_role?("newsadmin") || user.has_role?("fetadmin") + can :addmoderator, Rubrik + end + if user.has_role?("fetadmin") + can :addfetuser, User + can :addfetadmin, User + can :add_role, User + can :show, User + can :index, User + can :edit, User + can :manage, User + can :set_preferred_theme, User + end + + if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser") + can :manage, Rubrik + can :manage, Neuigkeit + can :showunpublished, Neuigkeit + end + unless user.has_role?("fetadmin") + cannot :delete, Rubrik + cannot :delete, Neuigkeit + end + # Calendar + + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can [:show, :edit, :update,:new,:create,:write, :write_etherpad, :read_from_etherpad, :dump_to_etherpad, :search], Document + can :manage, Meeting + can :manage, Meetingtyp + end + if user.has_role?("fetadmin") + can :manage, Document + end + if loggedin + end + can :show, Document, :typ=>11 + unless user.has_role?( "fetadmin") + cannot :delete, Document + cannot :delete, Meeting + end + if user.has_role?( "fetadmin") + can :manage, Meetingtyp + + end + + # Rechteverwaltung Kalender + can [:show, :index], Calendar, :public => true + can [:showics], Calendar + # can [:show], Calentry + if (!k.nil? && k.typ==1 && (k.user.has_role?("fetuser")||k.user.has_role?("fetadmin"))) + if k.parent.nil? + can [:show,:index], Calendar + else + can [:show], Calendar, id: k.parent_id + end + end + + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can [:show,:index], Calendar + can [:edit, :update,:new,:create,:verwalten], Calendar + can [:edit, :update,:new,:create,:verwalten,:delete], Calentry + end + if( user.has_role?("fetadmin")) + can [:delete],Calendar + can [:delete],Calentry + can :doadmin, User + end + + if user.has_role?("fetadmin") + can :emails,User + end + + end+
Generated with the Darkfish + Rdoc Generator 2.
+ActionController::Base
+ ++# File app/controllers/application_controller.rb, line 29 +def after_sign_in_path_for(resource) + sign_in_url = new_user_session_path(:only_path => false, :protocol => 'http') + if request.referer == sign_in_url + super + else + stored_location_for(resource) || root_path + end +end+
+# File app/controllers/application_controller.rb, line 68 +def current_ability + @current_ability ||= Ability.new(current_user, request, params[:key]) +end+
+# File app/controllers/application_controller.rb, line 71 +def default_url_options + {locale: nil, theme: nil , ansicht: nil} # I18n.locale +end+
+# File app/controllers/application_controller.rb, line 58 + def get_theme +u=current_user + if ! u.try(:preferredtheme).nil? and ThemesForRails.available_theme_names.include?(u.preferredtheme) + u.preferredtheme + else + "blue2" + end + + end+
+# File app/controllers/application_controller.rb, line 8 +def set_i18n_locale_from_params + if params[:locale] + if I18n.available_locales.include?(params[:locale].to_sym) + session[:locale] = params[:locale] + else + flash.now[:notice]= "#{params[:locale]} translation not available" + logger.error flash.now[:notice] + end + end + http_header=request.env['HTTP_ACCEPT_LANGUAGE'] + unless http_header.nil? + ht= http_header.scan(/^de|en/).first + else + ht=nil + end + I18n.locale = session[:locale] || I18n.default_locale + # removed ht from selection add || ht to check http header + + session[:locale] = I18n.locale +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/helpers/application_helper.rb, line 126 +def absurl(path) + if path.nil? + return nil + end + url=URI(root_url) + url.path=path + return url +end+
+# File app/helpers/application_helper.rb, line 2 + def cache_array_key(array,prefix="") + return "empty_array" if array.nil? or array.empty? + prefix+array.map{|c| c.id}.join('_')+"_"+array.max{|c|c.updated_at.to_i}.updated_at.try(:utc).to_s+"_"+I18n.locale.to_s +# array.map{|c| c.id}.join('')+"_"+array.map{|c|c.try(:updated_at).try(:utc).to_s}.join('') +"_"+I18n.locale.to_s + + end+
+# File app/helpers/application_helper.rb, line 9 +def clean_calendar(cal) + cal.rubrik.meetingtyps.each do |mt| + mt.meetings.each do |m| + m.calentry.calendar=cal + end + end +end+
+# File app/helpers/application_helper.rb, line 24 + def convert_topic_to_meeting(t,mt) + m=Meeting.new_with_date_and_typ(t,t.title.to_date+16.hour,mt) + m.save + m.create_protocol + m.protocol.text=t.text + m.protocol.save + m.update_time_from_protocol +m.save + + t.meetings << m + t.save + end+
+# File app/helpers/application_helper.rb, line 36 +def current_url1(overwrite={}) + url_for :params => params.merge(overwrite).except(:controller,:action,:ansicht) +end+
+# File app/helpers/application_helper.rb, line 73 +def fa_list + y=YAML.load_file("#{::Rails.root.to_s}/config/fontawesome.yml") + y["fa"] +end+
+# File app/helpers/application_helper.rb, line 57 +def fa_stack(icon1, icon2) + h_1 = content_tag("span", content_tag("i","", class: "ficon "+" fa-"+icon1+" fa fa-stack-1x" ) + content_tag("i","", class: "ficon "+" fa-"+icon2+" fa fa-stack-2x" ),class: "fa-stack ") + + h_2 = content_tag("span", h_1 ,class: "fa-stack-sm") + + h_2 +end+
+# File app/helpers/application_helper.rb, line 53 +def ff_icon (name) + content_tag("i","", class: "ficon "+name ) +end+
+# File app/helpers/application_helper.rb, line 46 +def ffi1_icon (name) + content_tag("i", "", class: "ficon ffi1-" + name ) +end+
+# File app/helpers/application_helper.rb, line 64 +def ffi1_list + y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon1.yml") + y["ffi1"] +end+
+# File app/helpers/application_helper.rb, line 50 +def ffi2_icon (name) + content_tag("i","", class: "ficon ffi2-"+name ) +end+
+# File app/helpers/application_helper.rb, line 68 +def ffi2_list + y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon2.yml") + y["ffi2"] +end+
+# File app/helpers/application_helper.rb, line 135 + def get_theme_help(u) + +# if params[:theme]== "default" || params[:theme]=="2003" || params[:theme].nil? +# params[:theme]="blue1" +# end + if ! u.try(:preferredtheme).nil? and ThemesForRails.available_theme_names.include?(u.preferredtheme) + u.preferredtheme + else + "blue1" + end +end+
+# File app/helpers/application_helper.rb, line 161 +def li_tag(content) + content_tag("li", content) +end+
+# File app/helpers/application_helper.rb, line 146 +def like_dislike_for(obj) + out="" + if can?(:like, obj) + out += link_to ffi1_icon("like3")+" like" + "("+obj.get_likes.size.to_s+")", url_for([:like, obj]),title: "liked by " + ((current_user.liked?(obj)) ? ("you and " + ((obj.get_likes.size - 1).to_s + " others")) : obj.get_likes.size.to_s), remote: true + else + out += "liked by " + obj.get_likes.size.to_s + end + + if can?(:dislike, obj) + out += link_to ffi1_icon("dislike")+" dislike" + "("+obj.get_dislikes.size.to_s+")", url_for([:dislike, obj]),title:"disliked by " + ((current_user.disliked?(obj)) ? ("you and " + ((obj.get_dislikes.size - 1).to_s + " others")) : obj.get_dislikes.size.to_s) , remote: true + else + out += "disliked by " + obj.get_dislikes.size.to_s + end + raw(out) +end+
+# File app/helpers/application_helper.rb, line 164 +def meta_itemprop(itemprop, content) + tag("meta", itemprop: itemprop, content: content) +end+
+# File app/helpers/application_helper.rb, line 16 +def strip_control_chars(value) + value.chars.inject("") do |str, char| + unless char.ascii_only? && (char.ord < 32 || char.ord == 127) + str << char + end + str + end +end+
+# File app/helpers/application_helper.rb, line 41 + def switch_locale_url(target_locale) +# current_url1({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" + language_path(locale: target_locale) + end+
+# File app/helpers/application_helper.rb, line 79 +def tinymce_icon_choice + s="" + ffi1_list.each do |i| + s=s+'<a onclick="insertIcon_ffi1(\ffi1-'+i+'\)">'+ffi1_icon(i)+'</a>' + end + raw(s) +end+
+# File app/helpers/application_helper.rb, line 87 + def toolbar_html(elemente) + html = "" + limiter = " | " + elemente.each do |e| + if !e[:icon].nil? + case e[:icon] + when :pencil + text = '<i class="icon-pencil"></i>'.html_safe + e[:text] + when :plus + text ='<i class="icon-plus"></i>'.html_safe+e[:text] + else + text = e[:text] + end + else + text =e[:text] + end + if e[:link].nil? + if !e[:method].nil? + if !e[:confirm].nil? + html = html + link_to(text,e[:path],:confirm=>e[:confirm],:method=>e[:method]) + else + html = html + link_to(text,e[:path],:method => e[:method]) + end + else + if !e[:confirm].nil? + html=html + link_to(text,e[:path],:confirm=>e[:confirm]) + else + html= html + link_to(text,e[:path]) + end + + end + else + html = html + e[:link] + end + + html=html+limiter + end + raw(html) +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: attachments
+ +id :integer not null, primary key +name :string(255) +datei :string(255) +created_at :datetime not null +updated_at :datetime not null +thema_id :integer+ +
+# File app/models/attachment.rb, line 23 + def image? + +# data_ext = datei.file.extension.downcase +# %w(jpg png jpeg).include?(data_ext) + datei.image?(datei.file) + end+
+# File app/models/attachment.rb, line 33 +def to_jq_upload +{ + "id" => read_attribute(:id), + "title" => read_attribute(:title), + "description" => read_attribute(:desc), + "name" => read_attribute(:title), + "size" => datei.size, + "url" => datei.url, + "thumbnail_url" => datei.thumb.url, + "delete_type" => "DELETE" + } +end+
Generated with the Darkfish + Rdoc Generator 2.
+CarrierWave::Uploader::Base
+ +Override the filename of the uploaded files: Avoid using model.id or +version_name here, see uploader/store.rb for details. def filename
+ +"something.jpg" if original_filename+ +
end
+ + + ++# File app/uploaders/attachment_uploader.rb, line 90 +def extention + File.extname(full_filename(file.file)).downcase +end+
+# File app/uploaders/attachment_uploader.rb, line 35 +def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' +end+
+# File app/uploaders/attachment_uploader.rb, line 23 +def get_cover + manipulate! do |frame, index| + frame if index.zero? + end +end+
+# File app/uploaders/attachment_uploader.rb, line 97 +def image?(for_file) + %(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase) +end+
+# File app/uploaders/attachment_uploader.rb, line 93 + def pdf?(for_file) +# %w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase) + false + end+
include CarrierWave::RMagick include CarrierWave::MiniMagick
+ + + ++# File app/uploaders/attachment_uploader.rb, line 10 +def root + Rails.root.join 'public/' +end+
Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:
+ + + ++# File app/uploaders/attachment_uploader.rb, line 20 +def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /attachments POST /attachments.json
+ + + ++# File app/controllers/attachments_controller.rb, line 71 + def create + @attachment = Attachment.new(params[:attachment]) + @thema = Thema.find_by_id(params[:thema_id]) + # logger.info "gg" + @attachment.thema = @thema + @attachment.name=@attachment.datei.filename + @action="create" +# logger.info "sdf" + respond_to do |format| + if @attachment.save + format.html { + render :json => [@attachment.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + + # format.html { redirect_to @thema, notice: 'Attachment was successfully created.' } + format.json { render json: {files: [@attachment.to_jq_upload]}, status: :created, location: [@thema, @attachment]} + + else + format.html { render action: "new" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + + end + end + end+
DELETE /attachments/1 DELETE /attachments/1.json
+ + + ++# File app/controllers/attachments_controller.rb, line 119 +def destroy + @attachment = Attachment.find(params[:id]) + @attachment.destroy + @thema = Thema.find(params[:thema_id]) + + respond_to do |format| + format.html { redirect_to @thema } + format.json { head :no_content } + end +end+
GET /attachments/1/edit
+ + + ++# File app/controllers/attachments_controller.rb, line 64 +def edit + @attachment = Attachment.find(params[:id]) + @thema = @attachment.thema +end+
+# File app/controllers/attachments_controller.rb, line 5 + def index +# @attachments = Attachment.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @attachments } + end + end+
GET /attachments/new
+ + + ++# File app/controllers/attachments_controller.rb, line 51 +def new + @attachment = Attachment.new + @thema = Thema.find(params[:thema_id]) + @attachment.thema = @thema + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @attachment } + format.js + end +end+
GET refresh_list +refresh the attachment list for a parent object
+ + + ++# File app/controllers/attachments_controller.rb, line 35 +def refresh_list + @parent = params[:parent_type].constantize.find(params[:parent_id]) + @attachments=@parent.attachments + respond_to do |format| + format.js + end +end+
GET sets the titlepic flag for one attachment for one parent object
+ + + ++# File app/controllers/attachments_controller.rb, line 16 +def set_titlepic + @attachment = Attachment.find(params[:id]) + if @attachment.image? # if attachment is an Image set flag + @attachment.parent.attachments.update_all("flag_titlepic=0") + @attachment.flag_titlepic=true + @attachment.save + end + respond_to do |format| + format.html { + redirect_to @attachment} + format.js { + @parent=@attachment.parent + @attachments=@parent.attachments + render :refresh_list + } + end +end+
get /attachments/ID
+ + + ++# File app/controllers/attachments_controller.rb, line 43 +def show + @attachment = Attachment.find(params[:id]) + respond_to do |format| + format.html # show.html.erb + end +end+
PUT /attachments/1 PUT /attachments/1.json
+ + + ++# File app/controllers/attachments_controller.rb, line 100 +def update + @attachment = Attachment.find(params[:id]) + @parent= @attachment.parent + + respond_to do |format| + if @attachment.update_attributes(params[:attachment]) + format.html { redirect_to @parent, notice: 'Attachment was successfully updated.' } + format.json { head :no_content } + format.js {@attachment=Attachment.new; render action:"create"} + else + format.html { render action: "edit" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + format.js { render action: "new"} + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/helpers/attachments_helper.rb, line 3 +def render_attachments_for(p) + a= Attachment.new + a.parent=p + render(partial:"attachments/attachment_list", object: p.attachments, locals: {editor: (can?(:edit, p)), parent: p} )+ ((can?(:edit, p))? (render partial:"attachments/form_bulk2", object: a ): "") + +end+
+# File app/helpers/attachments_helper.rb, line 10 +def render_attachments_list_for(p) + a= Attachment.new + a.parent=p + render(partial:"attachments/attachment_list", object: p.attachments, locals: {editor: (can?(:edit, p)), parent: p} ) +end+
+# File app/helpers/attachments_helper.rb, line 16 +def render_new_attachments_for(p, text="", options={}) + a= Attachment.new + a.parent=p + ((can?(:edit, p))? (render partial:"attachments/form_bulk2", object: a ): "") +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: beispiele
+ +id :integer not null, primary key +name :string(255) +desc :text +lva_id :integer +created_at :datetime not null +updated_at :datetime not null +beispieldatei :string(255)+ +
+# File app/models/beispiel.rb, line 50 +def divid + "beispiel_"+id.to_s +end+
+# File app/models/beispiel.rb, line 38 + def to_jq_upload + { + "id" => read_attribute(:id), + "title" => read_attribute(:title), + "description" => read_attribute(:desc), + "name" => read_attribute(:title), + "size" => beispieldatei.size, + "url" => beispieldatei.url, + "thumbnail_url" => beispieldatei.thumb.url, + "delete_type" => "DELETE" + } +end+
Generated with the Darkfish + Rdoc Generator 2.
+CarrierWave::Uploader::Base
+ +Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:
+ + + ++# File app/uploaders/beispieldatei_uploader.rb, line 14 +def root + Rails.root.join 'public/' +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /beispiele POST /beispiele.json
+ + + ++# File app/controllers/beispiele_controller.rb, line 67 +def create + logger.info "Creating Beispiel..." + @lva = Lva.find_by_id(params[:lva_id]) + params.delete(:lva_id) + params[:beispiel][:flag_delete]=false + @beispiel = Beispiel.new(params[:beispiel]) + @beispiel.flag_delete=false + logger.info "New Beispiel: #{params.inspect}" + + @beispiel.name=@beispiel.beispieldatei.filename + logger.info "New Beispiel: #{@beispiel.attributes.inspect}" + + + respond_to do |format| + unless @lva.nil? + @beispiel.lva=@lva + @beispiel.datum=Time.now + if @beispiel.save + format.html { + render :json => [@beispiel.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + format.json { render json: {files: [@beispiel.to_jq_upload]}, status: :created, location: [@lva, @beispiel] } + # format.html { redirect_to @backlink, notice: 'Beispiel was successfully created.' } + # format.json { render json: @beispiel, status: :created, location: @beispiel } + else + format.html { render action: "new" } + format.json { render json: @beispiel.errors, status: :unprocessable_entity } + end + else + if @beispiel.update_attributes(params[:beispiel]) + @backlink = Lva.find(@beispiel.lva) + format.html { redirect_to @backlink, notice: 'Beispiel was successfully uploaded.'} + format.json { head :no_content } + else + format.html { render action: "new" } + format.json { render json: @beispiel.errors, status: :unprocessable_entity } + end + end + + + end +end+
DELETE /beispiele/1 DELETE /beispiele/1.json
+ + + ++# File app/controllers/beispiele_controller.rb, line 135 +def destroy + @beispiel = Beispiel.find(params[:id]) + @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) + @beispiel.destroy + + respond_to do |format| + format.html { redirect_to @backlink } + format.json { head :no_content } + end +end+
GET /beispiele/1/edit
+ + + ++# File app/controllers/beispiele_controller.rb, line 61 +def edit + @beispiel = Beispiel.find(params[:id]) +end+
+# File app/controllers/beispiele_controller.rb, line 7 + def index +# unless params[:lva_id].nil? +# @beispiele= Lva.find(params[:lva_id]).beispiele.accessible_by(current_ability, :show) +# else +# @beispiele = Beispiel.accessible_by(current_ability, :show) +# end +# respond_to do |format| +# format.html # index.html.erb +# format.json { render json: @beispiele } +# end + end+
GET /beispiele/new GET /beispiele/new.json
+ + + ++# File app/controllers/beispiele_controller.rb, line 32 +def new + @beispiel = Beispiel.new + @beispiel.lva = Lva.find_by_id(params[:lva_id]) + @beispiel.flag_delete=false + @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) + respond_to do |format| + format.html # new.html.erb + format.json { render json: @beispiel } + end +end+
+# File app/controllers/beispiele_controller.rb, line 43 +def set_lecturer + @beispiel = Beispiel.find(params[:id]) + @beispiel.lecturer = Lecturer.find(params[:beispiel][:lecturer_id]) + @beispiel.save + + if @beispiel.save + format.html { redirect_to @backlink, notice: 'Beispiel was successfully updated.' } + format.js {render text: "alert(\"updated\");"} + format.json { head :no_content } + else + format.html { render action: "edit" } + format.js + format.json { render json: @beispiel.errors, status: :unprocessable_entity } + end + + +end+
GET /beispiele/1 GET /beispiele/1.json
+ + + ++# File app/controllers/beispiele_controller.rb, line 21 +def show + # @lva = params([:lva]) unless params([:lva]).nil? + @beispiel = Beispiel.find(params[:id]) + respond_to do |format| + format.html { redirect_to lva_path(@beispiel.lva , show_comments: params[:show_comments])} + format.js + end +end+
PUT /beispiele/1 PUT /beispiele/1.json
+ + + ++# File app/controllers/beispiele_controller.rb, line 114 +def update + @beispiel = Beispiel.find(params[:id]) + @beispiel.name=@beispiel.beispieldatei.to_s.split('/').last + @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) + params[:beispiel].delete :beispieldatei + params[:beispiel].delete :beispieldatei_cache + @lva = @beispiel.lva + respond_to do |format| + if @beispiel.update_attributes(params[:beispiel]) + format.html { redirect_to @backlink, notice: 'Beispiel was successfully updated.' } + format.js {render action: "show"} + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @beispiel.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: calendars
+ +id :integer not null, primary key +name :string(255) +public :boolean +created_at :datetime not null +updated_at :datetime not null +picture :string(255)+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /calendars POST /calendars.json
+ + + ++# File app/controllers/calendars_controller.rb, line 50 +def create + @calendar = Calendar.new(params[:calendar]) + + respond_to do |format| + if @calendar.save + format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' } + format.json { render json: @calendar, status: :created, location: @calendar } + else + format.html { render action: "new" } + format.json { render json: @calendar.errors, status: :unprocessable_entity } + end + end +end+
DELETE /calendars/1 DELETE /calendars/1.json
+ + + ++# File app/controllers/calendars_controller.rb, line 82 +def destroy + @calendar = Calendar.find(params[:id]) + @calendar.destroy + + respond_to do |format| + format.html { redirect_to calendars_url } + format.json { head :no_content } + end +end+
GET /calendars/1/edit
+ + + ++# File app/controllers/calendars_controller.rb, line 39 +def edit + @calendar = Calendar.find(params[:id]) + respond_to do |format| + format.html # new.html.erb + format.js + end + +end+
+# File app/controllers/calendars_controller.rb, line 5 +def index + @calendars = Calendar.accessible_by(current_ability,:show) + @calentries =@calendars.map{|c| c.calentries }.flatten + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @calendars } + format.ics + end +end+
GET /calendars/new GET /calendars/new.json
+ + + ++# File app/controllers/calendars_controller.rb, line 30 +def new + @calendar = Calendar.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @calendar } + end +end+
GET /calendars/1 GET /calendars/1.json
+ + + ++# File app/controllers/calendars_controller.rb, line 18 +def show + @calendar = Calendar.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @calendar } + format.ics { render 'show.ics.erb'} + end +end+
PUT /calendars/1 PUT /calendars/1.json
+ + + ++# File app/controllers/calendars_controller.rb, line 66 +def update + @calendar = Calendar.find(params[:id]) + + respond_to do |format| + if @calendar.update_attributes(params[:calendar]) + format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @calendar.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+POST /calentries POST /calentries.json
+ + + ++# File app/controllers/calentries_controller.rb, line 49 + def create + @calentry = Calentry.new(params[:calentry]) + + respond_to do |format| + if @calentry.save + format.html { redirect_to @calentry, notice: 'Calentry was successfully created.' } + format.json { render json: @calentry, status: :created, location: @calentry } + format.js + else + format.html { render action: "new" } + format.json { render json: @calentry.errors, status: :unprocessable_entity } + format.js { render action: "new" } +end + end + end+
DELETE /calentries/1 DELETE /calentries/1.json
+ + + ++# File app/controllers/calentries_controller.rb, line 85 +def destroy + logger.info("-------------delete------------------") + @calentry = Calentry.find(params[:id]) + @calentry_id = params[:id] + @object=@calentry.object + @calentry.destroy + + respond_to do |format| + format.html { redirect_to @object} + format.json { head :no_content } + format.js + end +end+
GET /calentries/1/edit
+ + + ++# File app/controllers/calentries_controller.rb, line 39 +def edit + @calentry = Calentry.find(params[:id]) + respond_to do |format| + format.html + format.js + end +end+
+# File app/controllers/calentries_controller.rb, line 5 + def index + + + respond_to do |format| + format.html {redirect_to rubriken_path} + end +end+
GET /calentries/new GET /calentries/new.json
+ + + ++# File app/controllers/calentries_controller.rb, line 27 +def new + @calentry = Calentry.new + @calentry.object=params[:object_type].constantize.find(params[:object_id]) + @calentry.typ=1 + respond_to do |format| + format.html # new.html.erb + format.json { render json: @calentry } + format.js + end +end+
GET /calentries/1 GET /calentries/1.json
+ + + ++# File app/controllers/calentries_controller.rb, line 15 +def show + @calentry = Calentry.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @calentry } + format.ics { render 'show.ics.erb'} + end +end+
PUT /calentries/1 PUT /calentries/1.json
+ + + ++# File app/controllers/calentries_controller.rb, line 67 +def update + @calentry = Calentry.find(params[:id]) + + respond_to do |format| + if @calentry.update_attributes(params[:calentry]) + format.html { redirect_to @calentry, notice: 'Calentry was successfully updated.' } + format.json { head :no_content } + format.js + else + format.html { render action: "edit" } + format.json { render json: @calentry.errors, status: :unprocessable_entity } + format.js { render action: "edit"} + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: calentries
+ +id :integer not null, primary key +start :datetime +ende :datetime +summary :string(255) +typ :integer +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/calentry.rb, line 72 + def dauer +if self.ende.nil? && self.start.nil? +0 +else +self.ende = self.start if self.ende.nil? + (self.ende-self.start)/3600 +end + end+
+# File app/models/calentry.rb, line 80 +def dauer=(dauer) + self.ende=self.start+dauer.to_i.hours +end+
+# File app/models/calentry.rb, line 46 +def days_to_today + if self.is_ongoing? + 0 + else + if self.is_upcomming? + (self.start.to_date - Date.today).to_i.abs + elsif self.is_past? + (self.ende.to_date - Date.today).to_i.abs + end + end + +end+
+# File app/models/calentry.rb, line 58 +def get_public + self.calendar=self.object.calendar unless object.nil? || object.calendar.nil? + self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?) + true +end+
+# File app/models/calentry.rb, line 90 +def icon_text + ApplicationController.helpers.fa_icon("calendar 2x") + self.text +end+
+# File app/models/calentry.rb, line 40 +def is_ongoing? + (self.start < Time.now) && (Time.now < self.ende) +end+
+# File app/models/calentry.rb, line 43 +def is_past? + (Time.now > self.ende) +end+
+# File app/models/calentry.rb, line 37 +def is_upcomming? + self.start > Time.now +end+
+# File app/models/calentry.rb, line 83 +def name + unless self.object.nil? + self.object.title + else + summary + end +end+
+# File app/models/calentry.rb, line 63 +def s_time=(s_time) + start +end+
+# File app/models/calentry.rb, line 69 +def start1 + start.to_date +end+
+# File app/models/calentry.rb, line 66 +def start_time + start +end+
+# File app/models/calentry.rb, line 93 +def text + if self.start.nil? || self.ende.nil? + "error" + else + if (self.start.to_date - self.ende.to_date) < 1.day + format=:timeonly + else + format =:default + end + I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende, :format=>format) + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+FormtasticBootstrap::Inputs::CheckBoxesInput
+ ++# File app/inputs/checkbox_autocomplete_input.rb, line 14 +def controls_wrapper_html_options +super.merge(:class=> "datepicker date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker')) +end+
+# File app/inputs/checkbox_autocomplete_input.rb, line 6 +def html_options + super + #super.merge(:default => Date.today) +end+
+# File app/inputs/checkbox_autocomplete_input.rb, line 2 +def input_html_options + super + #super.merge(:class => "input-append date") +end+
+# File app/inputs/checkbox_autocomplete_input.rb, line 22 + def options + super +#d.merge(:class=>"datepicker") + #super.merge(:append_content=>'<span class="add-on input-append" + #super.merge(:append_content=>'<span class="add-on" ><i class="icon-th"></i></span>') + end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/comment.rb, line 20 +def self.build_for(set_commentable, user, text,attr={}) + c = new + raise "Tried to build comment for non commentable" unless set_commentable.try(:is_commentable?) + c.user=user + c.text=text + c.assign_attributes(attr) + + unless set_commentable.class.to_s == "Comment" + c.commentable=set_commentable + c.save + else + + c.commentable=set_commentable.commentable + c.save + c.move_to_child_of(set_commentable) + end + c +end+
+# File app/models/comment.rb, line 53 +def self.formid_for(c) + "comment_form_" + c.class.to_s.gsub(":","_") + "_" + c.id.to_s +end+
+# File app/models/comment.rb, line 50 +def formid + "comment_form_" + commentable_type.gsub(":","_") + "_" + commentable_id.to_s +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /comments POST /comments.json
+ + + ++# File app/controllers/comments_controller.rb, line 47 +def create + params_new= params[:comment].select {|i| !["commentable_id", "commentable_type"].include?(i)} + + c = params[:comment][:commentable_type].constantize.find(params[:comment][:commentable_id]) unless params[:comment][:commentable_type].nil? or params[:comment][:commentable_id].nil? + authorize! :comment, c + + @comment = Comment.build_for(c, current_user,"", params_new) + @commentable=c + if @comment.parent_object.class==Comment + @comments= @comment.parent_object.children + else + @comments=@comment.parent_object.comments.order(:created_at).roots.page(params[:page]).per(Comment::NUM[params[:commentable_type]]).reverse_order + end + respond_to do |format| + if @comment + format.js + else + format.js {render action:"new"} + end + end +end+
DELETE /comments/1 DELETE /comments/1.json
+ + + ++# File app/controllers/comments_controller.rb, line 86 +def destroy + @comment = Comment.find(params[:id]) + @commentable=@comment.commentable + @comment.destroy + @comments=@commentable.comments.order(:created_at).roots.page(params[:page]).per(Comment::NUM[params[:commentable_type]]).reverse_order + respond_to do |format| + format.js + end +end+
GET /comments/1/edit
+ + + ++# File app/controllers/comments_controller.rb, line 41 +def edit + @comment = Comment.find(params[:id]) +end+
+# File app/controllers/comments_controller.rb, line 16 + def hide + @commentable=params[:commentable_type].constantize.find(params[:commentable_id]) unless params[:commentable_type].nil? or params[:commentable_id].nil? + respond_to do |format| + format.js + end +end+
+# File app/controllers/comments_controller.rb, line 4 + def index + @commentable=params[:commentable_type].constantize.find(params[:commentable_id]) unless params[:commentable_type].nil? or params[:commentable_id].nil? +if @commentable.nil? + render status: 404 + else + @comments=@commentable.comments.order(:created_at).roots.accessible_by(current_ability, :show).page(params[:page]).per(Comment::NUM[params[:commentable_type]]).reverse_order + + respond_to do |format| + format.js + end +end + end+
+# File app/controllers/comments_controller.rb, line 29 +def new + + @comment = Comment.new + @comment.commentable=params[:commentable_type].constantize.find(params[:commentable_id]) unless params[:commentable_type].nil? or params[:commentable_id].nil? + authorize! :comment, @comment.commentable + + respond_to do |format| + format.js + end +end+
+# File app/controllers/comments_controller.rb, line 22 +def show + @comment = Comment.find(params[:id]) + respond_to do |format| + format.js + format.html {redirect_to @comment.commentable} + end +end+
PUT /comments/1 PUT /comments/1.json
+ + + ++# File app/controllers/comments_controller.rb, line 71 +def update + params[:comment].select! {|i| !["commentable_id", "commentable_type"].include?(i)} + @comment = Comment.find(params[:id]) + @comment.commentable=params[:comment][:commentable_type].constantize.find(params[:comment][:commentable_id]) unless params[:comment][:commentable_type].nil? or params[:comment][:commentable_id].nil? + respond_to do |format| + if @comment.update_attributes(params[:comment]) + format.html { redirect_to @comment.commentable, notice: 'Comment was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActionMailer::Base
+ +Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/crawler_controller.rb, line 31 +def do_crawl_news + Crawlobject.crawl_news(5) + Crawlobject.crawl_news(6) + redirect_to action: :index +end+
+# File app/controllers/crawler_controller.rb, line 3 +def index + authorize! :doadmin, User + + @crawlobjs=Crawlobject.where(:objtype=>5).order(:published_at).reverse_order + @crawlobjs_etit=Crawlobject.where(:objtype=>6).order(:published_at).reverse_order + +end+
+# File app/controllers/crawler_controller.rb, line 10 +def load_attachments + authorize! :doadmin, User + + c = Crawlobject.find(params[:id]) + if c.has_attachments? + c.load_attachments + end + respond_to do |format| + format.html {redirect_to c.something} + format.js + end +end+
+# File app/controllers/crawler_controller.rb, line 22 +def move_to_news + authorize! :doadmin, User + co=Crawlobject.find(params[:id]) + if co.objtype == 5 || co.objtype==6 + co.move_to_neuigkeit(User.find(Rails.configuration.crawlconfig[co.objtype]["user_id"]), Rubrik.find(Rails.configuration.crawlconfig[co.objtype]["rubrik_id"])) + redirect_to co.something + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/crawlobject.rb, line 7 +def self.config + Rails.application.config.crawlconfig +end+
+# File app/models/crawlobject.rb, line 122 +def self.crawl_news(id) + cfg = Rails.application.config + res = JSON.parse(`python #{Rails.root}/bin/#{cfg.crawlconfig[id]['bin']} #{cfg.crawlconfig[id]['url']}`) + res.each do |r| + cc=Crawlobject.new(:raw=>r.to_json) + cc.objtype=id + cc.parse_object + cc.calc_hash + if Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>id).count==0 + cc.save + else + cc = Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>id).first + cc.raw=r.to_json + cc.parse_object + cc.calc_hash + cc.save + end + end +end+
+# File app/models/crawlobject.rb, line 114 +def calc_hash + self.objhash=Digest::SHA512.hexdigest(self.raw) + self.objhash2=Digest::SHA512.hexdigest(self.url.to_s+self.try(:name).to_s+self.schematype.to_s+self.published_at.try(:utc).to_s) + +end+
+# File app/models/crawlobject.rb, line 10 +def has_attachments? +if self.objtype==2 + return true +else + return false +end +end+
+# File app/models/crawlobject.rb, line 119 +def json + JSON.parse(self.raw) +end+
+# File app/models/crawlobject.rb, line 65 +def load_attachments + if self.objtype == 2 # ET Comments only + self.json["attachments"].each do |url| + fn = `python ../microdata/download_file.py "#{url}"` + + unless self.attachments.where(:name=>"Et_21.01.2015_L_sung.pdf").count > 0 + + a=Attachment.new + a.datei=File.open("/home/andreas/www/microdata/tmp/"+fn.strip) + a.name=fn.strip + a.parent=self + a.save + self.attachments<< a + a.save + end + end + end +end+
+# File app/models/crawlobject.rb, line 17 +def move_to_neuigkeit(user,rubrik) + if ( self.objtype == 5 || self.objtype == 6 )and self.something.nil? + n=Neuigkeit.new + n.title=self.name + n.text=self.text + n.datum=self.published_at + n.author=user + n.rubrik=rubrik + n.origurl = self.url + n.save + self.something=n + self.save + return n + elsif ( self.objtype == 5 || self.objtype==6) + n=self.something + n.title=self.name + n.text=self.text + n.datum=self.published_at + n.author=user + n.rubrik=rubrik + n.origurl = self.url + n.save + + end +end+
+# File app/models/crawlobject.rb, line 42 +def parse_children + if self.objtype == 1 # ET Forum Article loaded + self.json["comments"].each do |com| + if self.children.where(:objhash=>Digest::SHA512.hexdigest(com.to_json)).empty? + cco = self.children.new(:raw=>com.to_json,:crawlurl=>self.crawlurl) + cco.objtype=2 + cco.parse_object + cco.calc_hash + + if self.children.where(:objhash2=>cco.objhash2).empty? + cco.save + else + cco=self.children.where(:objhash2=>cco.objhash2).first + cco.raw=com.to_json + cco.parse_object + cco.calc_hash + cco.save + end + end + end + end +end+
+# File app/models/crawlobject.rb, line 83 +def parse_object + + if self.objtype == 1 # ET Forum Article loaded + # ET - Forum + self.schematype = self.json["type"].first + self.name = self.json["properties"]["name"].first + self.url = self.json["properties"]["url"].first + self.published_at = self.json["properties"]["dateCreated"].first + + end + if self.objtype == 2 # ET Forum Comment loaded is part of Article + self.schematype = self.json["type"].first + self.url = self.json["properties"]["replyToUrl"].first + self.name = self.json["properties"]["name"].try(:first) + self.published_at = self.json["properties"]["commentTime"].try(:first) + self.text = self.json["properties"]["commentText"].try(:first) + end + if self.objtype==5 + self.name=self.json["name"].strip + self.text=self.json["text"] + self.published_at=Time.parse(self.json["date"].strip) + self.url="http://www.htu.at" + end + if self.objtype==6 + self.name=self.json["name"].strip + self.text=self.json["text"] + self.published_at=Time.parse(self.json["date"].strip) + self.url="http://etit.tuwien.ac.at" + end + +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+FormtasticBootstrap::Inputs::StringInput
+ ++# File app/inputs/date_string_input.rb, line 2 +def input_html_options + value = (@object.send(method.to_sym)) + super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l((value.is_a?(Time)||value.is_a?(Date)||value.is_a?(DateTime)) ? value : Time.now)) +end+
Generated with the Darkfish + Rdoc Generator 2.
+FormtasticBootstrap::Inputs::StringInput
+ ++# File app/inputs/datepicker_input.rb, line 14 +def controls_wrapper_html_options +super.merge(:class=> "datepicker date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker')) +end+
+# File app/inputs/datepicker_input.rb, line 6 +def html_options + super + #super.merge(:default => Date.today) +end+
+# File app/inputs/datepicker_input.rb, line 2 +def input_html_options + super + #super.merge(:class => "input-append date") +end+
+# File app/inputs/datepicker_input.rb, line 23 + def options + super +#d.merge(:class=>"datepicker") + #super.merge(:append_content=>'<span class="add-on input-append" + #super.merge(:append_content=>'<span class="add-on" ><i class="icon-th"></i></span>') + end+
Generated with the Darkfish + Rdoc Generator 2.
+FormtasticBootstrap::Inputs::StringInput
+ ++# File app/inputs/datetimepicker_input.rb, line 17 +def controls_wrapper_html_options +super.merge(:class=> " date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker')) +end+
+# File app/inputs/datetimepicker_input.rb, line 9 +def html_options + super + +end+
+# File app/inputs/datetimepicker_input.rb, line 2 +def input_html_options + s=super + value=builder.object.send(method) + value=I18n.l(value) unless value.nil? + super.merge(:class => "datetimepicker",:value=>value) +end+
+# File app/inputs/datetimepicker_input.rb, line 26 + def options + super +#d.merge(:class=>"datepicker") + #super.merge(:append_content=>'<span class="add-on input-append" + #super.merge(:append_content=>'<span class="add-on" ><i class="icon-th"></i></span>') + end+
+# File app/inputs/datetimepicker_input.rb, line 20 +def to_html + bootstrap_wrapping do + builder.text_field(method, input_html_options) + + '<span class="add-on" ><i class="icon-th"></i></span>'.html_safe() +end +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/document.rb, line 29 + def create_pdf + require "open3" + + #url=blank_document_url({id: self.id, host: host, port: port}) + # url=Rails.application.routes.url_helpers.blank_document_url({id: self.id, host: host, port: port}) + + file = Tempfile.new(['document', '.pdf']) + bin=Rails.application.config.pdf_bin + sin,sout,serr=Open3.popen3("#{bin} --header-html \"file://#{Rails.root}/app/views/documents/header.html\" --footer-html \"file://#{Rails.root}/app/views/documents/footer.html\" --replace title1 \"#{self.name}\" - #{file.path}") +#Rails.logger.puts("#{bin} --header-html \"file://#{Rails.root}/app/views/documents/header.html\" --footer-html \"file://#{Rails.root}/app/views/documents/footer.html\" --replace title1 \"#{self.name}\" \"#{url}\" \"#{file.path}\" ") +# `#{bin} --header-html "file://#{Rails.root}/app/views/documents/header.html" --footer-html "file://#{Rails.root}/app/views/documents/footer.html" --replace title1 "#{self.name}" #{url} #{file.path} ` + sin.puts("<h1>#{self.name}</h1>") + t=self.text + t.gsub!(/src="[\.\/]*(uploads[^"]*)"/){|s| "src=\"#{Rails.root}/public/"+$1.to_s+'"'} + sin.puts(t) + sin.close + Rails.logger.puts(serr.read) + file + end+
+# File app/models/document.rb, line 23 +def divid + "document_"+self.id.to_s +end+
+# File app/models/document.rb, line 82 +def dump_to_etherpad + if self.is_etherpad? + if self.text.nil? + self.ep_pad.html = '<div>'+"text"+'</div>' + else + self.ep_pad.html = '<div>'+self.text+'</div>' + end + else + self.move_to_etherpad + end +end+
+# File app/models/document.rb, line 100 +def ep_group + t= (self.typ.nil? || self.typ ==0) ? 1 : self.typ + Document.ether.group(Document::TYPS[t]) +end+
+# File app/models/document.rb, line 97 +def ep_pad + self.ep_group.pad(self.etherpadkey) +end+
+# File app/models/document.rb, line 62 +def ether + if @ep.nil? + @ep=Document.ether + end + @ep +end+
+# File app/models/document.rb, line 68 +def is_etherpad? + !(etherpadkey.nil? || etherpadkey.empty?) +end+
+# File app/models/document.rb, line 13 +def long_name + if self.parent.class=="Meeting" + "<b>"+self.parent.text+ "</b>"+ self.name + else + "<b>" + self.parent.title + ":</b>"+ self.name + end +end+
+# File app/models/document.rb, line 117 +def maketoc + require "open3" + require "json" + sin,sout,serr=Open3.popen3("python #{Rails.root}/bin/maketoc.py") + sin.puts(self.text) + sin.close + b=sout.read() + c=JSON.parse(b) + l=2 + f=true; + s="<ul>" + c.each do |h| + s=s+ "</li></ul></li>"*(l-h["level"]) if (h["level"]<l) and !f + s=s+" </li>" if (h["level"]==l) and !f + if (h["level"]>l) + s=s + "<ul><li>" * (h["level"]-l) + else + s=s+"<li>" + end + s=s+h["text"] + + l = h["level"] + f=false + end + s=s+"</ul>"*(l-2) if (l>2) + s=s+"</ul>" + self.toc=s +end+
+# File app/models/document.rb, line 71 +def move_to_etherpad + unless self.is_etherpad? || self.id.nil? + self.etherpadkey="document_"+ self.id.to_s + + if self.text.nil? + self.ep_pad.html = '<div>'+"text"+'</div>' + else + self.ep_pad.html = '<div>'+self.text+'</div>' + end + end +end+
+# File app/models/document.rb, line 93 +def read_from_etherpad + self.text=ApplicationController.helpers.strip_control_chars( self.ep_pad.html) + +end+
+# File app/models/document.rb, line 48 +def sanitize + trans_icons= lambda do |env| + node=env[:node] + node_name=env[:node_name] + return if env[:is_whitelisted] || !node.element? + return unless node_name == 'span' + # return unless node["class"] =~ /.*ffi.*/ + Sanitize.node!(node,{:elements=>["span"],:attributes=>{"span"=>["class","style"]},:css=>{:properties=>["color"]}}) + {:node_whitelist=>[node]} + end + self.text = Sanitize.fragment(self.text, {:elements=>['table','tr','td','p','h1','h2','h3','h4','h5','a','th','img','ul','li','i','b','em','pre','code'],:attributes=>{'p'=>['class'],'table'=>['class'],'a'=>['href','data'],'img'=>['src','width','height'],:all=>['class']},:css=>{:properties=>['float']},:transformers=>[trans_icons]}) + +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/documents_controller.rb, line 102 +def create + @document = Document.new(params[:document]) + + @parent=@document.parent + + respond_to do |format| + if @document.save + # format.html { redirect_to @document, notice: 'Document was successfully created.' } + #format.json { render json: @document, status: :created, location: @document } + format.js + else + # format.html { render action: "new" } + # format.json { render json: @document.errors, status: :unprocessable_entity } + format.js { render action: "new" } + end + end +end+
+# File app/controllers/documents_controller.rb, line 137 +def destroy + logger.info("-------------delete------------------") + @document = Document.find(params[:id]) + + @parent=@document.parent + + @document_id = params[:id] + + @document.destroy + + respond_to do |format| + #format.html { redirect_to @object} + #format.json { head :no_content } + format.js + end +end+
+# File app/controllers/documents_controller.rb, line 41 + def dump_to_etherpad + @document = Document.find(params[:id]) + @document.dump_to_etherpad +@document.save +# author = ether.author('author_1') +# pad=group.pad(@document.etherpadkey) +# pad.html='<div>'+@document.text+'</div>' + redirect_to action: :show + end+
+# File app/controllers/documents_controller.rb, line 19 +def edit + @document = Document.find(params[:id]) + @parent=@document.parent + respond_to do |format| + format.js + format.html + end +end+
+# File app/controllers/documents_controller.rb, line 4 +def index + respond_to do |format| + format.html {redirect_to rubriken_path} + end +end+
+# File app/controllers/documents_controller.rb, line 9 +def new + @document=Document.new + @parent=params[:parent_type].constantize.find(params[:parent_id]) + @document.parent=@parent + + @document.typ = 1 + respond_to do |format| + format.js + end +end+
+# File app/controllers/documents_controller.rb, line 50 +def read_from_etherpad + @document = Document.find(params[:id]) + @document.read_from_etherpad + @document.save + render :show +end+
+# File app/controllers/documents_controller.rb, line 27 +def sanitize + @document = Document.find(params[:id]) + @document.sanitize + @parent=@document.parent + render :edit +end+
+# File app/controllers/documents_controller.rb, line 154 +def search + + unless params['query'].nil? || params['query'].empty? + @results = Document.search do + fulltext params['query'] do + fields :name, :text, :meeting + highlight :text,:name,:meeting + end + end + @res=[] + @results.results.each do |r| + @res << r if can?(:show,r) + end + end + respond_to do |format| + format.html { redirect_to action: :intern} + format.js + end +end+
+# File app/controllers/documents_controller.rb, line 33 +def show + @document = Document.find(params[:id]) + respond_to do |format| + format.pdf { send_file @document.create_pdf.path } + format.html + end +end+
+# File app/controllers/documents_controller.rb, line 121 +def update + @document = Document.find(params[:id]) + @parent=@document.parent + + respond_to do |format| + if @document.update_attributes(params[:document]) + format.html { redirect_to @document, notice: 'Document was successfully updated.' } + format.json { head :no_content } + format.js + else + # format.html { render action: "edit" } + # format.json { render json: @document.errors, status: :unprocessable_entity } + format.js { render action: "edit"} + end + end +end+
+# File app/controllers/documents_controller.rb, line 82 +def write + @document = Document.find(params[:id]) + if @document.is_etherpad? && params[:versionid].nil? + redirect_to action: :write_etherpad + else + unless params[:versionid].nil? + v=@document.versions.find(params[:versionid]) + if v.reify.nil? + v=v.next + end + @document=v.reify + + end + @parent=@document.parent + respond_to do |format| + format.html {render :edit} + end + end +end+
+# File app/controllers/documents_controller.rb, line 57 + def write_etherpad + @document = Document.find(params[:id]) + + ether=Document.ether + author = Document.ether.author("fetsite_"+current_user.uid, :name => current_user.text) + session[:ep_sessions]={} if session[:ep_sessions].nil? + group=@document.ep_group + + sess = session[:ep_sessions][group.id] ? ether.get_session(session[:ep_sessions][group.id]) : group.create_session(author, 300) + + if sess.expired? + sess.delete + sess = group.create_session(author, 300) + end + session[:ep_sessions][group.id] = sess.id + # Set the EtherpadLite session cookie. This will automatically be picked up by the jQuery plugin's iframe. + + cookies[:sessionID] = {value: sess.id.to_s, domain: %(.fet.at), expires: 5.hour.from_now} + #cookies[:sessionID] = {:value => sess.id} + cookies[:sessionID]= {value: sess.id, expires: 5.hour.from_now} +# cookies[:sdf]=sess.id + # pad=ether.pad(@document.etherpadkey) + # redirect_to "http://www.fet.at/etherpad/p/"+@document.ep_pad.id + #render :write + end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/emails_controller.rb, line 7 + def daily_reminder + ActionMailer::Base.default_url_options[:host] = request.host_with_port + @mail =NewsMailer.daily_reminder(current_user.id) + if params[:send] + usr=User.where(:flag_getemails => true) + usr.each do |u| + NewsMailer.daily_reminder(current_user.id).deliver + end + end + render layout: false +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: fetprofiles
+ +id :integer not null, primary key +vorname :string(255) +nachname :string(255) +short :string(255) +fetmailalias :string(255) +desc :text +picture :string(255) +active :boolean +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/fetprofile.rb, line 58 +def adress + connector= (self.street.nil?||self.street.empty?||(self.city.empty? && self.plz.empty?)) ? '' : ', ' + self.plz.to_s + ' ' + self.city.to_s + connector.to_s + self.street.to_s +end+
+# File app/models/fetprofile.rb, line 62 +def birthday + unless self.birth_month.nil? || self.birth_day.nil? + if self.birth_year.nil? || self.birth_year.zero? + Date.new( Date.today.year,self.birth_month,self.birth_day) + else + Date.new( self.birth_year,self.birth_month,self.birth_day) + end + else + nil + end +end+
+# File app/models/fetprofile.rb, line 55 +def fetmail + (fetmailalias.nil? || fetmailalias.empty?) ? short.to_s + "@fet.at" : fetmailalias.to_s + "@fet.at" +end+
+# File app/models/fetprofile.rb, line 51 +def name + [vorname, nachname, ((short.empty?)? "": ["(",short,")"].join)].join(" ") +end+
+# File app/models/fetprofile.rb, line 48 +def title + self.name +end+
+# File app/models/fetprofile.rb, line 33 +def validate_birthday + unless birth_month.nil? || birth_day.nil? + unless Date.valid_date?((birth_year.nil?) ? Date.today.year : birth_year, birth_month, birth_day) + errors.add(:birth_month, "Invalides Datum") + errors.add(:birth_day, "Invalides Datum") + v= false + else + v= true + end + else + v= false + end + v +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /fetprofiles POST /fetprofiles.json
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 67 +def create + @fetprofile = Fetprofile.new(params[:fetprofile]) + @memberships=@fetprofile.memberships.order(:typ) + @memberships<< Membership.new + + respond_to do |format| + if @fetprofile.save + format.html { redirect_to @fetprofile, notice: 'Fetprofile was successfully created.' } + format.json { render json: @fetprofile, status: :created, location: @fetprofile } + else + format.html { render action: "new" } + format.json { render json: @fetprofile.errors, status: :unprocessable_entity } + end + end +end+
DELETE /fetprofiles/1 DELETE /fetprofiles/1.json
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 116 +def destroy + @fetprofile = Fetprofile.find(params[:id]) + @fetprofile.destroy + + respond_to do |format| + format.html { redirect_to fetprofiles_url } + format.json { head :no_content } + end +end+
GET /fetprofiles/1/edit
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 59 +def edit + @fetprofile = Fetprofile.find(params[:id]) + @memberships=@fetprofile.memberships.order(:typ) + @memberships<< Membership.new +end+
+# File app/controllers/fetprofiles_controller.rb, line 6 +def index + + @fetprofiles = Fetprofile.active.order(:vorname,:nachname) + @fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all" + @fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive" + + @gremientabs = Gremium.tabs + @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile + + respond_to do |format| + format.html # index.html.erb + end +end+
+# File app/controllers/fetprofiles_controller.rb, line 20 +def internlist + @fetprofiles = Fetprofile.order(:vorname,:nachname) +end+
GET /fetprofiles/new GET /fetprofiles/new.json
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 47 +def new + @fetprofile = Fetprofile.new + @memberships=[] + @memberships<< Membership.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @fetprofile } + end +end+
GET /fetprofiles/1 GET /fetprofiles/1.json
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 26 +def show + @fetprofile = Fetprofile.find(params[:id]) + @gremientabs = Gremium.tabs + @memberships=@fetprofile.memberships.order(:typ) + + + + + @toolbar_elements << {:hicon=>'icon-pencil', :text=> I18n.t('common.edit'),:path => edit_fetprofile_path(@fetprofile) } if can? :edit, @fetprofile + + @toolbar_elements << {:hicon=>'icon-minus', :text => I18n.t('common.delete'), :method=>:delete, :confirm=>"Sure"} if can? :destroy,@fetprofile + + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @fetprofile } + end +end+
PUT /fetprofiles/1 PUT /fetprofiles/1.json
+ + + ++# File app/controllers/fetprofiles_controller.rb, line 85 +def update + @fetprofile = Fetprofile.find(params[:id]) + + + + respond_to do |format| + if @fetprofile.update_attributes(params[:fetprofile]) + format.html { + unless params[:button]=="continue" || params[:commit]=="continue" + + redirect_to @fetprofile, notice: 'profile was successfully updated.' + else + @memberships=@fetprofile.memberships.order(:typ) + @memberships<< Membership.new + @memberships<< Membership.new + @memberships<< Membership.new + render action: "edit", notice: 'profile was successfully updated.' + end + } + format.json { head :no_content } + else + @memberships=@fetprofile.memberships.order(:typ) + @memberships<< Membership.new + format.html { render action: "edit" } + format.json { render json: @fetprofile.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: fetzneditions
+ +id :integer not null, primary key +title :string(255) +desc :text +datum :date +datei :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /fetzneditions POST /fetzneditions.json
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 43 +def create + @fetznedition = Fetznedition.new(params[:fetznedition]) + + respond_to do |format| + if @fetznedition.save + format.html { redirect_to @fetznedition, notice: 'Fetznedition was successfully created.' } + format.json { render json: @fetznedition, status: :created, location: @fetznedition } + else + format.html { render action: "new" } + format.json { render json: @fetznedition.errors, status: :unprocessable_entity } + end + end +end+
DELETE /fetzneditions/1 DELETE /fetzneditions/1.json
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 75 +def destroy + @fetznedition = Fetznedition.find(params[:id]) + @fetznedition.destroy + + respond_to do |format| + format.html { redirect_to fetzneditions_url } + format.json { head :no_content } + end +end+
GET /fetzneditions/1/edit
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 37 +def edit + @fetznedition = Fetznedition.find(params[:id]) +end+
+# File app/controllers/fetzneditions_controller.rb, line 5 +def index + @fetzneditions = Fetznedition.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @fetzneditions } + end +end+
GET /fetzneditions/new GET /fetzneditions/new.json
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 27 +def new + @fetznedition = Fetznedition.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @fetznedition } + end +end+
GET /fetzneditions/1 GET /fetzneditions/1.json
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 16 +def show + @fetznedition = Fetznedition.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @fetznedition } + end +end+
PUT /fetzneditions/1 PUT /fetzneditions/1.json
+ + + ++# File app/controllers/fetzneditions_controller.rb, line 59 +def update + @fetznedition = Fetznedition.find(params[:id]) + + respond_to do |format| + if @fetznedition.update_attributes(params[:fetznedition]) + format.html { redirect_to @fetznedition, notice: 'Fetznedition was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @fetznedition.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
++# File lib/flagable.rb, line 8 +def acts_as_flagable(options={}) + include Flagable::ActsAsFlagableController::LocalInstanceMethods + extend Flagable::ActsAsFlagableController::LocalClassMethods +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
++# File lib/flagable.rb, line 18 +def flag + fi = controller_path.classify.constantize::FLAG_ICONS + + @obj=controller_path.classify.constantize.find(params[:id]) + lflag=("flag_"+params[:flag]).to_sym + authorize! lflag, @obj + unless params[:flag].nil? || params[:flag].empty? || params[:value].nil? + if @obj.respond_to?(lflag.to_s+"=") + @obj.send(lflag.to_s+"=",params[:value]=="true") + @obj.save + end + end + respond_to do |format| + format.html {render partial: "flags/flaglink", locals: {flag: params[:flag],icon: fi[params[:flag]]}} + format.js {render partial: "flags/flag", locals: {flag: params[:flag], icon: fi[params[:flag]]}} + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
++# File lib/flagable.rb, line 62 +def flag_link(obj, flag, text="") + flag=flag.to_s + fi = obj.class::FLAG_ICONS + fc = obj.class::FLAG_CONFIRM + value=obj.send("flag_"+flag) + cstyle=(value) ? "true" :"false" + cfm = (fc.nil? || fc["flag_"+flag].nil?) ? {} : {confirm: fc["flag_"+flag]} + link_to ff_icon(fi[flag]), url_for({controller: obj.class.name.tableize,action: :flag, flag: flag, value: !value, theme: nil, locale: nil, id: obj.id}), remote: true, class: ("flag-"+cstyle +" flag-"+flag + "-"+cstyle ), id: obj.flaglinkid(flag), data: cfm +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: fotos
+ +id :integer not null, primary key +title :string(255) +desc :text +gallery_id :integer +datei :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/foto.rb, line 32 +def parse_exif + unless self.exif.nil? || self.exif.empty? + j=JSON.parse(self.exif) + datetime = j.select {|i| i.first == "DateTime"}.try(:first).try(:last) + self.taken_at=Time.new(datetime) unless datetime.nil? + end +end+
+# File app/models/foto.rb, line 20 + def to_jq_upload +{ + "id" => read_attribute(:id), + "title" => read_attribute(:title), + "description" => read_attribute(:desc), + "name" => read_attribute(:title), + "size" => datei.size, + "url" => datei.url, + "thumbnail_url" => datei.thumb.url, + "delete_type" => "DELETE" + } +end+
Generated with the Darkfish + Rdoc Generator 2.
+CarrierWave::Uploader::Base
+ +Add a white list of extensions which are allowed to be uploaded. For images +you might use something like this:
+ + + ++# File app/uploaders/foto_uploader.rb, line 57 +def extension_white_list + %(jpg jpeg gif png) +end+
Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:
+ + + ++# File app/uploaders/foto_uploader.rb, line 14 +def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" +end+
Override the filename of the uploaded files: Avoid using model.id or +version_name here, see uploader/store.rb for details. def filename
+ +"something.jpg" if original_filename+ +
end
+ + + ++# File app/uploaders/foto_uploader.rb, line 67 +def store_exif + img = Magick::Image.read(current_path) + model.exif=img.first.get_exif_by_entry().to_json + +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /fotos POST /fotos.json
+ + + ++# File app/controllers/fotos_controller.rb, line 60 +def create + @foto = Foto.new(params[:foto]) + @foto.gallery_id = (params[:gallery_id]) + @gallery = @foto.gallery + respond_to do |format| + @foto.title = @foto.datei.filename + if @foto.save + format.html { + render :json => [@foto.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + format.json { render json: {files: [@foto.to_jq_upload]}, status: :created, location: [@gallery, @foto] } + else + format.html { render action: "new" } + format.json { render json: @foto.errors, status: :unprocessable_entity } + end + end +end+
DELETE /fotos/1 DELETE /fotos/1.json
+ + + ++# File app/controllers/fotos_controller.rb, line 102 +def destroy + @foto = Foto.find(params[:id]) + gallery = @foto.gallery_id + @foto.destroy + + respond_to do |format| + format.html { redirect_to gallery_path(gallery) } + format.json { head :no_content } + end +end+
GET /fotos/1/edit
+ + + ++# File app/controllers/fotos_controller.rb, line 54 +def edit + @foto = Foto.find(params[:id]) +end+
GET /fotos GET /fotos.json
+ + + ++# File app/controllers/fotos_controller.rb, line 6 +def index + @fotos = Foto.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @fotos } + end +end+
GET /fotos/new GET /fotos/new.json
+ + + ++# File app/controllers/fotos_controller.rb, line 41 +def new + @foto = Foto.new + @gallery = Gallery.find_by_id(params[:gallery_id]) + @foto.gallery_id = @gallery.id + @toolbar_elements << {:hicon => 'icon-arrow-left', :text => I18n.t('common.back'), :path => gallery_path(params[:gallery_id]) } + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @foto } + end +end+
GET /fotos/1 GET /fotos/1.json
+ + + ++# File app/controllers/fotos_controller.rb, line 17 +def show + @foto = Foto.find(params[:id]) + @gallery=@foto.gallery + @openfotoid=@foto.id + @pppage=params[:pppage].to_i % 4 + @pppage_array = [ 25 , 50 , 100, 10000] + @page = params[:page].nil? ? 1 : params[:page].to_i + + @fotos_p = @gallery.fotos.page(@page).per(@pppage_array[@pppage]) + @fotos_n = @gallery.fotos- @fotos_p + respond_to do |format| + format.html { + if params[:plain] + render "show", layout: false + else + render "galleries/show" #controller: :galleries, action: :show #gallery_path(@foto.gallery,:params=>{fotoid: @foto.id}) + end + } + format.json { render json: @foto } + end +end+
PUT /fotos/1 PUT /fotos/1.json
+ + + ++# File app/controllers/fotos_controller.rb, line 82 +def update + @foto = Foto.find(params[:id]) + + respond_to do |format| + if @foto.update_attributes(params[:foto]) + format.html { + render :json => [@foto.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + format.json { render json: {files: [@foto.to_jq_upload]}, status: :created, location: [@gallery, @foto] } + else + format.html { render action: "edit" } + format.json { render json: @foto.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: fragen
+ +id :integer not null, primary key +title :string(255) +text :text +created_at :datetime not null +updated_at :datetime not null +thema_id :integer+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /fragen POST /fragen.json
+ + + ++# File app/controllers/fragen_controller.rb, line 49 +def create + @frage = Frage.new(params[:frage]) + thema=@frage.thema + @fragen=@frage.thema.fragen + respond_to do |format| + if @frage.save + format.html { redirect_to @frage.thema, notice: 'Frage was successfully created.' } + format.json { render json: @frage, status: :created, location: @frage } + format.js {@frage=Frage.new ; @frage.thema=thema} + else + format.html { render action: "new" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + format.js + end + end +end+
DELETE /fragen/1 DELETE /fragen/1.json
+ + + ++# File app/controllers/fragen_controller.rb, line 86 +def destroy + @frage = Frage.find(params[:id]) + @thema=@frage.thema + @frage.destroy + + respond_to do |format| + format.html { redirect_to @frage.thema } + format.json { head :no_content } + format.js { + @fragen=@thema.fragen + render :create + } + end +end+
GET /fragen/1/edit
+ + + ++# File app/controllers/fragen_controller.rb, line 39 +def edit + @frage = Frage.find(params[:id]) + respond_to do |format| + format.html + format.js {render action: :new} + end +end+
+# File app/controllers/fragen_controller.rb, line 6 +def index + @fragen = Frage.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @fragen } + end +end+
GET /fragen/new GET /fragen/new.json
+ + + ++# File app/controllers/fragen_controller.rb, line 28 +def new + @frage = Frage.new + + respond_to do |format| + format.html + format.json { render json: @frage } + format.js + end +end+
GET /fragen/1 GET /fragen/1.json
+ + + ++# File app/controllers/fragen_controller.rb, line 17 +def show + @frage = Frage.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @frage } + end +end+
PUT /fragen/1 PUT /fragen/1.json
+ + + ++# File app/controllers/fragen_controller.rb, line 68 +def update + @frage = Frage.find(params[:id]) + + respond_to do |format| + if @frage.update_attributes(params[:frage]) + format.html { redirect_to @frage, notice: 'Frage was successfully updated.' } + format.json { head :no_content } + format.js {@frage=Frage.new; render action: "new"} + else + format.html { render action: "edit" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + format.js {render action: "edit"} + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+POST /galleries POST /galleries.json
+ + + ++# File app/controllers/galleries_controller.rb, line 96 +def create + @gallery = Gallery.new(params[:gallery]) + @foto = Foto.new + respond_to do |format| + if @gallery.save + format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' } + format.json { render json: @gallery, status: :created, location: @gallery } + else + format.html { render action: "new" } + format.json { render json: @gallery.errors, status: :unprocessable_entity } + end + end +end+
DELETE /galleries/1 DELETE /galleries/1.json
+ + + ++# File app/controllers/galleries_controller.rb, line 132 +def destroy + @gallery = Gallery.find(params[:id]) + @gallery.destroy + + respond_to do |format| + format.html { redirect_to galleries_url } + format.json { head :no_content } + end +end+
GET /galleries/1/edit
+ + + ++# File app/controllers/galleries_controller.rb, line 89 +def edit + @gallery = Gallery.find(params[:id]) + @fotos_old = @gallery.fotos +end+
GET /galleries GET /galleries.json
+ + + ++# File app/controllers/galleries_controller.rb, line 7 +def index + @galleries = Gallery.all + @toolbar_elements << {:hicon => 'icon-plus', :text => I18n.t('fotos.new-gallery'), :path => new_gallery_path } if can? :new, Gallery + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @galleries } + end +end+
GET /galleries/new GET /galleries/new.json
+ + + ++# File app/controllers/galleries_controller.rb, line 79 +def new + @gallery = Gallery.new + @foto = Foto.new + respond_to do |format| + format.html # new.html.erb + format.json { render json: @gallery } + end +end+
GET /galleries/1 GET /galleries/1.json
+ + + ++# File app/controllers/galleries_controller.rb, line 19 + def show + @gallery = Gallery.find(params[:id]) + + @pppage_array = [ 25 , 50 , 100, 10000] #defines number & size of picture chunks + @pppage = 0 #starting index of pppage_array + + if !params[:pppage].nil? && params[:pppage].to_i <= 3 && params[:pppage].to_i >= 0 + @pppage = params[:pppage].to_i + end + + @page = params[:page].nil? ? 1 : params[:page].to_i + + + # @fotos = Foto.where(:gallery_id => params[:id]).limit(@pppage_array[@pppage]).offset(@pppage_array[@pppage]*(@page-1)) + @fotos = Foto.where(:gallery_id => params[:id]) + unless params[:fotoid].nil? + foto_ind = @fotos.find_index(Foto.find(params[:fotoid])) + # @page=(@fotos.count/foto_ind).to_i+1 + @openfotoid=params[:fotoid] + else +@openfotoid=0 + end + if @fotos.nil? || @fotos.empty? + @fotos_p = [] + @fotos_n = [] + @pages = 1 + + else + if @pppage_array[@pppage] != "all" + @fotos_p = @fotos.page(@page).per(@pppage_array[@pppage]) + + @fotos_n = @fotos- @fotos_p + @foto_ind = @fotos.find_index(@fotos_p.first) + @fotos_n = @fotos_n.rotate(@foto_ind) + @pages = (Foto.where(:gallery_id => params[:id]).count/(@pppage_array[@pppage])+1) + else + @fotos_p = @fotos + @fotos_n = [] + @pages = 1 + end + end + + # Hier ausrechnen welche angezeigt werden sollen + @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('fotos.new-fotos'), :path=>new_gallery_foto_path(@gallery)} if can? :create, @gallery + @toolbar_elements << {:hicon=>'icon-pencil', :text => I18n.t('common.edit'), :path=>edit_gallery_path(@gallery)} if can? :edit, @gallery + @toolbar_elements << {:hicon=>'icon-arrow-left', :text=>I18n.t('common.back'), :path=>galleries_path()} + @toolbar_elements << {:hicon => 'icon-remove-circle', :text => I18n.t('common.delete'), :path => gallery_path(@gallery),:confirm=>'Sure?', :method=>:delete} if can? :delete, Gallery + + respond_to do |format| + format.html { + if @fotos.nil? || @fotos.empty? + redirect_to new_gallery_foto_path(@gallery) + end + } + format.json { render json: @gallery } + end + end+
PUT /galleries/1 PUT /galleries/1.json
+ + + ++# File app/controllers/galleries_controller.rb, line 112 +def update + @gallery = Gallery.find(params[:id]) + @foto = Foto.new + respond_to do |format| + if @gallery.update_attributes(params[:gallery]) + + Foto.where(:gallery_id=>nil).each do |tbd| + tbd.destroy + end + format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @gallery.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: galleries
+ +id :integer not null, primary key +name :string(255) +desc :text +datum :date +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /gremien POST /gremien.json
+ + + ++# File app/controllers/gremien_controller.rb, line 67 +def create + @gremium = Gremium.new(params[:gremium]) + + respond_to do |format| + if @gremium.save + format.html { redirect_to @gremium, notice: 'Gremium was successfully created.' } + format.json { render json: @gremium, status: :created, location: @gremium } + else + format.html { render action: "new" } + format.json { render json: @gremium.errors, status: :unprocessable_entity } + end + end +end+
DELETE /gremien/1
+ + + ++# File app/controllers/gremien_controller.rb, line 110 +def destroy + @gremium = Gremium.find(params[:id]) + @gremium.destroy + + respond_to do |format| + format.html { redirect_to gremien_url } + format.json { head :no_content } + end +end+
GET /gremien/1/edit
+ + + ++# File app/controllers/gremien_controller.rb, line 57 +def edit + @gremium = Gremium.find(params[:id]) + + @memberships=@gremium.memberships.order(:fetprofile_id).active + @memberships<< Membership.new + +end+
+# File app/controllers/gremien_controller.rb, line 18 +def index + if params[:filter].nil? + @gremien = Gremium.where("CAST(typ AS INT) < 10").order(:typ).order(:name) + else + @gremien = Gremium.order(:typ).order(:name).where("CAST(typ AS INT) = ?",params[:filter].to_i) + end + + + @gremientabs=Gremium.tabs + +end+
GET /gremien/new GET /gremien/new.json
+ + + ++# File app/controllers/gremien_controller.rb, line 46 +def new + @gremium = Gremium.new + @memberships=[Membership.new] + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @gremium } + end +end+
GET /gremien/1 GET /gremien/1.json
+ + + ++# File app/controllers/gremien_controller.rb, line 33 +def show + @gremium = Gremium.find(params[:id]) + @gremientabs=Gremium.tabs + @memberships=@gremium.memberships.visible_in_gremium + @nlinks = @gremium.nlinks.page(params[:page]).per(5) + respond_to do |format| + format.html # show.html.erb + format.json { render json: @gremium } + end +end+
PUT /gremien/1 PUT /gremien/1.json
+ + + ++# File app/controllers/gremien_controller.rb, line 83 +def update + @gremium = Gremium.find(params[:id]) + + respond_to do |format| + if @gremium.update_attributes(params[:gremium]) + format.html { + unless params[:button]=="continue" || params[:commit]=="continue" + redirect_to @gremium, notice: 'Gremium was successfully updated.' + else + @memberships=@gremium.memberships.order(:typ) + @memberships<< Membership.new + @memberships<< Membership.new + @memberships<< Membership.new + render action: "edit", notice: 'gremium was successfully updated.' + end + } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @gremium.errors, status: :unprocessable_entity } + end + end +end+
+# File app/controllers/gremien_controller.rb, line 6 +def verwalten + @gremien = Gremium.all + @gremientabs=Gremium.tabs + @toolbar_elements << {:text=>I18n.t('gremium.new'),:path=>new_gremium_path() ,:icon=>:plus} if can? :new, Gremium + @toolbar_elements << {:text=>I18n.t('profile.new'),:path=>new_fetprofile_path() ,:icon=>:plus} if can? :new, Fetprofile + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @gremien } + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: gremien
+ +id :integer not null, primary key +name :string(255) +desc :text +typ :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/gremium.rb, line 37 +def fall2 + Gremium::ART2FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "s":"") +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/home_controller.rb, line 43 +def admin + authorize! :doadmin, User + t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml") + @kontaktthemen = Thema.where(:id=>t) + +end+
+# File app/controllers/home_controller.rb, line 107 +def choose_contact_topics + authorize! :doadmin, User + t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml") + unless params[:themen].nil? + t=([t].flatten+params[:themen]).uniq + end + unless params[:rmthema].nil? + t=t-[params[:rmthema]] + end + File.open("config/contact_topic.yml",'w'){|f| f.write(t.to_yaml)} + redirect_to admin_home_index_path +end+
+# File app/controllers/home_controller.rb, line 20 +def dev + +end+
+# File app/controllers/home_controller.rb, line 2 +def index + @beispiele = Beispiel.last([Beispiel.count, 3].min) + @neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).limit(10) + if Thema.count>0 + t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml") + @rubriken= Rubrik.accessible_by(current_ability, :show) + + params[:month]= Date.today.month if params[:month].nil? + params[:year]= Date.today.year if params[:year].nil? + + @calentries= (@rubriken.map {|r| r.calendar}).collect(&:calentries).flatten.select {|c| c.object !=nil} + + @starttopic= @themen = Thema.where(:id=>t).first + else + @starttopic=@themen = nil + end + @stickythemen = Thema.where(:sticky_startpage=>true) +end+
+# File app/controllers/home_controller.rb, line 23 +def infoscreen + authorize! :infoscreen, User + @neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true) + render layout: false +end+
+# File app/controllers/home_controller.rb, line 38 +def intern + authorize! :seeintern, User + @neuigkeiten = Neuigkeit.intern.recent + @themengruppen=Themengruppe.intern.order(:priority).reverse +end+
+# File app/controllers/home_controller.rb, line 28 +def kontakt + t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml") + @themen = Thema.where(:id=>t) +end+
+# File app/controllers/home_controller.rb, line 102 +def language + redirect_to :back +rescue ActionController::RedirectBackError + redirect_to :root +end+
+# File app/controllers/home_controller.rb, line 62 +def linksnotimplemented +render 'links_notimplemented' +end+
+# File app/controllers/home_controller.rb, line 49 +def log + authorize! :doadmin, User + lines = params[:lines] + if Rails.env == "production" + @logs = `tail -n #{lines} log/production.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` + else + @logs = `tail -n #{lines} log/development.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` + end + +end+
+# File app/controllers/home_controller.rb, line 66 +def search + + unless params['query'].nil? || params['query'].empty? + @results = Sunspot.search Neuigkeit,Rubrik, Fetprofile, Thema, Themengruppe, Lva, Studium, Modul, Modulgruppe, Gremium, Document do + fulltext params['query'] + end + @neuigkeiten=[]; + if can?(:showintern, Neuigkeit) + #@neuigkeiten=Neuigkeit.search(params['query']) + else + # @neuigkeiten =Neuigkeit.search(params['query']).public + end + @res=[] + @results.results.each do |r| + @res << r if can?(:show,r) + end + +# @fetprofiles = Fetprofile.search(params['query']) + @fetprofiles=[] + # if can?(:showintern, Neuigkeit) + # @themen=Thema.search(params['query']) + # else + # @themen=Thema.search(params['query']).public + # end +@themen=[] + + else + @neuigkeiten=[] + @fetprofiles=[] + @themen=[] + end + respond_to do |format| + format.html + format.js + end +end+
+# File app/controllers/home_controller.rb, line 59 +def startdev +render 'setup_fetsite_dev' +end+
+# File app/controllers/home_controller.rb, line 32 +def treeview + authorize! :doadmin, User + @themengruppen = Themengruppe.order(:priority).reverse + @themengruppen += Themengruppe.intern.order(:priority).reverse + +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/key.rb, line 11 + def self.find_or_create(user, typ, parent=nil) + if parent.nil? || !parent + kk=Key.where(user_id: user.id, typ: typ, is_valid: true).first + if kk.nil? + kk=Key.new + kk.user=user + kk.typ = typ + kk.is_valid = true + kk.save + end + else + kk=Key.where(user_id: user.id, typ: typ, is_valid: true, parent_type: parent.class.to_s, parent_id: parent.id).first + + if kk.nil? + kk=Key.new + kk.user=user + kk.typ = typ + kk.is_valid = true +kk.parent=parent + kk.save + end + end + kk + end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: lecturers
+ +id :integer not null, primary key +name :string(255) +email :string(255) +oid :integer +picture :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/lecturer.rb, line 21 +def load_tissdata + url= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s+".xml" + hash=Hash.from_xml(open(url).read)["tuvienna"] + self.name=hash["person"]["firstname"]+" "+hash["person"]["lastname"] + if hash["person"]["employee"]["employment"].is_a? Array + self.email= hash["person"]["employee"]["employment"].first["emails"]["email"].first + else + self.email= hash["person"]["employee"]["employment"]["emails"]["email"].first + end + self.link= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s +end+
Generated with the Darkfish + Rdoc Generator 2.
+POST /lecturers POST /lecturers.json
+ + + ++# File app/controllers/lecturers_controller.rb, line 43 +def create + @lecturer = Lecturer.new(params[:lecturer]) + + respond_to do |format| + if @lecturer.save + format.html { redirect_to @lecturer, notice: 'Lecturer was successfully created.' } + format.json { render json: @lecturer, status: :created, location: @lecturer } + else + format.html { render action: "new" } + format.json { render json: @lecturer.errors, status: :unprocessable_entity } + end + end +end+
DELETE /lecturers/1 DELETE /lecturers/1.json
+ + + ++# File app/controllers/lecturers_controller.rb, line 75 +def destroy + @lecturer = Lecturer.find(params[:id]) + @lecturer.destroy + + respond_to do |format| + format.html { redirect_to lecturers_url } + format.json { head :no_content } + end +end+
GET /lecturers/1/edit
+ + + ++# File app/controllers/lecturers_controller.rb, line 37 +def edit + @lecturer = Lecturer.find(params[:id]) +end+
+# File app/controllers/lecturers_controller.rb, line 5 +def index + @lecturers = Lecturer.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @lecturers } + end +end+
GET /lecturers/new GET /lecturers/new.json
+ + + ++# File app/controllers/lecturers_controller.rb, line 27 +def new + @lecturer = Lecturer.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @lecturer } + end +end+
GET /lecturers/1 GET /lecturers/1.json
+ + + ++# File app/controllers/lecturers_controller.rb, line 16 +def show + @lecturer = Lecturer.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @lecturer } + end +end+
PUT /lecturers/1 PUT /lecturers/1.json
+ + + ++# File app/controllers/lecturers_controller.rb, line 59 +def update + @lecturer = Lecturer.find(params[:id]) + + respond_to do |format| + if @lecturer.update_attributes(params[:lecturer]) + format.html { redirect_to @lecturer, notice: 'Lecturer was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @lecturer.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
++# File lib/like_voteable.rb, line 27 +def dislike + @obj=controller_name.classify.constantize.find(params[:id]) + if current_user.disliked?(@obj) + @obj.undisliked_by current_user + else + @obj.disliked_by current_user + end + @obj.touch + respond_to do |format| + format.html { + redirect_to @obj + } + format.js { + render :show + } + # + end + +end+
+# File lib/like_voteable.rb, line 9 +def like + @obj=controller_name.classify.constantize.find(params[:id]) + if current_user.liked? @obj + @obj.unliked_by current_user + else + @obj.liked_by current_user + end + @obj.touch + respond_to do |format| + format.html { + redirect_to @obj + } + format.js { + render :show + } + # + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: lvas
+ +id :integer not null, primary key +name :string(255) +desc :text +ects :decimal +lvanr :string(255) +stunden :decimal +created_at :datetime not null +updated_at :datetime not null +modul_id :integer +semester_id :integer+ +
+# File app/models/lva.rb, line 240 +def self.update_multiple_with_modul(hash,modul) + newlvas=[] + hash.each do |i,l| + lva=Lva.where(:lvanr=>l["lvanr"]).first if lva.nil? + lva=Lva.new(l) if lva.nil? + lva.modul<< modul + lva.modul.uniq! + lva.name=l["name"] + lva.lvanr=l["lvanr"] + lva.ects=l["ects"] + descr = l["desc"] + lva.desc= (descr.empty?) ? "<div></div>" : descr + lva.semester=Semester.where(:id=>l["semester_ids"].map(&:to_i)) + lva.stunden=l["stunden"] + pr =l["pruefungsinformation"] + lva.pruefungsinformation= (pr.empty?) ? "<div></div>" : pr + lva.lernaufwand=l["lernaufwand"] + lva.typ=l["typ"] + lva.save + newlvas<< lva # + end + newlvas + +end+
+# File app/models/lva.rb, line 71 +def add_semesters + # Diese Methode fügt die Instanz automatisch zu allen Studien als "Ohne Semesterempfehlung" (Semester 0) zu, bei denen die Instanz im Studium noch nicht vorkommt. + for m in self.modul + for mg in m.modulgruppen # Über alle Module und alle Modulgruppen iterieren + hits = mg.studium.semester.all.map{|x| x.lvas}.map{|x| x.find_by_id(self.id)}.compact # Alle einträge in allen semestern mit gleicher LVa-ID suchen und alle nils entfernen + + if hits.empty? # wurde gar kein eintrag gefunden ? + self.semester << mg.studium.semester.where(:nummer => 0) # auf nummer null eintragen + end + end + end + +end+
+# File app/models/lva.rb, line 68 +def full_name + return self.typ_n + ' ' + self.name + end+
+# File app/models/lva.rb, line 116 + def load_tissdata + urlp="https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-" + begin + url= urlp+Time.now.year.to_s+"W" + hash=Hash.from_xml(open(url).read)["tuvienna"] + rescue OpenURI::HTTPError => e + begin + url= urlp+Time.now.year.to_s+"S" + hash=Hash.from_xml(open(url).read)["tuvienna"] + rescue OpenURI::HTTPError => e + begin + url= urlp+(Time.now.year-1).to_s+"W" + hash=Hash.from_xml(open(url).read)["tuvienna"] + rescue OpenURI::HTTPError => e + + end + + end + + end + + + +# begin + + # person=[] + # if hash["course"]["lecturers"]["oid"].is_a? String + # person = @hash["course"]["lecturers"]["oid"] + # else + # hash["course"]["lecturers"]["oid"].each do |pid| + # person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"] + # end + # end + self.name=hash["course"]["title"]["de"] + self.pruefungsinformation = hash["course"]["examinationModalities"][I18n.locale.to_s].to_s unless hash["course"]["examinationModalities"][I18n.locale.to_s].to_s.empty? + self.desc= hash["course"]["objective"][I18n.locale.to_s]+"<p></p>"+hash["course"]["teachingContent"][I18n.locale.to_s] + self.typ=hash["course"]["courseType"] + self.stunden=hash["course"]["weeklyHours"] + #hash["course"]["url"] + if hash["course"]["lecturers"]["oid"].is_a? Array + hash["course"]["lecturers"]["oid"].each do |oid| + lecturer= self.lecturers.where(:oid=>oid).first + if lecturer.nil? + lecturer=Lecturer.where(:oid=>oid).first + if lecturer.nil? + logger.debug "Neuen Lecturer laden" + lecturer=Lecturer.new + lecturer.oid=oid + lecturer.load_tissdata + if lecturer.save + self.lecturers << lecturer + else + logger.fatal "Invaliden Lecturer erzeugt" + end + else + logger.debug "Lecturer hinzufügen" + self.lecturers << lecturer + end + end + end + else + oid= hash["course"]["lecturers"]["oid"] + lecturer= self.lecturers.where(:oid=>oid).first + if lecturer.nil? + lecturer=Lecturer.where(:oid=>oid).first + if lecturer.nil? + logger.info "Neuen Lecturer laden" + lecturer=Lecturer.new + lecturer.oid=oid + lecturer.load_tissdata + if lecturer.save + self.lecturers << lecturer + else + logger.fatal "Invaliden Lecturer erzeugt" + end + else + + logger.info "Lecturer hinzufügen" + lecturer.load_tissdata + lecturer.save + self.lecturers << lecturer + end + end + + + end + + end+
+# File app/models/lva.rb, line 266 +def read_et_forum + lva=self + url=lva.forumlink + ans = JSON.parse(`python #{Rails.root}/bin/downloadlogin.py #{url}`) + ans.each do |a| + if Crawlobject.where(:objhash=>Digest::SHA512.hexdigest(a.to_json), :objtype=>1).count ==0 + aa = Crawlobject.new(:raw=>a.to_json) + aa.objtype=1 + aa.parse_object + aa.calc_hash + aa.something=lva + if Crawlobject.where(:objhash2=>aa.objhash2, :objtype=>1).count==0 + aa.save + else + aa=Crawlobject.where(:objhash2=>aa.objhash2).first + aa.raw=a.to_json + aa.parse_object + aa.calc_hash + aa.save + end + end + end +end+
Lade Daten aus TISS und füge diese in die Datenbank ein.
+ + + ++# File app/models/lva.rb, line 87 +def tisshash(semester) + url= "https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+semester +hash=Hash.from_xml(open(url).read)["tuvienna"] +end+
+# File app/models/lva.rb, line 92 +def tisslink + urlp="https://tiss.tuwien.ac.at/course/courseDetails.xhtml?courseNr="+ lvanr.to_s.gsub(".","")+"&" + urlp1 = "https://tiss.tuwien.ac.at/api/course/"+ lvanr.to_s.gsub(".","")+"-" + begin + url= urlp+"semester="+Time.now.year.to_s+"W" + hash=Hash.from_xml(open(urlp1+Time.now.year.to_s+"W").read)["tuvienna"] + rescue OpenURI::HTTPError => e + begin + url= urlp+"semester="+Time.now.year.to_s+"S" + hash=Hash.from_xml(open(urlp1+Time.now.year.to_s+"S").read)["tuvienna"] + rescue OpenURI::HTTPError => e + begin + url= urlp+"semester="+(Time.now.year-1).to_s+"W" + hash=Hash.from_xml(open(urlp1+(Time.now.year-1).to_s+"W").read)["tuvienna"] + rescue OpenURI::HTTPError => e + end + end + rescue => e + + end + url +end+
+# File app/models/lva.rb, line 65 +def title + self.name +end+
(zumindest eines)
+ + + ++# File app/models/lva.rb, line 62 +def typ_n + typ=="andere" ? "" : typ +end+
+# File app/models/lva.rb, line 205 +def update_multiple(hash) + newlvas=[] + params["lvas"].each do |i,l| + lva=Lva.where(:lvanr=>l["lvanr"]).first if lva.nil? + lva=Lva.new(l) if lva.nil? + + lva.name=l["name"] + lva.lvanr=l["lvanr"] + lva.ects=l["ects"] + descr = l["desc"] + lva.desc= (descr.empty?) ? "<div></div>" : descr + lva.semester=Semester.where(:id=>l["semester_ids"].map(&:to_i)) + lva.stunden=l["stunden"] + pr =l["pruefungsinformation"] + lva.pruefungsinformation= (pr.empty?) ? "<div></div>" : pr + lva.lernaufwand=l["lernaufwand"] + lva.typ=l["typ"] + lva.save + newlvas<<lva # + end + newlvas + +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/lvas_controller.rb, line 17 +def beispiel_sammlung + @lva = Lva.find_by_id(params[:id]) + filename = 'beispiel_sammlung_' + @lva.lvanr.to_s + '_' + l(Date.today).to_s + '.zip' + temp_file = Tempfile.new(filename) + begin + Zip::OutputStream.open(temp_file) { |zos| } + Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip| + i=1 + @lva.beispiele.each do |bsp| + zip.add(i.to_s + '_' + File.basename(bsp.beispieldatei.current_path), bsp.beispieldatei.current_path) + i = i + 1 + end + + end + #Read the binary data from the file + zip_data = File.read(temp_file.path) + send_data(zip_data, :type => 'application/zip', :filename => filename) + ensure + #Close and delete the temp file + temp_file.close + temp_file.unlink + end +end+
+# File app/controllers/lvas_controller.rb, line 76 +def compare_tiss + @lva = Lva.find_by_id(params[:id]) + @lvatiss = Lva.new + @lvatiss.lvanr=@lva.lvanr + @lvatiss.load_tissdata + +end+
+# File app/controllers/lvas_controller.rb, line 94 +def create + @lva = Lva.new(params[:lva]) + respond_to do |format| + if @lva.save + @lva.add_semesters + format.html { redirect_to @lva, notice: 'Lva was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
+# File app/controllers/lvas_controller.rb, line 118 +def destroy + @lva = Lva.find(params[:id]) + @lva.destroy + respond_to do |format| + format.html { redirect_to lvas_url } + end +end+
+# File app/controllers/lvas_controller.rb, line 71 +def edit + @lva = Lva.find(params[:id]) + @semester = @lva.modul.map(&:modulgruppen).flatten.map(&:studium).map(&:semester).flatten.uniq +end+
+# File app/controllers/lvas_controller.rb, line 10 +def index + @lvas = Lva.all + @toolbar_elements=[{:hicon=>'icon-plus-sign',:text =>I18n.t('lva.add'),:path => new_lva_path}] + @tb=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}, + {:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}, + {:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}] +end+
+# File app/controllers/lvas_controller.rb, line 7 +def load_studien + @studien = Studium.accessible_by(current_ability, :show) +end+
+# File app/controllers/lvas_controller.rb, line 84 +def load_tiss + @lva = Lva.find_by_id(params[:id]) + @lva.load_tissdata + if @lva.save + redirect_to @lva , notice: 'Lva von TISS geladen.' + else + redirect_to @lva, action: :compare_tiss + end +end+
+# File app/controllers/lvas_controller.rb, line 65 +def new + @lva = Lva.new + modul=Modul.find_by_id(params[:modul_id]) + @lva.modul<<modul unless modul.nil? # +end+
GET /lvas/1
+ + + ++# File app/controllers/lvas_controller.rb, line 42 +def show + @lva = Lva.find_by_id(params[:id]) + @beispiel=Beispiel.new + @beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show) + @beispiele = @lva.beispiele.not_flag_badquality.not_flag_delete.order(:lecturer_id,:datum).accessible_by(current_ability, :show) + @beispiele_badQ = @lva.beispiele.flag_badquality.not_flag_delete.order(:datum).accessible_by(current_ability, :show) + @beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show) + @toolbar_elements =[] + @toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.manage'),:path => verwalten_lva_path(@lva)} if can? :verwalten, @lva + @crawlobjects = @lva.crawlobjects.roots.accessible_by(current_ability) + @questions=@lva.questions.accessible_by(current_ability,:show) +end+
+# File app/controllers/lvas_controller.rb, line 106 +def update + @lva = Lva.find(params[:id]) + respond_to do |format| + if @lva.update_attributes(params[:lva]) + @lva.add_semesters + format.html { redirect_to @lva, notice: 'Lva was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
+# File app/controllers/lvas_controller.rb, line 55 +def verwalten + @lva = Lva.find_by_id(params[:id]) + @beispiel=Beispiel.new + @beispiele_all=@lva.beispiele.order(:datum).accessible_by(current_ability, :show) + @beispiele = @lva.beispiele.not_flag_badquality.not_flag_delete.order(:lecturer_id,:datum).accessible_by(current_ability, :show) + @beispiele_badQ = @lva.beispiele.flag_badquality.not_flag_delete.order(:datum).accessible_by(current_ability, :show) + @beispiele_deleted = @lva.beispiele.flag_delete.order(:datum).accessible_by(current_ability, :show) + render :show +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/meeting.rb, line 106 +def self.new_divid_for(parent) + "meeting_new_parent_" + parent.class.to_s + "_" + parent.id.to_s +end+
+# File app/models/meeting.rb, line 96 +def self.new_with_date_and_typ(parent,start, typ) + m= Meeting.new + m.parent=parent + m.calentry=Calentry.new + m.calentry.typ=2 + m.calentry.start=start + m.calentry.dauer=4 + m.meetingtyp=typ + m +end+
+# File app/models/meeting.rb, line 120 +def agenda_text + unless self.agenda.nil? + t= self.agenda.text + else + t= "" + end + t +end+
+# File app/models/meeting.rb, line 84 +def create_agenda + if self.agenda.nil? + d=Document.new + d.typ=11 + d.name="Agenda" + unless self.meetingtyp.agenda.nil? + d.text=self.meetingtyp.agenda.text + end + d.save + self.agenda=d + end +end+
+# File app/models/meeting.rb, line 38 +def create_announcement(user) + if self.neuigkeit.nil? + n = Neuigkeit.new + + n.title=self.text + n.text ="Agenda im Anhang" + n.rubrik = self.meetingtyp.rubrik + n.author=user + n.datum=Date.today + n.save + self.neuigkeit= n + end +end+
+# File app/models/meeting.rb, line 77 +def create_calentry + if self.calentry.nil? + ce =Calentry.new + ce.typ=2 + self.calentry=ce + end +end+
+# File app/models/meeting.rb, line 64 +def create_protocol + if self.protocol.nil? + d=Document.new + d.typ=10 + d.name="Protokoll" + unless self.meetingtyp.protocol.nil? + d.text=self.meetingtyp.protocol.text + end + d.save + self.protocol=d + end + +end+
+# File app/models/meeting.rb, line 109 +def divid + "meeting_"+self.id.to_s +end+
+# File app/models/meeting.rb, line 57 +def fix_calentry + self.calentry.object=self unless self.calentry.nil? + self.calentry.calendar = self.meetingtyp.rubrik.calendar +end+
+# File app/models/meeting.rb, line 128 + def protocol_text + unless self.protocol.nil? + t= self.protocol.text + else + t= "" + end + t +end+
+# File app/models/meeting.rb, line 61 +def public? + ! (self.intern) +end+
+# File app/models/meeting.rb, line 26 + def text + unless self.meetingtyp.try(:name).to_s.empty? + t = self.meetingtyp.name.to_s+", " + else + t="" + t = parent.title.to_s + ", " if self.name.empty? + end + t= t+ self.name.to_s +# t = t + " " + I18n.l(self.calentry.start) unless self.calentry.nil? + t = t +" "+ I18n.t("date.am")+" "+ self.calentry.text unless self.calentry.nil? + t + end+
+# File app/models/meeting.rb, line 22 +def title + self.text +end+
+# File app/models/meeting.rb, line 51 +def update_announcement + n=self.neuigkeit + n.title=self.text + n.save + +end+
+# File app/models/meeting.rb, line 113 +def update_time_from_protocol + st= /Beginn[\s:]*([^<>]*)/.match(self.protocol.text)[1].to_s + st= /Anfang[\s:]*([^<>]*)/.match(self.protocol.text)[1].to_s if st.empty? + self.calentry.start=(self.calentry.start.to_date.to_s + " " +st).to_datetime unless st.empty? + st= /Ende[\s:]*([^<>]*)/.match(self.protocol.text)[1].to_s + self.calentry.ende=(self.calentry.ende.to_date.to_s + " " +st).to_datetime unless st.empty? +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/meetings_controller.rb, line 20 +def announce + m=Meeting.find(params[:id]) + m.create_announcement(current_user) + m.save + @meeting=Meeting.find(params[:id]) + + respond_to do |format| + format.html {redirect_to m.parent} + format.js {render action: :show} + end +end+
+# File app/controllers/meetings_controller.rb, line 86 +def create + @meeting = Meeting.new(params[:meeting]) + + @parent=@meeting.parent + #@meeting.assign_attributes(params[:meeting]) + + respond_to do |format| + if @meeting.save + # format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' } + #format.json { render json: @meeting, status: :created, location: @meeting } + format.js + else + # format.html { render action: "new" } + # format.json { render json: @meeting.errors, status: :unprocessable_entity } + format.js { render action: "new" } + end + end +end+
+# File app/controllers/meetings_controller.rb, line 67 +def create_agenda + @meeting = Meeting.find(params[:id]) + @meeting.create_agenda + + + respond_to do |format| + format.js {render action: :show} + end +end+
+# File app/controllers/meetings_controller.rb, line 59 +def create_protocol + @meeting = Meeting.find(params[:id]) + @meeting.create_protocol + @meeting.save + respond_to do |format| + format.js {render action: :show} + end +end+
+# File app/controllers/meetings_controller.rb, line 122 +def destroy + logger.info("-------------delete------------------") + @meeting = Meeting.find(params[:id]) + + @parent=@meeting.parent + @meeting_id = params[:id] + @meeting.destroy + + respond_to do |format| + #format.html { redirect_to @object} + #format.json { head :no_content } + format.js + end +end+
+# File app/controllers/meetings_controller.rb, line 76 + def edit + @meeting = Meeting.find(params[:id]) + +@parent=@meeting.parent +respond_to do |format| + format.js + end + + end+
+# File app/controllers/meetings_controller.rb, line 4 +def index + parent=params[:parent_type].constantize.find(params[:parent_id]) + unless parent.nil? + #authorize! :show, parent + if params[:filter]=="upcomming" + @meetings=parent.meetings.upcomming + else + @meetings=parent.meetings + end + @parent=parent + end + respond_to do |format| + format.html {redirect_to rubriken_path} + format.js + end +end+
+# File app/controllers/meetings_controller.rb, line 49 +def new + @meeting=Meeting.new + @meeting.parent=params[:parent_type].constantize.find(params[:parent_id]) + @parent=@meeting.parent + @meeting.calentry=Calentry.new + @meeting.calentry.typ = 2 + respond_to do |format| + format.js + end +end+
+# File app/controllers/meetings_controller.rb, line 31 + def show + m=Meeting.find(params[:id]) + respond_to do |format| + format.html { + if can?(:show, m.parent) + redirect_to m.parent + else + if can?(:show, m.neuigkeit) && !m.neuigkeit.nil? + redirect_to m.neuigkeit + else + redirect_to m.parent + end + end + } + format.js + + end +end+
+# File app/controllers/meetings_controller.rb, line 105 +def update + + @meeting = Meeting.find(params[:id]) + @parent=@meeting.parent + respond_to do |format| + if @meeting.update_attributes(params[:meeting]) + format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' } + format.json { head :no_content } + format.js + else + + # format.html + # format.json { render json: @meeting.errors, status: :unprocessable_entity } + format.js { render action: "edit" } + end + end + end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/meetingtyps_controller.rb, line 35 +def create + @meetingtyp = Meetingtyp.new(params[:meetingtyp]) + @meetingtyp.assign_attributes(params[:meetingtyp]) + + respond_to do |format| + if @meetingtyp.save + format.html { redirect_to @meetingtyp, notice: 'Meeting was successfully created.' } + #format.json { render json: @meeting, status: :created, location: @meeting } + format.js + else + format.html { render action: "new" } + # format.json { render json: @meeting.errors, status: :unprocessable_entity } + format.js { render action: "new" } + end + end +end+
+# File app/controllers/meetingtyps_controller.rb, line 15 +def create_protocol_and_agenda + @meetingtyp = Meetingtyp.find(params[:id]) + if @meetingtyp.agenda.nil? + d=Document.new + d.typ=11 + d.name="Agendavorlage" + d.save + @meetingtyp.agenda=d + end + if @meetingtyp.protocol.nil? + d=Document.new + d.typ=10 + d.name="Protokollvorlage" + d.save + @meetingtyp.protocol=d + end + redirect_to action: :index +end+
+# File app/controllers/meetingtyps_controller.rb, line 66 +def destroy + @meetingtyp = Meeting.find(params[:id]) + @meetingtyp.destroy + respond_to do |format| + format.html { redirect_to action: :index} + end +end+
+# File app/controllers/meetingtyps_controller.rb, line 9 +def edit + @meetingtyp = Meetingtyp.find(params[:id]) +end+
+# File app/controllers/meetingtyps_controller.rb, line 3 +def index + @meetingtyps=Meetingtyp.all +end+
+# File app/controllers/meetingtyps_controller.rb, line 12 +def new + @meetingtyp=Meetingtyp.new +end+
+# File app/controllers/meetingtyps_controller.rb, line 6 +def show + redirect_to action: :index +end+
+# File app/controllers/meetingtyps_controller.rb, line 52 +def update + @meetingtyp = Meetingtyp.find(params[:id]) + respond_to do |format| + if @meetingtyp.update_attributes(params[:meetingtyp]) + format.html { redirect_to @meetingtyp, notice: 'Meeting was successfully updated.' } + # format.json { head :no_content } + format.js + else + format.html { render action: "edit" } + # format.json { render json: @meeting.errors, status: :unprocessable_entity } + format.js { render action: "edit" } + end + end + end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: memberships
+ +id :integer not null, primary key +fetprofile_id :string(255) +gremium_id :string(255) +start :date +stop :date +typ :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /memberships POST /memberships.json
+ + + ++# File app/controllers/memberships_controller.rb, line 21 +def create + @membership = Membership.new(params[:membership]) + @membership.fetprofile= Fetprofile.find(params[:fetprofile_id]) + respond_to do |format| + if @membership.save + format.html { redirect_to @membership.fetprofile, notice: 'Membership was successfully created.' } + format.json { render json: @membership.fetprofile, status: :created, location: @membership.fetprofile } + else + format.html { render action: "new" } + format.json { render json: @membership.errors, status: :unprocessable_entity } + end + end +end+
DELETE /memberships/1 DELETE /memberships/1.json
+ + + ++# File app/controllers/memberships_controller.rb, line 53 +def destroy + @membership = Membership.find(params[:id]) + fp = @membership.fetprofile + @membership.destroy + + respond_to do |format| + format.html { redirect_to fp } + format.json { head :no_content } + end +end+
GET /memberships/1/edit
+ + + ++# File app/controllers/memberships_controller.rb, line 15 +def edit + @membership = Membership.find(params[:id]) +end+
+# File app/controllers/memberships_controller.rb, line 5 +def new + @membership = Membership.new + @membership.fetprofile=Fetprofile.find(params[:fetprofile_id]) + respond_to do |format| + format.html # new.html.erb + format.json { render json: @membership } + end +end+
PUT /memberships/1 PUT /memberships/1.json
+ + + ++# File app/controllers/memberships_controller.rb, line 37 +def update + #@membership = Membership.find(params[:id]) + + respond_to do |format| + if @membership.update_attributes(params[:membership]) + format.html { redirect_to @membership.fetprofile, notice: 'Membership was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @membership.errors, status: :unprocessable_entity } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: moduls
+ +id :integer not null, primary key +name :string(255) +desc :text +depend :text +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/modul.rb, line 23 +def self.update_multiple(hash) + m= [] + if hash.is_a? Hash + hash.each do |i,h| + if i.to_i == 0 + unless h["name"].empty? + md=Modul.new(:name=>h["name"],:desc=>h["desc"],:depend=>h["depend"]) + md.modulgruppen=Modulgruppe.where(:id => h["modulgruppe_ids"].map(&:to_i)) + md.save + m << md + end + else + md=Modul.find(h["id"].to_i) + md.name=h["name"] + md.desc=h["desc"] + md.depend=h["depend"] + md.modulgruppen=Modulgruppe.where(:id => h["modulgruppe_ids"].map(&:to_i)) + m << md + end + end + else + hash.each do |h| + unless h["name"].empty? + md=Modul.new(:name=>h["name"],:desc=>h["desc"],:depend=>h["depend"]) + md.modulgruppen=Modulgruppe.where(:id => h["modulgruppe_ids"].map(&:to_i)) + md.save + m << md + end + end +end + m +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: modulgruppen
+ +id :integer not null, primary key +typ :string(255) +phase :integer +name :string(255) +desc :text +studium_id :integer +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /modulgruppen
+ + + ++# File app/controllers/modulgruppen_controller.rb, line 65 +def create + @modulgruppe = Modulgruppe.new(params[:modulgruppe]) + respond_to do |format| + if @modulgruppe.save + format.html { redirect_to @modulgruppe.studium, notice: 'Modulgruppe was successfully created.' } + + else + format.html { render action: "new" } + + end + end +end+
DELETE /modulgruppen/1
+ + + ++# File app/controllers/modulgruppen_controller.rb, line 94 +def destroy + @modulgruppe = Modulgruppe.find(params[:id]) + @modulgruppe.destroy + + respond_to do |format| + format.html { redirect_to modulgruppen_url } + + end +end+
GET /modulgruppen/1/edit
+ + + ++# File app/controllers/modulgruppen_controller.rb, line 50 +def edit + @studien = Studium.accessible_by(current_ability, :show) + + @modulgruppe = Modulgruppe.find(params[:id]) + if !params[:studium_id].nil? + @studium=Studium.find(params[:studium_id]) + end +end+
+# File app/controllers/modulgruppen_controller.rb, line 10 +def index + @studien = Studium.accessible_by(current_ability, :show) + + @modulgruppen = Modulgruppe.all + if !params[:studium_id].nil? + @studium=Studium.find(params[:studium_id]) + else + @studium=Studium.first + end +end+
+# File app/controllers/modulgruppen_controller.rb, line 7 +def load_studien + @studien = Studium.accessible_by(current_ability, :show) +end+
GET /modulgruppen/new
+ + + ++# File app/controllers/modulgruppen_controller.rb, line 34 +def new + @studien = Studium.accessible_by(current_ability, :show) + + @modulgruppe = Modulgruppe.new + if !params[:studium_id].nil? + @modulgruppe.studium_id=(params[:studium_id]) + else + @modulgruppe.studium_id=studium_id=Studium.first.id + end + respond_to do |format| + format.html # new.html.erb + end + +end+
GET /modulgruppen/1
+ + + ++# File app/controllers/modulgruppen_controller.rb, line 22 +def show + @modulgruppe = Modulgruppe.find(params[:id]) + @studien = Studium.accessible_by(current_ability, :show) + + @studium = Studium.find(@modulgruppe.studium_id) + if !params[:studium_id].nil? + @studium=Studium.find(params[:studium_id]) + end +end+
+# File app/controllers/modulgruppen_controller.rb, line 79 +def update + @modulgruppe = Modulgruppe.find(params[:id]) + respond_to do |format| + if @modulgruppe.update_attributes(params[:modulgruppe]) + format.html { redirect_to @modulgruppe, notice: 'Modulgruppe was successfully updated.' } + + else + format.html { render action: "edit" } + + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+POST /moduls POST /moduls.json
+ + + ++# File app/controllers/moduls_controller.rb, line 145 +def create + @modul = Modul.new(params[:modul]) + respond_to do |format| + if @modul.save + for i in @modul.lvas + i.add_semesters + end + format.html { redirect_to modulgruppe_path(@modul.modulgruppen.first), notice: 'Modul was successfully created.' } + else + format.html { render action: "new" } + end + end + +end+
PUT /moduls/1 PUT /moduls/1.json DELETE /moduls/1 DELETE /moduls/1.json
+ + + ++# File app/controllers/moduls_controller.rb, line 164 +def destroy + @modul = Modul.find(params[:id]) + modulgruppe=@modul.modulgruppen.first + for i in @modul.lvas + i.add_semesters + end + @modul.destroy + redirect_to modulgruppe_path(modulgruppe) +end+
+# File app/controllers/moduls_controller.rb, line 58 +def edit + @modul = Modul.find(params[:id]) + if !params[:studium_id].nil? + @studium=Studium.find(params[:studium_id]) + end +end+
+# File app/controllers/moduls_controller.rb, line 65 + def edit_bulk + unless params[:modulgruppen_id].nil? + @moduls=Modulgruppe.find(params[:modulgruppen_id]).moduls + else + unless params[:studium_id].nil? + @moduls=Studium.find(params[:studium_id]).modulgruppen.collect(&:moduls).flatten + else + + @moduls=Modul.all +end + end + + end+
+# File app/controllers/moduls_controller.rb, line 79 +def edit_lvas + @lvas = @modul.lvas + @semester = @modul.modulgruppen.flatten.map(&:studium).map(&:semester).flatten.uniq +end+
+# File app/controllers/moduls_controller.rb, line 13 +def index + @moduls = Modul.all + if @moduls + if !params[:studium_id].nil? + @studium=Studium.find_by_id(params[:studium_id]) + end + respond_to do |format| + format.html # index.html.erb + end + end + +end+
+# File app/controllers/moduls_controller.rb, line 10 +def load_studien + @studien = Studium.accessible_by(current_ability, :show) +end+
+# File app/controllers/moduls_controller.rb, line 121 +def load_tiss + @lvas = @modul.lvas +end+
GET /moduls/new GET /moduls/new.json
+ + + ++# File app/controllers/moduls_controller.rb, line 41 +def new + @modul = Modul.new + modulgruppe=Modulgruppe.find_by_id(params[:modulgruppen_id]) + if !modulgruppe.nil? + @modul.modulgruppen<<modulgruppe # + end + respond_to do |format| + format.html # new.html.erb + end +end+
+# File app/controllers/moduls_controller.rb, line 52 +def new_bulk + @moduls= [] + @modulgruppe=Modulgruppe.find(params[:modulgruppen_id]) + 10.times {@moduls << Modul.new(:modulgruppen=>[@modulgruppe])} +end+
GET /moduls/1 GET /moduls/1.json
+ + + ++# File app/controllers/moduls_controller.rb, line 28 +def show + for i in @modul.modulgruppen + @tb <<{:text=> i.long_name, :path=>modulgruppe_path(i)} + end + respond_to do |format| + format.html # show.html.erb + format.json { render json: @modul } + end +end+
+# File app/controllers/moduls_controller.rb, line 125 +def show_tiss + @lvas=[]; + @semester = @modul.modulgruppen.flatten.map(&:studium).map(&:semester).uniq + params["lvas"].to_a.each do |l| + unless l.last["lvanr"].empty? + l=l.last + lva=Lva.new + lva.lvanr=l["lvanr"] + lva.load_tissdata + lva.modul<<@modul + @lvas<<lva # + end + end + render 'edit_lvas' +end+
+# File app/controllers/moduls_controller.rb, line 84 +def update + + respond_to do |format| + if @modul.update_attributes(params[:modul]) + for i in @modul.lvas + i.add_semesters + end + format.html { redirect_to url_for(@modul), notice: 'Modul was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
+# File app/controllers/moduls_controller.rb, line 98 +def update_bulk + @moduls=Modul.update_multiple(params[:moduls]) + if @moduls.map(&:valid?).all? + redirect_to @moduls.first.modulgruppen.first, :notice=>"Erfolgreich Module geändert" + else + render :edit_bulk + end +end+
+# File app/controllers/moduls_controller.rb, line 109 +def update_lvas + @semester = @modul.modulgruppen.flatten.map(&:studium).map(&:semester).flatten.uniq + @newlvas=Lva.update_multiple_with_modul(params["lvas"],@modul) + @lvas=@newlvas + + if @newlvas.map(&:valid?).all? + redirect_to modul_path(@modul) + else + render "edit_lvas" + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: neuigkeiten
+ +id :integer not null, primary key +title :string(255) +text :text +datum :datetime +rubrik_id :integer +created_at :datetime not null +updated_at :datetime not null +author_id :integer+ +
scope :search, ->(query) {where(“text like ? or title like ?”, +“%#{query}%”, “%#{query}%”)}
+# File app/models/neuigkeit.rb, line 97 +def datum_nilsave + self.datum.nil? ? Time.now + 42.years : self.datum +end+
+# File app/models/neuigkeit.rb, line 54 +def globalize_fallbacks(locale) + if self.no_fallbacks + [locale] + else + super + end +end+
+# File app/models/neuigkeit.rb, line 148 +def has_calentries? + !self.calentries.nil? && !self.calentries.empty? +end+
+# File app/models/neuigkeit.rb, line 90 +def has_meeting? + !self.meeting.nil? +end+
+# File app/models/neuigkeit.rb, line 87 +def is_annoncement? + !self.meeting.nil? +end+
+# File app/models/neuigkeit.rb, line 151 +def is_event? + self.has_calentries? +end+
+# File app/models/neuigkeit.rb, line 116 +def load_from_facebook(link) + event=FbGraph::Event.new(link).fetch(:access_token=>"CAABtfB8SO7kBADyHVHnWHqsxsU1bqqmeDdZCp7V1KF9G4o3oFHcZBq0IB8X3ird4muVIPuWKZB8jL1o9JCON60Lmnvk8rkZA2dyZAuU95dC0SWzOEnhtAEkyzZCN6hkKXdl87o38OloLBivc2kjJYmpUVKzdZAD5ywxKG7Hv5FWxXf6amWA782JSmcxgWsRDH4ZAZBXsUrhpnILNOVoKSBf1mGyfrFiPvA3QZD") + self.title=event.name + self.text=event.description + unless event.start_time.nil? + ce=Calentry.new(:start=>event.start_time, :ende=>event.end_time , :typ=>1) + ce.ende=ce.start if ce.ende.nil? + self.calentries<< ce + ce.save + + end +end+
+# File app/models/neuigkeit.rb, line 113 +def name + self.title +end+
+# File app/models/neuigkeit.rb, line 71 +def picture_robust + unless self.picture.url.nil? + return self.picture + else + if self.has_meeting? + return self.meeting.meetingtyp.picture + else + unless self.title_pic.nil? + # return self.attachments.where(flag_titlepic: true).first.datei + return self.title_pic.datei + else + return self.picture + end + end + end +end+
+# File app/models/neuigkeit.rb, line 100 +def public? + self.rubrik.public +end+
+# File app/models/neuigkeit.rb, line 107 +def publish + self.datum = Time.now +end+
+# File app/models/neuigkeit.rb, line 103 +def published? + self.datum_nilsave<=Time.now +end+
+# File app/models/neuigkeit.rb, line 61 +def read_attribute(name,options={}) + if translated?(name) + a=super(name,options) + a=self.translation_for(options[:locale] || I18n.locale).read_attribute(name) if self.no_fallbacks + + a + else + super(name) + end +end+
+# File app/models/neuigkeit.rb, line 154 +def relevant_calentry + ce = self.calentries.min_by{|c| c.days_to_today * 1.3 * ((c.is_past?)? 2:1)} if self.is_event? + ce= self.meeting.calentry if self.has_meeting? + ce +end+
+# File app/models/neuigkeit.rb, line 110 +def reverse_publish + self.datum = nil +end+
+# File app/models/neuigkeit.rb, line 128 +def text_first_words + md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) + words=md[:text].split(" ") unless md.nil? + if words.nil? || words.empty? + "...." + else + words[0..100].join(" ")+ " ..." unless words.nil? + + end +end+
+# File app/models/neuigkeit.rb, line 138 +def text_infoscreen_words + md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) + words=md[:text].split(" ") unless md.nil? + if words.nil? || words.empty? + "...." + else + words[0..1000].join(" ")+ " ..." unless words.nil? + + end +end+
+# File app/models/neuigkeit.rb, line 159 +def update_cache + if self.has_meeting? && !self.meeting.calentry.nil? + self.update_column(:cache_order, (self.meeting.calentry.start.to_date - Date.today).to_i.abs * 1.3) + self.update_column(:cache_relevant_date, self.meeting.calentry.start.to_date) + self.touch + else + if self.is_event? + c = self.calentries.min_by{|c| c.days_to_today * 1.3 * ((c.is_past?)? 2:1)} + self.update_column(:cache_order, c.days_to_today * 1.3 * ((c.is_past?)? 2:1)) + self.update_column(:cache_relevant_date, (c.is_past?) ? c.ende.to_date : c.start.to_date) + self.touch + else + unless self.datum.nil? + self.update_column(:cache_order, (((self.datum.to_date - Date.today).to_i)).abs) + self.update_column(:cache_relevant_date, self.datum.to_date) + else + self.update_column(:cache_order,0) + end + end + end + unless self.published? + self.update_column(:cache_order, self.cache_order-14) + end + if self.flag_important + self.update_column(:cache_order, self.cache_order-10) + end + self.update_column(:cache_is_published, self.published?) +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/neuigkeiten_controller.rb, line 43 +def add_calentry + @neuigkeit=Neuigkeit.find(params[:id]) + if params[:calentry_id].nil? + ce = Calentry.new(:start=>Time.now, :ende=>1.hour.from_now, :typ=>1, :calendar=>@neuigkeit.rubrik.calendar) + else + ce = Calentry.find(params[:calentry_id]) + end + @calentry=ce + ce.object=@neuigkeit + @neuigkeit.calentry=ce + @neuigkeit.save + + render 'edit' +end+
+# File app/controllers/neuigkeiten_controller.rb, line 189 +def create + @neuigkeit = Neuigkeit.new(params[:neuigkeit]) + @neuigkeit.author=current_user + + respond_to do |format| + if @neuigkeit.save + format.html { redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
+# File app/controllers/neuigkeiten_controller.rb, line 170 +def create_link + @neuigkeit = Neuigkeit.find(params[:id]) + + Nlink.create(:link=>params[:link_type].constantize.find(params[:link_id]),:neuigkeit=>Neuigkeit.find(params[:id])) + @nlinks=@neuigkeit.nlinks + respond_to do |format| + format.html { redirect_to action:"show" } + format.js + end +end+
+# File app/controllers/neuigkeiten_controller.rb, line 10 + def default_url_options + super +# super.merge({host: request.host_with_port}) + end+
+# File app/controllers/neuigkeiten_controller.rb, line 180 +def delete_link + @neuigkeit = Neuigkeit.find(params[:id]) + @nlink = @neuigkeit.nlinks.find(params[:nlink_id]) + @nlink.destroy + respond_to do |format| + format.html { redirect_to @neuigkeit } + format.js + end +end+
DELETE /neuigkeiten/1 DELETE /neuigkeiten/1.json
+ + + ++# File app/controllers/neuigkeiten_controller.rb, line 216 +def destroy + @neuigkeit = Neuigkeit.find(params[:id]) + rubrik=@neuigkeit.rubrik + @neuigkeit.destroy + respond_to do |format| + format.html { redirect_to rubrik } + + end + end+
+# File app/controllers/neuigkeiten_controller.rb, line 138 +def edit + @neuigkeit = Neuigkeit.find(params[:id]) + @neuigkeit.no_fallbacks=true + @rubrik=@neuigkeit.rubrik + + @calentries= @neuigkeit.calentries + @calentries<< Calentry.new + +end+
+# File app/controllers/neuigkeiten_controller.rb, line 147 +def find_link + @rubrik=@neuigkeit.rubrik + if can?(:shownonpublic, Rubrik) + @rubriken = Rubrik.all + else + @rubriken = Rubrik.where(:public=>true) + end + + @calentries1=@neuigkeit.calentries + nlink_search = Neuigkeit::LINKTYPES.clone + nlink_search.collect!{|t| t.constantize} + # @nlink_search.collect!{|t| t.search(params[:query]).limit(2)} + @results= Sunspot.search nlink_search do + fulltext params[:query] + end + + respond_to do |format| + format.html { render action:"show" } + format.js + end + + +end+
+# File app/controllers/neuigkeiten_controller.rb, line 121 +def mail_preview +ActionMailer::Base.default_url_options[:host] = request.host_with_port + + @neuigkeit = Neuigkeit.find(params[:id]) + @user=current_user + @ability=Ability.new(@user) + @mail = NewsMailer.neuigkeit_mail("all@fet.at", params[:id]) + + authorize! :publish, @neuigkeit + render layout: false +end+
+# File app/controllers/neuigkeiten_controller.rb, line 107 +def mail_to_fet + +ActionMailer::Base.default_url_options[:host] = request.host_with_port + + @neuigkeit = Neuigkeit.find(params[:id]) + authorize! :publish, @neuigkeit + unless @neuigkeit.published? + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie als Mail zu versenden.' + else + NewsMailer.neuigkeit_mail("all@fet.at", params[:id]).deliver + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit versendet' + + end +end+
+# File app/controllers/neuigkeiten_controller.rb, line 35 +def new + @neuigkeit = Neuigkeit.new + @rubrik=Rubrik.find(params[:rubrik_id]) unless params[:rubrik_id].nil? + @neuigkeit.author=current_user + @neuigkeit.rubrik=@rubrik unless @rubrik.nil? + @calentries= [Calentry.new] + +end+
+# File app/controllers/neuigkeiten_controller.rb, line 75 + def publish + @neuigkeit = Neuigkeit.find(params[:id]) + @neuigkeit.publish + @neuigkeit.save + + @questions = @neuigkeit.questions.accessible_by(current_ability,:show) + + if params[:verwalten] + redirect_to verwalten_rubrik_path(@neuigkeit.rubrik) +else + respond_to do |format| + format.html { redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit)} + format.js { render partial: "show"} + end +end + end+
+# File app/controllers/neuigkeiten_controller.rb, line 91 + def publish_to_facebook + @neuigkeit = Neuigkeit.find(params[:id]) + unless @neuigkeit.picture.url.nil? + picture_url=URI(root_url) + picture_url.path=@neuigkeit.picture.url(:locale=>nil, :theme=>nil) + end + unless @neuigkeit.published? + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie auf Facebook zu posten.' + else + page=YAML.load_file("#{::Rails.root.to_s}/config/page.yml") + # page.feed!(:access_token=>page.access_token, :message=>@neuigkeit.text_first_words, :name=>@neuigkeit.title, :link=>rubrik_neuigkeit_url(@neuigkeit.rubrik, @neuigkeit)+".html", :picture=>@neuigkeit.picture.url) +page.feed!(:access_token=>page.access_token, :message=>@neuigkeit.text_first_words, :name=>@neuigkeit.title, :link=>rubrik_neuigkeit_url(@neuigkeit.rubrik, @neuigkeit)+".html")# , :picture=>picture_url) + + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit auf Facebook gepostet' + end + end+
+# File app/controllers/neuigkeiten_controller.rb, line 14 +def show + @neuigkeit = Neuigkeit.find(params[:id]) + @rubrik = @neuigkeit.rubrik + @questions = @neuigkeit.questions.accessible_by(current_ability,:show) + if can?(:shownonpublic, Rubrik) + @rubriken = Rubrik.all + else + @rubriken = Rubrik.where(:public=>true) + end + + if !params[:version].nil? && can?(:showversions, Neuigkeit) + @neuigkeit.assign_attributes(@neuigkeit.translation.versions.reverse[params[:version].to_i].reify.attributes.select{|k,v| @neuigkeit.translated_attribute_names.include? k.to_sym }) + end + @calentries1=@neuigkeit.calentries + respond_to do |format| + format.html + format.js + end + +end+
+# File app/controllers/neuigkeiten_controller.rb, line 58 + def unpublish + @neuigkeit = Neuigkeit.find(params[:id]) + @neuigkeit.reverse_publish + @neuigkeit.save + + @questions = @neuigkeit.questions.accessible_by(current_ability,:show) + + if params[:verwalten] + redirect_to verwalten_rubrik_path(@neuigkeit.rubrik) + else + respond_to do |format| + format.html { redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit)} + format.js { render partial: "show"} + end +end + + end+
+# File app/controllers/neuigkeiten_controller.rb, line 203 +def update + @neuigkeit = Neuigkeit.find(params[:id]) + respond_to do |format| + if @neuigkeit.update_attributes(params[:neuigkeit]) + format.html { redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActionMailer::Base
+ ++# File app/mailers/news_mailer.rb, line 25 + def daily_reminder(user_id) + user=User.find(user_id) + @user=user + self.message.perform_deliveries = false unless user.flag_getemails + @ability = Ability.new(user) + @calentries = Calentry.of_month(Date.today).limit(100) +# @neuigkeiten=Neuigkeit.accessiblße_by(ability).published_scope.where("cache_order<2") + mail(to: user.email, content_type: "text/html", subject: "sdf") + render locals: {c_user: user} + end+
+# File app/mailers/news_mailer.rb, line 6 +def neuigkeit_mail(email, neuigkeit_id) + @neuigkeit= Neuigkeit.find(neuigkeit_id) + @user=User.first + @ability=Ability.new(@user) + subject = @neuigkeit.title + subject = subject.to_s + " email: " + email.to_s if Rails.env=="development" + email = "andis@fet.at" if Rails.env=="development" + email="andis@fet.at" + mail(to: email, subject: subject) + render locals: {current_user: User.first} +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+CarrierWave::Uploader::Base
+ +Add a white list of extensions which are allowed to be uploaded. For images +you might use something like this:
+ + + ++# File app/uploaders/picture_uploader.rb, line 46 +def extension_white_list + %(jpg jpeg gif png) +end+
Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:
+ + + ++# File app/uploaders/picture_uploader.rb, line 14 +def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: roles
+ +id :integer not null, primary key +name :string(255) +resource_id :integer +resource_type :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: rubriken
+ +id :integer not null, primary key +name :string(255) +desc :text +prio :integer +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/rubrik.rb, line 23 +def icon_name + (ActionController::Base.helpers.content_tag("i","", class: self.icon)) + self.name +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/rubriken_controller.rb, line 70 +def addmoderator + @rubrik = Rubrik.find(params[:id]) + if can? :addmoderator, @rubrik + if params[:moderator].nil? + current_user.add_role(:newsmoderator,@rubrik) + else + User.find(params[:moderator]).add_role(:newsmoderator, @rubrik) + end + + response_notice= I18n.t("rubrik/moderatoradded") + else + response_notice= I18n.t("rubrik/moderatoraddnorights") + end + respond_to do |format| + format.html { redirect_to @rubrik,:notice => response_notice } + end +end+
Alle Rubriken verwalten und Sachen einstellen..
+ + + ++# File app/controllers/rubriken_controller.rb, line 122 +def alle_verwalten + @rubriken =Rubrik.all + @neuigkeiten_unpublished = Neuigkeit.unpublished + @neuigkeiten_public_published = Neuigkeit.published.public + + @toolbar_elements << {:text=>I18n.t('common.new'),:path=>new_rubrik_path() ,:icon=>:plus} if can? :new, Rubrik + +end+
+# File app/controllers/rubriken_controller.rb, line 58 +def create + @rubrik = Rubrik.new(params[:rubrik]) + + respond_to do |format| + if @rubrik.save + format.html { redirect_to @rubrik, notice: 'Rubrik was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
DELETE /rubriken/1 DELETE /rubriken/1.json
+ + + ++# File app/controllers/rubriken_controller.rb, line 133 +def destroy + @rubrik = Rubrik.find(params[:id]) + @rubrik.destroy + redirect_to rubriken_url +end+
+# File app/controllers/rubriken_controller.rb, line 54 +def edit + @rubrik = Rubrik.find(params[:id]) +end+
+# File app/controllers/rubriken_controller.rb, line 4 +def index +# if can?(:showintern, Rubrik) +# @rubriken = Rubrik.all +# @neuigkeiten = Neuigkeit.page(params[:page]).per(3) +# else +# @rubriken = Rubrik.where(:public=>true) +# @neuigkeiten = Neuigkeit.public.published.page(params[:page]).per(3) +# end + + params[:month]= Date.today.month if params[:month].nil? + params[:year]= Date.today.year if params[:year].nil? + + @rubriken= Rubrik.accessible_by(current_ability, :show) + @neuigkeiten = Neuigkeit.accessible_by(current_ability, :list).page(params[:page]).per(3) + + @calentries= (@rubriken.map {|r| r.calendar.calentries.of_month(Date.new(params[:year].to_i,params[:month].to_i,1))}).flatten.select {|c| c.object !=nil} + respond_to do |format| + format.html + format.js {render action: :show} + end + +end+
+# File app/controllers/rubriken_controller.rb, line 26 +def intern + +end+
+# File app/controllers/rubriken_controller.rb, line 50 +def new + @rubrik = Rubrik.new +end+
+# File app/controllers/rubriken_controller.rb, line 88 +def removemoderator + rubrik = Rubrik.find(params[:id]) + m = User.find(params[:moderator]) + if m.has_role?(:newsmoderator,rubrik) + m.remove_role(:newsmoderator,rubrik) + end + redirect_to verwalten_rubrik_path(rubrik) +end+
+# File app/controllers/rubriken_controller.rb, line 29 +def show + @rubriken= Rubrik.accessible_by(current_ability, :show) + @rubrik = Rubrik.find(params[:id]) + @moderatoren=User.with_role(:newsmoderator,@rubrik) + + params[:month]= Date.today.month if params[:month].nil? + params[:year]= Date.today.year if params[:year].nil? + + @calentries= @rubrik.calendar.calentries.select {|c| c.object !=nil} + @neuigkeiten = @rubrik.neuigkeiten.accessible_by(current_ability, :list).page(params[:page]).per(3) + + @toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik + @toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik + + respond_to do |format| + format.html + format.js + end + +end+
+# File app/controllers/rubriken_controller.rb, line 97 +def update + @rubrik = Rubrik.find(params[:id]) + + respond_to do |format| + if @rubrik.update_attributes(params[:rubrik]) + format.html { redirect_to @rubrik, notice: 'Rubrik was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @rubrik.errors, status: :unprocessable_entity } + end + end +end+
+# File app/controllers/rubriken_controller.rb, line 111 + def verwalten + @rubrik = Rubrik.find(params[:id]) + @neuigkeiten_unpublished = @rubrik.neuigkeiten.unpublished + @neuigkeiten_published=@rubrik.neuigkeiten.published + @moderatoren=User.with_role(:newsmoderator,@rubrik) +@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'),:path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik + + + end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: semesters
+ +id :integer not null, primary key +name :string(255) +nummer :integer +studium_id :integer +ssws :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/semester.rb, line 21 +def name + if self.nummer == 0 + return I18n.t("ohnezuordnung") + " (" + self.studium.name + ")" + else + return self.nummer.to_s + "."+I18n.t("semester.semester")+", " + self.studium.name + end +end+
+# File app/models/semester.rb, line 28 +def name_kurz + if self.nummer == 0 + return I18n.t("ohnezuordnung") + " (" + self.studium.abkuerzung + ")" + else + return self.nummer.to_s + ". " + self.studium.abkuerzung + end +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/semesters_controller.rb, line 22 +def create + @semester = Semester.new(params[:semester]) + + + respond_to do |format| + if @semester.save + format.html { redirect_to @semester, notice: 'Semester was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
+# File app/controllers/semesters_controller.rb, line 47 +def destroy + @semester = Semester.find(params[:id]) + @semester.destroy + redirect_to semester_url + +end+
+# File app/controllers/semesters_controller.rb, line 17 +def edit + @semester = Semester.find(params[:id]) + @studium = @semester.studium +end+
+# File app/controllers/semesters_controller.rb, line 3 +def index + @semesters = Semester.all +end+
+# File app/controllers/semesters_controller.rb, line 13 +def new + @semester = Semester.new +end+
+# File app/controllers/semesters_controller.rb, line 8 +def show + @semester = Semester.find(params[:id]) + +end+
+# File app/controllers/semesters_controller.rb, line 35 +def update + @semester = Semester.find(params[:id]) + @studium= @semester.studium + respond_to do |format| + if @semester.update_attributes(params[:semester]) + format.html { redirect_to @semester, notice: 'Semester was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/studien_controller.rb, line 73 +def create + @studium = Studium.new(params[:studium]) + + respond_to do |format| + if @studium.save + @studium.batch_add_semester + format.html { redirect_to url_for(@studium), notice: 'Studium was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
+# File app/controllers/studien_controller.rb, line 261 +def default_url_options + + super.merge({:ansicht=> params[:ansicht], + :std_verw=> params[:std_verw], + :mg_verw=> params[:mg_verw], + :m_verw=>params[:m_verw], + :lva_verw=>params[:lva_verw], + :b_verw=>params[:b_verw], + :lec_verw=>params[:lec_verw]}) +end+
+# File app/controllers/studien_controller.rb, line 104 +def destroy + @studium = Studium.find(params[:id]) + @studium.destroy + redirect_to studien_url +end+
+# File app/controllers/studien_controller.rb, line 56 +def edit + @studien = Studium.accessible_by(current_ability, :show) + @studium = Studium.find(params[:id]) + @toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }] + @toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)} +end+
+# File app/controllers/studien_controller.rb, line 63 +def edit_lvas + @studien = Studium.accessible_by(current_ability, :show) + @studium = Studium.find(params[:id]) + @lvas=@studium.lvas.uniq + @semester=@studium.semester + @toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }] + @toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)} + +end+
+# File app/controllers/studien_controller.rb, line 5 +def index + @studien = Studium.accessible_by(current_ability, :show) + @topbar_elements=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}] + @topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path} + @topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path} + @toolbar_elements<<{:icon =>:plus, :hicon=>'icon-plus-sign', :text=> I18n.t('studien.new') ,:path=>new_studium_path } if can? :new, Studium + # @toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path } +end+
+# File app/controllers/studien_controller.rb, line 51 +def new + @studien = Studium.accessible_by(current_ability, :show) + @studium = Studium.new +end+
+# File app/controllers/studien_controller.rb, line 14 + def show + @studium= Studium.find(params[:id]) + @studien = Studium.accessible_by(current_ability, :show) + @studienphasen=[] + [1, 2 ,3].each do |ph| + modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph) + if modulgruppen_phase.count==1 + opts={:width=>12, :slice=>1} + elsif modulgruppen_phase.count <= 4 + opts={:width=>6, :slice=>2} + else + opts={:width=>4, :slice=>3} + end + modulgruppen =[] + modulgruppen_phase.each_slice(opts[:slice]) do |s| + modulgruppen<<s # + + end + @studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts) + end + @toolbar_elements=[] + + @toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)} if can? :edit, Studium +@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('lva.editlvas'),:path => edit_lvas_studium_path(@studium)} if can? :edit_lvas, Studium +@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' } if can? :delete, Studium + @toolbar_modulgruppen =[] + @toolbar_modulgruppen << {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)} if can? :new, Modulgruppe + #@toolbar_modulgruppen << {:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path} if can? :index, Modulgruppe + case params[:ansicht] + when 'semesteransicht' + when 'infoansicht' + when 'qualifikationsprofil' + else + params[:ansicht]="modulgruppenansicht" + end + end+
+# File app/controllers/studien_controller.rb, line 87 +def update + @studium = Studium.find(params[:id]) + @studien = Studium.accessible_by(current_ability, :show) + logger.info "params: #{params[:studium].inspect}" + if @studium.update_attributes(params[:studium]) + if @studium.lvas.map(&:valid?).all? + redirect_to url_for(@studium), notice: 'Studium was successfully updated.' + else + render action: "edit" + end + else + render action: "edit" + + end + +end+
+# File app/controllers/studien_controller.rb, line 110 +def verwalten + @new_params={:std_verw=>params[:std_verw], :mg_verw=>params[:mg_verw], :m_verw=>params[:m_verw], :lva_verw=>params[:lva_verw], :b_verw=>params[:b_verw], :lec_verw=>params[:lec_verw]} + if @new_params.values.compact.empty? + + + @modulgruppen=Modulgruppe.all + @module=Modul.all + @lvas=Lva.all + @beispiele=Beispiel.all + @lecturers=Lecturer.all + else + + if !@new_params[:std_verw].nil? + @studien = [Studium.find(@new_params[:std_verw])] + else + @studien = Studium.all + end + if !@new_params[:mg_verw].nil? + @modulgruppen = [Modulgruppe.find(@new_params[:mg_verw])] + temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien + @studien=@studien.select{|k| temp.include?(k)} + + else + @modulgruppen = Modulgruppe.all + temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen + @modulgruppen = @modulgruppen.select{|k| temp.include?(k)} + end + if !@new_params[:m_verw].nil? + @module = [Modul.find(@new_params[:m_verw])] + temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen + @modulgruppen = @modulgruppen.select{|k| temp.include?(k)} + temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien + @studien=@studien.select{|k| temp.include?(k)} + + else + @module = Modul.all + temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq + @module=@module.select{|k| temp.include?(k)} + end + if !@new_params[:lva_verw].nil? + @lvas = [Lva.find(@new_params[:lva_verw])] + temp = @lvas.map{|x| x.modul}.flatten.uniq + @module=@module.select{|k| temp.include?(k)} + temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen + @modulgruppen = @modulgruppen.select{|k| temp.include?(k)} + temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien + @studien=@studien.select{|k| temp.include?(k)} + else + @lvas = Lva.all + temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module + @lvas=@lvas.select{|k| temp.include?(k)} + end + if !@new_params[:b_verw].nil? + @beispiele = [Beispiel.find(@new_params[:b_verw])] + temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas + @lvas=@lvas.select{|k| temp.include?(k)} + temp = @lva.map{|x| x.moduls}.flatten.uniq #Force Module + @module=@module.select{|k| temp.include?(k)} + temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen + @modulgruppen = @modulgruppen.select{|k| temp.include?(k)} + temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien + @studien=@studien.select{|k| temp.include?(k)} + + + else + @beispiele = Beispiel.all + temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel + @beispiele=@beispiele.select{|k| temp.include?(k)} + end + if !@new_params[:lec_verw].nil? + @lecturers=[Lecturer.find(@new_params[:lec_verw])] + temp = @lecturers.map{|x| x.lvas}.flatten.uniq #Force Force Lvas + @lvas=@lvas.select{|k| temp.include?(k)} + temp = @lvas.map{|x| x.modul}.flatten.uniq #Force Force Lvas + @module=@module.select{|k| temp.include?(k)} + temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen + @modulgruppen = @modulgruppen.select{|k| temp.include?(k)} + temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien + @studien=@studien.select{|k| temp.include?(k)} + temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel + @beispiele=@beispiele.select{|k| temp.include?(k)} + else + @lecturers = @lvas.map{|k| k.lecturers}.flatten.uniq + end + end + + @messages = [] + for s in @studien + + if s.valid? + @messages << s.name + ' hat keine Modulgruppe' if s.modulgruppen.count == 0 + + else + @messages << '<font color="red"><b>'+s.name + ': ' + @messages << s.errors.full_messages + @messages << '</font></b>' + end + end + for mg in @modulgruppen + + if mg.valid? + @messages << mg.name + ' hat kein Modul' if mg.moduls.count == 0 + else + @messages << '<font color="red"><b>'+mg.name + ': ' + @messages << mg.errors.full_messages + @messages << '</font></b>' + end + end + for m in @module + + if m.valid? + @messages << m.name.to_s + ' hat keine Modulgruppe' if m.modulgruppen.count == 0 + @messages << m.name.to_s + ' hat keine Lvas' if m.lvas.count == 0 + else + @messages << '<font color="red"><b>'+m.name.to_s + ': ' + @messages << m.errors.full_messages + @messages << '</font></b>' + end + end + for lva in @lvas + + if lva.valid? + @messages << lva.name + ' hat keine Module' if lva.modul.count == 0 + for s in @studien + stu_sem = s.semester.map{|l| l.lvas}.flatten.uniq.index(lva) + stu_mod = s.modulgruppen.map{|m| m.moduls}.flatten.map{|l| l.lvas}.flatten.uniq.index(lva) + if (stu_sem.nil? && !stu_mod.nil?) + @messages << lva.name + ' erscheint nicht in der Semesteransicht von ' +s.name + ' aber in der Modulgruppenansicht' + end + if (!stu_sem.nil? && stu_mod.nil?) + @messages << lva.name + ' erscheint in der Semesteransicht von ' +s.name + ' aber nicht in der Modulgruppenansicht' + end + end + else + @messages << '<font color="red"><b>'+lva.name + ': ' + @messages << lva.errors.full_messages + @messages << '</font></b>' + end + end + for b in @beispiele + if b.valid? + @messages << b.name + ' hat keine Lva' if b.lva.nil? + else + @messages << '<font color="red"><b>'+b.name + ': ' + @messages << b.errors.full_messages + @messages << '</font></b>' + end + end + render 'studien/verwalten' +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: studien
+ +id :integer not null, primary key +zahl :string(255) +name :string(255) +shortdesc :text +desc :text +typ :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
+# File app/models/studium.rb, line 55 +def batch_add_semester + # Semester automatisch zu Studien hinzufügen + if self.typ == "Bachelor" + length = 6 + else + length = 4 + end + for i in 1..length + semester =Semester.new() + #semester.name = i.to_s + '. ' + self.name + semester.nummer = i + semester.ssws = ((i % 2 == 0) ? "SS" : "WS") + semester.save + self.semester << semester + end + semester = Semester.new() + #semester.name = 'Ohne Zuordnung (' + self.name + ')' + semester.nummer = 0 + semester.ssws = "WS" + semester.save + self.semester << semester +end+
+# File app/models/studium.rb, line 78 + def desc_first_words + md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.desc + unless md.nil? + md[:text].split(" ")[0..100].join(" ")+ " ..." + else + "" + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/survey/choice.rb, line 13 +def attributes_for_copy + self.attributes.select{|k,v| ["text","sort", "picture", "icon"].include?(k)} +end+
+# File app/models/survey/choice.rb, line 16 +def copy_from_template + cpy = Survey::Choice.new(self.attributes_for_copy) + cpy.save + cpy +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/survey/choices_controller.rb, line 53 +def create + @survey_choice = Survey::Choice.new(params[:survey_choice]) + @divid = divid_for(@survey_choice) + + respond_to do |format| + if @survey_choice.save + format.html { redirect_to @survey_choice, notice: 'Choice was successfully created.' } + format.json { render json: @survey_choice, status: :created, location: @survey_choice } + format.js + else + format.html { render action: "new" } + format.json { render json: @survey_choice.errors, status: :unprocessable_entity } + end + end +end+
DELETE /survey/choices/1 DELETE /survey/choices/1.json
+ + + ++# File app/controllers/survey/choices_controller.rb, line 87 + def destroy + @survey_choice = Survey::Choice.find(params[:id]) + + if @survey_choice.answers.count>0 + redirect_to action: :show +else + @divid = divid_for(@survey_choice) + @survey_choice.destroy + + respond_to do |format| + format.html { redirect_to survey_choices_url } + format.json { head :no_content } + format.js +end +end + end+
GET /survey/choices/1/edit
+ + + ++# File app/controllers/survey/choices_controller.rb, line 42 +def edit + @choice = Survey::Choice.find(params[:id]) + respond_to do |format| + format.html + format.js + end +end+
+# File app/controllers/survey/choices_controller.rb, line 6 +def index + @survey_choices = Survey::Choice.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @survey_choices } + end +end+
GET /survey/choices/new GET /survey/choices/new.json
+ + + ++# File app/controllers/survey/choices_controller.rb, line 29 +def new + @question= Survey::Question.find(params[:question_id]) + + @choice=Survey::Choice.new + @choice.question=@question + respond_to do |format| + format.js + format.html # new.html.erb + format.json { render json: @survey_choice } + end +end+
GET /survey/choices/1 GET /survey/choices/1.json
+ + + ++# File app/controllers/survey/choices_controller.rb, line 17 +def show + @survey_choice = Survey::Choice.find(params[:id]) + + respond_to do |format| + format.html {redirect_to @survey_choice.question} + format.json { render json: @survey_choice } + format.js + end +end+
PUT /survey/choices/1 PUT /survey/choices/1.json
+ + + ++# File app/controllers/survey/choices_controller.rb, line 71 + def update + @survey_choice = Survey::Choice.find(params[:id]) + + respond_to do |format| + if @survey_choice.update_attributes(params[:survey_choice]) + format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @survey_choice.errors, status: :unprocessable_entity } +5 end + end + end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/survey/question.rb, line 30 +def add_yesno_choices + c=Survey::Choice.new(title: "Ja") + c.save + this.choices << c + c=Survey::Choice.new(title: "Nein") + c.save + this.choices << c +end+
+# File app/models/survey/question.rb, line 26 +def attributes_for_copy + self.attributes.select{|k,v| ["title","text","typ"].include?(k)} +end+
+# File app/models/survey/question.rb, line 12 +def copy_from_template_for(parent) + unless self.flag_template + return nil + else + cpy = Survey::Question.new(self.attributes_for_copy) + cpy.parent=parent + cpy.save + self.choices.each do |c| + cpy.choices << c.copy_from_template + end + cpy + end +end+
+# File app/models/survey/question.rb, line 39 +def do_answer(choice_ids, user) + unless (user.nil? || choice_ids.nil? || choice_ids.empty?) + cid=choice_ids.map{|c|c.to_i} + if (Survey::Answer.where(user_id: user.id, choice_id: cid).count > 0 ) + found_ids=Survey::Answer.where(user_id: user.id, choice_id: cid).includes(:choice).pluck(:choice_id) + cid= cid - found_ids + Survey::Answer.where(user_id: user.id, choice_id: found_ids).delete_all + else + if self.typ == 0 + Survey::Answer.where(user_id: user.id, choice_id: self.choice_ids).delete_all + end + end + cid.each do |c| + if self.choice_ids.include?(c) + a=Survey::Answer.new(user_id: user.id, choice_id: c.to_i) + a.save + end + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/survey/questions_controller.rb, line 13 +def answer + @survey_question = Survey::Question.find(params[:id]) + if (params[:key].nil? || params[:key].empty?) + user = current_user + else + k=Key.find_by_uuid(params[:key] ) + if k.is_valid && k.typ==3 && k.parent == @survey_question + user = k.user + end + end + + @survey_question.do_answer(params[:survey_question][:selected],user) + respond_to do |format| + format.html { redirect_to action: :show} + format.js { render action: :show} + end +end+
POST /survey/questions POST /survey/questions.json
+ + + ++# File app/controllers/survey/questions_controller.rb, line 66 +def create + @survey_question = Survey::Question.new(params[:survey_question]) + @survey_question.user=current_user + respond_to do |format| + if @survey_question.save + format.html { redirect_to @survey_question, notice: 'Question was successfully created.' } + else + format.html { render action: "new" } + end + end +end+
GET /survey/questions/1 GET /survey/questions/1.json
+ + + ++# File app/controllers/survey/questions_controller.rb, line 32 +def create_from_template + @template = Survey::Question.find(params[:id]) + parent= params[:parent_type].constantize.find(params[:parent_id]) + @survey_question = @template.copy_from_template_for(parent) + @survey_question.user=current_user + render action: :show +end+
DELETE /survey/questions/1 DELETE /survey/questions/1.json
+ + + ++# File app/controllers/survey/questions_controller.rb, line 95 +def destroy + @survey_question = Survey::Question.find(params[:id]) + @survey_question.destroy + + respond_to do |format| + format.html { redirect_to survey_questions_url } + + end +end+
GET /survey/questions/1/edit
+ + + ++# File app/controllers/survey/questions_controller.rb, line 60 +def edit + @survey_question = Survey::Question.find(params[:id]) +end+
+# File app/controllers/survey/questions_controller.rb, line 6 +def index + @survey_questions = Survey::Question.all + respond_to do |format| + format.html # index.html.erb + end +end+
GET /survey/questions/new GET /survey/questions/new.json
+ + + ++# File app/controllers/survey/questions_controller.rb, line 50 +def new + @survey_question = Survey::Question.new + @parent=params[:parent_type].constantize.find(params[:parent_id]) + @survey_question.parent=@parent + respond_to do |format| + format.html # new.html.erb + end +end+
+# File app/controllers/survey/questions_controller.rb, line 40 +def show + @survey_question = Survey::Question.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + end +end+
PUT /survey/questions/1 PUT /survey/questions/1.json
+ + + ++# File app/controllers/survey/questions_controller.rb, line 80 +def update + @survey_question = Survey::Question.find(params[:id]) + @survey_question.user=current_user + @survey_question.save + respond_to do |format| + if @survey_question.update_attributes(params[:survey_question]) + format.html { redirect_to @survey_question, notice: 'Question was successfully updated.' } + else + format.html { render action: "edit" } + end + end +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/helpers/survey/questions_helper.rb, line 2 +def new_question_for(obj,t="Neue Frage") + render partial: "survey/questions/new_question", locals: {question_templates: Survey::Question.templates, parent: obj, text: t} +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ ++# File app/models/thema.rb, line 75 +def fix_links(host) + full_url= URI.parse(root_url(:host=>host)) + self.text.gsub!(/src="[\.\/]*uploads\/attachment\/datei\/(\d+)\/thumb_big[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.thumb_big.url; 'src="'+full_url.to_s+'"'} + self.text.gsub!(/src="[\.\/^"]*uploads\/attachment\/datei\/(\d+)\/[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'} + self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'} +end+
+# File app/models/thema.rb, line 57 +def is_outdated? + unless translation.try(:updated_at).nil? + translation.updated_at < 7.month.ago + else + false + end +end+
+# File app/models/thema.rb, line 65 +def text_first_words + md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) + words=md[:text].split(" ") unless md.nil? + if words.nil? || words.empty? + "...." + else + words[0..100].join(" ")+ " ..." unless words.nil? + end +end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/themen_controller.rb, line 126 +def attachments + @thema = Thema.find(params[:id]) + @attachments=@thema.attachments + @attachment=Attachment.new + respond_to do |format| + format.js + end +end+
POST /themen POST /themen.json
+ + + ++# File app/controllers/themen_controller.rb, line 88 +def create + @thema = Thema.new(params[:thema]) + @themen = @thema.themengruppe.themen.order(:priority).reverse + + respond_to do |format| + if @thema.save + @themen = @thema.themengruppe.themen.order(:priority).reverse + format.html { redirect_to @thema, notice: I18n.t("thema.created") } + format.json { render json: @thema, status: :created, location: @thema } + format.js {render action: "update"} + else + @themen = @thema.themengruppe.themen.order(:priority).reverse + format.html { render action: "new" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + format.js { render action: "edit" } + end + end +end+
DELETE /themen/1 DELETE /themen/1.json
+ + + ++# File app/controllers/themen_controller.rb, line 163 +def destroy + @thema = Thema.find(params[:id]) + @thema.destroy + @themen = @thema.themengruppe.themen.order(:priority).reverse + respond_to do |format| + format.html { redirect_to themengruppe_path(@thema.themengruppe) } + format.json { head :no_content } + end +end+
+# File app/controllers/themen_controller.rb, line 119 +def documents + @thema = Thema.find(params[:id]) + @documents=@thema.documents + respond_to do |format| + format.js + end +end+
GET /themen/1/edit
+ + + ++# File app/controllers/themen_controller.rb, line 76 +def edit + @thema = Thema.find(params[:id]) + + + respond_to do |format| + format.html + format.js { @themen= @thema.themengruppe.themen } + end +end+
+# File app/controllers/themen_controller.rb, line 112 +def fragen + @thema = Thema.find(params[:id]) + @fragen=@thema.fragen + respond_to do |format| + format.js + end +end+
+# File app/controllers/themen_controller.rb, line 6 +def index + @themen = Thema.accessible_by(current_ability,:show).where(:isdraft=>false) + @themen_drafts = Thema.accessible_by(current_ability,:show).where(:isdraft=>true) + @themen_outdated =Thema.accessible_by(current_ability,:show).outdated +end+
+# File app/controllers/themen_controller.rb, line 106 +def is_updated + @thema = Thema.find(params[:id]) + @thema.translation.touch + + redirect_to @thema +end+
GET /themen/new GET /themen/new.json
+ + + ++# File app/controllers/themen_controller.rb, line 65 +def new + @thema = Thema.new + @thema.themengruppe = Themengruppe.find(params[:themengruppe_id]) unless params[:themengruppe_id].nil? + respond_to do |format| + format.html # new.html.erb + format.json { render json: @thema } + format.js { render action: "edit" } + end +end+
+# File app/controllers/themen_controller.rb, line 26 +def sanitize + require 'sanitize' + @thema = Thema.find(params[:id]) + @fragen = @thema.fragen + trans_icons= lambda do |env| + node=env[:node] + node_name=env[:node_name] + return if env[:is_whitelisted] || !node.element? + return unless node_name == 'span' + # return unless node["class"] =~ /.*ffi.*/ + Sanitize.node!(node,{:elements=>["span"],:attributes=>{"span"=>["class","style"]},:css=>{:properties=>["color"]}}) + {:node_whitelist=>[node]} + end + @thema.text = Sanitize.fragment(@thema.text, {:elements=>['table','tr','td','p','h1','h2','h3','h4','h5','a','th','img','ul','li','i','b','em','pre','code'],:attributes=>{'p'=>['class'],'table'=>['class'],'a'=>['href','data'],'img'=>['src','width','height'],:all=>['class']},:css=>{:properties=>['float']},:transformers=>[trans_icons]}) + # # # + # # + # # + # + # @thema.text = @thema.text.sanitize + render :edit +end+
+# File app/controllers/themen_controller.rb, line 11 + def show + @thema = Thema.find(params[:id]) + @fragen=@thema.fragen + + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("thema.manage"), :path=>verwalten_thema_path(@thema)}] + @toolbar_elements << [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] + @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} + + respond_to do |format| + format.html { +# redirect_to :controller=>'themengruppen', :id=>@thema.themengruppe.id, :action=>:show, :anchor=> "thema_"+params[:id].to_s + } + format.js + end + end+
PUT /themen/1 PUT /themen/1.json
+ + + ++# File app/controllers/themen_controller.rb, line 136 + def update + @thema = Thema.find(params[:id]) + @themen = @thema.themengruppe.themen.order(:priority).reverse + @thema.assign_attributes(params[:thema]) +# @thema.fix_links(request.host_with_port) + + respond_to do |format| + if @thema.save + format.html { + if params["button"]=="continue" + render action: "edit", notice: I18n.t("thema.updated") + else + redirect_to @thema, notice: I18n.t("thema.updated") + end + } + format.json { head :no_content } + format.js + else + format.html { render action: "edit" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + format.js { render action: "edit" } + end + end + end+
+# File app/controllers/themen_controller.rb, line 47 +def version + @thema = Thema.find(params[:id]) + +end+
+# File app/controllers/themen_controller.rb, line 52 +def verwalten + @thema = Thema.find(params[:id]) + @attachment=Attachment.new + @fragen=@thema.fragen + + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] + @toolbar_elements <<{ :hicon=>'icon-leaf', :text=>"Sanitize", :path=>sanitize_thema_path(@thema)} + + @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} + +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: themengruppen
+ +id :integer not null, primary key +title :string(255) +text :text +created_at :datetime not null +updated_at :datetime not null+ +
Generated with the Darkfish + Rdoc Generator 2.
+POST /themengruppen POST /themengruppen.json
+ + + ++# File app/controllers/themengruppen_controller.rb, line 99 +def create + @themengruppe = Themengruppe.new(params[:themengruppe]) + + respond_to do |format| + if @themengruppe.save + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully created.' } + format.json { render json: @themengruppe, status: :created, location: @themengruppe } + else + format.html { render action: "new" } + format.json { render json: @themengruppe.errors, status: :unprocessable_entity } + end + end +end+
DELETE /themengruppen/1.json
+ + + ++# File app/controllers/themengruppen_controller.rb, line 129 +def destroy + @themengruppe = Themengruppe.find(params[:id]) + @themengruppe.destroy + + respond_to do |format| + format.html { redirect_to themengruppen_url } + format.json { head :no_content } + end +end+
GET /themengruppen/1/edit
+ + + ++# File app/controllers/themengruppen_controller.rb, line 48 +def edit + @themengruppe = Themengruppe.find(params[:id]) +end+
+# File app/controllers/themengruppen_controller.rb, line 16 +def faqs + @themengruppen = Themengruppe.accessible_by(current_ability, :show).order("themengruppen.priority").includes(:themen,{themen: :fragen}).order("themen.priority") + +end+
+# File app/controllers/themengruppen_controller.rb, line 5 +def index + @themengruppen = Themengruppe.accessible_by(current_ability, :show).public.includes(:themen) + @toolbar_elements = [] + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()} if can? :new, Themengruppe + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()} if can? :verwalten_all, Themengruppe + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @themengruppen } + end +end+
GET /themengruppen/new GET /themengruppen/new.json
+ + + ++# File app/controllers/themengruppen_controller.rb, line 38 +def new + @themengruppe = Themengruppe.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @themengruppe } + end +end+
GET /themengruppen/1 GET /themengruppen/1.json
+ + + ++# File app/controllers/themengruppen_controller.rb, line 23 +def show + @themengruppe = Themengruppe.find(params[:id]) + @themen=@themengruppe.themen.accessible_by(current_ability, :show) + + @toolbar_elements = [] + @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @themengruppe } + end +end+
+# File app/controllers/themengruppen_controller.rb, line 83 +def sort_themen + @params=params + i=1 + params['themen'].reverse.each do |themaid| + thema=Thema.find(themaid) + thema.priority=i + thema.save + i=i+1 + end + respond_to do |format| + format.js + end +end+
+# File app/controllers/themengruppen_controller.rb, line 68 +def sort_themengruppen + @params=params + i=1 + params['themengruppen'].reverse.each do |themengruppeid| + themengruppe=Themengruppe.find(themengruppeid) + themengruppe.priority=i + themengruppe.save + i=i+1 + end + respond_to do |format| + format.js + end + +end+
PUT /themengruppen/1 PUT /themengruppen/1.json
+ + + ++# File app/controllers/themengruppen_controller.rb, line 115 +def update + @themengruppe = Themengruppe.find(params[:id]) + + respond_to do |format| + if @themengruppe.update_attributes(params[:themengruppe]) + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @themengruppe.errors, status: :unprocessable_entity } + end + end +end+
+# File app/controllers/themengruppen_controller.rb, line 57 +def verwalten + @themengruppe = Themengruppe.find(params[:themengruppe_id]) + @themen = @themengruppe.themen + + @toolbar_elements =[] + @toolbar_elements << {:text=>I18n.t('themengruppe.show'), :path=>themengruppe_path(@themengruppe)} if can? :show, @themengruppe + @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('themengruppe.edit'), :path=>edit_themengruppe_path(@themengruppe)} if can? :edit, @themengruppe + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('thema.add'), :path=>new_themengruppe_thema_path(@themengruppe), :remote=>true} if can? :new, Thema + @toolbar_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('themengruppe.remove'), :path=>themengruppe_path(@themengruppe), :method=>:delete,:confirm=>I18n.t('themengruppe.sure')} if can? :delete, @themengruppe +end+
+# File app/controllers/themengruppen_controller.rb, line 51 +def verwalten_all + @themengruppen =Themengruppe.public.order(:priority).reverse + @themengruppen_intern =Themengruppe.intern.order(:priority).reverse + @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}] + +end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+FormtasticBootstrap::Inputs::TextInput
+ +Generated with the Darkfish + Rdoc Generator 2.
+Formtastic::Inputs::FileInput
+ +A formtastic input which incorporates carrierwave uploader functionality.
+ +Intelligently adds the cache field, displays and links to the current value +if there is one, adds a class to the wrapper when replacing an existing +value, allows removing an existing value with the checkbox taking into +account validation requirements.
+ +There are several options:
+ +* Toggle the replacement field with `replaceable: true/false`. +* The replace file label is translatable as `replace_label` or using option `replace_label: "value"` (like `label`). +* Toggle the remove checkbox with `removable: true/false` (`true` overrides `required`). +* The remove checkbox label is translatable as `remove_label` or using option `remove_label: "value"` (like `label`). +* Override existing file display and links using `existing_html` and `existing_link_html` (like `wrapper_html`).+ +
Example: `form.input :file, as: “uploader”`
+ +Copyright © Samuel Cochran 2012, under the [MIT license](www.opensource.org/licenses/mit-license).
+ ++# File app/inputs/uploader_input.rb, line 66 +def cache_html + if method_changed? + builder.hidden_field("#{method}_cache") + end or "".html_safe +end+
+# File app/inputs/uploader_input.rb, line 88 +def existing_html + if method_present? + # TODO: Add classes based on mime type for icons, etc. + existing = template.content_tag(:span, template.image_tag( object.send(method).thumb), existing_html_options) + template.link_to_if linkable?, existing, object.send(method).url, existing_link_html_options + end or "".html_safe +end+
+# File app/inputs/uploader_input.rb, line 76 +def existing_html_options + expand_html_options(options[:existing_html]) do |opts| + opts[:class] << "existing" + end +end+
+# File app/inputs/uploader_input.rb, line 82 +def existing_link_html_options + expand_html_options(options[:existing_link_html]) do |opts| + opts[:class] << "existing" + end +end+
+# File app/inputs/uploader_input.rb, line 72 +def file_html + builder.file_field(method, input_html_options) +end+
+# File app/inputs/uploader_input.rb, line 20 +def linkable? + options[:linkable] != false +end+
+# File app/inputs/uploader_input.rb, line 40 +def method_changed? + if object.respond_to? "#{method}_changed?" + object.send "#{method}_changed?" + else + false + end +end+
+# File app/inputs/uploader_input.rb, line 32 +def method_present? + if object.respond_to?("#{method}?") + object.send("#{method}?") + else + object.send(method).present? + end +end+
+# File app/inputs/uploader_input.rb, line 48 +def method_was_present? + if not method_changed? + method_present? + else + object.send("#{method}_was").present? + end +end+
+# File app/inputs/uploader_input.rb, line 28 +def removable? + options[:removable] != false and (options[:removable] == true or not required?) +end+
+# File app/inputs/uploader_input.rb, line 109 +def remove_html + if removable? + template.content_tag(:label, class: "remove_label") do + template.check_box_tag("#{object_name}[remove_#{method}]", "1", false, id: "#{sanitized_object_name}_remove_#{sanitized_method_name}") << + # XXX: There are probably better ways to do these translations using defaults. + template.content_tag(:span, localized_string(method, "Remove #{method.to_s.titleize}", :remove_label)) + end + end or "".html_safe +end+
+# File app/inputs/uploader_input.rb, line 102 +def replace_html + if replaceable? + replace_label_html << + file_html + end or "".html_safe +end+
+# File app/inputs/uploader_input.rb, line 96 +def replace_label_html + template.content_tag(:label, class: "replace_label") do + template.content_tag(:span, localized_string(method, "Replace #{method.to_s.titleize}", :replace_label)) + end +end+
+# File app/inputs/uploader_input.rb, line 24 +def replaceable? + options[:replaceable] != false +end+
+# File app/inputs/uploader_input.rb, line 119 +def to_html + input_wrapping do + label_html << + cache_html << + if method_was_present? + existing_html << + replace_html << + remove_html + else + existing_html << + file_html + end + end +end+
+# File app/inputs/uploader_input.rb, line 56 +def wrapper_html_options + super.tap do |options| + options[:class] << " replaceable" if replaceable? + options[:class] << " removable" if removable? + options[:class] << " present" if method_present? + options[:class] << " changed" if method_changed? + options[:class] << " was_present" if method_was_present? + end +end+
+# File app/inputs/uploader_input.rb, line 136 +def expand_html_options opts + (opts || {}).dup.tap do |opts| + opts[:class] = + case opts[:class] + when Array + opts[:class].dup + when nil + [] + else + [opts[:class].to_s] + end + opts[:data] = + case opts[:data] + when Hash + opts[:data].dup + when nil + {} + else + {"" => opts[:data].to_s} + end + + yield opts if block_given? + + opts[:class] = opts[:class].join(' ') + end +end+
Generated with the Darkfish + Rdoc Generator 2.
+ActiveRecord::Base
+ +Table name: users
+ +id :integer not null, primary key
+email :string(255) default(""), not null
+encrypted_password :string(255) default(""), not null
+reset_password_token :string(255)
+reset_password_sent_at :datetime
+remember_created_at :datetime
+sign_in_count :integer default(0)
+current_sign_in_at :datetime
+last_sign_in_at :datetime
+current_sign_in_ip :string(255)
+last_sign_in_ip :string(255)
+confirmation_token :string(255)
+confirmed_at :datetime
+confirmation_sent_at :datetime
+unconfirmed_email :string(255)
+failed_attempts :integer default(0)
+unlock_token :string(255)
+locked_at :datetime
+created_at :datetime not null
+updated_at :datetime not null
+
+ attr_accessible :title, :body
+ + + ++# File app/models/user.rb, line 38 + def self.find_for_facebook_oauth(auth, signed_in_resource=nil) +logger.debug auth.to_s + logger.debug "DDD Username= #{auth.username}" + user = User.where(:provider => auth.provider, :uid => auth.uid).first + unless user + user = User.create(name: auth.uid, + provider:auth.provider, + uid: auth.uid, + email:auth.info.email, + password:Devise.friendly_token[0,20] + ) + end + + + user + end+
+# File app/models/user.rb, line 54 + def self.find_for_ldap_oauth(auth,signed_in_resource=nil) + # debug "sdfg" + + user= User.where(:provider=>auth.provider,:uid=>auth.extra.raw_info.uid).first + unless user + user= User.create(name:auth.extra.raw_info.uid.first, + provider:auth.provider, + uid:auth.extra.raw_info.uid.first, + email:auth.extra.raw_info.mail.first.to_s, + password:Devise.friendly_token[0,20]) + user.add_role("fetuser") + logger.debug(auth.extra.raw_info.to_s) + end + user +end+
+# File app/models/user.rb, line 70 +def self.new_with_session(params, session) + super.tap do |user| + if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"] + user.email = data["email"] if user.email.blank? + end + end + end+
Generated with the Darkfish + Rdoc Generator 2.
+Generated with the Darkfish + Rdoc Generator 2.
+Devise::OmniauthCallbacksController
+ ++# File app/controllers/users/omniauth_callbacks_controller.rb, line 10 +def facebook + # You need to implement the method below in your model (e.g. app/models/user.rb) + @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) + data=request.env["omniauth.auth"] + session[:fbuser_access_token]=data.credentials.token + + if @user + sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated + set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format? + else + session["devise.facebook_data"] = request.env["omniauth.auth"] + redirect_to new_user_registration_url + end +end+
+# File app/controllers/users/omniauth_callbacks_controller.rb, line 4 +def failure + + # flash[:notice] = "Failure #{Hash.new(request.env)} #{Hash.new(params)}" + #redirect_to new_user_registration_url , :notice=>"Omniauth Login failed" + super +end+
+# File app/controllers/users/omniauth_callbacks_controller.rb, line 25 + def ldap +logger.debug current_user.to_s + @user=User.find_for_ldap_oauth(request.env["omniauth.auth"],current_user) + # @user=User.find_for_ldap_oauth(session["devise.ldap_data"],current_user) + # @user=User.first +# flash[:notice]="#{request.env}" + # sign_in_and_redirect @user, :event=>:authentication +# debug @user +#debug + # logger.info "Request attributes hash: #{request.env}" + if @user + sign_in_and_redirect @user, :event => :authentication + set_flash_message(:notice,:success,:kind=>"Ldap") if is_navigational_format? + else + session["devise.ldap_data"]=request.env["omniauth.auth"] + # set_flash_message(:notice, "sdfsdf") + flash[:notice]=flash[:notice] + "Still not logged in " + redirect_to new_user_registration_url + end + end+
Generated with the Darkfish + Rdoc Generator 2.
++# File app/controllers/users_controller.rb, line 18 +def add_role + authorize!(:add_role, User) + @user= User.find(params[:id]) + if (params[:role]=="fetuser" && can?(:addfetuser,User)) + @user.add_role(params[:role]) + end + if (params[:role]=="fetadmin" && can?(:addfetadmin,User)) + @user.add_role(params[:role]) + end + redirect_to users_url +end+
+# File app/controllers/users_controller.rb, line 45 +def all_update + authorize! :doadmin,User + params[:users].each do |id,u| + user=User.find(id) + user.fetprofile = Fetprofile.find(u[:fetprofile_id].to_i) if u[:fetprofile_id].to_i>0 + user.save if can? :edit, User + end + redirect_to users_url +end+
+# File app/controllers/users_controller.rb, line 55 +def do_confirm + @user= User.find(params[:id]) + @user.confirm! + redirect_to users_url +end+
+# File app/controllers/users_controller.rb, line 29 +def fb_set_default_publish_page + authorize!(:doadmin, User) + + if Fetsite::Application.config.facebookconfig_enabled + if params["page"].nil? || !(current_user.provider=="facebook") + redirect_to intern_home_index_path + else + @fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"]) + File.open("config/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)} + logger.info @fbu.to_s + logger.info "FbGraph Access" + session["fbuser_access_token"] + redirect_to admin_home_index_path + end + end +end+
+# File app/controllers/users_controller.rb, line 2 +def index + authorize!(:index,User) + @users = User.all +end+
+# File app/controllers/users_controller.rb, line 11 +def set_preferred_theme + @user=User.find(params[:id]) + authorize!(:set_preferred_theme, @user) + @user.preferredtheme=params[:theme] + @user.save + redirect_to root_url +end+
Generated with the Darkfish + Rdoc Generator 2.
+A formtastic input which incorporates carrierwave uploader functionality.
+ +Intelligently adds the cache field, displays and links to the current value +if there is one, adds a class to the wrapper when replacing an existing +value, allows removing an existing value with the checkbox taking into +account validation requirements.
+ +There are several options:
+ +* Toggle the replacement field with `replaceable: true/false`. +* The replace file label is translatable as `replace_label` or using option `replace_label: "value"` (like `label`). +* Toggle the remove checkbox with `removable: true/false` (`true` overrides `required`). +* The remove checkbox label is translatable as `remove_label` or using option `remove_label: "value"` (like `label`). +* Override existing file display and links using `existing_html` and `existing_link_html` (like `wrapper_html`).+ +
Example: `form.input :file, as: “uploader”`
+ +Copyright © Samuel Cochran 2012, under the [MIT license](www.opensource.org/licenses/mit-license).
+ +Table name: attachments
+ +id :integer not null, primary key +name :string(255) +datei :string(255) +created_at :datetime not null +updated_at :datetime not null +thema_id :integer+ +
Table name: beispiele
+ +id :integer not null, primary key +name :string(255) +desc :text +lva_id :integer +created_at :datetime not null +updated_at :datetime not null +beispieldatei :string(255)+ +
Table name: calendars
+ +id :integer not null, primary key +name :string(255) +public :boolean +created_at :datetime not null +updated_at :datetime not null +picture :string(255)+ +
Table name: calentries
+ +id :integer not null, primary key +start :datetime +ende :datetime +summary :string(255) +typ :integer +created_at :datetime not null +updated_at :datetime not null+ +
Table name: fetprofiles
+ +id :integer not null, primary key +vorname :string(255) +nachname :string(255) +short :string(255) +fetmailalias :string(255) +desc :text +picture :string(255) +active :boolean +created_at :datetime not null +updated_at :datetime not null+ +
Table name: fetzneditions
+ +id :integer not null, primary key +title :string(255) +desc :text +datum :date +datei :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: fotos
+ +id :integer not null, primary key +title :string(255) +desc :text +gallery_id :integer +datei :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: fragen
+ +id :integer not null, primary key +title :string(255) +text :text +created_at :datetime not null +updated_at :datetime not null +thema_id :integer+ +
Table name: galleries
+ +id :integer not null, primary key +name :string(255) +desc :text +datum :date +created_at :datetime not null +updated_at :datetime not null+ +
Table name: gremien
+ +id :integer not null, primary key +name :string(255) +desc :text +typ :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: lecturers
+ +id :integer not null, primary key +name :string(255) +email :string(255) +oid :integer +picture :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: lvas
+ +id :integer not null, primary key +name :string(255) +desc :text +ects :decimal(, ) +lvanr :string(255) +stunden :decimal(, ) +created_at :datetime not null +updated_at :datetime not null +modul_id :integer +semester_id :integer +pruefungsinformation :text +lernaufwand :text +typ :string(255)+ +
Table name: memberships
+ +id :integer not null, primary key +fetprofile_id :string(255) +gremium_id :string(255) +start :date +stop :date +typ :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: moduls
+ +id :integer not null, primary key +name :string(255) +desc :text +depend :text +created_at :datetime not null +updated_at :datetime not null+ +
Table name: modulgruppen
+ +id :integer not null, primary key +typ :string(255) +phase :integer +name :string(255) +desc :text +studium_id :integer +created_at :datetime not null +updated_at :datetime not null+ +
Table name: neuigkeiten
+ +id :integer not null, primary key +title :string(255) +text :text +datum :datetime +rubrik_id :integer +created_at :datetime not null +updated_at :datetime not null +author_id :integer+ +
Table name: roles
+ +id :integer not null, primary key +name :string(255) +resource_id :integer +resource_type :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: rubriken
+ +id :integer not null, primary key +name :string(255) +desc :text +prio :integer +created_at :datetime not null +updated_at :datetime not null+ +
Table name: semesters
+ +id :integer not null, primary key +name :string(255) +nummer :integer +studium_id :integer +ssws :string(255) +created_at :datetime not null +updated_at :datetime not null+ +
Table name: studien
+ +id :integer not null, primary key +zahl :string(255) +name :string(255) +shortdesc :text +desc :text +typ :string(255) +created_at :datetime not null +updated_at :datetime not null +abkuerzung :string(255)+ +
Table name: themen
+ +id :integer not null, primary key +title :string(255) +text :text +created_at :datetime not null +updated_at :datetime not null +themengruppe_id :integer ID of themengruppe +isdraft :boolean True if this topic is only a draft an should not be visible to public + hidelink :boolean true if link to this topic should not be visible in the list +hideattachment :boolean hide the attachment table in the view - doesnt hide attachments that are linked and doesn't protect them +sticky_startpage :boolean if true topic is sticked on the start page +sticky_intern : boolean if true this topic is sticked at the intern page+ +
Table name: themengruppen
+ +id :integer not null, primary key +title :string(255) +text :text +created_at :datetime not null +updated_at :datetime not null+ +
Table name: users
+ +id :integer not null, primary key
+email :string(255) default(""), not null
+encrypted_password :string(255) default(""), not null
+reset_password_token :string(255)
+reset_password_sent_at :datetime
+remember_created_at :datetime
+sign_in_count :integer default(0)
+current_sign_in_at :datetime
+last_sign_in_at :datetime
+current_sign_in_ip :string(255)
+last_sign_in_ip :string(255)
+confirmation_token :string(255)
+confirmed_at :datetime
+confirmation_sent_at :datetime
+unconfirmed_email :string(255)
+failed_attempts :integer default(0)
+unlock_token :string(255)
+locked_at :datetime
+created_at :datetime not null
+updated_at :datetime not null
+
+ Use this README file to introduce your application and point to useful +places in the API for learning more. Run “rake doc:app” to generate API +documentation for your models, controllers, helpers, and libraries.
+ +Generated with the Darkfish + Rdoc Generator 2.
+This is the API documentation for 'Rails Application Documentation'.
+ + + + +Generated with the Darkfish + Rdoc Generator 2.
+