Adam Rose <adamr@eaze.net>: "In the /edit/part_svc.cgi is there a need to add
[freeside.git] / htdocs / edit / part_svc.cgi
index 58a1e04..e82306d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: part_svc.cgi,v 1.7 1999-01-19 05:13:42 ivan Exp $
+# $Id: part_svc.cgi,v 1.14 2001-05-30 14:42:11 ivan Exp $
 #
 # ivan@sisd.com 97-nov-14
 #
 # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12
 #
 # $Log: part_svc.cgi,v $
-# Revision 1.7  1999-01-19 05:13:42  ivan
+# Revision 1.14  2001-05-30 14:42:11  ivan
+# Adam Rose <adamr@eaze.net>: "In the /edit/part_svc.cgi is there a need to add
+# another section for svc_www?".  Yes.  Thanks Adam.
+#
+# Revision 1.13  2000/06/15 11:10:31  ivan
+# update to the inline documentation, hopefully will make things more clear
+#
+# Revision 1.12  1999/04/09 04:22:34  ivan
+# also table()
+#
+# Revision 1.11  1999/04/09 03:52:55  ivan
+# explicit & for table/itable/ntable
+#
+# Revision 1.10  1999/04/08 13:01:50  ivan
+#  [ AND DOCUMENT! ] all svc_acct services should have a default
+#  or fixed shell
+#
+# Revision 1.9  1999/02/23 08:09:21  ivan
+# beginnings of one-screen new customer entry and some other miscellania
+#
+# Revision 1.8  1999/02/07 09:59:21  ivan
+# more mod_perl fixes, and bugfixes Peter Wemm sent via email
+#
+# Revision 1.7  1999/01/19 05:13:42  ivan
 # for mod_perl: no more top-level my() variables; use vars instead
 # also the last s/create/new/;
 #
@@ -41,21 +64,31 @@ $cgi = new CGI;
 
 &cgisuidsetup($cgi);
 
-($query) = $cgi->keywords;
-if ( $query && $query =~ /^(\d+)$/ ) { #editing
+if ( $cgi->param('error') ) {
+  $part_svc = new FS::part_svc ( {
+    map { $_, scalar($cgi->param($_)) } fields('part_svc')
+  } );
+} elsif ( $cgi->keywords ) {
+  my ($query) = $cgi->keywords;
+  $query =~ /^(\d+)$/;
   $part_svc=qsearchs('part_svc',{'svcpart'=>$1});
-  $action='Edit';
 } else { #adding
   $part_svc = new  FS::part_svc {};
-  $action='Add';
 }
+$action = $part_svc->svcpart ? 'Edit' : 'Add';
 $hashref = $part_svc->hashref;
 
 $p = popurl(2);
 print $cgi->header( '-expires' => 'now' ), header("$action Service Definition", menubar(
   'Main Menu' => $p,
   'View all services' => "${p}browse/part_svc.cgi",
-)), '<FORM ACTION="', popurl(1), 'process/part_svc.cgi" METHOD=POST>';
+));
+
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+      "</FONT>"
+  if $cgi->param('error');
+
+print '<FORM ACTION="', popurl(1), 'process/part_svc.cgi" METHOD=POST>';
 
 print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$hashref->{svcpart}">!,
       "Service Part #", $hashref->{svcpart} ? $hashref->{svcpart} : "(NEW)";
@@ -68,6 +101,7 @@ Services are items you offer to your customers.
 <UL><LI>svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
     <LI>svc_domain - Virtual domains
     <LI>svc_acct_sm - Virtual domain mail aliasing
+    <LI>svc_www - Virtual domain website
 END
 #    <LI>svc_charge - One-time charges (Partially unimplemented)
 #    <LI>svc_wo - Work orders (Partially unimplemented)
@@ -80,9 +114,9 @@ blank <B>slipip</B> as well as a fixed shell something like <B>/bin/true</B> or
 <B>/usr/bin/passwd</B>.
 <BR><BR>
 END
-print table, '<TR><TH>Table<SELECT NAME="svcdb" SIZE=1>',
+print &table(), '<TR><TH>Table<SELECT NAME="svcdb" SIZE=1>',
       map '<OPTION'. ' SELECTED'x($_ eq $hashref->{svcdb}). ">$_\n", qw(
-        svc_acct svc_domain svc_acct_sm
+        svc_acct svc_domain svc_acct_sm svc_www
       );
       print "</SELECT>";
 #  svc_acct svc_domain svc_acct_sm svc_charge svc_wo
@@ -98,13 +132,13 @@ END
   'svc_acct' => {
     'dir'       => 'Home directory',
     'uid'       => 'UID (set to fixed and blank for dial-only)',
-    'slipip'    => 'IP address',
+    'slipip'    => 'IP address (set to fixed and blank to disable dialin)',
     'popnum'    => qq!<A HREF="$p/browse/svc_acct_pop.cgi/">POP number</A>!,
     'username'  => 'Username',
     'quota'     => '(unimplemented)',
     '_password' => 'Password',
     'gid'       => 'GID (when blank, defaults to UID)',
-    'shell'     => 'Shell',
+    'shell'     => 'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file)',
     'finger'    => 'GECOS',
   },
   'svc_domain' => {
@@ -122,11 +156,15 @@ END
     'worker'    => 'Worker',
     '_date'      => 'Date',
   },
+  'svc_www' => {
+    #'recnum' => '',
+    #'usersvc' => '',
+  },
 );
 
 #  svc_acct svc_domain svc_acct_sm svc_charge svc_wo
 foreach $svcdb ( qw(
-  svc_acct svc_domain svc_acct_sm
+  svc_acct svc_domain svc_acct_sm svc_www
 ) ) {
 
   my(@rows)=map { /^${svcdb}__(.*)$/; $1 }
@@ -138,9 +176,12 @@ foreach $svcdb ( qw(
   my($ptmp)="<TD ROWSPAN=$rowspan>$svcdb</TD>";
   my($row);
   foreach $row (@rows) {
-    my($value)=$part_svc->getfield($svcdb.'__'.$row);
-    my($flag)=$part_svc->getfield($svcdb.'__'.$row.'_flag');
-    print "<TR>$ptmp<TD>$row - <FONT SIZE=-1>$defs{$svcdb}{$row}</FONT></TD>";
+    my $value = $part_svc->getfield($svcdb. '__'. $row);
+    my $flag = $part_svc->getfield($svcdb. '__'. $row. '_flag');
+    print "<TR>$ptmp<TD>$row";
+    print "- <FONT SIZE=-1>$defs{$svcdb}{$row}</FONT>"
+      if defined $defs{$svcdb}{$row};
+    print "</TD>";
     print qq!<TD><INPUT TYPE="radio" NAME="${svcdb}__${row}_flag" VALUE=""!.
       ' CHECKED'x($flag eq ''). ">Off</TD>";
     print qq!<TD><INPUT TYPE="radio" NAME="${svcdb}__${row}_flag" VALUE="D"!.