Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
012719e3
authored
2010-12-17 22:14:27 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
HTML library update and user manager update
1 parent
51385ba3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
6 deletions
com/HTML/HTML.php
com/Notifications/Notifications.php
com/UserManager/UserManager.js
com/UserManager/UserManager.php
com/UserManager/views/edit_user_profile.php
com/HTML/HTML.php
View file @
012719e
...
...
@@ -38,6 +38,52 @@ function select_opts_securities($selected = null, $echo = true) {
return
select_opts
(
Vars
::
$securities
,
$selected
,
$echo
);
}
function
validateDate
(
$date
,
$format
=
'YYYY-MM-DD'
)
{
switch
(
$format
)
{
case
'YYYY/MM/DD'
:
case
'YYYY-MM-DD'
:
list
(
$y
,
$m
,
$d
)
=
preg_split
(
'/[-\.\/ ]/'
,
$date
);
break
;
case
'YYYY/DD/MM'
:
case
'YYYY-DD-MM'
:
list
(
$y
,
$d
,
$m
)
=
preg_split
(
'/[-\.\/ ]/'
,
$date
);
break
;
case
'DD-MM-YYYY'
:
case
'DD/MM/YYYY'
:
list
(
$d
,
$m
,
$y
)
=
preg_split
(
'/[-\.\/ ]/'
,
$date
);
break
;
case
'MM-DD-YYYY'
:
case
'MM/DD/YYYY'
:
list
(
$m
,
$d
,
$y
)
=
preg_split
(
'/[-\.\/ ]/'
,
$date
);
break
;
case
'YYYYMMDD'
:
$y
=
substr
(
$date
,
0
,
4
);
$m
=
substr
(
$date
,
4
,
2
);
$d
=
substr
(
$date
,
6
,
2
);
break
;
case
'YYYYDDMM'
:
$y
=
substr
(
$date
,
0
,
4
);
$d
=
substr
(
$date
,
4
,
2
);
$m
=
substr
(
$date
,
6
,
2
);
break
;
default
:
throw
new
Exception
(
"Invalid Date Format"
);
}
return
checkdate
(
$m
,
$d
,
$y
);
}
class
Vars
{
public
static
$prefixes
=
Array
(
...
...
com/Notifications/Notifications.php
View file @
012719e
...
...
@@ -36,7 +36,7 @@ function get_user_notices($uid) {
$notices
=
get_user_meta
(
$uid
,
'notices'
,
true
);
if
(
!
empty
(
$notices
))
{
$notices
=
subval_sort
(
$notices
,
'sent_date'
,
arsort
);
$notices
=
subval_sort
(
$notices
,
'sent_date'
,
'arsort'
);
Vars
::
$notices
=
$notices
;
}
...
...
@@ -83,7 +83,7 @@ function print_user_notices($show_more = true) {
}
endif
;
$rows
.=
'<tr>'
;
$rows
.=
'<tr
class="notice-row"
>'
;
if
(
$notices
[
$i
][
'status'
]
==
"unread"
)
{
$rows
.=
'<td width="12" style="padding:0;padding-left:10px;vertical-align:middle;"><a id="'
.
$i
.
'" href="#" class="notice '
.
((
$notices
[
$i
][
'status'
]
==
"read"
)
?
'read'
:
'unread'
)
.
'"><img src="assets/images/blank.gif" width="12" height="12" /></a></td>'
;
}
else
{
...
...
com/UserManager/UserManager.js
View file @
012719e
...
...
@@ -62,8 +62,8 @@ jQuery(function() {
}
,
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
var
$error_container
=
jQuery
(
'.validation-errors'
);
jQuery
(
'h6'
,
$error_container
).
html
(
"
A server error has occurred
."
);
jQuery
(
'ul'
,
$error_container
).
html
(
"<li>
"
+
errorThrown
+
"
</li>"
);
jQuery
(
'h6'
,
$error_container
).
html
(
"
OOPS..
."
);
jQuery
(
'ul'
,
$error_container
).
html
(
"<li>
Please check all required fields and be sure they are the right format.
</li>"
);
$error_container
.
show
();
}
});
...
...
com/UserManager/UserManager.php
View file @
012719e
...
...
@@ -12,6 +12,7 @@ use Tz\Common;
use
Tz\WordPress\Tools
;
use
Tz\WordPress\Tools\Auth
;
use
Tz\WordPress\UAM
;
use
Tz\WordPress\Tools\HTML
;
use
Tz\WordPress\CBV
;
use
Tz\WordPress\CBV\User
;
use
Tz\WordPress\CBV\Events
;
...
...
@@ -23,6 +24,7 @@ const OPTION_NAME = "user_options";
const
CAPABILITY
=
"manage_cbv_users"
;
CBV\load
(
'User'
);
Tools\import
(
'HTML'
);
call_user_func
(
function
()
{
...
...
@@ -184,6 +186,11 @@ class ProfileValidation extends Common\Validation {
}
public
function
date_of_birth
(
$val
)
{
if
(
!
empty
(
$val
))
{
if
(
!
HTML\validateDate
(
$val
))
{
throw
new
Exception
(
User\Vars
::
$field_lookup
[
__FUNCTION__
]
.
' must be in YYYY-MM-DD format.'
);
}
}
update_user_meta
(
$_POST
[
'uid'
],
__FUNCTION__
,
$val
);
}
...
...
@@ -740,7 +747,7 @@ class Actions {
}
public
static
function
admin_menu
()
{
add_menu_page
(
'CBV Users'
,
'CBV Users'
,
CAPABILITY
,
'cbv_users'
,
__NAMESPACE__
.
'\display_users'
);
add_menu_page
(
'CBV Users'
,
'CBV Users'
,
CAPABILITY
,
'cbv_users'
,
__NAMESPACE__
.
'\display_users'
,
null
,
3
);
add_submenu_page
(
'cbv_users'
,
'New User'
,
'New User'
,
CAPABILITY
,
'cbv_users_create'
,
__NAMESPACE__
.
'\create_user'
);
}
...
...
com/UserManager/views/edit_user_profile.php
View file @
012719e
...
...
@@ -64,7 +64,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
<td><textarea
name=
"description"
>
<?php
echo
get_user_meta
(
$_GET
[
'uid'
],
'description'
,
true
);
?>
</textarea></td>
</tr>
<tr>
<th>
Date of Birth:
</th>
<th>
Date of Birth:
<
br
/><span
style=
"font-size:10px;color:#999;font-weight:normal;"
>
(Ex. YYYY-MM-DD)
</span><
/th>
<td><input
type=
"text"
name=
"date_of_birth"
class=
"datepicker"
value=
"
<?php
echo
get_user_meta
(
$_GET
[
'uid'
],
'date_of_birth'
,
true
);
?>
"
/></td>
</tr>
</tbody>
...
...
Please
register
or
sign in
to post a comment