This repository has been archived by the owner on May 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Spiros Ioannou
committed
Mar 18, 2012
1 parent
f0e3243
commit ed2a607
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ITDB is a web based asset inventory management tool used to store information | ||
about assets found in office environments, with a focus -but not lmited to- | ||
IT assets. It is not or targets for ITIL/CMDB compliance (yet), but it has | ||
served me for years and hopefully it will do the same for you :-) | ||
|
||
ITDB comes with sources and is distributed under the GNU Public license. | ||
|
||
*Homepage* | ||
http://www.sivann.gr/software/itdb/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
if (!isset($initok)) {echo "do not run this script directly";exit;} | ||
|
||
/* Spiros Ioannou 2009 , sivann _at_ gmail.com */ | ||
|
||
//echo "<pre>"; print_r($_GET); print_r($_POST); | ||
|
||
$internaltypes="10"; | ||
|
||
$formvars=array("id", "typedesc"); | ||
|
||
//form submitted | ||
if (isset($_GET['deltype']) && $_GET['deltype']<=$internaltypes) { //delete an entry | ||
echo "Type '{$_GET['deltype']}' cannot be deleted: internal type"; | ||
} | ||
elseif (isset($_GET['deltype'])) { //delete an item entry | ||
$deltype=$_GET['deltype']; | ||
$sql="SELECT count(id) count from files WHERE type=$deltype"; | ||
$sth=db_execute($dbh,$sql); | ||
$r=$sth->fetch(PDO::FETCH_ASSOC); | ||
$count=$r['count']; | ||
|
||
if ($count>0) { | ||
echo t("<b>Warning! There are $count file(s) of this file type registered. Type not deleted!</b>"); | ||
} | ||
else { | ||
$sql="DELETE from filetypes where id=".$_GET['deltype']; | ||
$sth=db_exec($dbh,$sql); | ||
echo "<script>document.location='$scriptname?action={$_GET['action']}'</script>"; | ||
echo "<a href='$scriptname?action={$_GET['action']}'>Go here</a></body></html>"; | ||
} | ||
|
||
} | ||
|
||
|
||
//if came here from a form post, update db with new values | ||
if (isset($_POST['typedesc'])) { | ||
$nrows=count($_POST['id']); //number of rows | ||
|
||
for ($rn=0;$rn<$nrows;$rn++) { | ||
$id=$_POST['id'][$rn]; | ||
if (($id == "new") && (strlen($_POST['typedesc'][$rn])>1) ) {//new item -- insert | ||
$sql="INSERT into filetypes ". | ||
"(typedesc) ". | ||
" values (". | ||
"'".($_POST['typedesc'][$rn])."')"; | ||
} | ||
elseif ($id!="new" && strlen($_POST['typedesc'][$rn])){ //existing item -- update | ||
$sql="UPDATE filetypes set ". | ||
" typedesc='".($_POST['typedesc'][$rn])."' ". | ||
" WHERE id=$id"; | ||
} | ||
else {continue;} | ||
|
||
db_exec($dbh,$sql); | ||
}//for | ||
|
||
|
||
} //if | ||
|
||
|
||
|
||
|
||
//if (!isset ($_GET['itemid']) || !strlen($_GET['itemid'])) {echo "$scriptname: wrong arguments";exit;} | ||
|
||
$sql="SELECT * from filetypes order by id"; | ||
|
||
/// make db query | ||
$sth=db_execute($dbh,$sql); | ||
|
||
?> | ||
<form method=post name='actionaddfrm'> | ||
<h1><?php te("Edit File Types");?></h1> | ||
<table class=brdr> | ||
<tr><th> </th><th><?php te("Description");?></th></tr> | ||
|
||
<?php | ||
$i=0; | ||
while ($r=$sth->fetch(PDO::FETCH_ASSOC)) { | ||
$i++; | ||
$dbid=$r['id']; | ||
$dbtypedesc=$r['typedesc']; | ||
|
||
if ($dbid>$internaltypes) | ||
echo "\n<tr><td title='Delete [ID: ".$dbid."]'><a href='javascript:delconfirm(\"[ID: {$dbid}] $dbtypedesc\",\"$scriptname?action=$action&deltype=$dbid\");'>". | ||
"<img src='images/delete.png' border=0></a></td>"; | ||
else | ||
echo "\n\n<tr><td title='internal type ($dbid), cannot be deleted or changed.'></td>"; | ||
echo "<td nowrap><input type=hidden name='id[]' value='".$r['id']."' readonly size=3>\n"; | ||
if ($dbid<=$internaltypes) echo "<input size=15 maxlen=20 type=text name='typedesc[]' readonly value=\"".$r['typedesc']."\"></td>\n"; | ||
if ($dbid>$internaltypes) echo "<input size=15 maxlen=20 type=text name='typedesc[]' value=\"".$r['typedesc']."\"></td>\n"; | ||
echo "</tr>\n\n"; | ||
} | ||
|
||
//empty line to add new items at bottom | ||
echo "<tr><td><input type=hidden name='id[]' value='new' readonly size=3>New:</td>\n"; | ||
echo "<td><input size=15 maxlen=20 type=text name='typedesc[]' ></td>\n"; | ||
|
||
?> | ||
<tr><td colspan=2><button type="submit"><img src="images/save.png" alt="Save" > <?php te("Save");?></button></td></tr> | ||
|
||
</table> | ||
</form> | ||
</body> | ||
</html> |