" . i("VCL go Configurator") . "\n";
printf(i("VCL gos are for use with the %sVCL iOS app%s. VCL gos can be managed here but can only be used from an iOS device.") . " \n", "", " ");
if(count($oneclicks)) {
if($mode == 'submitEditOneClick' || $mode == 'deleteOneClick') {
$tab1sel = "";
$tab2sel = "selected=\"true\"";
}
else {
$tab1sel = "selected=\"true\"";
$tab2sel = "";
}
print "
\n";
print "
\n";
}
if(! $submitErr && $mode == 'submitOneClick')
print "" . i("VCL go successfully created") . " \n";
print "\n";
# end of first tab
print "
\n";
if(count($oneclicks)) {
# the tab that list all the OneClicks the user have
print "
\n";
if($mode == 'submitEditOneClick') {
print "" . i("VCL go successfully updated");
print " \n";
}
elseif($mode == 'deleteOneClick') {
print "" . i("VCL go successfully deleted");
print " \n";
}
}
foreach($oneclicks as $oneclick) {
print "
\n";
print i("VCL go Name:") . "\n";
$oneclickname = $oneclick['name'];
print "" . htmlentities($oneclickname) . " \n";
print " \n";
$oneclickid = $oneclick['id'];
print i("Resource:") . " " . htmlentities($oneclick['imagename']) . " \n";
# Duration
$duration = $oneclick['duration'];
if($duration < 60) {
print i("Duration:") . " " . $duration . " " . i("minutes") . " \n";
}
else {
if($duration < (60 * 24)) {
$hourduration = (int) $duration / 60;
print i("Duration:") . " " . $hourduration . " " . i("hour") . ($hourduration == 1 ? "" : "s") . " ";
}
else {
$dayduration = (int) $duration / (60 * 24);
print i("Duration:") . " " . $dayduration . " " . i("day") . ($dayduration == 1 ? "" : "s") . " ";
}
}
print i("Auto Login") . ": " . ($oneclick['autologin'] == 1 ? i("Yes") : i("No")) . " \n";
print " \n";
$cdata = array('oneclickid' => $oneclickid,
'oneclickname' => $oneclickname,
'maxlength' => $last);
# edit button
print "\n";
# Delete button
print "\n";
print " \n";
print " \n";
}
if(count($oneclicks)) {
print "\n";
print "
\n";
}
}
////////////////////////////////////////////////////////////////////////////////
///
/// \fn submitOneClick()
///
/// \to create one Button from Web Configurator
///
////////////////////////////////////////////////////////////////////////////////
function submitOneClick() {
global $user, $submitErr, $submitErrMsg;
$maxlength = getContinuationVar('maxlength');
$imageid = processInputVar("imageid", ARG_NUMERIC);
$name = processInputVar("newOneClickName", ARG_STRING);
$duration = processInputVar("length", ARG_NUMERIC);
$autologin = processInputVar("autologin", ARG_NUMERIC) == 1 ? 1 : 0;
# validate access to $imageid
$resources = getUserResources(array("imageAdmin", "imageCheckOut"));
$images = removeNoCheckout($resources["image"]);
if(! array_key_exists($imageid, $images)) {
$submitErr |= IMAGEERR;
$submitErrMsg[IMAGEERR] = i("Invalid image submitted.");
}
# validate $name
if(! preg_match('/^([-a-zA-Z0-9\. \(\)]){3,70}$/', $name)) {
$submitErr |= NAMEERR;
$submitErrMsg[NAMEERR] = i("Name can only contain letters, numbers, spaces, dashes(-), parenthesis,