ona  18.1.1
About: OpenNetAdmin provides a database managed inventory of your IP network (with Web and CLI interface).
  Fossies Dox: ona-18.1.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

main.inc.php
Go to the documentation of this file.
1 <?php
2 
3 $title_left_html = 'Custom Attributes';
4 
5 
6 
7 // Determine if this is a host, a subnet or a vlan we are dealing with
8 if (is_numeric($record['subnet_type_id'])) {
9  $kind = 'subnet';
10 }
11 elseif (is_numeric($record['device_id'])) {
12  $kind = 'host';
13 }
14 else {
15  $kind='vlan';
16 }
17 
18 // This adds an "s" at the end of the table name. assumes all tables are plural
19 list($status, $rows, $attributes) = db_get_records($onadb, 'custom_attributes', array('table_id_ref' => $record['id'], 'table_name_ref' => $kind.'s'), '');
20 
21 
22 // create workspace menu items
23 // This is where you list an array of menu items to display for this workspace
24 $modwsmenu[0]['menutitle'] = 'Add Custom Attribute';
25 $modwsmenu[0]['tooltip'] = "Add Custom Attribute to this {$kind}";
26 $modwsmenu[0]['authname'] = 'custom_attribute_add';
27 $modwsmenu[0]['commandjs'] = "xajax_window_submit('edit_custom_attribute', xajax.getFormValues('form_{$kind}_{$record['id']}'), 'editor');";
28 $modwsmenu[0]['image'] = '/images/silk/tag_blue.png';
29 
30 // CUSTOM ATTRIBUTES LIST
31 
32 if ($rows) {
33 $modbodyhtml .= <<<EOL
34  <!-- CUSTOM ATTRIBUTES -->
35  <table width=100% cellspacing="0" border="0" cellpadding="0" style="margin-bottom: 8px; margin-top: 0px;">
36 EOL;
37 
38  foreach ($attributes as $entry) {
39  list($status, $rows, $ca_type) = ona_get_custom_attribute_record(array('id' => $entry['id']));
40 
41  $modbodyhtml .= <<<EOL
42  <tr onMouseOver="this.className='row-highlight';"
43  onMouseOut="this.className='row-normal';">
44 
45  <td align="left" nowrap="true"
46  onmouseover="wwTT(this, event,
47  'id', 'tt_cainfo_{$entry['id']}',
48  'type', 'velcro',
49  'styleClass', 'wwTT_ca_info',
50  'direction', 'south',
51  'javascript', 'xajax_window_submit(\'tooltips\', \'tooltip=>cainfo,id=>tt_cainfo_{$entry['id']},ca_id=>{$entry['id']}\');'
52  );"
53  >
54  {$ca_type['name']}&nbsp;&nbsp;
55  </td>
56  <td align="left" nowrap="true" style="border-left: 1px solid; border-left-color: #aaaaaa;padding-left: 3px;"
57  onmouseover="wwTT(this, event,
58  'id', 'tt_cainfo_{$entry['id']}',
59  'type', 'velcro',
60  'styleClass', 'wwTT_ca_info',
61  'direction', 'south',
62  'javascript', 'xajax_window_submit(\'tooltips\', \'tooltip=>cainfo,id=>tt_cainfo_{$entry['id']},ca_id=>{$entry['id']}\');'
63  );"
64  >
65  <div style="width: 110px;overflow: hidden;">{$ca_type['value']}&nbsp;</div>
66  </td>
67  <td align="right" nowrap="true">
68  <form id="form_custom_attribute_{$entry['id']}"
69  ><input type="hidden" name="id" value="{$entry['id']}"
70  ><input type="hidden" name="{$kind}_id" value="{$record['id']}"
71  ><input type="hidden" name="kind" value="{$kind}"
72  ><input type="hidden" name="type" value="{$entry['custom_attribute_type_id']}"
73  ><input type="hidden" name="js" value="{$extravars['refresh']}"
74  ></form>
75 EOL;
76  if (auth('custom_attribute_del',$debug_val)) {
77  $modbodyhtml .= <<<EOL
78  <a title="Edit Custom Attribute. ID: {$ca_type['id']}"
79  class="act"
80  onClick="xajax_window_submit('edit_custom_attribute', xajax.getFormValues('form_custom_attribute_{$entry['id']}'), 'editor');"
81  ><img src="{$images}/silk/page_edit.png" border="0"></a>
82 
83  <a title="Delete Custom Attribute. ID: {$ca_type['id']}"
84  class="act"
85  onClick="var doit=confirm('Are you sure you want to delete this custom attribute?');
86  if (doit == true)
87  xajax_window_submit('edit_custom_attribute', xajax.getFormValues('form_custom_attribute_{$entry['id']}'), 'delete');"
88  ><img src="{$images}/silk/delete.png" border="0"></a>
89 EOL;
90  }
91  $modbodyhtml .= <<<EOL
92  </td>
93  </tr>
94 
95 EOL;
96  }
97 
98 
99  if (auth('custom_attribute_add',$debug_val)) {
100  $modbodyhtml .= <<<EOL
101  <tr>
102  <td colspan="5" align="left" valign="middle" nowrap="true" class="act-box">
103 
104  <form id="form_custom_attribute_add_{$record['id']}"
105  ><input type="hidden" name="{$kind}_id" value="{$record['id']}"
106  ><input type="hidden" name="js" value="{$extravars['refresh']}"
107  ></form>
108 
109  <a title="Add Custom Attribute"
110  class="act"
111  onClick="xajax_window_submit('edit_custom_attribute', xajax.getFormValues('form_custom_attribute_add_{$record['id']}'), 'editor');"
112  ><img src="{$images}/silk/page_add.png" border="0"></a>&nbsp;
113 
114  <a title="Add Custom Attribute"
115  class="act"
116  onClick="xajax_window_submit('edit_custom_attribute', xajax.getFormValues('form_custom_attribute_add_{$record['id']}'), 'editor');"
117  >Add Custom Attribute</a>&nbsp;
118  </td>
119  </tr>
120 EOL;
121  }
122 
123 $modbodyhtml .= "</table>";
124 
125 }
126 
127 
128 // END CUSTOM ATTRIBUTES LIST
129 
130 
131 
132 ?>
$record
$record['display_name']
Definition: app_advanced_search.inc.php:12
db_get_records
db_get_records($dbh=0, $table="", $where="", $order="", $rows=-1, $offset=-1)
Definition: functions_db.inc.php:891
$status
$status
Definition: install.php:12
$onadb
global $onadb
Definition: 2-to-3.php:15
nbsp
</td >< td class="padding" align="left"></td ></tr >< tr >< td align="right" nowrap="true">< b > Netmask</b > & nbsp
Definition: main.inc.php:121
$modwsmenu
$modwsmenu[0]['menutitle']
Definition: main.inc.php:24
ona_get_custom_attribute_record
ona_get_custom_attribute_record($array)
Definition: functions_db.inc.php:1183
$modbodyhtml
$modbodyhtml
Definition: main.inc.php:5
EOL
EOL
Definition: main.inc.php:43
$kind
$kind
Definition: main.inc.php:11
auth
auth($resource, $msg_level=1)
Definition: functions_general.inc.php:1330
$title_left_html
$title_left_html
Definition: main.inc.php:3