1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-06 02:46:42 +02:00

Extended fields added for Skype and Gender. Also GUI cleanup.

This commit is contained in:
Cameron 2013-04-17 12:19:47 -07:00
parent 70173958e2
commit 33c82dac70
4 changed files with 130 additions and 58 deletions

View File

@ -483,10 +483,10 @@ class users_ext
}
$text .= "
</td>
<td class='center' style='width:10%'>
<td class='center' style='width:10%;white-space:nowrap'>
<a style='text-decoration:none' href='".e_SELF."?editext.".$id."'>".ADMIN_EDIT_ICON."</a>
<input type='image' title='".LAN_DELETE."' name='eudel[".$name."]' src='".ADMIN_DELETE_ICON_PATH."' value='".$id."' onclick='return confirm(\"".EXTLAN_27."\")' />
<a class='btn btn-large' style='text-decoration:none' href='".e_SELF."?editext.".$id."'>".ADMIN_EDIT_ICON."</a>
<input class='btn btn-large' type='image' title='".LAN_DELETE."' name='eudel[".$name."]' src='".ADMIN_DELETE_ICON_PATH."' value='".$id."' onclick='return confirm(\"".EXTLAN_27."\")' />
</td>
</tr>
";
@ -991,14 +991,16 @@ class users_ext
$var['main']['text'] = EXTLAN_34;
$var['main']['link'] = e_SELF;
$var['editext']['text'] = EXTLAN_45;
$var['pre']['text'] = EXTLAN_45;
$var['pre']['link'] = e_SELF."?pre";
$var['editext']['text'] = "Add Custom Field";
$var['editext']['link'] = e_SELF."?editext";
$var['cat']['text'] = EXTLAN_35;
$var['cat']['link'] = e_SELF."?cat";
$var['pre']['text'] = EXTLAN_56;
$var['pre']['link'] = e_SELF."?pre";
show_admin_menu(EXTLAN_9, $action, $var);
}

View File

@ -50,6 +50,20 @@
<read>253</read>
<write>253</write>
</item>
<item name="skype">
<type>text</type>
<include_text>class='tbox' size='40' maxlength='254'</include_text>
<applicable>253</applicable>
<read>253</read>
<write>253</write>
</item>
<item name="gender">
<type>radio</type>
<values>M => UE_LAN_MALE,F => UE_LAN_FEMALE</values>
<applicable>253</applicable>
<read>253</read>
<write>253</write>
</item>
<item name="homepage">
<type>text</type>
<include_text>class='tbox' size='40' maxlength='254'</include_text>

View File

@ -628,21 +628,27 @@ class e107_user_extended
function user_extended_edit($struct, $curval)
{
global $tp;
$tp = e107::getParser();
$frm = e107::getForm();
if(trim($curval) == "" && $struct['user_extended_struct_default'] != "")
{
$curval = $struct['user_extended_struct_default'];
}
$choices = explode(",",$struct['user_extended_struct_values']);
foreach($choices as $k => $v)
{
$choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
$choices[$k] = str_replace("[E_COMMA]", ",", $v);
}
$parms = explode("^,^",$struct['user_extended_struct_parms']);
$include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
$regex = $tp->toText($parms[1]);
$regexfail = $tp->toText($parms[2]);
$fname = "ue[user_".$struct['user_extended_struct_name']."]";
if(strpos($include, 'class') === FALSE)
{
$include .= " class='tbox' ";
@ -658,24 +664,56 @@ class e107_user_extended
break;
case EUF_RADIO : //radio
$ret = '';
foreach($choices as $choice)
{
$choice = trim($choice);
$choice = deftrue($choice, $choice);
$chk = ($curval == $choice)? " checked='checked' " : "";
$ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
}
return $ret;
break;
case EUF_CHECKBOX : //checkboxes
$ret = '';
foreach($choices as $choice)
{
$choice = trim($choice);
if(strpos($choice,"|")!==FALSE)
{
list($val,$label) = explode("|",$choice);
}
elseif(strpos($choice," => ")!==FALSE) // new in v2.x
{
list($val,$label) = explode(" => ",$choice);
}
else
{
$val = $choice;
$label = $choice;
}
$label = deftrue($label, $label);
if(deftrue('e_BOOTSTRAP'))
{
$ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label));
}
else
{
$chk = ($curval == $val)? " checked='checked' " : "";
$ret .= "<input {$include} type='radio' name='{$fname}' value='{$val}' {$chk} /> {$label}";
}
}
return $ret;
break;
case EUF_CHECKBOX : //checkboxes
foreach($choices as $choice)
{
$choice = trim($choice);
if(strpos($choice,"|")!==FALSE)
{
list($val,$label) = explode("|",$choice);
}
elseif(strpos($choice," => ")!==FALSE) // new in v2.x
{
list($val,$label) = explode(" => ",$choice);
}
else
{
@ -683,9 +721,18 @@ class e107_user_extended
$label = $choice;
}
$label = deftrue($label, $label);
if(deftrue('e_BOOTSTRAP'))
{
$ret .= $frm->checkbox($fname,$val,($curval == $val),array('label'=>$label));
}
else
{
$chk = ($curval == $val)? " checked='checked' " : "";
$ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />";
}
}
return $ret;
break;

View File

@ -50,4 +50,13 @@ define('UE_LAN_TIMEZONE_DESC', 'User Timezone (from predefined list)');
define("LAN_UE_FAIL_HOMEPAGE", "Invalid entry for home page setting");
define("UE_LAN_SKYPE","Skype");
define("UE_LAN_SKYPE_DESC","Skype Address");
define("UE_LAN_GENDER","Gender");
define("UE_LAN_GENDER_DESC","Gender");
define("UE_LAN_MALE","Male");
define("UE_LAN_FEMALE","Female");
?>