Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mass_change
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
mass_change
Commits
9ddca228
Commit
9ddca228
authored
16 years ago
by
Todd Nienkerk
Browse files
Options
Downloads
Patches
Plain Diff
initial 6.x release
parent
ea8fee71
No related branches found
Branches containing commit
Tags
6.x-1.0-rc
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mass_change.info
+1
-1
1 addition, 1 deletion
mass_change.info
mass_change.module
+33
-32
33 additions, 32 deletions
mass_change.module
with
34 additions
and
33 deletions
mass_change.info
+
1
−
1
View file @
9ddca228
; $Id$
name = Mass Change
description = "Mass change the workflow and commenting status of nodes by content type."
core =
5
.x
core =
6
.x
This diff is collapsed.
Click to expand it.
mass_change.module
+
33
−
32
View file @
9ddca228
...
...
@@ -10,20 +10,18 @@
/**
* Implementation of hook_menu().
*/
function
mass_change_menu
(
$may_cache
)
{
function
mass_change_menu
()
{
$items
=
array
();
if
(
$may_cache
)
{
$items
[]
=
array
(
'path'
=>
'admin/content/mass_change'
,
'title'
=>
t
(
'Mass Change'
),
'description'
=>
t
(
'Mass change the workflow and commenting status of nodes by content type.'
),
'access'
=>
user_access
(
'mass change nodes'
),
'callback'
=>
'drupal_get_form'
,
'callback arguments'
=>
'mass_change_page_form'
,
);
}
$items
[
'admin/content/mass_change'
]
=
array
(
'title'
=>
'Mass Change'
,
'description'
=>
'Mass change the workflow and commenting status of nodes by content type.'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'mass_change_page_form'
),
'access callback'
=>
'user_access'
,
'access arguments'
=>
array
(
'mass change nodes'
),
);
return
$items
;
}
...
...
@@ -36,7 +34,7 @@ function mass_change_perm() {
}
function
mass_change_page_form
()
{
function
mass_change_page_form
(
$form_state
)
{
$form
=
array
();
$form
[
'action'
]
=
array
(
...
...
@@ -49,20 +47,23 @@ function mass_change_page_form() {
'unpromote'
=>
t
(
'Unpromote'
),
'sticky'
=>
t
(
'Sticky'
),
'unsticky'
=>
t
(
'Unsticky'
),
'rwcomments'
=>
t
(
'Commenting: Read/Write'
),
'rocomments'
=>
t
(
'Commenting: Read only'
),
'nocomments'
=>
t
(
'Commenting: Disabled'
),
),
'#required'
=>
TRUE
,
);
if
(
module_exists
(
'comment'
))
{
$form
[
'action'
][
'#options'
][
'rwcomments'
]
=
t
(
'Commenting: Read/Write'
);
$form
[
'action'
][
'#options'
][
'rocomments'
]
=
t
(
'Commenting: Read only'
);
$form
[
'action'
][
'#options'
][
'nocomments'
]
=
t
(
'Commenting: Disabled'
);
}
$form
[
'content_types'
]
=
array
(
'#type'
=>
'checkboxes'
,
'#title'
=>
t
(
'Content types to mass change'
),
'#options'
=>
node_get_types
(
'names'
),
);
$form
[]
=
array
(
$form
[
'submit'
]
=
array
(
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Mass change nodes'
),
);
...
...
@@ -71,57 +72,57 @@ function mass_change_page_form() {
}
function
mass_change_page_form_submit
(
$form
_id
,
$form_
values
)
{
function
mass_change_page_form_submit
(
$form
,
&
$form_
state
)
{
$change
=
''
;
$message
=
''
;
$content_types
=
array
();
if
(
$form_values
[
'action'
]
==
'publish'
)
{
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'publish'
)
{
$change
=
'status = 1'
;
$message
=
t
(
'<strong>Published</strong>'
);
}
else
if
(
$form_values
[
'action'
]
==
'unpublish'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'unpublish'
)
{
$change
=
'status = 0'
;
$message
=
t
(
'<strong>Unpublished</strong>'
);
}
else
if
(
$form_values
[
'action'
]
==
'promote'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'promote'
)
{
$change
=
'promote = 1'
;
$message
=
t
(
'<strong>Promoted</strong>'
)
;
$message
=
'<strong>Promoted</strong>'
;
}
else
if
(
$form_values
[
'action'
]
==
'unpromote'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'unpromote'
)
{
$change
=
'promote = 0'
;
$message
=
t
(
'<strong>Unpromoted</strong>'
);
}
else
if
(
$form_values
[
'action'
]
==
'sticky'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'sticky'
)
{
$change
=
'sticky = 1'
;
$message
=
t
(
'<strong>Stickied</strong>'
);
}
else
if
(
$form_values
[
'action'
]
==
'unsticky'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'unsticky'
)
{
$change
=
'sticky = 0'
;
$message
=
t
(
'<strong>Unstickied</strong>'
);
}
else
if
(
$form_values
[
'action'
]
==
'rwcomments'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'rwcomments'
)
{
$change
=
'comment = 2'
;
$message
=
t
(
'Set <strong>commenting status</strong> to <strong>read/write</strong> for'
);
}
else
if
(
$form_values
[
'action'
]
==
'rocomments'
)
{
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'rocomments'
)
{
$change
=
'comment = 1'
;
$message
=
t
(
'Set <strong>commenting status</strong> to <strong>read only</strong> for'
);
}
else
if
(
$form_values
[
'action'
]
==
'nocomments'
)
{
$change
=
'comment = 0'
;
else
if
(
$form_
state
[
'
values
'
]
[
'action'
]
==
'nocomments'
)
{
$change
=
'comment = 0'
;
$message
=
t
(
'Set <strong>commenting status</strong> to <strong>disabled</strong> for'
);
}
foreach
(
$form_values
[
'content_types'
]
as
$content_type
=>
$actionable
)
{
foreach
(
$form_
state
[
'
values
'
]
[
'content_types'
]
as
$content_type
=>
$actionable
)
{
if
(
$actionable
)
{
$content_types
[]
=
$content_type
;
db_query
(
'UPDATE {node} SET '
.
$change
.
' WHERE type = "%s"'
,
$content_type
);
}
}
drupal_set_message
(
$message
.
t
(
' all nodes of the following content types:'
)
.
'<strong>'
.
implode
(
', '
,
$content_types
)
.
'</strong>'
);
drupal_set_message
(
$message
.
t
(
' all nodes of the following content types:
'
)
.
'<strong>'
.
implode
(
', '
,
$content_types
)
.
'</strong>'
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment