Add GenericObject plugin files and assets
- Introduced default icon images in PNG and SVG formats. - Added example icons for car and cube in SVG format. - Created setup file for the GenericObject plugin with versioning and directory definitions. - Included a header file with licensing information for the plugin. - Added a remove.txt file with instructions for safe deletion.
This commit is contained in:
35
plugins/genericobject/objects/front.form.tpl
Normal file
35
plugins/genericobject/objects/front.form.tpl
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* This file is automatically managed by genericobject plugin. Do not edit it !
|
||||
*/
|
||||
|
||||
include ("../../../inc/includes.php");
|
||||
|
||||
$dropdown = new %%CLASSNAME%%();
|
||||
include (GLPI_ROOT . "/front/dropdown.common.form.php");
|
||||
38
plugins/genericobject/objects/front.tpl
Normal file
38
plugins/genericobject/objects/front.tpl
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
include ("../../../inc/includes.php");
|
||||
|
||||
/**
|
||||
* This file is automatically managed by genericobject plugin. Do not edit it !
|
||||
*/
|
||||
|
||||
Html::header(%%CLASSNAME%%::getTypeName(), $_SERVER['PHP_SELF'], "plugins", "genericobject",
|
||||
"%%CLASSNAME%%");
|
||||
|
||||
Search::show('%%CLASSNAME%%');
|
||||
|
||||
Html::footer();
|
||||
45
plugins/genericobject/objects/generic.class.tpl
Normal file
45
plugins/genericobject/objects/generic.class.tpl
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* This class is automatically managed by genericobject plugin. Do not edit it !
|
||||
*/
|
||||
class %%CLASSNAME%% extends PluginGenericobjectObject {
|
||||
|
||||
static $rightname = '';
|
||||
|
||||
static function getFormURL($full=true) {
|
||||
return Toolbox::getItemTypeFormURL( get_parent_class() , $full) .
|
||||
"?itemtype=".get_called_class();
|
||||
}
|
||||
static function getSearchURL($full=true) {
|
||||
return Toolbox::getItemTypeSearchURL( get_parent_class() , $full) .
|
||||
"?itemtype=".get_called_class();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
33
plugins/genericobject/objects/generic.dropdown.class.tpl
Normal file
33
plugins/genericobject/objects/generic.dropdown.class.tpl
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* This class is automatically managed by genericobject plugin. Do not modify it !
|
||||
*/
|
||||
class %%CLASSNAME%% extends %%EXTENDS%% {
|
||||
public $linked_itemtype = "%%LINKED_ITEMTYPE%%";
|
||||
}
|
||||
35
plugins/genericobject/objects/generic.form.tpl
Normal file
35
plugins/genericobject/objects/generic.form.tpl
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* This file is automatically managed by genericobject plugin. Do not edit it !
|
||||
*/
|
||||
|
||||
include ("../../../inc/includes.php");
|
||||
|
||||
$item = new %%CLASSNAME%%();
|
||||
include (GENERICOBJECT_DIR."/front/object.form.php");
|
||||
28
plugins/genericobject/objects/locale.tpl
Normal file
28
plugins/genericobject/objects/locale.tpl
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
$LANG['genericobject']['%%CLASSNAME%%'][0]="%%NAME%%";
|
||||
44
plugins/genericobject/objects/object_item.class.tpl
Normal file
44
plugins/genericobject/objects/object_item.class.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
if (!defined('GLPI_ROOT')){
|
||||
die("Sorry. You can't access directly to this file");
|
||||
}
|
||||
|
||||
class %%CLASSNAME%% extends PluginGenericobjectObject_Item {
|
||||
|
||||
public $dohistory = true;
|
||||
|
||||
// From CommonDBRelation
|
||||
static public $itemtype_1 = '%%SOURCEOBJECT%%';
|
||||
static public $items_id_1 = '%%FOREIGNKEY%%';
|
||||
|
||||
static public $itemtype_2 = 'itemtype';
|
||||
static public $items_id_2 = 'items_id';
|
||||
static public $checkItem_2_Rights = self::HAVE_VIEW_RIGHT_ON_ITEM;
|
||||
}
|
||||
|
||||
95
plugins/genericobject/objects/objectinjection.class.tpl
Normal file
95
plugins/genericobject/objects/objectinjection.class.tpl
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of the genericobject plugin.
|
||||
|
||||
Genericobject plugin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Genericobject plugin 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Genericobject. If not, see <http://www.gnu.org/licenses/>.
|
||||
--------------------------------------------------------------------------
|
||||
@package genericobject
|
||||
@author the genericobject plugin team
|
||||
@copyright Copyright (c) 2010-2017 Genericobject plugin team
|
||||
@license GPLv2+
|
||||
http://www.gnu.org/licenses/gpl.txt
|
||||
@link https://github.com/pluginsGLPI/genericobject
|
||||
@link http://www.glpi-project.org/
|
||||
@since 2009
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* This file is automatically managed by genericobject plugin. Do not edit it !
|
||||
*/
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access directly to this file");
|
||||
}
|
||||
|
||||
class %%INJECTIONCLASS%% extends %%CLASSNAME%%
|
||||
implements PluginDatainjectionInjectionInterface {
|
||||
|
||||
function __construct() {
|
||||
$this->table = getTableForItemType(get_parent_class($this));
|
||||
}
|
||||
|
||||
static function getTable($classname = null) {
|
||||
|
||||
$parenttype = get_parent_class();
|
||||
return $parenttype::getTable();
|
||||
|
||||
}
|
||||
|
||||
function isPrimaryType() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function connectedTo() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard method to add an object into glpi
|
||||
*
|
||||
* @param values fields to add into glpi
|
||||
* @param options options used during creation
|
||||
* @return an array of IDs of newly created objects : for example [Computer=>1, Networkport=>10]
|
||||
*
|
||||
**/
|
||||
function addOrUpdateObject($values = [], $options = []) {
|
||||
|
||||
$lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options);
|
||||
$lib->processAddOrUpdate();
|
||||
return $lib->getInjectionResults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search options formatted for injection mapping usage in datainjection plugin.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getOptions($primary_type = '') {
|
||||
$plugin = new Plugin();
|
||||
if (!$plugin->isActivated('datainjection')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return PluginDatainjectionCommonInjectionLib::addToSearchOptions(
|
||||
Search::getOptions(get_parent_class($this)),
|
||||
[
|
||||
'ignore_fields' => PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(
|
||||
get_parent_class($this)
|
||||
),
|
||||
],
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user