public function dashboard() { if (!User::isLoggedIn()) { die('You must be logged in to view this page.'); } //do we need to set a default? if (!User::$me->get('dashboard_style')) { User::$me->set('dashboard_style', 'large_thumbnails'); User::$me->save(); } //okay, pull in our dashboard style. $this->set('dashboard_style', User::$me->get('dashboard_style')); //are there any apps requesting access? $this->set('request_tokens', OAuthToken::getRequestTokensByIP()->getAll()); $this->addTemplate('bot_thumbnail_template', Controller::byName('bot')->renderTemplate('thumbnail')); $this->addTemplate('bot_list_template', Controller::byName('bot')->renderTemplate('dashboard_list')); $this->addTemplate('job_list_template', Controller::byName('job')->renderTemplate('job_list')); $this->addScript('initial_data', "var initialData = " . Controller::byName('main')->renderView('dashboard_data'), "text/javascript"); $this->addScript("js/backbone.js"); }
public function forgotpass() { $this->setTitle("Retrieve Forgotten Password"); if ($this->args('submit')) { $user = User::byEmail($this->args('email')); if ($user->isHydrated()) { //give them a pass hash. $user->set('pass_reset_hash', sha1(mt_rand() . mt_rand() . mt_rand())); $user->save(); $link = "http://" . SITE_HOSTNAME . $user->getUrl() . "/resetpass:"******"forgot his/her password. :P", $user); Email::queue($user, "Password Reset", $text, $html); $this->set('status', "We have sent a reset password confirmation email to '" . $this->args('email') . "'."); } else { $this->set('error', "We could not find an account with that email address."); } $this->setArg('email'); } }
if ($status) { ?> <?php echo Controller::byName('htmltemplate')->renderView('statusbar', array('message' => $status)); ?> <?php } elseif ($error) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $error)); ?> <?php } elseif ($user->get('force_password_change')) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => 'You are required to change your password before continuing.')); ?> <?php } ?> <form method="post" autocomplete="off" action="/user:<?php echo $user->id; ?> /changepass"> <table class="BaseForm"> <tr> <td valign="top"><b>Enter Password</b></td> <td><input type="password" name="changepass1" class="input-medium"></td> </tr> <tr>
<?php if ($megaerror) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror)); } else { ?> <form class="form-horizontal" method="post" autocomplete="off" action="<?php echo $bot->getUrl(); ?> /delete"> <input type="hidden" name="submit" value="1"> <div class="alert alert-block"> <h4 class="alert-heading">Warning!</h4> Are you sure you want to delete this bot? This is permanent and will remove all information about this bot, including any jobs it has been assigned or completed.<br/><br/> <button type="submit" class="btn btn-primary">Delete Bot</button> </div> </form> <?php }
?> :: <a href="/bots">see all</a> </h3> <?php echo Controller::byName('bot')->renderView('draw_bots', array('bots' => $bots)); ?> </div> </div> <?php if (!empty($errors)) { ?> <div class="row"> <div class="span12"> <h3>Error Log</h3> <?php echo Controller::byName('main')->renderView('draw_error_log', array('errors' => $errors, 'hide' => 'user')); ?> </div> </div> <?php } } else { ?> <div class="hero-unit"> <h1>BotQueue has arrived!</h1> <p>The open source, distributed fabrication software you've been dreaming about. Srsly.</p> <p> <img src="/img/botqueue.png" width="1013" height="403" align="center"> </p> <h3>Okay, so what does that mean?</h3> <p>
<?php if ($megaerror) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror)); } else { ?> <?php echo Controller::byName('browse')->renderView('pagination_info', array('collection' => $activities, 'word' => 'activity')); ?> <?php echo Controller::byName('main')->renderView('draw_activities', array('activities' => $activities->getAll(), 'user' => $user)); ?> <?php echo Controller::byName('browse')->renderView('pagination', array('collection' => $activities, 'base_url' => '/user:'******'/activity')); }
:: <a href="/jobs/complete">see all</a> <?php } ?> </h2> <?php echo Controller::byName('job')->renderView('draw_jobs_small', array('jobs' => $complete)); ?> </div> <div class="span6"> <h2> Failed Jobs <?php if ($failure_count) { ?> :: 1-<?php echo min(10, $failure_count); ?> of <?php echo $failure_count; ?> :: <a href="/jobs/failure">see all</a> <?php } ?> </h2> <?php echo Controller::byName('job')->renderView('draw_jobs_small', array('jobs' => $failure)); ?> </div> </div>
This file is part of BotQueue. BotQueue is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. BotQueue is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with BotQueue. If not, see <http://www.gnu.org/licenses/>. */ define("START_TIME", microtime(true)); include "../extensions/global.php"; //include(EXTENSIONS_DIR . "session.php"); //are we in the right place? if ($_SERVER['HTTP_HOST'] != SITE_HOSTNAME) { header("Location: http://" . SITE_HOSTNAME . $_SERVER['REQUEST_URI']); } // If page requires SSL, and we're not in SSL mode, // redirect to the SSL version of the page if (FORCE_SSL && $_SERVER['SERVER_PORT'] != 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit; } Controller::byName('apiv1')->renderView('endpoint');
// If page requires SSL, and we're not in SSL mode, // redirect to the SSL version of the page if (FORCE_SSL && $_SERVER['SERVER_PORT'] != 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit; } //get our stuff. $mode = $_GET['mode']; $controller = $_GET['controller']; $view = $_GET['view']; // What mode are we looking at, ajax or html if (!$mode) { $mode = 'html'; } // The main controller is the default if (!$controller) { $controller = 'main'; } if (!$view) { throw new Exception("No view specified"); } // load the content $main = Controller::byName($controller); // render the views $content = $main->renderView($view); // add in headers and footers for html, or nothing for ajax echo Controller::byName("{$mode}Template")->renderView('main', array('content' => $content, 'title' => $main->get('title'), 'area' => $main->get('area'))); } catch (Exception $ex) { echo "Something bad happened: " . $ex->getMessage(); }
<div class="row"> <?php foreach ($bots as $row) { ?> <?php echo Controller::byName("bot")->renderView("thumbnail", array('size' => 3, 'bot' => $row['Bot'], 'job' => $row['Job'])); ?> <?php } ?> </div>
public function render() { return Controller::byName('wizard')->renderView('view', array('forms' => $this->forms, 'name' => $this->name, 'active' => $this->activeForm, 'wizardMode' => $this->wizardMode)); }
<?php /** * @package botqueue_job * @var string $megaerror * @var int $page * @var int $per_page * @var int $total * @var array $jobs * @var string $status */ if ($megaerror) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror)); } else { ?> <?php echo Controller::byName('browse')->renderView('pagination_info', array('page' => $page, 'per_page' => $per_page, 'total' => $total, 'word' => 'job')); ?> <?php echo Controller::byName('job')->renderView('draw_jobs', array('jobs' => $jobs)); ?> <?php echo Controller::byName('browse')->renderView('pagination', array('page' => $page, 'per_page' => $per_page, 'base_url' => "/jobs/{$status}", 'total' => $total)); }
<div class="row"> <div class="span6"> <?php echo Controller::byName('upload')->renderView('uploader', array('payload' => array('type' => 'new_job'))); ?> </div> <div class="span6"> <h2>How it works</h2> <ol> <li>You upload a GCode file to our server.</li> <li>You specify the queue and # of prints you want.</li> <li>The client software downloads and executes each job.</li> <li>You take your shiny new stuff and do awesomeness.</li> </ol> <h2>Accepted filetypes</h2> <ul> <li>At this point in time, we only accept <strong>.gcode</strong> files.</li> <li>In <i>Version 2</i>, we will be adding online slicer support. Stay tuned.</li> </ul> </div> </div>
<?php if (!empty($errors)) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => 'There were errors creating your queue.')); } ?> <form class="form-horizontal" method="post" autocomplete="off" action="/queue/create"> <input type="hidden" name="submit" value="1"> <fieldset> <div class="control-group <?php echo $errorfields['name']; ?> "> <label class="control-label" for="iname">Queue Name</label> <div class="controls"> <input type="text" class="input-xlarge" id="iname" name="name" value="<?php echo $name; ?> "> <?php if ($errors['name']) { ?> <span class="help-inline"><?php echo $errors['name']; ?> </span> <?php }
public function render() { return Controller::byName('form')->renderView(strtolower(get_class($this)), array('field' => $this)); }
<div class="span6"> <h3> On Deck Jobs :: 1-<?php echo min(5, $on_deck_count); ?> of <?php echo $on_deck_count; ?> :: <a href="/jobs/available">see all</a> </h3> <?php echo Controller::byName('job')->renderView('draw_on_deck_jobs', array('jobs' => $on_deck)); ?> </div> <div class="span6"> <h3> Finished Jobs :: 1-<?php echo min(5, $finished_count); ?> of <?php echo $finished_count; ?> :: <a href="/jobs/complete">see all</a> </h3> <?php echo Controller::byName('job')->renderView('draw_finished_jobs', array('jobs' => $finished)); ?> </div> </div>
echo $feed['url']; ?> "/> <?php } ?> <?php } ?> </head> <body class="preview" data-spy="scroll" data-target=".subnav" data-offset="50"> <div class="container"> <?php echo Controller::byName('htmltemplate')->renderView('menubar', array('area' => $area)); ?> <section id="content" style="margin-top:60px"> <?php if ($title) { ?> <div class="page-header"> <h1><?php echo $title; ?> </h1> </div> <?php } ?>
<th>Config Data:</th> <td> <button class="btn" onclick="$(this).hide(); $('#config_data').show()">Click to show config data</button> <span id="config_data" style="display: none"><?php echo nl2br(Utility::sanitize($config->get('config_data'))); ?> </span> </td> </tr> </tbody> </table> </div> </div> <div class="row"> <div class="span6"> <h3>Slice Jobs</h3> <?php echo Controller::byName('slicer')->renderView('draw_jobs_small', array('jobs' => $jobs)); ?> </div> <div class="span6"> <h3>Bots</h3> <?php echo Controller::byName('bot')->renderView('draw_bots_small', array('bots' => $bots)); ?> </div> </div> <?php }
<div class="row"> <div class="span12"> <?php if (!empty($bots)) { ?> <?php echo Controller::byName('main')->renderView('dashboard_medium_thumbnails', array('bots' => $bots)); ?> <?php } else { ?> <div class="alert"> <strong>No active bots found!</strong> </div> <?php } ?> </div> </div>
<tr> <th>I joined</th> <td><?php echo Utility::getTimeAgo($user->get('registered_on')); ?> (<?php echo Utility::formatDate($user->get('registered_on')); ?> )</td> </tr> </tbody> </table> <?php if ($user->get('bio')) { ?> <p> <?php echo Utility::convertToHTML($user->get('bio')); ?> </p> <?php } ?> <h2>Recent Activity Stream</h2> <?php echo Controller::byName('main')->renderView('draw_activities', array('activities' => $activities)); ?> <?php echo Controller::byName('browse')->renderView('pagination', array('page' => 1, 'per_page' => 25, 'base_url' => '/user:'******'/activity', 'total' => $activity_total)); }
/** * @param Bot $bot * @return string */ public static function getStatusHTML($bot) { return Controller::byName('bot')->renderView('statusbutton', array('bot' => $bot)); }
<?php /** * @package botqueue_comment * @var string $megaerror * @var Form $form */ if ($megaerror) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror)); } else { ?> <?php echo Controller::byName('comment')->renderView('draw_all', array('comments' => $comments)); ?> <?php echo $form->render('horizontal'); }
<h5>Download other modules</h5> <pre>git submodule update --init</pre> <h5>Run it!</h5> <pre>python -m bumblebee</pre> </div> <div class="tab-pane" id="osx_install"> <?php echo Controller::byName('help')->renderView('osx_installation'); ?> </div> <div class="tab-pane" id="raspi_install"> <?php echo Controller::byName('help')->renderView('raspberry_pi_installation'); ?> </div> <div class="tab-pane" id="windows_install"> <span class="text-error">Windows is not currently supported by BotQueue - patches welcome!</span> </div> </div> </div> <h4>Step <?php echo $i++; ?> : Authorize the client software</h4> <p>From the command line, navigate to the <strong>Bumblebee</strong> folder and run this command: <strong>python
public function register() { $registerForm = $this->_createRegisterForm(); $this->set('register_form', $registerForm); if ($registerForm->checkSubmitAndValidate($this->args())) { $username = $this->args('username'); if (!Verify::username($username, $reason)) { /** @var FormField $field */ $field = $registerForm->get('username'); $field->error($reason); } $email = $this->args('email'); $testUser = User::byEmail($email); if ($testUser->isHydrated()) { /** @var FormField $emailField */ $emailField = $registerForm->get('email'); $emailField->error("That email is already being used"); } if ($this->args('pass1') != $this->args('pass2')) { /** @var FormField $field */ $field = $registerForm->get('pass2'); $field->error("Your passwords do not match"); } if (!$registerForm->hasError()) { //woot! $user = new User(); $user->set('username', $username); $user->set('email', $email); $user->set('pass_hash', User::hashPass($this->args('pass1'))); $user->set('registered_on', date("Y-m-d H:i:s")); $user->save(); //create a default queue for them $q = new Queue(); $q->set("name", 'Default'); $q->set("user_id", $user->id); $q->save(); Activity::log("registered a new account on BotQueue.", $user); $text = Controller::byName('email')->renderView('new_user', array('user' => $user)); $html = Controller::byName('email')->renderView('new_user_html', array('user' => $user)); Email::queue($user, "Welcome to " . RR_PROJECT_NAME . "!", $text, $html); //automatically log them in. $token = $user->createToken(); $token->setCookie(); $this->forwardToURL("/"); } } }
<div class="row"> <div class="span12"> <?php if (!empty($bots)) { ?> <?php echo Controller::byName('main')->renderView('dashboard_' . $dashboard_style, array('bots' => $bots)); ?> <?php } else { ?> <div class="alert"> <strong>No active bots found!</strong> </div> <?php } ?> </div> </div>
<?php /** * @package botqueue_form * @var Form $form */ if ($form->hasError()) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => "There was an error with your form submission.")); } ?> <form class="form-inline" method="<?php echo $form->method; ?> " action="<?php echo $form->action; ?> " enctype="multipart/form-data"> <?php echo $form->renderFields(); ?> <button type="submit" class="btn btn-primary"><?php echo $form->submitText; ?> </button> </form>
<?php echo Controller::byName('notifications')->renderView('draw', array('notifications' => $notifications)); if (count($notifications) == 0) { ?> <h1>No new notifications</h1> <?php } ?> <a href="/notifications/all">Click here</a> to see past notifications.
?> >Medium Thumbnails</option> <option value="small_thumbnails" <?php echo $style == 'small_thumbnails' ? 'selected' : ''; ?> >Small Thumbnails</option> <option value="list" <?php echo $style == 'list' ? 'selected' : ''; ?> >Detailed List</option> </select> </form> <div class="clearfix"></div> </div> <div id="Dashtron"><?php echo Controller::byName('main')->renderView('dashboard'); ?> </div> <div id="DashtronHidden" style="display: none;"></div> <script> setInterval(loadDashtron, 10000); function loadDashtron() { if ($('#autoload_dashboard').is(':checked')) { var dashboard_style = $("#dashboard_style").val(); var url = "/ajax/main/dashboard/" + dashboard_style; var jqxhr = $.get(url, function(data) { if(dashboard_style == $("#dashboard_style").val()) {
<?php if ($megaerror) { ?> <?php echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror)); } else { ?> <?php echo Controller::byName('browse')->renderView('pagination_info', array('page' => $page, 'per_page' => $per_page, 'total' => $total, 'word' => 'job')); ?> <?php echo Controller::byName('job')->renderView('draw_jobs', array('jobs' => $jobs)); ?> <?php echo Controller::byName('browse')->renderView('pagination', array('page' => $page, 'per_page' => $per_page, 'base_url' => $file->getUrl() . "/jobs", 'total' => $total)); }
It is can control the following types of machines: <ul> <li>Most RepRap Machines (w/ <a href="https://github.com/grbl/grbl/">grbl</a>, <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/ErikZalm/Marlin/">marlin</a>, etc) </li> <li>MakerBot Replicator - experimental / shitty driver that barely works.</li> </ul> <p>It can control the following types of machines:</p> <ul> </ul> <p> The <a href="https://github.com/Hoektronics/Bumblebee">latest version</a> of Bumblebee is <strong>v<?php $c = Controller::byName('APIV1'); echo $c::$api_version; ?> </strong> </p> <p> For instructions on how to install and configure Bumblebee, please see the <a href="/help">help</a> page. </p> <p> <img src="/img/bumblebee.png" width="558" height="232"> </p> </div> <div class="span6"> <?php