Index: openid_provider_persona.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider_persona/openid_provider_persona.info,v
retrieving revision 1.2
diff -u -p -r1.2 openid_provider_persona.info
--- openid_provider_persona.info	15 Oct 2008 15:04:16 -0000	1.2
+++ openid_provider_persona.info	16 Mar 2009 12:16:00 -0000
@@ -4,4 +4,5 @@ description = "OpenID Provider Personas 
 core = 6.x
 version = 6.x
 dependencies[] = openid_provider
+dependencies[] = openid_provider_ax
 package = "OpenID Provider"
Index: openid_provider_persona.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider_persona/openid_provider_persona.module,v
retrieving revision 1.5
diff -u -p -r1.5 openid_provider_persona.module
--- openid_provider_persona.module	17 Oct 2008 17:01:07 -0000	1.5
+++ openid_provider_persona.module	16 Mar 2009 12:16:00 -0000
@@ -144,7 +144,7 @@ function openid_provider_persona_process
     else {
       // Go through all of the fields that we have defined in the schema and determine
       // Which field key supports the simple registration that was requested by the RP
-      foreach (openid_provider_persona_schema_definitions() as $key => $value) {
+      foreach (openid_provider_ax_schema_definitions() as $key => $value) {
         if (isset($value['sreg']) && $value['sreg'] == $name) {
           // If we find one that matches we can then get the information from the persona
           // Which the user has for this realm. If no persona it will fallback to the default persona
@@ -161,16 +161,19 @@ function openid_provider_persona_process
 }
 
 /**
+ * Implementation of hook_openid_provider_ax().
  * Process the attribute exchange request that occurred
  *
+ * @param $op
+ *   'load' - gets the values for $attributes
  * @param $attributes
- *      Array holding the AX fields from the request
+ *   Array holding the AX fields from the request
  * @param $request
- *      Array holding the full request from the Relying Party
+ *   Array holding the full request from the Relying Party
  * @param $alias
- *      Alias that the Relying Party is using for attribute exchange namespace
+ *   Alias that the Relying Party is using for attribute exchange namespace
  */
-function openid_provider_persona_process_ax($attributes = array(), $request = array(), $alias = NULL) {
+function openid_provider_persona_openid_provider_ax($op = 'load', $attributes = array(), $request = array(), $alias = NULL) {
   global $user;
 
   $response = array();
@@ -232,412 +235,3 @@ function openid_provider_persona_process
   }
   return $response;
 }
-
-/**
- * Create an array containing the identifiers as listed in
- * http://www.axschema.org/types/
- *
- * @return array
- *      Array containing the schema definitions
- */
-function openid_provider_persona_schema_definitions() {
-  static $attributes = array();
-
-  // If already set return the array.
-  if (count($attributes)) {
-    return $attributes;
-  }
-
-  $attributes = array(
-    'http://axschema.org/namePerson' => array(
-      'identifier'  => 1,
-      'label'       => 'Full Name',
-      'description' => 'Full name of subject',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'sreg'        => 'openid.sreg.fullname',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/prefix' => array(
-      'identifier'  => 2,
-      'label'       => 'Name prefix',
-      'description' => 'Honorific prefix for the subject\'s name; i.e. "Mr.", "Mrs.", "Dr."',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/first' => array(
-      'identifier'  => 3,
-      'label'       => 'First name',
-      'description' => 'First or given name of subject',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/last' => array(
-      'identifier'  => 4,
-      'label'       => 'Last name',
-      'description' => 'Last name or surname of subject',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/middle' => array(
-      'identifier'  => 5,
-      'label'       => 'Middle name',
-      'description' => 'Middle name(s) of subject',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/suffix' => array(
-      'identifier'  => 6,
-      'label'       => 'Name suffix',
-      'description' => 'Suffix of subject\'s name',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/namePerson/friendly' => array(
-      'identifier'  => 7,
-      'label'       => 'Alias',
-      'description' => 'Subject\'s alias or "screen" name',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'sreg'        => 'openid.sreg.nickname',
-      'section'     => 'Name',
-    ),
-    'http://axschema.org/company/name' => array(
-      'identifier'  => 8,
-      'label'       => 'Company',
-      'description' => 'Company name (employer) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Work',
-    ),
-    'http://axschema.org/company/title' => array(
-      'identifier'  => 9,
-      'label'       => 'Title',
-      'description' => 'Employee title',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Work',
-    ),
-    'http://axschema.org/birthDate' => array(
-      'identifier'  => 10,
-      'label'       => 'Birth Date',
-      'description' => 'Date of Birth',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#date',
-      'sreg'        => 'openid.sreg.dob',
-      'section'     => 'Date-Of-Birth',
-    ),
-    'http://axschema.org/birthDate/birthYear' => array(
-      'identifier'  => 11,
-      'label'       => 'Birth year',
-      'description' => 'Year of birth (four digits) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#gYear',
-      'section'     => 'Date-Of-Birth',
-    ),
-    'http://axschema.org/birthDate/birthMonth' => array(
-      'identifier'  => 12,
-      'label'       => 'Birth month',
-      'description' => 'Month of birth (1-12)',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#gMonth',
-      'section'     => 'Date-Of-Birth',
-    ),
-    'http://axschema.org/birthDate/birthday' => array(
-      'identifier'  => 13,
-      'label'       => 'Birth day',
-      'description' => 'Day of birth',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#gDay',
-      'section'     => 'Date-Of-Birth',
-    ),
-    'http://axschema.org/contact/phone/default' => array(
-      'identifier'  => 14,
-      'label'       => 'Phone (preferred) ',
-      'description' => 'Main phone number (preferred) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Telephone',
-    ),
-    'http://axschema.org/contact/phone/home' => array(
-      'identifier'  => 15,
-      'label'       => 'Phone (home) ',
-      'description' => 'Home phone number',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Telephone',
-    ),
-    'http://axschema.org/contact/phone/business' => array(
-      'identifier'  => 16,
-      'label'       => 'Phone (work) ',
-      'description' => 'Business phone number ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Telephone',
-    ),
-    'http://axschema.org/contact/phone/cell' => array(
-      'identifier'  => 17,
-      'label'       => 'Phone (mobile) ',
-      'description' => 'Cellular (or mobile) phone number ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Telephone',
-    ),
-    'http://axschema.org/contact/phone/fax' => array(
-      'identifier'  => 18,
-      'label'       => 'Phone (fax) ',
-      'description' => 'Fax number',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Telephone',
-    ),
-    'http://axschema.org/contact/postalAddress/home' => array(
-      'identifier'  => 19,
-      'label'       => 'Address',
-      'description' => 'Home postal address: street number, name and apartment number',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/postalAddressAdditional/home' => array(
-      'identifier'  => 20,
-      'label'       => 'Address 2',
-      'description' => 'Home postal address: supplementary information',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/city/home' => array(
-      'identifier'  => 21,
-      'label'       => 'City',
-      'description' => 'Home city name',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/state/home' => array(
-      'identifier'  => 22,
-      'label'       => 'State/Province',
-      'description' => 'Home state or province name',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/country/home' => array(
-      'identifier'  => 23,
-      'label'       => 'Country',
-      'description' => 'Home country code',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/postalCode/home' => array(
-      'identifier'  => 24,
-      'label'       => 'Postal code',
-      'description' => 'Home postal code',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Address',
-    ),
-    'http://axschema.org/contact/postalAddress/business' => array(
-      'identifier'  => 25,
-      'label'       => 'Business Address',
-      'description' => 'Business postal address: street number, name and apartment number',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/postalAddressAdditional/business' => array(
-      'identifier'  => 26,
-      'label'       => 'Business Address 2 ',
-      'description' => 'Business postal address: supplementary information',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/city/business' => array(
-      'identifier'  => 27,
-      'label'       => 'City',
-      'description' => 'Business city name',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/state/business' => array(
-      'identifier'  => 28,
-      'label'       => 'State/Province',
-      'description' => 'Business state or province name ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/country/business' => array(
-      'identifier'  => 29,
-      'label'       => 'Country',
-      'description' => 'Business country code',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/postalCode/business' => array(
-      'identifier'  => 30,
-      'label'       => 'Postal code',
-      'description' => 'Business postal code',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Business-Address',
-    ),
-    'http://axschema.org/contact/email' => array(
-      'identifier'  => 31,
-      'label'       => 'Email',
-      'description' => 'Internet SMTP email address as per RFC2822',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'sreg'        => 'openid.sreg.email',
-      'section'     => 'Email',
-    ),
-    'http://axschema.org/contact/IM/AIM' => array(
-      'identifier'  => 32,
-      'label'       => 'AOL IM',
-      'description' => 'AOL instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/IM/ICQ' => array(
-      'identifier'  => 33,
-      'label'       => 'ICQ IM',
-      'description' => 'ICQ instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/IM/MSN' => array(
-      'identifier'  => 34,
-      'label'       => 'MSN IM',
-      'description' => 'MSN instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/IM/Yahoo' => array(
-      'identifier'  => 35,
-      'label'       => 'Yahoo! IM',
-      'description' => 'Yahoo! instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/IM/Jabber' => array(
-      'identifier'  => 36,
-      'label'       => 'Jabber IM',
-      'description' => 'Jabber instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/IM/Skype' => array(
-      'identifier'  => 37,
-      'label'       => 'Skype IM ',
-      'description' => 'Skype instant messaging service handle',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Instant-Messaging',
-    ),
-    'http://axschema.org/contact/web/default' => array(
-      'identifier'  => 38,
-      'label'       => 'Web page',
-      'description' => 'Web site URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/contact/web/blog' => array(
-      'identifier'  => 39,
-      'label'       => 'Blog',
-      'description' => 'Blog URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/contact/web/Linkedin' => array(
-      'identifier'  => 40,
-      'label'       => 'LinkedIn URL',
-      'description' => 'LinkedIn URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/contact/web/Amazon' => array(
-      'identifier'  => 41,
-      'label'       => 'Amazon URL',
-      'description' => 'Amazon URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/contact/web/Flickr' => array(
-      'identifier'  => 42,
-      'label'       => 'Flickr URL',
-      'description' => 'Flickr URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/contact/web/Delicious' => array(
-      'identifier'  => 43,
-      'label'       => 'del.icio.us URL',
-      'description' => 'del.icio.us URL',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Web-Sites',
-    ),
-    'http://axschema.org/media/spokenname' => array(
-      'identifier'  => 44,
-      'label'       => 'Spoken name',
-      'description' => 'Spoken name (web URL) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Audio/Video-Greetings',
-    ),
-    'http://axschema.org/media/greeting/audio' => array(
-      'identifier'  => 45,
-      'label'       => 'Audio greeting',
-      'description' => 'Audio greeting (web URL) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Audio/Video-Greetings',
-    ),
-    'http://axschema.org/media/greeting/video' => array(
-      'identifier'  => 46,
-      'label'       => 'Video greeting',
-      'description' => 'Video greeting (web URL) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Audio/Video-Greetings',
-    ),
-    'http://axschema.org/media/image/default' => array(
-      'identifier'  => 47,
-      'label'       => 'Image',
-      'description' => 'Image (web URL); unspecified dimension',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Images',
-    ),
-    'http://axschema.org/media/image/aspect11' => array(
-      'identifier'  => 48,
-      'label'       => 'Square image',
-      'description' => 'Image (web URL) with equal width and height',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Images',
-    ),
-    'http://axschema.org/media/image/aspect43' => array(
-      'identifier'  => 49,
-      'label'       => '4:3 aspect image',
-      'description' => 'Image (web URL) 4:3 aspect ratio - landscape',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Images',
-    ),
-    'http://axschema.org/media/image/aspect34' => array(
-      'identifier'  => 50,
-      'label'       => '3:4 aspect image',
-      'description' => 'Image (web URL) 3:4 aspect ratio - portrait',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Images',
-    ),
-    'http://axschema.org/media/image/favicon' => array(
-      'identifier'  => 51,
-      'label'       => 'Favicon image',
-      'description' => 'Image (web URL); favicon format',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#anyURI',
-      'section'     => 'Images',
-    ),
-    'http://axschema.org/person/gender' => array(
-      'identifier'  => 52,
-      'label'       => 'Gender',
-      'description' => 'Gender, either "M" or "F"',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Extra-Information',
-    ),
-    'http://axschema.org/pref/language' => array(
-      'identifier'  => 53,
-      'label'       => 'Language',
-      'description' => 'Preferred language',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Extra-Information',
-    ),
-    'http://axschema.org/pref/timezone' => array(
-      'identifier'  => 54,
-      'label'       => 'Time zone',
-      'description' => 'Home time zone information',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#normalizedString',
-      'section'     => 'Extra-Information',
-    ),
-    'http://axschema.org/media/biography' => array(
-      'identifier'  => 55,
-      'label'       => 'Biography',
-      'description' => 'Biography (text) ',
-      'type'        => 'http://www.w3.org/2001/XMLSchema#string',
-      'section'     => 'Extra-Information',
-    ),
-  );
-  return $attributes;
-}
Index: openid_provider_persona.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider_persona/openid_provider_persona.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 openid_provider_persona.pages.inc
--- openid_provider_persona.pages.inc	15 Oct 2008 15:04:16 -0000	1.2
+++ openid_provider_persona.pages.inc	16 Mar 2009 12:16:00 -0000
@@ -30,7 +30,7 @@ function openid_provider_persona_edit_fo
 
   // Build each of the form elements and make sure we put them in a field set.
   // Putting them in a fieldset will make sure the screen stays managable.
-  foreach (openid_provider_persona_schema_definitions() as $key => $val) {
+  foreach (openid_provider_ax_schema_definitions() as $key => $val) {
     // Build a field set so we can group the relevant fields together on the screen
     if (!isset($form[$val['section']])) {
       $form[$val['section']] = array('#type' => 'fieldset', '#title' => t($val['section']), '#collapsible' => TRUE, '#collapsed' => TRUE);
@@ -72,7 +72,7 @@ function openid_provider_persona_edit_fo
   // Retrieve it again from the database in this function cut down processing
   $current_results = unserialize($form_state['values']['persona_values']);
   // Retrieve the attributes we are supporting and determine what has been set already
-  foreach (openid_provider_persona_schema_definitions() as $key => $val) {
+  foreach (openid_provider_ax_schema_definitions() as $key => $val) {
     // Checking to determine if the value exists and if it is not currently set in the persona values table.
     if (isset($form_state['values'][$val['identifier']]) && drupal_strlen($form_state['values'][$val['identifier']]) && !isset($current_results[$key])) {
       db_query("INSERT INTO {openid_provider_persona_values} (type_uri, uid, persona_id, field_value) VALUES ('%s', '%d', '%d', '%s')", $key, $user->uid, $persona, $form_state['values'][$val['identifier']]);
@@ -257,7 +257,7 @@ function openid_provider_persona_copy_pe
     $form['persona_values'] = array('#type' => 'hidden', '#value' => serialize($values));
 
     // Retrieve the attributes we are supporting and determine what has been set already
-    foreach (openid_provider_persona_schema_definitions() as $key => $val) {
+    foreach (openid_provider_ax_schema_definitions() as $key => $val) {
       if (isset($values[$key])) {
         $form[$val['identifier']] = array(
           '#type' => 'checkbox',
@@ -278,7 +278,7 @@ function openid_provider_persona_copy_pe
 
   $values = unserialize($form_state['values']['persona_values']);
   // Retrieve the attributes we are supporting and determine what has been set already
-  foreach (openid_provider_persona_schema_definitions() as $key => $val) {
+  foreach (openid_provider_ax_schema_definitions() as $key => $val) {
     // Check if it exists and if so check if the value is set and if so copy the value
     if (isset($form_state['values'][$val['identifier']]) && $form_state['values'][$val['identifier']]) {
       // Courtesy remove incase a value currently exists for this field in the persona we are copying too
