From: <ma...@us...> - 2012-06-27 20:16:28
|
Revision: 9732 http://xoops.svn.sourceforge.net/xoops/?rev=9732&view=rev Author: mageg Date: 2012-06-27 20:16:21 +0000 (Wed, 27 Jun 2012) Log Message: ----------- update profile Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/regstep.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/language/english/admin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/categorylist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/fieldlist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/steplist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_userinfo.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -21,78 +21,105 @@ */ include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string'); +// Call header +$xoops->header('categorylist.html'); +// Get category handler +$category_Handler = $xoops->getModuleHandler("category"); -$xoops = Xoops::getInstance(); -$xoops->header(); -$indexAdmin = new XoopsModuleAdmin(); -$indexAdmin->renderNavigation('category.php'); +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('category.php'); -$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); - -/* @var $handler ProfileCategoryHandler */ -/* @var $obj ProfileCategory */ -$handler = $xoops->getModuleHandler('category'); switch ($op) { + case "list": default: - case "list": + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_CATEGORY, 'category.php?op=new', 'add'); + $admin_page->renderButton(); $criteria = new CriteriaCompo(); $criteria->setSort('cat_weight'); $criteria->setOrder('ASC'); - $xoops->tpl->assign('categories', $handler->getObjects($criteria, true, false)); - $template_main = "categorylist.html"; + $xoops->tpl->assign('categories', $category_Handler->getObjects($criteria, true, false)); + $xoops->tpl->assign('category', true); break; case "new": - $obj = $handler->create(); - $form = $obj->getForm(); - $form->display(); + $admin_page->addItemButton(_PROFILE_AM_CATEGORY_LIST, 'category.php', 'application-view-detail'); + $admin_page->renderButton(); + $obj = $category_Handler->create(); + $form = $xoops->getModuleForm($obj, 'category'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "edit": - $handler->get($_REQUEST['id']); - $form = $obj->getForm(); - $form->display(); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_CATEGORY, 'category.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_CATEGORY_LIST, 'category.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $category_Handler->get($id); + $form = $xoops->getModuleForm($obj, 'category'); + $form->render(); + $xoops->tpl->assign('form', true); + } else { + $xoops->redirect('category.php', 1, _AM_SYSTEM_DBERROR); + } break; case "save": if (!$xoops->security->check()) { $xoops->redirect('category.php', 3, implode(',', $xoops->security->getErrors())); } - if (isset($_REQUEST['id'])) { - $obj = $handler->get($_REQUEST['id']); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $category_Handler->get($id); } else { - $obj = $handler->create(); + $obj = $category_Handler->create(); } - $obj->setVar('cat_title', $_REQUEST['cat_title']); - $obj->setVar('cat_description', $_REQUEST['cat_description']); - $obj->setVar('cat_weight', $_REQUEST['cat_weight']); - if ($handler->insert($obj)) { + $obj->setVar('cat_title', $_POST['cat_title']); + $obj->setVar('cat_description', $_POST['cat_description']); + $obj->setVar('cat_weight',$_POST['cat_weight']); + if ($category_Handler->insert($obj)) { $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_CATEGORY)); } - echo $obj->getHtmlErrors(); - $form = $obj->getForm(); - $form->display(); + $xoops->error($obj->getHtmlErrors()); + $form = $xoops->getModuleForm($obj, 'category'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "delete": - $obj = $handler->get($_REQUEST['id']); - if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { - if (!$xoops->security->check()) { - $xoops->redirect('category.php', 3, implode(',', $xoops->security->getErrors())); - } - if ($handler->delete($obj)) { - $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY)); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_CATEGORY, 'category.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_CATEGORY_LIST, 'category.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $category_Handler->get($id); + if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect("category.php", 3, implode(",", $xoops->security->getErrors())); + } + if ($category_Handler->delete($obj)) { + $xoops->redirect("category.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY)); + } else { + $xoops->error($obj->getHtmlErrors()); + } } else { - echo $obj->getHtmlErrors(); + // Define Stylesheet + $xoops->theme->addStylesheet('modules/system/css/admin.css'); + $xoops->tpl->assign('form', false); + $xoops->confirm(array("ok" => 1, "id" => $id, "op" => "delete"), 'category.php', sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('cat_title')) . '<br />'); } } else { - $xoops->confirm(array( - 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' - ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('cat_title'))); + $xoops->redirect('category.php', 1, _AM_SYSTEM_DBERROR); } break; } -if (isset($template_main)) { - $xoops->tpl->display("admin:profile|{$template_main}"); -} $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -21,7 +21,6 @@ */ include dirname(__FILE__) . '/header.php'; -$xoops = Xoops::getInstance(); $xoops->header(); if (!isset($_REQUEST['uid'])) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -20,29 +20,33 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ - include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string'); +// Call header +$xoops->header('fieldlist.html'); +// Get handler +$field_handler = $xoops->getModuleHandler('field'); +$cat_handler = $xoops->getModuleHandler('category'); -$xoops = Xoops::getInstance(); -$xoops->header(); +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('field.php'); -$indexAdmin = new XoopsModuleAdmin(); -$indexAdmin->renderNavigation('field.php'); -$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); - -/* @var $profilefield_handler ProfileFieldHandler */ -$profilefield_handler = $xoops->getModuleHandler('field'); - -/* @var $obj ProfileField */ - switch ($op) { default: case "list": - $fields = $profilefield_handler->getObjects(null, true, false); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_FIELD, 'field.php?op=new', 'add'); + $admin_page->renderButton(); + $fields = $field_handler->getObjects(null, true, false); $modules = $xoops->getHandlerModule()->getObjectsArray(null, true); - $cat_handler = $xoops->getModuleHandler('category'); $criteria = new CriteriaCompo(); $criteria->setSort('cat_weight'); $cats = $cat_handler->getObjects($criteria, true); @@ -88,22 +92,31 @@ ksort($categories); $xoops->tpl->assign('fieldcategories', $categories); $xoops->tpl->assign('token', $xoops->security->getTokenHTML()); - $template_main = "fieldlist.html"; + $xoops->tpl->assign('fieldlist', true); break; case "new": - $obj = $profilefield_handler->create(); - $form = $obj->getForm(); - $form->display(); + $admin_page->addItemButton(_PROFILE_AM_FIELD_LIST, 'field.php', 'application-view-detail'); + $admin_page->renderButton(); + $obj = $field_handler->create(); + $form = $xoops->getModuleForm($obj, 'field'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "edit": - $obj = $profilefield_handler->get($_REQUEST['id']); - if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist - $xoops->redirect('field.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_FIELD, 'field.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_FIELD_LIST, 'field.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $field_handler->get($id); + $form = $xoops->getModuleForm($obj, 'field'); + $form->render(); + $xoops->tpl->assign('form', true); + } else { + $xoops->redirect('field.php', 1, _AM_SYSTEM_DBERROR); } - $form = $obj->getForm(); - $form->display(); break; case "reorder": @@ -125,12 +138,11 @@ if (count($ids) > 0) { $errors = array(); //if there are changed fields, fetch the fieldcategory objects - $field_handler = $xoops->getModuleHandler('field'); $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); foreach ($ids as $i) { $fields[$i]->setVar('field_weight', intval($weight[$i])); $fields[$i]->setVar('cat_id', intval($category[$i])); - if (!$field_handler->insert($fields[$i])) { + if (!$field_handler->insertFields($fields[$i])) { $errors = array_merge($errors, $fields[$i]->getErrors()); } } @@ -149,13 +161,14 @@ $xoops->redirect('field.php', 3, implode(',', $xoops->security->getErrors())); } $redirect_to_edit = false; - if (isset($_REQUEST['id'])) { - $obj = $profilefield_handler->get($_REQUEST['id']); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $field_handler->get($id); if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist $xoops->redirect('admin.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); } } else { - $obj = $profilefield_handler->create(); + $obj = $field_handler->create(); $obj->setVar('field_name', $_REQUEST['field_name']); $obj->setVar('field_moduleid', $xoops->module->getVar('mid')); $obj->setVar('field_show', 1); @@ -216,7 +229,8 @@ ) { $obj->setVar('step_id', $_REQUEST['step_id']); } - if ($profilefield_handler->insert($obj)) { + + if ($field_handler->insertFields($obj)) { $groupperm_handler = $xoops->getHandlerGroupperm(); $perm_arr = array(); @@ -271,34 +285,37 @@ $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; $xoops->redirect($url, 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_FIELD)); } - echo $obj->getHtmlErrors(); - $form = $obj->getForm(); - $form->display(); + $xoops->error($obj->getHtmlErrors()); + $form = $xoops->getModuleForm($obj, 'regstep'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "delete": - $obj = $profilefield_handler->get($_REQUEST['id']); - if (!$obj->getVar('field_config')) { - $xoops->redirect('index.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); - } - if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { - if (!$xoops->security->check()) { - $xoops->redirect('field.php', 3, implode(',', $xoops->security->getErrors())); - } - if ($profilefield_handler->delete($obj)) { - $xoops->redirect('field.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_FIELD)); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_FIELD, 'field.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_FIELD_LIST, 'field.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $field_handler->get($id); + if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect("field.php", 3, implode(",", $xoops->security->getErrors())); + } + if ($field_handler->deleteFields($obj)) { + $xoops->redirect("field.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY)); + } else { + $xoops->error($obj->getHtmlErrors()); + } } else { - echo $obj->getHtmlErrors(); + // Define Stylesheet + $xoops->theme->addStylesheet('modules/system/css/admin.css'); + $xoops->tpl->assign('form', false); + $xoops->confirm(array("ok" => 1, "id" => $id, "op" => "delete"), 'field.php', sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('field_title')) . '<br />'); } } else { - $xoops->confirm(array( - 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' - ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('field_title'))); + $xoops->redirect('field.php', 1, _AM_SYSTEM_DBERROR); } break; } - -if (isset($template_main)) { - $xoops->tpl->display("admin:profile|{$template_main}"); -} $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -21,6 +21,5 @@ */ require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; - -$xoops = Xoops::getInstance(); +XoopsLoad::load('system', 'system'); $xoops->loadLanguage('user'); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -21,23 +21,28 @@ * @version $Id$ */ include dirname(__FILE__) . '/header.php'; - -$xoops = Xoops::getInstance(); +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'edit', 'string'); +// Call header $xoops->header(); -$indexAdmin = new XoopsModuleAdmin(); -$indexAdmin->renderNavigation('permissions.php'); +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('permissions.php'); -$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "edit"; - $perm_desc = ""; switch ($op ) { case "visibility": - //$xoops->redirect("visibility.php", 0, _PROFILE_AM_PROF_VISIBLE); header("Location: visibility.php"); break; case "edit": + default: $title_of_form = _PROFILE_AM_PROF_EDITABLE; $perm_name = "profile_edit"; $restriction = "field_edit"; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -20,74 +20,119 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ - include dirname(__FILE__) . '/header.php'; +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string'); +// Call header +$xoops->header('steplist.html'); +// Get handler +$regstep_Handler = $xoops->getModuleHandler("regstep"); -$xoops = Xoops::getInstance(); -$xoops->header(); +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('step.php'); -$indexAdmin = new XoopsModuleAdmin(); -$indexAdmin->renderNavigation('step.php'); - -$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); - -/* @var $handler ProfileRegstepHandler */ -$handler = $xoops->getModuleHandler('regstep'); -/* @var $obj ProfileRegstep */ switch ($op) { case "list": - $xoops->tpl->assign('steps', $handler->getObjects(null, true, false)); - $template_main = "steplist.html"; + default: + // Add Scripts + $xoops->theme->addScript('media/xoops/xoops.js'); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_STEP, 'step.php?op=new', 'add'); + $admin_page->renderButton(); + $xoops->tpl->assign('steps', $regstep_Handler->getObjects(null, true, false)); + $xoops->tpl->assign('step', true); break; - + case "new": - $obj = $handler->create(); - $form = $obj->getForm(); - $form->display(); + $admin_page->addItemButton(_PROFILE_AM_STEP_LIST, 'step.php', 'application-view-detail'); + $admin_page->renderButton(); + $obj = $regstep_Handler->create(); + $form = $xoops->getModuleForm($obj, 'regstep'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "edit": - $obj = $handler->get($_REQUEST['id']); - $form = $obj->getForm(); - $form->display(); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_STEP, 'step.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_STEP_LIST, 'step.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $regstep_Handler->get($id); + $form = $xoops->getModuleForm($obj, 'regstep'); + $form->render(); + $xoops->tpl->assign('form', true); + } else { + $xoops->redirect('step.php', 1, _AM_SYSTEM_DBERROR); + } break; case "save": - if (isset($_REQUEST['id'])) { - $obj = $handler->get($_REQUEST['id']); + if (!$xoops->security->check()) { + $xoops->redirect('step.php', 3, implode(',', $xoops->security->getErrors())); + } + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $regstep_Handler->get($id); } else { - $obj = $handler->create(); + $obj = $regstep_Handler->create(); } - $obj->setVar('step_name', $_REQUEST['step_name']); - $obj->setVar('step_order', $_REQUEST['step_order']); - $obj->setVar('step_desc', $_REQUEST['step_desc']); - $obj->setVar('step_save', $_REQUEST['step_save']); - if ($handler->insert($obj)) { + $obj->setVar('step_name', $_POST['step_name']); + $obj->setVar('step_order', $_POST['step_order']); + $obj->setVar('step_desc', $_POST['step_desc']); + $obj->setVar('step_save', $_POST['step_save']); + if ($regstep_Handler->insert($obj)) { $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_STEP)); } - echo $obj->getHtmlErrors(); - $form = $obj->getForm(); - $form->display(); + $xoops->error($obj->getHtmlErrors()); + $form = $xoops->getModuleForm($obj, 'regstep'); + $form->render(); + $xoops->tpl->assign('form', true); break; case "delete": - $obj = $handler->get($_REQUEST['id']); - if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { - if ($handler->delete($obj)) { - $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_STEP)); + $admin_page->addItemButton(_ADD . ' ' . _PROFILE_AM_STEP, 'step.php?op=new', 'add'); + $admin_page->addItemButton(_PROFILE_AM_STEP_LIST, 'step.php', 'application-view-detail'); + $admin_page->renderButton(); + $id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $regstep_Handler->get($id); + if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect("step.php", 3, implode(",", $xoops->security->getErrors())); + } + if ($regstep_Handler->deleteRegstep($obj)) { + $xoops->redirect("step.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY)); + } else { + $xoops->error($obj->getHtmlErrors()); + } } else { - echo $obj->getHtmlErrors(); + // Define Stylesheet + $xoops->theme->addStylesheet('modules/system/css/admin.css'); + $xoops->tpl->assign('form', false); + $xoops->confirm(array("ok" => 1, "id" => $id, "op" => "delete"), 'step.php', sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('step_name')) . '<br />'); } } else { - $xoops->confirm(array( - 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' - ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('step_name'))); + $xoops->redirect('step.php', 1, _AM_SYSTEM_DBERROR); } break; -} -if (!empty($template_main)) { - $xoops->tpl->display("admin:profile|{$template_main}"); + case "step_update": + $id = $system->cleanVars($_POST, 'id', 0, 'int'); + if ($id > 0) { + $obj = $regstep_Handler->get($id); + $old = $obj->getVar('step_save'); + $obj->setVar('step_save', !$old); + if ($regstep_Handler->insert($obj)) { + exit; + } + echo $obj->getHtmlErrors(); + } + break; } - $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -20,18 +20,25 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ - include dirname(__FILE__) . '/header.php'; - -$xoops = Xoops::getInstance(); - +// Get main instance +$system = System::getInstance(); +// Check users rights +if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) { + exit(_NOPERM); +} //there is no way to override current tabs when using system menu //this dirty hack will have to do it $_SERVER['REQUEST_URI'] = "admin/permissions.php"; +// Get Action type +$op = $system->cleanVars($_REQUEST, 'op', 'visibility', 'string'); + +// Call header $xoops->header(); -$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "visibility"; +$admin_page = new XoopsModuleAdmin(); +$admin_page->renderNavigation('permissions.php'); $visibility_handler = $xoops->getModuleHandler('visibility'); $field_handler = $xoops->getModuleHandler('field'); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -35,24 +35,6 @@ $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); $this->initVar('cat_weight', XOBJ_DTYPE_INT); } - - /** - * Get {@link XoopsThemeForm} for adding/editing categories - * - * @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] - * - * @return XoopsThemeForm - */ - public function getForm($action = false) - { - $xoops = Xoops::getInstance(); - $form = $xoops->getModuleForm($this, 'category', 'profile'); - if ($action === false) { - $action = $_SERVER['REQUEST_URI']; - } - $form->setAction($action); - return $form; - } } class ProfileCategoryHandler extends XoopsPersistableObjectHandler @@ -62,6 +44,6 @@ */ public function __construct(XoopsDatabase $db = null) { - parent::__construct($db, "profile_category", "profilecategory", "cat_id", 'cat_title'); + parent::__construct($db, 'profile_category', 'profilecategory', 'cat_id', 'cat_title'); } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -54,24 +54,6 @@ } /** - * Get {@link XoopsThemeForm} for adding/editing fields - * - * @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] - * - * @return XoopsThemeForm - */ - public function getForm($action = false) - { - $xoops = Xoops::getInstance(); - $form = $xoops->getModuleForm($this, 'field', 'profile'); - if ($action === false) { - $action = $_SERVER['REQUEST_URI']; - } - $form->setAction($action); - return $form; - } - - /** * Extra treatment dealing with non latin encoding * Tricky solution * @@ -477,7 +459,7 @@ * @param bool $force whether to force the query execution despite security settings * @return bool FALSE if failed, TRUE if already present and unchanged or successful */ - public function insert(XoopsObject $obj, $force = false) + public function insertFields(XoopsObject $obj, $force = false) { $xoops = Xoops::getInstance(); $profile_handler = $xoops->getModuleHandler('profile', 'profile'); @@ -605,7 +587,7 @@ * @param bool $force * @return bool FALSE if failed. **/ - public function delete(XoopsObject $obj, $force = false) + public function deleteFields(XoopsObject $obj, $force = false) { $xoops = Xoops::getInstance(); $profile_handler = $xoops->getModuleHandler('profile', 'profile'); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -16,12 +16,14 @@ * @version $Id$ */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + class ProfileCategoryForm extends XoopsThemeForm { /** * @param ProfileCategory|XoopsObject $obj */ - public function __construct(ProfileCategory $obj) + public function __construct(ProfileCategory &$obj) { $title = $obj->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_CATEGORY) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_CATEGORY); @@ -36,7 +38,5 @@ $this->addElement(new XoopsFormHidden('op', 'save') ); $this->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit', 'btn primary formButton')); - - return $this; } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/regstep.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/regstep.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/regstep.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -33,24 +33,6 @@ $this->initVar('step_order', XOBJ_DTYPE_INT, 1); $this->initVar('step_save', XOBJ_DTYPE_INT, 0); } - - /** - * Get {@link XoopsThemeForm} for adding/editing steps - * - * @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] - * - * @return XoopsThemeForm - */ - public function getForm($action = false) - { - $xoops = Xoops::getInstance(); - $form = $xoops->getModuleForm($this, 'regstep', 'profile'); - if ($action === false) { - $action = $_SERVER['REQUEST_URI']; - } - $form->setAction($action); - return $form; - } } class ProfileRegstepHandler extends XoopsPersistableObjectHandler @@ -72,7 +54,7 @@ * * @return bool */ - public function delete(XoopsObject $obj, $force = false) + public function deleteRegstep(XoopsObject $obj, $force = false) { if (parent::delete($obj, $force)) { $xoops = Xoops::getInstance(); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -238,7 +238,9 @@ array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]); $title = isset($categories[$k]) ? $categories[$k]['cat_title'] : _PROFILE_MA_DEFAULT; $desc = isset($categories[$k]) ? $categories[$k]['cat_description'] : ""; - $form->addElement(new XoopsFormLabel("<h3>{$title}</h3>", $desc), false); + //$form->addElement(new XoopsFormLabel("<div class='break'>{$title}</div>", $desc), false); + $desc = ($desc != '' ? ' - ' . $desc : ''); + $form->insertBreak($title . $desc); foreach (array_keys($elements[$k]) as $i) { $form->addElement($elements[$k][$i]['element'], $elements[$k][$i]['required']); } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/language/english/admin.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/language/english/admin.php 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/language/english/admin.php 2012-06-27 20:16:21 UTC (rev 9732) @@ -115,4 +115,7 @@ define('_PROFILE_AM_ACTION', 'Action'); //Since 2.6 -define("_PROFILE_AM_CANNOTDEACTIVATEWEBMASTERS", "Deactivating an administrator account is not allowed"); \ No newline at end of file +define("_PROFILE_AM_CANNOTDEACTIVATEWEBMASTERS", "Deactivating an administrator account is not allowed"); +define("_PROFILE_AM_CATEGORY_LIST", "List of categories"); +define("_PROFILE_AM_STEP_LIST", "List of registration step"); +define("_PROFILE_AM_FIELD_LIST", "List of fields"); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/categorylist.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/categorylist.html 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/categorylist.html 2012-06-27 20:16:21 UTC (rev 9732) @@ -1,9 +1,6 @@ -<div class="pull-right spacer"> - <a class="btn primary tooltip" href="category.php?op=new" title="<{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_CATEGORY}>"> - <span class="icon icon-folder-add"></span> - <{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_CATEGORY}> - </a> -</div> +<{includeq file="admin:system|admin_navigation.html"}> +<{includeq file="admin:system|admin_buttons.html"}> +<{if $category}> <table class="outer"> <thead> <tr> @@ -20,7 +17,7 @@ <td class="txtleft"><{$category.cat_description}></td> <td class="txtcenter width5"><{$category.cat_weight}></td> <td class="xo-actions txtcenter width5"> - <a href="category.php?id=<{$category.cat_id}>" title="<{$smarty.const._EDIT}>"> + <a href="category.php?op=edit&id=<{$category.cat_id}>" title="<{$smarty.const._EDIT}>"> <img src="<{xoAdminIcons edit.png}>" alt="<{$smarty.const._EDIT}>"> </a> <a href="category.php?op=delete&id=<{$category.cat_id}>" title="<{$smarty.const._DELETE}>"> @@ -30,4 +27,9 @@ </tr> <{/foreach}> </tbody> -</table> \ No newline at end of file +</table> +<{/if}> +<!-- Display form (add,edit) --> +<{if $form}> +<{includeq file="module:system|system_form.html"}> +<{/if}> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/fieldlist.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/fieldlist.html 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/fieldlist.html 2012-06-27 20:16:21 UTC (rev 9732) @@ -1,10 +1,6 @@ -<div class="pull-right spacer"> - <a class="btn primary tooltip" href="field.php?op=new" title="<{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_FIELD}>"> - <span class="icon icon-textfield-add"></span> - <{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_FIELD}> - </a> -</div> -<div class="clear"></div> +<{includeq file="admin:system|admin_navigation.html"}> +<{includeq file="admin:system|admin_buttons.html"}> +<{if $fieldlist}> <form action="field.php" method="post" id="fieldform"> <table class="outer"> <thead> @@ -41,7 +37,7 @@ <input type="hidden" name="oldweight[<{$field.field_id}>]" value="<{$field.field_weight}>" /> <input type="hidden" name="oldcat[<{$field.field_id}>]" value="<{$field.cat_id}>" /> <input type="hidden" name="field_ids[]" value="<{$field.field_id}>" /> - <a href="field.php?id=<{$field.field_id}>" title="<{$smarty.const._EDIT}>"> + <a href="field.php?op=edit&id=<{$field.field_id}>" title="<{$smarty.const._EDIT}>"> <img src="<{xoAdminIcons edit.png}>" alt="<{$smarty.const._EDIT}>"> </a> <{/if}> @@ -59,14 +55,17 @@ <tr class="<{cycle values='odd, even'}>"> <td colspan="5"> </td> - <td> + <td colspan="2"> <{$token}> <input type="hidden" name="op" value="reorder" /> <input class="btn primary" type="submit" name="submit" value="<{$smarty.const._SUBMIT}>" /> </td> - <td colspan="2"> - </td> </tr> </tfoot> </table> -</form> \ No newline at end of file +</form> +<{/if}> +<!-- Display form (add,edit) --> +<{if $form}> +<{includeq file="module:system|system_form.html"}> +<{/if}> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/steplist.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/steplist.html 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/steplist.html 2012-06-27 20:16:21 UTC (rev 9732) @@ -1,14 +1,17 @@ -<div class="pull-right spacer"> - <a class="btn primary tooltip" href="step.php?op=new" title="<{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_STEP}>"> - <span class="icon icon-chart-bar-add"></span> - <{$smarty.const._ADD}> <{$smarty.const._PROFILE_AM_STEP}> - </a> -</div> -<div class="clear"></div> +<script type="text/javascript"> + Xoops.setStatusImg('accept', '<{xoAdminIcons success.png}>'); + Xoops.setStatusImg('cancel', '<{xoAdminIcons cancel.png}>'); + Xoops.setStatusText('accept', '<{$smarty.const._NO}>'); + Xoops.setStatusText('cancel', '<{$smarty.const._YES}>'); +</script> +<{includeq file="admin:system|admin_navigation.html"}> +<{includeq file="admin:system|admin_buttons.html"}> +<{if $step}> <table class="outer"> <thead> <tr> <th><{$smarty.const._PROFILE_AM_STEPNAME}></th> + <th class="txtleft"><{$smarty.const._PROFILE_AM_DESCRIPTION}></th> <th><{$smarty.const._PROFILE_AM_STEPORDER}></th> <th><{$smarty.const._PROFILE_AM_STEPSAVE}></th> <th></th> @@ -17,11 +20,15 @@ <tbody> <{foreach item=step from=$steps}> <tr class="<{cycle values='odd, even'}>"> - <td><{$step.step_name}></td> + <td class="txtcenter width20"><{$step.step_name}></td> + <td class="txtleft"><{$step.step_desc}></td> <td class="txtcenter width10"><{$step.step_order}></td> - <td class="txtcenter width10"><{if $step.step_save == 1}><img src="<{xoAppUrl modules/profile/images/yes.png}>" alt="<{$smarty.const._YES}>" /><{else}><img src="<{xoAppUrl modules/profile/images/no.png}>" alt="<{$smarty.const._NO}>" /><{/if}></td> + <td class="xo-actions txtcenter width10"> + <img id="loading_sml<{$step.step_id}>" src="<{xoAppUrl media/xoops/images/spinner.gif}>" style="display:none;" alt="<{$smarty.const._AM_SYSTEM_LOADING}>" /> + <img class="cursorpointer" id="sml<{$step.step_id}>" onclick="Xoops.changeStatus( 'step.php', { op: 'step_update', id: <{$step.step_id}> }, 'sml<{$step.step_id}>', 'step.php' )" src="<{if $step.step_save}><{xoAdminIcons success.png}><{else}><{xoAdminIcons cancel.png}><{/if}>" alt="<{if $step.step_save}><{$smarty.const._NO}><{else}><{$smarty.const._YES}><{/if}>" title="<{if $step.step_save}><{$smarty.const._NO}><{else}><{$smarty.const._YES}><{/if}>" /> + </td> <td class="xo-actions txtcenter width5"> - <a href="step.php?id=<{$step.step_id}>" title="<{$smarty.const._EDIT}>"> + <a href="step.php?op=edit&id=<{$step.step_id}>" title="<{$smarty.const._EDIT}>"> <img src="<{xoAdminIcons edit.png}>" alt="<{$smarty.const._EDIT}>"> </a> <a href="step.php?op=delete&id=<{$step.step_id}>" title="<{$smarty.const._DELETE}>"> @@ -31,4 +38,9 @@ </tr> <{/foreach}> </tbody> -</table> \ No newline at end of file +</table> +<{/if}> +<!-- Display form (add,edit) --> +<{if $form}> +<{includeq file="module:system|system_form.html"}> +<{/if}> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_userinfo.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_userinfo.html 2012-06-26 21:56:24 UTC (rev 9731) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_userinfo.html 2012-06-27 20:16:21 UTC (rev 9732) @@ -13,7 +13,7 @@ <{/if}> <{if !$user_ownpage && $xoops_isuser == true}> <form name="usernav" action="user.php" method="post"> - <input type="button" value="<{$smarty.const._PROFILE_MA_SENDPM}>" onclick="javascript:openWithSelfMain('<{$xoops_url}>/pmlite.php?send2=1&to_userid=<{$user_uid}>', 'pmlite', 450, 380);" /> + <input class="btn" type="button" value="<{$smarty.const._PROFILE_MA_SENDPM}>" onclick="javascript:openWithSelfMain('<{$xoops_url}>/pmlite.php?send2=1&to_userid=<{$user_uid}>', 'pmlite', 450, 380);" /> </form> <{/if}> </div> @@ -23,10 +23,10 @@ <{if $user_ownpage == true}> <div class="floatleft pad5"> <form name="usernav" action="user.php" method="post"> - <input type="button" value="<{$lang_editprofile}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/edituser.php'" /> - <input type="button" value="<{$lang_changepassword}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/changepass.php'" /> + <input class="btn" type="button" value="<{$lang_editprofile}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/edituser.php'" /> + <input class="btn" type="button" value="<{$lang_changepassword}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/changepass.php'" /> <{if $user_changeemail}> - <input type="button" value="<{$smarty.const._PROFILE_MA_CHANGEMAIL}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/changemail.php'" /> + <input class="btn" type="button" value="<{$smarty.const._PROFILE_MA_CHANGEMAIL}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/changemail.php'" /> <{/if}> <{if $user_candelete == true}> @@ -37,10 +37,10 @@ </form> <{/if}> <{if $avatars == true}> - <input type="button" value="<{$lang_avatar}>" onclick="location='edituser.php?op=avatarform'" /> + <input class="btn" type="button" value="<{$lang_avatar}>" onclick="location='edituser.php?op=avatarform'" /> <{/if}> - <input type="button" value="<{$lang_inbox}>" onclick="location='<{$xoops_url}>/viewpmsg.php'" /> - <input type="button" value="<{$lang_logout}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/user.php?op=logout'" /> + <input class="btn" type="button" value="<{$lang_inbox}>" onclick="location='<{$xoops_url}>/viewpmsg.php'" /> + <input class="btn" type="button" value="<{$lang_logout}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/user.php?op=logout'" /> </form> </div> <{elseif $xoops_isadmin != false}> @@ -64,7 +64,7 @@ <{foreach item=category from=$categories}> <{if isset($category.fields)}> <div class="profile-list-category" id="profile-category-<{$category.cat_id}>"> - <table class="outer" cellpadding="4" cellspacing="1"> + <table class="outer"> <tr> <th class="txtcenter" colspan="2"><{$category.cat_title}></th> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |