@@ -67,6 +67,20 @@ static function getTypeName($nb=0) {
67
67
}
68
68
69
69
70
+ /**
71
+ * @see CommonGLPI::getTabNameForItem()
72
+ **/
73
+ function getTabNameForItem (CommonGLPI $ item , $ withtemplate =0 ) {
74
+ if (static ::canView ()) {
75
+ switch ($ item ->getType ()) {
76
+ case __CLASS__ :
77
+ $ ong = array (1 => __ ('Operating System ' ));
78
+ return $ ong ;
79
+ }
80
+ }
81
+ }
82
+
83
+
70
84
/**
71
85
* @see CommonDBTM::useDeletedToLockIfDynamic()
72
86
*
@@ -94,6 +108,7 @@ function defineTabs($options=array()) {
94
108
95
109
$ ong = array ();
96
110
$ this ->addDefaultFormTab ($ ong )
111
+ ->addStandardTab (__CLASS__ , $ ong , $ options )
97
112
->addStandardTab ('Item_Devices ' , $ ong , $ options )
98
113
->addStandardTab ('ComputerDisk ' , $ ong , $ options )
99
114
->addStandardTab ('Computer_SoftwareVersion ' , $ ong , $ options )
@@ -117,6 +132,88 @@ function defineTabs($options=array()) {
117
132
}
118
133
119
134
135
+ /**
136
+ * @param $item CommonGLPI object
137
+ * @param $tabnum (default 1)
138
+ * @param $withtemplate (default 0)
139
+ **/
140
+ static function displayTabContentForItem (CommonGLPI $ item , $ tabnum =1 , $ withtemplate =0 ) {
141
+
142
+ self ::showOperatingSystem ($ item );
143
+ return true ;
144
+ }
145
+
146
+ /**
147
+ * Print the computer's operating system form
148
+ *
149
+ * @param $comp Computer object
150
+ *
151
+ * @return Nothing (call to classes members)
152
+ **/
153
+ static function showOperatingSystem (Computer $ comp ) {
154
+ global $ DB ;
155
+
156
+ $ ID = $ comp ->fields ['id ' ];
157
+ $ colspan = 4 ;
158
+
159
+ echo "<div class='center'> " ;
160
+
161
+ $ comp ->initForm ($ ID );
162
+ $ comp ->showFormHeader ();
163
+
164
+ echo "<table class='tab_cadre_fixe'> " ;
165
+
166
+ echo "<tr class='headerRow'><th colspan=' " .$ colspan ."'> " ;
167
+ echo __ ('Operating system ' );
168
+ echo "</th></tr> " ;
169
+
170
+ echo "<tr class='tab_bg_1'> " ;
171
+ echo "<td> " .__ ('Name ' )."</td> " ;
172
+ echo "<td> " ;
173
+ OperatingSystem::dropdown (array ('value ' => $ comp ->fields ["operatingsystems_id " ]));
174
+ echo "</td> " ;
175
+
176
+ echo "<td> " .__ ('Version ' )."</td> " ;
177
+ echo "<td > " ;
178
+ OperatingSystemVersion::dropdown (array ('value ' => $ comp ->fields ["operatingsystemversions_id " ]));
179
+ echo "</td> " ;
180
+ echo "</tr> " ;
181
+
182
+ echo "<tr class='tab_bg_1'> " ;
183
+ echo "<td> " .__ ('Architecture ' )."</td> " ;
184
+ echo "<td > " ;
185
+ OperatingSystemArchitecture::dropdown (array ('value '
186
+ => $ comp ->fields ["operatingsystemarchitectures_id " ]));
187
+ echo "</td> " ;
188
+
189
+ echo "<td> " .__ ('Service pack ' )."</td> " ;
190
+ echo "<td > " ;
191
+ OperatingSystemServicePack::dropdown (array ('value '
192
+ => $ comp ->fields ["operatingsystemservicepacks_id " ]));
193
+ echo "</td></tr> " ;
194
+
195
+ echo "<tr class='tab_bg_1'> " ;
196
+ echo "<td> " .__ ('Kernel version ' )."</td> " ;
197
+ echo "<td > " ;
198
+ Html::autocompletionTextField ($ comp , 'os_kernel_version ' );
199
+ echo "</td> " ;
200
+
201
+ echo "<td> " .__ ('Product ID ' )."</td> " ;
202
+ echo "<td > " ;
203
+ Html::autocompletionTextField ($ comp , 'os_licenseid ' );
204
+ echo "</td></tr> " ;
205
+
206
+ echo "<tr class='tab_bg_1'> " ;
207
+ echo "<td> " .__ ('Serial number ' )."</td> " ;
208
+ echo "<td > " ;
209
+ Html::autocompletionTextField ($ comp , 'os_license_number ' );
210
+ echo "</td></tr> " ;
211
+
212
+ $ comp ->showFormButtons ();
213
+
214
+ echo "</table> " ;
215
+ echo "</div> " ;
216
+ }
120
217
function post_restoreItem () {
121
218
122
219
$ comp_softvers = new Computer_SoftwareVersion ();
@@ -528,14 +625,13 @@ function showForm($ID, $options=array()) {
528
625
echo "</td> " ;
529
626
530
627
// Display auto inventory informations
531
- $ rowspan = 7 ;
628
+ $ rowspan = 4 ;
532
629
$ inventory_show = false ;
533
630
534
631
if (!empty ($ ID )
535
632
&& Plugin::haveImport ()
536
633
&& $ this ->fields ["is_dynamic " ]) {
537
634
$ inventory_show = true ;
538
- $ rowspan -= 5 ;
539
635
}
540
636
541
637
echo "<td rowspan=' $ rowspan'> " .__ ('Comments ' )."</td> " ;
@@ -552,89 +648,6 @@ function showForm($ID, $options=array()) {
552
648
'entity ' => $ this ->fields ["entities_id " ]));
553
649
echo "</td></tr> " ;
554
650
555
- echo "<tr class='tab_bg_1'> " ;
556
- echo "<td> " .__ ('Operating system ' )."</td> " ;
557
- echo "<td> " ;
558
- OperatingSystem::dropdown (array ('value ' => $ this ->fields ["operatingsystems_id " ]));
559
- echo "<br /><a href='#' id='toggle_os_information'> " .__ ("More information " )."</a> " ;
560
- echo "</td> " ;
561
- if ($ inventory_show ) {
562
- echo "<td rowspan='5' colspan='2'> " ;
563
- Plugin::doHook ("autoinventory_information " , $ this );
564
- echo "</td> " ;
565
- }
566
- echo "</tr> " ;
567
-
568
- echo "<tr class='tab_bg_1'> " ;
569
- echo "<td> " .__ ('Version of the operating system ' )."</td> " ;
570
- echo "<td > " ;
571
- OperatingSystemVersion::dropdown (array ('value ' => $ this ->fields ["operatingsystemversions_id " ]));
572
- echo "</td> " ;
573
- echo "</tr> " ;
574
-
575
- echo "<tr class='tab_bg_1'><td colspan='2'> " ;
576
- echo Html::scriptBlock ("
577
- $(document).ready(function(){
578
- $('#os_information').hide();
579
-
580
- $('#toggle_os_information').on('click',function() {
581
- $('#os_information').dialog({
582
- width:'auto',
583
- resizable: false,
584
- appendTo: '#os_information_parent',
585
- position: {
586
- my : 'left top',
587
- at : 'left bottom',
588
- of: $('#toggle_os_information')
589
- }
590
- })
591
- })
592
- }); " );
593
-
594
- // group os advanced information in a single bloc (who can be toggled)
595
- echo "<div id='os_information_parent'> " ;
596
- echo "<div id='os_information' title= \"" .__ ('Operating system ' )."\"> " ;
597
- echo "<table> " ;
598
- echo "<tr class='tab_bg_1'> " ;
599
-
600
- echo "<td> " .__ ('Service pack ' )."</td> " ;
601
- echo "<td > " ;
602
- OperatingSystemServicePack::dropdown (array ('value '
603
- => $ this ->fields ["operatingsystemservicepacks_id " ]));
604
- echo "</td></tr> " ;
605
-
606
- echo "<tr class='tab_bg_1'> " ;
607
- echo "<td> " .__ ('Operating system architecture ' )."</td> " ;
608
- echo "<td > " ;
609
- OperatingSystemArchitecture::dropdown (array ('value '
610
- => $ this ->fields ["operatingsystemarchitectures_id " ]));
611
- echo "</td></tr> " ;
612
-
613
- echo "<tr class='tab_bg_1'> " ;
614
- echo "<td> " .__ ('Kernel version of the operating system ' )."</td> " ;
615
- echo "<td > " ;
616
- Html::autocompletionTextField ($ this , 'os_kernel_version ' );
617
- echo "</td></tr> " ;
618
-
619
- echo "<tr class='tab_bg_1'> " ;
620
- echo "<td> " .__ ('Product ID of the operating system ' )."</td> " ;
621
- echo "<td > " ;
622
- Html::autocompletionTextField ($ this , 'os_licenseid ' );
623
- echo "</td></tr> " ;
624
-
625
- echo "<tr class='tab_bg_1'> " ;
626
- echo "<td> " .__ ('Serial of the operating system ' )."</td> " ;
627
- echo "<td > " ;
628
- Html::autocompletionTextField ($ this , 'os_license_number ' );
629
- echo "</td> " ;
630
-
631
-
632
- echo "</table> " ;
633
- echo "</div> " ;
634
- echo "</div> " ;
635
- echo "</td> " ;
636
- echo "</tr> " ;
637
-
638
651
echo "<tr class='tab_bg_1'> " ;
639
652
echo "<td> " .__ ('UUID ' )."</td> " ;
640
653
echo "<td > " ;
@@ -648,6 +661,18 @@ function showForm($ID, $options=array()) {
648
661
AutoUpdateSystem::dropdown (array ('value ' => $ this ->fields ["autoupdatesystems_id " ]));
649
662
echo "</td></tr> " ;
650
663
664
+
665
+ if (Plugin::haveImport () && $ inventory_show ) {
666
+ //echo "<td>".__('Automatic inventory')."</td>";
667
+ echo '<tr><td colspan="4"> ' ;
668
+ if ($ ID && $ this ->fields ['is_dynamic ' ]) {
669
+ Plugin::doHook ("autoinventory_information " , $ this );
670
+ } else {
671
+ _e ('No ' );
672
+ }
673
+ echo "</td></tr> " ;
674
+ }
675
+
651
676
$ this ->showFormButtons ($ options );
652
677
653
678
return true ;
0 commit comments