[CS-Project-svn_notify] SF.net SVN: cs-project:[906] trunk/1.2
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-08-26 03:28:38
|
Revision: 906 http://cs-project.svn.sourceforge.net/cs-project/?rev=906&view=rev Author: crazedsanity Date: 2008-08-26 03:28:35 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Display username on contact details (where applicable). /includes/content/contacts.inc: * when displaying contact information, display the username. /lib/userClass.php: * get_user_info(): -- updated to allow an array as criteria for fine-grained searching. -- NOTE: allowable fields should be limited to avoid database errors. /templates/content/contacts/view.contact.tmpl: * new block row in static display to show username. Modified Paths: -------------- trunk/1.2/includes/content/contacts.inc trunk/1.2/lib/userClass.php trunk/1.2/templates/content/contacts/view.content.tmpl Modified: trunk/1.2/includes/content/contacts.inc =================================================================== --- trunk/1.2/includes/content/contacts.inc 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/includes/content/contacts.inc 2008-08-26 03:28:35 UTC (rev 906) @@ -141,10 +141,19 @@ if(is_numeric($contactId)) { try{ + $page->rip_all_block_rows(); + + $contactObj->set_contact_id($contactId); $contactDetails = $contactObj->get_contact(); - $page->rip_all_block_rows(); + $userDetails = $user->get_user_info(array('contact_id'=>$contactId)); + if(is_array($userDetails)) { + $contactDetails['username'] = $userDetails['username']; + $page->add_template_var('display_username', $page->templateRows['display_username']); + } + + //set the main details. foreach($contactDetails as $name=>$value) { $page->add_template_var($name, $value); Modified: trunk/1.2/lib/userClass.php =================================================================== --- trunk/1.2/lib/userClass.php 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/lib/userClass.php 2008-08-26 03:28:35 UTC (rev 906) @@ -155,17 +155,20 @@ function get_user_info($findThis) { $retval = 0; - if(isset($findThis) && strlen($findThis)) { - $findThis = strtolower($findThis); + if(isset($findThis) && (strlen($findThis) || is_array($findThis))) { if(is_numeric($findThis)) { $criteria = "uid = $findThis"; } + elseif(is_array($findThis)) { + $criteria = $this->gfObj->string_from_array($findThis, 'select', NULL, 'sql'); + } else { + $findThis = strtolower($findThis); $criteria = "lower(username) = '$findThis'"; } - $query = "SELECT * from user_table WHERE $criteria"; + $query = "SELECT * from user_table WHERE ". $criteria; $numrows = $this->db->exec($query); $dberror = $this->db->errorMsg(); Modified: trunk/1.2/templates/content/contacts/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/contacts/view.content.tmpl 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/templates/content/contacts/view.content.tmpl 2008-08-26 03:28:35 UTC (rev 906) @@ -1,4 +1,3 @@ - <form method="POST" onSubmit="new Effect.DropOut(submitButton);" name="updateContactForm"> <input type="HIDDEN" name="contact_id" value="{contact_id}"> <div id="mainContact_static" style="display:inline;"> @@ -7,6 +6,9 @@ <td style="border:solid #000 1px; "> <h1 style="display:inline">{company}</h1><BR> <center><div style="display:inline;text-align:center;">{fname} {lname} (<i>{email}</i>)</div></center> + <!-- BEGIN display_username --> + <center><div style="display:inline;text-align:center;">Username: {username}</div></center> + <!-- END display_username --> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |