Plugin label and position
This commit is contained in:
parent
15ddb13229
commit
bef0f55b53
|
@ -17,10 +17,11 @@ if($Login->role()!=='admin') {
|
||||||
// Main before POST
|
// Main before POST
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
$_Plugin = false;
|
$_Plugin = false;
|
||||||
|
$pluginClassName = $layout['parameters'];
|
||||||
|
|
||||||
foreach($plugins['all'] as $P)
|
foreach($plugins['all'] as $P)
|
||||||
{
|
{
|
||||||
if($P->className()==$layout['parameters']) {
|
if($P->className()==$pluginClassName) {
|
||||||
$_Plugin = $P;
|
$_Plugin = $P;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +31,6 @@ if($_Plugin===false) {
|
||||||
Redirect::page('admin', 'plugins');
|
Redirect::page('admin', 'plugins');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the plugin has the method form.
|
|
||||||
if($_Plugin->form()===false) {
|
|
||||||
Redirect::page('admin', 'plugins');
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// POST Method
|
// POST Method
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
@ -22,7 +22,11 @@ if($Login->role()!=='admin') {
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
$pluginClassName = $layout['parameters'];
|
$pluginClassName = $layout['parameters'];
|
||||||
|
|
||||||
$Plugin = new $pluginClassName;
|
foreach($plugins['all'] as $P)
|
||||||
$Plugin->install();
|
{
|
||||||
|
if($P->className()==$pluginClassName) {
|
||||||
|
$P->install();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Redirect::page('admin', 'plugins');
|
Redirect::page('admin', 'plugins');
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
<title><?php echo $layout['title'] ?></title>
|
<title><?php echo $layout['title'] ?></title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="./css/kube.min.css">
|
<link rel="stylesheet" href="./css/kube.min.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||||
<link rel="stylesheet" href="./css/default.css">
|
<link rel="stylesheet" href="./css/default.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||||
<link rel="stylesheet" href="./css/css/font-awesome.css">
|
<link rel="stylesheet" href="./css/css/font-awesome.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||||
|
|
||||||
<script src="./js/jquery.min.js"></script>
|
<script src="./js/jquery.min.js"></script>
|
||||||
<script src="./js/kube.min.js"></script>
|
<script src="./js/kube.min.js"></script>
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
|
|
||||||
<input type="hidden" id="jskey" name="key" value="">
|
<input type="hidden" id="jskey" name="key" value="">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label><?php $Language->p('Plugin label') ?></label>
|
||||||
|
<input name="label" type="text" value="<?php echo $_Plugin->getDbField('label') ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo $_Plugin->form();
|
echo $_Plugin->form();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
{
|
{
|
||||||
echo '<div class="pluginBox">';
|
echo '<div class="pluginBox">';
|
||||||
|
|
||||||
echo '<p>'.$Plugin->name().' <span class="version">'.$Language->g('Version').': '.$Plugin->version().'</span></p>';
|
echo '<p>'.$Plugin->name().'<span class="version">'.$Language->g('Version').': '.$Plugin->version().'</span></p>';
|
||||||
echo '<p>'.$Plugin->description().'</p>';
|
echo '<p>'.$Plugin->description().'</p>';
|
||||||
|
|
||||||
if($Plugin->installed()) {
|
if($Plugin->installed()) {
|
||||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'" class="btn btn-red btn-small">'.$Language->g('Uninstall plugin').'</a>';
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'" class="btn btn-red btn-small">'.$Language->g('Uninstall plugin').'</a>';
|
||||||
if($Plugin->form()) {
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'" class="btn btn-small">'.$Language->g('Configure plugin').'</a>';
|
||||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'" class="btn btn-small">'.$Language->g('Configure plugin').'</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'" class="btn btn-blue btn-small">'.$Language->g('Install plugin').'</a>';
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'" class="btn btn-blue btn-small">'.$Language->g('Install plugin').'</a>';
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return TRUE if the installation success, otherwise FALSE.
|
// Return TRUE if the installation success, otherwise FALSE.
|
||||||
public function install()
|
public function install($position=0)
|
||||||
{
|
{
|
||||||
if($this->installed()) {
|
if($this->installed()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -157,7 +157,8 @@ class Plugin {
|
||||||
// Create database
|
// Create database
|
||||||
$Tmp = new dbJSON($this->filenameDb);
|
$Tmp = new dbJSON($this->filenameDb);
|
||||||
$Tmp->db = $this->dbFields;
|
$Tmp->db = $this->dbFields;
|
||||||
$Tmp->db['position'] = 0;
|
$Tmp->db['position'] = $position;
|
||||||
|
$Tmp->db['label'] = $this->name();
|
||||||
$Tmp->save();
|
$Tmp->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -130,5 +130,6 @@
|
||||||
"show-blog": "Show blog",
|
"show-blog": "Show blog",
|
||||||
"default-home-page": "Default home page",
|
"default-home-page": "Default home page",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
"there-are-no-drafts": "There are no drafts."
|
"there-are-no-drafts": "There are no drafts.",
|
||||||
|
"plugin-label": "Plugin label"
|
||||||
}
|
}
|
|
@ -12,6 +12,5 @@
|
||||||
|
|
||||||
"pages": "Pages",
|
"pages": "Pages",
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"show-home-link": "Show home link",
|
"show-home-link": "Show home link"
|
||||||
"label-text-to-display": "Label text to display"
|
|
||||||
}
|
}
|
|
@ -12,6 +12,5 @@
|
||||||
|
|
||||||
"pages": "Pages",
|
"pages": "Pages",
|
||||||
"home": "Accueil",
|
"home": "Accueil",
|
||||||
"show-home-link": "Afficher le lien de la page d’accueil",
|
"show-home-link": "Afficher le lien de la page d’accueil"
|
||||||
"label-text-to-display": "Texte à afficher"
|
|
||||||
}
|
}
|
|
@ -5,8 +5,7 @@ class pluginPages extends Plugin {
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'homeLink'=>true,
|
'homeLink'=>true
|
||||||
'label'=> 'Pages'
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +16,6 @@ class pluginPages extends Plugin {
|
||||||
$html = '<div>';
|
$html = '<div>';
|
||||||
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="true" '.($this->getDbField('homeLink')?'checked':'').'>';
|
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="true" '.($this->getDbField('homeLink')?'checked':'').'>';
|
||||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||||
$html .= '</div>';
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label for="label">'.$Language->get('Label text to display');
|
|
||||||
$html .= '<input type="text" name="label" value="'.$this->getDbField('label').'" />';
|
|
||||||
$html .= '</label>';
|
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
|
@ -63,12 +57,9 @@ class pluginPages extends Plugin {
|
||||||
}
|
}
|
||||||
$html .= '</ul></li>';
|
$html .= '</ul></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '</ul>';
|
$html .= '</ul>';
|
||||||
|
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue