File indexing completed on 2024-12-29 05:24:48

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 $users = $this->newUsers($limit = 216,'created_at','DESC');
0023 $buildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0024 $helperImage = new Default_View_Helper_Image();
0025 $this->inlineScript()->appendFile('/theme/flatui/js/lib/bootstrap-validator.min.js');
0026 ?>
0027 
0028     <!-- new code -->
0029     <main id="reg-page">
0030 
0031         <section class="wrapper" id="register-wrap">
0032             <div id="register" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 clearfix">
0033                 <div id="register-box" >
0034 
0035                     <div id="login-form-box" class="well" style="width:100%;">
0036                         <h3><?= $this->translate('Please change your profile.') ?></h3>
0037 
0038                         <div id="help-block" class="help-block">
0039                             <?php
0040                                 $errCode = $this->errorCode;
0041                                 if($errCode == Default_Model_ReviewProfileData::INVALID_USERNAME_DEACTIVATED) {
0042                                     print_r("Due to a rare username conflict your account has been temp. deactivated. To activate again please choose a new valid username.");
0043                                 } else if($errCode == Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED) {
0044                                     print_r("Some characters in your username are no longer supported. Please correct it or choose another one.");
0045                                 } else if($errCode == Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_UNIQUE) {
0046                                     print_r("Due to a switch to LDAP, there is a rare username conflict. Please make your username unique to continue.");
0047                                 } else if($errCode == Default_Model_ReviewProfileData::INVALID_EMAIL_DEACTIVATED) {
0048                                     print_r("Due to a rare email conflict your account has been temp. deactivated. To activate again please choose a new valid email address.");
0049                                 }
0050                             ?>
0051                         </div>
0052                         <div id="error" class="center text-error help-block">
0053                             <?php if ($this->error && isset($this->errorText)): ?>
0054                                 <p class="errors">
0055                                     <?= $this->translate($this->errorText) ?>
0056                                 </p>
0057                             <?php endif; ?>
0058                         </div>
0059                         <form id="usernameForm" class="standard-form row-fluid center" action="<?=$this->action?>" method="post" role="form" data-toggle="validator">
0060                             <?php
0061                             if ($this->error) {
0062                                 $this->form->mail->class = $this->form->mail->class . ' has-error';
0063                             }
0064                             ?>
0065  
0066                             <?php if (($this->errorCode == Default_Model_ReviewProfileData::INVALID_USERNAME_DEACTIVATED || $this->errorCode == Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED || $this->errorCode == Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_UNIQUE) ) : ?>
0067                             <div class="form-group has-feedback">
0068                                 <label for="username" class="control-label">The username has to be unique and may only contain lower case alphanumeric characters or single hyphens, and cannot begin or end with a hyphen</label>
0069                                 <input name="username" id="username" value="" type="text" placeholder="Username" data-minlength="4" class="form-control" required data-minlength-error="Minimum of 4 characters" data-maxlength="40" data-maxlength-error="Maximum of 40 characters"><div class="help-block with-errors"></div>
0070                             </div>
0071                             <?php endif ?>
0072                             
0073                             <?php if ($this->errorCode == Default_Model_ReviewProfileData::INVALID_EMAIL_DEACTIVATED || $this->errorCode == Default_Model_ReviewProfileData::INVALID_EMAIL) : ?>
0074                             <div class="form-group has-feedback">
0075                                 <label for="email" class="control-label">Please enter a valid email address.</label>
0076                                 <input type="email" class="form-control" placeholder="Email" value="" id="mail" name="mail" required><div class="help-block with-errors"></div>
0077                             </div>
0078                             <?php endif ?>
0079 
0080                             <button name="change_it" id="change_it" type="submit" class="btn btn-min-width btn-native">Save Changes <i id="load-state" class="fa fa-spinner fa-pulse hidden" aria-hidden="true"></i></button>
0081 
0082                             <br><br>
0083                             <p>We are sorry for the inconvenience.</p>
0084                             
0085                         </form>
0086 
0087                     </div>
0088 
0089                 </div>
0090                 <!-- END #login-box -->
0091             </div>
0092         </section>
0093 
0094         <section id="thumbs">
0095 
0096             <?php /* foreach ($users as $key => $user) { ?>
0097 
0098                 <div class="thumb">
0099                     <a href="<?php echo $buildMemberUrl->buildMemberUrl($user['member_id']); ?>">
0100                         <span></span>
0101                         <img src="<?php echo $helperImage->Image($user['profile_image_url'],array('width' => 110, 'height' => 110, 'crop' => 2)); ?>"/>
0102                     </a>
0103                 </div>
0104 
0105             <?php } */ ?>
0106 
0107         </section>
0108 
0109     </main>
0110     <!-- /new code -->
0111 
0112     <script>
0113         $('document').ready(function(){
0114 
0115             var ValidateAjax = {
0116                 isClean: {},
0117                 initialize: function (formid, endpoint) {
0118                     end_url = endpoint;
0119                     form_id = '#'+formid;
0120 
0121                     $(form_id +' input[id=username],input[id=mail]').
0122                     blur(function () {
0123                         var formElementID = $(this).attr('id');
0124                         var formElementValue = $(this).val();
0125                         ValidateAjax.doValidate(formElementID, formElementValue);
0126                         return false;
0127                     });
0128                     $(form_id).on('submit', function(e){
0129                         var target = $(this).attr("data-target");
0130                         var loadState = $(this).attr('data-load-state');
0131 
0132                         $(target).find(loadState).prop('disabled', true);
0133                         $(target).find(loadState).find('i').removeClass('hidden');
0134 
0135                         var validateValues = ValidateAjax.isClean;
0136                         for (var k in validateValues){
0137                             if (validateValues.hasOwnProperty(k)) {
0138                                 if (!validateValues[k]) {
0139                                     e.preventDefault();
0140                                     return false;
0141                                 }
0142                             }
0143                         }
0144                         return true;
0145                     });
0146                 },
0147 
0148                 doValidate: function (id, value) {
0149                     var url = end_url;
0150                     var data = {'name' : id, 'value': value};
0151                     $.post(url, data, function (response) {
0152                         $('#'+id).parent().find('.form-control-feedback').remove();
0153                         $('#'+id).parent().removeClass('has-error');
0154                         if (!response['status']) {
0155                             ValidateAjax.isClean[id] = false;
0156                             $('#'+id).parent().addClass('has-error');
0157                             if (response[id]) {
0158                                 $('#'+id).parent().append('<i class="glyphicon glyphicon-remove form-control-feedback"></i>');
0159                             }
0160                         } else {
0161                             ValidateAjax.isClean[id] = true;
0162                             $('#'+id).parent().addClass('has-success');
0163                             $('#'+id).parent().append('<i class="glyphicon glyphicon-ok form-control-feedback"></i>');
0164                         }
0165                     },'json');
0166 
0167                 },
0168                 getHTML: function (errArray) {
0169                     var o = '<ul class="errors">';
0170                     $.each(errArray,function(key,value){
0171                         o += '<li>'+ value+'</li>';
0172                     });
0173                     o+='</ul>';
0174 
0175                     return o;
0176                 }
0177             };
0178 
0179             ValidateAjax.initialize('usernameForm', '/r/validate');
0180         });
0181     </script>
0182 
0183 <?php $this->inlineScript()->appendScript(
0184     '    $(document).ready(function(){
0185           
0186         });
0187     ');