[freeside-devel] Possible Changes to svc_www.cgi and svc_www.pm

Stephen Bechard steve at destek.net
Sat Jun 22 22:04:50 PDT 2002


----- Original Message -----
From: "Stephen Bechard" <steve at destek.net>
To: <ivan-freeside-devel at sisd.com>
Sent: Saturday, June 22, 2002 10:35 PM
Subject: Re: [freeside-devel] Possible Changes to svc_www.cgi and svc_www.pm


> > Thanks for the patches; applied.
>
> As I was working on the edit svc_www.cgi I found that you had already
> solved the . issue in the website name in the view/svc_www.cgi,
> so to keep things consistent you might want the change my earlier fix
> for svc_www.pm of $zone = "$zone.". $svc_domain->domain;
> to $zone .= '.'. $svc_domain->domain;
> Which should be the same ending result.
>
> > On Sat, Jun 22, 2002 at 09:20:59PM -0400, Stephen Bechard wrote:
> > > I am now going to work some scripts that will allow the options of
> > > editing/modifing the reczone with the posibility to delete it as well.
> > > Unless you know of someone else that is doing this...
> >
> > If you mean editing the DNS/zone data, there's already
> > (import from/export to) BIND and a web editor for the zone files.
>
> I noticed in that view/svc_domain.cgi there was a (delete) option for each
> of the DNS/zone data records, but not and edit. I also noticed that there
is
> no error checking on the deletion of these zones compared to configured
> svc_www
> records that might be attached to it. :(
>
> > svc_www is intended for website hosting with Apache or whatnot.  I could
> > totally see some amount of automatic zone provisioning for websites,
> > though.
>
> I was referring to changing which recnum and usersvc that was attached to
> the svc_www record.
> For example changing recnum of the www to ww2, or changing the usersvc to
a
> different svc_acct.
> I found that there was indeed a edit/svc_www.cgi which did just what I
> wanted as long as the
> other Records are present, there just wasn't a link from the view to the
> edit.
> The only thing I had to tweak was that the process/svc_www.cgi had to be
> changed as it
> seemed to be checking the wrong table. Is this Correct? Here is the diff:
>
> *** /tarballs/freeside-1.4.0pre14/httemplate/edit/process/svc_www.cgi
> Mon Feb 11 14:38:58 2002
> --- ../edit/process/svc_www.cgi Sat Jun 22 21:55:47 2002
> ***************
> *** 5,12 ****
>
>   my $old;
>   if ( $svcnum ) {
> !   $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } )
> !     or die "fatal: can't find account (svcnum $svcnum)!";
>   } else {
>     $old = '';
>   }
> --- 5,12 ----
>
>   my $old;
>   if ( $svcnum ) {
> !   $old = qsearchs('svc_www', { 'svcnum' => $svcnum } )
> !     or die "fatal: can't find website (svcnum $svcnum)!";
>   } else {
>     $old = '';
>   }
>
> I have added the above diff and the link to the edit/svc_www.cgi and life
is
> good.
> Here is the link diff:
>
> *** /tarballs/freeside-1.4.0pre14/httemplate/view/svc_www.cgi       Tue
Feb
> 19 20:03:10 2002
> --- svc_www.cgi Sat Jun 22 22:24:37 2002
> ***************
> *** 41,46 ****
> --- 41,50 ----
>   )).
>         "Service #$svcnum".
>         qq!<BR>Website name: <B><A HREF="http://$www">$www</A></B>!.
> +       '&nbsp;(&nbsp;<A HREF="'. popurl(2). 'edit/svc_www.cgi?'. $svcnum.
> +           '">Edit</A>&nbsp;)'.
>         '<BR>'. joblisting({'svcnum'=>$svcnum}, 1).
>         '</BODY></HTML>'
>   ;
>
> However, this updates the recnum and usersvc in the svc_www table, but
> doesn't
> put anything back in the queue to make the necessary changes on the Remote
> Server.
> Is this not implemented yet?
>
> The other part of this was to have the ability to delete the svc_www
record
> without
> having to cancel all of the services in a Larger Package. I would rather
> have an
> unprovisioned service, than have to rebuild all of the other services, by
> cancelling
> one Package and Adding another.

Here is the updated diff of the view/svc_www.cgi with the edit and delete
links.
You will also need the new file /misc/delete-svc_www.cgi as well. (see
below)

*** /tarballs/freeside-1.4.0pre14/httemplate/view/svc_www.cgi       Tue Feb
19 20:03:10 2002
--- view/svc_www.cgi Sun Jun 23 01:04:35 2002
***************
*** 38,46 ****
            "${p}misc/cancel-unaudited.cgi?$svcnum" )
    ),
    "Main menu" => $p,
! )).
!       "Service #$svcnum".
        qq!<BR>Website name: <B><A HREF="http://$www">$www</A></B>!.
        '<BR>'. joblisting({'svcnum'=>$svcnum}, 1).
        '</BODY></HTML>'
  ;
--- 38,61 ----
            "${p}misc/cancel-unaudited.cgi?$svcnum" )
    ),
    "Main menu" => $p,
! ));
!
! print <<END;
! <SCRIPT>
! function svc_www_areyousure(href) {
!     if (confirm("Are you sure you want to delete this website?")
!  == true)
!         window.location.href = href;
! }
! </SCRIPT>
! END
!
! print "Service #$svcnum".
        qq!<BR>Website name: <B><A HREF="http://$www">$www</A></B>!.
+       '&nbsp;(&nbsp;<A HREF="'. popurl(2). 'edit/svc_www.cgi?'. $svcnum.
+           '">Edit</A>&nbsp;)'.
+       '&nbsp;(&nbsp;<A HREF="javascript:svc_www_areyousure(\''. popurl(2).
+           'misc/delete-svc_www.cgi?'.  $svcnum. '\')">delete</A>&nbsp;)'.
        '<BR>'. joblisting({'svcnum'=>$svcnum}, 1).
        '</BODY></HTML>'
  ;

Here is the misc/delete-svc_www.cgi I crafted up based on the other
misc/delete-* files. Everything works great from the database standpoint,
but I have the same problem as the edit/svc_www.cgi, nothing gets put back
into the queue for processing on the remote server. Maybe its in the .pm?

Well any way here it is and it needs to be put in the misc/ directory.

-- start of file: delete-svc_www.cgi -----------------------------------
<%

#untaint svcnum
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/ || die "Illegal svcnum";
my $svcnum = $1;

my $svc_www = qsearchs('svc_www',{'svcnum'=>$svcnum});
my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});

my $error = $svc_www->delete;
eidiot($error) if $error;

print $cgi->redirect($p. "view/cust_pkg.cgi?". $cust_svc->pkgnum);

%>
-- end of file: delete-svc_www.cgi -----------------------------------

Enjoy,
Steve




More information about the freeside-devel mailing list