[vhffs-dev] [947] Admin part of web areas is now in web/prefs.pl, admin/web/edit. pl should disappear soon.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 947
Author:   gradator
Date:     2007-09-27 21:54:42 +0000 (Thu, 27 Sep 2007)

Log Message:
-----------
Admin part of web areas is now in web/prefs.pl, admin/web/edit.pl should disappear soon. All admin/*/(edit.pl|show.pl) are going to be deleted.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Object.pm
    trunk/vhffs-api/src/Vhffs/Panel/Web.pm
    trunk/vhffs-panel/admin/web/list.pl
    trunk/vhffs-panel/templates/Makefile.am
    trunk/vhffs-panel/templates/admin/web/part.tmpl
    trunk/vhffs-panel/templates/web/prefs.tmpl
    trunk/vhffs-panel/web/prefs.pl

Added Paths:
-----------
    trunk/vhffs-panel/templates/admin/object/editembedded.tmpl


Modified: trunk/vhffs-api/src/Vhffs/Panel/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Object.pm	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-api/src/Vhffs/Panel/Object.pm	2007-09-27 21:54:42 UTC (rev 947)
@@ -42,6 +42,7 @@
 use strict;
 use Vhffs::User;
 use Vhffs::Main;
+use Vhffs::Object;
 use Vhffs::Acl;
 use Vhffs::Services::Cvs;
 use Vhffs::Panel::Main;
@@ -74,4 +75,153 @@
     return $objs;
 }
 
+
+sub admin_part
+{
+	my $panel = shift;
+	my $object = shift;
+
+	#return undef unless defined $object;
+
+	my $vhffs = $panel->{vhffs};
+	my $templatedir = $panel->{templatedir};
+	my $user = $panel->{user};
+
+	#return undef if( $user->is_admin != 1 );
+
+	my $template = new HTML::Template( filename => $templatedir.'/panel/admin/object/editembedded.tmpl' );
+
+	$template->param( TITLE => gettext("Admin part") );
+
+	$template->param( TEXT_OID => gettext("Object id") );
+	$template->param( TEXT_UID => gettext("UID of owner") );
+	$template->param( TEXT_DATE => gettext("Date of creation") );
+	$template->param( TEXT_STATUS => gettext("Status") );
+	$template->param( TEXT_DESCRIPTION => gettext("Description") );
+	$template->param( SEND => gettext("Send") );
+	
+
+	$template->param( VALUE_DESCRIPTION => CGI::escapeHTML( $object->get_description ) );
+	$template->param( VALUE_OID => $object->get_oid );
+	$template->param( VALUE_UID => $object->get_owner_uid );
+	$template->param( VALUE_USERNAME => Vhffs::User::get_name_by_uid( $vhffs , $object->get_owner_uid ));
+
+	if( defined $object->get_date )
+	{
+		$template->param( VALUE_DATE => $object->get_date );
+	}
+	else
+	{
+		$template->param( VALUE_DATE => gettext("no date") );
+	}
+
+	$template->param( TEXT_STATUS_WAITING_FOR_VALIDATION => gettext("Waiting for validation") );
+	$template->param( TEXT_STATUS_VALIDATION_REFUSED => gettext("Validation refused") );
+	$template->param( TEXT_STATUS_WAITING_FOR_CREATION => gettext("Waiting for creation") );
+	$template->param( TEXT_STATUS_CREATING_ERROR => gettext("Creating error") );
+	$template->param( TEXT_STATUS_ACTIVATED => gettext("Activated") );
+	$template->param( TEXT_STATUS_CREATED => gettext("Created") );
+	$template->param( TEXT_STATUS_SUSPENDED => gettext("Suspended") );
+	$template->param( TEXT_STATUS_SUSPENDED_BEFORE_DELETED => gettext("Suspended") );
+	$template->param( TEXT_STATUS_WAITING_FOR_MODIFICATION => gettext("Waiting for modification") );
+	$template->param( TEXT_STATUS_MODIFICATION_ERROR => gettext("Modification error") );
+	$template->param( TEXT_STATUS_MODIFICATION_APPLIED => gettext("Modification applied") );
+	$template->param( TEXT_STATUS_TO_DELETE => gettext("Will be deleted") );
+
+	$template->param( VALUE_STATUS_WAITING_FOR_VALIDATION => Vhffs::Constants::WAITING_FOR_VALIDATION );
+	$template->param( VALUE_STATUS_VALIDATION_REFUSED => Vhffs::Constants::VALIDATION_REFUSED );
+	$template->param( VALUE_STATUS_WAITING_FOR_CREATION => Vhffs::Constants::WAITING_FOR_CREATION );
+	$template->param( VALUE_STATUS_CREATING_ERROR => Vhffs::Constants::CREATING_ERROR );
+	$template->param( VALUE_STATUS_ACTIVATED => Vhffs::Constants::ACTIVATED );
+	$template->param( VALUE_STATUS_CREATED => Vhffs::Constants::CREATED );
+	$template->param( VALUE_STATUS_SUSPENDED => Vhffs::Constants::SUSPENDED );
+	$template->param( VALUE_STATUS_SUSPENDED_BEFORE_DELETED => Vhffs::Constants::SUSPENDED_BEFORE_DELETED );
+	$template->param( VALUE_STATUS_WAITING_FOR_MODIFICATION => Vhffs::Constants::WAITING_FOR_MODIFICATION );
+	$template->param( VALUE_STATUS_MODIFICATION_ERROR => Vhffs::Constants::MODIFICATION_ERROR );
+	$template->param( VALUE_STATUS_MODIFICATION_APPLIED => Vhffs::Constants::MODIFICATION_APPLIED );
+	$template->param( VALUE_STATUS_TO_DELETE => Vhffs::Constants::TO_DELETE );
+
+	my $status = $object->get_status;
+
+	if( $status == Vhffs::Constants::WAITING_FOR_VALIDATION )
+	{
+		$template->param( SELECTED_STATUS_WAITING_FOR_VALIDATION => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::VALIDATION_REFUSED )
+	{
+		$template->param( SELECTED_STATUS_VALIDATION_REFUSED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::WAITING_FOR_CREATION )
+	{
+		$template->param( SELECTED_STATUS_WAITING_FOR_CREATION => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::CREATING_ERROR )
+	{
+		$template->param( SELECTED_STATUS_CREATING_ERROR => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::CREATED )
+	{
+		$template->param( SELECTED_STATUS_CREATED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::ACTIVATED )
+	{
+		$template->param( SELECTED_STATUS_ACTIVATED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::SUSPENDED )
+	{
+		$template->param( SELECTED_STATUS_SUSPENDED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::SUSPENDED_BEFORE_DELETED )
+	{
+		$template->param( SELECTED_STATUS_SUSPENDED_BEFORE_DELETED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::WAITING_FOR_MODIFICATION )
+	{
+		$template->param( SELECTED_STATUS_WAITING_FOR_MODIFICATION => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::MODIFICATION_ERROR )
+	{
+		$template->param( SELECTED_STATUS_MODIFICATION_ERROR => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::MODIFICATION_APPLIED )
+	{
+		$template->param( SELECTED_STATUS_MODIFICATION_APPLIED => "selected" );
+	}
+	elsif( $status == Vhffs::Constants::TO_DELETE )
+	{
+		$template->param( SELECTED_STATUS_TO_DELETE => "selected" );
+	}
+
+
+	$template->param( AVATAR_TITLE => gettext( "Avatar management" ) );
+	$template->param( DELETE_AVATAR => gettext( "Delete avatar for this object" ) );
+
+	# Print history
+	$template->param( HISTORY_TITLE => gettext("History of this object") );
+	my $output = "";
+	my $string;
+	my $history = $object->get_history;
+	unless( defined $history )
+	{
+		$template->param( HISTORY => gettext("No event about this object") );
+	}   
+	else
+	{
+	        foreach( keys %{$history} )
+	        {
+			my $subtemplate = new HTML::Template( filename => $templatedir.'/panel/misc/history_part.tmpl' );
+			use DateTime;
+			use DateTime::Locale;
+			use Encode;
+			$subtemplate->param( DATE => Encode::encode_utf8( DateTime->from_epoch( epoch => $history->{$_}{date} , locale => $user->get_lang )->strftime("%a, %d %b %Y %H:%M:%S %z") ) );
+			$subtemplate->param( EVENT => $history->{$_}{message} );
+			$output .= $subtemplate->output;
+		}
+		$template->param( HISTORY => $output );
+	}
+
+	return $template;
+}
+
+
 1;

Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Web.pm	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm	2007-09-27 21:54:42 UTC (rev 947)
@@ -89,10 +89,10 @@
     my $webs = [];
 
     if( defined $name ) {
-        $sql = 'SELECT w.servername, w.object_id AS oid, o.state, g.groupname  FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE w.servername LIKE ?';
+        $sql = 'SELECT w.servername, o.state, g.groupname  FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE w.servername LIKE ?';
         push(@params, '%'.$name.'%');
     } else {
-        $sql = 'SELECT w.servername, w.object_id AS oid, o.state, g.groupname  FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
+        $sql = 'SELECT w.servername, o.state, g.groupname  FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
     }
 
     my $dbh = $main->get_db_object();

Modified: trunk/vhffs-panel/admin/web/list.pl
===================================================================
--- trunk/vhffs-panel/admin/web/list.pl	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-panel/admin/web/list.pl	2007-09-27 21:54:42 UTC (rev 947)
@@ -87,10 +87,10 @@
 
     	if( $user->is_admin == 1 )  {
 			$subtemplate = new HTML::Template( filename => $templatedir."/panel/admin/web/part.tmpl", global_vars => 1 );
-            $subtemplate->param( SEND => gettext('Change this Website') );
+            $subtemplate->param( EDIT => gettext('Edit this Website') );
 		}  else   {
 			$subtemplate = new HTML::Template( filename => $templatedir."/panel/admin/web/part-modo.tmpl", global_vars => 1 );
-            $subtemplate->param( SEND => gettext('Show this Website'));
+            $subtemplate->param( EDIT => gettext('Show this Website'));
 		}
 
         $subtemplate->param( WEBS => $webs );

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-panel/templates/Makefile.am	2007-09-27 21:54:42 UTC (rev 947)
@@ -48,6 +48,7 @@
 	admin/mysql/search.tmpl \
 	admin/mysql/show.tmpl \
 	admin/object/edit.tmpl \
+	admin/object/editembedded.tmpl \
 	admin/object/part.tmpl \
 	admin/object/search.tmpl \
 	admin/pgsql/edit.tmpl \

Added: trunk/vhffs-panel/templates/admin/object/editembedded.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/object/editembedded.tmpl	                        (rev 0)
+++ trunk/vhffs-panel/templates/admin/object/editembedded.tmpl	2007-09-27 21:54:42 UTC (rev 947)
@@ -0,0 +1,65 @@
+<h1><TMPL_VAR NAME="TITLE"></h1>
+	
+<form method="post" action="/admin/object/edit_submit.pl">
+
+	<p>
+		<label>
+			<TMPL_VAR NAME="TEXT_OID">
+		</label>
+		<TMPL_VAR NAME="VALUE_OID">
+	</p>
+	<p>
+		<label for="UID">			
+			<TMPL_VAR NAME="TEXT_UID">
+		</label>
+		<input type="text" name="UID" id="UID" value="<TMPL_VAR NAME="VALUE_UID">" />
+		( <TMPL_VAR NAME="VALUE_USERNAME"> )
+	</p>
+	<p>
+		<label>			
+			<TMPL_VAR NAME="TEXT_DATE">
+		</label>
+			<TMPL_VAR NAME="VALUE_DATE">
+	</p>
+	<p>
+		<label for="STATUS">			
+			<TMPL_VAR NAME="TEXT_STATUS">
+		</label>
+			<select name="STATUS" id="STATUS">
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_WAITING_FOR_VALIDATION">" <TMPL_VAR NAME="SELECTED_STATUS_WAITING_FOR_VALIDATION">> <TMPL_VAR NAME="TEXT_STATUS_WAITING_FOR_VALIDATION"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_VALIDATION_REFUSED">" <TMPL_VAR NAME="SELECTED_STATUS_VALIDATION_REFUSED">> <TMPL_VAR NAME="TEXT_STATUS_VALIDATION_REFUSED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_WAITING_FOR_CREATION">" <TMPL_VAR NAME="SELECTED_STATUS_WAITING_FOR_CREATION">> <TMPL_VAR NAME="TEXT_STATUS_WAITING_FOR_CREATION"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_CREATING_ERROR">" <TMPL_VAR NAME="SELECTED_STATUS_CREATING_ERROR">> <TMPL_VAR NAME="TEXT_STATUS_CREATING_ERROR"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_CREATED">" <TMPL_VAR NAME="SELECTED_STATUS_CREATED">> <TMPL_VAR NAME="TEXT_STATUS_CREATED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_ACTIVATED">" <TMPL_VAR NAME="SELECTED_STATUS_ACTIVATED">> <TMPL_VAR NAME="TEXT_STATUS_ACTIVATED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_SUSPENDED">" <TMPL_VAR NAME="SELECTED_STATUS_SUSPENDED">> <TMPL_VAR NAME="TEXT_STATUS_SUSPENDED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_SUSPENDED_BEFORE_DELETED">" <TMPL_VAR NAME="SELECTED_STATUS_SUSPENDED_BEFORE_DELETED">> <TMPL_VAR NAME="TEXT_STATUS_SUSPENDED_BEFORE_DELETED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_WAITING_FOR_MODIFICATION">" <TMPL_VAR NAME="SELECTED_STATUS_WAITING_FOR_MODIFICATION">> <TMPL_VAR NAME="TEXT_STATUS_WAITING_FOR_MODIFICATION"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_MODIFICATION_ERROR">" <TMPL_VAR NAME="SELECTED_STATUS_MODIFICATION_ERROR">> <TMPL_VAR NAME="TEXT_STATUS_MODIFICATION_ERROR"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_MODIFICATION_APPLIED">" <TMPL_VAR NAME="SELECTED_STATUS_MODIFICATION_APPLIED">> <TMPL_VAR NAME="TEXT_STATUS_MODIFICATION_APPLIED"></option>
+				<option value="<TMPL_VAR NAME="VALUE_STATUS_TO_DELETE">" <TMPL_VAR NAME="SELECTED_STATUS_TO_DELETE">> <TMPL_VAR NAME="TEXT_STATUS_TO_DELETE"></option>
+			</select>
+	</p>
+	<p>
+		<label>		
+			<TMPL_VAR NAME="TEXT_DESCRIPTION">:
+		</label>
+		<textarea name="description" id="description" cols="45" rows="7"><TMPL_VAR NAME="VALUE_DESCRIPTION"></textarea>
+	</p>
+
+	<p class="button" id="buttonSend">
+		<input type="hidden" name="OID" value="<TMPL_VAR NAME="VALUE_OID">" />
+		<input type="submit" value="<TMPL_VAR NAME="SEND">" />
+	</p>
+
+</form>
+
+<h2><TMPL_VAR NAME="HISTORY_TITLE"></h2>
+<table>
+	<TMPL_VAR NAME="HISTORY">
+</table>
+
+<h2><TMPL_VAR NAME="AVATAR_TITLE"></h2>
+<ul>
+	<li><a href="delete_avatar.pl?OID=<TMPL_VAR NAME="VALUE_OID">"><TMPL_VAR NAME="DELETE_AVATAR"></a></li>
+</ul>

Modified: trunk/vhffs-panel/templates/admin/web/part.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/web/part.tmpl	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-panel/templates/admin/web/part.tmpl	2007-09-27 21:54:42 UTC (rev 947)
@@ -10,11 +10,7 @@
 		<TMPL_VAR NAME="STATE"> 
 	</td>
 	<td>
-		<form method="post" action="edit.pl">
-			<input type="hidden" name="OID" value="<TMPL_VAR NAME="OID">" />
-			<input type="hidden" name="NAME" value="<TMPL_VAR NAME="SERVERNAME">" />
-			<input type="submit" value="<TMPL_VAR NAME="SEND">" />
-		</form>
+		<a href="/web/prefs.pl?name=<TMPL_VAR NAME="SERVERNAME">"><TMPL_VAR NAME="EDIT"></a>
 	</td>
 </tr>
 </TMPL_LOOP>

Modified: trunk/vhffs-panel/templates/web/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/web/prefs.tmpl	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-panel/templates/web/prefs.tmpl	2007-09-27 21:54:42 UTC (rev 947)
@@ -64,3 +64,4 @@
 </form>
 
 
+<tmpl_var name="ADMIN_PART">

Modified: trunk/vhffs-panel/web/prefs.pl
===================================================================
--- trunk/vhffs-panel/web/prefs.pl	2007-09-21 17:06:37 UTC (rev 946)
+++ trunk/vhffs-panel/web/prefs.pl	2007-09-27 21:54:42 UTC (rev 947)
@@ -44,6 +44,7 @@
 use Vhffs::Main;
 use Vhffs::Panel::Main;
 use Vhffs::Panel::Menu;
+use Vhffs::Panel::Object;
 use Vhffs::Services::Web;
 use Vhffs::Acl;
 use Vhffs::Constants;
@@ -111,6 +112,8 @@
 	$template->param( YES => gettext("Yes I'm sure of what I do") );
 	$template->param( NO => gettext("No, I'm not sure, I prefer to keep it.") );
 	$template->param( TEXT_DELETE => gettext("Delete") );
+
+	$template->param( ADMIN_PART => Vhffs::Panel::Object::admin_part( $panel, $web )->output );
 }
 
 $panel->build( $template );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/