diff options
author | Preston Cody <codeman@gentoo.org> | 2008-02-17 19:36:19 +0000 |
---|---|---|
committer | Preston Cody <codeman@gentoo.org> | 2008-02-17 19:36:19 +0000 |
commit | e3a4734a4e5a7ed268841d18d994385f9e8f556b (patch) | |
tree | 883b500b5bdd937762e52aa2292526f2044fb74f /scire | |
parent | adding in the minimal phpgacl code. this is all that is necessary (diff) | |
download | scire-e3a4734a4e5a7ed268841d18d994385f9e8f556b.tar.gz scire-e3a4734a4e5a7ed268841d18d994385f9e8f556b.tar.bz2 scire-e3a4734a4e5a7ed268841d18d994385f9e8f556b.zip |
adding some module support code as well as a prototype page
for quickstart.
reworking the job page to do what was previously in add_job.php
we can now safely get rid of add_job i think.
svn path=/trunk/; revision=356
Diffstat (limited to 'scire')
-rw-r--r-- | scire/.lib/functions.php | 64 | ||||
-rw-r--r-- | scire/.lib/module_common.php | 4 | ||||
-rw-r--r-- | scire/.smarty/templates/header.tpl | 2 | ||||
-rw-r--r-- | scire/.smarty/templates/job.tpl | 269 | ||||
-rw-r--r-- | scire/.smarty/templates/modules/Exporter/index.tpl | 36 | ||||
-rw-r--r-- | scire/.smarty/templates/modules/quickstart/index.tpl | 86 | ||||
-rw-r--r-- | scire/.smarty/templates/script_library.tpl | 2 | ||||
-rw-r--r-- | scire/job.php | 118 | ||||
-rw-r--r-- | scire/quickstart/index.php | 37 | ||||
-rw-r--r-- | scire/quickstart/sample_data.csv | 5 |
10 files changed, 471 insertions, 152 deletions
diff --git a/scire/.lib/functions.php b/scire/.lib/functions.php index 1215d54..7a1996f 100644 --- a/scire/.lib/functions.php +++ b/scire/.lib/functions.php @@ -78,6 +78,70 @@ function get_priorities() { return array('1','2','3','4','5','6','7','8','9'); } +function get_cron_times() { + # Minutes array + $minutes = array( +# "*" => "Every minute", +# "*/2" => "Every other minute", + "*/5" => "Every five minutes", + "*/10" => "Every ten minutes", + "*/15" => "Every fifteen minutes", + ); + foreach (range(0,59) as $val) { + $minutes[(string)$val] = $val; + } + $minutes["other"] = "other"; + # Hours array + $hours = array( + "*" => "Every hour", + "*/2" => "Every other hour"); + foreach (range(0,11) as $val) { + $hours[(string)$val] = (string)$val . " A.M."; + } + $hours["12"] = "12 Noon"; + foreach (range(13,23) as $val) { + $hours[(string)$val] = (string)($val-12) . " P.M."; + } + $hours["other"] = "other"; + + # Days + $days = array( + "*" => "Every day", + "*/2" => "Every other day"); + foreach (range(1,31) as $val) { + $days[(string)$val] = (string)($val); + } + $days["other"] = "other"; + + # Weekdays + $weekdays = array( + "*" => "Every weekday", + "0" => "Sunday", + "1" => "Monday", + "2" => "Tuesday", + "3" => "Wednesday", + "4" => "Thursday", + "5" => "Friday", + "6" => "Saturday"); + $weekdays["other"] = "other"; + + # Months + $months = array("*" => "Every month", + "1" => "January", + "2" => "February", + "3" => "March", + "4" => "April", + "5" => "May", + "6" => "June", + "7" => "July", + "8" => "August", + "9" => "October", + "10" => "September", + "11" => "November", + "12" => "December"); + $months["other"] = "other"; + return array($minutes,$hours,$days,$weekdays,$months); +} ?> diff --git a/scire/.lib/module_common.php b/scire/.lib/module_common.php new file mode 100644 index 0000000..1c51549 --- /dev/null +++ b/scire/.lib/module_common.php @@ -0,0 +1,4 @@ +<?php +$path = "../"; +require_once('common.php'); +?> diff --git a/scire/.smarty/templates/header.tpl b/scire/.smarty/templates/header.tpl index 51f5387..d0d40b5 100644 --- a/scire/.smarty/templates/header.tpl +++ b/scire/.smarty/templates/header.tpl @@ -12,7 +12,7 @@ <title>Scire{if ($title ne "")} - {$title}{if ($subtitle ne "")} - {$subtitle}{/if}{/if}</title> <link rel="icon" href="{$baseurl}favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="{$baseurl}favicon.ico" type="image/x-icon" /> - <link rel="stylesheet" href="{$theme}.css" type="text/css" /> + <link rel="stylesheet" href="{$baseurl}{$theme}.css" type="text/css" /> {if isset($head)}{$head}{/if} </head> diff --git a/scire/.smarty/templates/job.tpl b/scire/.smarty/templates/job.tpl index 124e03c..8919f02 100644 --- a/scire/.smarty/templates/job.tpl +++ b/scire/.smarty/templates/job.tpl @@ -1,115 +1,210 @@ {include file="header.tpl" title="Jobs"} -<form action="" method="post" name="edit_jobform"> -{if $Action eq "addgroup"} - <table width="100%" border="0" cellspacing="0" cellpadding="5"> - <tr><td class="boxtitle">Add client to group</td></tr> - <tr> - <td colspan="2" align="center" valign="top"> - <table class="box" width="100%" border="1" cellspacing="0" cellpadding="0"> - <tr> - <td class="boxtitle" width="15">Add</td><td class="boxtitle">Group Name</td> - </tr> - {foreach from=$groups name=ugroup item=item key=id} - <tr> - <td><input type="checkbox" name="addgroupid[]" value="{$id}" - {if isset($ingroups)} {if in_array($id, $ingroups)} checked {/if} {/if} - ></td> - <td>{$item}</td> - </tr> - {/foreach} - <tr><td> - <input type="hidden" name="clientid" value="{$clientid}"> - <input type="submit" name="addgroup_confirm" value="Save Changes"> - </td></tr> - </table> - </td> - </tr> - </table> -{elseif $Action eq "create"} +{if $Action eq "create"} +<h1>Add a Job</h1> +<form action="" method="post" name="add_jobform"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> - <td colspan="2" align="center" valign="top"> - <table class="box" width="100%" border="1" cellspacing="0" cellpadding="0"> + <td align="left" valign="top"> + <table class="box" width="90%" border="1" cellspacing="0" cellpadding="0"> <tr> - <td class="boxtitle">Client</td><td class="boxtitle">Groups</td> + <td class="boxtitle">Script Selection</td> </tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="5"> <tr> - <td><label for="addhostname">*Hostname:</label></td> - <td><input type="text" id="addhostname" name="addhostname" /></td> - <td><label for="ip">*IP Address:</label></td> - <td><input type="text" id="ip" name="ip" /></td> - - </tr> - <tr> - <td><label for="assetid">Asset ID:</label></td> - <td><input type="text" id="assetid" name="assetid" /></td> - <td><label for="mac">*MAC:</label></td> - <td><input type="text" id="mac" name="mac" /></td> - + <td><label for="scripts">Scripts:</label></td> </tr> <tr> - <td><label for="digest">Digest (DO NOT EDIT):</label></td> - <td colspan="3"><input type="text" id="digest" name="digest" size="58"></td> - </tr> - <tr> - <td><label for="gli_profile">GLI Profile:</label></td> - <td><select name="gli_profile" size="1"> - {section name=p loop=$gli_profiles} - <option value="{$gli_profiles[p].profileid}">{$gli_profiles[p].profile_name}</option> - {/section} - </select> - </td> - <td><label for="status">Status:</label></td> - <td><select id="status" name="status" size="1"> - <option value="active" selected="selected">Active</option> - <option value="disabled">Disabled</option> - </select> - </td> + {if isset($get.scriptid)} + + <td>Selected script:</td> + <td><input type="hidden" name="script" value="{$script.scriptid}">{$script.name}</td> + {else} + <td>Categories will go here</td> + <td> + <select name="script" size="1" > + {foreach from=$scripts item=script key=key} + <option value="{$script.scriptid}"> + {$script.name}</option> + {/foreach} + </select> + </td> + {/if} </tr> + {if !isset($get.scriptid)} <tr> - <td><label for="osid">OS:</label></td> - <td><select name="osid" size="1"> - {section name=o loop=$oss} - <option value="{$oss[o].osid}">{$oss[o].osname}</option> - {/section} - </select> - </td> - <td><label for="contact">Contact:</label></td> - <td><select name="contact" size="1"> - {section name=con loop=$users} - <option value="{$users[con].userid}">{$users[con].username}</option> - {/section} - </select></td> + <td colspan="2">Or just type in the ID of the script: <input type="text" name="scriptID" ></td> </tr> + {/if} <tr> - <td><label for="installtime">Install Time <br>(leave blank for NOW):</label></td> - <td colspan="3"><input type="text" id="installtime" name="installtime" size="25"/></td> + <td colspan="2"><hr><h4>Override Script default values:</h4><br> + Permission: <select size="1" name="permission"> + {foreach from=$perms item=perm key=id} + <option value="{$perm}" + {if isset($script.permission)} + {if $perm eq $script.permission} selected {/if} + {/if} + >{$perm}</option> + {/foreach} + </select><br> + + Set Priority: <select size="1" name="priority"> + {foreach from=$priorities item=priority key=id} + <option value="{$priority}" + {if isset($script.priority)} + {if $priority eq $script.priority} selected {/if} + {/if} + >{$priority}</option> + {/foreach} + </select><br> + Log Location: <input type="text" name="log_location" value="{$script.log_location}"><br> + Success Code: (not worrying bout this now)<br> + Set dynamic content: <br> + </td> </tr> </table> - <p><input type="submit" name="AddClientSubmit" value="Add Client" /></p> </td> + </tr> + </table> + </td> + + <td align="right" valign="top"> + <table class="box" width="50%" border="1" cellspacing="0" cellpadding="0"> + <tr> + <td class="boxtitle">Client Selection</td> + </tr> + <tr> <td> - <table> - <tr><td>Assign client to the following groups:</td></tr> - <tr><td> - <select name="groups[]" size="10" multiple="multiple" id="groups"> - {foreach from=$groups item=ugroup key=id} - <option value="{$id}">{$ugroup}</option> - {/foreach} - </select> - </td> - </tr></table> + <table border="0" cellspacing="0" cellpadding="5"> + <tr> + {if isset($get.clientid)} + + <td>Selected client:</td> + <td><input type="hidden" name="clients[]" value="{$client.hostname}">{$client.hostname}</td> + {elseif isset($get.cgroupid)} + <td>Selected clientgroup:</td> + <td><input type="hidden" name="cgroups[]" value="{$get.cgroupid}">NAME HERE</td> + {else} + <td><label for="clientgroups">Clientgroups:</label></td> + <td><label for="clients">Clients:</label></td> + </tr> + <tr> + <td> + <select name="clientgroups[]" size="18" multiple="multiple"> + {foreach from=$cgroups item=cgroup key=id} + <option value="{$id}">{$cgroup}</option> + {/foreach} + </select> + </td> + <td> + <select name="clients[]" size="18" multiple="multiple"> + {section loop=$clients name=clients} + <option value="{$clients[clients].clientid}">{$clients[clients].hostname}</option> + {/section} + </select> + </td> + {/if} + </tr> + </table> </td> </tr> </table> + Input staging client hostname (optional): <input type="text" name="staging"><br> + Staging success: <input type="radio" name="staging_success" value="result">Positive Result Code <input type="radio" name="staging_success" value="user">Manually approved </td> </tr> + </table> + <hr> + <table> + {if $dyn_tags} + <tr> + <th>Dynamic Tag</th><th>Value</th> + </tr> + {foreach from=$dyn_tags item=tag key=tagnum} + <tr> + <td>Tag: <b>{$tag}</b></td><td><input type="text" name="tag_{$tag}" value="{$tag_values[$tag]}" /></td> + </tr> + {/foreach} + {/if} +</table> +<hr> +Job Description: <br><textarea name="description" rows="3" cols="40"></textarea><br> +<table><tr> + <td><label for="runs_chedule">Run schedule:</label></td> + <td><input type="text" id="run_schedule" name="run_schedule" size="25" value="{$job.run_schedule}" /></td> + <td><label for="validity_period">Validity Period:<br>(in minutes)</label></td> + <td><input type="text" id="validity_period" name="validity_period" size="25" value="{$job.validity_period}" /></td> +</tr></table> + <fieldset> + <legend>Run Schedule</legend> + <table> + <tr> + <td> + <p>Minute(s):</p> + {html_options name=minutes options=$minutes selected=$selectedMinute size=6} + </td> + <td> </td> + <td> + <p>Hour(s):</p> + {html_options name=hours options=$hours selected=$selectedHour size=6} + </td> + <td> </td> + <td> + <p>Month(s):</p> + {html_options name=months options=$months selected=$selectedMonth size=6} + </td> + </tr> + + <tr> + <td> + <p>Day(s):</p> + {html_options name=days options=$days selected=$selectedDay size=6} + </td> + <td></td> + <td></td> + <td></td> + <td> + <p>Weekday(s):</p> + {html_options name=weekdays options=$weekdays selected=$selectedWeekday size=6} + </td> + </tr> + </table> + + </fieldset> +<table> +<tr><td> +<script language="JavaScript" src="calendar/calendar3.js"></script><!-- Date only with year scrolling --> +<label for="deploy_time">Start time: <input type="Text" name="deploy_time" value=""> + <a href="javascript:cal1.popup();"><img src="calendar/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></label> +</td> +<td> +<label for="expiration_time">End time: <input type="Text" name="expiration_time" value=""> + <a href="javascript:cal2.popup();"><img src="calendar/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></label> +<script language="JavaScript"> + <!-- // create calendar object(s) just after form tag closed + // specify form element as the only parameter (document.forms['formname'].elements['inputname']); + // note: you can have as many calendar objects as you need for your application + var cal1 = new calendar3(document.forms['add_jobform'].elements['deploy_time']); + cal1.year_scroll = false; + cal1.time_comp = true; + var cal2 = new calendar3(document.forms['add_jobform'].elements['expiration_time']); + cal2.year_scroll = false; + cal2.time_comp = true; + //--> + </script> +</td> +</tr> +</table> +<hr> +Job dependency stuff here.<B>CODE ME</B><br> +<!-- Set notification email address: <input type="radio" name="notify_addr" value="{$useremail}">{$useremail}</input><input type="radio" name="notify_addr" value="new"><input type="text" name="notify_new"></input> --> +<input type="submit" name="ADD" value="ADD JOB!!!"> +</form> {elseif $Action eq "edit"} -<h1>EDITING</h1> - <table width="100%" border="0" cellspacing="0" cellpadding="5"> +<h1>Edit Job</h1> +<form action="" method="post" name="edit_jobform"> +<table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td colspan="2" align="center" valign="top"> <table class="box" width="100%" border="1" cellspacing="0" cellpadding="0"> diff --git a/scire/.smarty/templates/modules/Exporter/index.tpl b/scire/.smarty/templates/modules/Exporter/index.tpl new file mode 100644 index 0000000..93cb8e5 --- /dev/null +++ b/scire/.smarty/templates/modules/Exporter/index.tpl @@ -0,0 +1,36 @@ +{include file="header.tpl" title="Server Information Exporter"} +List of clients in group: +<form name="form1" method="post" action="#"> +<select name="group" size="1"> +<option value=""></option> +<!-- +foreach ($profile_list as $profile) + print "<option value=\"". $profile['profileid']."\">".$profile['profile_name']."</option>\n"; +?> --> +</select> +<input type="submit" name="ChangeView" value="Go, because i hate doing it with javascript."> +</form> +<form name="form2" method="post" action="ExportedData.php"> +<table><tr> + <th>HOSTNAME</th> + <th>STATUS</th> + <th>IP</th> + <th>MAC</th> + <th>ASSET ID</th> + <th>INSTALL TIME</th> + </tr> +<!-- +foreach ($clients as $client) + print "<tr><td>".$client['hostname']."</td>\n"; + print "<td>".$client['status']."</td>\n"; + print "<td>".$client['ip']."</td>\n"; + print "<td>".$client['mac']."</td>\n"; + print "<td>".$client['assetid']."</td>\n"; + print "<td>".$client['installtime']."</td>\n"; +?> --> +</table> +<hr> +<input type="submit" name="ExportToXML" value="Export To XML"> +<input type="submit" name="ExportToCSV" value="Export To CSV"> +<input type="submit" name="ExportToTXT" value="Export To TXT"> +{include file="footer.tpl"} diff --git a/scire/.smarty/templates/modules/quickstart/index.tpl b/scire/.smarty/templates/modules/quickstart/index.tpl new file mode 100644 index 0000000..8440724 --- /dev/null +++ b/scire/.smarty/templates/modules/quickstart/index.tpl @@ -0,0 +1,86 @@ +{include file="header.tpl" title="Quickstart Server"} +<h3>Quickstart Server Status Overview</h3> +<form name="form1" method="post" action="#"> +List of clients currently installing:<br> +<table class="table" border="2"> + <tr> + <th>MAC</th> + <th>IP</th> + <th>PROFILE</th> + <th>STATUS</th> + </tr> +{foreach from=$clients item=client key=key} + {if $client.status eq 'Installing'} + <tr> + <td>{$client.mac}</td> + <td>{$client.ip}</td> + <td>{$client.profile}</td> + <td>{$client.status}</td> + </tr> + + {/if} +{/foreach} +</table> +List of clients pending installation:<br> +<table class="table"> + <tr> + <th>MAC</th> + <th>IP</th> + <th>PROFILE</th> + <th>STATUS</th> + </tr> +{foreach from=$clients item=client key=key} + {if $client.status eq 'Scheduled for Install'} + <tr> + <td>{$client.mac}</td> + <td>{$client.ip}</td> + <td>{$client.profile}</td> + <td>{$client.status}</td> + </tr> + + {/if} +{/foreach} +</table> +List of completed installations:<br> +<table class="table"> + <tr> + <th>MAC</th> + <th>IP</th> + <th>PROFILE</th> + <th>STATUS</th> + </tr> +{foreach from=$clients item=client key=key} + {if $client.status eq 'Install Complete'} + <tr> + <td>{$client.mac}</td> + <td>{$client.ip}</td> + <td>{$client.profile}</td> + <td>{$client.status}</td> + </tr> + + {/if} +{/foreach} +</table> +List of available profiles:<br> +<table class="table"> + <tr> + <th>Profile ID</th> + <th>Profile Name</th> + <th>Filename/URI</th> + <th>Description</th> + </tr> +{foreach from=$profiles item=profile key=key} + <tr> + <td>{$profile.profileid}</td> + <td>{$profile.profile_name}</td> + <td>{$profile.location}</td> + <td>{$profile.description}</td> + </tr> + +{/foreach} +</table> + + +<input type="submit" name="Submit" value="Submit"> +</form> +{include file="footer.tpl"} diff --git a/scire/.smarty/templates/script_library.tpl b/scire/.smarty/templates/script_library.tpl index 670f00c..be796f5 100644 --- a/scire/.smarty/templates/script_library.tpl +++ b/scire/.smarty/templates/script_library.tpl @@ -13,7 +13,7 @@ <td>LAST USED HERE</td> <td>ADD OS TO SCRIPT TABLE</td> <td>{$script.permission}</td> - <td><a href="add_job.php?scriptid={$script.scriptid}">Create Job</a>|<a href="script.php?Action=Edit&scriptid={$script.scriptid}">Edit</a>|<a href="script.php?Action=Delete&scriptid={$script.scriptid}">Delete</a><a href="script.php?Action=Copy&scriptid={$script.scriptid}">Copy as New</a></td> + <td><a href="job.php?Action=create&scriptid={$script.scriptid}">Create Job</a>|<a href="script.php?Action=Edit&scriptid={$script.scriptid}">Edit</a>|<a href="script.php?Action=Delete&scriptid={$script.scriptid}">Delete</a><a href="script.php?Action=Copy&scriptid={$script.scriptid}">Copy as New</a></td> </tr> {/foreach} <tr class="table"> diff --git a/scire/job.php b/scire/job.php index 81a10a1..8adc957 100644 --- a/scire/job.php +++ b/scire/job.php @@ -10,68 +10,7 @@ add_leftbar($leftbar_menu, "««Cancel", "jobs.php"); $jobid = ""; -# Minutes array -$minutes = array( -# "*" => "Every minute", -# "*/2" => "Every other minute", - "*/5" => "Every five minutes", - "*/10" => "Every ten minutes", - "*/15" => "Every fifteen minutes", - ); -foreach (range(0,59) as $val) { - $minutes[(string)$val] = $val; -} -$minutes["other"] = "other"; - -# Hours array -$hours = array( - "*" => "Every hour", - "*/2" => "Every other hour"); -foreach (range(0,11) as $val) { - $hours[(string)$val] = (string)$val . " A.M."; -} -$hours["12"] = "12 Noon"; -foreach (range(13,23) as $val) { - $hours[(string)$val] = (string)($val-12) . " P.M."; -} -$hours["other"] = "other"; - -# Days -$days = array( - "*" => "Every day", - "*/2" => "Every other day"); -foreach (range(1,31) as $val) { - $days[(string)$val] = (string)($val); -} -$days["other"] = "other"; - -# Weekdays -$weekdays = array( - "*" => "Every weekday", - "0" => "Sunday", - "1" => "Monday", - "2" => "Tuesday", - "3" => "Wednesday", - "4" => "Thursday", - "5" => "Friday", - "6" => "Saturday"); -$weekdays["other"] = "other"; - -# Months -$months = array("*" => "Every month", - "1" => "January", - "2" => "February", - "3" => "March", - "4" => "April", - "5" => "May", - "6" => "June", - "7" => "July", - "8" => "August", - "9" => "October", - "10" => "September", - "11" => "November", - "12" => "December"); -$months["other"] = "other"; +list($minutes,$hours,$days,$weekdays,$months) = get_cron_times(); function scheduleUIHelper($cronString) { @@ -206,10 +145,63 @@ if ($_POST['delete_cancel']) { header('Location: ' . $baseurl . 'jobs.php'); } +######################################################## +################## MAIN SWITCH ######################### switch($_GET['Action']) { case "create": check_action_access("Add Job"); #Access check add_leftbar($leftbar_menu, "««Cancel", "jobs.php"); + + if ($_GET['scriptid']) { + $_GET['scriptid'] = (int) $_GET['scriptid']; + $script = get_scire_script($_GET['scriptid']); + $smarty->assign('script', $script); + # print $script['script_data']; + preg_match_all('/%%(.*?)%%/', $script['script_data'], $matches); + $smarty->assign('dyn_tags', $matches[1]); + foreach ($matches[1] as $tag) { + $tag_values[$tag] = get_dyn_tag_value($_GET['scriptid'],$tag); + } + $smarty->assign('tag_values', $tag_values); + + pre_var_dump($tag_values); + } + + if ($_GET['clientid']) { + $_GET['clientid'] = (int) $_GET['clientid']; + $client = get_scire_client($_GET['clientid']); + #$id = $acl->get_object_id("clients",$client['hostname'],'AXO' + + $smarty->assign('client', $client); + } + ######################################################## + + $permissions = array(); + $all_permissions = $acl->get_objects(NULL, 1, 'ACO'); + foreach ($all_permissions as $categoryname => $cat) { + #print "Perm: $perm<br>Permname: $permname<br>"; + if ($categoryname != $scire_ui_section) { + foreach ($cat as $perm) { + array_push($permissions, $perm); + } + } + } + $smarty->assign('perms', $permissions); + #pre_var_dump($permissions); + $smarty->assign('priorities', get_priorities()); + + + $scripts = get_scire_scripts(); + $smarty->assign('scripts', $scripts); + + $smarty->assign('cgroups', $acl->format_groups($acl->sort_groups('AXO'), TEXT)); + $clients = get_scire_clients('hostname', 'asc'); + $smarty->assign('clients', $clients); + $smarty->assign('minutes', $minutes); + $smarty->assign('hours', $hours); + $smarty->assign('days', $days); + $smarty->assign('months', $months); + $smarty->assign('weekdays', $weekdays); break; case "edit": @@ -273,7 +265,7 @@ switch($_GET['Action']) { break; } - +$smarty->assign('get', $_GET); $smarty->assign('leftbar_menu', $leftbar_menu); $smarty->assign('Action', $_GET['Action']); $smarty->assign('status', $status); diff --git a/scire/quickstart/index.php b/scire/quickstart/index.php new file mode 100644 index 0000000..40c8528 --- /dev/null +++ b/scire/quickstart/index.php @@ -0,0 +1,37 @@ +<? +include('../.lib/module_common.php'); +$mod_path = "modules/quickstart"; + +$smarty->assign('leftbar', "on"); +$leftbar_menu = array(); + +add_leftbar($leftbar_menu, "Edit Profiles", "$mod_path/profiles.php"); +add_leftbar($leftbar_menu, "Install Client", "$mod_path/install_client.php"); + +$clients = array(); +#The first thing we need to do is parse the quickstart server data file. +#Find the file. +$fh = fopen("sample_data.csv", "r"); +#Open and loot. +if ($fh) { + while(!feof($fh)) { + $line = trim(fgets($fh)); + #File is a CSV with MAC,profile,status + list($client['mac'], $client['ip'], $client['profile'], $client['status']) = explode(",",$line); + array_push($clients,$client); + } + fclose($fh); +} + + + +#Get a list of the groups to put in the select box. +$profile_list = get_profile_list(); + +$smarty->assign('clients',$clients); +$smarty->assign('profiles',$profile_list); +$smarty->assign('leftbar_menu', $leftbar_menu); +$smarty->display($mod_path."/index.tpl"); +#pre_var_dump($clients); +#var_dump($profile_list); +?> diff --git a/scire/quickstart/sample_data.csv b/scire/quickstart/sample_data.csv new file mode 100644 index 0000000..f736047 --- /dev/null +++ b/scire/quickstart/sample_data.csv @@ -0,0 +1,5 @@ +00:01:02:03:04:0A,1.2.3.4,MTA,Install Complete +AA:BB:CC:DD:EE:FF,65.43.2.1,sample_profile,Scheduled for Install +00:01:02:03:04:05,192.168.1.11,sample_profile,Installing +AA:AB:CC:DD:EE:FF,95.43.2.1,sample_profile,Scheduled for Install +AA:AA:CC:DD:EE:FF,99.43.2.1,sample_profile,Installing |