From 8cf8c5e2edb3e519d32267ddbdf13c5e11d7242d Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 19 Mar 2015 16:48:11 -0300 Subject: [PATCH] Remove proposals_discussion plugin --- plugins/proposals_discussion/controllers/myprofile/proposals_discussion_plugin_myprofile_controller.rb | 38 -------------------------------------- plugins/proposals_discussion/controllers/profile/proposals_discussion_plugin_profile_controller.rb | 16 ---------------- plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb | 51 --------------------------------------------------- plugins/proposals_discussion/lib/proposals_discussion_plugin.rb | 47 ----------------------------------------------- plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb | 42 ------------------------------------------ plugins/proposals_discussion/lib/proposals_discussion_plugin/proposal.rb | 51 --------------------------------------------------- plugins/proposals_discussion/lib/proposals_discussion_plugin/proposals_list_helper.rb | 11 ----------- plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb | 74 -------------------------------------------------------------------------- plugins/proposals_discussion/lib/proposals_discussion_plugin/topic_helper.rb | 12 ------------ plugins/proposals_discussion/public/flotr2.min.js | 27 --------------------------- plugins/proposals_discussion/public/images/score.png | Bin 1645 -> 0 bytes plugins/proposals_discussion/public/jquery.jscroll.min.js | 15 --------------- plugins/proposals_discussion/public/jquery.masonry.min.js | 10 ---------- plugins/proposals_discussion/public/proposals_graph.js | 57 --------------------------------------------------------- plugins/proposals_discussion/public/proposals_list.js | 57 --------------------------------------------------------- plugins/proposals_discussion/public/style.css | 250 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/proposals_discussion/test/functional/cms_controller_test.rb | 33 --------------------------------- plugins/proposals_discussion/test/functional/content_viewer_controller_test.rb | 21 --------------------- plugins/proposals_discussion/test/functional/proposals_discussion_plugin_myprofile_controller_test.rb | 49 ------------------------------------------------- plugins/proposals_discussion/test/functional/proposals_discussion_plugin_profile_controller_test.rb | 37 ------------------------------------- plugins/proposals_discussion/test/functional/proposals_discussion_plugin_public_controller_test.rb | 98 -------------------------------------------------------------------------------------------------- plugins/proposals_discussion/test/test_helper.rb | 1 - plugins/proposals_discussion/test/unit/discussion_test.rb | 27 --------------------------- plugins/proposals_discussion/test/unit/proposal_test.rb | 54 ------------------------------------------------------ plugins/proposals_discussion/test/unit/proposals_discussion_plugin_test.rb | 70 ---------------------------------------------------------------------- plugins/proposals_discussion/test/unit/topic_test.rb | 50 -------------------------------------------------- plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_discussion.html.erb | 9 --------- plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_proposal.html.erb | 35 ----------------------------------- plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_topic.html.erb | 18 ------------------ plugins/proposals_discussion/views/content_viewer/_proposal_card.html.erb | 28 ---------------------------- plugins/proposals_discussion/views/content_viewer/_proposals_list.html.erb | 27 --------------------------- plugins/proposals_discussion/views/content_viewer/_proposals_list_content.html.erb | 7 ------- plugins/proposals_discussion/views/content_viewer/_social.html.erb | 3 --- plugins/proposals_discussion/views/content_viewer/discussion.html.erb | 33 --------------------------------- plugins/proposals_discussion/views/content_viewer/proposal.html.erb | 31 ------------------------------- plugins/proposals_discussion/views/content_viewer/topic.html.erb | 64 ---------------------------------------------------------------- plugins/proposals_discussion/views/proposals_discussion_plugin_myprofile/select_topic.html.erb | 39 --------------------------------------- plugins/proposals_discussion/views/proposals_discussion_plugin_profile/export.csv.erb | 30 ------------------------------ 38 files changed, 0 insertions(+), 1522 deletions(-) delete mode 100644 plugins/proposals_discussion/controllers/myprofile/proposals_discussion_plugin_myprofile_controller.rb delete mode 100644 plugins/proposals_discussion/controllers/profile/proposals_discussion_plugin_profile_controller.rb delete mode 100644 plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin/proposal.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin/proposals_list_helper.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb delete mode 100644 plugins/proposals_discussion/lib/proposals_discussion_plugin/topic_helper.rb delete mode 100644 plugins/proposals_discussion/public/flotr2.min.js delete mode 100644 plugins/proposals_discussion/public/images/score.png delete mode 100644 plugins/proposals_discussion/public/jquery.jscroll.min.js delete mode 100644 plugins/proposals_discussion/public/jquery.masonry.min.js delete mode 100644 plugins/proposals_discussion/public/proposals_graph.js delete mode 100644 plugins/proposals_discussion/public/proposals_list.js delete mode 100644 plugins/proposals_discussion/public/style.css delete mode 100644 plugins/proposals_discussion/test/functional/cms_controller_test.rb delete mode 100644 plugins/proposals_discussion/test/functional/content_viewer_controller_test.rb delete mode 100644 plugins/proposals_discussion/test/functional/proposals_discussion_plugin_myprofile_controller_test.rb delete mode 100644 plugins/proposals_discussion/test/functional/proposals_discussion_plugin_profile_controller_test.rb delete mode 100644 plugins/proposals_discussion/test/functional/proposals_discussion_plugin_public_controller_test.rb delete mode 100644 plugins/proposals_discussion/test/test_helper.rb delete mode 100644 plugins/proposals_discussion/test/unit/discussion_test.rb delete mode 100644 plugins/proposals_discussion/test/unit/proposal_test.rb delete mode 100644 plugins/proposals_discussion/test/unit/proposals_discussion_plugin_test.rb delete mode 100644 plugins/proposals_discussion/test/unit/topic_test.rb delete mode 100644 plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_discussion.html.erb delete mode 100644 plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_proposal.html.erb delete mode 100644 plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_topic.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/_proposal_card.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/_proposals_list.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/_proposals_list_content.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/_social.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/discussion.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/proposal.html.erb delete mode 100644 plugins/proposals_discussion/views/content_viewer/topic.html.erb delete mode 100644 plugins/proposals_discussion/views/proposals_discussion_plugin_myprofile/select_topic.html.erb delete mode 100644 plugins/proposals_discussion/views/proposals_discussion_plugin_profile/export.csv.erb diff --git a/plugins/proposals_discussion/controllers/myprofile/proposals_discussion_plugin_myprofile_controller.rb b/plugins/proposals_discussion/controllers/myprofile/proposals_discussion_plugin_myprofile_controller.rb deleted file mode 100644 index f02a4a5..0000000 --- a/plugins/proposals_discussion/controllers/myprofile/proposals_discussion_plugin_myprofile_controller.rb +++ /dev/null @@ -1,38 +0,0 @@ -class ProposalsDiscussionPluginMyprofileController < MyProfileController - - before_filter :check_edit_permission_to_proposal, :only => :publish_proposal - before_filter :set_discussion, :only => [:select_topic, :new_proposal] - - def select_topic - end - - def new_proposal - if params[:discussion].blank? || params[:discussion][:topic].blank? - session[:notice] = _('Please select a topic') - render :file => 'proposals_discussion_plugin_myprofile/select_topic' - else - redirect_to :controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => params[:discussion][:topic] - end - end - - def publish_proposal - if @proposal.update_attribute(:published, true) - session[:notice] = _('Proposal published!') - else - session[:notice] = _('Failed to publish your proposal.') - end - redirect_to @proposal.topic.view_url - end - - protected - - def check_edit_permission_to_proposal - @proposal = profile.articles.find(params[:proposal_id]) - render_access_denied unless @proposal.allow_edit?(user) - end - - def set_discussion - @discussion = profile.articles.find(params[:parent_id]) - end - -end diff --git a/plugins/proposals_discussion/controllers/profile/proposals_discussion_plugin_profile_controller.rb b/plugins/proposals_discussion/controllers/profile/proposals_discussion_plugin_profile_controller.rb deleted file mode 100644 index 2357728..0000000 --- a/plugins/proposals_discussion/controllers/profile/proposals_discussion_plugin_profile_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class ProposalsDiscussionPluginProfileController < ProfileController - - before_filter :check_access_to_profile - - def export - @comments = @target.proposals_comments - end - - protected - - def check_access_to_profile - @target = profile.articles.find(params[:article_id]) - render_access_denied(_('You are not allowed to export data from this article')) unless @target.allow_create?(user) - end - -end diff --git a/plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb b/plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb deleted file mode 100644 index 491f502..0000000 --- a/plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb +++ /dev/null @@ -1,51 +0,0 @@ -class ProposalsDiscussionPluginPublicController < ApplicationController - - needs_profile - - before_filter :check_permission - - def load_proposals - page = (params[:page] || 1).to_i - set_rand_cookie if page == 1 - order = params[:order] - - @proposals = order_proposals(@holder.proposals.published, order) - @proposals = @proposals.page(page).per_page(4) - - render :partial => 'content_viewer/proposals_list_content', :locals => {:proposals => @proposals, :holder => @holder, :page => page+1, :order => order} - end - - private - - def check_permission - @holder = profile.articles.find(params[:holder_id]) - render_access_denied unless @holder.display_to?(user) - end - - def order_proposals(proposals, order) - case order - when 'alphabetical' - proposals.reorder('name') - when 'recent' - proposals.reorder('created_at DESC') - when 'most_commented' - proposals.reorder('comments_count DESC') - when 'most_recently_commented' - proposals.joins("LEFT OUTER JOIN comments ON comments.source_id=articles.id AND comments.created_at >= '#{5.days.ago}'").group('articles.id').reorder('count(comments.id) DESC') - else - set_seed - proposals.reorder('random()') - end - end - - def set_seed - #XXX postgresql specific - seed_val = profile.connection.quote(cookies[:_noosfero_proposals_discussion_rand_seed]) - profile.connection.execute("select setseed(#{seed_val})") - end - - def set_rand_cookie - cookies[:_noosfero_proposals_discussion_rand_seed] = {value: rand, expires: Time.now + 600} - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin.rb deleted file mode 100644 index bb55542..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin.rb +++ /dev/null @@ -1,47 +0,0 @@ -class ProposalsDiscussionPlugin < Noosfero::Plugin - - def self.plugin_name - 'Discussion of Proposals' - end - - def self.plugin_description - _("Provide a structured way to promove a discussion over ideas proposed by users.") - end - - def stylesheet? - true - end - - def content_types - if context.respond_to?(:params) && context.params - types = [] - parent_id = context.params[:parent_id] - parent = parent_id ? context.profile.articles.find(parent_id) : nil - types << ProposalsDiscussionPlugin::Discussion - types << ProposalsDiscussionPlugin::Topic if parent.kind_of?(ProposalsDiscussionPlugin::Discussion) - types << ProposalsDiscussionPlugin::Proposal if parent.kind_of?(ProposalsDiscussionPlugin::Topic) - types - else - [ProposalsDiscussionPlugin::Discussion, - ProposalsDiscussionPlugin::Topic, - ProposalsDiscussionPlugin::Proposal] - end - end - - def content_remove_new(page) - page.kind_of?(ProposalsDiscussionPlugin::Discussion) || - page.kind_of?(ProposalsDiscussionPlugin::Topic) || - page.kind_of?(ProposalsDiscussionPlugin::Proposal) - end - - def content_remove_upload(page) - page.kind_of?(ProposalsDiscussionPlugin::Discussion) || - page.kind_of?(ProposalsDiscussionPlugin::Topic) || - page.kind_of?(ProposalsDiscussionPlugin::Proposal) - end - - def js_files - ['jquery.jscroll.min.js', 'jquery.masonry.min.js', 'flotr2.min.js'] - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb deleted file mode 100644 index f449aa4..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb +++ /dev/null @@ -1,42 +0,0 @@ -class ProposalsDiscussionPlugin::Discussion < Folder - - acts_as_having_posts - - has_many :topics, :class_name => 'ProposalsDiscussionPlugin::Topic', :foreign_key => 'parent_id' - has_many :proposals, :class_name => 'ProposalsDiscussionPlugin::Proposal', :through => :children, :source => :children - has_many :proposals_comments, :class_name => 'Comment', :through => :proposals, :source => :comments - - settings_items :custom_body_label, :type => :string, :default => _('Body') - - attr_accessible :custom_body_label - - def self.short_description - _("Discussion") - end - - def self.description - _('Container for topics.') - end - - def to_html(options = {}) - discussion = self - proc do - render :file => 'content_viewer/discussion', :locals => {:discussion => discussion} - end - end - - def cache_key_with_person(params = {}, user = nil, language = 'en') - cache_key_without_person + (user ? "-#{user.identifier}" : '') - end - alias_method_chain :cache_key, :person - - def posts - #override posts method to list proposals in feed - ProposalsDiscussionPlugin::Proposal.from_discussion(self) - end - - def accept_comments? - accept_comments - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposal.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposal.rb deleted file mode 100644 index a0146c8..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposal.rb +++ /dev/null @@ -1,51 +0,0 @@ -class ProposalsDiscussionPlugin::Proposal < TinyMceArticle - - scope :private, lambda {|user| {:conditions => {:last_changed_by_id => user.id, :published => false}}} - scope :from_discussion, lambda {|discussion| joins(:parent).where(['parents_articles.parent_id = ?', discussion.id])} - - alias :topic :parent - - def self.short_description - _("Proposal") - end - - def self.description - _('Proposal') - end - - validates_presence_of :abstract - - - def to_html(options = {}) - proposal = self - unless options[:feed] - proc do - render :file => 'content_viewer/proposal', :locals => {:proposal => proposal} - end - else - body - end - end - - def allow_edit?(user) - super || created_by == user - end - - def score - comments_count - end - - def normalized_score(holder) - (score/holder.max_score.to_f).round(2) - end - - def cache_key_with_person(params = {}, user = nil, language = 'en') - cache_key_without_person + (user && created_by == user ? "-#{user.identifier}" : '') - end - alias_method_chain :cache_key, :person - - def can_display_versions? - false - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposals_list_helper.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposals_list_helper.rb deleted file mode 100644 index b867c7b..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin/proposals_list_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module ProposalsDiscussionPlugin::ProposalsListHelper - - def sort_criteria - [[_('Random'), :random], [_('Alphabetical'), :alphabetical], [_('Recent'), :recent], [_('Most Commented'), :most_commented], [_('Most Recently Commented'), :most_recently_commented]] - end - - def more_proposals(text, holder, order, page=1) - link_to text, url_for({:controller => 'proposals_discussion_plugin_public', :action => 'load_proposals', :holder_id => holder.id, :profile => profile.identifier, :order => order, :page => page }) - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb deleted file mode 100644 index 4086018..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb +++ /dev/null @@ -1,74 +0,0 @@ -class ProposalsDiscussionPlugin::Topic < Folder - - alias :discussion :parent - - has_many :proposals, :class_name => 'ProposalsDiscussionPlugin::Proposal', :foreign_key => 'parent_id' - has_many :proposals_comments, :class_name => 'Comment', :through => :children, :source => :comments - has_many :proposals_authors, :class_name => 'Person', :through => :children, :source => :created_by - - settings_items :color, :type => :string - - attr_accessible :color - - def self.short_description - _("Discussion topic") - end - - def self.description - _('Container for proposals.') - end - - def most_active_participants - proposals_authors.group('profiles.id').order('count(articles.id) DESC').includes(:environment, :preferred_domain, :image) - end - - def to_html(options = {}) - topic = self - proc do - render :file => 'content_viewer/topic', :locals => {:topic => topic} - end - end - - def allow_create?(user) - true - end - - def max_score - @max ||= [1, proposals.maximum(:comments_count)].max - end - - def proposal_tags - proposals.tag_counts.inject({}) do |memo,tag| - memo[tag.name] = tag.count - memo - end - end - - def proposals_per_day - result = proposals.group("date(created_at)").count - fill_empty_days(result) - end - - def comments_per_day - result = proposals.joins(:comments).group('date(comments.created_at)').count('comments.id') - fill_empty_days(result) - end - - def fill_empty_days(result) - from = created_at.to_date - (from..Date.today).inject({}) do |h, date| - h[date.to_s] = result[date.to_s] || 0 - h - end - end - - def cache_key_with_person(params = {}, user = nil, language = 'en') - cache_key_without_person + (user ? "-#{user.identifier}" : '') - end - alias_method_chain :cache_key, :person - - def accept_comments? - accept_comments - end - -end diff --git a/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic_helper.rb b/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic_helper.rb deleted file mode 100644 index 885c034..0000000 --- a/plugins/proposals_discussion/lib/proposals_discussion_plugin/topic_helper.rb +++ /dev/null @@ -1,12 +0,0 @@ -module ProposalsDiscussionPlugin::TopicHelper - - def topic_title(topic) - image_icon = topic.image ? image_tag(topic.image.public_filename(:thumb), :class => 'disable-zoom') : '' - - content_tag(:div, ( - content_tag(:div, '', :class=>'topic-color', :style => "background-color: #{topic.color};") + - content_tag(:h2, link_to(image_icon + content_tag(:span, topic.title), topic.view_url)) - ), :class => 'topic-title') - end - -end diff --git a/plugins/proposals_discussion/public/flotr2.min.js b/plugins/proposals_discussion/public/flotr2.min.js deleted file mode 100644 index c3601e8..0000000 --- a/plugins/proposals_discussion/public/flotr2.min.js +++ /dev/null @@ -1,27 +0,0 @@ -/*! - * bean.js - copyright Jacob Thornton 2011 - * https://github.com/fat/bean - * MIT License - * special thanks to: - * dean edwards: http://dean.edwards.name/ - * dperini: https://github.com/dperini/nwevents - * the entire mootools team: github.com/mootools/mootools-core - *//*global module:true, define:true*/ -!function(e,t,n){typeof module!="undefined"?module.exports=n(e,t):typeof define=="function"&&typeof define.amd=="object"?define(n):t[e]=n(e,t)}("bean",this,function(e,t){var n=window,r=t[e],i=/over|out/,s=/[^\.]*(?=\..*)\.|.*/,o=/\..*/,u="addEventListener",a="attachEvent",f="removeEventListener",l="detachEvent",c=document||{},h=c.documentElement||{},p=h[u],d=p?u:a,v=Array.prototype.slice,m=/click|mouse|menu|drag|drop/i,g=/^touch|^gesture/i,y={one:1},b=function(e,t,n){for(n=0;n0){t=t.split(" ");for(f=t.length;f--;)_(e,t[f],n);return e}u=c&&t.replace(o,""),u&&w[u]&&(u=w[u].type);if(!t||c){if(a=c&&t.replace(s,""))a=a.split(".");l(e,u,n,a)}else if(typeof t=="function")l(e,null,t);else for(r in t)t.hasOwnProperty(r)&&_(e,r,t[r]);return e},D=function(e,t,n,r,i){var s,o,u,a,f=n,l=n&&typeof n=="string";if(t&&!n&&typeof t=="object")for(s in t)t.hasOwnProperty(s)&&D.apply(this,[e,s,t[s]]);else{a=arguments.length>3?v.call(arguments,3):[],o=(l?n:t).split(" "),l&&(n=M(t,f=r,i))&&(a=v.call(a,1)),this===y&&(n=L(_,e,t,n,f));for(u=o.length;u--;)O(e,o[u],n,f,a)}return e},P=function(){return D.apply(y,arguments)},H=p?function(e,t,r){var i=c.createEvent(e?"HTMLEvents":"UIEvents");i[e?"initEvent":"initUIEvent"](t,!0,!0,n,1),r.dispatchEvent(i)}:function(e,t,n){n=S(n,e),e?n.fireEvent("on"+t,c.createEventObject()):n["_on"+t]++},B=function(e,t,n){var r,i,u,a,f,l=t.split(" ");for(r=l.length;r--;){t=l[r].replace(o,"");if(a=l[r].replace(s,""))a=a.split(".");if(!a&&!n&&e[d])H(b[t],t,e);else{f=T.get(e,t),n=[!1].concat(n);for(i=0,u=f.length;i=r.computed&&(r={value:e,computed:o})}),r.value},S.min=function(e,t,n){if(!t&&S.isArray(e))return Math.min.apply(Math,e);var r={computed:Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;or?1:0}),"value")},S.groupBy=function(e,t){var n={};return x(e,function(e,r){var i=t(e,r);(n[i]||(n[i]=[])).push(e)}),n},S.sortedIndex=function(e,t,n){n||(n=S.identity);var r=0,i=e.length;while(r>1;n(e[s])=0})})},S.difference=function(e,t){return S.filter(e,function(e){return!S.include(t,e)})},S.zip=function(){var e=o.call(arguments),t=S.max(S.pluck(e,"length")),n=new Array(t);for(var r=0;r=0;n--)t=[e[n].apply(this,t)];return t[0]}},S.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},S.keys=w||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)f.call(e,n)&&(t[t.length]=n);return t},S.values=function(e){return S.map(e,S.identity)},S.functions=S.methods=function(e){var t=[];for(var n in e)S.isFunction(e[n])&&t.push(n);return t.sort()},S.extend=function(e){return x(o.call(arguments,1),function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])}),e},S.defaults=function(e){return x(o.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},S.clone=function(e){return S.isArray(e)?e.slice():S.extend({},e)},S.tap=function(e,t){return t(e),e},S.isEqual=function(e,t){if(e===t)return!0;var n=typeof e,r=typeof t;if(n!=r)return!1;if(e==t)return!0;if(!e&&t||e&&!t)return!1;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual)return e.isEqual(t);if(t.isEqual)return t.isEqual(e);if(S.isDate(e)&&S.isDate(t))return e.getTime()===t.getTime();if(S.isNaN(e)&&S.isNaN(t))return!1;if(S.isRegExp(e)&&S.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline;if(n!=="object")return!1;if(e.length&&e.length!==t.length)return!1;var i=S.keys(e),s=S.keys(t);if(i.length!=s.length)return!1;for(var o in e)if(!(o in t)||!S.isEqual(e[o],t[o]))return!1;return!0},S.isEmpty=function(e){if(S.isArray(e)||S.isString(e))return e.length===0;for(var t in e)if(f.call(e,t))return!1;return!0},S.isElement=function(e){return!!e&&e.nodeType==1},S.isArray=b||function(e){return a.call(e)==="[object Array]"},S.isObject=function(e){return e===Object(e)},S.isArguments=function(e){return!!e&&!!f.call(e,"callee")},S.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},S.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)},S.isNumber=function(e){return!!(e===0||e&&e.toExponential&&e.toFixed)},S.isNaN=function(e){return e!==e},S.isBoolean=function(e){return e===!0||e===!1},S.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},S.isRegExp=function(e){return!(!(e&&e.test&&e.exec)||!e.ignoreCase&&e.ignoreCase!==!1)},S.isNull=function(e){return e===null},S.isUndefined=function(e){return e===void 0},S.noConflict=function(){return e._=t,this},S.identity=function(e){return e},S.times=function(e,t,n){for(var r=0;r/g,interpolate:/<%=([\s\S]+?)%>/g},S.template=function(e,t){var n=S.templateSettings,r="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(n.interpolate,function(e,t){return"',"+t.replace(/\\'/g,"'")+",'"}).replace(n.evaluate||null,function(e,t){return"');"+t.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",i=new Function("obj",r);return t?i(t):i};var k=function(e){this._wrapped=e};S.prototype=k.prototype;var L=function(e,t){return t?S(e).chain():e},A=function(e,t){k.prototype[e]=function(){var e=o.call(arguments);return u.call(e,this._wrapped),L(t.apply(S,e),this._chain)}};S.mixin(S),x(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];k.prototype[e]=function(){return t.apply(this._wrapped,arguments),L(this._wrapped,this._chain)}}),x(["concat","join","slice"],function(e){var t=r[e];k.prototype[e]=function(){return L(t.apply(this._wrapped,arguments),this._chain)}}),k.prototype.chain=function(){return this._chain=!0,this},k.prototype.value=function(){return this._wrapped}})(); -/** - * Flotr2 (c) 2012 Carl Sutherland - * MIT License - * Special thanks to: - * Flotr: http://code.google.com/p/flotr/ (fork) - * Flot: https://github.com/flot/flot (original fork) - */ -(function(){var e=this,t=this.Flotr,n;n={_:_,bean:bean,isIphone:/iphone/i.test(navigator.userAgent),isIE:navigator.appVersion.indexOf("MSIE")!=-1?parseFloat(navigator.appVersion.split("MSIE")[1]):!1,graphTypes:{},plugins:{},addType:function(e,t){n.graphTypes[e]=t,n.defaultOptions[e]=t.options||{},n.defaultOptions.defaultType=n.defaultOptions.defaultType||e},addPlugin:function(e,t){n.plugins[e]=t,n.defaultOptions[e]=t.options||{}},draw:function(e,t,r,i){return i=i||n.Graph,new i(e,t,r)},merge:function(e,t){var r,i,s=t||{};for(r in e)i=e[r],i&&typeof i=="object"?i.constructor===Array?s[r]=this._.clone(i):i.constructor!==RegExp&&!this._.isElement(i)&&!i.jquery?s[r]=n.merge(i,t?t[r]:undefined):s[r]=i:s[r]=i;return s},clone:function(e){return n.merge(e,{})},getTickSize:function(e,t,r,i){var s=(r-t)/e,o=n.getMagnitude(s),u=10,a=s/o;return a<1.5?u=1:a<2.25?u=2:a<3?u=i===0?2:2.5:a<7.5&&(u=5),u*o},defaultTickFormatter:function(e,t){return e+""},defaultTrackFormatter:function(e){return"("+e.x+", "+e.y+")"},engineeringNotation:function(e,t,n){var r=["Y","Z","E","P","T","G","M","k",""],i=["y","z","a","f","p","n","ยต","m",""],s=r.length;n=n||1e3,t=Math.pow(10,t||2);if(e===0)return 0;if(e>1)while(s--&&e>=n)e/=n;else{r=i,s=r.length;while(s--&&e<1)e*=n}return Math.round(e*t)/t+r[s]},getMagnitude:function(e){return Math.pow(10,Math.floor(Math.log(e)/Math.LN10))},toPixel:function(e){return Math.floor(e)+.5},toRad:function(e){return-e*(Math.PI/180)},floorInBase:function(e,t){return t*Math.floor(e/t)},drawText:function(e,t,r,i,s){if(!e.fillText){e.drawText(t,r,i,s);return}s=this._.extend({size:n.defaultOptions.fontSize,color:"#000000",textAlign:"left",textBaseline:"bottom",weight:1,angle:0},s),e.save(),e.translate(r,i),e.rotate(s.angle),e.fillStyle=s.color,e.font=(s.weight>1?"bold ":"")+s.size*1.3+"px sans-serif",e.textAlign=s.textAlign,e.textBaseline=s.textBaseline,e.fillText(t,0,0),e.restore()},getBestTextAlign:function(e,t){return t=t||{textAlign:"center",textBaseline:"middle"},e+=n.getTextAngleFromAlign(t),Math.abs(Math.cos(e))>.01&&(t.textAlign=Math.cos(e)>0?"right":"left"),Math.abs(Math.sin(e))>.01&&(t.textBaseline=Math.sin(e)>0?"top":"bottom"),t},alignTable:{"right middle":0,"right top":Math.PI/4,"center top":Math.PI/2,"left top":3*(Math.PI/4),"left middle":Math.PI,"left bottom":-3*(Math.PI/4),"center bottom":-Math.PI/2,"right bottom":-Math.PI/4,"center middle":0},getTextAngleFromAlign:function(e){return n.alignTable[e.textAlign+" "+e.textBaseline]||0},noConflict:function(){return e.Flotr=t,this}},e.Flotr=n})(),Flotr.defaultOptions={colors:["#00A8F0","#C0D800","#CB4B4B","#4DA74D","#9440ED"],ieBackgroundColor:"#FFFFFF",title:null,subtitle:null,shadowSize:4,defaultType:null,HtmlText:!0,fontColor:"#545454",fontSize:7.5,resolution:1,parseFloat:!0,preventDefault:!0,xaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:0,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,mode:"normal",timeFormat:null,timeMode:"UTC",timeUnit:"millisecond",scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},x2axis:{},yaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:90,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},y2axis:{titleAngle:270},grid:{color:"#545454",backgroundColor:null,backgroundImage:null,watermarkAlpha:.4,tickColor:"#DDDDDD",labelMargin:3,verticalLines:!0,minorVerticalLines:null,horizontalLines:!0,minorHorizontalLines:null,outlineWidth:1,outline:"nsew",circular:!1},mouse:{track:!1,trackAll:!1,position:"se",relative:!1,trackFormatter:Flotr.defaultTrackFormatter,margin:5,lineColor:"#FF3F19",trackDecimals:1,sensibility:2,trackY:!0,radius:3,fillColor:null,fillOpacity:.4}},function(){function t(e,t,n,r){this.rgba=["r","g","b","a"];var i=4;while(-1<--i)this[this.rgba[i]]=arguments[i]||(i==3?1:0);this.normalize()}var e=Flotr._,n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};t.prototype={scale:function(t,n,r,i){var s=4;while(-1<--s)e.isUndefined(arguments[s])||(this[this.rgba[s]]*=arguments[s]);return this.normalize()},alpha:function(t){return!e.isUndefined(t)&&!e.isNull(t)&&(this.a=t),this.normalize()},clone:function(){return new t(this.r,this.b,this.g,this.a)},limit:function(e,t,n){return Math.max(Math.min(e,n),t)},normalize:function(){var e=this.limit;return this.r=e(parseInt(this.r,10),0,255),this.g=e(parseInt(this.g,10),0,255),this.b=e(parseInt(this.b,10),0,255),this.a=e(this.a,0,1),this},distance:function(e){if(!e)return;e=new t.parse(e);var n=0,r=3;while(-1<--r)n+=Math.abs(this[this.rgba[r]]-e[this.rgba[r]]);return n},toString:function(){return this.a>=1?"rgb("+[this.r,this.g,this.b].join(",")+")":"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"},contrast:function(){var e=1-(.299*this.r+.587*this.g+.114*this.b)/255;return e<.5?"#000000":"#ffffff"}},e.extend(t,{parse:function(e){if(e instanceof t)return e;var r;if(r=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return new t(parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16));if(r=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10));if(r=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return new t(parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16));if(r=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4]));if(r=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55);if(r=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55,parseFloat(r[4]));var i=(e+"").replace(/^\s*([\S\s]*?)\s*$/,"$1").toLowerCase();return i=="transparent"?new t(255,255,255,0):(r=n[i])?new t(r[0],r[1],r[2]):new t(0,0,0,0)},processColor:function(n,r){var i=r.opacity;if(!n)return"rgba(0, 0, 0, 0)";if(n instanceof t)return n.alpha(i).toString();if(e.isString(n))return t.parse(n).alpha(i).toString();var s=n.colors?n:{colors:n};if(!r.ctx)return e.isArray(s.colors)?t.parse(e.isArray(s.colors[0])?s.colors[0][1]:s.colors[0]).alpha(i).toString():"rgba(0, 0, 0, 0)";s=e.extend({start:"top",end:"bottom"},s),/top/i.test(s.start)&&(r.x1=0),/left/i.test(s.start)&&(r.y1=0),/bottom/i.test(s.end)&&(r.x2=0),/right/i.test(s.end)&&(r.y2=0);var o,u,a,f=r.ctx.createLinearGradient(r.x1,r.y1,r.x2,r.y2);for(o=0;o=h)break}h=i[v][0],p=i[v][1],p=="year"&&(h=Flotr.getTickSize(s.noTicks*r.year,a,f,0),h==.5&&(p="month",h=6)),e.tickUnit=p,e.tickSize=h;var g=h*r[p];m=new Date(a);switch(p){case"millisecond":y("Milliseconds");break;case"second":y("Seconds");break;case"minute":y("Minutes");break;case"hour":y("Hours");break;case"month":y("Month");break;case"year":y("FullYear")}g>=r.second&&t(m,"Milliseconds",o,0),g>=r.minute&&t(m,"Seconds",o,0),g>=r.hour&&t(m,"Minutes",o,0),g>=r.day&&t(m,"Hours",o,0),g>=r.day*4&&t(m,"Date",o,1),g>=r.year&&t(m,"Month",o,0);var b=0,w=NaN,E;do{E=w,w=m.getTime(),c.push({v:w/u,label:d(w/u,e)});if(p=="month")if(h<1){t(m,"Date",o,1);var S=m.getTime();t(m,"Month",o,n(m,"Month",o)+1);var x=m.getTime();m.setTime(w+b*r.hour+(x-S)*h),b=n(m,"Hours",o),t(m,"Hours",o,0)}else t(m,"Month",o,n(m,"Month",o)+h);else p=="year"?t(m,"FullYear",o,n(m,"FullYear",o)+h):m.setTime(w+g)}while(w0)return{x:t.touches[0].pageX,y:t.touches[0].pageY};if(!e._.isUndefined(t.changedTouches)&&t.changedTouches.length>0)return{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};if(t.pageX||t.pageY)return{x:t.pageX,y:t.pageY};if(t.clientX||t.clientY){var n=document,r=n.body,i=n.documentElement;return{x:t.clientX+r.scrollLeft+i.scrollLeft,y:t.clientY+r.scrollTop+i.scrollTop}}}}}(),function(){var e=Flotr,t=e.DOM,n=e._,r=function(e){this.o=e};r.prototype={dimensions:function(e,t,n,r){return e?this.o.html?this.html(e,this.o.element,n,r):this.canvas(e,t):{width:0,height:0}},canvas:function(t,n){if(!this.o.textEnabled)return;n=n||{};var r=this.measureText(t,n),i=r.width,s=n.size||e.defaultOptions.fontSize,o=n.angle||0,u=Math.cos(o),a=Math.sin(o),f=2,l=6,c;return c={width:Math.abs(u*i)+Math.abs(a*s)+f,height:Math.abs(a*i)+Math.abs(u*s)+l},c},html:function(e,n,r,i){var s=t.create("div");return t.setStyles(s,{position:"absolute",top:"-10000px"}),t.insert(s,'
'+e+"
"),t.insert(this.o.element,s),t.size(s)},measureText:function(t,r){var i=this.o.ctx,s;return!i.fillText||e.isIphone&&i.measure?{width:i.measure(t,r)}:(r=n.extend({size:e.defaultOptions.fontSize,weight:1,angle:0},r),i.save(),i.font=(r.weight>1?"bold ":"")+r.size*1.3+"px sans-serif",s=i.measureText(t),i.restore(),s)}},Flotr.Text=r}(),function(){function i(e,n,r){return t.observe.apply(this,arguments),this._handles.push(arguments),this}var e=Flotr.DOM,t=Flotr.EventAdapter,n=Flotr._,r=Flotr;Graph=function(e,i,s){this._setEl(e),this._initMembers(),this._initPlugins(),t.fire(this.el,"flotr:beforeinit",[this]),this.data=i,this.series=r.Series.getSeries(i),this._initOptions(s),this._initGraphTypes(),this._initCanvas(),this._text=new r.Text({element:this.el,ctx:this.ctx,html:this.options.HtmlText,textEnabled:this.textEnabled}),t.fire(this.el,"flotr:afterconstruct",[this]),this._initEvents(),this.findDataRanges(),this.calculateSpacing(),this.draw(n.bind(function(){t.fire(this.el,"flotr:afterinit",[this])},this))},Graph.prototype={destroy:function(){t.fire(this.el,"flotr:destroy"),n.each(this._handles,function(e){t.stopObserving.apply(this,e)}),this._handles=[],this.el.graph=null},observe:i,_observe:i,processColor:function(e,t){var i={x1:0,y1:0,x2:this.plotWidth,y2:this.plotHeight,opacity:1,ctx:this.ctx};return n.extend(i,t),r.Color.processColor(e,i)},findDataRanges:function(){var e=this.axes,t,i,s;n.each(this.series,function(e){s=e.getRange(),s&&(t=e.xaxis,i=e.yaxis,t.datamin=Math.min(s.xmin,t.datamin),t.datamax=Math.max(s.xmax,t.datamax),i.datamin=Math.min(s.ymin,i.datamin),i.datamax=Math.max(s.ymax,i.datamax),t.used=t.used||s.xused,i.used=i.used||s.yused)},this),!e.x.used&&!e.x2.used&&(e.x.used=!0),!e.y.used&&!e.y2.used&&(e.y.used=!0),n.each(e,function(e){e.calculateRange()});var o=n.keys(r.graphTypes),u=!1;n.each(this.series,function(e){if(e.hide)return;n.each(o,function(t){e[t]&&e[t].show&&(this.extendRange(t,e),u=!0)},this),u||this.extendRange(this.options.defaultType,e)},this)},extendRange:function(e,t){this[e].extendRange&&this[e].extendRange(t,t.data,t[e],this[e]),this[e].extendYRange&&this[e].extendYRange(t.yaxis,t.data,t[e],this[e]),this[e].extendXRange&&this[e].extendXRange(t.xaxis,t.data,t[e],this[e])},calculateSpacing:function(){var e=this.axes,t=this.options,r=this.series,i=t.grid.labelMargin,s=this._text,o=e.x,u=e.x2,a=e.y,f=e.y2,l=t.grid.outlineWidth,c,h,p,d;n.each(e,function(e){e.calculateTicks(),e.calculateTextDimensions(s,t)}),d=s.dimensions(t.title,{size:t.fontSize*1.5},"font-size:1em;font-weight:bold;","flotr-title"),this.titleHeight=d.height,d=s.dimensions(t.subtitle,{size:t.fontSize},"font-size:smaller;","flotr-subtitle"),this.subtitleHeight=d.height;for(h=0;h1&&(this.multitouches=n.touches),t.fire(e,"flotr:mousedown",[event,this]),this.observe(document,"touchend",r)},this)),this.observe(this.overlay,"touchmove",n.bind(function(n){var r=this.getEventPosition(n);this.options.preventDefault&&n.preventDefault(),i=!0,this.multitouches||n.touches&&n.touches.length>1?this.multitouches=n.touches:s||t.fire(e,"flotr:mousemove",[event,r,this]),this.lastMousePos=r},this))):this.observe(this.overlay,"mousedown",n.bind(this.mouseDownHandler,this)).observe(e,"mousemove",n.bind(this.mouseMoveHandler,this)).observe(this.overlay,"click",n.bind(this.clickHandler,this)).observe(e,"mouseout",function(n){t.fire(e,"flotr:mouseout",n)})},_initCanvas:function(){function l(i,s){return i||(i=e.create("canvas"),typeof FlashCanvas!="undefined"&&typeof i.getContext=="function"&&(FlashCanvas.initElement(i),this.isFlashCanvas=!0),i.className="flotr-"+s,i.style.cssText="position:absolute;left:0px;top:0px;",e.insert(t,i)),n.each(a,function(t,n){e.show(i);if(s=="canvas"&&i.getAttribute(n)===t)return;i.setAttribute(n,t*r.resolution),i.style[n]=t+"px"}),i.context_=null,i}function c(e){window.G_vmlCanvasManager&&window.G_vmlCanvasManager.initElement(e);var t=e.getContext("2d");return window.G_vmlCanvasManager||t.scale(r.resolution,r.resolution),t}var t=this.el,r=this.options,i=t.children,s=[],o,u,a,f;for(u=i.length;u--;)o=i[u],!this.canvas&&o.className==="flotr-canvas"?this.canvas=o:!this.overlay&&o.className==="flotr-overlay"?this.overlay=o:s.push(o);for(u=s.length;u--;)t.removeChild(s[u]);e.setStyles(t,{position:"relative"}),a={},a.width=t.clientWidth,a.height=t.clientHeight;if(a.width<=0||a.height<=0||r.resolution<=0)throw"Invalid dimensions for plot, width = "+a.width+", height = "+a.height+", resolution = "+r.resolution;this.canvas=l(this.canvas,"canvas"),this.overlay=l(this.overlay,"overlay"),this.ctx=c(this.canvas),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.octx=c(this.overlay),this.octx.clearRect(0,0,this.overlay.width,this.overlay.height),this.canvasHeight=a.height,this.canvasWidth=a.width,this.textEnabled=!!this.ctx.drawText||!!this.ctx.fillText},_initPlugins:function(){n.each(r.plugins,function(e,t){n.each(e.callbacks,function(e,t){this.observe(this.el,t,n.bind(e,this))},this),this[t]=r.clone(e),n.each(this[t],function(e,r){n.isFunction(e)&&(this[t][r]=n.bind(e,this))},this)},this)},_initOptions:function(e){var i=r.clone(r.defaultOptions);i.x2axis=n.extend(n.clone(i.xaxis),i.x2axis),i.y2axis=n.extend(n.clone(i.yaxis),i.y2axis),this.options=r.merge(e||{},i),this.options.grid.minorVerticalLines===null&&this.options.xaxis.scaling==="logarithmic"&&(this.options.grid.minorVerticalLines=!0),this.options.grid.minorHorizontalLines===null&&this.options.yaxis.scaling==="logarithmic"&&(this.options.grid.minorHorizontalLines=!0),t.fire(this.el,"flotr:afterinitoptions",[this]),this.axes=r.Axis.getAxes(this.options);var s=[],o=[],u=this.series.length,a=this.series.length,f=this.options.colors,l=[],c=0,h,p,d,v;for(p=a-1;p>-1;--p)h=this.series[p].color,h&&(--a,n.isNumber(h)?s.push(h):l.push(r.Color.parse(h)));for(p=s.length-1;p>-1;--p)a=Math.max(a,s[p]+1);for(p=0;o.length=f.length&&(p=0,++c)}for(p=0,d=0;p10?t.minorTickFreq=0:o-u>5?t.minorTickFreq=2:t.minorTickFreq=5)}else e.tickSize=Flotr.getTickSize(t.noTicks,n,r,t.tickDecimals);e.min=n,e.max=r,t.min===null&&t.autoscale&&(e.min-=e.tickSize*i,e.min<0&&e.datamin>=0&&(e.min=0),e.min=e.tickSize*Math.floor(e.min/e.tickSize)),t.max===null&&t.autoscale&&(e.max+=e.tickSize*i,e.max>0&&e.datamax<=0&&e.datamax!=e.datamin&&(e.max=0),e.max=e.tickSize*Math.ceil(e.max/e.tickSize)),e.min==e.max&&(e.max=e.min+1)},calculateTextDimensions:function(e,t){var n="",r,i;if(this.options.showLabels)for(i=0;in.length&&(n=this.ticks[i].label);this.maxLabel=e.dimensions(n,{size:t.fontSize,angle:Flotr.toRad(this.options.labelsAngle)},"font-size:smaller;","flotr-grid-label"),this.titleSize=e.dimensions(this.options.title,{size:t.fontSize*1.2,angle:Flotr.toRad(this.options.titleAngle)},"font-weight:bold;","flotr-axis-title")},_cleanUserTicks:function(t,n){var r=this,i=this.options,s,o,u,a;e.isFunction(t)&&(t=t({min:r.min,max:r.max}));for(o=0;o1?a[1]:i.tickFormatter(s,{min:r.min,max:r.max})):(s=a,u=i.tickFormatter(s,{min:this.min,max:this.max})),n[o]={v:s,label:u}},_calculateTimeTicks:function(){this.ticks=Flotr.Date.generator(this)},_calculateLogTicks:function(){var e=this,t=e.options,n,r,s=Math.log(e.max);t.base!=Math.E&&(s/=Math.log(t.base)),s=Math.ceil(s);var o=Math.log(e.min);t.base!=Math.E&&(o/=Math.log(t.base)),o=Math.ceil(o);for(i=o;ii&&(i=a,o=!0)),f!==null&&(fs&&(s=f,u=!0));return{xmin:n,xmax:i,ymin:r,ymax:s,xused:o,yused:u}}},e.extend(t,{getSeries:function(n){return e.map(n,function(n){var r;return n.data?(r=new t,e.extend(r,n)):r=new t({data:n}),r})}}),Flotr.Series=t}(),Flotr.addType("lines",{options:{show:!1,lineWidth:2,fill:!1,fillBorder:!1,fillColor:null,fillOpacity:.4,steps:!1,stacked:!1},stack:{values:[]},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize,i;t.save(),t.lineJoin="round",r&&(t.lineWidth=r/2,i=n/2+t.lineWidth/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,i+r/2,!1),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,i,!1)),t.lineWidth=n,t.strokeStyle=e.color,this.plot(e,0,!0),t.restore()},plot:function(e,t,n){function S(){!t&&e.fill&&d&&(v=o(d[0]),r.fillStyle=e.fillStyle,r.lineTo(m,p),r.lineTo(v,p),r.lineTo(v,u(d[1])),r.fill(),e.fillBorder&&r.stroke())}var r=e.context,i=e.width,s=e.height,o=e.xScale,u=e.yScale,a=e.data,f=e.stacked?this.stack:!1,l=a.length-1,c=null,h=null,p=u(0),d=null,v,m,g,y,b,w,E;if(l<1)return;r.beginPath();for(E=0;E0&&a[E][1]!==null&&(r.stroke(),S(),d=null,r.closePath(),r.beginPath());continue}v=o(a[E][0]),m=o(a[E+1][0]),d===null&&(d=a[E]),f?(b=f.values[a[E][0]]||0,w=f.values[a[E+1][0]]||f.values[a[E][0]]||0,g=u(a[E][1]+b),y=u(a[E+1][1]+w),n&&(a[E].y0=b,f.values[a[E][0]]=a[E][1]+b,E==l-1&&(a[E+1].y0=w,f.values[a[E+1][0]]=a[E+1][1]+w))):(g=u(a[E][1]),y=u(a[E+1][1]));if(g>s&&y>s||g<0&&y<0||v<0&&m<0||v>i&&m>i)continue;(c!=v||h!=g+t)&&r.moveTo(v,g+t),c=m,h=y+t,e.steps?(r.lineTo(c+t/2,g+t),r.lineTo(c+t/2,h)):r.lineTo(c,h)}(!e.fill||e.fill&&!e.fillBorder)&&r.stroke(),S(),r.closePath()},extendYRange:function(e,t,n,r){var i=e.options;if(n.stacked&&(!i.max&&i.max!==0||!i.min&&i.min!==0)){var s=e.max,o=e.min,u=r.positiveSums||{},a=r.negativeSums||{},f,l;for(l=0;l0?(u[f]=(u[f]||0)+t[l][1],s=Math.max(s,u[f])):(a[f]=(a[f]||0)+t[l][1],o=Math.min(o,a[f]));r.negativeSums=a,r.positiveSums=u,e.max=s,e.min=o}n.steps&&(this.hit=function(e){var t=e.data,n=e.args,r=e.yScale,i=n[0],s=t.length,o=n[1],u=e.xInverse(i.relX),a=i.relY,f;for(f=0;f=t[f][0]&&u<=t[f+1][0]){Math.abs(r(t[f][1])-a)<8&&(o.x=t[f][0],o.y=t[f][1],o.index=f,o.seriesIndex=e.index);break}},this.drawHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=n.index,o=i(n.x),u=e.yScale(n.y),a;r.length-1>s&&(a=e.xScale(r[s+1][0]),t.save(),t.strokeStyle=e.color,t.lineWidth=e.lineWidth,t.beginPath(),t.moveTo(o,u),t.lineTo(a,u),t.stroke(),t.closePath(),t.restore())},this.clearHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=e.lineWidth,o=n.index,u=i(n.x),a=e.yScale(n.y),f;r.length-1>o&&(f=e.xScale(r[o+1][0]),t.clearRect(u-s,a-s,f-u+2*s,2*s))})}}),Flotr.addType("bars",{options:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,fillOpacity:.4,horizontal:!1,stacked:!1,centered:!0,topPadding:.1,grouped:!1},stack:{positive:[],negative:[],_positive:[],_negative:[]},draw:function(e){var t=e.context;this.current+=1,t.save(),t.lineJoin="miter",t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.shadowSize,i,s,o,u,a,f;if(t.length<1)return;this.translate(n,e.horizontal);for(i=0;i0?o.positive:o.negative,p=d[c]||p,d[c]=p+h),v=f(c-a),m=f(c+i-a),g=l(h+p),y=l(p),y<0&&(y=0),e===null||t===null?null:{x:c,y:h,xScale:f,yScale:l,top:g,left:Math.min(v,m)-u/2,width:Math.abs(m-v)-u,height:y-g}},hit:function(e){var t=e.data,n=e.args,r=n[0],i=n[1],s=e.xInverse(r.relX),o=e.yInverse(r.relY),u=this.getBarGeometry(s,o,e),a=u.width/2,f=u.left,l=u.y,c,h;for(h=t.length;h--;)c=this.getBarGeometry(t[h][0],t[h][1],e),(l>0&&lc.y)&&Math.abs(f-c.left)0?(f[c]=(f[c]||0)+h,o=Math.max(o,f[c])):(l[c]=(l[c]||0)+h,s=Math.min(s,l[c]));(a==1&&u||a==-1&&!u)&&n.topPadding&&(e.max===e.datamax||n.stacked&&this.stackMax!==o)&&(o+=n.topPadding*(o-s)),this.stackMin=s,this.stackMax=o,this.negativeSums=l,this.positiveSums=f,e.max=o,e.min=s}}),Flotr.addType("bubbles",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,baseRadius:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i,s,o,u,a;t=t||0;for(s=0;sg?"downFillColor":"upFillColor"],e.fill&&!e.barcharts&&(n.fillStyle="rgba(0,0,0,0.05)",n.fillRect(y+o,x+o,b-y,S-x),n.save(),n.globalAlpha=e.fillOpacity,n.fillStyle=l,n.fillRect(y,x+u,b-y,S-x),n.restore());if(u||a)h=Math.floor((y+b)/2)+f,n.strokeStyle=l,n.beginPath(),e.barcharts?(n.moveTo(h,Math.floor(E+u)),n.lineTo(h,Math.floor(w+u)),T=dv&&ag&&fs.max||yo.max)continue;vs.max&&(m=s.max,s.lastSerie!=e&&(p=!1)),go.max&&(y=o.max,o.lastSerie!=e&&(p=!1)),r&&(u.beginPath(),u.moveTo(s.d2p(v),o.d2p(g)+n),u.lineTo(s.d2p(v),o.d2p(y)+n),u.lineTo(s.d2p(m),o.d2p(y)+n),u.lineTo(s.d2p(m),o.d2p(g)+n),u.fill(),u.closePath()),e.gantt.lineWidth&&(h||d||p)&&(u.beginPath(),u.moveTo(s.d2p(v),o.d2p(g)+n),u[h?"lineTo":"moveTo"](s.d2p(v),o.d2p(y)+n),u[p?"lineTo":"moveTo"](s.d2p(m),o.d2p(y)+n),u[d?"lineTo":"moveTo"](s.d2p(m),o.d2p(g)+n),u.stroke(),u.closePath())}},plotShadows:function(e,t,n){var r=e.data;if(r.length<1)return;var i,s,o,u,a=e.xaxis,f=e.yaxis,l=this.ctx,c=this.options.shadowSize;for(i=0;ia.max||vf.max)continue;ha.max&&(p=a.max),df.max&&(v=f.max);var m=a.d2p(p)-a.d2p(h)-(a.d2p(p)+c<=this.plotWidth?0:c),g=f.d2p(d)-f.d2p(v)-(f.d2p(d)+c<=this.plotHeight?0:c);l.fillStyle="rgba(0,0,0,0.05)",l.fillRect(Math.min(a.d2p(h)+c,this.plotWidth),Math.min(f.d2p(v)+c,this.plotHeight),m,g)}},extendXRange:function(e){if(e.options.max===null){var t=e.min,n=e.max,r,i,s,o,u,a={},f={},l=null;for(r=0;rt&&(t=e.max+o.barWidth)}}e.lastSerie=f,e.max=t,e.min=n,e.tickSize=Flotr.getTickSize(e.options.noTicks,n,t,e.options.tickDecimals)}}}),function(){function e(e){return typeof e=="object"&&e.constructor&&(Image?!0:e.constructor===Image)}Flotr.defaultMarkerFormatter=function(e){return Math.round(e.y*100)/100+""},Flotr.addType("markers",{options:{show:!1,lineWidth:1,color:"#000000",fill:!1,fillColor:"#FFFFFF",fillOpacity:.4,stroke:!1,position:"ct",verticalMargin:0,labelFormatter:Flotr.defaultMarkerFormatter,fontSize:Flotr.defaultOptions.fontSize,stacked:!1,stackingType:"b",horizontal:!1},stack:{positive:[],negative:[],values:[]},draw:function(e){function h(e,t){return o=r.negative[e]||0,s=r.positive[e]||0,t>0?(r.positive[e]=o+t,o+t):(r.negative[e]=s+t,s+t)}var t=e.data,n=e.context,r=e.stacked?e.stack:!1,i=e.stackingType,s,o,u,a,f,l,c;n.save(),n.lineJoin="round",n.lineWidth=e.lineWidth,n.strokeStyle="rgba(0,0,0,0.5)",n.fillStyle=e.fillStyle;for(a=0;a0?"top":"bottom",C,k,L;n.save(),n.translate(u/2,o/2),n.scale(1,v),k=Math.cos(b)*a,L=Math.sin(b)*a,i>0&&(this.plotSlice(k+i,L+i,h,g,y,n),l&&(n.fillStyle="rgba(0,0,0,0.1)",n.fill())),this.plotSlice(k,L,h,g,y,n),l&&(n.fillStyle=c,n.fill()),n.lineWidth=r,n.strokeStyle=f,n.stroke(),C={size:e.fontSize*1.2,color:e.fontColor,weight:1.5},w&&(e.htmlText||!e.textEnabled?(divStyle="position:absolute;"+N+":"+(o/2+(N==="top"?x:-x))+"px;",divStyle+=T+":"+(u/2+(T==="right"?-S:S))+"px;",d.push('
',w,"
")):(C.textAlign=T,C.textBaseline=N,Flotr.drawText(n,w,S,x,C)));if(e.htmlText||!e.textEnabled){var A=Flotr.DOM.node('
');Flotr.DOM.insert(A,d.join("")),Flotr.DOM.insert(e.element,A)}n.restore(),this.startAngle=y,this.slices=this.slices||[],this.slices.push({radius:h,x:k,y:L,explode:a,start:g,end:y})},plotSlice:function(e,t,n,r,i,s){s.beginPath(),s.moveTo(e,t),s.arc(e,t,n,r,i,!1),s.lineTo(e,t),s.closePath()},hit:function(e){var t=e.data[0],n=e.args,r=e.index,i=n[0],s=n[1],o=this.slices[r],u=i.relX-e.width/2,a=i.relY-e.height/2,f=Math.sqrt(u*u+a*a),l=Math.atan(a/u),c=Math.PI*2,h=o.explode||e.explode,p=o.start%c,d=o.end%c,v=e.epsilon;u<0?l+=Math.PI:u>0&&a<0&&(l+=c),fh&&(l>p&&ld&&(lp)||p===d&&(o.start===o.end&&Math.abs(l-p)v))&&(s.x=t[0],s.y=t[1],s.sAngle=p,s.eAngle=d,s.index=0,s.seriesIndex=r,s.fraction=t[1]/this.total)},drawHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex];t.save(),t.translate(e.width/2,e.height/2),this.plotSlice(n.x,n.y,n.radius,n.start,n.end,t),t.stroke(),t.restore()},clearHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex],r=2*e.lineWidth,i=n.radius+r;t.save(),t.translate(e.width/2,e.height/2),t.clearRect(n.x-i,n.y-i,2*i+r,2*i+r),t.restore()},extendYRange:function(e,t){this.total=(this.total||0)+t[0][1]}})}(),Flotr.addType("points",{options:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#FFFFFF",fillOpacity:1,hitRadius:null},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize;t.save(),r>0&&(t.lineWidth=r/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,r/2+t.lineWidth/2),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,t.lineWidth/2)),t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=e.xScale,s=e.yScale,o,u,a;for(o=n.length-1;o>-1;--o){a=n[o][1];if(a===null)continue;u=i(n[o][0]),a=s(a);if(u<0||u>e.width||a<0||a>e.height)continue;r.beginPath(),t?r.arc(u,a+t,e.radius,0,Math.PI,!1):(r.arc(u,a,e.radius,0,2*Math.PI,!0),e.fill&&r.fill()),r.stroke(),r.closePath()}}}),Flotr.addType("radar",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,radiusRatio:.9,sensibility:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.translate(e.width/2,e.height/2),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=Math.min(e.height,e.width)*e.radiusRatio/2,s=2*Math.PI/n.length,o=-Math.PI/2,u,a;t=t||0,r.beginPath();for(u=0;uthis.plotWidth||t.relY>this.plotHeight){this.el.style.cursor=null,e.removeClass(this.el,"flotr-crosshair");return}r.hideCursor&&(this.el.style.cursor="none",e.addClass(this.el,"flotr-crosshair")),n.save(),n.strokeStyle=r.color,n.lineWidth=1,n.beginPath(),r.mode.indexOf("x")!=-1&&(n.moveTo(s,i.top),n.lineTo(s,i.top+this.plotHeight)),r.mode.indexOf("y")!=-1&&(n.moveTo(i.left,o),n.lineTo(i.left+this.plotWidth,o)),n.stroke(),n.restore()},clearCrosshair:function(){var e=this.plotOffset,t=this.lastMousePos,n=this.octx;t&&(n.clearRect(Math.round(t.relX)+e.left,e.top,1,this.plotHeight+1),n.clearRect(e.left,Math.round(t.relY)+e.top,this.plotWidth+1,1))}})}(),function(){function n(e,t,n,r,i,s){var o="image/"+e,u=n.getImageData(0,0,r,i),a=new Image;return n.save(),n.globalCompositeOperation="destination-over",n.fillStyle=s,n.fillRect(0,0,r,i),a.src=t.toDataURL(o),n.restore(),n.clearRect(0,0,r,i),n.putImageData(u,0,0),a}var e=Flotr.DOM,t=Flotr._;Flotr.addPlugin("download",{saveImage:function(r,i,s,o){var u=this.options.grid,a;if(Flotr.isIE&&Flotr.isIE<9)return a=""+this.canvas.firstChild.innerHTML+"",window.open().document.write(a);if(r!=="jpeg"&&r!=="png")return;a=n(r,this.canvas,this.ctx,this.canvasWidth,this.canvasHeight,u&&u.backgroundColor||"#ffffff");if(!t.isElement(a)||!o)return window.open(a.src);this.download.restoreCanvas(),e.hide(this.canvas),e.hide(this.overlay),e.setStyles({position:"absolute"}),e.insert(this.el,a),this.saveImageElement=a},restoreCanvas:function(){e.show(this.canvas),e.show(this.overlay),this.saveImageElement&&this.el.removeChild(this.saveImageElement),this.saveImageElement=null}})}(),function(){var e=Flotr.EventAdapter,t=Flotr._;Flotr.addPlugin("graphGrid",{callbacks:{"flotr:beforedraw":function(){this.graphGrid.drawGrid()},"flotr:afterdraw":function(){this.graphGrid.drawOutline()}},drawGrid:function(){function v(e){for(p=0;p=c.max||(e==c.min||e==c.max)&&i.outlineWidth)return;r(Math.floor(c.d2p(e))+n.lineWidth/2)})}function g(e){n.moveTo(e,0),n.lineTo(e,f)}function y(e){n.moveTo(0,e),n.lineTo(l,e)}var n=this.ctx,r=this.options,i=r.grid,s=i.verticalLines,o=i.horizontalLines,u=i.minorVerticalLines,a=i.minorHorizontalLines,f=this.plotHeight,l=this.plotWidth,c,h,p,d;(s||u||o||a)&&e.fire(this.el,"flotr:beforegrid",[this.axes.x,this.axes.y,r,this]),n.save(),n.lineWidth=1,n.strokeStyle=i.tickColor;if(i.circular){n.translate(this.plotOffset.left+l/2,this.plotOffset.top+f/2);var b=Math.min(f,l)*r.radar.radiusRatio/2,w=this.axes.x.ticks.length,S=2*(Math.PI/w),x=-Math.PI/2;n.beginPath(),c=this.axes.y,o&&v(c.ticks),a&&v(c.minorTicks),s&&t.times(w,function(e){n.moveTo(0,0),n.lineTo(Math.cos(e*S+x)*b,Math.sin(e*S+x)*b)}),n.stroke()}else n.translate(this.plotOffset.left,this.plotOffset.top),i.backgroundColor&&(n.fillStyle=this.processColor(i.backgroundColor,{x1:0,y1:0,x2:l,y2:f}),n.fillRect(0,0,l,f)),n.beginPath(),c=this.axes.x,s&&m(c.ticks,g),u&&m(c.minorTicks,g),c=this.axes.y,o&&m(c.ticks,y),a&&m(c.minorTicks,y),n.stroke();n.restore(),(s||u||o||a)&&e.fire(this.el,"flotr:aftergrid",[this.axes.x,this.axes.y,r,this])},drawOutline:function(){var e=this,t=e.options,n=t.grid,r=n.outline,s=e.ctx,o=n.backgroundImage,u=e.plotOffset,a=u.left,f=u.top,l=e.plotWidth,c=e.plotHeight,h,p,d,v,m,g;if(!n.outlineWidth)return;s.save();if(n.circular){s.translate(a+l/2,f+c/2);var y=Math.min(c,l)*t.radar.radiusRatio/2,b=this.axes.x.ticks.length,w=2*(Math.PI/b),E=-Math.PI/2;s.beginPath(),s.lineWidth=n.outlineWidth,s.strokeStyle=n.color,s.lineJoin="round";for(i=0;i<=b;++i)s[i===0?"moveTo":"lineTo"](Math.cos(i*w+E)*y,Math.sin(i*w+E)*y);s.stroke()}else{s.translate(a,f);var S=n.outlineWidth,x=.5-S+(S+1)%2/2,T="lineTo",N="moveTo";s.lineWidth=S,s.strokeStyle=n.color,s.lineJoin="miter",s.beginPath(),s.moveTo(x,x),l-=S/2%1,c+=S/2,s[r.indexOf("n")!==-1?T:N](l,x),s[r.indexOf("e")!==-1?T:N](l,c),s[r.indexOf("s")!==-1?T:N](x,c),s[r.indexOf("w")!==-1?T:N](x,x),s.stroke(),s.closePath()}s.restore(),o&&(d=o.src||o,v=(parseInt(o.left,10)||0)+u.left,m=(parseInt(o.top,10)||0)+u.top,p=new Image,p.onload=function(){s.save(),o.alpha&&(s.globalAlpha=o.alpha),s.globalCompositeOperation="destination-over",s.drawImage(p,0,0,p.width,p.height,v,m,l,c),s.restore()},p.src=d)}})}(),function(){var e=Flotr.DOM,t=Flotr._,n=Flotr,r="opacity:0.7;background-color:#000;color:#fff;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;";Flotr.addPlugin("hit",{callbacks:{"flotr:mousemove":function(e,t){this.hit.track(t)},"flotr:click":function(e){var n=this.hit.track(e);n&&!t.isUndefined(n.index)&&(e.hit=n)},"flotr:mouseout":function(e){e.relatedTarget!==this.mouseTrack&&this.hit.clearHit()},"flotr:destroy":function(){this.options.mouse.container&&e.remove(this.mouseTrack),this.mouseTrack=null}},track:function(e){if(this.options.mouse.track||t.any(this.series,function(e){return e.mouse&&e.mouse.track}))return this.hit.hit(e)},executeOnType:function(e,r,i){function u(e,u){t.each(t.keys(n.graphTypes),function(t){e[t]&&e[t].show&&!e.hide&&this[t][r]&&(o=this.getOptions(e,t),o.fill=!!e.mouse.fillColor,o.fillStyle=this.processColor(e.mouse.fillColor||"#ffffff",{opacity:e.mouse.fillOpacity}),o.color=e.mouse.lineColor,o.context=this.octx,o.index=u,i&&(o.args=i),this[t][r].call(this[t],o),s=!0)},this)}var s=!1,o;return t.isArray(e)||(e=[e]),t.each(e,u,this),s},drawHit:function(e){var t=this.octx,n=e.series;if(n.mouse.lineColor){t.save(),t.lineWidth=n.points?n.points.lineWidth:1,t.strokeStyle=n.mouse.lineColor,t.fillStyle=this.processColor(n.mouse.fillColor||"#ffffff",{opacity:n.mouse.fillOpacity}),t.translate(this.plotOffset.left,this.plotOffset.top);if(!this.hit.executeOnType(n,"drawHit",e)){var r=e.xaxis,i=e.yaxis;t.beginPath(),t.arc(r.d2p(e.x),i.d2p(e.y),n.points.hitRadius||n.points.radius||n.mouse.radius,0,2*Math.PI,!0),t.fill(),t.stroke(),t.closePath()}t.restore(),this.clip(t)}this.prevHit=e},clearHit:function(){var t=this.prevHit,n=this.octx,r=this.plotOffset;n.save(),n.translate(r.left,r.top);if(t){if(!this.hit.executeOnType(t.series,"clearHit",this.prevHit)){var i=t.series,s=i.points?i.points.lineWidth:1;offset=(i.points.hitRadius||i.points.radius||i.mouse.radius)+s,n.clearRect(t.xaxis.d2p(t.x)-offset,t.yaxis.d2p(t.y)-offset,offset*2,offset*2)}e.hide(this.mouseTrack),this.prevHit=null}n.restore()},hit:function(e){var n=this.options,r=this.prevHit,i,s,o,u,a,f,l,c,h;if(this.series.length===0)return;h={relX:e.relX,relY:e.relY,absX:e.absX,absY:e.absY,series:this.series};if(n.mouse.trackY&&!n.mouse.trackAll&&this.hit.executeOnType(this.series,"hit",[e,h])&&!t.isUndefined(h.seriesIndex))a=this.series[h.seriesIndex],h.series=a,h.mouse=a.mouse,h.xaxis=a.xaxis,h.yaxis=a.yaxis;else{i=this.hit.closest(e);if(i){i=n.mouse.trackY?i.point:i.x,u=i.seriesIndex,a=this.series[u],l=a.xaxis,c=a.yaxis,s=2*a.mouse.sensibility;if(n.mouse.trackAll||i.distanceXl.xaxis.max)continue;p=Math.abs(g-v),d=Math.abs(y-m),h=p*p+d*d,h'),this.mouseTrack=c,e.insert(b||this.el,c));if(!g||g<0)g=0;a&&a.toFixed&&(a=a.toFixed(g)),f&&f.toFixed&&(f=f.toFixed(g)),T=n.mouse.trackFormatter({x:a,y:f,series:n.series,index:n.index,nearest:n,fraction:n.fraction});if(t.isNull(T)||t.isUndefined(T)){e.hide(c);return}c.innerHTML=T,e.show(c);if(!o)return;x=e.size(c),b&&(S=e.position(this.el),w=S.top,E=S.left);if(!n.mouse.relative)i+="top:",o.charAt(0)=="n"?i+=w+u+m:o.charAt(0)=="s"&&(i+=w-u+m+this.plotHeight-x.height),i+="px;bottom:auto;left:",o.charAt(1)=="e"?i+=E-u+p+this.plotWidth-x.width:o.charAt(1)=="w"&&(i+=E+u+p),i+="px;right:auto;";else if(s.pie&&s.pie.show){var N={x:this.plotWidth/2,y:this.plotHeight/2},C=Math.min(this.canvasWidth,this.canvasHeight)*s.pie.sizeRatio/2,k=n.sAngle=5||Math.abs(e.second.y-e.first.y)>=5}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("labels",{callbacks:{"flotr:afterdraw":function(){this.labels.draw()}},draw:function(){function b(e,t,r){var i=r?t.minorTicks:t.ticks,s=t.orientation===1,u=t.n===1,l,h;l={color:t.options.color||d.grid.color,angle:Flotr.toRad(t.options.labelsAngle),textBaseline:"middle"};for(c=0;c(s?e.plotWidth:e.plotHeight))continue;Flotr.drawText(v,n.label,l(e,s,o,a),h(e,s,o,a),u),!s&&!o&&(v.save(),v.strokeStyle=u.color,v.beginPath(),v.moveTo(e.plotOffset.left+e.plotWidth-8,e.plotOffset.top+t.d2p(n.v)),v.lineTo(e.plotOffset.left+e.plotWidth,e.plotOffset.top+t.d2p(n.v)),v.stroke(),v.restore())}}function E(e,t){var r=t.orientation===1,i=t.n===1,o="",u,a,f,l=e.plotOffset;!r&&!i&&(v.save(),v.strokeStyle=t.options.color||d.grid.color,v.beginPath());if(t.options.showLabels&&(i?!0:t.used))for(c=0;c(r?e.canvasWidth:e.canvasHeight))continue;f=l.top+(r?(i?1:-1)*(e.plotHeight+d.grid.labelMargin):t.d2p(n.v)-t.maxLabel.height/2),u=r?l.left+t.d2p(n.v)-s/2:0,o="",c===0?o=" first":c===t.ticks.length-1&&(o=" last"),o+=r?" flotr-grid-label-x":" flotr-grid-label-y",h+=['
'+n.label+"
"].join(" "),!r&&!i&&(v.moveTo(l.left+e.plotWidth-8,l.top+t.d2p(n.v)),v.lineTo(l.left+e.plotWidth,l.top+t.d2p(n.v)))}}var t,n,r,i,s,o,u,a,f,l,c,h="",p=0,d=this.options,v=this.ctx,m=this.axes,g={size:d.fontSize};for(c=0;c-1;--p){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),E=Math.max(E,this._text.measureText(d,S).width)}var x=Math.round(m+y*3+E),T=Math.round(f*(y+g)+y);!h&&h!==0&&(h=.1);if(!i.HtmlText&&this.textEnabled&&!s.container){l.charAt(0)=="s"&&(w=r.top+this.plotHeight-(c+T)),l.charAt(0)=="c"&&(w=r.top+this.plotHeight/2-(c+T/2)),l.charAt(1)=="e"&&(b=r.left+this.plotWidth-(c+x)),v=this.processColor(s.backgroundColor,{opacity:h}),a.fillStyle=v,a.fillRect(b,w,x,T),a.strokeStyle=s.labelBoxBorderColor,a.strokeRect(Flotr.toPixel(b),Flotr.toPixel(w),x,T);var N=b+y,C=w+y;for(p=0;p":""),u=!0);var k=n[p],L=s.labelBoxWidth,A=s.labelBoxHeight;d=s.labelFormatter(k.label),v="background-color:"+(k.bars&&k.bars.show&&k.bars.fillColor&&k.bars.fill?k.bars.fillColor:k.color)+";",o.push('','
','
','
',"
","
","",'',d,"")}u&&o.push("");if(o.length>0){var O=''+o.join("")+"
";if(s.container)O=e.node(O),this.legend.markup=O,e.insert(s.container,O);else{var M={position:"absolute",zIndex:"2",border:"1px solid "+s.labelBoxBorderColor};l.charAt(0)=="n"?(M.top=c+r.top+"px",M.bottom="auto"):l.charAt(0)=="c"?(M.top=c+(this.plotHeight-T)/2+"px",M.bottom="auto"):l.charAt(0)=="s"&&(M.bottom=c+r.bottom+"px",M.top="auto"),l.charAt(1)=="e"?(M.right=c+r.right+"px",M.left="auto"):l.charAt(1)=="w"&&(M.left=c+r.left+"px",M.right="auto");var P=e.create("div"),H;P.className="flotr-legend",e.setStyles(P,M),e.insert(P,O),e.insert(this.el,P);if(!h)return;var B=s.backgroundColor||i.grid.backgroundColor||"#ffffff";t.extend(M,e.size(P),{backgroundColor:B,zIndex:"",border:""}),M.width+="px",M.height+="px",P=e.create("div"),P.className="flotr-legend-bg",e.setStyles(P,M),e.opacity(P,h),e.insert(P," "),e.insert(this.el,P)}}}}}})}(),function(){function e(e){if(this.options.spreadsheet.tickFormatter)return this.options.spreadsheet.tickFormatter(e);var t=n.find(this.axes.x.ticks,function(t){return t.v==e});return t?t.label:e}var t=Flotr.DOM,n=Flotr._;Flotr.addPlugin("spreadsheet",{options:{show:!1,tabGraphLabel:"Graph",tabDataLabel:"Data",toolbarDownload:"Download CSV",toolbarSelectAll:"Select all",csvFileSeparator:",",decimalSeparator:".",tickFormatter:null,initialTab:"graph"},callbacks:{"flotr:afterconstruct":function(){if(!this.options.spreadsheet.show)return;var e=this.spreadsheet,n=t.node('
'),r=t.node('
'+this.options.spreadsheet.tabGraphLabel+"
"),i=t.node('
'+this.options.spreadsheet.tabDataLabel+"
"),s;e.tabsContainer=n,e.tabs={graph:r,data:i},t.insert(n,r),t.insert(n,i),t.insert(this.el,n),s=t.size(i).height+2,this.plotOffset.bottom+=s,t.setStyles(n,{top:this.canvasHeight-s+"px"}),this.observe(r,"click",function(){e.showTab("graph")}).observe(i,"click",function(){e.showTab("data")}),this.options.spreadsheet.initialTab!=="graph"&&e.showTab(this.options.spreadsheet.initialTab)}},loadDataGrid:function(){if(this.seriesData)return this.seriesData;var e=this.series,t={};return n.each(e,function(e,r){n.each(e.data,function(e){var n=e[0],s=e[1],o=t[n];if(o)o[r+1]=s;else{var u=[];u[0]=n,u[r+1]=s,t[n]=u}})}),this.seriesData=n.sortBy(t,function(e,t){return parseInt(t,10)}),this.seriesData},constructDataGrid:function(){if(this.spreadsheet.datagrid)return this.spreadsheet.datagrid;var r=this.series,i=this.spreadsheet.loadDataGrid(),s=[""],o,u,a,f=[''];f.push(""),n.each(r,function(e,t){f.push('"),s.push("")}),f.push(""),n.each(i,function(t){f.push(""),n.times(r.length+1,function(r){var i="td",s=t[r],o=n.isUndefined(s)?"":Math.round(s*1e5)/1e5;if(r===0){i="th";var u=e.call(this,o);u&&(o=u)}f.push("<"+i+(i=="th"?' scope="row"':"")+">"+o+"")},this),f.push("")},this),s.push(""),a=t.node(f.join("")),o=t.node('"),u=t.node('"),this.observe(o,"click",n.bind(this.spreadsheet.downloadCSV,this)).observe(u,"click",n.bind(this.spreadsheet.selectAllData,this));var l=t.node('
');t.insert(l,o),t.insert(l,u);var c=this.canvasHeight-t.size(this.spreadsheet.tabsContainer).height-2,h=t.node('
');return t.insert(h,l),t.insert(h,a),t.insert(this.el,h),this.spreadsheet.datagrid=a,this.spreadsheet.container=h,a},showTab:function(e){if(this.spreadsheet.activeTab===e)return;switch(e){case"graph":t.hide(this.spreadsheet.container),t.removeClass(this.spreadsheet.tabs.data,"selected"),t.addClass(this.spreadsheet.tabs.graph,"selected");break;case"data":this.spreadsheet.datagrid||this.spreadsheet.constructDataGrid(),t.show(this.spreadsheet.container),t.addClass(this.spreadsheet.tabs.data,"selected"),t.removeClass(this.spreadsheet.tabs.graph,"selected");break;default:throw"Illegal tab name: "+e}this.spreadsheet.activeTab=e},selectAllData:function(){if(this.spreadsheet.tabs){var e,t,n,r,i=this.spreadsheet.constructDataGrid();return this.spreadsheet.showTab("data"),setTimeout(function(){(n=i.ownerDocument)&&(r=n.defaultView)&&r.getSelection&&n.createRange&&(e=window.getSelection())&&e.removeAllRanges?(t=n.createRange(),t.selectNode(i),e.removeAllRanges(),e.addRange(t)):document.body&&document.body.createTextRange&&(t=document.body.createTextRange())&&(t.moveToElementText(i),t.select())},0),!0}return!1},downloadCSV:function(){var t="",r=this.series,i=this.options,s=this.spreadsheet.loadDataGrid(),o=encodeURIComponent(i.spreadsheet.csvFileSeparator);if(i.spreadsheet.decimalSeparator===i.spreadsheet.csvFileSeparator)throw"The decimal separator is the same as the column separator ("+i.spreadsheet.decimalSeparator+")";n.each(r,function(e,n){t+=o+'"'+(e.label||String.fromCharCode(65+n)).replace(/\"/g,'\\"')+'"'}),t+="%0D%0A",t+=n.reduce(s,function(t,n){var r=e.call(this,n[0])||"";r='"'+(r+"").replace(/\"/g,'\\"')+'"';var s=n.slice(1).join(o);return i.spreadsheet.decimalSeparator!=="."&&(s=s.replace(/\./g,i.spreadsheet.decimalSeparator)),t+r+o+s+"%0D%0A"},"",this),Flotr.isIE&&Flotr.isIE<9?(t=t.replace(new RegExp(o,"g"),decodeURIComponent(o)).replace(/%0A/g,"\n").replace(/%0D/g,"\r"),window.open().document.write(t)):window.open("data:text/csv,"+t)}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("titles",{callbacks:{"flotr:afterdraw":function(){this.titles.drawTitles()}},drawTitles:function(){var t,n=this.options,r=n.grid.labelMargin,i=this.ctx,s=this.axes;if(!n.HtmlText&&this.textEnabled){var o={size:n.fontSize,color:n.grid.color,textAlign:"center"};n.subtitle&&Flotr.drawText(i,n.subtitle,this.plotOffset.left+this.plotWidth/2,this.titleHeight+this.subtitleHeight-2,o),o.weight=1.5,o.size*=1.5,n.title&&Flotr.drawText(i,n.title,this.plotOffset.left+this.plotWidth/2,this.titleHeight-2,o),o.weight=1.8,o.size*=.8,s.x.options.title&&s.x.used&&(o.textAlign=s.x.options.titleAlign||"center",o.textBaseline="top",o.angle=Flotr.toRad(s.x.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+s.x.maxLabel.height+this.plotHeight+2*r,o)),s.x2.options.title&&s.x2.used&&(o.textAlign=s.x2.options.titleAlign||"center",o.textBaseline="bottom",o.angle=Flotr.toRad(s.x2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x2.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top-s.x2.maxLabel.height-2*r,o)),s.y.options.title&&s.y.used&&(o.textAlign=s.y.options.titleAlign||"right",o.textBaseline="middle",o.angle=Flotr.toRad(s.y.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y.options.title,this.plotOffset.left-s.y.maxLabel.width-2*r,this.plotOffset.top+this.plotHeight/2,o)),s.y2.options.title&&s.y2.used&&(o.textAlign=s.y2.options.titleAlign||"left",o.textBaseline="middle",o.angle=Flotr.toRad(s.y2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y2.options.title,this.plotOffset.left+this.plotWidth+s.y2.maxLabel.width+2*r,this.plotOffset.top+this.plotHeight/2,o))}else{t=[],n.title&&t.push('
',n.title,"
"),n.subtitle&&t.push('
',n.subtitle,"
"),t.push(""),t.push('
'),s.x.options.title&&s.x.used&&t.push('
',s.x.options.title,"
"),s.x2.options.title&&s.x2.used&&t.push('
',s.x2.options.title,"
"),s.y.options.title&&s.y.used&&t.push('
',s.y.options.title,"
"),s.y2.options.title&&s.y2.used&&t.push('
',s.y2.options.title,"
"),t=t.join("");var u=e.create("div");e.setStyles({color:n.grid.color}),u.className="flotr-titles",e.insert(this.el,u),e.insert(u,t)}}})}(); diff --git a/plugins/proposals_discussion/public/images/score.png b/plugins/proposals_discussion/public/images/score.png deleted file mode 100644 index 6cc20f8..0000000 Binary files a/plugins/proposals_discussion/public/images/score.png and /dev/null differ diff --git a/plugins/proposals_discussion/public/jquery.jscroll.min.js b/plugins/proposals_discussion/public/jquery.jscroll.min.js deleted file mode 100644 index f39469a..0000000 --- a/plugins/proposals_discussion/public/jquery.jscroll.min.js +++ /dev/null @@ -1,15 +0,0 @@ -/*! - * jScroll - jQuery Plugin for Infinite Scrolling / Auto-Paging - v2.2.4 - * http://jscroll.com/ - * - * Copyright 2011-2013, Philip Klauzinski - * http://klauzinski.com/ - * Dual licensed under the MIT and GPL Version 2 licenses. - * http://jscroll.com/#license - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl-2.0.html - * - * @author Philip Klauzinski - * @requires jQuery v1.4.3+ - */ -(function(b){b.jscroll={defaults:{debug:false,autoTrigger:true,autoTriggerUntil:false,loadingHtml:"Loading...",padding:0,nextSelector:"a:last",contentSelector:"",pagingSelector:"",callback:false}};var a=function(e,g){var o=e.data("jscroll"),n=(typeof g==="function")?{callback:g}:g,p=b.extend({},b.jscroll.defaults,n,o||{}),c=(e.css("overflow-y")==="visible"),l=e.find(p.nextSelector).first(),v=b(window),h=b("body"),q=c?v:e,m=b.trim(l.attr("href")+" "+p.contentSelector);e.data("jscroll",b.extend({},o,{initialized:true,waiting:false,nextHref:m}));r();k();t();function k(){var x=b(p.loadingHtml).filter("img").attr("src");if(x){var w=new Image();w.src=x}}function r(){if(!e.find(".jscroll-inner").length){e.contents().wrapAll('
')}}function d(w){if(p.pagingSelector){var x=w.closest(p.pagingSelector).hide()}else{var x=w.parent().not(".jscroll-inner,.jscroll-added").addClass("jscroll-next-parent").hide();if(!x.length){w.wrap('
').parent().hide()}}}function j(){return q.unbind(".jscroll").removeData("jscroll").find(".jscroll-inner").children().unwrap().filter(".jscroll-added").children().unwrap()}function i(){r();var D=e.find("div.jscroll-inner").first(),B=e.data("jscroll"),C=parseInt(e.css("borderTopWidth")),y=isNaN(C)?0:C,x=parseInt(e.css("paddingTop"))+y,A=c?q.scrollTop():e.offset().top,z=D.length?D.offset().top:0,w=Math.ceil(A-z+q.height()+x);if(!B.waiting&&w+p.padding>=D.outerHeight()){f("info","jScroll:",D.outerHeight()-w,"from bottom. Loading next request...");return u()}}function s(w){w=w||e.data("jscroll");if(!w||!w.nextHref){f("warn","jScroll: nextSelector not found - destroying");j();return false}else{t();return true}}function t(){var w=e.find(p.nextSelector).first();if(p.autoTrigger&&(p.autoTriggerUntil===false||p.autoTriggerUntil>0)){d(w);if(h.height()<=v.height()){i()}q.unbind(".jscroll").bind("scroll.jscroll",function(){return i()});if(p.autoTriggerUntil>0){p.autoTriggerUntil--}}else{q.unbind(".jscroll");w.bind("click.jscroll",function(){d(w);u();return false})}}function u(){var x=e.find("div.jscroll-inner").first(),w=e.data("jscroll");w.waiting=true;x.append('
').children(".jscroll-added").last().html('
'+p.loadingHtml+"
");return e.animate({scrollTop:x.outerHeight()},0,function(){x.find("div.jscroll-added").last().load(w.nextHref,function(A,z,B){if(z==="error"){return j()}var y=b(this).find(p.nextSelector).first();w.waiting=false;w.nextHref=y.attr("href")?b.trim(y.attr("href")+" "+p.contentSelector):false;b(".jscroll-next-parent",e).remove();s();if(p.callback){p.callback.call(this)}f("dir",w)})})}function f(w){if(p.debug&&typeof console==="object"&&(typeof w==="object"||typeof console[w]==="function")){if(typeof w==="object"){var y=[];for(var x in w){if(typeof console[x]==="function"){y=(w[x].length)?w[x]:[w[x]];console[x].apply(console,y)}else{console.log.apply(console,y)}}}else{console[w].apply(console,Array.prototype.slice.call(arguments,1))}}}b.extend(e.jscroll,{destroy:j});return e};b.fn.jscroll=function(c){return this.each(function(){var f=b(this),e=f.data("jscroll");if(e&&e.initialized){return}var d=new a(f,c)})}})(jQuery); \ No newline at end of file diff --git a/plugins/proposals_discussion/public/jquery.masonry.min.js b/plugins/proposals_discussion/public/jquery.masonry.min.js deleted file mode 100644 index 57c081c..0000000 --- a/plugins/proposals_discussion/public/jquery.masonry.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * jQuery Masonry v2.1.08 - * A dynamic layout plugin for jQuery - * The flip-side of CSS Floats - * http://masonry.desandro.com - * - * Licensed under the MIT license. - * Copyright 2012 David DeSandro - */ -(function(e,t,n){"use strict";var r=t.event,i;r.special.smartresize={setup:function(){t(this).bind("resize",r.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",r.special.smartresize.handler)},handler:function(e,t){var n=this,s=arguments;e.type="smartresize",i&&clearTimeout(i),i=setTimeout(function(){r.dispatch.apply(n,s)},t==="execAsap"?0:100)}},t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])},t.Mason=function(e,n){this.element=t(n),this._create(e),this._init()},t.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},t.Mason.prototype={_filterFindBricks:function(e){var t=this.options.itemSelector;return t?e.filter(t).add(e.find(t)):e},_getBricks:function(e){var t=this._filterFindBricks(e).css({position:"absolute"}).addClass("masonry-brick");return t},_create:function(n){this.options=t.extend(!0,{},t.Mason.settings,n),this.styleQueue=[];var r=this.element[0].style;this.originalStyle={height:r.height||""};var i=this.options.containerStyle;for(var s in i)this.originalStyle[s]=r[s]||"";this.element.css(i),this.horizontalDirection=this.options.isRTL?"right":"left";var o=this.element.css("padding-"+this.horizontalDirection),u=this.element.css("padding-top");this.offset={x:o?parseInt(o,10):0,y:u?parseInt(u,10):0},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var a=this;setTimeout(function(){a.element.addClass("masonry")},0),this.options.isResizable&&t(e).bind("smartresize.masonry",function(){a.resize()}),this.reloadItems()},_init:function(e){this._getColumns(),this._reLayout(e)},option:function(e,n){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))},layout:function(e,t){for(var n=0,r=e.length;n 0) { - scroll.jscroll({ - loadingHtml: 'LoadingLoading...', - nextSelector: nextSelector - }); - } - } - $('.filters .random').click(); - - $('.proposals_list .filters a.order').on('ajax:success', function(event, data, status, xhr) { - $(this).parents('div.proposals_list').find('.filters a.order').removeClass('selected'); - $(this).addClass('selected'); - $(this).parents('div.proposals_list').find('.proposals').html(data); - proposalsScroll(); - $('.topics').masonry(); - }); - $('.topics').masonry(); - $(window).resize(function() { - $('.topics').masonry(); - }); - $(window).bind('toggleFullwidth', function() { - $('.topics').masonry(); - }); -}); - -function loadSocialButtons() { - twttr.widgets.load(); - try{FB.XFBML.parse();}catch(ex){} -} -function initFacebookButton() { - (function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.0"; - fjs.parentNode.insertBefore(js, fjs); - }(document, 'script', 'facebook-jssdk')); -} -function initTwitterButton() { - !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); -} diff --git a/plugins/proposals_discussion/public/style.css b/plugins/proposals_discussion/public/style.css deleted file mode 100644 index 8241d62..0000000 --- a/plugins/proposals_discussion/public/style.css +++ /dev/null @@ -1,250 +0,0 @@ -.private-proposals .proposal { - background: url(/images/hachure.png); - opacity: 0.5; - filter: alpha(opacity=25); - zoom: 1; -} - -.proposal { - width: 100%; - min-width: 272px; - vertical-align: top; - margin: 12px 13px 12px 0; -} - -.article-body-proposals-discussion-plugin_discussion .actions, -.article-body-proposals-discussion-plugin_topic .actions { - margin: 10px 0 25px 0; -} - -.proposal .content, .proposal .score, .proposal .topic { - display: inline-block; - border-color: rgb(201, 201, 201); - padding: 5px; - vertical-align: middle; - height: 100%; -} -.proposal .topic { - border-right: 0; - text-align: center; - width: 24%; -} -.proposal .score { - width: 5%; - text-align: center; -} -.proposal .score span { - background: url(/plugins/proposals_discussion/images/score.png) no-repeat; - display: inline-block; - width: 25px; - height: 19px; - position: relative; -} - -.proposal .content:hover, .proposal .topic:hover { - background: rgb(230, 230, 230); -} - -.proposal .title { - font-weight: bold; - font-size: 12px; -} - -#article .proposal a:visited, #article .proposal a { - color: rgb(70, 70, 70); - text-decoration: none; - width: 100%; - display: inline-block; -} -#article .proposal .private.actions a:visited, #article .proposal .private.actions a { - display: inline; -} - -.proposal .content { - width: 84%; - color: rgb(83, 83, 83); - vertical-align: top; - position: relative; -} - -form .proposals-discussion-plugin textarea { - width: 98%; -} - -form .proposals-discussion-plugin .abstract textarea { - height: 60px; -} - -form .proposals-discussion-plugin .body textarea { - height: 400px; -} - -.topic-color { - width: 100%; - height: 5px; -} - -.topics .topic { - background-color: rgb(233, 233, 233); - margin: 5px 0; - height: 25px; -} - -#article .proposal .topic a { - font-weight: bold; - color: #888a85; - width: 100%; - height: 100%; -} - -.proposals_list .filters { - float: right; - margin-top: 4px; -} -.topics .proposals_list .filters { - display: none; -} -#article .proposals_list .filters a { - text-decoration: none; - border-left: 1px solid rgb(185, 185, 185); - padding: 0 5px; - color: #555753; -} -.proposals_list .filters a.selected { - font-weight: bold; -} -#content .proposals_list h5 { - float: left; - margin: 0; -} -.topics .topic-item { - width: 48%; - float: left; - margin: 6px; - font-size: 10px; - box-shadow: 5px 5px 5px -2px #ddd; -} - -.topics .proposals .more { - display: none; -} -#content .topics .actions.topic-item { - background-color: #EEE; -} -#content .topics .actions.topic-item a { - width: 93%; - display: inline-block; - height: 100px; - max-height: 100px; - line-height: 100px; - border: 0; - border-radius: 0; - text-align: center; - background-position: 60px; - font-size: 20px; -} -#content .topics .actions.topic-item .topic-color { - background-color: #7293CF; -} - -#content #article .topic-item h2, #content #article .article-body-proposals-discussion-plugin_topic h2, -#content #article .topic h2, -#content .topic .topic-title h2 { - background-color: #BDBDBD; - margin: 0; -} - -#content .topic-item h2 a, #article .article-body-proposals-discussion-plugin_topic h2 a, -#content .topic h2 a { - text-decoration: none; - display: inline-block; - color: white; -} -#content .topic-title h2 span { - padding: 10px; - display: inline-block; -} -.topic-item .topic-content, #article .article-body-proposals-discussion-plugin_topic .topic-content { - padding: 5px 7px 5px 2px; -} -.topic-content .description { - font-size: 11px; -} -#article .article-body-proposals-discussion-plugin_topic #article-header > h1 { - display: none; -} -.proposal .content .actions { - position: absolute; - top: -18px; - display: none; - margin: 1px 0 0 0; -} - -#content .article-body-proposals-discussion-plugin_topic .tag_cloud a { - text-decoration: none; -} - -#content .summary { - float: left; - margin-left: 12px; -} -#content .summary .label { - font-weight: bold; - color: rgb(95, 95, 95); - font-size: 13px; - line-height: 27px; -} -#content .summary .content { - color: rgb(175, 175, 175); - font-size: 14px; - font-weight: bold; -} -#content .statistics h5 { - color: rgb(95, 95, 95); -} -#content .article-body-proposals-discussion-plugin_topic .tag_cloud { - float: right; - width: 300px; - box-shadow: 5px 5px 5px -2px #ddd; - background-color: rgb(248, 248, 248); - min-height: 50px; -} - -.article-body-proposals-discussion-plugin_topic .graph { - float: left; -} -.article-body-proposals-discussion-plugin_topic .graph #proposals-time { - height: 150px; - width: 300px; -} - -.article-body-proposals-discussion-plugin_topic .topic.actions { - clear: both; - padding-top: 10px; -} - -.proposal .actions .fb-share-button { - top: -3px; -} - -.topic-title h2 img { - max-height: 36px; - vertical-align: middle; - padding: 4px 0 4px 4px; -} - -#content .article-body.article-body-proposals-discussion-plugin_proposal .body { - padding-top: 10px; -} -#content .article-body.article-body-proposals-discussion-plugin_proposal .abstract { - text-align: right; - width: 50%; - padding-left: 50%; -} -#content .article-body.article-body-proposals-discussion-plugin_proposal .abstract .content { - font-style: italic; - color: rgb(70, 70, 70); -} -#content .article-body.article-body-proposals-discussion-plugin_proposal .discussion { - color: gray; -} diff --git a/plugins/proposals_discussion/test/functional/cms_controller_test.rb b/plugins/proposals_discussion/test/functional/cms_controller_test.rb deleted file mode 100644 index a798792..0000000 --- a/plugins/proposals_discussion/test/functional/cms_controller_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class CmsControllerTest < ActionController::TestCase - - def setup - @profile = fast_create(Community) - - @discussion = ProposalsDiscussionPlugin::Discussion.create!(:name => 'test', :profile => @profile) - @topic = ProposalsDiscussionPlugin::Topic.create!(:name => 'test', :profile => @profile, :parent => @discussion) - @proposal = ProposalsDiscussionPlugin::Proposal.create!(:name => 'test', :profile => @profile, :parent => @topic, :abstract => "Abstract", :body => "Proposal Body") - - user = create_user('testinguser') - @profile.add_admin(user.person) - login_as(user.login) - end - - attr_reader :profile, :proposal, :topic, :discussion - - should 'display custom body label when edit a proposal' do - discussion.custom_body_label = "My Custom Label" - discussion.save! - get :edit, :id => proposal.id, :profile => profile.identifier - assert_tag :tag => 'label', :attributes => {:class => 'formlabel'}, :content => 'My Custom Label' - end - - should 'escape html tags in custom body label' do - discussion.custom_body_label = "My Custom " - discussion.save! - get :edit, :id => proposal.id, :profile => profile.identifier - assert_tag :tag => 'label', :attributes => {:class => 'formlabel'}, :content => 'My Custom Label' - end - -end diff --git a/plugins/proposals_discussion/test/functional/content_viewer_controller_test.rb b/plugins/proposals_discussion/test/functional/content_viewer_controller_test.rb deleted file mode 100644 index 78cb446..0000000 --- a/plugins/proposals_discussion/test/functional/content_viewer_controller_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ContentViewerControllerTest < ActionController::TestCase - - def setup - @profile = fast_create(Community) - - @discussion = ProposalsDiscussionPlugin::Discussion.create!(:name => 'test', :profile => @profile) - @topic = ProposalsDiscussionPlugin::Topic.create!(:name => 'test', :profile => @profile, :parent => @discussion) - @proposal = ProposalsDiscussionPlugin::Proposal.create!(:name => 'test', :profile => @profile, :parent => @topic, :abstract => "Abstract", :body => "Proposal Body") - end - - attr_reader :profile, :proposal, :topic, :discussion - - should 'display custom proposal page' do - get :view_page, proposal.url - assert_tag :tag => 'div', :attributes => {:class => 'content'}, :content => 'Abstract' - assert_tag :tag => 'div', :attributes => {:class => 'content'}, :content => 'Proposal Body' - end - -end diff --git a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_myprofile_controller_test.rb b/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_myprofile_controller_test.rb deleted file mode 100644 index d4ef2ee..0000000 --- a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_myprofile_controller_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProposalsDiscussionPluginMyprofileControllerTest < ActionController::TestCase - - def setup - @profile = fast_create(Community) - @discussion = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - @topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => @discussion.id, :profile_id => @profile.id) - @person = create_user_with_permission('testinguser', 'post_content') - login_as :testinguser - end - - attr_reader :profile, :discussion, :topic, :person - - should 'list topics for selection' do - 3.times {fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id, :profile_id => profile.id)} - get :select_topic, :profile => profile.identifier, :parent_id => discussion.id - assert_equal discussion, assigns(:discussion) - assert_select 'div#topics' do - assert_select 'div.content', discussion.topics.count - assert_select "input[name='discussion[topic]']", discussion.topics.count - end - assert_tag :form, :attributes => {:action => "/myprofile/#{profile.identifier}/plugin/proposals_discussion/myprofile/new_proposal"} - end - - should 'new_proposal redirect to cms controller' do - get :new_proposal, :profile => profile.identifier, :discussion => {:topic => topic.id}, :parent_id => discussion.id - assert_redirected_to :controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id - end - - should 'publish a proposal' do - proposal = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :profile_id => profile.id, :published => false, :created_by_id => person.id) - get :publish_proposal, :proposal_id => proposal.id, :profile => profile.identifier - assert proposal.reload.published - end - - should 'do not publish if the logged user do not have edition permission' do - proposal = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :profile_id => profile.id, :published => false) - get :publish_proposal, :proposal_id => proposal.id, :profile => profile.identifier - assert_response 403 - assert !proposal.reload.published - end - - should 'new_proposal without a topic redirect to back' do - get :new_proposal, :profile => profile.identifier, :parent_id => discussion.id - assert_template 'select_topic' - end - -end diff --git a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_profile_controller_test.rb b/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_profile_controller_test.rb deleted file mode 100644 index 69642af..0000000 --- a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_profile_controller_test.rb +++ /dev/null @@ -1,37 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProposalsDiscussionPluginProfileControllerTest < ActionController::TestCase - - def setup - @profile = fast_create(Community) - @discussion = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - @topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => @discussion.id, :profile_id => @profile.id) - @person = create_user_with_permission('testinguser', 'post_content') - login_as :testinguser - end - - attr_reader :profile, :discussion, :topic, :person - - should 'assigns comments of all proposals' do - discussion.class.any_instance.stubs(:allow_create?).returns(true) - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :profile_id => profile.id, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :profile_id => profile.id, :parent_id => topic.id) - comment1 = fast_create(Comment, :source_id => proposal1.id) - comment2 = fast_create(Comment, :source_id => proposal1.id) - comment3 = fast_create(Comment, :source_id => proposal2.id) - get :export, :format => :csv, :article_id => discussion.id, :profile => profile.identifier - assert_equivalent [comment1, comment2, comment3], assigns(:comments) - end - - should 'deny access to export when user is not logged' do - logout - get :export, :format => :csv, :article_id => discussion.id, :profile => profile.identifier - assert_template 'access_denied' - end - - should 'deny access to export when user has no permission' do - get :export, :format => :csv, :article_id => discussion.id, :profile => profile.identifier - assert_template 'access_denied' - end - -end diff --git a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_public_controller_test.rb b/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_public_controller_test.rb deleted file mode 100644 index 822d151..0000000 --- a/plugins/proposals_discussion/test/functional/proposals_discussion_plugin_public_controller_test.rb +++ /dev/null @@ -1,98 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProposalsDiscussionPluginPublicControllerTest < ActionController::TestCase - - def setup - @profile = fast_create(Community) - @discussion = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - @topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => @discussion.id, :profile_id => @profile.id) - end - - attr_reader :profile, :discussion, :topic - - should 'load proposals' do - proposals = 3.times.map { fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal title', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id)} - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id - assert_equivalent proposals, assigns(:proposals) - end - - should 'add link to next page' do - proposal = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal title', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id - assert_match /href=.*page=2/, response.body - end - - should 'not render more link if it was the last page' do - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id - assert_select 'div.more a', 0 - end - - should 'load proposals with alphabetical order' do - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'z proposal', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'abc proposal', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal3 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'abd proposal', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id, :order => 'alphabetical' - assert_equal [proposal2, proposal3, proposal1], assigns(:proposals) - end - - should 'load proposals with most commented order' do - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal1', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal2', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal3 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal3', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - - author = fast_create(Person) - Comment.create!(:source => proposal2, :body => 'text', :author => author) - Comment.create!(:source => proposal2, :body => 'text', :author => author) - Comment.create!(:source => proposal3, :body => 'text', :author => author) - - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id, :order => 'most_commented' - assert_equal [proposal2, proposal3, proposal1], assigns(:proposals) - end - - should 'load proposals with most recent order' do - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'z', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id, :created_at => Date.today - 2.day) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'b', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id, :created_at => Date.today - 1.day) - proposal3 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'k', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id, :created_at => Date.today) - - author = fast_create(Person) - - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id, :order => 'recent' - assert_equal [proposal3, proposal2, proposal1].map(&:name), assigns(:proposals).map(&:name) - end - - should 'load proposals with most recently commented order' do - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal1', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal2', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - proposal3 = fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal3', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id) - - author = fast_create(Person) - Comment.create!({:source => proposal2, :body => 'text', :author => author, :created_at => 10.days.ago}, :without_protection => true) - Comment.create!({:source => proposal2, :body => 'text', :author => author, :created_at => 10.days.ago}, :without_protection => true) - Comment.create!(:source => proposal3, :body => 'text', :author => author) - Comment.create!(:source => proposal3, :body => 'text', :author => author) - Comment.create!(:source => proposal1, :body => 'text', :author => author) - - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id, :order => 'most_recently_commented' - assert_equal [proposal3, proposal1, proposal2], assigns(:proposals) - end - - should 'load proposals when profile is private and the user is a member' do - person = create_user.person - login_as(person.identifier) - profile.add_member(person) - profile.update_attribute(:public_profile, false) - - proposals = 3.times.map { fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal title', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id)} - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id - assert_equivalent proposals, assigns(:proposals) - end - - should 'not load proposals when profile is private and user is not logged' do - logout - profile.update_attribute(:public_profile, false) - proposals = 3.times.map { fast_create(ProposalsDiscussionPlugin::Proposal, :name => 'proposal title', :abstract => 'proposal abstract', :profile_id => profile.id, :parent_id => topic.id)} - get :load_proposals, :profile => profile.identifier, :holder_id => topic.id - assert_equal nil, assigns(:proposals) - end - -end diff --git a/plugins/proposals_discussion/test/test_helper.rb b/plugins/proposals_discussion/test/test_helper.rb deleted file mode 100644 index cca1fd3..0000000 --- a/plugins/proposals_discussion/test/test_helper.rb +++ /dev/null @@ -1 +0,0 @@ -require File.dirname(__FILE__) + '/../../../test/test_helper' diff --git a/plugins/proposals_discussion/test/unit/discussion_test.rb b/plugins/proposals_discussion/test/unit/discussion_test.rb deleted file mode 100644 index 80c975c..0000000 --- a/plugins/proposals_discussion/test/unit/discussion_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class DiscussionTest < ActiveSupport::TestCase - - def setup - @profile = fast_create(Community) - @discussion = ProposalsDiscussionPlugin::Discussion.new(:name => 'test', :profile => @profile) - end - - attr_reader :profile, :discussion - - should 'return list of topics' do - discussion.save! - topic1 = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id) - topic2 = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id) - assert_equivalent [topic1, topic2], discussion.topics - end - - should 'return list of proposals' do - discussion.save! - topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id) - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - assert_equivalent [proposal1, proposal2], discussion.proposals - end - -end diff --git a/plugins/proposals_discussion/test/unit/proposal_test.rb b/plugins/proposals_discussion/test/unit/proposal_test.rb deleted file mode 100644 index 5813fff..0000000 --- a/plugins/proposals_discussion/test/unit/proposal_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProposalTest < ActiveSupport::TestCase - - def setup - @profile = fast_create(Community) - @person = fast_create(Person) - @proposal = ProposalsDiscussionPlugin::Proposal.new(:name => 'test', :profile => @profile) - @proposal.created_by = @person - end - - attr_reader :profile, :proposal, :person - - should 'save a proposal' do - proposal.abstract = 'abstract' - assert proposal.save - end - - should 'do not save a proposal without abstract' do - proposal.save - assert proposal.errors['abstract'].present? - end - - should 'allow edition if user is the author' do - assert proposal.allow_edit?(person) - end - - should 'do not allow edition if user is not the author' do - assert !proposal.allow_edit?(fast_create(Person)) - end - - should 'return body when to_html was called with feed=true' do - assert_equal proposal.body, proposal.to_html(:feed => true) - end - - should 'return a proc when to_html was called with feed=false' do - assert proposal.to_html(:feed => false).kind_of?(Proc) - end - - should 'return a proc when to_html was called with no feed parameter' do - assert proposal.to_html.kind_of?(Proc) - end - - should 'return proposals by discussion' do - discussion = fast_create(ProposalsDiscussionPlugin::Discussion) - topic = fast_create(ProposalsDiscussionPlugin::Topic, :parent_id => discussion.id) - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal) - proposal3 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - - assert_equivalent [proposal1, proposal3], ProposalsDiscussionPlugin::Proposal.from_discussion(discussion) - end - -end diff --git a/plugins/proposals_discussion/test/unit/proposals_discussion_plugin_test.rb b/plugins/proposals_discussion/test/unit/proposals_discussion_plugin_test.rb deleted file mode 100644 index 1b1b235..0000000 --- a/plugins/proposals_discussion/test/unit/proposals_discussion_plugin_test.rb +++ /dev/null @@ -1,70 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ProposalsDiscussionPluginTest < ActiveSupport::TestCase - - def setup - @plugin = ProposalsDiscussionPlugin.new - @profile = fast_create(Community) - @params = {} - @plugin.stubs(:context).returns(self) - end - - attr_reader :plugin, :profile, :params - - should 'has stylesheet' do - assert @plugin.stylesheet? - end - - should 'return Discussion as a content type' do - @params[:parent_id] = nil - assert_includes plugin.content_types, ProposalsDiscussionPlugin::Discussion - end - - should 'return Topic as a content type if parent is a Discussion' do - parent = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - @params[:parent_id] = parent.id - assert_includes plugin.content_types, ProposalsDiscussionPlugin::Topic - end - - should 'return Proposal as a content type if parent is a Topic' do - parent = fast_create(ProposalsDiscussionPlugin::Topic, :profile_id => @profile.id) - @params[:parent_id] = parent.id - assert_includes plugin.content_types, ProposalsDiscussionPlugin::Proposal - end - - should 'do not return Proposal as a content type if parent is nil' do - @params[:parent_id] = nil - assert_not_includes plugin.content_types, ProposalsDiscussionPlugin::Proposal - end - - should 'remove new button from content page for a discussion' do - page = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - assert plugin.content_remove_new(page) - end - - should 'remove upload button from content page for a discussion' do - page = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) - assert plugin.content_remove_upload(page) - end - - should 'remove new button from content page for a proposal' do - page = fast_create(ProposalsDiscussionPlugin::Proposal, :profile_id => @profile.id) - assert plugin.content_remove_new(page) - end - - should 'remove upload button from content page for a proposal' do - page = fast_create(ProposalsDiscussionPlugin::Proposal, :profile_id => @profile.id) - assert plugin.content_remove_upload(page) - end - - should 'do not remove new button from content page for others article types' do - page = fast_create(Article, :profile_id => @profile.id) - assert !plugin.content_remove_new(page) - end - - should 'do not remove upload button from content page for others article types' do - page = fast_create(Article, :profile_id => @profile.id) - assert !plugin.content_remove_upload(page) - end - -end diff --git a/plugins/proposals_discussion/test/unit/topic_test.rb b/plugins/proposals_discussion/test/unit/topic_test.rb deleted file mode 100644 index dccc0fa..0000000 --- a/plugins/proposals_discussion/test/unit/topic_test.rb +++ /dev/null @@ -1,50 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class TopicTest < ActiveSupport::TestCase - - def setup - @profile = fast_create(Community) - @topic = ProposalsDiscussionPlugin::Topic.new(:name => 'test', :profile => @profile) - end - - attr_reader :profile, :topic - - should 'return list of proposals' do - topic.save! - proposal1 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - proposal2 = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - assert_equivalent [proposal1, proposal2], topic.proposals - end - - should 'allow any user to create proposals in a topic' do - assert topic.allow_create?(Person.new) - end - - should 'return list of comments' do - topic.save! - proposal = fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id) - comment1 = fast_create(Comment, :source_id => proposal.id) - comment2 = fast_create(Comment, :source_id => proposal.id) - assert_equivalent [comment1, comment2], topic.proposals_comments - end - - should 'return list of authors' do - topic.save! - author1 = fast_create(Person) - author2 = fast_create(Person) - fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :created_by_id => author1) - fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :created_by_id => author2) - assert_equivalent [author1, author2], topic.proposals_authors - end - - should 'return most active participants' do - topic.save! - author1 = fast_create(Person) - author2 = fast_create(Person) - fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :created_by_id => author1) - fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :created_by_id => author2) - fast_create(ProposalsDiscussionPlugin::Proposal, :parent_id => topic.id, :created_by_id => author2) - assert_equal [author2, author1], topic.most_active_participants - end - -end diff --git a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_discussion.html.erb b/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_discussion.html.erb deleted file mode 100644 index 528d0ac..0000000 --- a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_discussion.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -sdadasda -<%= required_fields_message %> - -<%= required f.text_field('name', :size => '64', :maxlength => 150) %> -<%= render :partial => 'general_fields' %> - -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %> - -<%= f.text_field(:custom_body_label) %> diff --git a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_proposal.html.erb b/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_proposal.html.erb deleted file mode 100644 index 524ce58..0000000 --- a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_proposal.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<%= required_fields_message %> - -<%= render :file => 'shared/tiny_mce' %> - -<% title_limit = 70 %> -<% abstract_limit = 140 %> - -<% extend ProposalsDiscussionPlugin::TopicHelper %> - -
- -
- <%= topic_title @article.topic %> -
- -
- <%= required labelled_form_field _('Title'), limited_text_area(:article, :name, title_limit, 'title_textarea', :rows => 1) %> -
- -
- <%= required labelled_form_field _('Abstract'), limited_text_area(:article, :abstract, abstract_limit, 'abstract_textarea') %> -
- -
- <% editor_type = 'mceEditor' %> - <%= labelled_form_field(strip_tags(@article.topic.discussion.custom_body_label), text_area(:article, :body, :class => editor_type)) %> -
-
- - diff --git a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_topic.html.erb b/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_topic.html.erb deleted file mode 100644 index ab14a05..0000000 --- a/plugins/proposals_discussion/views/cms/proposals_discussion_plugin/_topic.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%= stylesheet_link_tag 'spectrum.css' %> -<%= javascript_include_tag "spectrum.js" %> -<%= javascript_include_tag "colorpicker-noosfero.js" %> - -<%= required_fields_message %> - -<%= required f.text_field('name', :size => '64', :maxlength => 150) %> -<%= render :partial => 'general_fields' %> - -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %> - -<%= labelled_colorpicker_field(_('Color:'), :article, :color) %> - - -<%= f.fields_for :image_builder, @article.image do |i| %> - <%= file_field_or_thumbnail(_('Image:'), @article.image, i)%> - <%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> -<% end %> diff --git a/plugins/proposals_discussion/views/content_viewer/_proposal_card.html.erb b/plugins/proposals_discussion/views/content_viewer/_proposal_card.html.erb deleted file mode 100644 index 7327c51..0000000 --- a/plugins/proposals_discussion/views/content_viewer/_proposal_card.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -
-
- <% if proposal_card.published? %> - <% normalized_score = proposal_card.normalized_score(@holder) %> - <% pos = 26 * (normalized_score*4 - 1).round %> -   - <% end %> -
-
-
- <%= link_to proposal_card.name, proposal_card.view_url %> -
- <% if proposal_card.published? %> -
- <%= render :partial => 'content_viewer/social', :locals => {:proposal => proposal_card} %> -
- <% else %> -
- <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'publish_proposal', :proposal_id => proposal_card.id}), :class => 'button with-text icon-suggest' do %> - <%= _("Publish") %> - <% end %> -
- <% end %> -
- <%= link_to strip_tags(proposal_card.abstract), proposal_card.view_url %> -
-
-
diff --git a/plugins/proposals_discussion/views/content_viewer/_proposals_list.html.erb b/plugins/proposals_discussion/views/content_viewer/_proposals_list.html.erb deleted file mode 100644 index 5d0bea0..0000000 --- a/plugins/proposals_discussion/views/content_viewer/_proposals_list.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<% extend ProposalsDiscussionPlugin::ProposalsListHelper %> - -
- -<% private_proposals = user ? holder.proposals.private(user) : [] %> -<% unless private_proposals.empty? %> -
- <%= render :partial => 'content_viewer/proposal_card', :collection => private_proposals %> -
-<% end %> - -<% order ||= 'random' %> -
-
- <% sort_criteria.each_with_index do |order, i| %> - <%= link_to order.first, url_for({:controller => 'proposals_discussion_plugin_public', :action => 'load_proposals', :holder_id => holder.id, :profile => profile.identifier, :order => order.second}), :remote => true, :class => "order #{order.second} #{i==0 ? 'selected':''}" %> - <% end %> -
-
- -
-
- Loading<%= _("Loading...") %> - <%= more_proposals('', holder, order) %> -
-
-
diff --git a/plugins/proposals_discussion/views/content_viewer/_proposals_list_content.html.erb b/plugins/proposals_discussion/views/content_viewer/_proposals_list_content.html.erb deleted file mode 100644 index 6df8274..0000000 --- a/plugins/proposals_discussion/views/content_viewer/_proposals_list_content.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<%= render :partial => 'content_viewer/proposal_card', :collection => proposals %> - -<% extend ProposalsDiscussionPlugin::ProposalsListHelper %> - -
- <%= more_proposals(_('More'), holder, order, page) unless proposals.empty? %> -
diff --git a/plugins/proposals_discussion/views/content_viewer/_social.html.erb b/plugins/proposals_discussion/views/content_viewer/_social.html.erb deleted file mode 100644 index 0dda388..0000000 --- a/plugins/proposals_discussion/views/content_viewer/_social.html.erb +++ /dev/null @@ -1,3 +0,0 @@ - - -
diff --git a/plugins/proposals_discussion/views/content_viewer/discussion.html.erb b/plugins/proposals_discussion/views/content_viewer/discussion.html.erb deleted file mode 100644 index 4343504..0000000 --- a/plugins/proposals_discussion/views/content_viewer/discussion.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> - -<%= add_rss_feed_to_head(discussion.name, discussion.feed.url) if discussion.feed %> - -
- <%= discussion.body %> -
- -<% if discussion.allow_create?(user) %> -
- <%= link_to({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Topic", :parent_id => discussion.id}, :class => 'button with-text icon-add') do %> - <%= _("New Topic") %> - <% end %> - <%= link_to({:controller => :proposals_discussion_plugin_profile, :action => :export, :format => :csv, :article_id => discussion.id}, :class => 'button with-text icon-spread') do %> - <%= _('Export') %> - <% end %> -
-<% end %> - -
-
-
- <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'select_topic', :parent_id => discussion.id}), :class => 'button with-text icon-add' do %> - <%= _("Send your proposal!") %> - <% end %> -
- <% discussion.topics.includes(:profile).each do |topic| %> -
- <%= render :file => 'content_viewer/topic', :locals => {:topic => topic, :list_view => true} %> -
- <% end %> -
- diff --git a/plugins/proposals_discussion/views/content_viewer/proposal.html.erb b/plugins/proposals_discussion/views/content_viewer/proposal.html.erb deleted file mode 100644 index 9f5522e..0000000 --- a/plugins/proposals_discussion/views/content_viewer/proposal.html.erb +++ /dev/null @@ -1,31 +0,0 @@ - - <%= show_date(proposal.published_at) %> - <%= _(", by %s") % (proposal.author ? link_to(proposal.author_name, proposal.author_url) : proposal.author_name) %> - <%= _(" - %s") % link_to_comments(proposal) %> - - -
-
<%= proposal.topic.discussion.title %>
-
- -<% extend ProposalsDiscussionPlugin::TopicHelper %> - -
- <%= topic_title proposal.topic %> -
- -
-
<%= proposal.abstract %>
-
- -
-
<%= proposal.body %>
-
- -<% if proposal.created_by == user && !proposal.published %> -
- <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'publish_proposal', :proposal_id => proposal.id}), :class => 'button with-text icon-suggest' do %> - <%= _("Publish") %> - <% end %> -
-<% end %> diff --git a/plugins/proposals_discussion/views/content_viewer/topic.html.erb b/plugins/proposals_discussion/views/content_viewer/topic.html.erb deleted file mode 100644 index d9fbaa1..0000000 --- a/plugins/proposals_discussion/views/content_viewer/topic.html.erb +++ /dev/null @@ -1,64 +0,0 @@ -<% list_view ||= false %> - -<% unless list_view %> - <%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> -<% end %> - -<% extend ProposalsDiscussionPlugin::TopicHelper %> -<%= topic_title topic %> - -
- -
- <%= topic.body %> -
- -<% unless list_view %> -

<%= topic.discussion.title %>

- -
-
<%= _('Statistics') %>
- -
-
-
- <%= javascript_include_tag 'plugins/proposals_discussion/proposals_graph.js' %> - - -
-
- <%= _('Number of Proposals: ') %> - <%= topic.proposals.count %> -
-
- <%= _('Number of Participants: ') %> - <%= topic.proposals_authors.count %> -
-
- <%= _('Number of Comments: ') %> - <%= topic.proposals_comments.count %> -
-
- <%= _('Most active: ') %> - - <% topic.most_active_participants.each do |author| %> - <%= link_to profile_image(author, :icon), author.url, :title => author.name %> - <% end %> - -
-
-
-
- <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %> -
- -
- <%= link_to url_for({:controller => 'cms', :action => 'new', :type => "ProposalsDiscussionPlugin::Proposal", :parent_id => topic.id}), :class => 'button with-text icon-add' do %> - <%= _("Send your proposal") %> - <% end %> -
-<% end %> - -<%= render :partial => 'content_viewer/proposals_list', :locals => {:holder => topic} %> - -
diff --git a/plugins/proposals_discussion/views/proposals_discussion_plugin_myprofile/select_topic.html.erb b/plugins/proposals_discussion/views/proposals_discussion_plugin_myprofile/select_topic.html.erb deleted file mode 100644 index 8eeee03..0000000 --- a/plugins/proposals_discussion/views/proposals_discussion_plugin_myprofile/select_topic.html.erb +++ /dev/null @@ -1,39 +0,0 @@ - - -
-

<%= @discussion.title %>

- <%= form_for :discussion, :url => {:controller => 'proposals_discussion_plugin_myprofile', :action => 'new_proposal'} do %> - -

<%= _('Select topic') %>

-
- - <% @discussion.topics.each do |topic| %> -

- <%= radio_button_tag('discussion[topic]', topic.id) %> - <%= topic.title %> -

-
- <%= topic.body %> -
- <% end %> - -
-
- - <%= hidden_field_tag :parent_id, @discussion.id %> - -
- <%= submit_button(:next, _('Next')) %> - <%= button :cancel, _('Cancel'), @discussion.view_url %> -
- <% end %> -
diff --git a/plugins/proposals_discussion/views/proposals_discussion_plugin_profile/export.csv.erb b/plugins/proposals_discussion/views/proposals_discussion_plugin_profile/export.csv.erb deleted file mode 100644 index d1b9b19..0000000 --- a/plugins/proposals_discussion/views/proposals_discussion_plugin_profile/export.csv.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% require 'csv' %> - -<% header = [ - _('Topic'), - _('Proposal'), - _('Author'), - _('Author Email'), - _('Title'), - _('Body'), - _('Date') -] %> -<% header << _('Likes') if environment.plugin_enabled?('VotePlugin') %> -<% header << _('Dislikes') if environment.plugin_enabled?('VotePlugin') %> - -<%= CSV.generate_line(header, :row_sep => ?\t) %> - -<% @comments.each do |comment| %> - <% line = [ - comment.source.parent ? comment.source.parent.name : '', - comment.source.name, - comment.author_name, - comment.author_email, - comment.title, - comment.body, - comment.created_at, - ] %> - <% line << comment.votes_for if environment.plugin_enabled?('VotePlugin') %> - <% line << comment.votes_against if environment.plugin_enabled?('VotePlugin') %> - <%= CSV.generate_line(line, :row_sep => ?\t) %> -<% end %> -- libgit2 0.21.2
 '+(e.label||String.fromCharCode(65+t))+"