Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
4f5962bf
Verified
Commit
4f5962bf
authored
Dec 12, 2019
by
Cyril Vazquez
Browse files
Fix #12586 Fix Datatable init error
parent
a3ae1a28
Pipeline
#5647
passed with stage
in 8 minutes
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dependency/html/Document.php
View file @
4f5962bf
...
...
@@ -37,12 +37,13 @@ class Document extends \dependency\xml\Document
------------------------------------------------------------------------- */
protected
$layout
;
protected
$classes
;
p
rotected
$plugins
;
p
ublic
$plugins
;
protected
$headers
;
protected
$layoutData
;
public
$XPath
;
public
$translator
;
public
$dateTimeFormatter
;
public
$pluginsParameters
=
[];
/**
* -- document --
* <html>
...
...
@@ -402,15 +403,9 @@ class Document extends \dependency\xml\Document
*/
public
function
addPlugins
(
$node
=
null
)
{
//var_dump("addPlugins($node->nodeType)");
$elements
=
$this
->
XPath
->
query
(
"descendant-or-self::*[@class]"
,
$node
);
foreach
(
$elements
as
$element
)
{
foreach
(
explode
(
' '
,
$element
->
getAttribute
(
'class'
))
as
$htmlClass
)
{
if
(
isset
(
$this
->
plugins
[
$htmlClass
]))
{
$pluginClass
=
$this
->
plugins
[
$htmlClass
];
$element
->
plugin
[
$htmlClass
]
=
new
$pluginClass
(
$element
);
}
}
$element
->
addPlugins
();
}
}
...
...
@@ -420,19 +415,9 @@ class Document extends \dependency\xml\Document
*/
public
function
savePlugins
(
$node
=
null
)
{
$parameters
=
[];
$elements
=
$this
->
XPath
->
query
(
"descendant-or-self::*[@class]"
,
$node
);
foreach
(
$elements
as
$element
)
{
foreach
(
$element
->
plugin
as
$name
=>
$plugin
)
{
if
(
method_exists
(
$plugin
,
'saveHtml'
))
{
$plugin
->
saveHtml
();
}
if
(
!
isset
(
$parameters
[
$name
])
&&
method_exists
(
$plugin
,
'saveParameters'
))
{
$parameters
[
$name
]
=
$plugin
;
$plugin
->
saveParameters
();
}
}
$element
->
savePlugins
();
}
}
...
...
dependency/html/Element.php
View file @
4f5962bf
...
...
@@ -24,7 +24,7 @@ class Element
/* -------------------------------------------------------------------------
- Properties
------------------------------------------------------------------------- */
p
ublic
$plugin
=
array
()
;
p
rotected
$plugin
;
/* -------------------------------------------------------------------------
- Methods
------------------------------------------------------------------------- */
...
...
@@ -99,4 +99,71 @@ class Element
{
return
implode
(
" "
,
$array
);
}
}
\ No newline at end of file
/**
* Returns the requested property
*
* @param string $name
*
* @return mixed
*/
public
function
__get
(
$name
)
{
if
(
$name
==
'plugin'
&&
empty
(
$this
->
plugin
))
{
$this
->
plugin
=
new
PluginContainer
(
$this
);
}
return
$this
->
{
$name
};
}
/**
* Add plugins
*/
public
function
addPlugins
()
{
foreach
(
explode
(
' '
,
$this
->
getAttribute
(
'class'
))
as
$htmlClass
)
{
if
(
isset
(
$this
->
ownerDocument
->
plugins
[
$htmlClass
]))
{
if
(
!
isset
(
$this
->
plugin
))
{
$this
->
plugin
=
new
PluginContainer
(
$this
);
}
$this
->
plugin
->
add
(
$htmlClass
);
}
}
}
/**
* Translate plugins
*/
public
function
translatePlugins
()
{
if
(
!
isset
(
$this
->
plugin
))
{
return
;
}
foreach
(
$this
->
plugin
as
$name
=>
$plugin
)
{
if
(
method_exists
(
$plugin
,
'translate'
))
{
$plugin
->
translate
();
}
}
}
/**
* Save plugins
*/
public
function
savePlugins
()
{
if
(
!
isset
(
$this
->
plugin
))
{
return
;
}
foreach
(
$this
->
plugin
as
$name
=>
$plugin
)
{
if
(
method_exists
(
$plugin
,
'saveHtml'
))
{
$plugin
->
saveHtml
();
}
if
(
method_exists
(
$plugin
,
'saveParameters'
))
{
$plugin
->
saveParameters
();
}
}
}
}
dependency/html/LocalisationTrait.php
View file @
4f5962bf
...
...
@@ -253,11 +253,7 @@ trait LocalisationTrait
{
$elements
=
$this
->
XPath
->
query
(
"descendant-or-self::*[@class]"
,
$node
);
foreach
(
$elements
as
$element
)
{
foreach
(
$element
->
plugin
as
$name
=>
$plugin
)
{
if
(
method_exists
(
$plugin
,
'translate'
))
{
$plugin
->
translate
();
}
}
$element
->
translatePlugins
();
}
}
...
...
dependency/html/PluginContainer.php
0 → 100644
View file @
4f5962bf
<?php
/*
* Copyright (C) 2019 Maarch
*
* This file is part of dependency html.
*
* Dependency html is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Dependency html is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with dependency html. If not, see <http://www.gnu.org/licenses/>.
*/
namespace
dependency\html
;
/**
* Element plugins container
*
* @package Dependency\Html
* @author Cyril VAZQUEZ <cyril.vazquez@maarch.org>
**/
class
PluginContainer
extends
\
ArrayObject
{
/**
* The owner element of the container
*
* @var DOMElement
*/
protected
$element
;
/**
* Constructs a new container
* @param DOMElement $element
*/
public
function
__construct
(
$element
)
{
$this
->
element
=
$element
;
}
/**
* Returns the requested plugin or instancites a new one
*
* @param string $name
*
* @return object
*/
public
function
offsetGet
(
$name
)
{
if
(
!
isset
(
$this
[
$name
])
&&
isset
(
$this
->
element
->
ownerDocument
->
plugins
[
$name
]))
{
$this
->
add
(
$name
);
}
return
parent
::
offsetGet
(
$name
);
}
/**
* Adds a plugin from a class
*
* @param string $name
*/
public
function
add
(
$name
)
{
$pluginClass
=
$this
->
element
->
ownerDocument
->
plugins
[
$name
];
$plugin
=
new
$pluginClass
(
$this
->
element
);
$this
[
$name
]
=
$plugin
;
}
}
src/presentation/maarchRM/Resources/view/dashboard/mainScreen/archiveForm.html
View file @
4f5962bf
...
...
@@ -120,7 +120,7 @@
};
$
(
'
#app_maarchRM_main
'
).
ready
(
function
()
{
$
(
"
#managementMetadataForm
"
).
find
(
"
[name=retentionStartDate]
"
).
data
(
"
datepicker
"
).
setDate
(
new
Date
());
//
$("#managementMetadataForm").find("[name=retentionStartDate]").data("datepicker").setDate(new Date());
});
$
(
"
#archiveForm
"
).
keypress
(
function
(
e
)
{
...
...
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