Merge branch 'master' into various_bugs
Conflicts: config/locales/en.yml config/locales/zh_tw.yml vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/back_end/writing_patents/_form.html.erb vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb
This commit is contained in:
commit
b40d4702d5
233 files changed
+3124
-5384
No files matched your search
@@ -1,10 +1,11 @@
|
||||
class Admin::InfosController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
helper Admin::AttributeValuesViewHelper
|
||||
|
||||
def index
|
||||
@attributes = Info.all.entries
|
||||
render :template => 'admin/attributes/index'
|
||||
@@ -32,8 +33,8 @@ class Admin::InfosController < ApplicationController
|
||||
|
||||
def update
|
||||
@attribute = Info.find(params[:id])
|
||||
# binding.pry
|
||||
@attribute.update_attributes(params[:info])
|
||||
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
@@ -47,10 +48,10 @@ class Admin::InfosController < ApplicationController
|
||||
end
|
||||
|
||||
def add_attribute_field
|
||||
@attribute = Info.find(params[:id]) rescue nil
|
||||
if !@attribute
|
||||
@attribute = Info.new
|
||||
end
|
||||
attribute = Info.find(params[:info_id]) rescue nil
|
||||
@attribute_field_counter = attribute.attribute_fields.count
|
||||
@attribute_field = attribute.attribute_fields.build
|
||||
@attribute_field.save
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -33,14 +33,10 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
@student_data = []
|
||||
@staff_data = []
|
||||
|
||||
|
||||
attribute_values = @user.attribute_values.reject{|att_val|
|
||||
# binding.pry if(att_val.id.to_s == '507fa1295789b52a540000e0')
|
||||
!att_val.attribute_field.locale and (att_val.attribute_field.neutral_for != I18n.locale.to_s)
|
||||
}
|
||||
|
||||
attribute_values = @user.attribute_values
|
||||
attribute_values.each{|att_val|
|
||||
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale)}) if att_val.attribute_field.attribute.key=="profile" rescue false
|
||||
binding.pry if att_val.id.to_s == '5052dab52b5c49ae9d000006'
|
||||
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale.to_s)}) if att_val.attribute_field.attribute.key=="profile" rescue false
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +71,6 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
binding.pry
|
||||
puts params.to_yaml
|
||||
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
|
||||
# attribute_values = params[:user].delete(attribute_values_key)
|
||||
@@ -84,6 +79,7 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||
# @user.attribute_values.build(value)
|
||||
# }
|
||||
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
|
||||
binding.pry
|
||||
if @user.save
|
||||
flash[:notice] = t('create.success.user')
|
||||
redirect_to :action => :index
|
||||
|
||||
@@ -103,11 +103,41 @@ class DesktopController< ApplicationController
|
||||
def getgroups
|
||||
@section = Section.find(params["sectionid"])
|
||||
@groups = @section.groups
|
||||
a = Array.new
|
||||
|
||||
gr = Array.new
|
||||
@groups.each do |group|
|
||||
a << group.tiles
|
||||
a = Array.new
|
||||
t = group.tiles
|
||||
t.each do |tile|
|
||||
data_content = ""
|
||||
jsfile = []
|
||||
cssfile = ""
|
||||
shape = "w1 h1"
|
||||
if tile.data_category == "widget"
|
||||
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
|
||||
# data_content = widge.widget_layout.file
|
||||
data_content = "desktop/widget_layout?id="+tile.desktop_widget_id.to_s
|
||||
jsfile = widge.javascripts.collect{|js| js.file}
|
||||
cssfile = widge.css_default.file
|
||||
shape = widge.shape
|
||||
title = widge.name
|
||||
else
|
||||
data_content = tile.data_content
|
||||
title = tile.title
|
||||
end
|
||||
a << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title}
|
||||
end
|
||||
gr << a
|
||||
end
|
||||
render :json =>a.to_json
|
||||
render :json =>gr.to_json
|
||||
end
|
||||
|
||||
def widget_layout
|
||||
widget = DesktopWidget.find(params[:id])
|
||||
link = '<link href="'+widget.css_default.file.to_s+'" media="screen" rel="stylesheet" type="text/css" />'
|
||||
content = widget.widget_layout.body
|
||||
dhtml = link + content
|
||||
render :text => dhtml.html_safe
|
||||
end
|
||||
|
||||
def getsectionlist
|
||||
|
||||
@@ -8,6 +8,7 @@ class DesktopPublicationsController< ApplicationController
|
||||
end
|
||||
|
||||
def journal_p_add
|
||||
debugger
|
||||
render "desktop/journal_pages/add", :layout => false
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
class DesktopWidgetsController < OrbitBackendController
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def upload
|
||||
if !params[:desktop_widget].nil?
|
||||
temp_file = Tempfile.new("temp_file")
|
||||
original_file = params[:desktop_widget][:package_file]
|
||||
#if original_file.content_type == 'application/zip'
|
||||
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
||||
temp_file.rewind
|
||||
filename = File.basename(original_file.original_filename,".zip")
|
||||
unzip_widget(temp_file, filename)
|
||||
#else
|
||||
# flash[:error] = "Upload file should be in zip format"
|
||||
#end
|
||||
temp_file.close
|
||||
end
|
||||
end
|
||||
|
||||
def unzip_widget(file, zip_name)
|
||||
Zip::ZipFile.open(file) { |zip_file|
|
||||
dw = DesktopWidget.new.from_json(zip_file.read("#{zip_name}/settings.json"))
|
||||
Dir.mktmpdir('f_path') { |dir|
|
||||
javascripts_entries = []
|
||||
images_entries = []
|
||||
|
||||
zip_file.entries.each do |entry|
|
||||
case (path = entry.to_s)
|
||||
when /\A(#{zip_name})\/(default\.css)\z/
|
||||
#for default css
|
||||
dw.build_css_default(:file => get_temp_file(zip_file, dir, entry))
|
||||
when /\A(#{zip_name})\/(widget\.html)\z/ #for layout html
|
||||
dw.build_widget_layout(:file => get_temp_file(zip_file, dir, entry))
|
||||
when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js
|
||||
javascripts_entries << entry
|
||||
when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img
|
||||
images_entries << entry
|
||||
end
|
||||
end
|
||||
|
||||
['javascripts', 'images'].each do |type|
|
||||
eval("#{type}_entries").each do |entry|
|
||||
eval("dw.#{type}").build(:file => get_temp_file(zip_file, dir, entry))
|
||||
end
|
||||
end
|
||||
}
|
||||
dw.save
|
||||
}
|
||||
end
|
||||
def get_temp_file(zip_file, dir, entry)
|
||||
filename = File.basename(entry.to_s)
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||
temp_file
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class OtheraccountsController< ApplicationController
|
||||
class Desktop::OtheraccountsController< ApplicationController
|
||||
require 'open-uri'
|
||||
require 'rexml/document'
|
||||
require 'net/http'
|
||||
|
||||
Reference in new issue
Block a user