1: <?php
2: 3: 4: 5: 6:
7:
8: if (!defined('XOOPS_ROOT_PATH')) exit();
9:
10: require_once XOOPS_MODULE_PATH . "/profile/class/AbstractEditAction.class.php";
11:
12: class Profile_Admin_DefinitionsEditAction extends Profile_AbstractEditAction
13: {
14: var $mTypeArr = array();
15: var $mValidationArr = array();
16:
17: 18: 19:
20: function _getId()
21: {
22: return intval(xoops_getrequest('field_id'));
23: }
24:
25: 26: 27:
28: function &_getHandler()
29: {
30: $handler =& $this->mAsset->load('handler', "definitions");
31: return $handler;
32: }
33:
34: 35: 36:
37: function _setupActionForm()
38: {
39:
40: $this->mActionForm =& $this->mAsset->create('form', "admin.edit_definitions");
41: $this->mActionForm->prepare();
42: }
43:
44: 45: 46: 47: 48: 49: 50:
51: protected function _setHeaderScript()
52: {
53: $headerScript = $this->mRoot->mContext->getAttribute('headerScript');
54: $type = $this->mActionForm->get('type');
55: $headerScript->addStylesheet('/modules/profile/style.css');
56: $headerScript->addScript('
57: $(".optionField input, .optionField select, .optionField textarea").attr("disabled", "disabled");
58: $(".optionField").addClass("hideOption");
59: $("#fieldtype_'. $type .'").removeClass("hideOption");
60: $("#fieldtype_'. $type .' input, #fieldtype_'. $type .' select, #fieldtype_'. $type .' textarea").removeAttr("disabled");
61: $("#legacy_xoopsform_type").change(function(){
62: $(".optionField").addClass("hideOption");
63: $("#fieldtype_"+$(this).val()).removeClass("hideOption");
64: $("#fieldtype_"+$(this).val()+" input, #fieldtype_"+$(this).val()+" select, #fieldtype_"+$(this).val()+" textarea").removeAttr("disabled");
65: });'
66: );
67: }
68:
69: 70: 71:
72: function prepare()
73: {
74: parent::prepare();
75: $handler =& $this->_getHandler();
76: $this->mTypeArr = $handler->getTypeList();
77: $this->mValidationArr = $handler->getValidationList();
78: }
79:
80: 81: 82:
83: function executeViewInput(&$render)
84: {
85: $gHandler =& xoops_gethandler('group');
86:
87: $render->setTemplateName("definitions_edit.html");
88: $render->setAttribute('actionForm', $this->mActionForm);
89: $render->setAttribute('object', $this->mObject);
90: $render->setAttribute('groupArr', $gHandler->getObjects());
91: $render->setAttribute('accessArr', explode(',', $this->mObject->get('access')));
92: $render->setAttribute('typeArr', $this->mTypeArr);
93: $render->setAttribute('validationArr', $this->mValidationArr);
94: $this->_setHeaderScript();
95: }
96:
97: 98: 99:
100: function executeViewSuccess(&$render)
101: {
102: $this->mRoot->mController->executeForward("./index.php?action=DefinitionsList");
103: }
104:
105: 106: 107:
108: function executeViewError(&$render)
109: {
110: $this->mRoot->mController->executeRedirect("./index.php?action=DefinitionsList", 1, _MD_PROFILE_ERROR_DBUPDATE_FAILED);
111: }
112:
113: 114: 115:
116: function executeViewCancel(&$render)
117: {
118: $this->mRoot->mController->executeForward("./index.php?action=DefinitionsList");
119: }
120: }
121:
122: ?>
123: