Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
14fbd557
Commit
14fbd557
authored
May 16, 2012
by
Nathaniel Catchpole
Browse files
Issue
#1574484
by tim.plunkett, nod_: Replace authorize.js with states.
parent
777a7b91
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/includes/authorize.inc
View file @
14fbd557
...
...
@@ -21,10 +21,6 @@ function authorize_filetransfer_form($form, &$form_state) {
// If possible, we want to post this form securely via https.
$form
[
'#https'
]
=
TRUE
;
// CSS we depend on lives in modules/system/maintenance.css, which is loaded
// via the default maintenance theme.
$form
[
'#attached'
][
'js'
][]
=
$base_url
.
'/misc/authorize.js'
;
// Get all the available ways to transfer files.
if
(
empty
(
$_SESSION
[
'authorize_filetransfer_info'
]))
{
drupal_set_message
(
t
(
'Unable to continue, no available methods of file transfer'
),
'error'
);
...
...
@@ -83,7 +79,6 @@ function authorize_filetransfer_form($form, &$form_state) {
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Continue'
),
'#weight'
=>
100
,
'#attributes'
=>
array
(
'style'
=>
'display:none'
),
);
// Build a container for each connection type.
...
...
@@ -92,6 +87,11 @@ function authorize_filetransfer_form($form, &$form_state) {
$form
[
'connection_settings'
][
$name
]
=
array
(
'#type'
=>
'container'
,
'#attributes'
=>
array
(
'class'
=>
array
(
"filetransfer-
$name
"
,
'filetransfer'
)),
'#states'
=>
array
(
'visible'
=>
array
(
'select[name="connection_settings[authorize_filetransfer_default]"]'
=>
array
(
'value'
=>
$name
),
),
),
);
// We can't use #prefix on the container itself since then the header won't
// be hidden and shown when the containers are being manipulated via JS.
...
...
core/misc/authorize.js
deleted
100644 → 0
View file @
777a7b91
/**
* @file
* Conditionally hide or show the appropriate settings and saved defaults
* on the file transfer connection settings form used by authorize.php.
*/
(
function
(
$
)
{
"
use strict
"
;
Drupal
.
behaviors
.
authorizeFileTransferForm
=
{
attach
:
function
(
context
)
{
$
(
'
#edit-connection-settings-authorize-filetransfer-default
'
).
change
(
function
()
{
$
(
'
.filetransfer
'
).
hide
().
filter
(
'
.filetransfer-
'
+
$
(
this
).
val
()).
show
();
});
$
(
'
.filetransfer
'
).
hide
().
filter
(
'
.filetransfer-
'
+
$
(
'
#edit-connection-settings-authorize-filetransfer-default
'
).
val
()).
show
();
// Removes the float on the select box (used for non-JS interface).
if
(
$
(
'
.connection-settings-update-filetransfer-default-wrapper
'
).
length
>
0
)
{
$
(
'
.connection-settings-update-filetransfer-default-wrapper
'
).
css
(
'
float
'
,
'
none
'
);
}
// Hides the submit button for non-js users.
$
(
'
#edit-submit-connection
'
).
hide
();
$
(
'
#edit-submit-process
'
).
show
();
}
};
})(
jQuery
);
core/modules/system/system.maintenance.css
View file @
14fbd557
/**
* Update styles
*/
...
...
@@ -26,16 +25,21 @@
/**
* Authorize.php styles
*/
.connection-settings-update-filetransfer-default-wrapper
{
float
:
left
;
}
#edit-submit-connection
{
clear
:
both
;
}
#edit-submit-process
,
.filetransfer
{
display
:
none
;
clear
:
both
;
}
.js
#edit-submit-connection
{
display
:
none
;
}
.js
#edit-submit-process
{
display
:
block
;
}
#edit-connection-settings-change-connection-type
{
margin
:
2.6em
0.5em
0em
1em
;
}
...
...
core/modules/system/tests/common.test
View file @
14fbd557
...
...
@@ -1321,12 +1321,12 @@ class CommonJavaScriptTestCase extends WebTestBase {
// same regardless of whether aggregation is enabled, so ensure this
// expected order, first with aggregation off.
drupal_add_js
(
'core/misc/ajax.js'
);
drupal_add_js
(
'core/misc/
authoriz
e.js'
,
array
(
'every_page'
=>
TRUE
));
drupal_add_js
(
'core/misc/
collaps
e.js'
,
array
(
'every_page'
=>
TRUE
));
drupal_add_js
(
'core/misc/autocomplete.js'
);
drupal_add_js
(
'core/misc/batch.js'
,
array
(
'every_page'
=>
TRUE
));
$javascript
=
drupal_get_js
();
$expected
=
implode
(
"
\n
"
,
array
(
'<script type="text/javascript" src="'
.
file_create_url
(
'core/misc/
authoriz
e.js'
)
.
'?'
.
$default_query_string
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
'core/misc/
collaps
e.js'
)
.
'?'
.
$default_query_string
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
'core/misc/batch.js'
)
.
'?'
.
$default_query_string
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
'core/misc/ajax.js'
)
.
'?'
.
$default_query_string
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
'core/misc/autocomplete.js'
)
.
'?'
.
$default_query_string
.
'"></script>'
,
...
...
@@ -1340,13 +1340,13 @@ class CommonJavaScriptTestCase extends WebTestBase {
$config
->
set
(
'preprocess_js'
,
1
);
$config
->
save
();
drupal_add_js
(
'core/misc/ajax.js'
);
drupal_add_js
(
'core/misc/
authoriz
e.js'
,
array
(
'every_page'
=>
TRUE
));
drupal_add_js
(
'core/misc/
collaps
e.js'
,
array
(
'every_page'
=>
TRUE
));
drupal_add_js
(
'core/misc/autocomplete.js'
);
drupal_add_js
(
'core/misc/batch.js'
,
array
(
'every_page'
=>
TRUE
));
$js_items
=
drupal_add_js
();
$javascript
=
drupal_get_js
();
$expected
=
implode
(
"
\n
"
,
array
(
'<script type="text/javascript" src="'
.
file_create_url
(
drupal_build_js_cache
(
array
(
'core/misc/
authoriz
e.js'
=>
$js_items
[
'core/misc/
authoriz
e.js'
],
'core/misc/batch.js'
=>
$js_items
[
'core/misc/batch.js'
])))
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
drupal_build_js_cache
(
array
(
'core/misc/
collaps
e.js'
=>
$js_items
[
'core/misc/
collaps
e.js'
],
'core/misc/batch.js'
=>
$js_items
[
'core/misc/batch.js'
])))
.
'"></script>'
,
'<script type="text/javascript" src="'
.
file_create_url
(
drupal_build_js_cache
(
array
(
'core/misc/ajax.js'
=>
$js_items
[
'core/misc/ajax.js'
],
'core/misc/autocomplete.js'
=>
$js_items
[
'core/misc/autocomplete.js'
])))
.
'"></script>'
,
));
$this
->
assertTrue
(
strpos
(
$javascript
,
$expected
)
>
0
,
t
(
'JavaScript is aggregated in the expected groups and order.'
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment