Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
831864db
Commit
831864db
authored
9 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
make styler work without JS as well
parent
aae321f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/plugins/styler/action.php
+31
-6
31 additions, 6 deletions
lib/plugins/styler/action.php
lib/plugins/styler/admin.php
+1
-1
1 addition, 1 deletion
lib/plugins/styler/admin.php
with
32 additions
and
7 deletions
lib/plugins/styler/action.php
+
31
−
6
View file @
831864db
...
@@ -20,7 +20,7 @@ if(!defined('DOKU_INC')) die();
...
@@ -20,7 +20,7 @@ if(!defined('DOKU_INC')) die();
class
action_plugin_styler
extends
DokuWiki_Action_Plugin
{
class
action_plugin_styler
extends
DokuWiki_Action_Plugin
{
/**
/**
* Registers a callback function
for a given event
* Registers a callback function
s
*
*
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @return void
* @return void
...
@@ -28,12 +28,37 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
...
@@ -28,12 +28,37 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
public
function
register
(
Doku_Event_Handler
$controller
)
{
public
function
register
(
Doku_Event_Handler
$controller
)
{
$controller
->
register_hook
(
'AJAX_CALL_UNKNOWN'
,
'BEFORE'
,
$this
,
'handle_ajax'
);
$controller
->
register_hook
(
'AJAX_CALL_UNKNOWN'
,
'BEFORE'
,
$this
,
'handle_ajax'
);
$controller
->
register_hook
(
'ACTION_ACT_PREPROCESS'
,
'BEFORE'
,
$this
,
'handle_action'
);
$controller
->
register_hook
(
'ACTION_ACT_PREPROCESS'
,
'BEFORE'
,
$this
,
'handle_action'
);
$controller
->
register_hook
(
'TPL_METAHEADER_OUTPUT'
,
'BEFORE'
,
$this
,
'handle_header'
);
}
/**
* Adds the preview parameter to the stylesheet loading in non-js mode
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public
function
handle_header
(
Doku_Event
&
$event
,
$param
)
{
global
$ACT
;
global
$INPUT
;
if
(
$ACT
!=
'admin'
||
$INPUT
->
str
(
'page'
)
!=
'styler'
)
return
;
if
(
!
auth_isadmin
())
return
;
// FIXME load preview style when on admin page
// set preview
$len
=
count
(
$event
->
data
[
'link'
]);
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
{
if
(
$event
->
data
[
'link'
][
$i
][
'rel'
]
==
'stylesheet'
&&
strpos
(
$event
->
data
[
'link'
][
$i
][
'href'
],
'lib/exe/css.php'
)
!==
false
)
{
$event
->
data
[
'link'
][
$i
][
'href'
]
.
=
'&preview=1&tseed='
.
time
();
}
}
}
}
/**
/**
*
[Custom event handler which performs action]
*
Updates the style.ini settings by passing it on to handle() of the admin component
*
*
* @param Doku_Event $event event object by reference
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
...
@@ -41,8 +66,8 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
...
@@ -41,8 +66,8 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
* @return void
* @return void
*/
*/
public
function
handle_action
(
Doku_Event
&
$event
,
$param
)
{
public
function
handle_action
(
Doku_Event
&
$event
,
$param
)
{
if
(
!
auth_isadmin
())
return
;
if
(
$event
->
data
!=
'styler_plugin'
)
return
;
if
(
$event
->
data
!=
'styler_plugin'
)
return
;
if
(
!
auth_isadmin
())
return
;
$event
->
data
=
'show'
;
$event
->
data
=
'show'
;
/** @var admin_plugin_styler $hlp */
/** @var admin_plugin_styler $hlp */
...
@@ -51,7 +76,7 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
...
@@ -51,7 +76,7 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
}
}
/**
/**
*
[Custom event handler which performs action]
*
Create the style form in the floating Dialog
*
*
* @param Doku_Event $event event object by reference
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
...
@@ -60,8 +85,8 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
...
@@ -60,8 +85,8 @@ class action_plugin_styler extends DokuWiki_Action_Plugin {
*/
*/
public
function
handle_ajax
(
Doku_Event
&
$event
,
$param
)
{
public
function
handle_ajax
(
Doku_Event
&
$event
,
$param
)
{
if
(
!
auth_isadmin
())
return
;
if
(
$event
->
data
!=
'plugin_styler'
)
return
;
if
(
$event
->
data
!=
'plugin_styler'
)
return
;
if
(
!
auth_isadmin
())
return
;
$event
->
preventDefault
();
$event
->
preventDefault
();
$event
->
stopPropagation
();
$event
->
stopPropagation
();
...
...
This diff is collapsed.
Click to expand it.
lib/plugins/styler/admin.php
+
1
−
1
View file @
831864db
...
@@ -26,7 +26,7 @@ class admin_plugin_styler extends DokuWiki_Admin_Plugin {
...
@@ -26,7 +26,7 @@ class admin_plugin_styler extends DokuWiki_Admin_Plugin {
}
}
/**
/**
*
Should carry out any processing required by the plugin.
*
handle the different actions (also called from ajax)
*/
*/
public
function
handle
()
{
public
function
handle
()
{
global
$INPUT
;
global
$INPUT
;
...
...
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