{"action":"created","comment":{"url":"https://api.github.com/repos/ding2/ding2/pulls/comments/51413203","id":51413203,"diff_hunk":"@@ -0,0 +1,456 @@\n+<?php\n+/**\n+ * @file\n+ * Handle user self registration after login into gatewayf.\n+ */\n+\n+define('DING_GATEWAYF_REGISTRATION_ACCEPTANCE_URL', 'gatewayf/registration/acceptance');\n+define('DING_GATEWAYF_REGISTRATION_INFORMATION_URL', 'gatewayf/registration/information');\n+define('DING_GATEWAYF_REGISTRATION_SUCCESS_URL', 'gatewayf/registration/success');\n+\n+/**\n+ * Implements hook_menu().\n+ */\n+function ding_gatewayf_registration_menu() {\n+  $items = array();\n+\n+  $items[DING_GATEWAYF_REGISTRATION_INFORMATION_URL] = array(\n+    'page callback' => 'ding_gatewayf_registration_information',\n+    'access callback' => TRUE,\n+    'type' => MENU_CALLBACK,\n+  );\n+\n+  $items[DING_GATEWAYF_REGISTRATION_ACCEPTANCE_URL] = array(\n+    'page callback' => 'drupal_get_form',\n+    'page arguments' => array('ding_gatewayf_registration_acceptance_form'),\n+    'access callback' => TRUE,\n+    'type' => MENU_CALLBACK,\n+  );\n+\n+  $items[DING_GATEWAYF_REGISTRATION_SUCCESS_URL] = array(\n+    'page callback' => 'ding_gatewayf_registration_success',\n+    'access callback' => TRUE,\n+    'type' => MENU_CALLBACK,\n+  );\n+\n+  return $items;\n+}\n+\n+/**\n+ * Implements hook_theme().\n+ */\n+function ding_gatewayf_registration_theme($existing, $type, $theme, $path) {\n+  return array(\n+    'ding_gatewayf_registration_link' => array(\n+      'template' => 'ding-gatewayf-registration-link',\n+      'variables' => array(\n+        'link' => NULL,\n+      ),\n+      'path' => $path . '/templates',\n+    ),\n+    'ding_gatewayf_registration_information' => array(\n+      'template' => 'ding-gatewayf-registration-information',\n+      'variables' => array(\n+        'title' => array(),\n+        'content' => array(),\n+        'link' => NULL,\n+      ),\n+      'path' => $path . '/templates',\n+    ),\n+    'ding_gatewayf_registration_success_page' => array(\n+      'template' => 'ding-gatewayf-registration-success',\n+      'variables' => array(\n+        'title' => array(),\n+        'content' => array(),\n+      ),\n+      'path' => $path . '/templates',\n+    ),\n+  );\n+}\n+\n+/**\n+ * Implements hook_block_info().\n+ */\n+function ding_gatewayf_registration_block_info() {\n+  return array(\n+    'registration' => array(\n+      'info' => t('Ding GateWAYF self registration link'),\n+    ),\n+  );\n+}\n+\n+/**\n+ * Implements hook_block_view().\n+ */\n+function ding_gatewayf_registration_block_view() {\n+  $block = new stdClass();\n+\n+  // Only display the link when users are not logged in.\n+  if (user_is_anonymous()) {\n+    $block->content = array(\n+      '#theme' => 'ding_gatewayf_registration_link',\n+      '#link' => array(\n+        '#theme' => 'link',\n+        '#text' => t('Create user'),\n+        '#path' => DING_GATEWAYF_REGISTRATION_INFORMATION_URL,\n+        '#options' => array(\n+          'attributes' => array(\n+            'class' => array('ding-gatewayf-registration-link'),\n+          ),\n+          'html' => TRUE,\n+        ),\n+      ),\n+    );\n+  }\n+\n+  return $block;\n+}\n+\n+/**\n+ * Implements hook_form_ding_gatewayf_admin_settings_form_alter().\n+ */\n+function ding_gatewayf_registration_form_ding_gatewayf_admin_settings_form_alter(&$form, &$form_state, $form_id) {\n+\n+  $defaults = _ding_gatewayf_registration_load_config();\n+\n+  $form['ding_gatewayf_registration'] = array(\n+    '#type' => 'fieldset',\n+    '#title' => t('Self registration'),\n+    '#collapsible' => TRUE,\n+    '#collapsed' => TRUE,\n+    '#tree' => TRUE,\n+  );\n+\n+  $form['ding_gatewayf_registration']['age_limit'] = array(\n+    '#type' => 'textfield',\n+    '#title' => t('Age limit'),\n+    '#description' => t('The age limit will be used to ensure that no user is created without begin above the limit. If left empty no age limit is enforced.'),\n+    '#default_value' => $defaults['age_limit'],\n+    '#element_validate' => array('element_validate_integer_positive'),\n+  );\n+\n+  // Define before create info page.\n+  $form['ding_gatewayf_registration']['information'] = array(\n+    '#type' => 'fieldset',\n+    '#title' => t('Information page'),\n+    '#description' => t('Information displayed before the user starts the self registration page. This could be information about the rules for self registration and links to the library regulations.'),\n+    '#collapsible' => TRUE,\n+    '#collapsed' => TRUE,\n+    '#tree' => TRUE,\n+  );\n+\n+  $form['ding_gatewayf_registration']['information']['title'] = array(\n+    '#type' => 'textfield',\n+    '#title' => t('Page title'),\n+    '#default_value' => $defaults['information']['title'],\n+  );\n+\n+  $form['ding_gatewayf_registration']['information']['content'] = array(\n+    '#type' => 'textarea',\n+    '#title' => t('Content'),\n+    '#description' => t('This field accept HTML.'),\n+    '#default_value' => $defaults['information']['content'],\n+  );\n+\n+  $form['ding_gatewayf_registration']['information']['link'] = array(\n+    '#type' => 'textfield',\n+    '#title' => t('Link title'),\n+    '#default_value' => $defaults['information']['link'],\n+  );\n+\n+  // Accepting text.\n+  $form['ding_gatewayf_registration']['acceptance'] = array(\n+    '#type' => 'fieldset',\n+    '#title' => t('Acceptance page'),\n+    '#description' => t('Before the user can be created we need to get basic contact information and the user needs to accept regulations.'),\n+    '#collapsible' => TRUE,\n+    '#collapsed' => TRUE,\n+    '#tree' => TRUE,\n+  );\n+\n+  $form['ding_gatewayf_registration']['acceptance']['description'] = array(\n+    '#type' => 'textarea',\n+    '#title' => t('Acceptance text'),\n+    '#description' => t('Description displayed next to the user acceptance check box. This field accept HTML'),\n+    '#default_value' => $defaults['acceptance']['description'],\n+  );\n+\n+  // Define after create info page.\n+  $form['ding_gatewayf_registration']['success'] = array(\n+    '#type' => 'fieldset',\n+    '#title' => t('Successful registration page'),\n+    '#description' => t('Information displayed after the user have been successful registered at the provider.'),\n+    '#tree' => TRUE,\n+    '#collapsible' => TRUE,\n+    '#collapsed' => TRUE,\n+  );\n+\n+  $form['ding_gatewayf_registration']['success']['title'] = array(\n+    '#type' => 'textfield',\n+    '#title' => t('Title'),\n+    '#default_value' => $defaults['success']['title'],\n+  );\n+\n+  $form['ding_gatewayf_registration']['success']['content'] = array(\n+    '#type' => 'textarea',\n+    '#title' => t('Content'),\n+    '#description' => t('This field accept HTML.'),\n+    '#default_value' => $defaults['success']['content'],\n+  );\n+}\n+\n+/**\n+ * Generate render array for the information page.\n+ *\n+ * @return array\n+ *   Render array with the page content.\n+ */\n+function ding_gatewayf_registration_information() {\n+  $config = _ding_gatewayf_registration_load_config();\n+\n+  // Set page title to the same as the pages headline.\n+  drupal_set_title($config['information']['title']);\n+\n+  return array(\n+    '#theme' => 'ding_gatewayf_registration_information',\n+    '#title' => $config['information']['title'],\n+    '#content' => $config['information']['content'],\n+    '#link' => array(\n+      '#theme' => 'link',\n+      '#text' => $config['information']['link'],\n+      '#path' => DING_GATEWAYF_LOGIN_URL,\n+      '#options' => array(\n+        'attributes' => array(\n+          // This class \"form-submit\" is used to make the link look and behave\n+          // link a button.\n+          'class' => array(\n+            'form-submit',\n+            'ding-gatewayf-link',\n+          ),\n+        ),\n+        'query' => array(\n+          'destination' => DING_GATEWAYF_REGISTRATION_ACCEPTANCE_URL,\n+        ),\n+        'html' => TRUE,\n+      ),\n+    ),\n+  );\n+}\n+\n+/**\n+ * Implements hook_form().\n+ */\n+function ding_gatewayf_registration_acceptance_form() {\n+  $config = _ding_gatewayf_registration_load_config();\n+\n+  // This is a little style hack to get around the panels design requirements of\n+  // the DDB default theme. The module existing_pages could have been used to\n+  // wrapper the form in panels. But seen form a performance point this is\n+  // faster and simpler.\n+  $form = array(\n+    '#prefix' => '<div class=\"empty-sidebars default-layout\"><div class=\"layout-wrapper\"><div class=\"pane-content\"><div class=\"primary-content\">',\n+    '#suffix' => '</div></div></div></div>',\n+  );\n+\n+  $form['accept'] = array(\n+    '#type' => 'checkbox',\n+    '#title' => t('I accept the user agreements'),\n+    '#description' => $config['acceptance']['description'],\n+    '#required' => TRUE,\n+  );\n+\n+  $form['name'] = array(\n+    '#type' => 'textfield',\n+    '#title' => t('Name'),\n+    '#description' => t('You full name.'),\n+    '#maxlength' => 100,","path":"modules/ding_gatewayf/modules/ding_gatewayf_registration/ding_gatewayf_registration.module","position":266,"original_position":266,"commit_id":"02435775eebcb5efce267d4f8f13739f31b91864","original_commit_id":"02435775eebcb5efce267d4f8f13739f31b91864","user":{"login":"kasperg","id":73966,"avatar_url":"https://avatars.githubusercontent.com/u/73966?v=3","gravatar_id":"","url":"https://api.github.com/users/kasperg","html_url":"https://github.com/kasperg","followers_url":"https://api.github.com/users/kasperg/followers","following_url":"https://api.github.com/users/kasperg/following{/other_user}","gists_url":"https://api.github.com/users/kasperg/gists{/gist_id}","starred_url":"https://api.github.com/users/kasperg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kasperg/subscriptions","organizations_url":"https://api.github.com/users/kasperg/orgs","repos_url":"https://api.github.com/users/kasperg/repos","events_url":"https://api.github.com/users/kasperg/events{/privacy}","received_events_url":"https://api.github.com/users/kasperg/received_events","type":"User","site_admin":false},"body":"\r\n@@ -0,0 +1,402 @@\r\n +<?php\r\n +/**\r\n + * @file\r\n + * Handles user creation in the provider with information from WAYF login.\r\n + */\r\n +\r\n +/**\r\n + * Implements hook_permission().\r\n + */\r\n +function ding_wayf_dk_create_user_permission() {\r\n +  return array(\r\n +    'administer wayf user creation' => array(\r\n +      'title' => t('Administer WAYF user creation'),\r\n +    ),\r\n +  );\r\n +}\r\n +\r\n +/**\r\n + * Implements hook_menu().\r\n + */\r\n +function ding_wayf_dk_create_user_menu() {\r\n +  $items = array();\r\n +\r\n +  $items['wayf/create-user/before-page'] = array(\r\n +    'title' => 'Create new user information page',\r\n +    'description' => 'Create new user using WAYF login.',\r\n +    'page callback' => 'ding_wayf_dk_create_user_info_page',\r\n +    'access callback' => TRUE,\r\n +    'type' => MENU_CALLBACK,\r\n +  );\r\n +\r\n +  $items['wayf/create-user/notice'] = array(\r\n +    'title' => 'User creation notice',\r\n +    'description' => 'Notice about account creation.',\r\n +    'page callback' => 'ding_wayf_dk_create_user_notice',\r\n +    'access callback' => TRUE,\r\n +    'type' => MENU_CALLBACK,\r\n +  );\r\n +\r\n +  $items['wayf/create-user/form'] = array(\r\n +    'title' => 'User creation form',\r\n +    'description' => 'Form used to account creation.',\r\n +    'page callback' => 'drupal_get_form',\r\n +    'page arguments' => array('ding_wayf_dk_create_user_form'),\r\n +    'access callback' => TRUE,\r\n +    'type' => MENU_CALLBACK,\r\n +  );\r\n +\r\n +  return $items;\r\n +}\r\n +\r\n +/**\r\n + * Implements hook_ctools_plugin_directory().\r\n + */\r\n +function ding_wayf_dk_create_user_ctools_plugin_directory($owner, $plugin_type) {\r\n +  return 'plugins/' . $plugin_type;\r\n +}\r\n +\r\n +/**\r\n + * Implements hook_wayf_dk_login_authenticate_result_alter().\r\n + */\r\n +function ding_wayf_dk_create_user_wayf_dk_login_authenticate_result_alter($result) {\r\n +  // After the user have logged in using WAYF this alter hook is called. If the\r\n +  // destination url (redirect) in the session (created at login) is the create\r\n +  // new user path. This path is part of the \"create user\" link and then we know\r\n +  // that this is a create use request.\r\n +  if (isset($_SESSION['ding_wayf_dk_login_destination']) && $_SESSION['ding_wayf_dk_login_destination'] == 'wayf/create-user/form') {\r\n +    // Extract unique id form the WAYF attributes (the CPR number).\r\n +    preg_match('/\\d{10}$/', reset($result['attributes']['schacPersonalUniqueID']), $unique_id);\r\n +    $unique_id = reset($unique_id);\r\n +\r\n +    // Check if age limit should be set.\r\n +    $limit = variable_get('ding_wayf_user_create_age_limit', '');\r\n +    if (!empty($limit) && is_numeric($limit)) {\r\n@kasperg   Owner\r\nkasperg added a note 10 days ago\r\nValidation in the settings form should ensure that $limit is numeric.\r\n Add a line note\r\n +\r\n +      // Magic function to get the 1900, 1800 or 2000 prefixes for year.\r\n@kasperg   Owner\r\nkasperg added a note 10 days ago\r\n1800-prefix. Really?\r\n @cableman   Owner\r\ncableman added a note 4 days ago\r\nYes, it's an standard function to detect CPR numbers, so for completeness.\r\n Add a line note\r\n +      // @see http://da.wikipedia.org/wiki/CPR-nummer\r\n +      $year = substr($unique_id, 4, 2);\r\n +      switch (substr($unique_id, 6, 1)) {\r\n +        case 0:\r\n +        case 1:\r\n +        case 2:\r\n +        case 3:\r\n +          $year = '19' . $year;\r\n +          break;\r\n +\r\n +        case 4:\r\n +        case 9:\r\n +          $year = $year > 36 ? '19' . $year : '20' . $year;\r\n +          break;\r\n +\r\n +        case 5:\r\n +        case 6:\r\n +        case 7:\r\n +        case 8:\r\n +          $year = $year > 57 ? '18' . $year : '20' . $year;\r\n +          break;\r\n +      }\r\n +\r\n +      // Create date time object to use it's diff method.\r\n +      $from = new DateTime();\r\n +      $from->setDate($year, substr($unique_id, 2, 2), substr($unique_id, 0, 2));\r\n +      $to = new DateTime('tomorrow');\r\n@kasperg   Owner\r\nkasperg added a note 10 days ago\r\nWhy tomorrow instead of now?\r\n @cableman   Owner\r\ncableman added a note 4 days ago\r\nIt's due to the time of day, when we created this months ago we did a lot of testing and this was the correct why to do it.\r\n\r\nWe don't have the test code any more and can't remember the why, but it's something about the day they turn (the limit) they should be able to be created.\r\n Add a line note\r\n +\r\n +      // Check if limit have been reached.\r\n +      if ($from->diff($to)->y < $limit) {\r\n +        // The age limit has to kick in.\r\n +        drupal_set_message(t('You are not allowed to automatically be created because of the age limit (!limit years). Please go to your local library to registry.', array('!limit' => $limit)));\r\n +\r\n +        // Redirect to front page.\r\n +        drupal_goto('<front>');\r\n +      }\r\n +    }\r\n +\r\n +    // Store the schacPersonalUniqueID (CPR) in the current session to use when\r\n +    // sending the \"user create\" request to the provider in the redirect to\r\n +    // create new user form. It's only temporally store in the session and\r\n +    // removed as soon as possible.\r\n +    $_SESSION['ding_wayf_dk_create_user'] = $unique_id;\r\n +  }\r\n +}\r\n +\r\n +/**\r\n + * Implements hook_form_wayf_dk_login__settings_form_alter().\r\n + */\r\n +function ding_wayf_dk_create_user_form_wayf_dk_login__settings_form_alter(&$form, &$form_state, $form_id) {\r\n +  $form['user'] = array(\r\n +    '#type' => 'fieldset',\r\n +    '#title' => t('Create user'),\r\n +    '#group' => 'tabs',\r\n +  );\r\n +\r\n +  $form['user']['ding_wayf_user_create_age_limit'] = array(\r\n +    '#type' => 'textfield',\r\n +    '#title' => t('Age limit'),\r\n +    '#description' => t('The age limit will be used to ensure that no user is created without begin above the limit. If left empty no age limit is enforced.'),\r\n +    '#default_value' => variable_get('ding_wayf_user_create_age_limit', ''),\r\n +  );\r\n +\r\n +  // Define before create info page.\r\n +  $form['user']['ding_wayf_user_create_before_info'] = array(\r\n +    '#type' => 'fieldset',\r\n +    '#tree' => TRUE,\r\n +    '#collapsible' => TRUE,\r\n +    '#collapsed' => TRUE,\r\n +    '#title' => t('Information page (before)'),\r\n +    '#description' => t('Information to display before the user clicks on the \"create user\" link before the user is asked to login with WAYF.'),\r\n +  );\r\n +\r\n +  $defaults = variable_get('ding_wayf_user_create_before_info', array());\r\n +  $form['user']['ding_wayf_user_create_before_info']['title'] = array(\r\n +    '#type' => 'textfield',\r\n +    '#title' => t('Title'),\r\n +    '#default_value' => isset($defaults['title']) ? $defaults['title'] : '',\r\n +  );\r\n +\r\n +  $form['user']['ding_wayf_user_create_before_info']['content'] = array(\r\n +    '#type' => 'textarea',\r\n +    '#title' => t('Content'),\r\n +    '#default_value' => isset($defaults['content']) ? $defaults['content'] : '',\r\n +  );\r\n +\r\n +  $form['user']['ding_wayf_user_create_before_info']['link'] = array(\r\n +    '#type' => 'textfield',\r\n +    '#title' => t('Link title'),\r\n +    '#default_value' => isset($defaults['link']) ? $defaults['link'] : '',\r\n +  );\r\n +\r\n +  // Accepting text.\r\n +  $form['user']['ding_wayf_user_create_accept_text'] = array(\r\n +    '#type' => 'textarea',\r\n +    '#title' => t('Accept text'),\r\n +    '#default_value' => variable_get('ding_wayf_user_create_accept_text', ''),\r\n +    '#description' => t('The text that is display next to the user create accept check box.'),\r\n +  );\r\n +\r\n +  // Define after create info page.\r\n +  $form['user']['ding_wayf_user_create_after_info'] = array(\r\n +    '#type' => 'fieldset',\r\n +    '#tree' => TRUE,\r\n +    '#collapsible' => TRUE,\r\n +    '#collapsed' => TRUE,\r\n +    '#title' => t('Information page (after)'),\r\n +    '#description' => t('Information to display after the user have been create at the provider. This page can be used to display information about when the newly created user account is ready etc.'),\r\n +  );\r\n +\r\n +  $defaults = variable_get('ding_wayf_user_create_after_info', array());\r\n +  $form['user']['ding_wayf_user_create_after_info']['title'] = array(\r\n +    '#type' => 'textfield',\r\n +    '#title' => t('Title'),\r\n +    '#default_value' => isset($defaults['title']) ? $defaults['title'] : '',\r\n +  );\r\n +\r\n +  $form['user']['ding_wayf_user_create_after_info']['content'] = array(\r\n +    '#type' => 'textarea',\r\n +    '#title' => t('Content'),\r\n +    '#default_value' => isset($defaults['content']) ? $defaults['content'] : '',\r\n +  );\r\n +}\r\n +\r\n +/**\r\n + * Implements hook_theme().\r\n + */\r\n +function ding_wayf_dk_create_user_theme($existing, $type, $theme, $path) {\r\n +  return array(\r\n +    'ding_wayf_dk_info_page' => array(\r\n +      'template' => 'ding-wayf-dk-info-page',\r\n +      'variables' => array(\r\n +        'title' => array(),\r\n +        'content' => array(),\r\n +        'link' => NULL,\r\n +      ),\r\n +      'path' => $path . '/templates',\r\n +    ),\r\n +    'ding_wayf_dk_create_user_link' => array(\r\n +      'template' => 'ding-wayf-dk-create-user-link',\r\n +      'variables' => array(\r\n +        'link' => NULL,\r\n +      ),\r\n +      'path' => $path . '/templates',\r\n +    ),\r\n +  );\r\n +}\r\n +\r\n +/**\r\n + * Menu callback for information page before user creation.\r\n + */\r\n +function ding_wayf_dk_create_user_info_page() {\r\n +  // Get texts from the configuration.\r\n +  $values = variable_get('ding_wayf_user_create_before_info', array());\r\n +\r\n +  return array(\r\n +    '#theme' => 'ding_wayf_dk_info_page',\r\n +    '#title' => empty($values['title']) ? t('Not configured.') : $values['title'],\r\n +    '#content' => empty($values['content']) ? t('Please configure WAYF configuration to get content on this page under <a href=\"/admin/config/people/wayf\">admin/config/people/wayf</a>.') : $values['content'],\r\n@kasperg   Owner\r\nkasperg added a note 10 days ago\r\nPlease provide a better default value. Having \"Not configured\" potentially exposed to end users is never a good idea.\r\n @kasperg   Owner\r\nkasperg added a note 7 days ago\r\nNo admin instructions in end user texts. Please provide som sane defaults.\r\n @cableman   Owner\r\ncableman added a note 4 days ago\r\nI see, but it's hard to give any good defaults here... for aakb.dk it's a legal text and links to custom pages with the library rules etc.\r\n @cableman   Owner\r\ncableman added a note 4 days ago\r\nI see, but it's hard to give any good defaults here... for aakb.dk it's a legal text and links to custom pages with the library rules etc.\r\n Add a line note\r\n +    '#link' => array(\r\n +      '#theme' => 'link',\r\n +      '#text' => empty($values['link']) ? t('Register as new user') : $values['link'],\r\n +      '#path' => 'wayf/consume',\r\n +      '#options' => array(\r\n +        'attributes' => array(\r\n +          'class' => array(),\r\n +        ),\r\n +        'query' => array(\r\n +          'destination' => 'wayf/create-user/form',\r\n +        ),\r\n +        'html' => TRUE,\r\n +      ),\r\n +    ),\r\n +  );\r\n +}\r\n +\r\n +/**\r\n + * Menu callback for information page after user creation.\r\n + */\r\n +function ding_wayf_dk_create_user_notice() {\r\n +  // Get texts from the configuration.\r\n +  $values = variable_get('ding_wayf_user_create_after_info', array());\r\n@kasperg   Owner\r\nkasperg added a note 7 days ago\r\nNaming seems inconsistent here. Some places we use notice - some places create after. Could this be made more consistent?\r\n Add a line note\r\n +\r\n +  return array(\r\n +    '#theme' => 'ding_wayf_dk_info_page',\r\n +    '#title' => empty($values['title']) ? t('Not configured.') : $values['title'],\r\n +    '#content' => empty($values['content']) ? t('Please configure WAYF configuration to get content on this page under <a href=\"/admin/config/people/wayf\">admin/config/people/wayf</a>.') : $values['content'],\r\n +  );\r\n +}\r\n +\r\n +/**\r\n + * Menu callback to create the user creation form.\r\n + */\r\n +function ding_wayf_dk_create_user_form() {\r\n +  // Remove all message from the normal login, that have not succeed.\r\n +  drupal_get_messages(NULL, TRUE);\r\n +\r\n +  // Check if user have been logged in.\r\n +  if (user_is_logged_in()) {\r\n +    // User is logged in and have an account.\r\n +    drupal_set_message(t('You already have an user account at the library. So we have just logged you in.'));\r\n +\r\n +    // Ensure session information is removed.\r\n +    unset($_SESSION['ding_wayf_dk_create_user']);\r\n +    unset($_SESSION['ding_wayf_dk_login_destination']);\r\n +\r\n +    // Send user to front page.\r\n +    drupal_goto('<front>');\r\n +  }\r\n +\r\n +  // This is a little hack to get around the panels design requirements of the\r\n +  // ddbasic theme.\r\n +  $form = array(\r\n +    '#prefix' => '<div class=\"default-layout\"><div class=\"layout-wrapper\">',\r\n +    '#suffix' => '<br /></div></div>',\r\n +  );\r\n@kasperg   Owner\r\nkasperg added a note 7 days ago\r\nI image this could be a problem that might occour multiple times. Could we extract it into a theme function and use #theme_wrappers?\r\n Add a line note\r\n +\r\n +  $form['accept'] = array(\r\n +    '#type' => 'checkbox',\r\n +    '#title' => t('I accept the user agreements'),\r\n +    '#description' => variable_get('ding_wayf_user_create_accept_text', ''),\r\n +    '#required' => TRUE,\r\n +  );\r\n +\r\n +  $form['name'] = array(\r\n +    '#type' => 'textfield',\r\n +    '#title' => t('Name'),\r\n +    '#description' => t('You full name.'),\r\n@kasperg   Owner\r\nkasperg added a note 7 days ago\r\nTypo: Your.\r\n Add a line note\r\n +    '#maxlength' => 100,\r\n@kasperg   Owner\r\nkasperg added a note 7 days ago\r\nWhy this maxlength? If it is caused by other Drupal limitations then please add a comment stating why.","created_at":"2016-02-01T12:40:11Z","updated_at":"2016-02-01T12:40:11Z","html_url":"https://github.com/ding2/ding2/pull/129#discussion_r51413203","pull_request_url":"https://api.github.com/repos/ding2/ding2/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments/51413203"},"html":{"href":"https://github.com/ding2/ding2/pull/129#discussion_r51413203"},"pull_request":{"href":"https://api.github.com/repos/ding2/ding2/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/ding2/ding2/pulls/129","id":57657520,"html_url":"https://github.com/ding2/ding2/pull/129","diff_url":"https://github.com/ding2/ding2/pull/129.diff","patch_url":"https://github.com/ding2/ding2/pull/129.patch","issue_url":"https://api.github.com/repos/ding2/ding2/issues/129","number":129,"state":"open","locked":false,"title":"Issue #659: Support for gatewayf","user":{"login":"cableman","id":111397,"avatar_url":"https://avatars.githubusercontent.com/u/111397?v=3","gravatar_id":"","url":"https://api.github.com/users/cableman","html_url":"https://github.com/cableman","followers_url":"https://api.github.com/users/cableman/followers","following_url":"https://api.github.com/users/cableman/following{/other_user}","gists_url":"https://api.github.com/users/cableman/gists{/gist_id}","starred_url":"https://api.github.com/users/cableman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cableman/subscriptions","organizations_url":"https://api.github.com/users/cableman/orgs","repos_url":"https://api.github.com/users/cableman/repos","events_url":"https://api.github.com/users/cableman/events{/privacy}","received_events_url":"https://api.github.com/users/cableman/received_events","type":"User","site_admin":false},"body":"This introduces an new WAYF module that only communicates with gatewayf from bibliotek.dk, which is part of DDB.\r\n\r\nThis also support self registration for users logged in with gatewayf in the library system (only alma provider at the moment and is therefore optional sub-module).\r\n\r\nIt adds new blocks to the front page in ding_frontend, which is displayed when the modules are activated.\r\n\r\nIt contains style and JS changes to DDBasic to style the blocks and self registration pages.  ","created_at":"2016-01-29T15:00:14Z","updated_at":"2016-02-01T12:40:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c94b31c3b9d6faa32b63a2c7428a42c12b317572","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ding2/ding2/pulls/129/commits","review_comments_url":"https://api.github.com/repos/ding2/ding2/pulls/129/comments","review_comment_url":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ding2/ding2/issues/129/comments","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/02435775eebcb5efce267d4f8f13739f31b91864","head":{"label":"aakbcms:feature/ding_gatewayf","ref":"feature/ding_gatewayf","sha":"02435775eebcb5efce267d4f8f13739f31b91864","user":{"login":"aakbcms","id":10941069,"avatar_url":"https://avatars.githubusercontent.com/u/10941069?v=3","gravatar_id":"","url":"https://api.github.com/users/aakbcms","html_url":"https://github.com/aakbcms","followers_url":"https://api.github.com/users/aakbcms/followers","following_url":"https://api.github.com/users/aakbcms/following{/other_user}","gists_url":"https://api.github.com/users/aakbcms/gists{/gist_id}","starred_url":"https://api.github.com/users/aakbcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakbcms/subscriptions","organizations_url":"https://api.github.com/users/aakbcms/orgs","repos_url":"https://api.github.com/users/aakbcms/repos","events_url":"https://api.github.com/users/aakbcms/events{/privacy}","received_events_url":"https://api.github.com/users/aakbcms/received_events","type":"Organization","site_admin":false},"repo":{"id":49064130,"name":"ding2","full_name":"aakbcms/ding2","owner":{"login":"aakbcms","id":10941069,"avatar_url":"https://avatars.githubusercontent.com/u/10941069?v=3","gravatar_id":"","url":"https://api.github.com/users/aakbcms","html_url":"https://github.com/aakbcms","followers_url":"https://api.github.com/users/aakbcms/followers","following_url":"https://api.github.com/users/aakbcms/following{/other_user}","gists_url":"https://api.github.com/users/aakbcms/gists{/gist_id}","starred_url":"https://api.github.com/users/aakbcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aakbcms/subscriptions","organizations_url":"https://api.github.com/users/aakbcms/orgs","repos_url":"https://api.github.com/users/aakbcms/repos","events_url":"https://api.github.com/users/aakbcms/events{/privacy}","received_events_url":"https://api.github.com/users/aakbcms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aakbcms/ding2","description":"Ding install profile","fork":true,"url":"https://api.github.com/repos/aakbcms/ding2","forks_url":"https://api.github.com/repos/aakbcms/ding2/forks","keys_url":"https://api.github.com/repos/aakbcms/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aakbcms/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aakbcms/ding2/teams","hooks_url":"https://api.github.com/repos/aakbcms/ding2/hooks","issue_events_url":"https://api.github.com/repos/aakbcms/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/aakbcms/ding2/events","assignees_url":"https://api.github.com/repos/aakbcms/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/aakbcms/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/aakbcms/ding2/tags","blobs_url":"https://api.github.com/repos/aakbcms/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aakbcms/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aakbcms/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/aakbcms/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aakbcms/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/aakbcms/ding2/languages","stargazers_url":"https://api.github.com/repos/aakbcms/ding2/stargazers","contributors_url":"https://api.github.com/repos/aakbcms/ding2/contributors","subscribers_url":"https://api.github.com/repos/aakbcms/ding2/subscribers","subscription_url":"https://api.github.com/repos/aakbcms/ding2/subscription","commits_url":"https://api.github.com/repos/aakbcms/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/aakbcms/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/aakbcms/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/aakbcms/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/aakbcms/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/aakbcms/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aakbcms/ding2/merges","archive_url":"https://api.github.com/repos/aakbcms/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aakbcms/ding2/downloads","issues_url":"https://api.github.com/repos/aakbcms/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/aakbcms/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/aakbcms/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/aakbcms/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aakbcms/ding2/labels{/name}","releases_url":"https://api.github.com/repos/aakbcms/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/aakbcms/ding2/deployments","created_at":"2016-01-05T12:21:32Z","updated_at":"2016-01-28T12:23:27Z","pushed_at":"2016-01-29T17:55:17Z","git_url":"git://github.com/aakbcms/ding2.git","ssh_url":"git@github.com:aakbcms/ding2.git","clone_url":"https://github.com/aakbcms/ding2.git","svn_url":"https://github.com/aakbcms/ding2","homepage":"","size":79429,"stargazers_count":0,"watchers_count":0,"language":"SourcePawn","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ding2:master","ref":"master","sha":"9ebbe80d3a5db8e7183081a1decf689f29ed7dbe","user":{"login":"ding2","id":564698,"avatar_url":"https://avatars.githubusercontent.com/u/564698?v=3","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"repo":{"id":1266749,"name":"ding2","full_name":"ding2/ding2","owner":{"login":"ding2","id":564698,"avatar_url":"https://avatars.githubusercontent.com/u/564698?v=3","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ding2/ding2","description":"Ding install profile","fork":false,"url":"https://api.github.com/repos/ding2/ding2","forks_url":"https://api.github.com/repos/ding2/ding2/forks","keys_url":"https://api.github.com/repos/ding2/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ding2/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ding2/ding2/teams","hooks_url":"https://api.github.com/repos/ding2/ding2/hooks","issue_events_url":"https://api.github.com/repos/ding2/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/ding2/ding2/events","assignees_url":"https://api.github.com/repos/ding2/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/ding2/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/ding2/ding2/tags","blobs_url":"https://api.github.com/repos/ding2/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ding2/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ding2/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ding2/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/ding2/ding2/languages","stargazers_url":"https://api.github.com/repos/ding2/ding2/stargazers","contributors_url":"https://api.github.com/repos/ding2/ding2/contributors","subscribers_url":"https://api.github.com/repos/ding2/ding2/subscribers","subscription_url":"https://api.github.com/repos/ding2/ding2/subscription","commits_url":"https://api.github.com/repos/ding2/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ding2/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ding2/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ding2/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ding2/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/ding2/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ding2/ding2/merges","archive_url":"https://api.github.com/repos/ding2/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ding2/ding2/downloads","issues_url":"https://api.github.com/repos/ding2/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/ding2/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/ding2/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/ding2/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ding2/ding2/labels{/name}","releases_url":"https://api.github.com/repos/ding2/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/ding2/ding2/deployments","created_at":"2011-01-18T10:54:00Z","updated_at":"2015-11-02T10:11:44Z","pushed_at":"2016-01-29T17:55:17Z","git_url":"git://github.com/ding2/ding2.git","ssh_url":"git@github.com:ding2/ding2.git","clone_url":"https://github.com/ding2/ding2.git","svn_url":"https://github.com/ding2/ding2","homepage":"","size":79641,"stargazers_count":11,"watchers_count":11,"language":"SourcePawn","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":62,"forks":30,"open_issues":62,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/129"},"html":{"href":"https://github.com/ding2/ding2/pull/129"},"issue":{"href":"https://api.github.com/repos/ding2/ding2/issues/129"},"comments":{"href":"https://api.github.com/repos/ding2/ding2/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/ding2/ding2/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ding2/ding2/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/ding2/ding2/statuses/02435775eebcb5efce267d4f8f13739f31b91864"}}}}