Example #1
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $groups = DB::select()->from('groups')->execute()->as_array('id', 'name');
     $companies = DB::select()->from('companies')->execute()->as_array('id', 'name');
     $form = new Form('users/edit' . ($id ? '/' . $id : ''));
     $form->add("login", 'Login', Form::STRING, '', array('not_empty', 'min_length' => array(':value', 4)))->add('name', 'Real Name', Form::STRING)->add('group_id', 'Group', Form::SELECT, array(0 => 'Not selected') + $groups, array('not_empty'))->add('company_id', 'Company', Form::SELECT, array(0 => 'Not selected') + $companies, array('not_empty'))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add('is_admin', 'Admin', Form::BOOL);
     $form->add('passw', 'Password', Form::PASSWORD, '', $id ? false : array('not_empty', 'min_length' => array(':value', 6)))->add('pass2', 'Confirm password', Form::PASSWORD, '', array('matches' => array(':validation', 'pass2', 'passw')));
     $item = $id ? User::get($id) : array();
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         $error = $form->validate($item);
         if (!$error) {
             unset($item['pass2']);
             $exists = DB::select('id')->from('users')->where_open()->where('login', '=', $item['login'])->or_where('email', '=', $item['email'])->where_close()->and_where('id', '<>', $id)->execute()->get('id');
             if ($exists) {
                 if ($this->request->is_ajax()) {
                     $item['success'] = false;
                     $item['error'] = 'exists';
                     header('Content-type: application/json');
                     die(json_encode($item));
                 }
                 Messages::save("User with given login or email already exists! Please, enter different login/email!");
             } else {
                 if ($id) {
                     if (!Arr::get($item, 'passw')) {
                         unset($item['passw']);
                     }
                     DB::update('users')->set($item)->where('id', '=', $id)->execute();
                 } else {
                     $result = DB::insert('users', array_keys($item))->values(array_values($item))->execute();
                     $id = Arr::get($result, 0);
                 }
                 $item['id'] = $id;
                 $item['success'] = true;
                 $item['group'] = Arr::get($groups, $item['group_id'], 'Unknown');
                 $item['company'] = Arr::get($companies, $item['company_id'], 'Unknown');
                 if ($this->request->is_ajax()) {
                     header('Content-type: application/json');
                     die(json_encode($item));
                 }
                 Messages::save('User successfully saved!', 'success');
                 $this->redirect('/users');
             }
         } elseif ($this->request->is_ajax()) {
             $item['success'] = false;
             $item['error'] = $error;
             header('Content-type: application/json');
             die(json_encode($item));
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #2
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('security/users/edit' . ($id ? '/' . $id : ''));
     $groups = DB::select('id', 'name')->from('groups')->execute()->as_array('id', 'name');
     $partners = DB::select('id', 'name')->from('companies')->execute()->as_array('id', 'name');
     $regions = DB::select('id', 'name')->from('regions')->execute()->as_array('id', 'name');
     $form->add("login", 'Login', Form::STRING, '', array('not_empty', 'min_length' => array(':value', 4)))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add('group_id', 'Group', Form::SELECT, array('' => 'Please select...') + $groups, array('not_empty'), array('class' => 'multiselect'))->add('company_id', 'Partner', Form::SELECT, array('' => 'None') + $partners, null, array('class' => 'multiselect'))->add('default_region', 'Default region', Form::SELECT, array(0 => 'None') + $regions, null, array('class' => 'multiselect'));
     $form->add('region[]', 'Available regions', Form::SELECT, $regions, null, array('multiple' => 'multiple', 'class' => 'multiselect'));
     $form->add('passw', 'Password', Form::PASSWORD, '', $id ? false : array('not_empty', 'min_length' => array(':value', 6)))->add('pass2', 'Confirm password', Form::PASSWORD, '', array('matches' => array(':validation', 'pass2', 'passw')));
     $item = $id ? User::get($id) : array();
     if ($id) {
         $item['region[]'] = DB::select('region_id')->from('user_regions')->where('user_id', '=', $id)->execute()->as_array(NULL, 'region_id') ?: false;
     }
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         if (!$form->validate($item)) {
             unset($item['pass2']);
             $exists = DB::select('id')->from('users')->where_open()->where('login', '=', $item['login'])->or_where('email', '=', $item['email'])->where_close()->and_where('id', '<>', $id)->execute()->get('id');
             if ($exists) {
                 Messages::save("User with given login or email already exists! Please, enter different login/email!");
             } else {
                 $regs = Arr::get($_POST, 'region');
                 if ($id) {
                     if (!Arr::get($item, 'passw')) {
                         unset($item['passw']);
                     }
                     DB::update('users')->set($item)->where('id', '=', $id)->execute();
                     DB::delete('user_regions')->where('user_id', '=', $id)->execute();
                 } else {
                     $result = DB::insert('users', array_keys($item))->values(array_values($item))->execute();
                     $id = Arr::get($result, 0);
                 }
                 if ($regs) {
                     $result = DB::insert('user_regions', array('user_id', 'region_id'));
                     foreach ($regs as $reg) {
                         $result->values(array($id, $reg));
                     }
                     $result->execute();
                 }
                 Messages::save('User successfully saved!', 'success');
                 $this->redirect('/security/users');
             }
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #3
0
 public function action_edit()
 {
     $type = $this->request->param('id');
     $id = Arr::get($_GET, 'id');
     $uoms = DB::select('id', 'name')->from('uoms')->execute()->as_array('id', 'name');
     $form = new Form('items/edit/' . $type . '?id=' . ($id ?: ''));
     $form->add('code', 'Code', Form::STRING, '', array('not_empty'))->add('name', 'Name', Form::STRING, '', array('not_empty'));
     if ($type == 'item') {
         $table = 'items';
         $form->add('descr', 'Description', Form::TEXT);
     } else {
         $table = 'bom_items';
     }
     $form->add('uom', 'UOM', Form::SELECT, array(0 => 'Not selected') + $uoms);
     $item = DB::select()->from($table)->where('id', '=', $id)->execute()->current();
     $form->values($item);
     if ($_POST) {
         $value = $form->filter($_POST);
         if (!$form->validate($value)) {
             if ($id) {
                 DB::update($table)->set($value)->where('id', '=', $id)->execute();
             } else {
                 $id = Arr::get(DB::insert($table, array_keys($value))->values(array_values($value))->execute(), 0, 0);
             }
             $value['id'] = $id;
             $value['success'] = true;
             $value['uom'] = Arr::get($uoms, $value['uom'], 'Unknown');
             if (isset($value['descr'])) {
                 $value['descr'] = nl2br($value['descr']);
             }
             die(json_encode($value));
         }
     }
     $this->response->body($form->render());
 }
Example #4
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('security/groups/edit' . ($id ? '/' . $id : ''));
     $form->add("name", 'Name', Form::STRING, '', array('not_empty'))->add('is_admin', 'Administrative group', Form::BOOL)->add('show_all_jobs', 'Show all jobs (unchecked - show only assigned jobs)', Form::BOOL)->add('allow_assign', 'Allow assigning jobs', Form::BOOL)->add('allow_reports', 'Allow tracking changes', Form::BOOL)->add('allow_submissions', 'Allow tracking submissions', Form::BOOL)->add('allow_finance', 'Financial reports', Form::BOOL)->add('allow_forms', 'Forms submission', Form::BOOL)->add('allow_custom_forms', 'Custom forms submission', Form::BOOL)->add('edit_custom_forms', 'Edit custom forms reports', Form::BOOL)->add('time_machine', 'Time Machine', Form::BOOL);
     $form->add('columns', 'Show columns in job search', Form::INFO);
     foreach (Columns::$fixed as $key => $value) {
         $form->add($key, $value, Form::BOOL);
     }
     $item = $id ? Group::get($id) : array();
     if ($item) {
         $columns = explode(',', $item['columns']);
         foreach ($columns as $column) {
             $item[$column] = 1;
         }
         unset($item['columns']);
     }
     $form->values($item);
     if ($_POST) {
         $value = $form->filter($_POST);
         if ($value['is_admin']) {
             $value['show_all_jobs'] = 1;
             $value['allow_assign'] = 1;
             $value['allow_reports'] = 1;
             $value['allow_submissions'] = 1;
             $value['allow_finance'] = 1;
             $value['allow_forms'] = 0;
             $value['allow_custom_forms'] = 1;
             $value['edit_custom_forms'] = 1;
             $value['time_machine'] = 1;
             $value['columns'] = implode(',', array_keys(Columns::$fixed));
         } else {
             $columns = array();
             foreach (Columns::$fixed as $key => $name) {
                 if (Arr::get($value, $key)) {
                     $columns[] = $key;
                 }
             }
             $value['columns'] = implode(',', $columns);
         }
         $value = array_diff_key($value, Columns::$fixed);
         if (!$form->validate($value)) {
             if ($id) {
                 DB::update('groups')->set($value)->where('id', '=', $id)->execute();
             } else {
                 $origin = Arr::get($_POST, 'permissions');
                 unset($_POST['permissions']);
                 $id = Arr::get(DB::insert('groups', array_keys($value))->values(array_values($value))->execute(), 0);
                 DB::query(Database::INSERT, DB::expr("INSERT INTO `group_columns` (`group_id`, `column_id`, `permissions`) \n                        (SELECT :id, `column_id`, `permissions` FROM `group_columns` WHERE `group_id` = :origin)")->param(':id', $id)->param(':origin', $origin)->compile())->execute();
             }
             Messages::save('Group successfully saved!', 'success');
             $this->redirect('/security/groups');
         }
     }
     if (!$id) {
         $groups = DB::select('id', 'name')->from('groups')->execute()->as_array('id', 'name');
         $form->add('permissions', 'Copy permissions from group', Form::SELECT, $groups);
     }
     $this->response->body($form->render());
 }
Example #5
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     if (!User::current('is_admin') && !(Group::current('item_create') && !$id) && !(Group::current('item_edit') && $id)) {
         throw new HTTP_Exception_403('Forbidden');
     }
     $uoms = DB::select()->from('uoms')->execute()->as_array('id', 'name');
     $form = new Form('items/edit' . ($id ? '/' . $id : ''));
     $form->add("sku", 'SKU/Barcode', Form::STRING, '', array('not_empty'))->add("name", 'Description', Form::STRING, '', array('not_empty'))->add("uom", 'UOM', Form::SELECT, array(0 => 'Not selected') + $uoms, array('not_empty'))->add("cost", 'Cost (each)', Form::NUMBER, '', array('not_empty'))->add("qty", 'Qty Tracked', Form::BOOL);
     if ($id) {
         $item = DB::select()->from('items')->where('id', '=', $id)->execute()->current();
     } else {
         $item = array();
     }
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         $error = $form->validate($item);
         if (!$error) {
             if ($id) {
                 DB::update('items')->set($item)->where('id', '=', $id)->execute();
             } else {
                 $result = DB::insert('items', array_keys($item))->values(array_values($item))->execute();
                 $id = Arr::get($result, 0);
             }
             $item['id'] = $id;
             $item['success'] = true;
             if ($this->request->is_ajax()) {
                 $item['uom'] = Arr::get($uoms, Arr::get($item, 'uom', 0), 'Unknown');
                 header('Content-type: application/json');
                 die(json_encode($item));
             }
             Messages::save('Item successfully saved!', 'success');
             $this->redirect('/items');
         } elseif ($this->request->is_ajax()) {
             $item['success'] = false;
             $item['error'] = $error;
             header('Content-type: application/json');
             die(json_encode($item));
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #6
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('address/edit' . ($id ? '/' . $id : ''));
     $form->add("name", 'Site Name', Form::STRING, '', array('not_empty'))->add("address", 'Delivery Address', Form::STRING, '', array('not_empty'))->add("contact", 'Attention to', Form::STRING, '', array('not_empty'))->add("phone", 'Phone Number', Form::STRING, '', array('not_empty'))->add("note", 'Note', Form::TEXT);
     if ($id) {
         $item = DB::select()->from('address')->where('id', '=', $id)->execute()->current();
     } else {
         $item = array();
     }
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         $error = $form->validate($item);
         if (!$error) {
             if ($id) {
                 DB::update('address')->set($item)->where('id', '=', $id)->execute();
             } else {
                 $result = DB::insert('address', array_keys($item))->values(array_values($item))->execute();
                 $id = Arr::get($result, 0);
             }
             $item['id'] = $id;
             $item['success'] = true;
             if ($this->request->is_ajax()) {
                 header('Content-type: application/json');
                 die(json_encode($item));
             }
             Messages::save('Address successfully saved!', 'success');
             $this->redirect('/address');
         } elseif ($this->request->is_ajax()) {
             $item['success'] = false;
             $item['error'] = $error;
             header('Content-type: application/json');
             die(json_encode($item));
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #7
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('projects/edit' . ($id ? '/' . $id : ''));
     $form->add("client_code", 'Client Code', Form::STRING, '', array('not_empty'))->add("internal_code", 'Internal Code', Form::STRING, '', array('not_empty'))->add("name", 'Project Name', Form::STRING, '', array('not_empty'));
     if ($id) {
         $item = DB::select()->from('projects')->where('id', '=', $id)->execute()->current();
     } else {
         $item = array();
     }
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         $error = $form->validate($item);
         if (!$error) {
             if ($id) {
                 DB::update('projects')->set($item)->where('id', '=', $id)->execute();
             } else {
                 $result = DB::insert('projects', array_keys($item))->values(array_values($item))->execute();
                 $id = Arr::get($result, 0);
             }
             $item['id'] = $id;
             $item['success'] = true;
             if ($this->request->is_ajax()) {
                 header('Content-type: application/json');
                 die(json_encode($item));
             }
             Messages::save('Project successfully saved!', 'success');
             $this->redirect('/projects');
         } elseif ($this->request->is_ajax()) {
             $item['success'] = false;
             $item['error'] = $error;
             header('Content-type: application/json');
             die(json_encode($item));
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #8
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('companies/edit' . ($id ? '/' . $id : ''));
     $form->add("logo", 'Logo', Form::IMAGE)->add("name", 'Project Name', Form::STRING, '', array('not_empty'))->add("prefix", 'Order Number Prefix', Form::STRING, '', array('not_empty'))->add("abn", 'ABN', Form::STRING, '', array('not_empty'))->add("address", 'Address', Form::STRING, '', array('not_empty'))->add("contact", 'Contact Name', Form::STRING, '', array('not_empty'))->add("phone", 'Contact Phone', Form::STRING, '', array('not_empty'))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add("note", 'Note', Form::TEXT)->add("note2", 'Note2', Form::TEXT);
     if ($id) {
         $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current();
     } else {
         $item = array();
     }
     $form->values($item);
     $error = false;
     if ($_POST) {
         $item = $form->filter($_POST);
         $error = $form->validate($item);
         if (!$error) {
             if ($id) {
                 DB::update('companies')->set($item)->where('id', '=', $id)->execute();
             } else {
                 $result = DB::insert('companies', array_keys($item))->values(array_values($item))->execute();
                 $id = Arr::get($result, 0);
             }
             $item['id'] = $id;
             $item['success'] = true;
             if ($this->request->is_ajax()) {
                 header('Content-type: application/json');
                 die(json_encode($item));
             }
             Messages::save('Company successfully saved!', 'success');
             $this->redirect('/companies');
         } elseif ($this->request->is_ajax()) {
             $item['success'] = false;
             $item['error'] = $error;
             header('Content-type: application/json');
             die(json_encode($item));
         }
         $form->values($item);
     }
     $this->response->body($form->render($error));
 }
Example #9
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('groups/edit' . ($id ? '/' . $id : ''));
     $form->add("name", 'Name', Form::STRING, '', array('not_empty'));
     $roles = DB::select()->from('roles')->execute()->as_array('id', 'name');
     foreach ($roles as $key => $role) {
         $form->add($key, $role, Form::BOOL);
     }
     $item = $id ? Group::get($id) : array();
     $form->values($item);
     if ($_POST) {
         $value = $form->filter($_POST);
         if (!$form->validate($value)) {
             Database::instance()->begin();
             if ($id) {
                 DB::update('groups')->set(array('name' => $value['name']))->where('id', '=', $id)->execute();
                 DB::delete('group_roles')->where('group_id', '=', $id)->execute();
             } else {
                 $id = Arr::get(DB::insert('groups', array('name'))->values(array($value['name']))->execute(), 0);
             }
             $list = array();
             foreach ($roles as $key => $role) {
                 if (Arr::get($_POST, $key)) {
                     $list[] = array($id, $key);
                 }
             }
             if ($list) {
                 $query = DB::insert('group_roles', array('group_id', 'role_id'));
                 foreach ($list as $role) {
                     $query->values($role);
                 }
                 $query->execute();
             }
             Database::instance()->commit();
             $value['id'] = $id;
             $value['success'] = true;
             die(json_encode($value));
             //Messages::save('Group successfully saved!', 'success');
             //$this->redirect('/groups');
         }
     }
     $this->response->body($form->render());
 }
Example #10
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('security/companies/edit' . ($id ? '/' . $id : ''));
     $types = DB::select('id', 'name')->from('company_types')->execute()->as_array('id', 'name');
     $form->add("name", 'Name', Form::STRING, '', array('not_empty'))->add('type', 'Company type', Form::SELECT, $types, array('not_empty'));
     $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current();
     $form->values($item);
     if ($_POST) {
         $value = $form->filter($_POST);
         if (!$form->validate($value)) {
             if ($id) {
                 DB::update('companies')->set($value)->where('id', '=', $id)->execute();
             } else {
                 DB::insert('companies', array_keys($value))->values(array_values($value))->execute();
             }
             Messages::save('Company successfully saved!', 'success');
             $this->redirect('/security/companies');
         }
     }
     $this->response->body($form->render());
 }
Example #11
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $form = new Form('companies/edit' . ($id ? '/' . $id : ''));
     $form->add("name", 'Name', Form::STRING, '', array('not_empty'));
     $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current();
     $form->values($item);
     if ($_POST) {
         $value = $form->filter($_POST);
         if (!$form->validate($value)) {
             Database::instance()->begin();
             if ($id) {
                 DB::update('companies')->set(array('name' => $value['name']))->where('id', '=', $id)->execute();
             } else {
                 $id = Arr::get(DB::insert('companies', array('name'))->values(array($value['name']))->execute(), 0);
             }
             Database::instance()->commit();
             $value['id'] = $id;
             $value['success'] = true;
             die(json_encode($value));
         }
     }
     $this->response->body($form->render());
 }
Example #12
0
<?php

if (!isset($res)) {
    $Base = new Base();
    $Base->type(SEARCH);
    $Base->title("Search");
    $Base->header();
}
$Form = new Form();
$Form->ajax(false);
if (isset($_SESSION['search'])) {
    $Form->values($_SESSION['search']);
}
$Form->header("/search/", "post", FORM_SALT);
$Form->fieldset_open("Search Information");
$Form->add_text("search", "Search For:", 300);
$Form->add_select("_type", "Within:", "Choose", array("thread" => "Threads", "thread_post" => "Thread Posts", "message" => "Messages", "message_post" => "Message Posts"));
$Form->fieldset_close();
$Form->fieldset_open("Optional Fields");
print "<li>will return in a bit</li>\n";
/*
$Form->add_text("member","By Member:");
$Form->labels(false);
print "<li>\n";
print "  <label>Date Range:</label>\n";
$Form->add_date("start",false);
$Form->add_date("end",false);
print "</li>\n";
$Form->labels(true);
$Form->add_select("quickdate","Quick Ranges:","Choose",array("thisweek"=>"This Week","thismonth"=>"This Month","lastweek"=>"Last Week","lastmonth"=>"Last Month"),"onchange=\"quickrange($(this).val())\">");
*/
Example #13
0
  jQuery('.read').css('border-right','3px solid #'+jQuery('#readbar').val());
  if(jQuery('#hover').val() == 'none')
  {
    jQuery('body').append("<style type=text/css>.list:hover { background-color: transparent !important; }</style>");
  }
  else
  jQuery('body').append("<style type=text/css>.list:hover { background-color: #"+jQuery('#hover').val()+"; }</style>");
}
</script>
<div style="float:left;width:50%">
<?php 
$Form = new Form();
if ($theme['hover'] == "transparent") {
    $theme['hover'] = "none";
}
$Form->values(array_merge($theme, get('theme') ? array("theme" => get('theme')) : array()));
$Form->header(url(), "post", FORM_SALT);
$Form->fieldset_open("Theme Options");
$Form->add_text("font", "Font Family:", 250);
$Form->add_select("fontsize", "Font Size:", "Select Size", $fontsizes);
$Form->add_text("body", "Background #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"body\" checked=\"true\"/>");
$Form->add_text("even", "Even #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"even\"/>");
$Form->add_text("odd", "Odd #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"odd\"/>");
$Form->add_text("me", "My Posts #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"me\"/>");
$Form->add_text("hover", "Hover Bar #:<br/><span class=\"small\">(or 'none')</span>", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"hover\"/>");
$Form->add_text("readbar", "Read Bars #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"readbar\"/>");
$Form->fieldset_close();
$Form->add_submit("Save");
$Form->add_button("preview", "Preview", "preview_theme()");
$Form->labels(false);
$Form->fieldset_open("Preset Themes");
Example #14
0
<?php

if (!id() || !session('admin')) {
    return to_index();
}
$Base = new Base();
$Base->type(EDIT);
$Base->title("Edit Post");
$Base->header();
$DB->query("SELECT thread_id,body FROM thread_post WHERE id=\$1", array(id()));
$data = $DB->load_array();
$Form = new Form();
$Form->values($data);
$Form->header(url(), "post", FORM_SALT);
$Form->fieldset_open("Edit");
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "id=\"submit\"/>");
$Form->footer();
$Form->header_validate();
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
$Base->footer();
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "") location.href='/thread/view/<?php 
print $data['thread_id'];
?>
/';
Example #15
0
<?php

if ($DB->value("SELECT locked FROM thread WHERE id=\$1", array(id())) == 't') {
    return;
}
$Form = new Form();
$Form->header(url(0, 1) . "reply", "post", FORM_SALT);
$Form->values(array("thread_id" => id(true)));
$Form->add_hidden("thread_id");
$Form->account_login();
$Form->fieldset_open("Reply");
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "id=\"submit\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','thread'," . id() . ");");
if (id() == 362137) {
    print "&nbsp;";
    $Form->add_button("_load", "load bradyism", "\$(this).val('loading...');\$.post('/thread/view/bradyism/',{},function(data){ \$('#body').val(\$.trim(data));\$('#_load').val('load bradyism')});");
}
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
print BBCODE_GUIDE;
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "")
  {
Example #16
0
<?php

$Form = new Form();
$Form->header(url(0, 1) . "reply", "post", FORM_SALT);
$Form->values(array("message_id" => id(true)));
$Form->add_hidden("message_id");
$Form->account_login();
$Form->fieldset_open("Reply");
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "id=\"submit\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','message'," . id() . ");");
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
print BBCODE_GUIDE;
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "")
  {
    loadposts('message',false);
    e('<?php 
print $Form->name;
?>
').reset();
  }
  $('.submit').attr('disabled',false);
Example #17
0
if (!isset($prefs['collapseopen'])) {
    $prefs['collapseopen'] = COLLAPSE_DEFAULT;
}
if (!is_numeric($prefs['collapseopen'])) {
    $prefs['collapseopen'] = COLLAPSE_OPEN_DEFAULT;
}
if ($prefs['collapseopen'] < 1) {
    $prefs['collapseopen'] = 1;
}
$Base = new Base();
$Base->type(EDIT);
$Base->title("Account Management: {$member['name']}");
$Base->header();
print "<div class=\"box clear\">\n";
$Form = new Form();
$Form->values(array_merge($member, $prefs));
$Form->header(url(), "post", FORM_SALT);
$Form->fieldset_open("Account Management");
$Form->add_text("name", "Name:");
$Form->add_text("postalcode", "Postal Code:");
$Form->fieldset_close();
$Form->fieldset_open("Password Management");
print "<div id=\"password\" style=\"display:none\">\n";
$Form->add_password("_current", "Current:");
$Form->add_password("_pass", "New:");
$Form->add_password("_pass_confirm", "Confirm:");
print "</div>\n";
$Form->add_button("_change", "Change Password", "change_password()", "style=\"margin:5px\"");
$Form->fieldset_close();
$Form->fieldset_open("Details");
$DB->query("SELECT\r\n              p.display,\r\n              p.name as field,\r\n              pt.name as type,\r\n              p.width\r\n            FROM\r\n              pref p\r\n            LEFT JOIN\r\n              pref_type pt\r\n            ON\r\n              pt.id = p.pref_type_id\r\n            WHERE\r\n              p.editable IS true\r\n            ORDER BY\r\n              p.ordering");
Example #18
0
<?php

if (!isset($res)) {
    $Base = new Base();
    $Base->type(SEARCH);
    $Base->title("Search");
    $Base->header();
}
$Form = new Form();
$Form->ajax(false);
if (isset($_SESSION['search'])) {
    $Form->values($_SESSION['search']);
}
$Form->header("/search/", "post", FORM_SALT);
$Form->fieldset_open("Search Information");
$Form->add_text("search", "Search For:", 300);
$Form->values(array("_type" => "thread"));
$Form->add_select("_type", "Within:", NULL, array("thread" => "Threads", "thread_post" => "Thread Posts", "message" => "Messages", "message_post" => "Message Posts"));
$Form->fieldset_close();
$Form->fieldset_open("Optional Fields");
print "<li>will return in a bit</li>\n";
/*
$Form->add_text("member","By Member:");
$Form->labels(false);
print "<li>\n";
print "  <label>Date Range:</label>\n";
$Form->add_date("start",false);
$Form->add_date("end",false);
print "</li>\n";
$Form->labels(true);
$Form->add_select("quickdate","Quick Ranges:","Choose",array("thisweek"=>"This Week","thismonth"=>"This Month","lastweek"=>"Last Week","lastmonth"=>"Last Month"),"onchange=\"quickrange($(this).val())\">");