function doImport($data, $form)
 {
     $errors = array();
     DynamicTemplate::import_file($data['TemplateFile']['tmp_name'], $errors, $data['TemplateFile']['name']);
     if (count($errors) == 0) {
         $this->sessionMessage("Successfully imported template", 'good');
     } else {
         die(print_r($errors, true));
         $this->sessionMessage($errors[0], 'bad');
     }
     $this->controller->redirectBack();
 }
 public function importtarball($data, $form)
 {
     // Protect against CSRF on destructive action
     if (!SecurityToken::inst()->checkRequest($this->request)) {
         return $this->httpError(400);
     }
     $result = DynamicTemplate::import_file($data['ImportFile']['tmp_name'], $errors, $data['ImportFile']['name']);
     return $this->returnItemToUser($result);
 }