{"action":"created","comment":{"url":"https://api.github.com/repos/openscholar/openscholar/pulls/comments/38351065","id":38351065,"diff_hunk":"@@ -44,3 +44,115 @@ function cp_settings_form($form_state) {\n \n   return system_settings_form($form);\n }\n+\n+/**\n+ * Spaces features form.\n+ */\n+function cp_app_settings_form($form, &$form_state) {\n+  $spaces_features = variable_get('spaces_features', array());\n+  $space = spaces_get_space();\n+  $features = spaces_features($space ? $space->type : 'site');\n+\n+  $sort_array = array();\n+  foreach ($features as $feature => $info) {\n+    $sort_array[$feature] = $info->info['name'];\n+  }\n+  asort($sort_array);\n+  $i = 0;\n+  foreach ($sort_array as $feature => $name) {\n+    $form['spaces_features'][$feature]['#weight'] = $i++;\n+  }\n+\n+  foreach ($features as $feature => $info) {\n+    $label = \"<strong>\" . t($info->info['name']) . \"</strong>\";\n+    $label .= \"<div class='description'>\" . t($info->info['description']) . \"</div>\";\n+    $form['labels'][$feature] = array(\n+      '#type' => 'markup',\n+      '#markup' => $label,\n+    );\n+    $form['spaces_features'][$feature] = array(\n+      '#type' => 'select',\n+      '#options' => $space ? $space->feature_options() : array(\n+          0 => t('Disabled'),\n+          1 => t('Enabled'),\n+        ),\n+      '#default_value' => isset($spaces_features[$feature]) ? $spaces_features[$feature] : 0,\n+    );\n+  }\n+\n+  $form = system_settings_form($form);\n+  $form['#theme'] = 'spaces_features_form';\n+  $form['actions']['#weight'] = 100;\n+\n+  if ($space = spaces_get_space()) {\n+    // Add our submit handler to system settings forms\n+    if (!empty($form['#submit'])) {\n+      $position = array_search('system_settings_form_submit', $form['#submit'], TRUE);\n+      if ($position !== FALSE) {\n+        $form['#submit'][$position] = 'cp_app_system_settings_form_submit';\n+\n+        if (isset($form['actions']) && count(element_children($form['actions'])) == 1 &&\n+          spaces_access_admin_perms(array('administer spaces'))\n+        ) {\n+            $form['actions']['reset'] = array(\n+              '#type' => 'submit',\n+              '#value' => t('Reset to defaults'),\n+            );\n+            $form['actions']['submit']['#value'] = t('Save for @name', array(\n+              '@name' => $space->title(),\n+            ));\n+        }\n+        dpm($form);\n+      }\n+    }\n+\n+    // Add the #space value to all forms generated in a space to enable non-\n+    // purl space-types to handle AHAH callbacks. @see spaces_ahah_check()\n+    $form['#space'] = array(\n+      '#type' => 'value',\n+      '#value' => $space->type . ':' . $space->id,\n+    );\n+  }\n+\n+  return $form;\n+}\n+\n+function cp_app_system_settings_form_submit($form, &$form_state) {\n+  if ($space = spaces_get_space()) {\n+    $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';\n+\n+    // Exclude unnecessary elements.\n+    form_state_values_clean($form_state);\n+\n+    foreach ($form_state['values'] as $key => $value) {","path":"openscholar/modules/cp/cp.form.inc","position":84,"original_position":84,"commit_id":"275ae72527cb80f4fcac1a3221503c94b5a6dbf8","original_commit_id":"275ae72527cb80f4fcac1a3221503c94b5a6dbf8","user":{"login":"rbran100","id":651318,"avatar_url":"https://avatars.githubusercontent.com/u/651318?v=3","gravatar_id":"","url":"https://api.github.com/users/rbran100","html_url":"https://github.com/rbran100","followers_url":"https://api.github.com/users/rbran100/followers","following_url":"https://api.github.com/users/rbran100/following{/other_user}","gists_url":"https://api.github.com/users/rbran100/gists{/gist_id}","starred_url":"https://api.github.com/users/rbran100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbran100/subscriptions","organizations_url":"https://api.github.com/users/rbran100/orgs","repos_url":"https://api.github.com/users/rbran100/repos","events_url":"https://api.github.com/users/rbran100/events{/privacy}","received_events_url":"https://api.github.com/users/rbran100/received_events","type":"User","site_admin":false},"body":"This logic looks OK, but you are only saving one variable \"spaces_features\", so you don't need a foreach any longer.  Just need to save that one element (or delete it if they are hitting reset).  ","created_at":"2015-08-31T19:46:13Z","updated_at":"2015-08-31T19:46:13Z","html_url":"https://github.com/openscholar/openscholar/pull/7435#discussion_r38351065","pull_request_url":"https://api.github.com/repos/openscholar/openscholar/pulls/7435","_links":{"self":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/comments/38351065"},"html":{"href":"https://github.com/openscholar/openscholar/pull/7435#discussion_r38351065"},"pull_request":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/7435"}}},"pull_request":{"url":"https://api.github.com/repos/openscholar/openscholar/pulls/7435","id":43801259,"html_url":"https://github.com/openscholar/openscholar/pull/7435","diff_url":"https://github.com/openscholar/openscholar/pull/7435.diff","patch_url":"https://github.com/openscholar/openscholar/pull/7435.patch","issue_url":"https://api.github.com/repos/openscholar/openscholar/issues/7435","number":7435,"state":"open","locked":false,"title":"7303 new admin menu","user":{"login":"Bilsi","id":11841641,"avatar_url":"https://avatars.githubusercontent.com/u/11841641?v=3","gravatar_id":"","url":"https://api.github.com/users/Bilsi","html_url":"https://github.com/Bilsi","followers_url":"https://api.github.com/users/Bilsi/followers","following_url":"https://api.github.com/users/Bilsi/following{/other_user}","gists_url":"https://api.github.com/users/Bilsi/gists{/gist_id}","starred_url":"https://api.github.com/users/Bilsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bilsi/subscriptions","organizations_url":"https://api.github.com/users/Bilsi/orgs","repos_url":"https://api.github.com/users/Bilsi/repos","events_url":"https://api.github.com/users/Bilsi/events{/privacy}","received_events_url":"https://api.github.com/users/Bilsi/received_events","type":"User","site_admin":false},"body":"#7303 - UX Updates","created_at":"2015-08-31T19:39:09Z","updated_at":"2015-08-31T19:46:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac5f8c2fa72ccfdfa65c525be616a8505e12a6c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openscholar/openscholar/pulls/7435/commits","review_comments_url":"https://api.github.com/repos/openscholar/openscholar/pulls/7435/comments","review_comment_url":"https://api.github.com/repos/openscholar/openscholar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openscholar/openscholar/issues/7435/comments","statuses_url":"https://api.github.com/repos/openscholar/openscholar/statuses/275ae72527cb80f4fcac1a3221503c94b5a6dbf8","head":{"label":"openscholar:7303_new-admin_menu","ref":"7303_new-admin_menu","sha":"275ae72527cb80f4fcac1a3221503c94b5a6dbf8","user":{"login":"openscholar","id":611073,"avatar_url":"https://avatars.githubusercontent.com/u/611073?v=3","gravatar_id":"","url":"https://api.github.com/users/openscholar","html_url":"https://github.com/openscholar","followers_url":"https://api.github.com/users/openscholar/followers","following_url":"https://api.github.com/users/openscholar/following{/other_user}","gists_url":"https://api.github.com/users/openscholar/gists{/gist_id}","starred_url":"https://api.github.com/users/openscholar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openscholar/subscriptions","organizations_url":"https://api.github.com/users/openscholar/orgs","repos_url":"https://api.github.com/users/openscholar/repos","events_url":"https://api.github.com/users/openscholar/events{/privacy}","received_events_url":"https://api.github.com/users/openscholar/received_events","type":"Organization","site_admin":false},"repo":{"id":1440092,"name":"openscholar","full_name":"openscholar/openscholar","owner":{"login":"openscholar","id":611073,"avatar_url":"https://avatars.githubusercontent.com/u/611073?v=3","gravatar_id":"","url":"https://api.github.com/users/openscholar","html_url":"https://github.com/openscholar","followers_url":"https://api.github.com/users/openscholar/followers","following_url":"https://api.github.com/users/openscholar/following{/other_user}","gists_url":"https://api.github.com/users/openscholar/gists{/gist_id}","starred_url":"https://api.github.com/users/openscholar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openscholar/subscriptions","organizations_url":"https://api.github.com/users/openscholar/orgs","repos_url":"https://api.github.com/users/openscholar/repos","events_url":"https://api.github.com/users/openscholar/events{/privacy}","received_events_url":"https://api.github.com/users/openscholar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openscholar/openscholar","description":"OpenScholar project ","fork":false,"url":"https://api.github.com/repos/openscholar/openscholar","forks_url":"https://api.github.com/repos/openscholar/openscholar/forks","keys_url":"https://api.github.com/repos/openscholar/openscholar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openscholar/openscholar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openscholar/openscholar/teams","hooks_url":"https://api.github.com/repos/openscholar/openscholar/hooks","issue_events_url":"https://api.github.com/repos/openscholar/openscholar/issues/events{/number}","events_url":"https://api.github.com/repos/openscholar/openscholar/events","assignees_url":"https://api.github.com/repos/openscholar/openscholar/assignees{/user}","branches_url":"https://api.github.com/repos/openscholar/openscholar/branches{/branch}","tags_url":"https://api.github.com/repos/openscholar/openscholar/tags","blobs_url":"https://api.github.com/repos/openscholar/openscholar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openscholar/openscholar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openscholar/openscholar/git/refs{/sha}","trees_url":"https://api.github.com/repos/openscholar/openscholar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openscholar/openscholar/statuses/{sha}","languages_url":"https://api.github.com/repos/openscholar/openscholar/languages","stargazers_url":"https://api.github.com/repos/openscholar/openscholar/stargazers","contributors_url":"https://api.github.com/repos/openscholar/openscholar/contributors","subscribers_url":"https://api.github.com/repos/openscholar/openscholar/subscribers","subscription_url":"https://api.github.com/repos/openscholar/openscholar/subscription","commits_url":"https://api.github.com/repos/openscholar/openscholar/commits{/sha}","git_commits_url":"https://api.github.com/repos/openscholar/openscholar/git/commits{/sha}","comments_url":"https://api.github.com/repos/openscholar/openscholar/comments{/number}","issue_comment_url":"https://api.github.com/repos/openscholar/openscholar/issues/comments{/number}","contents_url":"https://api.github.com/repos/openscholar/openscholar/contents/{+path}","compare_url":"https://api.github.com/repos/openscholar/openscholar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openscholar/openscholar/merges","archive_url":"https://api.github.com/repos/openscholar/openscholar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openscholar/openscholar/downloads","issues_url":"https://api.github.com/repos/openscholar/openscholar/issues{/number}","pulls_url":"https://api.github.com/repos/openscholar/openscholar/pulls{/number}","milestones_url":"https://api.github.com/repos/openscholar/openscholar/milestones{/number}","notifications_url":"https://api.github.com/repos/openscholar/openscholar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openscholar/openscholar/labels{/name}","releases_url":"https://api.github.com/repos/openscholar/openscholar/releases{/id}","created_at":"2011-03-04T16:39:08Z","updated_at":"2015-08-26T17:58:27Z","pushed_at":"2015-08-31T19:39:09Z","git_url":"git://github.com/openscholar/openscholar.git","ssh_url":"git@github.com:openscholar/openscholar.git","clone_url":"https://github.com/openscholar/openscholar.git","svn_url":"https://github.com/openscholar/openscholar","homepage":"http://theopenscholar.org","size":160916,"stargazers_count":146,"watchers_count":146,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":436,"forks":67,"open_issues":436,"watchers":146,"default_branch":"SCHOLAR-3.x"}},"base":{"label":"openscholar:media_browser_rewrite","ref":"media_browser_rewrite","sha":"59debb0deb672fb4aad9e4ea7b458a99185de1b2","user":{"login":"openscholar","id":611073,"avatar_url":"https://avatars.githubusercontent.com/u/611073?v=3","gravatar_id":"","url":"https://api.github.com/users/openscholar","html_url":"https://github.com/openscholar","followers_url":"https://api.github.com/users/openscholar/followers","following_url":"https://api.github.com/users/openscholar/following{/other_user}","gists_url":"https://api.github.com/users/openscholar/gists{/gist_id}","starred_url":"https://api.github.com/users/openscholar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openscholar/subscriptions","organizations_url":"https://api.github.com/users/openscholar/orgs","repos_url":"https://api.github.com/users/openscholar/repos","events_url":"https://api.github.com/users/openscholar/events{/privacy}","received_events_url":"https://api.github.com/users/openscholar/received_events","type":"Organization","site_admin":false},"repo":{"id":1440092,"name":"openscholar","full_name":"openscholar/openscholar","owner":{"login":"openscholar","id":611073,"avatar_url":"https://avatars.githubusercontent.com/u/611073?v=3","gravatar_id":"","url":"https://api.github.com/users/openscholar","html_url":"https://github.com/openscholar","followers_url":"https://api.github.com/users/openscholar/followers","following_url":"https://api.github.com/users/openscholar/following{/other_user}","gists_url":"https://api.github.com/users/openscholar/gists{/gist_id}","starred_url":"https://api.github.com/users/openscholar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openscholar/subscriptions","organizations_url":"https://api.github.com/users/openscholar/orgs","repos_url":"https://api.github.com/users/openscholar/repos","events_url":"https://api.github.com/users/openscholar/events{/privacy}","received_events_url":"https://api.github.com/users/openscholar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openscholar/openscholar","description":"OpenScholar project ","fork":false,"url":"https://api.github.com/repos/openscholar/openscholar","forks_url":"https://api.github.com/repos/openscholar/openscholar/forks","keys_url":"https://api.github.com/repos/openscholar/openscholar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openscholar/openscholar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openscholar/openscholar/teams","hooks_url":"https://api.github.com/repos/openscholar/openscholar/hooks","issue_events_url":"https://api.github.com/repos/openscholar/openscholar/issues/events{/number}","events_url":"https://api.github.com/repos/openscholar/openscholar/events","assignees_url":"https://api.github.com/repos/openscholar/openscholar/assignees{/user}","branches_url":"https://api.github.com/repos/openscholar/openscholar/branches{/branch}","tags_url":"https://api.github.com/repos/openscholar/openscholar/tags","blobs_url":"https://api.github.com/repos/openscholar/openscholar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openscholar/openscholar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openscholar/openscholar/git/refs{/sha}","trees_url":"https://api.github.com/repos/openscholar/openscholar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openscholar/openscholar/statuses/{sha}","languages_url":"https://api.github.com/repos/openscholar/openscholar/languages","stargazers_url":"https://api.github.com/repos/openscholar/openscholar/stargazers","contributors_url":"https://api.github.com/repos/openscholar/openscholar/contributors","subscribers_url":"https://api.github.com/repos/openscholar/openscholar/subscribers","subscription_url":"https://api.github.com/repos/openscholar/openscholar/subscription","commits_url":"https://api.github.com/repos/openscholar/openscholar/commits{/sha}","git_commits_url":"https://api.github.com/repos/openscholar/openscholar/git/commits{/sha}","comments_url":"https://api.github.com/repos/openscholar/openscholar/comments{/number}","issue_comment_url":"https://api.github.com/repos/openscholar/openscholar/issues/comments{/number}","contents_url":"https://api.github.com/repos/openscholar/openscholar/contents/{+path}","compare_url":"https://api.github.com/repos/openscholar/openscholar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openscholar/openscholar/merges","archive_url":"https://api.github.com/repos/openscholar/openscholar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openscholar/openscholar/downloads","issues_url":"https://api.github.com/repos/openscholar/openscholar/issues{/number}","pulls_url":"https://api.github.com/repos/openscholar/openscholar/pulls{/number}","milestones_url":"https://api.github.com/repos/openscholar/openscholar/milestones{/number}","notifications_url":"https://api.github.com/repos/openscholar/openscholar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openscholar/openscholar/labels{/name}","releases_url":"https://api.github.com/repos/openscholar/openscholar/releases{/id}","created_at":"2011-03-04T16:39:08Z","updated_at":"2015-08-26T17:58:27Z","pushed_at":"2015-08-31T19:39:09Z","git_url":"git://github.com/openscholar/openscholar.git","ssh_url":"git@github.com:openscholar/openscholar.git","clone_url":"https://github.com/openscholar/openscholar.git","svn_url":"https://github.com/openscholar/openscholar","homepage":"http://theopenscholar.org","size":160916,"stargazers_count":146,"watchers_count":146,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":436,"forks":67,"open_issues":436,"watchers":146,"default_branch":"SCHOLAR-3.x"}},"_links":{"self":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/7435"},"html":{"href":"https://github.com/openscholar/openscholar/pull/7435"},"issue":{"href":"https://api.github.com/repos/openscholar/openscholar/issues/7435"},"comments":{"href":"https://api.github.com/repos/openscholar/openscholar/issues/7435/comments"},"review_comments":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/7435/comments"},"review_comment":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openscholar/openscholar/pulls/7435/commits"},"statuses":{"href":"https://api.github.com/repos/openscholar/openscholar/statuses/275ae72527cb80f4fcac1a3221503c94b5a6dbf8"}}}}