Diff
Modified: trunk/app/controllers/license_attributes_controller.rb (2240 => 2241)
--- trunk/app/controllers/license_attributes_controller.rb 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/app/controllers/license_attributes_controller.rb 2009-07-07 17:22:49 UTC (rev 2241)
@@ -1,14 +1,9 @@
class LicenseAttributesController < ApplicationController
before_filter :login_required
before_filter :find_license_attribute, : [:index]
-
- def destroy
- @license_attribute = LicenseAttribute.find(params[:id])
- @license_attribute.destroy
- respond_to do |format|
- format.html { redirect_to license_url(@license_attribute.license) }
- end
+ def destroy
+ LicenseAttribute.find(params[:id]).destroy
end
Modified: trunk/app/controllers/licenses_controller.rb (2240 => 2241)
--- trunk/app/controllers/licenses_controller.rb 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/app/controllers/licenses_controller.rb 2009-07-07 17:22:49 UTC (rev 2241)
@@ -38,14 +38,13 @@
def update
@license = License.find(params[:id])
- @license_attributes = @license.license_attributes
- for @attrib in @license_attributes do
- @attrib.destroy
+ LicenseAttribute.destroy_all("license_id = #{params[:id]}")
+ if params[:license_attributes]
+ params[:license_attributes].each do |attrib,aval|
+ @license_attribute = LicenseAttribute.new(:license => @license, :license_option_id => attrib)
+ @license_attribute.save
+ end
end
- params[:license_attributes].each do |attrib,aval|
- @license_attribute = LicenseAttribute.new(:license => @license, :license_option_id => attrib)
- @license_attribute.save
- end
if @license.update_attributes(params[:license])
flash[:notice] = 'License was successfully updated.'
redirect_to :action ="" 'show', :id => @license
@@ -56,7 +55,7 @@
def destroy
if (Workflow.find_all_by_license_id(params[:id]).empty? and Blob.find_all_by_license_id(params[:id]).empty? )
- # License.find(params[:id]).destroy
+ License.find(params[:id]).destroy
flash[:notice] = 'License was successfully deleted.'
else
flash[:error] = 'License could not be deleted because it is in use.'
Modified: trunk/app/models/license.rb (2240 => 2241)
--- trunk/app/models/license.rb 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/app/models/license.rb 2009-07-07 17:22:49 UTC (rev 2241)
@@ -14,9 +14,9 @@
if license.id
license_id=license.id
else
- license_id="0"
+ license_id='0'
end
- return LicenseOption.find_by_sql("SELECT license_options.title, license_options.id, lic_att.isset FROM license_options LEFT JOIN ( SELECT license_option_id, 1 AS isset FROM license_attributes WHERE license_id = #{license_id}) AS lic_att ON license_options.id = lic_att.license_option_id")
+ return LicenseOption.find_by_sql("SELECT license_options.title, license_options.description, license_options.id, lic_att.isset FROM license_options LEFT JOIN ( SELECT license_option_id, 1 AS isset FROM license_attributes WHERE license_id = #{license_id}) AS lic_att ON license_options.id = lic_att.license_option_id")
end
def license_attributes
return LicenseAttribute.find_by_sql("SELECT * FROM license_attributes INNER JOIN license_options on license_attributes.license_option_id=license_options.id WHERE license_id = #{self.id}")
Modified: trunk/app/views/license_attributes/_attributes_form.rhtml (2240 => 2241)
--- trunk/app/views/license_attributes/_attributes_form.rhtml 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/app/views/license_attributes/_attributes_form.rhtml 2009-07-07 17:22:49 UTC (rev 2241)
@@ -3,7 +3,7 @@
<div class="foldTitle">
<%= info_icon_with_tooltip("Here you can add attributes to <strong>describe</strong> this license.") %>
<span>Attributes</span>
- <% if edit %>
+ <% if license.id %>
<hr />
<small>Current: <%= license.license_attributes.size %> attribute(s)</small>
<% end %>
@@ -16,7 +16,7 @@
<p>
<label for="" a.id %>">
<input <%= 'checked' if a.isset %> style="margin-right: 0.3em;" value="<%= a.id %>" type="checkbox" name="license_attributes[<%= a.id %>][id]" id="license_attributes_<%= a.id %> " />
- <%= h(a.title) %>
+ <b><%= h(a.title) %>:</b> <%= h(a.description) %>
</label>
</p>
<% end %>
Modified: trunk/db/migrate/077_create_licenses.rb (2240 => 2241)
--- trunk/db/migrate/077_create_licenses.rb 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/db/migrate/077_create_licenses.rb 2009-07-07 17:22:49 UTC (rev 2241)
@@ -221,8 +221,16 @@
#Apache
License.create(:user_id => uid, :unique_name => 'Apache', :title => 'Apache License v2.0', :description => "<p>See <a href=''>http://www.apache.org/licenses/LICENSE-2.0</a></p>", :url ="" "http://www.apache.org/licenses/LICENSE-2.0")
+
+ #Public Domain
+ License.create(:user_id => uid, :unique_name => 'CC0', :title => 'CC0 1.0 Universal (Public Domain License)', :description => "<p>The person who associated a work with this document has dedicated this work to the Commons by waiving all of his or her rights to the work under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.</p>
+<p><b>Other Rights</b> — In no way are any of the following rights affected by CC0:</p>
+<ul>
+ <li>Patent or trademark rights held by the person who associated this document with a work.</li>
+ <li>Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.</li>
+</ul>", :url ="" "http://creativecommons.org/publicdomain/zero/1.0/")
end
-
+
def self.down
drop_table :licenses
end
Modified: trunk/db/migrate/078_create_license_options.rb (2240 => 2241)
--- trunk/db/migrate/078_create_license_options.rb 2009-07-07 15:11:45 UTC (rev 2240)
+++ trunk/db/migrate/078_create_license_options.rb 2009-07-07 17:22:49 UTC (rev 2241)
@@ -28,7 +28,7 @@
LicenseOption.create(:user_id => uid, :title => 'Requires Source Code', :description => 'Requires source code (the preferred form for making modifications) must be provided when exercising some rights granted by the license.', :uri => 'http://creativecommons.org/ns#SourceCode', :predicate => 'requires')
LicenseOption.create(:user_id => uid, :title => 'Requires Copyleft', :description => 'Requires derivative and combined works must be licensed under specified terms, similar to those on the original work', :uri => 'http://creativecommons.org/ns#Copyleft', :predicate => 'requires')
LicenseOption.create(:user_id => uid, :title => 'Requires Lesser Copyleft', :description => 'Requires derivative works must be licensed under specified terms, with at least the same conditions as the original work; combinations with the work may be licensed under different terms', :uri => 'http://creativecommons.org/ns#LesserCopyleft', :predicate => 'requires')
- LicenseOption.create(:user_id => uid, :title => 'Prohibits Commercial User', :description => 'Prohibits exercising rights for commercial purposes', :uri => 'http://creativecommons.org/ns#CommercialUse', :predicate => 'prohibits')
+ LicenseOption.create(:user_id => uid, :title => 'Prohibits Commercial Use', :description => 'Prohibits exercising rights for commercial purposes', :uri => 'http://creativecommons.org/ns#CommercialUse', :predicate => 'prohibits')
end
def self.down