├── locales ├── en_GB.mo ├── fr_FR.mo ├── en_GB.po ├── glpi.pot └── fr_FR.po ├── README.md ├── scripts ├── function.js └── filtergroup.js.php ├── install └── sql │ └── empty-1.0.0.sql ├── tools └── extract_template.sh ├── front ├── group.form.php └── profilegroup.form.php ├── inc ├── group.class.php ├── profilegroup.class.php └── profile.class.php ├── ajax └── group_values.php ├── hook.php ├── setup.php └── LICENSE /locales/en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/groupassignment/master/locales/en_GB.mo -------------------------------------------------------------------------------- /locales/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/groupassignment/master/locales/fr_FR.mo -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GroupAssignment 2 | 3 | Plugin GroupAssignment for GLPI 4 | 5 | Ce plugin permet de filtrer la liste des groupes "Attribué à" selon les profils lors de la création ou modification d'un ticket. 6 | 7 | Exemple : 8 | * Groupes existants et pouvant être "attribué à" : **Groupe 1**, **Groupe 2**, **Groupe 3** 9 | * Dans la configuration du plugin pour le **"Profil 1"**, le groupe "Groupe 1" sera ajouté 10 | * Le **"Profil 1"** ne pourra attribué que le Groupe 1 lors de la création ou la modification d'un ticket -------------------------------------------------------------------------------- /scripts/function.js: -------------------------------------------------------------------------------- 1 | var getUrlParameter = function(val) { 2 | var result = undefined, 3 | tmp = []; 4 | 5 | location.search 6 | .substr(1) // remove '?' 7 | .split("&") 8 | .forEach(function (item) { 9 | tmp = item.split("="); 10 | if (tmp[0] === val) { 11 | result = decodeURIComponent(tmp[1]); 12 | } 13 | }); 14 | return result; 15 | }; 16 | 17 | 18 | var checkDOMChange = function (selector, handler) { 19 | if ($(selector).get(0)) { 20 | return handler(); 21 | } 22 | setTimeout( function() { 23 | checkDOMChange(selector, handler); 24 | }, 100 ); 25 | }; -------------------------------------------------------------------------------- /install/sql/empty-1.0.0.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_groupassignment_profilegroups' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_groupassignment_profilegroups`; 5 | CREATE TABLE `glpi_plugin_groupassignment_profilegroups` ( 6 | `id` int(11) NOT NULL auto_increment, 7 | `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `groups_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 9 | PRIMARY KEY (`id`), 10 | FOREIGN KEY (`profiles_id`) REFERENCES glpi_profiles(id), 11 | FOREIGN KEY (`groups_id`) REFERENCES glpi_groups(id) 12 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 13 | 14 | -------------------------------------------------------------------------------- /locales/en_GB.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2016-08-26 10:29+0200\n" 6 | "PO-Revision-Date: 2016-08-26 10:29+0200\n" 7 | "Last-Translator: \n" 8 | "Language-Team: \n" 9 | "Language: en_GB\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "X-Generator: Poedit 1.8.5\n" 14 | "X-Poedit-Basepath: .\n" 15 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 16 | 17 | #: setup.php:49 inc/profile.class.php:51 inc/profile.class.php:131 18 | msgid "Ticket group assignment" 19 | msgstr "Ticket group assignment" 20 | 21 | #: setup.php:60 22 | msgid "This plugin requires GLPI 0.85 or higher" 23 | msgstr "This plugin requires GLPI 0.85 or higher" 24 | 25 | #: inc/profilegroup.class.php:97 26 | msgid "Group list" 27 | msgstr "Group list" 28 | 29 | #: inc/profilegroup.class.php:128 30 | msgid "No group is added to the list" 31 | msgstr "No group is added to the list" 32 | -------------------------------------------------------------------------------- /locales/glpi.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR GROUPASSIGNMENT Development Team 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI - GROUPASSIGNMENT plugin 1.0.0\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2016-08-26 10:29+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: setup.php:49 inc/profile.class.php:51 inc/profile.class.php:131 21 | msgid "Ticket group assignment" 22 | msgstr "" 23 | 24 | #: setup.php:60 25 | msgid "This plugin requires GLPI 0.85 or higher" 26 | msgstr "" 27 | 28 | #: inc/profilegroup.class.php:97 29 | msgid "Group list" 30 | msgstr "" 31 | 32 | #: inc/profilegroup.class.php:128 33 | msgid "No group is added to the list" 34 | msgstr "" 35 | -------------------------------------------------------------------------------- /tools/extract_template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | soft='GLPI - GROUPASSIGNMENT plugin' 4 | version='1.0.0' 5 | email='glpi-translation@gna.org' 6 | copyright='INDEPNET Development Team' 7 | 8 | #xgettext *.php */*.php -copyright-holder='$copyright' --package-name=$soft --package-version=$version --msgid-bugs-address=$email -o locales/en_GB.po -L PHP --from-code=UTF-8 --force-po -i --keyword=_n:1,2 --keyword=__ --keyword=_e 9 | 10 | # Only strings with domain specified are extracted (use Xt args of keyword param to set number of args needed) 11 | 12 | xgettext *.php */*.php --copyright-holder='GROUPASSIGNMENT Development Team' --package-name='GLPI - GROUPASSIGNMENT plugin' --package-version='1.0.0' -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po \ 13 | --keyword=_n:1,2,4t --keyword=__s:1,2t --keyword=__:1,2t --keyword=_e:1,2t --keyword=_x:1c,2,3t \ 14 | --keyword=_ex:1c,2,3t --keyword=_nx:1c,2,3,5t --keyword=_sx:1c,2,3t 15 | 16 | ### for using tx : 17 | ##tx set --execute --auto-local -r GLPI_ocsinventoryng.glpi_ocsinventoryng-version-100 'locales/.po' --source-lang en --source-file locales/glpi.pot 18 | ## tx push -s 19 | ## tx pull -a 20 | 21 | 22 | -------------------------------------------------------------------------------- /front/group.form.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | include ("../../../inc/includes.php"); 27 | 28 | Session::checkRight("plugin_groupassignment", UPDATE); 29 | 30 | $grp = new PluginGroupassignmentGroup(); 31 | 32 | if (isset($_POST['update_groupassignment_group'])) { 33 | $grp->update($_POST); 34 | Html::back(); 35 | } 36 | -------------------------------------------------------------------------------- /locales/fr_FR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2016-08-26 10:29+0200\n" 6 | "PO-Revision-Date: 2016-08-26 10:29+0200\n" 7 | "Last-Translator: \n" 8 | "Language-Team: \n" 9 | "Language: fr_FR\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "X-Generator: Poedit 1.8.5\n" 14 | "X-Poedit-Basepath: .\n" 15 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 16 | 17 | #: setup.php:49 inc/profile.class.php:51 inc/profile.class.php:131 18 | msgid "Ticket group assignment" 19 | msgstr "Affectation de groupe de ticket" 20 | 21 | #: setup.php:60 22 | msgid "This plugin requires GLPI 0.85 or higher" 23 | msgstr "Ce plugin nécessite GLPI 0.85 ou supérieur" 24 | 25 | #: inc/profilegroup.class.php:97 26 | msgid "Group list" 27 | msgstr "Liste des groupes" 28 | 29 | #: inc/profilegroup.class.php:128 30 | msgid "No group is added to the list" 31 | msgstr "Aucun groupe présent dans la liste" 32 | 33 | #~ msgid "VIP management" 34 | #~ msgstr "Gestion VIP" 35 | 36 | #~ msgid "VIP group" 37 | #~ msgstr "Groupe VIP" 38 | 39 | #~ msgid "VIP" 40 | #~ msgstr "VIP" 41 | 42 | #~ msgid "Rights management" 43 | #~ msgstr "Gestion des droits" 44 | 45 | #~ msgid "VIP : %s tickets updated" 46 | #~ msgstr "VIP : %s tickets mis à jour" 47 | 48 | #~ msgid "%1$s %2$s" 49 | #~ msgstr "%1$s %2$s" 50 | -------------------------------------------------------------------------------- /front/profilegroup.form.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | include ("../../../inc/includes.php"); 27 | 28 | Session::haveRight("plugin_groupassignment", UPDATE); 29 | 30 | $profilegroup = new PluginGroupassignmentProfileGroup(); 31 | 32 | if (isset($_POST['add_group'])) { 33 | $profilegroup->add($_POST); 34 | Html::back(); 35 | } 36 | -------------------------------------------------------------------------------- /inc/group.class.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | if (!defined('GLPI_ROOT')) { 27 | die("Sorry. You can't access directly to this file"); 28 | } 29 | 30 | /** 31 | * Class PluginGroupassignmentGroup 32 | */ 33 | class PluginGroupassignmentGroup extends CommonDBTM { 34 | 35 | static $rightname = 'plugin_groupassignment'; 36 | 37 | /** 38 | * Returns groups profile 39 | * @return array 40 | */ 41 | function getGroups() { 42 | 43 | $profilegroup = new PluginGroupassignmentProfileGroup(); 44 | 45 | //search groups with profile 46 | $groups = $profilegroup->find("`profiles_id` = ".$_SESSION['glpiactiveprofile']['id']); 47 | $tab = []; 48 | if (count($groups)) { 49 | foreach ($groups as $group) { 50 | $tab[$group['groups_id']] = Dropdown::getDropdownName('glpi_groups', $group['groups_id']); 51 | } 52 | return $tab; 53 | } else { 54 | return []; 55 | } 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /ajax/group_values.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | 27 | $AJAX_INCLUDE = 1; 28 | include ("../../../inc/includes.php"); 29 | header("Content-Type: text/html; charset=UTF-8"); 30 | Html::header_nocache(); 31 | Session::checkLoginUser(); 32 | 33 | $ticket_id = (isset($_REQUEST['ticket_id'])) ? $_REQUEST['ticket_id'] : 0; 34 | $entities_id = (isset($_REQUEST['entities_id'])) ? $_REQUEST['entities_id'] : 0; 35 | 36 | $PluginGroupassignmentGroup = new PluginGroupassignmentGroup(); 37 | 38 | $groups_id_filtred = $PluginGroupassignmentGroup->getGroups(); 39 | 40 | if (count($groups_id_filtred) > 0) { 41 | $myarray = []; 42 | foreach ($groups_id_filtred as $groups_id => $groups_name) { 43 | $myarray[] = $groups_id; 44 | } 45 | $newarray = implode(", ", $myarray); 46 | $condition = " id IN ($newarray)"; 47 | 48 | } else { 49 | $condition = "`is_assign`"; 50 | $_POST['entity_restrict'] = $entities_id; 51 | } 52 | 53 | $rand = mt_rand(); 54 | $_SESSION['glpicondition'][$rand] = $condition; 55 | 56 | $_POST["condition"] = $rand; 57 | 58 | if ($ticket_id) { 59 | $ticket = new Ticket(); 60 | $ticket->getFromDB($ticket_id); 61 | $_POST["entity_restrict"] = $ticket->fields['entities_id']; 62 | } else { 63 | $_POST['entity_restrict'] = $entities_id; 64 | } 65 | 66 | require ("../../../ajax/getDropdownValue.php"); -------------------------------------------------------------------------------- /hook.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | /** 27 | * @return bool 28 | */ 29 | function plugin_groupassignment_install() { 30 | global $DB; 31 | include_once(GLPI_ROOT."/plugins/groupassignment/inc/profile.class.php"); 32 | 33 | //First install 34 | if (!TableExists("glpi_plugin_groupassignment_profilegroups")) { 35 | $DB->runFile(GLPI_ROOT . "/plugins/groupassignment/install/sql/empty-1.0.0.sql"); 36 | } 37 | 38 | PluginGroupassignmentProfile::initProfile(); 39 | PluginGroupassignmentProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); 40 | 41 | return true; 42 | } 43 | 44 | /** 45 | * @return bool 46 | */ 47 | function plugin_groupassignment_uninstall() { 48 | global $DB; 49 | include_once (GLPI_ROOT."/plugins/groupassignment/inc/profile.class.php"); 50 | 51 | $tables = ["glpi_plugin_groupassignment_profilegroups"]; 52 | 53 | foreach ($tables as $table) { 54 | $DB->query("DROP TABLE IF EXISTS `$table`;"); 55 | } 56 | 57 | //Delete rights associated with the plugin 58 | $profileRight = new ProfileRight(); 59 | foreach (PluginGroupassignmentProfile::getAllRights() as $right) { 60 | $profileRight->deleteByCriteria(['name' => $right['field']]); 61 | } 62 | PluginGroupassignmentProfile::removeRightsFromSession(); 63 | 64 | return true; 65 | } 66 | 67 | // Define dropdown relations 68 | /** 69 | * @return array 70 | */ 71 | function plugin_groupassignment_getPluginsDatabaseRelations() { 72 | 73 | $plugin = new Plugin(); 74 | if ($plugin->isActivated("groupassignment")) { 75 | return [ 76 | "glpi_groups" => ["glpi_plugin_groupassignment_profilegroups" => "groups_id"], 77 | "glpi_profiles" => ["glpi_plugin_groupassignment_profilegroups" => "profiles_id"] 78 | ]; 79 | } else { 80 | return []; 81 | } 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | // Init the hooks of the plugins -Needed 27 | function plugin_init_groupassignment() { 28 | global $PLUGIN_HOOKS; 29 | 30 | $PLUGIN_HOOKS['csrf_compliant']['groupassignment'] = true; 31 | 32 | $plugin = new Plugin(); 33 | if ($plugin->isActivated("groupassignment")) { 34 | 35 | Plugin::registerClass('PluginGroupassignmentProfile', ['addtabon' => ['Profile']]); 36 | $PLUGIN_HOOKS['change_profile']['groupassignment'] = ['PluginGroupassignmentProfile', 'changeProfile']; 37 | 38 | $PLUGIN_HOOKS['add_javascript']['groupassignment'][] = 'scripts/function.js'; 39 | if (Session::getLoginUserID() && (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false)) { 40 | //filter group feature 41 | $PLUGIN_HOOKS['add_javascript']['groupassignment'][] = 'scripts/filtergroup.js.php'; 42 | } 43 | } 44 | } 45 | 46 | // Get the name and the version of the plugin - Needed 47 | /** 48 | * @return array 49 | */ 50 | function plugin_version_groupassignment() { 51 | 52 | return ['name' => __('Ticket group assignment', 'groupassignment'), 53 | 'version' => '1.0.0', 54 | 'author' => "Infotel", 55 | 'license' => 'GPLv2+', 56 | 'minGlpiVersion' => '0.85']; // For compatibility / no install in version < 0.85 57 | } 58 | 59 | // Optional : check prerequisites before install : may print errors or add to message after redirect 60 | function plugin_groupassignment_check_prerequisites() { 61 | 62 | if (version_compare(GLPI_VERSION, '0.85', 'lt') || version_compare(GLPI_VERSION, '9.2', 'ge')) { 63 | _e('This plugin requires GLPI 0.85 or higher', 'groupassignment'); 64 | return false; 65 | } 66 | return true; 67 | } 68 | 69 | // Uninstall process for plugin : need to return true if succeeded 70 | //may display messages or add to message after redirect 71 | function plugin_groupassignment_check_config() { 72 | return true; 73 | } 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /inc/profilegroup.class.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | if (!defined('GLPI_ROOT')) { 27 | die("Sorry. You can't access directly to this file"); 28 | } 29 | 30 | /** 31 | * Class PluginGroupassignmentProfileGroup 32 | */ 33 | class PluginGroupassignmentProfileGroup extends CommonDBTM { 34 | 35 | static $rightname = 'plugin_groupassignment'; 36 | 37 | /** 38 | * Form add groups 39 | * @param type $ID 40 | */ 41 | static function showProfileGroup($ID) { 42 | echo "
"; 43 | $profilegroup = new PluginGroupassignmentProfileGroup(); 44 | echo "
"; 45 | 46 | echo ""; 47 | echo ""; 49 | 50 | //groups already added 51 | $used = []; 52 | $profilegroups = $profilegroup->find('`profiles_id` = ' . $ID); 53 | foreach ($profilegroups as $group) { 54 | $used[$group['groups_id']] = $group['groups_id']; 55 | } 56 | 57 | echo ""; 58 | echo ""; 61 | 62 | echo ""; 63 | echo ""; 67 | echo "
" . __('Group'); 48 | echo "
" . __('Group') . ""; 59 | Dropdown::show('Group', ['name' => 'groups_id', 'used' => $used, 'condition' => "`is_assign` = 1"]); 60 | echo "
"; 64 | echo ""; 65 | echo ""; 66 | echo "
"; 68 | 69 | Html::closeForm(); 70 | } 71 | 72 | /** 73 | * List of groups 74 | * @param type $ID 75 | */ 76 | static function showListProfileGroup($ID) { 77 | 78 | $rand = mt_rand(); 79 | 80 | $canedit = Session::haveRight('plugin_groupassignment', PURGE); 81 | 82 | //groups add to profile 83 | $profilegroup = new self(); 84 | $profilegroups = $profilegroup->find('`profiles_id` = ' . $ID); 85 | 86 | $number = count($profilegroups); 87 | 88 | if ($number) { 89 | echo "
"; 90 | if ($canedit) { 91 | Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); 92 | 93 | $massiveactionparams = ['container' => 'mass' . __CLASS__ . $rand, 94 | 'check_itemtype' => 'Config']; 95 | Html::showMassiveActions($massiveactionparams); 96 | } 97 | 98 | //Group list 99 | echo ""; 100 | echo ""; 102 | echo ""; 103 | echo ""; 108 | echo ""; 111 | 112 | foreach ($profilegroups as $group) { 113 | echo ""; 120 | } 121 | 122 | echo "
" . __('Group list', 'groupassignment'); 101 | echo "
"; 104 | if ($canedit) { 105 | echo Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand); 106 | } 107 | echo ""; 109 | echo _n('Group', 'Groups', 1); 110 | echo "
"; 114 | if ($canedit) { 115 | Html::showMassiveActionCheckBox(__CLASS__, $group["id"]); 116 | } 117 | echo ""; 118 | echo Dropdown::getDropdownName('glpi_groups', $group['groups_id']); 119 | echo "
"; 123 | if ($canedit) { 124 | $massiveactionparams['ontop'] = false; 125 | Html::showMassiveActions($massiveactionparams); 126 | Html::closeForm(); 127 | } 128 | echo "
"; 129 | } else { 130 | echo "

"; 131 | _e('No group is added to the list', 'groupassignment'); 132 | echo "

"; 133 | } 134 | } 135 | 136 | /** 137 | * @since version 0.84 138 | **/ 139 | function getForbiddenStandardMassiveAction() { 140 | 141 | $forbidden = parent::getForbiddenStandardMassiveAction(); 142 | $forbidden[] = 'delete'; 143 | $forbidden[] = 'restore'; 144 | $forbidden[] = 'update'; 145 | 146 | return $forbidden; 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /scripts/filtergroup.js.php: -------------------------------------------------------------------------------- 1 | = 100); 51 | return {results: data.results, more: more}; 52 | } 53 | }, 54 | initSelection: function (element, callback) { 55 | var id=$(element).val(); 56 | var defaultid = '0'; 57 | if (id !== '') { 58 | // No ajax call for first item 59 | if (id === defaultid) { 60 | var data = {id: 0, 61 | text: "-----"}; 62 | callback(data); 63 | } else { 64 | $.ajax(url, { 65 | data: { 66 | ticket_id: tickets_id, 67 | itemtype: 'Group', 68 | display_emptychoice: true, 69 | displaywith: [], 70 | emptylabel: "-----", 71 | condition: "8791f22d6279ae77180198b33b4cc0f0e3b49513", 72 | used: [], 73 | toadd: [], 74 | entity_restrict: 0, 75 | limit: "50", 76 | permit_select_parent: false, 77 | specific_tags: [], 78 | _one_id: id}, 79 | dataType: 'json', 80 | type: 'POST' 81 | }).done(function(data) { callback(data); }); 82 | } 83 | } 84 | 85 | }, 86 | formatResult: function(result, container, query, escapeMarkup) { 87 | var markup=[]; 88 | window.Select2.util.markMatch(result.text, query.term, markup, escapeMarkup); 89 | if (result.level) { 90 | var a=''; 91 | var i=result.level; 92 | while (i>1) { 93 | a = a+'   '; 94 | i=i-1; 95 | } 96 | return a+'»'+markup.join(''); 97 | } 98 | return markup.join(''); 99 | } 100 | }); 101 | } 102 | 103 | $(document).ready(function() { 104 | if (tickets_id == undefined) { 105 | // ----------------------- 106 | // ---- Create Ticket ---- 107 | // ----------------------- 108 | 109 | $('#tabspanel + div.ui-tabs').on("tabsload", function( event, ui ) { 110 | setTimeout(function() { 111 | // Group 112 | if($("*[name='_groups_id_assign']")[0] != undefined) { 113 | var assign_select_dom_id = $("*[name='_groups_id_assign']")[0].id; 114 | var entities_id = $("input[name='entities_id']")[0].value; 115 | redefineDropdown(assign_select_dom_id, urlGroup, 0, entities_id); 116 | } 117 | }, 300); 118 | }); 119 | 120 | } else { 121 | // ----------------------- 122 | // ---- Update Ticket ---- 123 | // ----------------------- 124 | 125 | $(document).ajaxSend(function( event, jqxhr, settings ) { 126 | // Ticket : Group 127 | if (settings.url.indexOf("dropdownItilActors.php") > 0 128 | && settings.data.indexOf("group") > 0 129 | && settings.data.indexOf("assign") > 0) { 130 | checkDOMChange("input[name='_itil_assign[groups_id]']", function() { 131 | var assign_select_dom_id = $("input[name='_itil_assign[groups_id]']")[0].id; 132 | redefineDropdown(assign_select_dom_id, urlGroup, tickets_id, 0); 133 | }); 134 | } 135 | //TicketTask Group 136 | if (settings.url.indexOf("timeline.php") > 0 137 | && settings.data.indexOf("TicketTask") > 0) { 138 | setTimeout(function() { 139 | var select_groups = $("input[name='groups_id_tech']"); 140 | select_groups.each(function (href, value) { 141 | redefineDropdown(value.id, urlGroup, tickets_id, 0); 142 | }); 143 | }, 300); 144 | } 145 | }); 146 | 147 | } 148 | }); 149 | JAVASCRIPT; 150 | echo $JS; 151 | -------------------------------------------------------------------------------- /inc/profile.class.php: -------------------------------------------------------------------------------- 1 | . 24 | -------------------------------------------------------------------------- */ 25 | 26 | if (!defined('GLPI_ROOT')) { 27 | die("Sorry. You can't access directly to this file"); 28 | } 29 | 30 | /** 31 | * Class PluginGroupassignmentProfile 32 | * 33 | * This class manages the profile rights of the plugin 34 | */ 35 | class PluginGroupassignmentProfile extends Profile { 36 | 37 | /** 38 | * @param int $nb 39 | * @return translated 40 | */ 41 | static function getTypeName($nb = 0) { 42 | return __('Rights management'); 43 | } 44 | 45 | /** 46 | * Get tab name for item 47 | * 48 | * @param CommonGLPI $item 49 | * @param type $withtemplate 50 | * @return string 51 | */ 52 | function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { 53 | 54 | if ($item->getType()=='Profile' 55 | && $item->fields['interface'] == 'central') { 56 | return __('Ticket group assignment', 'groupassignment'); 57 | } 58 | return ''; 59 | } 60 | 61 | /** 62 | * display tab content for item 63 | * 64 | * @global type $CFG_GLPI 65 | * @param CommonGLPI $item 66 | * @param type $tabnum 67 | * @param type $withtemplate 68 | * @return boolean 69 | */ 70 | static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { 71 | 72 | if ($item->getType()=='Profile') { 73 | $ID = $item->getID(); 74 | $prof = new self(); 75 | 76 | self::addDefaultProfileInfos($ID, 77 | ['plugin_groupassignment' => 0]); 78 | $prof->showForm($ID); 79 | 80 | if (Session::haveRight('plugin_groupassignment', UPDATE)) { 81 | PluginGroupassignmentProfileGroup::showProfileGroup($ID); 82 | } 83 | PluginGroupassignmentProfileGroup::showListProfileGroup($ID); 84 | } 85 | 86 | return true; 87 | } 88 | 89 | /** 90 | * show profile form 91 | * 92 | * @param type $ID 93 | * @param type $options 94 | * @return boolean 95 | */ 96 | function showForm ($profiles_id = 0, $openform = true, $closeform = true) { 97 | 98 | echo "
"; 99 | if (($canedit = Session::haveRightsOr(self::$rightname, [UPDATE, PURGE])) 100 | && $openform) { 101 | $profile = new Profile(); 102 | echo ""; 103 | } 104 | 105 | $profile = new Profile(); 106 | $profile->getFromDB($profiles_id); 107 | 108 | $rights = $this->getAllRights(); 109 | $profile->displayRightsChoiceMatrix($rights, ['canedit' => $canedit, 110 | 'default_class' => 'tab_bg_2', 111 | 'title' => __('General')]); 112 | if ($canedit 113 | && $closeform) { 114 | echo "
"; 115 | echo Html::hidden('id', ['value' => $profiles_id]); 116 | echo Html::submit(_sx('button', 'Save'), ['name' => 'update']); 117 | echo "
\n"; 118 | Html::closeForm(); 119 | } 120 | echo "
"; 121 | 122 | $this->showLegend(); 123 | } 124 | 125 | /** 126 | * Get all rights 127 | * 128 | * @param type $all 129 | * @return array 130 | */ 131 | static function getAllRights($all = false) { 132 | 133 | $rights = [ 134 | ['itemtype' => 'PluginGroupassignmentGroup', 135 | 'label' => __('Ticket group assignment', 'groupassignment'), 136 | 'field' => 'plugin_groupassignment', 137 | 'rights' => [UPDATE => __('Update'), PURGE => __('Purge')] 138 | ] 139 | ]; 140 | 141 | return $rights; 142 | } 143 | 144 | /** 145 | * Init profiles 146 | * 147 | **/ 148 | 149 | static function translateARight($old_right) { 150 | switch ($old_right) { 151 | case '': 152 | return 0; 153 | case 'r' : 154 | return READ; 155 | case 'w': 156 | return UPDATE + PURGE; 157 | case '0': 158 | case '1': 159 | return $old_right; 160 | 161 | default : 162 | return 0; 163 | } 164 | } 165 | 166 | 167 | /** 168 | * @since 0.85 169 | * Migration rights from old system to the new one for one profile 170 | * @param $profiles_id the profile ID 171 | * @return bool 172 | */ 173 | static function migrateOneProfile($profiles_id) { 174 | global $DB; 175 | //Cannot launch migration if there's nothing to migrate... 176 | if (!TableExists('glpi_plugin_groupassignment_profiles')) { 177 | return true; 178 | } 179 | 180 | foreach ($DB->request('glpi_plugin_groupassignment_profiles', 181 | "`profiles_id`='$profiles_id'") as $profile_data) { 182 | 183 | $matching = ['show_groupassignment_tab' => 'plugin_groupassignment']; 184 | $current_rights = ProfileRight::getProfileRights($profiles_id, array_values($matching)); 185 | foreach ($matching as $old => $new) { 186 | if (!isset($current_rights[$old])) { 187 | $right = self::translateARight($profile_data[$old]); 188 | switch ($new) { 189 | case 'plugin_groupassignment' : 190 | $right = 0; 191 | if ($profile_data[$old] == '1') { 192 | $right = READ; 193 | } 194 | break; 195 | } 196 | 197 | $query = "UPDATE `glpi_profilerights` 198 | SET `rights`='".$right."' 199 | WHERE `name`='$new' AND `profiles_id`='$profiles_id'"; 200 | $DB->query($query); 201 | } 202 | } 203 | } 204 | } 205 | 206 | /** 207 | * Initialize profiles, and migrate it necessary 208 | */ 209 | static function initProfile() { 210 | global $DB; 211 | $profile = new self(); 212 | 213 | //Add new rights in glpi_profilerights table 214 | foreach ($profile->getAllRights(true) as $data) { 215 | if (countElementsInTable("glpi_profilerights", 216 | "`name` = '".$data['field']."'") == 0) { 217 | ProfileRight::addProfileRights([$data['field']]); 218 | } 219 | } 220 | 221 | //Migration old rights in new ones 222 | foreach ($DB->request("SELECT `id` FROM `glpi_profiles`") as $prof) { 223 | self::migrateOneProfile($prof['id']); 224 | } 225 | foreach ($DB->request("SELECT * 226 | FROM `glpi_profilerights` 227 | WHERE `profiles_id`='".$_SESSION['glpiactiveprofile']['id']."' 228 | AND `name` LIKE '%plugin_groupassignment%'") as $prof) { 229 | $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; 230 | } 231 | } 232 | 233 | /** 234 | * Initialize profiles, and migrate it necessary 235 | */ 236 | static function changeProfile() { 237 | global $DB; 238 | 239 | foreach ($DB->request("SELECT * 240 | FROM `glpi_profilerights` 241 | WHERE `profiles_id`='".$_SESSION['glpiactiveprofile']['id']."' 242 | AND `name` LIKE '%plugin_groupassignment%'") as $prof) { 243 | $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; 244 | } 245 | 246 | } 247 | 248 | /** 249 | * @param $profiles_id 250 | */ 251 | static function createFirstAccess($profiles_id) { 252 | 253 | $rights = ['plugin_groupassignment' => UPDATE + PURGE]; 254 | 255 | self::addDefaultProfileInfos($profiles_id, 256 | $rights, true); 257 | 258 | } 259 | 260 | /** 261 | * @param $profile 262 | **/ 263 | static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) { 264 | 265 | $profileRight = new ProfileRight(); 266 | foreach ($rights as $right => $value) { 267 | if (countElementsInTable('glpi_profilerights', 268 | "`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) { 269 | $profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]); 270 | } 271 | if (!countElementsInTable('glpi_profilerights', 272 | "`profiles_id`='$profiles_id' AND `name`='$right'")) { 273 | $myright['profiles_id'] = $profiles_id; 274 | $myright['name'] = $right; 275 | $myright['rights'] = $value; 276 | $profileRight->add($myright); 277 | 278 | //Add right to the current session 279 | $_SESSION['glpiactiveprofile'][$right] = $value; 280 | } 281 | } 282 | } 283 | 284 | static function removeRightsFromSession() { 285 | foreach (self::getAllRights(true) as $right) { 286 | if (isset($_SESSION['glpiactiveprofile'][$right['field']])) { 287 | unset($_SESSION['glpiactiveprofile'][$right['field']]); 288 | } 289 | } 290 | } 291 | 292 | } 293 | 294 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | --------------------------------------------------------------------------------