Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xml2html-pkp-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FNSO
FAIREST
xml2html-pkp-plugin
Commits
ae44eee2
Commit
ae44eee2
authored
Jun 13, 2023
by
Jerome Chauveau
Browse files
Options
Downloads
Patches
Plain Diff
nettoyage
parent
aef8c04c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
XML2HTMLPlugin.php
+11
-32
11 additions, 32 deletions
XML2HTMLPlugin.php
with
11 additions
and
32 deletions
XML2HTMLPlugin.php
+
11
−
32
View file @
ae44eee2
...
@@ -19,15 +19,8 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -19,15 +19,8 @@ class XML2HTMLPlugin extends GenericPlugin
if
(
$success
&&
$this
->
getEnabled
())
{
if
(
$success
&&
$this
->
getEnabled
())
{
HookRegistry
::
register
(
'ArticleHandler::view::galley'
,
array
(
$this
,
'articleHandler'
));
HookRegistry
::
register
(
'ArticleHandler::view::galley'
,
array
(
$this
,
'articleHandler'
));
HookRegistry
::
register
(
'ArticleHandler::download'
,
array
(
$this
,
'articleDownloadCallback'
),
HOOK_SEQUENCE_LATE
);
//HookRegistry::register('ArticleHandler::download', array($this, 'articleDownloadCallback'), HOOK_SEQUENCE_LATE);
// HookRegistry::register('Templates::Article::Main', array($this, 'xml2html'));
// HookRegistry::register('TemplateManager::display', array($this, 'xml2htmlImports'));
HookRegistry
::
register
(
'LoadHandler'
,
array
(
$this
,
'loadImageHandler'
));
HookRegistry
::
register
(
'LoadHandler'
,
array
(
$this
,
'loadImageHandler'
));
// HookRegistry::register('SubmissionFile::add', array($this, 'uploadHandler'));
// HookRegistry::register('LoadHandler', array($this, 'setPageHandler'));
//HookRegistry::register('LoadHandler', array($this, 'setPageHandler'));
HookRegistry
::
register
(
'CatalogBookHandler::view'
,
array
(
$this
,
'catalogHandler'
));
HookRegistry
::
register
(
'CatalogBookHandler::view'
,
array
(
$this
,
'catalogHandler'
));
}
}
...
@@ -35,37 +28,27 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -35,37 +28,27 @@ class XML2HTMLPlugin extends GenericPlugin
return
$success
;
return
$success
;
}
}
public
function
articleDownloadHandler
(
$hookName
,
$params
)
//
public function articleDownloadHandler($hookName, $params)
{
//
{
//
}
//
}
/**
/**
* @throws Exception
* @throws Exception
*/
*/
public
function
articleHandler
(
$hookName
,
$params
)
public
function
articleHandler
(
$hookName
,
$params
)
:
bool
{
{
$request
=&
$params
[
0
];
$galley
=&
$params
[
2
];
$galley
=&
$params
[
2
];
$submission
=
&
$params
[
3
];
$submission
=
&
$params
[
3
];
$templateMgr
=
TemplateManager
::
getManager
(
$request
);
//handle only on zip galleys - supposed to be an xml archive (source + images)
//handle only on zip galleys - supposed to be an xml archive (source + images)
$zipMode
=
$galley
&&
$galley
->
getFileType
()
===
'application/zip'
;
$zipMode
=
$galley
&&
$galley
->
getFileType
()
===
'application/zip'
;
if
(
$zipMode
)
{
if
(
$zipMode
)
{
$this
->
archiveView
(
$galley
->
getFile
()
->
getData
(
'path'
),
$submission
->
getId
(),
'article'
);
$this
->
archiveView
(
$galley
->
getFile
()
->
getData
(
'path'
),
$submission
->
getId
(),
'article'
);
// $filePath = $galley->getFile()->getData('path');
// $xmlFilePath = XML2HTMLPlugin::unzipXMLArchive($filePath);
// $html = $this->resolveZipImagePaths(XML2HTMLPlugin::transform($xmlFilePath), $submission->getId(), $xmlFilePath, $this->getRequest());
// $baseUrl = $request->getBaseUrl() . '/' . $this->getPluginPath();
// $templateMgr->addStyleSheet('xml2htmlStyles', $baseUrl . '/resources/styles/article.css');
// $templateMgr->addJavaScript('xml2htmlJavascript', $baseUrl . '/resources/javascript/xml_2_html.js');
// $templateMgr->assign('text', $html);
// $templateMgr->display($this->getTemplateResource('HTMLGalleyView.tpl'));
return
true
;
return
true
;
}
else
return
false
;
}
else
return
false
;
}
}
public
function
catalogHandler
(
$hookName
,
$params
)
public
function
catalogHandler
(
$hookName
,
$params
)
:
bool
{
{
$submission
=
&
$params
[
1
];
$submission
=
&
$params
[
1
];
...
@@ -79,7 +62,8 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -79,7 +62,8 @@ class XML2HTMLPlugin extends GenericPlugin
}
}
private
function
archiveView
(
string
$filePath
,
int
$submissionId
,
string
$op
){
private
function
archiveView
(
string
$filePath
,
int
$submissionId
,
string
$op
)
{
$templateMgr
=
TemplateManager
::
getManager
(
$this
->
getRequest
());
$templateMgr
=
TemplateManager
::
getManager
(
$this
->
getRequest
());
$xmlFilePath
=
XML2HTMLPlugin
::
unzipXMLArchive
(
$filePath
);
$xmlFilePath
=
XML2HTMLPlugin
::
unzipXMLArchive
(
$filePath
);
$html
=
$this
->
resolveZipImagePaths
(
$html
=
$this
->
resolveZipImagePaths
(
...
@@ -118,7 +102,6 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -118,7 +102,6 @@ class XML2HTMLPlugin extends GenericPlugin
}
}
static
function
transform
(
static
function
transform
(
string
$xmlFilePath
string
$xmlFilePath
)
)
...
@@ -140,7 +123,6 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -140,7 +123,6 @@ class XML2HTMLPlugin extends GenericPlugin
}
}
static
function
unzipXMLArchive
(
string
$path
)
static
function
unzipXMLArchive
(
string
$path
)
{
{
$fileManager
=
new
FileManager
();
$fileManager
=
new
FileManager
();
...
@@ -282,8 +264,6 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -282,8 +264,6 @@ class XML2HTMLPlugin extends GenericPlugin
$file
$file
)
)
);
);
$pattern
=
preg_quote
(
rawurlencode
(
$file
));
$pattern
=
preg_quote
(
rawurlencode
(
$file
));
$htmlString
=
preg_replace
(
$htmlString
=
preg_replace
(
'/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\s*=\s*"([^"]*'
.
$pattern
.
')"/'
,
'/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\s*=\s*"([^"]*'
.
$pattern
.
')"/'
,
...
@@ -295,6 +275,5 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -295,6 +275,5 @@ class XML2HTMLPlugin extends GenericPlugin
return
$htmlString
;
return
$htmlString
;
}
}
}
}
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