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 username.') ?></h3>
0037 
0038                         <div id="help-block" class="help-block">
0039                             <?= $this->translate('For technical reasons, we have to ask you to change your username. Please enter a new username, which may consist of English letters, numbers, hyphen, underscore and period.') ?>
0040                         </div>
0041                         <div id="error" class="center text-error help-block">
0042                             <?php if ($this->error && isset($this->errorText)): ?>
0043                                 <p class="errors">
0044                                     <?= $this->translate($this->errorText) ?>
0045                                 </p>
0046                             <?php endif; ?>
0047                         </div>
0048                         <form id="usernameForm" class="standard-form row-fluid center" action="<?=$this->action?>" method="post" role="form" data-toggle="validator">
0049                             <?php
0050                             if ($this->error) {
0051                                 $this->form->mail->class = $this->form->mail->class . ' has-error';
0052                             }
0053                             ?>
0054 
0055                             <div class="form-group has-feedback">
0056                                 <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>
0057                             </div>
0058 
0059                             <button name="change_it" id="change_it" type="submit" class="btn btn-min-width btn-native">Change Username <i id="load-state" class="fa fa-spinner fa-pulse hidden" aria-hidden="true"></i></button>
0060 
0061                         </form>
0062 
0063                     </div>
0064 
0065                 </div>
0066                 <!-- END #login-box -->
0067             </div>
0068         </section>
0069 
0070         <section id="thumbs">
0071 
0072             <?php foreach ($users as $key => $user) { ?>
0073 
0074                 <div class="thumb">
0075                     <a href="<?php echo $buildMemberUrl->buildMemberUrl($user['username']); ?>">
0076                         <span></span>
0077                         <img src="<?php echo $helperImage->Image($user['profile_image_url'],array('width' => 110, 'height' => 110, 'crop' => 2)); ?>"/>
0078                     </a>
0079                 </div>
0080 
0081             <?php } ?>
0082 
0083         </section>
0084 
0085     </main>
0086     <!-- /new code -->
0087 
0088     <script>
0089         $('document').ready(function(){
0090 
0091             var ValidateAjax = {
0092                 isClean: {},
0093                 initialize: function (formid, endpoint) {
0094                     end_url = endpoint;
0095                     form_id = '#'+formid;
0096 
0097                     $(form_id +' input[id=username]').
0098                     blur(function () {
0099                         var formElementID = $(this).attr('id');
0100                         var formElementValue = $(this).val();
0101                         ValidateAjax.doValidate(formElementID, formElementValue);
0102                         return false;
0103                     });
0104                     $(form_id).on('submit', function(e){
0105                         var target = $(this).attr("data-target");
0106                         var loadState = $(this).attr('data-load-state');
0107 
0108                         $(target).find(loadState).prop('disabled', true);
0109                         $(target).find(loadState).find('i').removeClass('hidden');
0110 
0111                         var validateValues = ValidateAjax.isClean;
0112                         for (var k in validateValues){
0113                             if (validateValues.hasOwnProperty(k)) {
0114                                 if (!validateValues[k]) {
0115                                     e.preventDefault();
0116                                     return false;
0117                                 }
0118                             }
0119                         }
0120                         return true;
0121                     });
0122                 },
0123 
0124                 doValidate: function (id, value) {
0125                     var url = end_url;
0126                     var data = {'name' : id, 'value': value};
0127                     $.post(url, data, function (response) {
0128                         $('#'+id).parent().find('.form-control-feedback').remove();
0129                         $('#'+id).parent().removeClass('has-error');
0130                         if (!response['status']) {
0131                             ValidateAjax.isClean[id] = false;
0132                             $('#'+id).parent().addClass('has-error');
0133                             if (response[id]) {
0134                                 $('#'+id).parent().append('<i class="glyphicon glyphicon-remove form-control-feedback"></i>');
0135                             }
0136                         } else {
0137                             ValidateAjax.isClean[id] = true;
0138                             $('#'+id).parent().addClass('has-success');
0139                             $('#'+id).parent().append('<i class="glyphicon glyphicon-ok form-control-feedback"></i>');
0140                         }
0141                     },'json');
0142 
0143                 },
0144                 getHTML: function (errArray) {
0145                     var o = '<ul class="errors">';
0146                     $.each(errArray,function(key,value){
0147                         o += '<li>'+ value+'</li>';
0148                     });
0149                     o+='</ul>';
0150 
0151                     return o;
0152                 }
0153             };
0154 
0155             ValidateAjax.initialize('usernameForm', '/register/validate');
0156         });
0157     </script>
0158 
0159 <?php $this->inlineScript()->appendScript(
0160     '    $(document).ready(function(){
0161           
0162         });
0163     ');