Label Read Only

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Label Read Only

Postby mastrit » Thu Apr 18, 2013 3:16 am

Hello, I'm using vicidial, and i have some quetions,
It'a possible to make on agent screen label the name and the label vendor ID ''read only''
Because the agents change the names and it makes trouble pls help...
mastrit
 
Posts: 14
Joined: Thu Apr 18, 2013 3:11 am

Re: Label Read Only

Postby williamconley » Thu Apr 18, 2013 5:17 pm

1) Welcome to the Party! 8-)

2) You can put this information in "source id" instead of vendor id and they won't see it or be able to change it.

3) You can change the system to NOT allow agents to alter lead data at all. But then, of course, that would not be the only field affected.

4) You could try changing it to disable modifications, and then create a custom form (by using the custom fields system, but without creating any new fields ... just using the old ones ...), which allows for display instead of edit.

5) Since you are obviously a newbie, here are your newbie suggestions ...

when you post, please post your entire configuration including (but not limited to) your installation method and vicidial version with build.

this IS a requirement for posting along with reading the stickies (at the top of each forum) and the manager's manual (available on EFLO.net, both free and paid versions)

You should also post: Asterisk version, telephony hardware (model number is helpful here), cluster information if you have one, and whether any other software is installed in the box. If your installation method is "from scratch" you must post your operating system and should also post the .iso version from which you installed your original operating system. If your installation is "Hosted" list the site name of the host.

If this is a "Cloud" or "Virtual" server, please note the technology involved along with the version of that techology (ie: VMware Server Version 2.0.2). If it is not, merely stating the Motherboard model # and CPU would be helpful.

Similar to This:

Vicibox X.X from .iso | Vicidial X.X.X-XXX Build XXXXXX-XXXX | Asterisk X.X.X | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation | Intel DG35EC | Core2Quad Q6600

6) Happy Hunting! 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Label Read Only

Postby ZoVoS » Thu Apr 18, 2013 9:11 pm

I believe in html 4.1-5 the form INPUT FORM attribute is "readonly"

For vendor lead code this would be;

nano /srv/www/htdocs/agc/vicidial.php
CTRL - W
{echo "$label_vendor_lead_code: </td><td align=\"left\"><font class=\"body_text\"><input type=\"text\" size=\"15\" name=\"vendor_lead_code\" id=\"vendor_lead_code\" maxlength=\"20\" class=\"cust_form\" value=\"\" />";}

change this line to include "readonly"

{echo "$label_vendor_lead_code: </td><td align=\"left\"><font class=\"body_text\"><input readonly type=\"text\" size=\"15\" name=\"vendor_lead_code\" id=\"vendor_lead_code\" maxlength=\"20\" class=\"cust_form\" value=\"\" />";}


Then


For Name this would be;

{echo "&nbsp; $label_first_name: <input type=\"text\" size=\"17\" name=\"first_name\" id=\"first_name\" maxlength=\"30\" class=\"cust_form\" value=\"\" />";}
->
{echo "&nbsp; $label_first_name: <input readonly type=\"text\" size=\"17\" name=\"first_name\" id=\"first_name\" maxlength=\"30\" class=\"cust_form\" value=\"\" />";}

I Tested it to check it works and it seems fine. You should probably test on a backup vicidial.php before going into production with it as with any change.


EDIT- For anybody making these changes in future;
1 - Don't unless you are sure what you are doing or the server is non critical
2 - Use some common sense (in this case, the box is a input box, I know the box uses vendor_lead_code (INSPECT ELEMENT = <input type="text" size="15" name="vendor_lead_code" id="vendor_lead_code" maxlength="20" class="cust_form" value="">)
3 - Grep is your friend (in this case, grep vendor_lead_code /srv/www/htdocs/agc/vicidial.php | grep input)



{echo " </td><td align=\"left\"><input type=\"hidden\" name=\"vendor_lead_code\" id=\"vendor_lead_code\" value=\"\" />";}
Well thats hidden so when you check the source you can find it pertains to the ---hide--- code
{echo "$label_vendor_lead_code: </td><td align=\"left\"><font class=\"body_text\"><input type=\"text\" size=\"15\" name=\"vendor_lead_code\" id=\"vendor_lead_code\"
Thats probably the one we are looking for
<td align="right"> <?php echo $label_vendor_lead_code ?>: </td><td align="left"><input type="text" size="18" maxlength="20" name="search_vendor_lead_code" id="search_vendor_lead_code"></td>
Contains the word search, so probably not it
Last edited by ZoVoS on Thu Apr 18, 2013 9:20 pm, edited 1 time in total.
ZoVoS
 
Posts: 58
Joined: Fri Aug 17, 2012 11:07 am

Re: Label Read Only

Postby williamconley » Thu Apr 18, 2013 9:19 pm

considering how simple the change is ... i wonder if it would be worth modifying the "agent screens" and "system settings" screen ... to include a "read only" checkbox. :) I bet Matt would include it if he were paid or provided a valid DIFF against latest ... seems like a good feature.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Label Read Only

Postby ZoVoS » Thu Apr 18, 2013 9:22 pm

williamconley wrote:considering how simple the change is ... i wonder if it would be worth modifying the "agent screens" and "system settings" screen ... to include a "read only" checkbox. :) I bet Matt would include it if he were paid or provided a valid DIFF against latest ... seems like a good feature.


there are tons of little changes like this I do for clients. ill list them all one day =]

I suppose i could start now if you want. The change your asking for would be easyer to impliment by adding another modifier. currently the code goes somthing like this

if ($label_province == '---HIDE---')
{echo " </td><td align=\"left\"><input type=\"hidden\" name=\"province\" id=\"province\" value=\"\" />";}
else
{echo "$label_province: </td><td align=\"left\"><font class=\"body_text\"><input type=\"text\" size=\"20\" name=\"province\" id=\"province\" maxlength=\"50\" class=\"cust_form\" value=\"\" />";}

could use a regex replace to look for anything that has a (if*---HIDE---*else)

then duplicate everything between if and else using a elseif X == '---NOEDIT---')
replacing input type with input readonly type
ZoVoS
 
Posts: 58
Joined: Fri Aug 17, 2012 11:07 am

Re: Label Read Only

Postby ZoVoS » Thu Apr 18, 2013 9:32 pm

Code: Select all
 grep -i -- '--HIDE--' /srv/www/htdocs/agc/vicidial.php
# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings
if ($label_gender == '---HIDE---')
                                                if ($label_gender == '---HIDE---')
        if ($label_title == '---HIDE---')
        if ($label_first_name == '---HIDE---')
        if ($label_middle_initial == '---HIDE---')
        if ($label_last_name == '---HIDE---')
        if ($label_address1 == '---HIDE---')
        if ($label_address2 == '---HIDE---')
        if ($label_address3 == '---HIDE---')
        if ($label_city == '---HIDE---')
        if ($label_state == '---HIDE---')
        if ($label_postal_code == '---HIDE---')
        if ($label_province == '---HIDE---')
        if ($label_vendor_lead_code == '---HIDE---')
        if ($label_gender == '---HIDE---')
        if ($label_phone_number == '---HIDE---')
        if ($label_phone_code == '---HIDE---')
        if ($label_alt_phone == '---HIDE---')
        if ($label_security_phrase == '---HIDE---')
        if ($label_email == '---HIDE---')
        if ($label_comments == '---HIDE---')


dam hes not parsing the ---HIDE--- when the LABEL is looked up in the system 2 secs

EDIT1

ok so the problem here is that

Code: Select all
if (strlen($row[0])>0)  {$label_title =                         $row[0];}
if (strlen($row[1])>0)  {$label_first_name =            $row[1];}
if (strlen($row[2])>0)  {$label_middle_initial =        $row[2];}
if (strlen($row[3])>0)  {$label_last_name =                     $row[3];}
if (strlen($row[4])>0)  {$label_address1 =                      $row[4];}
if (strlen($row[5])>0)  {$label_address2 =                      $row[5];}
if (strlen($row[6])>0)  {$label_address3 =                      $row[6];}
if (strlen($row[7])>0)  {$label_city =                          $row[7];}
if (strlen($row[8])>0)  {$label_state =                         $row[8];}
if (strlen($row[9])>0)  {$label_province =                      $row[9];}
if (strlen($row[10])>0) {$label_postal_code =           $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code =      $row[11];}
if (strlen($row[12])>0) {$label_gender =                        $row[12];}
if (strlen($row[13])>0) {$label_phone_number =          $row[13];}
if (strlen($row[14])>0) {$label_phone_code =            $row[14];}
if (strlen($row[15])>0) {$label_alt_phone =                     $row[15];}
if (strlen($row[16])>0) {$label_security_phrase =       $row[16];}
if (strlen($row[17])>0) {$label_email =                         $row[17];}
if (strlen($row[18])>0) {$label_comments =                      $row[18];}


simply looks for anything over 0 characters

best way to change it would be to use --- as a diliminator and then you could set it to do all sorts of fancy stuff on a per field basis

$row[x] = explode("---", $row['x'])
with hide that would probably make an array
$row[0][0] = ""
$row[0][1] = HIDE
$row[0][2] = ""

so you would want to check the last value in the nested array for the field name work backwards through the array applying options? skipping blanks =P

it could be done in many other ways but that is the least coding required I suppose. TBH it would be nicer to change the way its processed.
Last edited by ZoVoS on Thu Apr 18, 2013 9:42 pm, edited 1 time in total.
ZoVoS
 
Posts: 58
Joined: Fri Aug 17, 2012 11:07 am

Re: Label Read Only

Postby williamconley » Thu Apr 18, 2013 9:34 pm

so package it up and DIFF it against the latest install and upload it to the Vicidial Issue Tracker so NOEDIT can be an option just like HIDE (although, personally, I'd like READONLY instead of NOEDIT, but ... I'm strange and you're writing the DIFF today! LOL).

pretty good work, dude!
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Label Read Only

Postby ZoVoS » Thu Apr 18, 2013 10:24 pm

screw it looking at the code ill just implement a dirty solution for now and rewrite the whole thing when i have time =P

if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
...
...
...

each line could be changed to;

if (strlen($row[0])>0)
{
if($row[0] == '---READONLY---')
{$label_title_READONLY='x';}
else
{$label_title = $row[0];}
}

etc

then

{echo "$label_alt_phone: </td><td align=\"left\"><font class=\"body_text\"><input type=\"text\" size=\"14\" name=\"alt_phone\" id=\"alt_phone\" maxlength=\"16\" class=\"cust_form\" value=\"\" />";}
becomes
{echo "$label_alt_phone: </td><td align=\"left\"><font class=\"body_text\"><input ".($label_alt_phone_READONLY == x ? 'readonly' : '')." type=\"text\" size=\"14\" name=\"alt_phone\" id=\"alt_phone\" maxlength=\"16\" class=\"cust_form\" value=\"\" />";}


ill have to check if php needs a false side to its Ternary.

its 4:30 AM ill write it when I wake up, before I do would it be better to write a quick and dirty solution? write an explode array that can store multiple tags?

lots of problems with different approaches.


using hide it doesn't matter if you change the field as you wont display it anyway
Using read only you will display the field but if it changes the value you cant display it
if you use the value ---READONLY--- and change it at the time its echoed to the screen you wont be able to use READONLY and a custom name


Personally I would change how ---HIDE--- Operatesand explode the segments and store the information in either an array using the current labels or probably better a FLAG (like the proposed $label_title_READONLY) but the flag could be then reused for other changes (not that I can think of any right now which is why the dirty solution is appealing. most other changes would be done on custom lists)

argh choices choices =P

ANYHOO ill leave this up until tomorrow morning anybody add you comments and ill do whatever group consensus is.
ZoVoS
 
Posts: 58
Joined: Fri Aug 17, 2012 11:07 am

Re: Label Read Only

Postby williamconley » Thu Apr 18, 2013 11:24 pm

isn't there a "disable" for fields in html? I'm rusty and it's late ...
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 136 guests