diff --git a/include/ajax.users.php b/include/ajax.users.php index 43a7864b0bf801215d87b8a13d9e69230ad0519f..a523695e5c72b4565340da5236222d1bdea763db 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -79,6 +79,29 @@ class UsersAjaxAPI extends AjaxController { } + function preview($id) { + global $thisstaff; + + if(!$thisstaff) + Http::response(403, 'Login Required'); + elseif(!($user = User::lookup($id))) + Http::response(404, 'Unknown user'); + + $info = array('title' => ''); + + ob_start(); + echo sprintf('<div style="width:650px; padding: 2px 2px 0 5px;" + id="u%d">', $user->getId()); + include(STAFFINC_DIR . 'templates/user.tmpl.php'); + echo '</div>'; + $resp = ob_get_contents(); + ob_end_clean(); + + return $resp; + + } + + function editUser($id) { global $thisstaff; diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php index 2aabe3ba5857d0cbecd5079ff7a46641f164ff28..5848055a08827e668e9d59a2921a711c646d4b9b 100644 --- a/include/staff/templates/user.tmpl.php +++ b/include/staff/templates/user.tmpl.php @@ -1,11 +1,15 @@ <?php -if (!$info['title']) +if (!isset($info['title'])) $info['title'] = Format::htmlchars($user->getName()); -?> + +if ($info['title']) { ?> <h3><?php echo $info['title']; ?></h3> <b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b> -<hr/> +<hr> <?php +} else { + echo '<div class="clear"></div>'; +} if ($info['error']) { echo sprintf('<p id="msg_error">%s</p>', $info['error']); } elseif ($info['msg']) { @@ -49,7 +53,7 @@ if ($info['error']) { <a href="users.php?id=<?php echo $user->getId(); ?>" title="Manage User" class="action"><i class="icon-share"></i></a> </div> - <table class="custom-info"> + <table class="custom-info" width="100%"> <?php foreach ($user->getDynamicData() as $entry) { ?> <tr><th colspan="2"><strong><?php diff --git a/include/staff/templates/users.tmpl.php b/include/staff/templates/users.tmpl.php index 11e094d28d89782da68235c6c0c4eb48c12712cb..d5beaf2c77fdcd50d8dde8bd189a84e7acf4e0e9 100644 --- a/include/staff/templates/users.tmpl.php +++ b/include/staff/templates/users.tmpl.php @@ -91,7 +91,7 @@ if ($num) { ?> ?> <tr id="<?php echo $row['id']; ?>"> <td> - <a href="users.php?id=<?php echo $row['id']; ?>"><?php echo $name; ?></a> + <a class="userPreview" href="users.php?id=<?php echo $row['id']; ?>"><?php echo $name; ?></a> <?php if ($row['tickets']) diff --git a/include/staff/users.inc.php b/include/staff/users.inc.php index b4d64f846a6897c984abdd3e564e3b6fdcd6ce83..91362ae32c8b0bc0afb9d0af276587717ed6afd8 100644 --- a/include/staff/users.inc.php +++ b/include/staff/users.inc.php @@ -139,7 +139,7 @@ else ?> <tr id="<?php echo $row['id']; ?>"> <td> - <a href="users.php?id=<?php echo $row['id']; ?>"><?php echo $name; ?></a> + <a class="userPreview" href="users.php?id=<?php echo $row['id']; ?>"><?php echo $name; ?></a> <?php if ($row['tickets']) diff --git a/scp/ajax.php b/scp/ajax.php index 75a3c4ac6597781f3cf366aef8aa9c4304dc4471..ff6703a5aa4ab9a6721c2b9ffab8a1d4c010a6a7 100644 --- a/scp/ajax.php +++ b/scp/ajax.php @@ -73,6 +73,7 @@ $dispatcher = patterns('', url_get('^/remote$', 'search', array('remote')), url_get('^/(?P<id>\d+)$', 'getUser'), url_post('^/(?P<id>\d+)$', 'updateUser'), + url_get('^/(?P<id>\d+)/preview$', 'preview'), url_get('^/(?P<id>\d+)/edit$', 'editUser'), url('^/lookup$', 'getUser'), url_get('^/lookup/form$', 'getLookupForm'), diff --git a/scp/css/scp.css b/scp/css/scp.css index 416ee3850dbae1dce7c7c07eab6f32a07656a92d..e51a3b970646a89b7120b6de278e8559c69d260e 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -8,10 +8,25 @@ body { } a { - color:#E65524; + color:#184E81; text-decoration:none; } +a:hover { + text-decoration: underline; +} + +#nav a:hover, +#sub_nav a:hover, +a:hover i[class^="icon-"], +.tabs a { + text-decoration: none; +} + +div#header a { + color:#E65524; +} + .form_table a:hover { text-decoration: underline; } @@ -1444,11 +1459,14 @@ time { } /* Dynamic forms in dialogs */ +.dialog th, .tip_box th { + text-align: left; +} + .dialog th { background-color: #eee; border: 1px dotted #bbb; padding: 0.3em; - text-align: left; padding-left: 0.3em; } diff --git a/scp/js/scp.js b/scp/js/scp.js index 40e77866d0a471df5a4a86888354580af0eafc53..219c1eb0810bdab45b1ff1488034c9ddc4e04aa1 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -672,7 +672,7 @@ $('.quicknote .action.edit-note').live('click.note', function() { var note = $(this).closest('.quicknote'), body = note.find('.body'), T = $('<textarea>').text(body.html()); - if (note.closest('.dialog').length) + if (note.closest('.dialog, .tip_box').length) T.addClass('no-bar small'); body.replaceWith(T); $.redact(T); @@ -742,7 +742,7 @@ $('#new-note').live('click', function() { 'html' ); }); - if (note.closest('.dialog').length) + if (note.closest('.dialog, .tip_box').length) T.addClass('no-bar small'); note.replaceWith(T); $('<p>').addClass('submit').css('text-align', 'center') diff --git a/scp/js/tips.js b/scp/js/tips.js index db5a1aaf5d6e5feae57dad203a7cdf19eec2d438..a1b7f88d53224c906dc83d7e51716285fd5cc3d3 100644 --- a/scp/js/tips.js +++ b/scp/js/tips.js @@ -214,6 +214,32 @@ jQuery(function() { clearTimeout($(this).data('timer')); }); + //User preview + $('.userPreview').live('mouseover', function(e) { + e.preventDefault(); + var elem = $(this); + + var vars = elem.attr('href').split('='); + var url = 'ajax.php/users/'+vars[1]+'/preview'; + var id='u'+vars[1]; + var xoffset = 80; + + elem.data('timer', 0); + if(!elem.data('id')) { + elem.data('id', id); + if(e.type=='mouseover') { + /* wait about 1 sec - before showing the tip - mouseout kills the timeout*/ + elem.data('timer',setTimeout(function() { showtip(url,elem,xoffset);},750)) + }else{ + clearTimeout(elem.data('timer')); + showtip(url, elem, xoffset); + } + } + }).live('mouseout', function(e) { + $(this).data('id', 0); + clearTimeout($(this).data('timer')); + }); + $('body') .delegate('.tip_close', 'click', function(e) { e.preventDefault();