app/models/proquest_behaviors.rb
# Export a zipped directory of an ETD in the format expected by ProQuest
# @return [String] the full path of the exported .zip file
Export a zipped directory of an ETD in the format expected by ProQuest
Export a zipped directory of an ETD in the format expected by ProQuest
def export_proquest_xml
    @registrar_data = registrar_data
    lastname, firstname = creator.first.split(", ")
    builder = Nokogiri::XML::Builder.new do |xml|
      xml.DISS_submission(publishing_option: "0", embargo_code: embargo_code) {
        xml.DISS_authorship {
          xml.DISS_author(type: 'primary') {
            xml.DISS_name {
              xml.DISS_surname lastname
              xml.DISS_fname firstname
              xml.DISS_affiliation department.first
            }
            xml.DISS_contact(type: "future") {
              xml.DISS_contact_effdt Time.zone.today.strftime('%m/%d/%Y')
              xml.DISS_address {
                xml.DISS_addrline "#{@registrar_data['home address 1']} #{@registrar_data['home address 2']} #{@registrar_data['home address 3']}".strip!
                xml.DISS_city @registrar_data["home address city"]
                xml.DISS_st @registrar_data["home address state"]
                xml.DISS_pcode @registrar_data["home address postal code"]
                xml.DISS_country @registrar_data["home address country code"][0..1]
              }
              xml.DISS_email post_graduation_email.first
            }
          }
        }
        xml.DISS_description(external_id: id, page_count: page_count, type: proquest_submission_type, apply_for_copyright: "no") {
          xml.DISS_title title.first
          xml.DISS_dates {
            xml.DISS_comp_date proquest_diss_comp_date
            xml.DISS_accept_date proquest_diss_accept_date
          }
          xml.DISS_degree "Ph.D."
          xml.DISS_institution {
            xml.DISS_inst_code "0665"
            xml.DISS_inst_name "Emory University"
            xml.DISS_inst_contact department.first
            xml.DISS_processing_code proquest_processing_code
          }
          xml.DISS_advisor {
            xml.DISS_name {
              xml.DISS_surname committee_chair.first.last_name
              xml.DISS_fname committee_chair.first.first_name
              xml.DISS_affiliation committee_chair.first.affiliation.first
            }
          }
          committee_members.each do |committee_member|
            xml.DISS_cmte_member {
              xml.DISS_name {
                xml.DISS_surname committee_member.last_name
                xml.DISS_fname committee_member.first_name
                xml.DISS_affiliation committee_member.affiliation.first
              }
            }
          end
          xml.DISS_categorization {
            research_field.each do |field_name|
              xml.DISS_category {
                xml.DISS_cat_code proquest_code(field_name)
                xml.DISS_cat_desc field_name
              }
            end
            keyword.each do |k|
              xml.DISS_keyword k
            end
            xml.DISS_ISBN
            xml.DISS_language proquest_language
          }
        }
        xml.DISS_content {
          xml.DISS_abstract mce_to_proquest(abstract.first)
          xml.DISS_binary(primary_pdf_file_name, type: "PDF")
          members.select { |a| a.pcdm_use == "supplementary" }.each do |attachment|
            xml.DISS_attachment {
              xml.DISS_file_name attachment.label
              xml.DISS_file_category attachment.file_type
              xml.DISS_file_descr attachment.description.first
            }
          end
        }
        if embargo_code == 4
          xml.DISS_restriction {
            xml.DISS_sales_restriction(code: 1, remove: (Time.zone.today + 6.years).strftime("%m/%d/%Y"))
          }
        end
      }
    end
    CGI.unescapeHTML(builder.to_xml)
  end
def export_proquest_xml @registrar_data = registrar_data lastname , firstname = creator . first . split ( ", " ) builder = Nokogiri :: XML :: Builder . new do | xml | xml . DISS_submission ( publishing_option : "0" , embargo_code : embargo_code ) { xml . DISS_authorship { xml . DISS_author ( type : 'primary' ) { xml . DISS_name { xml . DISS_surname lastname xml . DISS_fname firstname xml . DISS_affiliation department . first } xml . DISS_contact ( type : "future" ) { xml . DISS_contact_effdt Time . zone . today . strftime ( '%m/%d/%Y' ) xml . DISS_address { xml . DISS_addrline "#{@registrar_data['home address 1']} #{@registrar_data['home address 2']} #{@registrar_data['home address 3']}" . strip! xml . DISS_city @registrar_data [ "home address city" ] xml . DISS_st @registrar_data [ "home address state" ] xml . DISS_pcode @registrar_data [ "home address postal code" ] xml . DISS_country @registrar_data [ "home address country code" ] [ 0 .. 1 ] } xml . DISS_email post_graduation_email . first } } } xml . DISS_description ( external_id : id , page_count : page_count , type : proquest_submission_type , apply_for_copyright : "no" ) { xml . DISS_title title . first xml . DISS_dates { xml . DISS_comp_date proquest_diss_comp_date xml . DISS_accept_date proquest_diss_accept_date } xml . DISS_degree "Ph.D." xml . DISS_institution { xml . DISS_inst_code "0665" xml . DISS_inst_name "Emory University" xml . DISS_inst_contact department . first xml . DISS_processing_code proquest_processing_code } xml . DISS_advisor { xml . DISS_name { xml . DISS_surname committee_chair . first . last_name xml . DISS_fname committee_chair . first . first_name xml . DISS_affiliation committee_chair . first . affiliation . first } } committee_members . each do | committee_member | xml . DISS_cmte_member { xml . DISS_name { xml . DISS_surname committee_member . last_name xml . DISS_fname committee_member . first_name xml . DISS_affiliation committee_member . affiliation . first } } end xml . DISS_categorization { research_field . each do | field_name | xml . DISS_category { xml . DISS_cat_code proquest_code ( field_name ) xml . DISS_cat_desc field_name } end keyword . each do | k | xml . DISS_keyword k end xml . DISS_ISBN xml . DISS_language proquest_language } } xml . DISS_content { xml . DISS_abstract mce_to_proquest ( abstract . first ) xml . DISS_binary ( primary_pdf_file_name , type : "PDF" ) members . select { | a | a . pcdm_use == "supplementary" } . each do | attachment | xml . DISS_attachment { xml . DISS_file_name attachment . label xml . DISS_file_category attachment . file_type xml . DISS_file_descr attachment . description . first } end } if embargo_code == 4 xml . DISS_restriction { xml . DISS_sales_restriction ( code : 1 , remove : ( Time . zone . today + 6 . years ) . strftime ( "%m/%d/%Y" ) ) } end } end CGI . unescapeHTML ( builder . to_xml ) end
Export a zipped directory of an ETD in the format expected by ProQuest
Export a zipped directory of an ETD in the format expected by ProQuest
# Only provide the first two letters of the country code
the full path of the exported .zip file
the full path of the exported . zip file
String