Commit 2c3bf9be by Scott Committed by GitHub

Merge pull request #496 from pupi1985/patch-88

Use onchange instead of onclick; add default permit in userfields
parents 2030c41b cf377db5
...@@ -1638,7 +1638,7 @@ function qa_set_display_rules(&$qa_content, $effects) ...@@ -1638,7 +1638,7 @@ function qa_set_display_rules(&$qa_content, $effects)
// set default state of options // set default state of options
$loadscript = array( $loadscript = array(
"for (var i = 0; i < {$optVar}.length; i++) {", "for (var i = 0; i < {$optVar}.length; i++) {",
"\t$('#'+{$optVar}[i]).click(function() { " . $function . "(false); });", "\t$('#'+{$optVar}[i]).change(function() { " . $function . "(false); });",
"}", "}",
"{$function}(true);", "{$function}(true);",
); );
......
...@@ -716,18 +716,42 @@ function qa_db_create_table_sql($rawname, $definition) ...@@ -716,18 +716,42 @@ function qa_db_create_table_sql($rawname, $definition)
*/ */
function qa_db_default_userfields_sql() function qa_db_default_userfields_sql()
{ {
$oldprofileflags = array( require_once QA_INCLUDE_DIR . 'app/options.php';
'name' => 0,
'location' => 0, $profileFields = array(
'website' => QA_FIELD_FLAGS_LINK_URL, array(
'about' => QA_FIELD_FLAGS_MULTI_LINE, 'title' => 'name',
'position' => 0,
'flags' => 0,
'permit' => QA_PERMIT_ALL,
),
array(
'title' => 'location',
'position' => 1,
'flags' => 0,
'permit' => QA_PERMIT_ALL,
),
array(
'title' => 'website',
'position' => 2,
'flags' => QA_FIELD_FLAGS_LINK_URL,
'permit' => QA_PERMIT_ALL,
),
array(
'title' => 'about',
'position' => 3,
'flags' => QA_FIELD_FLAGS_MULTI_LINE,
'permit' => QA_PERMIT_ALL,
),
); );
$sql = 'INSERT INTO ^userfields (title, position, flags) VALUES '; // content column will be NULL, meaning use default from lang files $sql = 'INSERT INTO ^userfields (title, position, flags, permit) VALUES'; // content column will be NULL, meaning use default from lang files
foreach ($profileFields as $field) {
$sql .= sprintf('("%s", %d, %d, %d), ', qa_db_escape_string($field['title']), $field['position'], $field['flags'], $field['permit']);
}
$index = 0; $sql = substr($sql, 0, -2);
foreach ($oldprofileflags as $title => $flags)
$sql .= ($index ? ', ' : '') . "('" . qa_db_escape_string($title) . "', " . (++$index) . ", " . (int)@$oldprofileflags[$title] . ")";
return $sql; return $sql;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment