edit-external-contact.tcl0100777000076500007650000000727207674430441015157 0ustar bkiesbyewebad_page_contract { edit external contact @author Bjoern Kiesbye @creation-date 2003-06-19 @param friend Frist and Last name of the conntact that should be edited } { friend_first_name:notnull friend_last_name:notnull } -properties { im_screen_name:onevalue service:onevalue friend_first_name:onevalue friend_last_name:onevalue } set user_id [ad_conn user_id] set services_list [list] db_foreach get_services "Select service , pretty_name from jb_services where active_check_p = 't'" { lappend services_list $service set services($service) $pretty_name set details_im_screen_name($service) "" } db_foreach get_external_contacts_details "Select jb_screens.im_screen_name , jb_screens.service , jb_screens.screen_id from jb_screens , jb_friends where jb_friends.friend_first_name = :friend_first_name and jb_friends.friend_last_name = :friend_last_name and jb_friends.friend_screen_id = jb_screens.screen_id and jb_friends.user_id = :user_id" { ns_log notice "$service / $im_screen_name" set details_im_screen_name($service) $im_screen_name # lappend details_service $service } template::form create edit-user -action edit-external-contact-confirm template::element create edit-user friend_first_name -datatype text -widget text -label "First Name:" -value $friend_first_name template::element create edit-user friend_last_name -datatype text -widget text -label "Last Name:" -value $friend_last_name template::element create edit-user friend_first_name_old -datatype text -widget hidden -value $friend_first_name template::element create edit-user friend_last_name_old -datatype text -widget hidden -value $friend_last_name for {set i 0} { $i < [llength $services_list]} { incr i } { set err "" # catch { set test "$details_im_screen_name([lindex $services_list $i])" } err # ns_log notice "err = $err" if {$details_im_screen_name([lindex $services_list $i]) != ""} { set displayed_im_screen_name $details_im_screen_name([lindex $services_list $i]) if { [lindex $services_list $i] == "msn"} { regsub -all "%" $displayed_im_screen_name "@" displayed_im_screen_name } template::element create edit-user im_screen_name.[lindex $services_list $i] -datatype text -widget text -label "$services([lindex $services_list $i]) Screen:" -value "$displayed_im_screen_name" template::element create edit-user im_screen_name_old.[lindex $services_list $i] -datatype text -widget hidden -value "$displayed_im_screen_name" template::element create edit-user services.$i -datatype text -widget hidden -value "[lindex $services_list $i]" template::element create edit-user services_pretty.[lindex $services_list $i] -datatype text -widget hidden -value "$services([lindex $services_list $i])" } else { set displayed_im_screen_name $details_im_screen_name([lindex $services_list $i]) template::element create edit-user im_screen_name.[lindex $services_list $i] -datatype text -widget text -label "$services([lindex $services_list $i]) Screen:" -value "$displayed_im_screen_name" template::element create edit-user im_screen_name_old.[lindex $services_list $i] -datatype text -widget hidden -value "$displayed_im_screen_name" template::element create edit-user services.$i -datatype text -widget hidden -value "[lindex $services_list $i]" template::element create edit-user services_pretty.[lindex $services_list $i] -datatype text -widget hidden -value "$services([lindex $services_list $i])" } } ad_return_templateedit-external-contact.adp0100777000076500007650000000046607674430463015143 0ustar bkiesbyeweb Edit external contact information Edit

Edit external contact information


Back to view Back to index page edit-external-contact-confirm.tcl0100644000076500001440000000211507674430506017147 0ustar bkiesbyeusersad_page_contract { edit external contact @author Bjoern Kiesbye @creation-date 2003-06-19 @param friend Frist and Last name of the conntact that should be edited } { friend_first_name friend_last_name friend_last_name_old friend_first_name_old im_screen_name:array im_screen_name_old:array services:array services_pretty:array } -properties { new_im_contacts friend_first_name:onevalue friend_last_name:onevalue friend_last_name_old:onevalue friend_first_name_old:onevalue } multirow create new_im_contacts service pretty_name im_screen_name im_screen_name_old for {set search [array startsearch services]} { [array anymore services $search]} {} { set cur_service_1 [array nextelement services $search] set cur_service $services($cur_service_1) ns_log notice "cur_service = $cur_service , services(cur_service) = $services($cur_service_1)" multirow append new_im_contacts $cur_service $services_pretty($cur_service) $im_screen_name($cur_service) $im_screen_name_old($cur_service) } ad_return_templateedit-external-contact-confirm.adp0100644000076500001440000000231707674430526017137 0ustar bkiesbyeusers Edit Contact Information Confirm

Please confirm your changes

First Name : @friend_first_name@

Last Name : @friend_last_name@

@new_im_contacts.pretty_name@ : @new_im_contacts.im_screen_name@


Back to index page edit-external-contact-2.tcl0100777000076500007650000001140507674430616015313 0ustar bkiesbyewebad_page_contract { updates the database @author Luis Mosteiro Fernandez @creation-date 2002-10-23 @param screen_id who should be updated @param first_names new value for first_names @param last_name new value for last_name @param im_screen_name new value for im_screen_name } { friend_first_name friend_last_name friend_last_name_old friend_first_name_old im_screen_name:array im_screen_name_old:array services:array } -properties { } set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] if {$friend_first_name != $friend_first_name_old} { db_dml update_first_name "UPDATE jb_friends SET friend_first_name = :friend_first_name WHERE friend_first_name = :friend_first_name_old AND friend_last_name = :friend_last_name_old AND user_id = :user_id" set friend_first_name_old "$friend_first_name" } if {$friend_last_name != $friend_last_name_old} { db_dml update_first_name "UPDATE jb_friends SET friend_last_name = :friend_last_name WHERE friend_first_name = :friend_first_name_old AND friend_last_name = :friend_last_name_old AND user_id = :user_id" set friend_last_name_old "$friend_last_name" } for {set search [array startsearch services]} { [array anymore services $search]} {} { set cur_service_1 [array nextelement services $search] set cur_service $services($cur_service_1) ns_log notice "cur_service = $cur_service , services(cur_service) = $services($cur_service_1)" set old_screen $im_screen_name_old($cur_service) set new_screen $im_screen_name($cur_service) if {$new_screen != $old_screen} { if {$cur_service == "msn"} { regsub -all "@" $old_screen "%" old_screen regsub -all "@" $new_screen "%" new_screen } if {$old_screen != "" } { #remove from friends list db_1row get_old_screen_id "SELECT (screen_id) as old_screen_id , refcount FROM jb_screens WHERE im_screen_name = :old_screen AND service = :cur_service" db_dml delete_from_friendslist "DELETE FROM jb_friends WHERE friend_screen_id = :old_screen_id AND user_id = :user_id" if {$refcount > 1} { set refcount [expr $refcount - 1] db_dml update_refcount "UPDATE jb_screens SET refcount = :refcount WHERE im_screen_name = :old_screen AND service = :cur_service" } else { db_exec_plsql jb_screen_delete " begin jb_screen.delete(:old_screen_id); end; " set success [jb_removetransportbuddy $old_screen [jb_get_transport_id_from_symbol $cur_service]] } } if { $new_screen != "" } { # check if we alreddy have this screen in the jb_screens table if { [ db_0or1row get_new_screen_id "SELECT (screen_id) as new_screen_id , (refcount) as new_refcount FROM jb_screens WHERE im_screen_name = :new_screen AND service = :cur_service"]} { #we know this screen just update the friends table. db_dml insert_new_frind "INSERT INTO jb_friends (friend_first_name , friend_last_name , friend_screen_id , user_id) values (:friend_first_name_old , :friend_last_name_old , :new_screen_id , :user_id)" set new_refcount [expr $new_refcount +1] db_dml update_refcount_with_screen_id "UPDATE jb_screens SET refcount = :new_refcount WHERE screen_id = :new_screen_id" } else { #we have a total new screen #create a new jb_screen object for the new screen name db_exec_plsql new_screen { declare id integer; begin id := jb_screen.new ( user_id => :user_id, im_screen_name => :new_screen, service => :cur_service, status => 'offline', refcount => '1', object_type => 'jb_screen', creation_user => :user_id, creation_ip => :peeraddr ); end; } #now add the new screen to the jabber roster set success [jb_addtransportbuddy $new_screen "online-trace" [jb_get_transport_id_from_symbol $cur_service]] db_1row get_new_screen_id "SELECT (screen_id) as new_screen_id , (refcount) as new_refcount FROM jb_screens WHERE im_screen_name = :new_screen AND service = :cur_service" db_dml insert_new_frind "INSERT INTO jb_friends (friend_first_name , friend_last_name , friend_screen_id , user_id) VALUES (:friend_first_name_old , :friend_last_name_old , :new_screen_id , :user_id)" } } } } ad_returnredirect "view-external-contacts"