diff options
author | ivan <ivan> | 2010-07-17 21:41:48 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-07-17 21:41:48 +0000 |
commit | a98cd4637716d783c20bb08d903978d06abf9d31 (patch) | |
tree | fa5c8ec0a7829d82dfee3e77c487480a58150b64 /httemplate | |
parent | 556b8e9650155e74416496238cfc0e4abe64c53a (diff) |
customer tags, RT#9192
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/part_tag.html | 9 | ||||
-rw-r--r-- | httemplate/edit/part_tag.html | 15 | ||||
-rw-r--r-- | httemplate/elements/pickcolor.html | 60 | ||||
-rw-r--r-- | httemplate/elements/tr-pickcolor.html | 11 |
4 files changed, 83 insertions, 12 deletions
diff --git a/httemplate/browse/part_tag.html b/httemplate/browse/part_tag.html index 3bb166199..d0ef72ec3 100644 --- a/httemplate/browse/part_tag.html +++ b/httemplate/browse/part_tag.html @@ -6,9 +6,10 @@ ], 'query' => { 'table' => 'part_tag', }, 'count_query' => 'SELECT COUNT(*) FROM part_tag', - 'header' => [ 'Tag', 'Description', 'Color' ], - 'fields' => [ 'tagname', 'tagdesc', 'tagcolor' ], - 'links' => [ $link, '', '' ], + 'header' => [ 'Tag', 'Message', ], + 'fields' => [ 'tagname', 'tagdesc', ], + 'links' => [ $link, '', ], + 'cell_style' => [ '', $tagdesc_style ], 'disableable' => 1, 'disabled_statuspos' => 1, ) @@ -18,6 +19,8 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $tagdesc_style = sub { 'background-color:#'.shift->tagcolor }; + my $link = [ "${p}edit/part_tag.html?", 'tagnum' ]; </%init> diff --git a/httemplate/edit/part_tag.html b/httemplate/edit/part_tag.html index 56ba5672c..319063fea 100644 --- a/httemplate/edit/part_tag.html +++ b/httemplate/edit/part_tag.html @@ -4,11 +4,11 @@ 'fields' => [ 'tagname', { field=>'disabled', type=>'checkbox', value=>'Y' }, 'tagdesc', - 'tagcolor' + $tagcolor, ], 'labels' => { 'tagnum' => 'Tag #', 'tagname' => 'Tag', - 'tagdesc' => 'Description', + 'tagdesc' => 'Message', 'tagcolor' => 'Highlight Color', 'disabled' => 'Disabled', }, @@ -20,12 +20,9 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -#FF6666 red -#FF9966 orange -#FFFF66 yellow -#66FF66 green -#66FFFF cyan? -#6666FF blue -#FF66FF purple? looks more like pink. CC66FF? +my $tagcolor = { + field => 'tagcolor', + type => 'pickcolor', +}; </%init> diff --git a/httemplate/elements/pickcolor.html b/httemplate/elements/pickcolor.html new file mode 100644 index 000000000..d410ebfc7 --- /dev/null +++ b/httemplate/elements/pickcolor.html @@ -0,0 +1,60 @@ +<INPUT TYPE="hidden" NAME="<% $opt{'field'} %>" ID="<%$id%>" VALUE="<%$value%>"> +<TABLE BGCOLOR="#FFFFFF" ID="showcolor<%$unum%>"> +<TR> + <TD STYLE="border:1px solid blue;background-color:#<%$value%>" WIDTH=16 HEIGHT=16 ID="currcolor<%$unum%>"></TD> + <TD> <A HREF="javascript:void(0);" onClick="change_clicked<%$unum%>()">change</A></TD> +</TR> +</TABLE> +<TABLE BGCOLOR="#FFFFFF" ID="pickcolor<%$unum%>" STYLE="display:none"> +% for (1..$rows) { + <TR> +% for (1..$cols) { +% last unless @colors; +% my $color = shift(@colors); + <TD STYLE="border:1px solid blue;cursor:pointer;cursor:hand" BGCOLOR="#<% $color %>" WIDTH=16 HEIGHT=16 onClick="color_clicked<%$unum%>('<%$color%>')"></TD> +% } + </TR> +% } +</TABLE> +<SCRIPT TYPE="text/javascript"> + + function change_clicked<%$unum%>() { + document.getElementById('showcolor<%$unum%>').style.display = 'none'; + document.getElementById('pickcolor<%$unum%>').style.display = ''; + } + + function color_clicked<%$unum%>(color) { + document.getElementById('<%$id%>').value = color; //update hidden + if ( color == '' ) { color = 'ffffff'; } + document.getElementById('currcolor<%$unum%>').style.backgroundColor = '#' + color; + document.getElementById('showcolor<%$unum%>').style.display = ''; + document.getElementById('pickcolor<%$unum%>').style.display = 'none'; + } + +</SCRIPT> +<%init> + +my %opt = @_; + +my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value}; + +my $unum = int(rand(100000)); + +my $id = $opt{'id'} || $opt{'field'}.$unum; + +my @colors = ( + '', #none/white + 'FF6666', #red + 'FF9966', #orange + 'FFFF66', #yellow + '66FF66', #green + '66FFFF', #cyan? + '6666FF', #blue + 'CC66FF', #purple? FF66FF looks more like pink. +); + +my $rows = 2; + +my $cols = int(.5+scalar(@colors)/$rows); + +</%init> diff --git a/httemplate/elements/tr-pickcolor.html b/httemplate/elements/tr-pickcolor.html new file mode 100644 index 000000000..2b6cc23ca --- /dev/null +++ b/httemplate/elements/tr-pickcolor.html @@ -0,0 +1,11 @@ +<% include('tr-td-label.html', @_ ) %> + <TD <% $colspan %> <% $cell_style %> ID="<% $opt{input_id} || $opt{id}.'_input0' %>"><% include('pickcolor.html', @_ ) %></TD> +<%init> + +my %opt = @_; + +my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; + +my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : ''; + +</%init> |