summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 04b77e5)
raw | patch | inline | side by side (parent: 04b77e5)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 18 Feb 2010 09:46:32 +0000 (09:46 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 18 Feb 2010 09:46:32 +0000 (09:46 +0000) |
- Merge changeset 13812 from GOsa trunk
- Always initialize @valid_packages to avoid a PHP error if no valid
packages are specified (e.g. if only one package is specified that
has invalid characters).
- On initialization check for a configuration option
"direct_packages_add" in the plugin configuration and depending
what is set show a direct add field or not. Default is false.
- Update locales
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15646 594d385d-05f5-0310-b6e9-bd551577e9d8
- Always initialize @valid_packages to avoid a PHP error if no valid
packages are specified (e.g. if only one package is specified that
has invalid characters).
- On initialization check for a configuration option
"direct_packages_add" in the plugin configuration and depending
what is set show a direct add field or not. Default is false.
- Update locales
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15646 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPackage.inc
index d33d148077eb164bc84403c58d80786e85b5ef57..e877dfd1515aa858d6ff25f08f8b8245762da3ec 100644 (file)
var $usedPackages = array();
var $buffer = NULL;
- var $newDialogShown =false;
+ var $newDialogShown = false;
var $FAIstate = "";
var $view_logged = FALSE;
"hold", "clean", "aptitude", "aptitude-r",
"pending", "dpkgc" );
+ var $direct_packages_add = FALSE;
+
function faiPackage (&$config, $dn= NULL)
{
if($this->dn == "new"){
$this->is_new =TRUE;
}
+ /* Check weither its allowed to directly add packages */
+ $direct_packages_add = $config->search("faiManagement","direct_packages_add",array("menu"));
+ if (preg_match("/^true$/i", $direct_packages_add) || preg_match("/yes/i", $direct_packages_add)) {
+ $this->direct_packages_add = TRUE;
+ }
/* Generate package list */
$this->list= $this->genPkgs(TRUE);
* Add
******/
+ if(isset($_POST['AddManualpkg']) &&
+ isset($_POST['addPpkgsText']) &&
+ strlen($_POST['addPpkgsText']) &&
+ $this->acl_is_writeable("FAIpackage") &&
+ !preg_match("/freeze/",$this->FAIstate)){
+
+ // Check all splitted packages for valid package names
+ $add_packages = preg_split( "/[\s,]+/", get_post('addPpkgsText'), -1, PREG_SPLIT_NO_EMPTY );
+ $valid_packages = array();
+ if( is_array($add_packages) ) {
+ $invalid_packages = array();
+ foreach ($add_packages as $value) {
+ if(!preg_match( "/^[a-z0-9][-0-9a-z+\.]+$/",$value)){
+ $invalid_packages[] = trim($value);
+ }else{
+ $valid_packages[] = trim($value);
+ }
+ }
+ if(count($invalid_packages)){
+ $str = implode(", ",$invalid_packages);
+ msg_dialog::display(_("Invalid package names"),
+ sprintf(_("The following package names don't match the Debian policy: %s"),$str),
+ ERROR_DIALOG);
+ }
+
+
+ // If we have a complete list of valid packages, add them
+ if(count($valid_packages)){
+
+ foreach($valid_packages as $key => $value){
+ if(array_key_exists($value,$this->usedPackages)) {
+ unset($valid_packages[$key]);
+ }
+ }
+
+ // Query SI-Deamon for additional package information
+ $daemon = new gosaSupportDaemon();
+ $query_attrs = array("distribution", "package","version", "section", "description", "timestamp");
+ $do_si_query = true;
+
+
+ foreach ($valid_packages as $value) {
+
+ if( $do_si_query == true ) {
+ $res = $daemon->FAI_get_packages($this->FAIdebianRelease,$query_attrs,array($value),0,1);
+ if( ! $daemon->is_error()){
+
+ if(count($res)){
+
+ // We just use the last answer - there shouldn't be multiple
+ $res_attrs = array_pop( $res );
+ $this->list[$value] = $res_attrs;
+ $this->usedPackages[$value] = $res_attrs['PACKAGE'];
+
+ }else{
+ $this->usedPackages[$value] = $value;
+ }
+ }else{
+ msg_dialog::display(_("Service infrastructure"),
+ msgPool::siError($daemon->get_error()),
+ ERROR_DIALOG);
+ $do_si_query = false;
+ }
+ }
+ }
+
+ ksort($this->usedPackages);
+
+ /* Generate package list */
+ $this->list= $this->genPkgs(TRUE);
+ }
+ }
+ }
+
/* + was pressed to open the package dialog */
- if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage") && !preg_match("/freeze/",$this->FAIstate)){
+ if(isset($_POST['Addpkg']) &&
+ $this->acl_is_writeable("FAIpackage") &&
+ !preg_match("/freeze/",$this->FAIstate)){
$this->dialog = new faiPackageEntry($this->config, $this->FAIdebianRelease,$this->usedPackages);
$this->is_dialog =true;
}
+
/* Check image Posts
*/
foreach($_POST as $name => $value){
$smarty->assign("release" ,$this->FAIdebianRelease);
$smarty->assign("sections",$this->sections);
$smarty->assign("section" ,$strsec);
+ $smarty->assign("direct_packages_add", $this->direct_packages_add);
$display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
return($display);
}
diff --git a/trunk/gosa-plugins/fai/admin/fai/faiPackage.tpl b/trunk/gosa-plugins/fai/admin/fai/faiPackage.tpl
index 3ab7fdebb87c4772b33eae9ec94daee8b9edce18..3afc580c78468877fde48400e051bb3236e4cff6 100644 (file)
<td>
<h2><img class="center" alt="" src="plugins/fai/images/fai_packages.png" align="middle" title="{t}Used packages{/t}"> {t}Used packages{/t}</h2>
{$divlist}
- <br>
+ </td>
+ </tr>
{render acl=$FAIpackageACL}
- <input type="submit" name="Addpkg" value="{msgPool type=addButton}">
-{/render}
+ <tr>
+ <td>
+{if $direct_packages_add}
+ <input type="text" size="25" name="addPpkgsText" value="" />
+ <input type="submit" name="AddManualpkg" value="{msgPool type=addButton}" />
+
+ <input type="submit" name="Addpkg" value="{t}Add from list{/t}" />
+{else}
+ <input type="submit" name="Addpkg" value="{msgPool type=addButton}">
+{/if}
</td>
</tr>
+{/render}
</table>
<!-- Place cursor -->
diff --git a/trunk/gosa-plugins/fai/locale/de/LC_MESSAGES/messages.po b/trunk/gosa-plugins/fai/locale/de/LC_MESSAGES/messages.po
index b46a1fcfc04ec8a5a47156110b44d0c945731f94..3ebe8cdf826ea0258e11e03dc2169e7627c63369 100644 (file)
msgstr ""
"Project-Id-Version: messages\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-02-10 15:41+0100\n"
+"POT-Creation-Date: 2010-02-11 13:22+0100\n"
"PO-Revision-Date: 2008-12-04 11:27+0100\n"
"Last-Translator: Cajus Pollmeier <pollmeier@gonicus.de>\n"
"Language-Team: deutsch <de@li.org>\n"
#: admin/fai/tabsTemplate.inc:33 admin/fai/class_FAI.inc:548
#: admin/fai/class_faiHook.inc:239 admin/fai/class_faiProfile.inc:259
#: admin/fai/class_faiHookEntry.inc:62 admin/fai/class_faiHookEntry.inc:65
-#: admin/fai/class_faiVariable.inc:142 admin/fai/class_faiPackage.inc:272
+#: admin/fai/class_faiVariable.inc:142 admin/fai/class_faiPackage.inc:356
#: admin/fai/tabsVariable.inc:33
msgid "Error"
msgstr "Fehler"
#: admin/fai/class_faiVariable.inc:398 admin/fai/class_faiVariableEntry.inc:90
#: admin/fai/class_faiVariableEntry.inc:99
#: admin/fai/class_faiVariableEntry.inc:102
-#: admin/fai/class_faiVariableEntry.inc:137 admin/fai/class_faiPackage.inc:456
-#: admin/fai/class_faiPackage.inc:582 admin/fai/faiPartitionTable.tpl:9
+#: admin/fai/class_faiVariableEntry.inc:137 admin/fai/class_faiPackage.inc:541
+#: admin/fai/class_faiPackage.inc:667 admin/fai/faiPartitionTable.tpl:9
#: admin/fai/faiPartitionTableEntry.tpl:6 admin/fai/faiProfile.tpl:9
msgid "Name"
msgstr "Name"
#: admin/systems/services/repository/class_servRepository.inc:352
#: admin/fai/class_faiManagement.inc:788
#: admin/fai/class_faiPackageConfiguration.inc:35 admin/fai/class_FAI.inc:566
-#: admin/fai/class_faiPackage.inc:478 admin/fai/class_faiPackageEntry.inc:53
+#: admin/fai/class_faiPackage.inc:266 admin/fai/class_faiPackage.inc:563
+#: admin/fai/class_faiPackageEntry.inc:53
#: admin/fai/class_faiPackageEntry.inc:193
msgid "Service infrastructure"
msgstr "Dienst-Infrastruktur"
#: admin/systems/services/repository/servRepositorySetup.tpl:19
#: admin/systems/services/repository/class_divListRepositories.inc:23
#: admin/fai/faiPackage.tpl:37 admin/fai/branch_selector.tpl:25
-#: admin/fai/class_faiPackage.inc:588
+#: admin/fai/class_faiPackage.inc:673
msgid "Release"
msgstr "Release"
msgstr "Repository hinzufügen"
#: admin/fai/faiPackageConfiguration.tpl:1 admin/fai/class_divListFai.inc:68
-#: admin/fai/class_faiPackage.inc:574
+#: admin/fai/class_faiPackage.inc:659
msgid "Package"
msgstr "Paket"
#: admin/fai/faiHookEntry.tpl:19 admin/fai/faiHook.tpl:21
#: admin/fai/class_faiHook.inc:563 admin/fai/class_faiProfile.inc:492
#: admin/fai/class_faiHookEntry.inc:197 admin/fai/class_faiVariable.inc:399
-#: admin/fai/class_faiVariableEntry.inc:138 admin/fai/class_faiPackage.inc:583
+#: admin/fai/class_faiVariableEntry.inc:138 admin/fai/class_faiPackage.inc:668
#: admin/fai/faiPartitionTable.tpl:21 admin/fai/faiPartitionTableEntry.tpl:13
#: admin/fai/faiProfile.tpl:21
msgid "Description"
msgid "Generic"
msgstr "Allgemein"
-#: admin/fai/faiPackage.tpl:45 admin/fai/class_faiPackage.inc:585
+#: admin/fai/faiPackage.tpl:45 admin/fai/class_faiPackage.inc:670
msgid "Section"
msgstr "Section"
msgid "Used packages"
msgstr "Verwendete Pakete"
+#: admin/fai/faiPackage.tpl:82
+msgid "Add from list"
+msgstr "Aus Liste hinzufügen"
+
#: admin/fai/class_faiPartitionTableEntry.inc:176
msgid "primary"
msgstr "primär"
msgstr "FAI-Vorlage"
#: admin/fai/class_faiTemplate.inc:545 admin/fai/class_faiScript.inc:646
-#: admin/fai/class_faiPackage.inc:585 admin/fai/class_faiPackage.inc:588
+#: admin/fai/class_faiPackage.inc:670 admin/fai/class_faiPackage.inc:673
msgid "Readonly"
msgstr "Nur Lesen"
msgid ""
"The specified classname '%s' is invalid. Scripts must not start with a dash."
msgstr ""
-"Der angegebene Klassen-Name ist ungültig. Skripte dürfen nicht mit einem Bindestrich beginnn."
+"Der angegebene Klassen-Name ist ungültig. Skripte dürfen nicht mit einem "
+"Bindestrich beginnn."
#: admin/fai/class_askClassName.inc:189
#, php-format
msgid "FAI variable entry "
msgstr "FAI-Variablen-Eintrag"
-#: admin/fai/class_faiPackage.inc:329 admin/fai/class_faiPackage.inc:330
+#: admin/fai/class_faiPackage.inc:228
+msgid "Invalid package names"
+msgstr "Ungültige Paketnamen"
+
+#: admin/fai/class_faiPackage.inc:229
+#, php-format
+msgid "The following package names don't match the Debian policy: %s"
+msgstr "Die folgenden Paketnamen entsprechen nicht der Debian policy: %s"
+
+#: admin/fai/class_faiPackage.inc:413 admin/fai/class_faiPackage.inc:414
msgid "Configured"
msgstr "Konfiguriert"
-#: admin/fai/class_faiPackage.inc:336 admin/fai/class_faiPackage.inc:337
+#: admin/fai/class_faiPackage.inc:420 admin/fai/class_faiPackage.inc:421
msgid "Package marked for removal"
msgstr "Paket zum Entfernen vorgemerkt"
-#: admin/fai/class_faiPackage.inc:353
+#: admin/fai/class_faiPackage.inc:437
msgid "Mark package for removal"
msgstr "Paket zum Entfernen vormerken"
-#: admin/fai/class_faiPackage.inc:359
+#: admin/fai/class_faiPackage.inc:443
msgid "Configure this package"
msgstr "Dieses Paket konfigurieren"
-#: admin/fai/class_faiPackage.inc:363
+#: admin/fai/class_faiPackage.inc:447
msgid "Remove this package"
msgstr "Dieses Paket entfernen"
-#: admin/fai/class_faiPackage.inc:442
+#: admin/fai/class_faiPackage.inc:527
msgid "Please select a least one package!"
msgstr "Bitte wählen Sie mindestens ein Paket!"
-#: admin/fai/class_faiPackage.inc:446
+#: admin/fai/class_faiPackage.inc:531
msgid ""
"Please choose a valid release/section combination for your repository setup!"
msgstr ""
"Bitte wählen Sie eine gültige Kombination aus Release und Sektion für Ihr "
"gewünschtes Repository!"
-#: admin/fai/class_faiPackage.inc:575
+#: admin/fai/class_faiPackage.inc:660
msgid "FAI Package list"
msgstr "FAI-Paketliste"
-#: admin/fai/class_faiPackage.inc:584
+#: admin/fai/class_faiPackage.inc:669
msgid "Packages"
msgstr "Pakete"
-#: admin/fai/class_faiPackage.inc:586
+#: admin/fai/class_faiPackage.inc:671
msgid "Install Method"
msgstr "Installations-Methode"
-#: admin/fai/class_faiPackage.inc:587
+#: admin/fai/class_faiPackage.inc:672
msgid "Package configuration"
msgstr "Paket-Konfiguration"
index 4a23d8c45b62c85472940cf34995e8b123589b01..b158485e678be4872a30a6f471e37b9708c870b7 100644 (file)
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-02-10 15:41+0100\n"
+"POT-Creation-Date: 2010-02-11 13:22+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#: admin/fai/tabsTemplate.inc:33 admin/fai/class_FAI.inc:548
#: admin/fai/class_faiHook.inc:239 admin/fai/class_faiProfile.inc:259
#: admin/fai/class_faiHookEntry.inc:62 admin/fai/class_faiHookEntry.inc:65
-#: admin/fai/class_faiVariable.inc:142 admin/fai/class_faiPackage.inc:272
+#: admin/fai/class_faiVariable.inc:142 admin/fai/class_faiPackage.inc:356
#: admin/fai/tabsVariable.inc:33
msgid "Error"
msgstr ""
#: admin/fai/class_faiVariable.inc:398 admin/fai/class_faiVariableEntry.inc:90
#: admin/fai/class_faiVariableEntry.inc:99
#: admin/fai/class_faiVariableEntry.inc:102
-#: admin/fai/class_faiVariableEntry.inc:137 admin/fai/class_faiPackage.inc:456
-#: admin/fai/class_faiPackage.inc:582 admin/fai/faiPartitionTable.tpl:9
+#: admin/fai/class_faiVariableEntry.inc:137 admin/fai/class_faiPackage.inc:541
+#: admin/fai/class_faiPackage.inc:667 admin/fai/faiPartitionTable.tpl:9
#: admin/fai/faiPartitionTableEntry.tpl:6 admin/fai/faiProfile.tpl:9
msgid "Name"
msgstr ""
#: admin/systems/services/repository/class_servRepository.inc:352
#: admin/fai/class_faiManagement.inc:788
#: admin/fai/class_faiPackageConfiguration.inc:35 admin/fai/class_FAI.inc:566
-#: admin/fai/class_faiPackage.inc:478 admin/fai/class_faiPackageEntry.inc:53
+#: admin/fai/class_faiPackage.inc:266 admin/fai/class_faiPackage.inc:563
+#: admin/fai/class_faiPackageEntry.inc:53
#: admin/fai/class_faiPackageEntry.inc:193
msgid "Service infrastructure"
msgstr ""
#: admin/systems/services/repository/servRepositorySetup.tpl:19
#: admin/systems/services/repository/class_divListRepositories.inc:23
#: admin/fai/faiPackage.tpl:37 admin/fai/branch_selector.tpl:25
-#: admin/fai/class_faiPackage.inc:588
+#: admin/fai/class_faiPackage.inc:673
msgid "Release"
msgstr ""
msgstr ""
#: admin/fai/faiPackageConfiguration.tpl:1 admin/fai/class_divListFai.inc:68
-#: admin/fai/class_faiPackage.inc:574
+#: admin/fai/class_faiPackage.inc:659
msgid "Package"
msgstr ""
#: admin/fai/faiHookEntry.tpl:19 admin/fai/faiHook.tpl:21
#: admin/fai/class_faiHook.inc:563 admin/fai/class_faiProfile.inc:492
#: admin/fai/class_faiHookEntry.inc:197 admin/fai/class_faiVariable.inc:399
-#: admin/fai/class_faiVariableEntry.inc:138 admin/fai/class_faiPackage.inc:583
+#: admin/fai/class_faiVariableEntry.inc:138 admin/fai/class_faiPackage.inc:668
#: admin/fai/faiPartitionTable.tpl:21 admin/fai/faiPartitionTableEntry.tpl:13
#: admin/fai/faiProfile.tpl:21
msgid "Description"
msgid "Generic"
msgstr ""
-#: admin/fai/faiPackage.tpl:45 admin/fai/class_faiPackage.inc:585
+#: admin/fai/faiPackage.tpl:45 admin/fai/class_faiPackage.inc:670
msgid "Section"
msgstr ""
msgid "Used packages"
msgstr ""
+#: admin/fai/faiPackage.tpl:82
+msgid "Add from list"
+msgstr ""
+
#: admin/fai/class_faiPartitionTableEntry.inc:176
msgid "primary"
msgstr ""
msgstr ""
#: admin/fai/class_faiTemplate.inc:545 admin/fai/class_faiScript.inc:646
-#: admin/fai/class_faiPackage.inc:585 admin/fai/class_faiPackage.inc:588
+#: admin/fai/class_faiPackage.inc:670 admin/fai/class_faiPackage.inc:673
msgid "Readonly"
msgstr ""
msgid "FAI variable entry "
msgstr ""
-#: admin/fai/class_faiPackage.inc:329 admin/fai/class_faiPackage.inc:330
+#: admin/fai/class_faiPackage.inc:228
+msgid "Invalid package names"
+msgstr ""
+
+#: admin/fai/class_faiPackage.inc:229
+#, php-format
+msgid "The following package names don't match the Debian policy: %s"
+msgstr ""
+
+#: admin/fai/class_faiPackage.inc:413 admin/fai/class_faiPackage.inc:414
msgid "Configured"
msgstr ""
-#: admin/fai/class_faiPackage.inc:336 admin/fai/class_faiPackage.inc:337
+#: admin/fai/class_faiPackage.inc:420 admin/fai/class_faiPackage.inc:421
msgid "Package marked for removal"
msgstr ""
-#: admin/fai/class_faiPackage.inc:353
+#: admin/fai/class_faiPackage.inc:437
msgid "Mark package for removal"
msgstr ""
-#: admin/fai/class_faiPackage.inc:359
+#: admin/fai/class_faiPackage.inc:443
msgid "Configure this package"
msgstr ""
-#: admin/fai/class_faiPackage.inc:363
+#: admin/fai/class_faiPackage.inc:447
msgid "Remove this package"
msgstr ""
-#: admin/fai/class_faiPackage.inc:442
+#: admin/fai/class_faiPackage.inc:527
msgid "Please select a least one package!"
msgstr ""
-#: admin/fai/class_faiPackage.inc:446
+#: admin/fai/class_faiPackage.inc:531
msgid ""
"Please choose a valid release/section combination for your repository setup!"
msgstr ""
-#: admin/fai/class_faiPackage.inc:575
+#: admin/fai/class_faiPackage.inc:660
msgid "FAI Package list"
msgstr ""
-#: admin/fai/class_faiPackage.inc:584
+#: admin/fai/class_faiPackage.inc:669
msgid "Packages"
msgstr ""
-#: admin/fai/class_faiPackage.inc:586
+#: admin/fai/class_faiPackage.inc:671
msgid "Install Method"
msgstr ""
-#: admin/fai/class_faiPackage.inc:587
+#: admin/fai/class_faiPackage.inc:672
msgid "Package configuration"
msgstr ""