Página de soporte de WaihonaPedia

Información del documento


Padre

Título

Contenido

//

    //
      shortcut.add("e",function() { location.href=$('tmEdit').down('a').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
              shortcut.add("k",function() { location.href=$('tmEditWiki').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
        shortcut.add("g",function() { location.href=$('tmEditWysiwyg').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
        shortcut.add("f",function() { location.href=$('tmEditInline').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
        shortcut.add("r",function() { location.href=$('tmEditRights').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
        shortcut.add("o",function() { location.href=$('tmEditObject').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
                  shortcut.add("s",function() { location.href=$('tmEditClass').href; }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
                 
   
//

//

    //
      shortcut.add("d", function() {
        location.href = $('tmViewSource').href;
      }, {'type': 'keypress', 'propagate': false, 'disable_in_input': true });
   
   
//

//

//
document.writeln("<div class='leftmenu2 clearfix'>");
  addButton('/xwiki/resources/icons/silk/text_bold.png', 'Negrita', '**', '**', 'Texto en negrita');
  addButton('/xwiki/resources/icons/silk/text_italic.png', 'Cursiva', '\/\/', '\/\/', 'Texto en cursiva');
  addButton('/xwiki/resources/icons/silk/text_underline.png', 'Subrayado', '__', '__', 'Texto Subrayado');
  addButton('/xwiki/resources/icons/silk/text_strikethrough.png', 'Tachado', '--', '--', 'Tachado');
  addButton('/xwiki/resources/icons/silk/text_subscript.png', 'Sub\u00EDndice', ',,', ',,', 'Texto en sub\u00EDndice');
  addButton('/xwiki/resources/icons/silk/text_superscript.png', 'Super\u00EDndice', '^^', '^^', 'Texto en super\u00EDndice');
  addButton('/xwiki/resources/icons/silk/text_list_bullets.png', 'Lista con vi\u00F1etas', '\\r\\n* ', '\\r\\n* Elemento de la lista\\r\\n* Elemento de la lista\\r\\n', 'Elemento de la lista');
  addButton('/xwiki/resources/icons/silk/text_list_numbers.png', 'Lista numerada', '\\r\\n1. ', '\\r\\n1. Elemento de la lista\\r\\n1. Elemento de la lista\\r\\n', 'Elemento de la lista');
  addButton('/xwiki/resources/icons/silk/link.png', 'Enlace interno', '[[', ']]', 'Ejemplo de enlace');
  addButton('/xwiki/resources/icons/silk/link_go.png', 'Enlace externo (no olvide http:\/\/)', '[[', ']]', 'nombre del enlace>>http:\/\/www.ejemplo.com');
  addButton('/xwiki/resources/icons/silk/text_heading_1.png', 'Encabezado 1', '\\r\\n= ', '=\\r\\n', 'Encabezado 1');
  addButton('/xwiki/resources/icons/silk/text_heading_2.png', 'Encabezado 2', '\\r\\n== ', '==\\r\\n', 'Encabezado 2');
  addButton('/xwiki/resources/icons/silk/text_heading_3.png', 'Encabezado 3', '\\r\\n=== ', '===\\r\\n', 'Encabezado 3');
  addButton('/xwiki/resources/icons/silk/text_heading_4.png', 'Encabezado 4', '\\r\\n==== ', '====\\r\\n', 'Encabezado 4');
  addButton('/xwiki/resources/icons/silk/text_horizontalrule.png', 'L\u00EDnea horizontal', '\\r\\n----\\r\\n', '', '');
  addButton('/xwiki/resources/icons/silk/image.png', 'Imagen adjuntada', '[[image:', ']]', 'ejemplo.jpg');
  addButton('/xwiki/resources/icons/silk/html.png', 'C\u00F3digo HTML', '\\r\\n{{html}}\\r\\n', '\\r\\n{{\/html}}\\r\\n', '<!-- Su c\u00F3digo HTML aqu\u00ED --> ');
  addButton('/xwiki/resources/icons/silk/cog.png', 'C\u00F3digo Velocity', '\\r\\n{{velocity}}\\r\\n', '\\r\\n{{\/velocity}}\\r\\n', '#* Su c\u00F3digo velocity aqu\u00ED *# ');
document.writeln("<" + "/div>");
//

//

Maximizar NegritaCursivaSubrayadoTachadoSubíndiceSuperíndiceLista con viñetasLista numeradaEnlace interno','Ejemplo de enlace');]]>http://www.ejemplo.com');">Enlace externo (no olvide http://)','nombre del enlace]]Encabezado 1Encabezado 2Encabezado 3Encabezado 4Línea horizontalImagen adjuntada ');">Código HTMLCódigo Velocity

{{include document="CdlsatdCode.Macros"/}} {{velocity}} $xwiki.ssx.use('CDLS-dependancies-2014.registration-ssx') $xwiki.jsx.use('CDLS-dependancies-2014.select-refacing-jsx') $xwiki.ssx.use('CDLS-dependancies-2014.select-refacing-ssx') ## These are defined in other places around XWiki, changing them here will result in undefined behavior. #set($redirectParam = 'xredirect') #set($userSpace = 'XWiki.') #set($loginPage = 'XWiki.XWikiLogin') #set($loginAction = 'loginsubmit') ## #set($documentName = 'XWiki.Registration') #set($ok = $xwiki.ssx.use($doc.fullName)) #set($ok = $xwiki.jsx.use($doc.fullName))## ## Security measure: ## If this document is changed such that it must have programming permission in order to run, change this to false. #set($sandbox = false) ## ## Load the configuration from a seperate document. #loadConfig('CdlsatdCode.RegistrationConfig') ## ## Defines what server generated error messages should look like ## The error message when a field is entered incorrectly #set($failureMessageParams = { 'class' : 'LV_validation_message LV_invalid'}) ## 'LV_validation_message LV_invalid' depends on this: $xwiki.get('ssfx').use('uicomponents/widgets/validation/livevalidation.css') ## ## The * next to the fields to denote they are mandatory. #set($fieldMandatoryStar = $failureMessageParams) ## #* * You may include this document in other documents using {{include document="XWiki.Registration"/}} * To specify that the user is invited and should be allowed to register even if Guest does not have permission to * register, set $invited to true. NOTE: The including script must have programming permission to do this. * * To specify some code which should run after registration is successfully completed, set * $doAfterRegistration to a define block of velocity code like so: * #define($doAfterRegistration) * some code * #end * Output from running this code will not be printed. * * The fields which will be seen on the registration page are defined here. * $fields is an array and each field is a Map. The names shown below are Map keys. * * Each field must have: * name - this is the name of the field, it will be the value for "name" and "id" * * Each field may have: * label - this String will be written above the field. * * tag - the HTML tag which will be created, default is <input>, may also be a non form tag such as <img> * * params - a Map, each key value pair will be in the html tag. eg: {"size" : "30"} becomes <input size=30... * * validate a Map describing how to validate the field, validation is done in javascript then redone in velocity * | for security and because not everyone has javascript. * | * +-mandatory (Optional) - Will fail if the field is not filled in. * | +-failureMessage (Required) - The message to display if the field is not filled in. * | +-noscript (Optional) - will not be checked by javascript * | * +-regex (Optional) - Will validate the field using a regular expression. * | | because of character escaping, you must provide a different expression for the * | | javascript validation and the server side validation. Both javascript and server side * | | validation are optional, but if you provide neither, then your field will not be validated. * | | * | +-failureMessage (Optional) - The message to display if the regex evaluation returns false. * | +-jsFailureMessage (Optional) - The message for Javascript to display if regex fails. * | | If jsFailureMessage is not defined Javascript uses failureMessage. * | | NOTE: Javascript injects the failure message using createTextNode so &lt; will * | | be displayed as &lt; * | | * | +-pattern (Optional) - The regular expression to test the input at the server side, it's important to use * | | this if you need to validate the field for security reasons, also it is good because not * | | all browsers use javascript or have it enabled. * | | * | +-jsPattern (Optional) - The regular expression to use for client side, you can use escaped characters to avoid * | | them being parsed as HTML or javascript. To get javascript to unescape characters use: * | | {"jsPattern" : "'+unescape('%5E%5B%24')+'"} * | | NOTE: If no jsPattern is specified, the jsValidator will try to validate * | | using the server pattern. * | | * | +-noscript (Optional) - will not be checked by javascript * | * +-mustMatch (Optional) - Will fail if the entry into the field is not the same as the entry in another field. * | | Good for password confirmation. * | | * | +-failureMessage (Required) - The message to display if the field doesn't match the named field. * | +-name (Required) - The name of the field which this field must match. * | +-noscript (Optional) - will not be checked by javascript * | * +-programmaticValidation (Optional) - This form of validation executes a piece of code which you give it and * | | if the code returns the word "failed" then it gives the error message. * | | Remember to put the code in singel quotes ('') because you want the value * | | of 'code' to equal the literal code, not the output from running it. * | | * | +-code (Required) - The code which will be executed to test whether the field is filled in correctly. * | +-failureMessage (Required) - The message which will be displayed if evaluating the code returns "false" * | * +-fieldOkayMessage (Optional) - The message which is displayed by LiveValidation when a field is validated as okay. * If not specified, will be $defaultFieldOkayMessage * * noReturn - If this is specified, the field will not be filled in if there is an error and the user has to fix their * registration information. If you don't want a password to be passed back in html then set this true * for the password fields. Used for the captcha because it makes no sense to pass back a captcha answer. * * doAfterRegistration - Some Velocity code which will be executed after a successfull registration. * This is used in the favorite color example. * Remember to put the code in singel quotes ('') because you want the 'code' entry to equal the literal * code, not the output from running it. * * Each field may not have: (reserved names) * error - This is used to pass back any error message from the server side code. * * NOTE: This template uses a registration method which requires: * * register_first_name * * register_last_name * * xwikiname * * register_password * * register2_password * * register_email * * template * Removing or renaming any of these fields will result in undefined behavior. * *### #set($fields = []) ## ## The first name field, no checking. #set($field = {'name' : 'register_first_name', 'label' : $msg.get('core.register.firstName'), 'params' : { 'type' : 'text', 'size' : '30', 'tabindex' : '14' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') } } }) #set($discard = $fields.add($field)) ## ## The last name field, no checking. #set($field = {'name' : 'register_last_name', 'label' : $msg.get('core.register.lastName'), 'params' : { 'type' : 'text', 'size' : '30', 'tabindex' : '15' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'mustNotMatch' : { 'name' : 'register_first_name', 'failureMessage' : $msg.get('cdls.register.firstNameLastName') } } }) #set($discard = $fields.add($field)) ## ## The user name field, mandatory and programmatically checked to make sure the username doesn't exist. #set($field = {'name' : 'xwikiname', 'label' : $msg.get('core.register.username'), 'params' : { 'type' : 'text', 'onfocus' : 'prepareName(document.forms.register);', 'size' : '20', 'tabindex' : '16' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'programmaticValidation' : { 'code' : '#nameAvailable($request.get("xwikiname"))', 'failureMessage' : $msg.get('core.register.userAlreadyExists') } } }) #set($discard = $fields.add($field)) ## Make sure the chosen user name is not already taken ## This macro is called by programmaticValidation for xwikiname (above) #macro(nameAvailable, $name) #if($xwiki.exists("$userSpace$name")) failed #end #end ## ##The password field, mandatory and must be at least 6 characters long. #set($field = {'name' : 'register_password', 'label' : $msg.get('core.register.password'), 'params' : { 'type' : 'password', 'size' : '10', 'tabindex' : '17' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'regex' : { 'pattern' : '/.{6,}/', 'failureMessage' : $msg.get('xe.admin.registration.passwordTooShort') } } }) #set($discard = $fields.add($field)) ## ##The confirm password field, mandatory, must match password field, and must also be 6+ characters long. #set($field = {'name' : 'register2_password', 'label' : $msg.get('core.register.passwordRepeat'), 'params' : { 'type' : 'password', 'size' : '10', 'tabindex' : '18' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'mustMatch' : { 'name' : 'register_password', 'failureMessage' : $msg.get('xe.admin.registration.passwordMismatch') }, 'regex' : { 'pattern' : '/.{6,}/', 'failureMessage' : $msg.get('xe.admin.registration.passwordTooShort') } } }) #set($discard = $fields.add($field)) ## ## The email address field, regex checked with an email pattern. #set($field = {'name' : 'register_email', 'label' : $msg.get('core.register.email'), 'params' : { 'type' : 'text', 'size' : '30', 'tabindex' : '19' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'regex' : { 'pattern' : '/^([^@\s]+)@((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})$/', 'failureMessage' : $msg.get('xe.admin.registration.invalidEmail') } } }) #set($discard = $fields.add($field)) #set($countriesOptions = []) #generateCountries($countriesOptions) ## from the macros #set($field = {'name' : 'register_country', 'label' : $msg.get('cdls.register.country'), 'tag' : 'select', 'params' : { 'size' : '1', 'tabindex' : '251', 'options' : $countriesOptions }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') } } }) #set($discard = $fields.add($field)) #set($field = {'name' : 'register_default_language', 'label' : $msg.get('cdls.register.language'), 'tag' : 'select', 'params' : { 'size' : '1', 'tabindex' : '263', 'options' : $xwiki.getXWikiPreference("languages").split(",") }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') } }, 'doAfterRegistration' : '#addCsldUserProfile()' }) #set($discard = $fields.add($field)) #macro(addCsldUserProfile) #set($xwikiname = $request.get('xwikiname')) #set($cdlsProfileDoc = $xwiki.getDocumentAsAuthor("CdlsatdPrivate.$!{xwikiname}_profile")) #set($profileObj = $cdlsProfileDoc.getObject('CdlsatdCode.CdLS_ATD_UserProfileClass', true)) #set($discard = $profileObj.set("contextUsr", "XWiki.$!{xwikiname}")) ## add rights for the user #set($userRightObj = $cdlsProfileDoc.getObject('XWiki.XWikiRights', true)) #set($ok = $userRightObj.set('allow', '1')) #set($ok = $userRightObj.set('users', "XWiki.${xwikiname}")) #set($ok = $userRightObj.set('levels', 'edit')) #set($ok = $cdlsProfileDoc.createNewObject('XWiki.XWikiRights')) #set($userRightObj = $cdlsProfileDoc.getObject('XWiki.XWikiRights', true)) #set($ok = $userRightObj.set('allow', '1')) #set($ok = $userRightObj.set('groups', 'XWiki.XWikiAdminGroup')) #set($ok = $userRightObj.set('levels', 'edit')) #set($ok = $cdlsProfileDoc.setContent('{{include document="CdlsatdCode.CdLS_ATD_UserProfileClassSheet"/}}')) $cdlsProfileDoc.saveAsAuthor("Add cdls profile object.") #end ## #* ## Uncomment this code to see an example of how you can easily add a field to the registration page ## Note: The user's favorite color is not saved anywhere, see above for information on how to save it. #set($field = {'name' : 'favorite_color', 'label' : 'What is your favorite color', 'params' : { 'type' : 'text', 'size' : '25' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('xe.admin.registration.fieldMandatory') }, 'regex' : { 'pattern' : '/^green$/i', 'failureMessage' : 'You are not cool enough to register here.' }, 'fieldOkayMessage' : 'You are awesome.' }, 'doAfterRegistration' : '#saveFavoriteColor()' }) #set($discard = $fields.add($field)) ## Save the user's favorite color on their user page. #macro(saveFavoriteColor) #set($xwikiname = $request.get('xwikiname')) #set($userDoc = $xwiki.getDocument("$userSpace$xwikiname")) $userDoc.setContent("$userDoc.getContent() ${xwikiname}'s favorite color is $request.get('favorite_color')!") ## The user (who is not yet logged in) can't save documents so saveWithProgrammingRights ## will save the document as long as the user who last saved this registration page has programming rights. $userDoc.saveWithProgrammingRights("Saved favorite color from registration form.") #end ## *### ## To disable the captcha on this page, comment out the next two entries. ## The captcha image, not an input field but still defined the same way. #if($captchaservice && !$invited && $xcontext.getUser() == "XWiki.XWikiGuest" && $requireCaptcha) ## Empty label field used for padding. ## Empty 'name' field overriddes name="captcha_image" with "" so name is not specified at all. #set($field = {'name' : 'captcha_image', 'label' : '', 'tag' : 'img', 'params' : { 'src' : $doc.getURL('imagecaptcha'), 'alt' : $msg.get('core.captcha.image.alternateText', [$msg.get('core.register.submit')]), 'name' : '' } }) #set($discard = $fields.add($field)) ## The captcha field, mandatory, programmatically checked to make sure the captcha is right ## Not checked by javascript because javascript can't check the captcha and the Ok message because it passes the ## mandatory test is misleading. ## and not filled back in if there is an error ('noReturn') #set($field = {'name' : 'captcha_answer', 'label' : $msg.get('core.captcha.image.instruction'), 'params' : { 'type' : 'text', 'size' : '30', 'tabindex' : '263' }, 'validate' : { 'mandatory' : { 'failureMessage' : $msg.get('core.captcha.captchaAnswerIsWrong'), 'noscript' : true }, 'programmaticValidation' : { 'code' : '#checkCaptcha($request, $request.get("captcha_answer"))', 'failureMessage' : $msg.get('core.captcha.captchaAnswerIsWrong') } }, 'noReturn' : true }) #set($discard = $fields.add($field)) #end ## ## Checks the captcha answer; used by programmaticValidation above. #macro(checkCaptcha, $request, $answer) #set($cv = $captchaservice.getCaptchaVerifier('image')) #if(!$cv.isAnswerCorrect($cv.getUserId($request), $answer)) failed #end #end ## ## Pass the redirect parameter on so that the login page may redirect to the right place. ## Not necessary in Firefox 3.0.10 or Opera 9.64, I don't know about IE or Safari. #set($field = {'name' : $redirectParam, 'params' : { 'type' : 'hidden' } }) #set($discard = $fields.add($field)) ## ####################################################################### ## The Code. ####################################################################### ## #if($useLiveValidation) $xwiki.get('jsfx').use('uicomponents/widgets/validation/livevalidation_prototype.js') $xwiki.get('ssfx').use('uicomponents/widgets/validation/livevalidation.css') #end ## This application's HTML is dynamically generated and editing in WYSIWYG would not work #if($xcontext.getAction() == 'edit') $response.sendRedirect("$xwiki.getURL($doc.getFullName(), 'edit')?editor=wiki") #end ## ## If this document has PR and is not included from another document then it's author should be set to Guest ## for the duration of it's execution in order to improve security. ## Note we compare document ids because #if($sandbox && $xcontext.hasProgrammingRights() && $xcontext.getDoc().getDocumentReference().equals($xwiki.getDocument($documentName).getDocumentReference())) ## #set($discard = $xcontext.getDoc().setAuthor('XWiki.XWikiGuest')) #end ## ## Access level to register must be explicitly checked because it is only checked in XWiki.prepareDocuments ## and this page is accessible through view action. #if(!$xcontext.hasAccessLevel('register', 'XWiki.XWikiPreferences')) ## Make an exception if another document with programming permission (Invitation app) has included this ## document and set $invited to true. #if(!$invited || !$xcontext.hasProgrammingRights()) $response.sendRedirect("$xwiki.getURL($doc.getFullName(), 'login')") #end #end ## If this is true, then assume the registration page is being viewed inside of a lightbox #if($request.get('xpage')) #set($assumeLightbox = true) #end ## ## Display the heading $heading ## If the submit button has been pressed, then we test the input and maybe create the user. #if($request.getParameter('xwikiname')) ## Do server side validation of input fields. #set($discard = "#validateFields($fields, $request)") ## If server side validation was successfull, create the user #if(!$registrationFailed) #createUser($fields, $request, $response, $doAfterRegistration) #end #end ## If the registration was not successful or if the user hasn't submitted the info yet ## Then we display the registration form. #if(!$registrationDone) $welcomeMessage {{html clean=false wiki=false}} <form id="register" action="" method="post"> <div> <input type="hidden" id="language" name="language" value="$!context.language" /> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> #generateHtml($fields, $fieldMandatoryStar, $failureMessageParams) <div class="wikimodel-emptyline"></div> <span class="buttonwrapper"> #if($assumeLightbox) ## LightBox detected... <script type="text/javascript"> ## Make the X button not reload the page. (overriding LbClose) window.lb.lbClose = function() { this.lbHide(); this.lbClearData(); ##return false; } ## Post the form entry to the page and load the result. (we override lbSaveForm) window.lb.lbSaveForm = function() { var formParams = Form.serialize(this.form); Form.disable(this.form); var ajaxRequest = new Ajax.Request(this.saveUrl, { parameters: formParams, asynchronous: false }); window.lb.lbFormDataLoaded(ajaxRequest.transport); } </script> ## It doesn't really matter where these are, the scripts will be relocated to the head. <!-- com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin --> <!-- com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin --> ## <input class="button" type="submit" value="$services.localization.render('save')" onclick="window.lb.lbSaveForm();"/> </span>#* End ButtonWrapper then start another...*#<span class="buttonwrapper"> <input class="button" type="submit" value="$services.localization.render("cancel")" onclick="Form.disable(window.lb.form); window.lb.lbClose();"/> #else ## Not using the LightBox <input type="submit" value="$services.localization.render('applypage_button')" class="button" tabindex="264" /> #end </span>## ButtonWrapper </div> </form> #if($useLiveValidation) #generateJavascript($fields) #end {{/html}} ## ## Allow permitted users to configure this application. #if($xcontext.getUser() != 'XWiki.XWikiGuest' && $xcontext.hasAccessLevel("edit", $documentName)) [[$msg.get('xe.admin.registration.youCanConfigureRegistrationHere')>>XWiki.XWikiPreferences?section=Registration&editor=globaladmin#HCustomizeXWikiRegistration]] {{html}}<a href="$xwiki.getURL($documentName, 'edit', 'editor=wiki')">$msg.get('xe.admin.registration.youCanConfigureRegistrationFieldsHere')</a>{{/html}} #end ## If the registration is done (successful) and we detect the Lightbox simply send the user back to the original page. #elseif($assumeLightbox) {{html clean=false wiki=false}} <script type="text/javascript"> var url = window.lb.redirectUrl; window.lb.lbClose; if (url != undefined) { if(window.location.pathname + window.location.search == url) { ## Under certain circumstances (bug) Opera will not load a page if the location is the same as the current page. ## In these cases, location.reload() doesn't work either, the only solution (I could find) was to change the URL. window.location.href = url + "&"; } else { window.location.href = url; } } </script> {{/html}} #end ## ####### The Macros (nothing below this point is run directly) ######### #* * Server side validation, this is necessary for security and because not everyone has Javascript * * @param $fields The array of fields to validate. * @param $request An XWikiRequest object which made the register request, used to get parameters. *### #macro(validateFields, $fields, $request) #foreach($field in $fields) #if($field.get('validate') && $field.get('name')) #set($fieldName = $field.get('name')) #set($validate = $field.get('validate')) #set($error = '') #set($value = $request.get($fieldName)) #if($value && $value != '') ## ## mustMatch validation #if($error == '' && $validate.get('mustMatch')) #set($mustMatch = $validate.get('mustMatch')) #if($mustMatch.get('name') && $mustMatch.get('failureMessage')) #if($request.get($fieldName) != $request.get($mustMatch.get('name'))) #set($error = $mustMatch.get('failureMessage')) #end #else ERROR: In field: ${fieldName}: mustMatch validation required both name (of field which this field must match) and failureMessage. #end #end ## ## mustNotMatch validation #if($error == '' && $validate.get('mustNotMatch')) #set($mustNotMatch = $validate.get('mustNotMatch')) #if($mustNotMatch.get('name') && $mustNotMatch.get('failureMessage')) #if($request.get($fieldName) == $request.get($mustNotMatch.get('name'))) #set($error = $mustNotMatch.get('failureMessage')) #end #else ERROR: In field: ${fieldName}: mustNotMatch validation required both name (of field which this field must match) and failureMessage. #end #end ## Regex validation ## We won't bother with regex validation if there is no entry, that would defeat the purpose of 'mandatory' #if($error == '' && $validate.get('regex') && $value && $value != '') #set($regex = $validate.get('regex')) #if($regex.get('pattern') && $regex.get('failureMessage')) ## Make Java regexes more compatible with Perl/js style regexes by removing leading and trailing / #if($regex.get('pattern').length() > 1) #set($pattern = $regex.get('pattern').substring(1, $mathtool.add($regex.get('pattern').length(), -1))) #else ## I don't expect this but want to maintain compatibility. #set($pattern = $regex.get('pattern')) #end #if($regextool.find($value, $pattern).isEmpty()) #set($error = $regex.get('failureMessage')) #end #elseif($regex.get('pattern')) ERROR: In field: ${fieldName}: regex validation must include failureMessage. #end #end ## ## If regex and mustMatch validation passed, try programmatic validation #if($error == '' && $validate.get('programmaticValidation')) #set($pv = $validate.get('programmaticValidation')) #if($pv.get('code') && $pv.get('failureMessage')) #set($pvReturn = "#evaluate($pv.get('code'))") #if($pvReturn.indexOf('failed') != -1) #set($error = $pv.get('failureMessage')) #end #else ERROR: In field: ${fieldName}: programmaticValidation requires code and failureMessage #end #end #else ## ## If no content, check if content is mandatory #if($validate.get('mandatory')) #set($mandatory = $validate.get('mandatory')) #if($mandatory.get('failureMessage')) #set($error = $mandatory.get('failureMessage')) #else ERROR: In field: ${fieldName}: mandatory validation requires a failureMessage #end #end #end #if($error != '') #set($discard = $field.put('error', $error)) #set($registrationFailed = true) #end #elseif(!$field.get('name')) ERROR: Field with no name. #end##if(validate) #end##loop #end##macro #* * Create the user. * Calls $xwiki.createUser to create a new user. * * @param $request An XWikiRequest object which made the register request. * @param $response The XWikiResponse object to send any redirects to. * @param $doAfterRegistration code block to run after registration completes successfully. *### #macro(createUser, $fields, $request, $response, $doAfterRegistration) ## CSRF check #if(${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) ## See if email verification is required and register the user. #if($xwiki.getXWikiPreferenceAsInt('use_email_verification', 0) == 1) #set($reg = $xwiki.createUser(true)) #else #set($reg = $xwiki.createUser(false)) #end #else $response.sendRedirect("$!{services.csrf.getResubmissionURL()}") #end ## ## Handle output from the registration. #if($reg && $reg <= 0) {{error}} #if($reg == -2) $msg.get('core.register.passwordMismatch') ## -3 means username taken, -8 means username is superadmin name #elseif($reg == -3 || $reg == -8) $msg.get('core.register.userAlreadyExists') #elseif($reg == -4) $msg.get('core.register.invalidUsername') #else $msg.get('core.register.registerFailed', [$reg]) #end {{/error}} #elseif($reg) ## Registration was successful #set($registrationDone = true) ## ## If there is any thing to "doAfterRegistration" then do it. #foreach($field in $fields) #if($field.get('doAfterRegistration')) #evaluate($field.get('doAfterRegistration')) #end #end ## If there is a "global" doAfterRegistration, do that as well. #if($doAfterRegistration) #set($discard = $doAfterRegistration.toString()) #end ## Define some strings which may be used by autoLogin or loginButton #set($userName = $!request.get('xwikiname')) #set($password = $!request.get('register_password')) #set($loginURL = $xwiki.getURL($loginPage, $loginAction)) #if("$!request.getParameter($redirectParam)" != '') #set($redirect = $request.getParameter($redirectParam)) #else #set($redirect = $defaultRedirect) #end ## Display a "registration successful" message #evaluate($registrationSuccessMessage) ## Empty line prevents message from being forced into a <p> block. ## Give the user a login button which posts their username and password to loginsubmit #if($loginButton) {{html clean=false wiki=false}} <form id="loginForm" action="$loginURL" method="post"> <div> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input id="j_username" name="j_username" type="hidden" value="$escapetool.xml($!userName)" /> <input id="j_password" name="j_password" type="hidden" value="$escapetool.xml($!password)" /> <input id="$redirectParam" name="$redirectParam" type="hidden" value="$escapetool.xml($redirect)" /> <div class="buttonwrapper" style="margin-left:47%;"> <input type="submit" value="$msg.get('login')" class="button"/> </div> </div> </form> ## We don't want autoLogin if we are administrators adding users... #if($autoLogin && !$assumeLightbox) <script type='text/javascript'> document.observe('dom:loaded', function() { document.forms['loginForm'].submit(); }); </script> #end {{/html}} #end #end ## #end## createUser Macro #* * Generate HTML form, this is the only place where HTML is written. * * @param $fields The array of fields to use for generating html code. * @param $fieldMandatoryStar The tag parameters for a * indicating a mandatory field. * @param $failureMessageParams The tag parameters for a failure message. *### #macro(generateHtml, $fields, $fieldMandatoryStar, $failureMessageParams) ## Put the same values back into the fields. #getParams($fields) ## #foreach($field in $fields) <div class="formfield"> #if($field.get('name')) #set($fieldName = $field.get('name')) #if($field.get('label')) #set($label = $field.get('label')) <label for="$fieldName">$label</label> #if($field.get('validate').get('mandatory')) ## <span class="MandatoryStar"></span> #end #end ## If no tag then default tag is <input> #if($field.get('tag')) #set($tag = $field.get('tag')) #else #set($tag = 'input') #end <$tag id="$fieldName" ## #set($params = $field.get('params')) ## If no name parameter is spacified, then we use the field name #if(!$params.get('name')) #set($discard = $params.put('name', $fieldName)) #end #foreach($entry in $params.entrySet()) ## If a parameter is specified as '' then we don't include it. #if($entry.getValue() != '' && $entry.getKey() != 'options') $entry.getKey()="$escapetool.xml($entry.getValue())" ## #end #end > #if($params.get('options')) #set($tagOptions = $params.get('options')) <option value=""> #if("$!{fieldName}" == "register_default_language") $msg.get("cdls.register.language") #else $msg.get("cdls.register.country") #end </option> #foreach($option in $tagOptions) <option value="$option" #if("$!option" == "$!request.language" && "$!{fieldName}" == "register_default_language" || "$!option" == "$!request.register_country" && "$!{fieldName}" == "register_country") selected="selected" #end> #if("$!{fieldName}" == "register_default_language") $msg.get("cdls.register.${fieldName}.${option}") #else $msg.get("lblFlag${option}") #end </option> #end #end </$tag> #if($field.get('error')) <span ## #foreach($entry in $failureMessageParams.entrySet()) $entry.getKey()="$entry.getValue()" ## #end >$field.get('error')</span> #end #else ERROR: Field with no name. #end##if fieldName exists </div> #end #end #* * Generate the Javascript for interacting with LiveValidation. * * @param $fields The array of fields which to validate. *### #macro(generateJavascript, $fields) <script type='text/javascript'> /* <![CDATA[ */ document.observe('dom:loaded', function() { ## #foreach($field in $fields) #if($field.get('validate') && $field.get('name')) #set($validate = $field.get('validate')) #if(($validate.get('mandatory') && !$validate.get('mandatory').get('noscript')) || ($validate.get('regex') && !$validate.get('regex').get('noscript')) || ($validate.get('mustMatch') && !$validate.get('mustMatch').get('noscript')) || ($validate.get('mustNotMatch') && !$validate.get('mustNotMatch').get('noscript'))) #set($fieldName = $field.get('name')) #if($validate.get('fieldOkayMessage')) #set($okayMessage = $validate.get('fieldOkayMessage')) #else #set($okayMessage = $defaultFieldOkayMessage) #end var ${fieldName}Validator = new LiveValidation("$fieldName", { validMessage: "$okayMessage", wait: 500, onlyOnSubmit: true} ); ## #if($validate.get('mandatory')) #set($mandatory = $validate.get('mandatory')) #if($mandatory.get('failureMessage') && !$mandatory.get('noscript')) ${fieldName}Validator.add( Validate.Presence, { failureMessage: "$!mandatory.get('failureMessage')"} ); #end #end ## #if($validate.get('mustMatch')) #set($mustMatch = $validate.get('mustMatch')) #if($mustMatch.get('name') && $mustMatch.get('failureMessage') && !$mustMatch.get('noscript')) ${fieldName}Validator.add( Validate.Confirmation, { match: $$("input[name=$!mustMatch.get('name')]")[0], failureMessage: "$!mustMatch.get('failureMessage')"} ); #end #end ## #if($validate.get('mustNotMatch')) #set($mustNotMatch = $validate.get('mustNotMatch')) #if($mustNotMatch.get('name') && $mustNotMatch.get('failureMessage') && !$mustNotMatch.get('noscript')) var mustNotMatchValue = []; mustNotMatchValue[0] = ($$("input[name=$!mustNotMatch.get('name')]")[0]); ${fieldName}Validator.add( Validate.Exclusion, { within: ["test"], failureMessage: "$!mustNotMatch.get('failureMessage')"} ); #end #end #if($validate.get('regex')) #set($regex = $validate.get('regex')) #set($pattern = "") #if($regex.get('jsPattern')) #set($pattern = $regex.get('jsPattern')) #elseif($regex.get('pattern')) #set($pattern = $regex.get('pattern')) #end #set($failMessage = "") #if($regex.get('jsFailureMessage')) #set($failMessage = $regex.get('jsFailureMessage')) #elseif($regex.get('failureMessage')) #set($failMessage = $regex.get('failureMessage')) #end #if($pattern != '' && $failMessage != '' && !$regex.get('noscript')) ${fieldName}Validator.add( Validate.Format, { pattern: $pattern, failureMessage: "$failMessage"} ); #end #end##if regex #end##if contains js validateable fields. #end##if validate #end##loop });// ]]> </script> #end##macro #* * Get parameters from request so that values will be filled in if there is a mistake * in one of the entries. Entries will be returned to fields[n].params.value * Fields will not be returned if they have either noReturn or error specified. * * @param $fields The array of fields to get parameters for. *### #macro(getParams $fields) #foreach($field in $fields) #if($field.get('name') && $request.get($field.get('name'))) #if(!$field.get('noReturn') && !$field.get('error')) #if(!$field.get('params')) #set($params = {}) #set($discard = $field.put('params', $params)) #else #set($params = $field.get('params')) #end #set($discard = $params.put('value', $request.get($field.get('name')))) #end #end #end #end #* * Get the configuration from the configuration object. * * @param $configDocumentName The name of the document to get the configuration from. *### #macro(loadConfig, $configDocumentName) #set($configDocument = $xwiki.getDocument($configDocumentName)) #if(!$configDocument || !$configDocument.getObject($documentName)) ## No config document, load defaults. #set($heading = "= $msg.get('core.register.title') =") #set($welcomeMessage = "$msg.get('core.register.welcome')") #set($useLiveValidation = true) #set($defaultFieldOkayMessage = "$msg.get('xe.admin.registration.fieldOkay')") #set($loginButton = true) #set($defaultRedirect = "$xwiki.getURL('Main.WebHome')") #set($userFullName = "$request.get('register_first_name') $request.get('register_last_name')") #set($registrationSuccessMessage = '{{info}}$msg.get("core.register.successful", ["[[$fullName>>$userSpace$userName]]", $userName]){{/info}}') #else #set($configObject = $configDocument.getObject($documentName)) #set($heading = "= #evaluate($configObject.getProperty('heading').getValue()) =") #set($welcomeMessage = "#evaluate($configObject.getProperty('welcomeMessage').getValue())") #if($configObject.getProperty('liveValidation_enabled').getValue() == 1) #set($useLiveValidation = true) #end #set($defaultFieldOkayMessage = "#evaluate($configObject.getProperty('liveValidation_defaultFieldOkMessage').getValue())") #if($configObject.getProperty('loginButton_enabled').getValue() == 1) #set($loginButton = true) #end #if($configObject.getProperty('loginButton_autoLogin_enabled').getValue() == 1) #set($autoLogin = true) #end #set($defaultRedirect = "#evaluate($configObject.getProperty('defaultRedirect').getValue())") #set($registrationSuccessMessage = "$configObject.getProperty('registrationSuccessMessage').getValue()") #if($configObject.getProperty('requireCaptcha').getValue() == 1) #set($requireCaptcha = true) #end #end #end {{/velocity}}

Es una edición menor

Comentario (Escriba una breve descripción de sus cambios)

Autosave every minutes

//

    //
    if ($('tmEditWysiwyg')) {
      // Manage switch from wiki to wysiwyg, content must be preserved between those editors.
      Event.observe($('tmEditWysiwyg'), "click", function(event) {
                document.forms.edit.action='/xwiki/bin/edit/CdlsatdCode/RegistrationSheet?editor=wysiwyg&language=en';
        document.forms.edit.submit();
        Event.stop(event);
      });

      // Manage switch from wysiwyg to wiki, content must be preserved between those editors.
      Event.observe($('tmEditWiki'), "click", function(event) {
        document.forms.edit.action='/xwiki/bin/edit/CdlsatdCode/RegistrationSheet?editor=wiki&language=en';
        document.forms.edit.submit();
        Event.stop(event);
      });
    }
   
 
//

Información del documento

Idioma predefinido:

Sintaxis del documento
XWiki 2.1 XWiki 2.0
Documento oculto
Un documento incluido : 
CdlsatdCode.Macros Editar CdlsatdCode.Macros

Traducciones de los documentos

Está editando el documento original (en).

Traducciones disponibles: nl de fr it pl

Traducir este documento al: es pt sv da 

Ayuda de sintaxis XWiki

Ayuda sobre Sintaxis de XWiki

Sobre el contenido del sitio web

Toda la información contenida en este sitio web tiene únicamente fines educativos. El lugar para obtener consejos médicos específicos, diagnósticos y tratamientos es su médico. El uso de este sitio es estrictamente bajo su propio riesgo. Si encuentra algo que cree que necesita ser corregido o aclarado, por favor háganoslo saber en: 

Envíe un correo electrónico: info@cdlsWorld.org