PhoneNumber control

From Catglobe Wiki
Revision as of 09:27, 6 March 2009 by Catglobe (talk | contribs) (New page: = Introduction = We already have a phone number control worked for long time. it works however it contains some potential things: * Code, code behind and domain layer, is to complex which ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

We already have a phone number control worked for long time. it works however it contains some potential things:

  • Code, code behind and domain layer, is to complex which is not necessary at all.
  • Java Script is not good.
  • Fail on FireFox.

Once there is a bug, it is difficult to fix and also hard to maintain the code.

The goal of refactoring it is to make the code nicer, work well in all well - known browsers: IE, FF and improve the performance.

Being used in

Currently the phone number is being used in these places:

  1. User, Company, and correct user info: here are the place which use all features of phone number control: displaying value, adding/editing, validating the format.
  2. CATI, at CatiFormExpand.aspx: Only use to show the current available phone number of a project questionnaire or user. It has 2 parts: The type of phone, and a textbox to show the full values of selected phone type. No validation, no editing.
  3. Search Page, for User or Company resource: Nearly the same as in CRD.

New implementation

For the JavaScript things, please refer to UserControls/Scripts/PhoneNumberControlEx.js. The code is made in OOP way using jQuery and AJAX.

Beside the code to build up and manage phonenumber control internally, there are some public API which is used to work with phonenumber from other places:

  • cg_getPhoneNumberById(pnId): return the phone number control object by its ClientID
  • cg_getCurrentPhoneNumber(pnId): return the phone number info object. It is a convenient way to get the needed phone number information without knowing the control code.
  • Element 3