[pLog-svn] r6011 - in plog/trunk: class/action/admin class/view/admin js/ui/pages templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Thu Oct 25 02:00:17 EDT 2007
Author: mark
Date: 2007-10-25 02:00:17 -0400 (Thu, 25 Oct 2007)
New Revision: 6011
Added:
plog/trunk/js/ui/pages/friendgroups.js
plog/trunk/templates/admin/editfriendgroup_form.template
plog/trunk/templates/admin/editfriendgroups_table.template
plog/trunk/templates/admin/newfriendgroup_form.template
Modified:
plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php
plog/trunk/class/action/admin/admindeletefriendgroupaction.class.php
plog/trunk/class/action/admin/admineditfriendgroupaction.class.php
plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php
plog/trunk/class/action/admin/adminnewfriendgroupaction.class.php
plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php
plog/trunk/class/view/admin/adminfriendgroupslistview.class.php
plog/trunk/templates/admin/editfriendgroup.template
plog/trunk/templates/admin/editfriendgroups.template
plog/trunk/templates/admin/menus.xml
plog/trunk/templates/admin/newfriendgroup.template
Log:
Ajaxified friend group done!
Modified: plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/adminaddfriendgroupaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,11 +1,5 @@
<?php
-
-
-
-
-
-
/**
* \ingroup Action
* @private
@@ -29,47 +23,79 @@
$this->AdminAction( $actionInfo, $request );
// data validation
- $this->registerFieldValidator( "groupName", new StringValidator() );
+ $this->registerFieldValidator( "groupName", new StringValidator(), false, $this->_locale->tr("error_empty_name") );
$this->registerField( "groupDescription" );
$this->registerField( "showGroup" );
- $this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "newfriendgroup" ));
+ $view = new AdminTemplatedView( $this->_blogInfo, "newfriendgroup" );
+ $view->setErrorMessage( $this->_locale->tr( "error_adding_friend_group" ) );
+ $this->setValidationErrorView( $view );
}
+ function addFriendGroup()
+ {
+ // add the new friend group to the database
+ $this->_groupName = Textfilter::filterAllHTML( $this->_request->getValue( "groupName" ) );
+ $this->_groupDescription = Textfilter::filterAllHTML( $this->_request->getValue( "groupDescription" ) );
+ $this->_showGroup = $this->_request->getValue( "showGroup" ) ? 1 : 0;
+ // create the group
+ $friendGroups = new FriendGroups();
+ $this->_friendGroup = new FriendGroup( $this->_userInfo->getId(),
+ $this->_groupName,
+ $this->_groupDescription,
+ $this->_properties,
+ $this->_showGroup );
+
+ $result = $friendGroups->addFriendGroup( $this->_friendGroup, $this->_userInfo->getId() );
+
+ if( $result ) {
+ // clear the cache
+ CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
+ // and set a message
+ $this->_message = $this->_locale->pr( "friend_group_added_ok", $this->_friendGroup->getName() );
+ }
+ else {
+ $this->_message = $this->_locale->tr( "error_adding_friend_group" );
+ }
+
+ return( $result );
+ }
+
/**
* Carries out the specified action
*/
function perform()
{
- // add the new friend group to the database
- $this->_groupName = Textfilter::filterAllHTML($this->_request->getValue( "groupName" ));
- $this->_groupDescription = Textfilter::filterAllHTML($this->_request->getValue( "groupDescription" ));
- $this->_showGroup = $this->_request->getValue("showGroup") ? 1 : 0;
-
- // create the group
- $friendGroups = new FriendGroups();
- $friendGroup = new FriendGroup( $this->_userInfo->getId(),
- $this->_groupName,
- $this->_groupDescription,
- $this->_properties,
- $this->_showGroup );
-
- // the view is the same for both conditions
$this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
- if( !$friendGroups->addFriendGroup( $friendGroup, $this->_userInfo->getId())) {
+ $result = $this->addFriendGroup();
+
+ if( !$result ) {
// set an error message
- $this->_view->setErrorMessage( $this->_locale->tr("error_adding_friend_group"));
+ $this->_view->setErrorMessage( $this->_message);
}
else {
- // clear the cache
- CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
- $this->_view->setSuccessMessage( $this->_locale->pr("friend_group_added_ok", $friendGroup->getName()));
- }
+ // or success
+ $this->_view->setSuccessMessage( $this->_message );
+ }
$this->setCommonData();
return true;
}
+
+ function performAjax()
+ {
+ $result = $this->addFriendGroup();
+
+
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+
+ $this->_view->setSuccess( $result );
+ $this->_view->setMessage( $this->_message );
+ $this->_view->setResult( $this->_friendGroup );
+
+ return( true );
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/admindeletefriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletefriendgroupaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/admindeletefriendgroupaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,11 +1,5 @@
<?php
-
-
-
-
-
-
/**
* \ingroup Action
* @private
@@ -39,15 +33,15 @@
function perform()
{
- if( $this->_op == "deleteFriendGroup" ) {
- $this->_groupId = $this->_request->getValue( "groupId" );
- $this->_groupIds = Array();
- $this->_groupIds[] = $this->_groupId;
- }
- else
- $this->_groupIds = $this->_request->getValue( "groupIds" );
+ $results = $this->_deleteFriendGroups();
- $this->_deleteFriendGroups();
+ $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
+ if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+ if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
+ $this->setCommonData();
+
+ // better to return true if everything fine
+ return true;
}
/**
@@ -56,6 +50,14 @@
*/
function _deleteFriendGroups()
{
+ if( $this->_op == "deleteFriendGroup" ) {
+ $this->_groupId = $this->_request->getValue( "groupId" );
+ $this->_groupIds = Array();
+ $this->_groupIds[] = $this->_groupId;
+ }
+ else
+ $this->_groupIds = $this->_request->getValue( "groupIds" );
+
// delete the friend group, but only if there are no links under it
$groups = new FriendGroups();
$errorMessage = "";
@@ -65,7 +67,7 @@
foreach( $this->_groupIds as $groupId ) {
// fetch the group
$group = $groups->getFriendGroup( $groupId, $this->_userInfo->getId());
-
+
if( $group ) {
// Check if the last friend group reached
if( $groups->getNumUserFriendGroups( $this->_userInfo->getId() ) <= 1) {
@@ -95,18 +97,26 @@
}
}
- $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
- if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
- if( $successMessage != "" ) {
- $this->_view->setSuccessMessage( $successMessage );
- // clear the cache
+ if( $totalOk > 0 )
CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
- }
- $this->setCommonData();
+ return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
+ }
+ /**
+ * Ajax-specific behaviour
+ */
+ function performAjax()
+ {
+ $results = $this->_deleteFriendGroups();
+
+
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setMessage( $results );
+ $this->_view->setSuccess( true );
+
// better to return true if everything fine
return true;
- }
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/admineditfriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditfriendgroupaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/admineditfriendgroupaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,11 +1,5 @@
<?php
-
-
-
-
-
-
/**
* \ingroup Action
* @private
@@ -27,30 +21,51 @@
// data validation
$this->registerFieldValidator( "groupId", new IntegerValidator());
+ $this->registerField( "groupName" );
+ $this->registerField( "groupDescription" );
$view = new AdminFriendGroupsListView( $this->_blogInfo );
$view->setErrorMessage( $this->_locale->tr("error_incorrect_friend_group_id"));
$this->setValidationErrorView( $view );
}
+ function getFriendGroup()
+ {
+ // fetch the group
+ $this->_groupId = $this->_request->getValue( "groupId" );
+ $groups = new FriendGroups();
+ $group = $groups->getFriendGroup( $this->_groupId, $this->_userInfo->getId());
+
+ // show an error if we couldn't fetch the group
+ if( !$group )
+ return false;
+
+ $this->notifyEvent( EVENT_FRIEND_GROUP_LOADED, Array( "friendgroup" => &$group ));
+ return( $group );
+ }
+
/**
* Carries out the specified action
*/
function perform()
{
- // fetch the group
- $this->_groupId = $this->_request->getValue( "groupId" );
- $groups = new FriendGroups();
- $group = $groups->getFriendGroup( $this->_groupId, $this->_userInfo->getId());
- // show an error if we couldn't fetch the relatinoship
- if( !$group ) {
- $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_link_category"));
+ $group = $this->getFriendGroup();
+ if( !$group ) {
+ if( Request::isXHR())
+ $this->_view = new AdminErrorDialogView( $this->_blogInfo );
+ else
+ $this->_view = new AdminFriendGroupsListView( $this->_blogInfo, $this->_locale->tr("error_incorrect_friend_group_id"));
+
+ $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_friend_group"));
$this->setCommonData();
-
- return false;
- }
- $this->notifyEvent( EVENT_FRIEND_GROUP_LOADED, Array( "friendgroup" => &$group ));
+ return( false );
+ }
+
// otherwise show the form to edit its fields
- $this->_view = new AdminTemplatedView( $this->_blogInfo, "editfriendgroup" );
+ if( Request::isXHR())
+ $this->_view = new AdminTemplatedView( $this->_blogInfo, "editfriendgroup_form" );
+ else
+ $this->_view = new AdminTemplatedView( $this->_blogInfo, "editfriendgroup" );
+
$this->_view->setValue( "groupId", $group->getId());
$this->_view->setValue( "groupName", $group->getName());
$this->_view->setValue( "groupDescription", $group->getDescription());
@@ -60,5 +75,28 @@
// better to return true if everything fine
return true;
}
+
+ function performAjax()
+ {
+ if( $this->_request->getOutput() == Request::REQUEST_OUTPUT_JSON ) {
+ $group = $this->getFriendGroup();
+ if( !$group ) {
+ $this->_view = $this->getAjaxErrorView();
+ $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_friend_group"));
+ return( false );
+ }
+
+ // otherwise show the form to edit its fields
+
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setResult( $group );
+
+ // better to return true if everything fine
+ return true;
+ }
+ else {
+ return( $this->perform());
+ }
+ }
}
?>
Modified: plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/admineditfriendgroupsaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,8 +1,5 @@
<?php
-
-
-
/**
* \ingroup Action
* @private
@@ -34,5 +31,36 @@
// better to return true if everything fine
return true;
}
+
+ /**
+ * Ajax-specific behaviour
+ */
+ function performAjax()
+ {
+ if( $this->_request->getOutput() == Request::REQUEST_OUTPUT_JSON ) {
+ if( $this->_request->loadAllData()) {
+ // in this case, we load all data
+ // get the friend groups
+ $friendGroups = new FriendGroups();
+ $myFriendGroups = $friendGroups->getFriendGroups( $this->_userInfo->getId() );
+ // pass it to the view
+
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setSuccess( true );
+ $this->_view->setResult( $myFriendGroups );
+ }
+ else {
+ $searchTerms = $this->_request->getValue( "searchTerms" );
+ $this->_view = new AjaxViewRenderer( new AdminFriendGroupsListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms )));
+ $this->_view->setSuccess( true );
+ $this->_view->setResultObject( "friendgroups" );
+ }
+ }
+ else {
+ return( $this->perform());
+ }
+
+ return( true );
+ }
}
?>
Modified: plog/trunk/class/action/admin/adminnewfriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewfriendgroupaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/adminnewfriendgroupaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,8 +1,4 @@
<?php
-
-
-
-
/**
* \ingroup Action
* @private
@@ -26,10 +22,20 @@
*/
function perform()
{
- // initialize the view
- $this->_view = new AdminTemplatedView( $this->_blogInfo, "newfriendgroup" );
+ if( $this->_request->isXHR())
+ $this->_view = new AdminTemplatedView( $this->_blogInfo, "newfriendgroup_form" );
+ else
+ $this->_view = new AdminTemplatedView( $this->_blogInfo, "newfriendgroup" );
+
$this->setCommonData();
+
+ // better to return true if everything fine
return true;
}
+
+ function performAjax()
+ {
+ return( $this->perform());
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/action/admin/adminupdatefriendgroupaction.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,12 +1,5 @@
<?php
-
-
-
-
-
-
-
/**
* \ingroup Action
* @private
@@ -15,7 +8,6 @@
*/
class AdminUpdateFriendGroupAction extends AdminAction
{
-
var $_groupName;
var $_groupDescription;
var $_showGroup;
@@ -30,20 +22,17 @@
$this->AdminAction( $actionInfo, $request );
// data validation
- $this->registerFieldValidator( "groupName", new StringValidator());
- $this->registerFieldValidator( "groupId", new IntegerValidator());
+ $this->registerFieldValidator( "groupId", new IntegerValidator(), false, $this->_locale->tr( "error_fetching_friend_group" ) );
+ $this->registerFieldValidator( "groupName", new StringValidator(), false, $this->_locale->tr("error_empty_name") );
$this->registerField( "groupDescription" );
$this->registerField( "showGroup" );
$errorView = new AdminTemplatedView( $this->_blogInfo, "editfriendgroup" );
- $errorView->setErrorMessage( $this->_locale->tr("error_updating_friend_group"));
+ $errorView->setErrorMessage( $this->_locale->tr("error_updating_friend_group") );
$this->setValidationErrorView( $errorView );
}
- /**
- * Carries out the specified action
- */
- function perform()
- {
+ function updateFriendGroup()
+ {
// fetch the group we're trying to update
$this->_groupId = $this->_request->getValue( "groupId" );
$this->_groupName = Textfilter::filterAllHTML($this->_request->getValue( "groupName" ));
@@ -53,10 +42,7 @@
$groups = new FriendGroups();
$group = $groups->getFriendGroup( $this->_groupId, $this->_userInfo->getId());
if( !$group ) {
- $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_friend_group"));
- $this->setCommonData();
-
+ $this->_message = $this->_locale->tr("error_fetching_friend_group");
return false;
}
@@ -66,23 +52,49 @@
$group->setShowGroup( $this->_showGroup );
$this->notifyEvent( EVENT_PRE_UPDATE_FRIEND_GROUP, Array( "friendgroup" => &$group ));
if( !$groups->updateFriendGroup( $group )) {
- $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_updating_friend_group"));
- $this->setCommonData();
-
+ $this->_message = $this->_locale->tr("error_updating_friend_group");
return false;
}
+
$this->notifyEvent( EVENT_POST_UPDATE_FRIEND_GROUP, Array( "friendgroup" => &$group ));
// clear the cache
CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
+ // set the success message
+ $this->_message = $this->_locale->pr( "friend_group_updated_ok", $group->getName() );
+
+ $this->_friendGroup = $group;
- $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
- $this->_view->setSuccessMessage( $this->_locale->pr("friend_group_updated_ok", $group->getName()));
+ return( true );
+ }
+
+ /**
+ * Carries out the specified action
+ */
+ function perform()
+ {
+ $this->_view = new AdminFriendGroupsListView( $this->_blogInfo );
+ if( !$this->updateFriendGroup()) {
+ $this->_view->setErrorMessage( $this->_message );
+ }
+ else {
+ $this->_view->setSuccessMessage( $this->_message );
+ }
+
$this->setCommonData();
-
- // better to return true if everything fine
return true;
}
+
+ /**
+ * Ajax-specific behaviour
+ */
+ function performAjax()
+ {
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setSuccess( $this->updateFriendGroup());
+ $this->_view->setMessage( $this->_message );
+ $this->_view->setResult( $this->_friendGroup );
+ return true;
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/view/admin/adminfriendgroupslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminfriendgroupslistview.class.php 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/class/view/admin/adminfriendgroupslistview.class.php 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,9 +1,5 @@
<?php
-
-
-
-
/**
* \ingroup View
* @private
@@ -16,8 +12,13 @@
function AdminFriendGroupsListView( $blogInfo, $params = Array())
{
- $this->AdminTemplatedView( $blogInfo, "editfriendgroups" );
+ if( Request::isXHR())
+ $template = "editfriendgroups_table";
+ else
+ $template = "editfriendgroups";
+ $this->AdminTemplatedView( $blogInfo, $template );
+
$this->_page = $this->getCurrentPageFromRequest();
if( isset( $params['searchTerms'] ) )
$this->_searchTerms = $params['searchTerms'];
@@ -48,6 +49,7 @@
// create the view and fill the template context
$this->setValue( "friendgroups", $friendGroups );
+ $this->setValue( "searchTerms", $this->_searchTerms );
$this->setValue( "pager", $pager );
// transfer control to the parent class
Added: plog/trunk/js/ui/pages/friendgroups.js
===================================================================
--- plog/trunk/js/ui/pages/friendgroups.js (rev 0)
+++ plog/trunk/js/ui/pages/friendgroups.js 2007-10-25 06:00:17 UTC (rev 6011)
@@ -0,0 +1,21 @@
+Lifetype.UI.Pages.FriendGroups = function() {}
+
+Lifetype.UI.Pages.FriendGroups.addSubmitHook = function( form )
+{
+ Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );
+}
+
+Lifetype.UI.Pages.FriendGroups.updateSubmitHook = function( form )
+{
+ Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json' );
+}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+ var t = new Lifetype.Effects.Table( "list" );
+ t.stripe();
+ t.highlightRows();
+
+ // reload the list when successfully deleting an item and processing one of the forms
+ Lifetype.Forms.Events.performRequestSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+ Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+});
\ No newline at end of file
Modified: plog/trunk/templates/admin/editfriendgroup.template
===================================================================
--- plog/trunk/templates/admin/editfriendgroup.template 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/templates/admin/editfriendgroup.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,44 +1,7 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editFriendGroups title=$locale->tr("editFriendGroups")}
- <form name="editFriendGroup" action="admin.php" method="post">
+{include file="$admintemplatepath/editfriendgroup_form.template"}
- <fieldset class="inputField">
- <legend>{$locale->tr("editFriendGroup")}</legend>
- {include file="$admintemplatepath/formvalidate.template" message=$locale->tr("error_updating_friend_group")}
-
- <div class="field">
- <label for="groupName">{$locale->tr("name")}</label>
- <span class="required">*</span>
- <div class="formHelp">{$locale->tr("category_name_help")}</div>
- <input type="text" id="groupName" name="groupName" value="{$groupName|escape:"html"}"/>
- {include file="$admintemplatepath/validate.template" field=groupName message=$locale->tr("error_empty_name")}
- </div>
-
- <div class="field">
- <label for="groupDescription">{$locale->tr("description")}</label>
- <span class="required"></span>
- <div class="formHelp">{$locale->tr("category_description_help")}</div>
- <textarea name="groupDescription" id="groupDescription" cols="60" rows="5">{$groupDescription}</textarea>
- {include file="$admintemplatepath/validate.template" field=groupDescription message=$locale->tr("error_empty_description")}
- </div>
-
- <div class="field">
- <label for="showGroup">{$locale->tr("show")}</label>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1" {if $showGroup == 1} checked="checked"{/if} />
- {$locale->tr("show_group_help")}
- </div>
- </div>
-
- </fieldset>
- <div class="buttons">
- <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
- <input type="submit" name="Update" value="{$locale->tr("update")}" />
- <input type="hidden" name="op" value="updateFriendGroup" />
- <input type="hidden" name="groupId" value="{$groupId}" />
- </div>
-</form>
-
-{include file="$blogtemplate/footernavigation.template"}
+{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Added: plog/trunk/templates/admin/editfriendgroup_form.template
===================================================================
--- plog/trunk/templates/admin/editfriendgroup_form.template (rev 0)
+++ plog/trunk/templates/admin/editfriendgroup_form.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -0,0 +1,32 @@
+<form id="editFriendGroup" method="post" action="admin.php" onSubmit="Lifetype.UI.Pages.FriendGroups.updateSubmitHook(this);return(false);">
+ <fieldset class="inputField">
+ {include file="$admintemplatepath/formvalidateajax.template"}
+ <legend>{$locale->tr("editFriendGroup")}</legend>
+ <div class="field">
+ <label for="groupName">{$locale->tr("name")}</label>
+ <span class="required">*</span>
+ <div class="formHelp">{$locale->tr("category_name_help")}</div>
+ <input type="text" id="groupName" name="groupName" value="{$groupName}"/>
+ {include file="$admintemplatepath/validateajax.template" field=groupName}
+ </div>
+ <div class="field">
+ <label for="groupDescription">{$locale->tr("description")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("category_description_help")}</div>
+ <textarea name="groupDescription" id="groupDescription" cols="60" rows="5">{$groupDescription}</textarea>
+ </div>
+ <div class="field">
+ <label for="showGroup">{$locale->tr("show")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1" {if $showGroup == 1} checked="checked"{/if} />
+ {$locale->tr("show_group_help")}
+ </div>
+ </div>
+ </fieldset>
+ <div class="buttons">
+ <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
+ <input type="submit" name="Update" value="{$locale->tr("update")}" />
+ <input type="hidden" name="op" value="updateFriendGroup" />
+ <input type="hidden" name="groupId" value="{$groupId}" />
+ </div>
+</form>
\ No newline at end of file
Modified: plog/trunk/templates/admin/editfriendgroups.template
===================================================================
--- plog/trunk/templates/admin/editfriendgroups.template 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/templates/admin/editfriendgroups.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,19 +1,16 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editFriendGroups title=$locale->tr("editFriendGroups")}
-
- <div id="list_nav_bar">
- <div id="list_nav_select">
-
+{js src="js/ui/pages/friendgroups.js"}
+<div id="list_nav_bar">
+ <div id="list_nav_select">
<form id="viewFriendGroup" action="admin.php" method="post">
<fieldset>
<legend>{$locale->tr("show_by")}</legend>
-
<div class="list_nav_option">
<label for="search">{$locale->tr("search_terms")}</label>
<br />
<input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
</div>
-
<div class="list_nav_option">
<br />
<input type="hidden" name="op" value="editFriendGroups" />
@@ -24,49 +21,21 @@
</div>
<br style="clear:both" />
</div>
-
- <form id="friendGroups" action="admin.php" method="post">
+<div class="extraFunctions">
+<div class="left">
+ <a id="newFriendGroupButton" href="?op=newFriendGroup" rel="overlay">{$locale->tr("newFriendGroup")}</a>
+</div>
+<br style="clear:both" />
+</div>
+ <form id="friendGroups" action="admin.php" method="post" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
+ {include file="$admintemplatepath/viewvalidateajax.template"}
<div id="list">
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <table class="info">
- <thead>
- <tr>
- <th style="width:10px;"><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('friendGroups');" /></th>
- <th style="width:500px;">{$locale->tr("name")}</th>
- <th style="width:170px;">{$locale->tr("friends")}</th>
- <th style="width:95px;">{$locale->tr("actions")}</th>
- </tr>
- </thead>
- <tbody>
- {foreach from=$friendgroups item=group}
- <tr class="{cycle values="odd,even"}">
- <td align="center"><input class="checkbox" type="checkbox" name="groupIds[{counter}]" value="{$group->getId()}"/></td>
- <td class="col_highlighted"><a href="admin.php?op=editFriendGroup&groupId={$group->getId()}">{$group->getName()}</a></td>
- <td>
- {if $group->getNumFriends() > 0}
- <a href="admin.php?op=editFriends&showGroup={$group->getId()}">({$group->getNumFriends()})</a>
- {else}
- (0)
- {/if}
- </td>
- <td>
- <div class="list_action_button">
- <a href="?op=editFriendGroup&groupId={$group->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
- <a href="?op=deleteFriendGroup&groupId={$group->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
- </div>
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
+ {include file="$admintemplatepath/editfriendgroups_table.template"}
</div>
<div id="list_action_bar">
- {adminpager style=list}
<input type="hidden" name="op" value="deleteFriendGroups"/>
<input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
</div>
</form>
-
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Added: plog/trunk/templates/admin/editfriendgroups_table.template
===================================================================
--- plog/trunk/templates/admin/editfriendgroups_table.template (rev 0)
+++ plog/trunk/templates/admin/editfriendgroups_table.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -0,0 +1,34 @@
+<table id="friendgroups" class="info" summary="{$locale->tr("editFriendGroups")}">
+ <thead>
+ <tr>
+ <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('friendGroups');" /></th>
+ <th style="width:30%;">{$locale->tr("name")}</th>
+ <th style="width:45%;">{$locale->tr("description")}</th>
+ <th style="width:15%;">{$locale->tr("friends")}</th>
+ <th style="width:10%;">{$locale->tr("actions")}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {foreach from=$friendgroups item=group}
+ <tr>
+ <td align="center"><input class="checkbox" type="checkbox" name="groupIds[{counter}]" value="{$group->getId()}"/></td>
+ <td class="col_highlighted"><a href="admin.php?op=editFriendGroup&groupId={$group->getId()}" rel="overlay">{$group->getName()}</a></td>
+ <td><a href="admin.php?op=editFriendGroup&groupId={$group->getId()}" rel="overlay">{$group->getDescription()}</a></td>
+ <td>
+ {if $group->getNumFriends() > 0}
+ <a href="admin.php?op=editFriends&showGroup={$group->getId()}">{$group->getNumFriends()}</a>
+ {else}
+ 0
+ {/if}
+ </td>
+ <td>
+ <div class="list_action_button">
+ <a rel="overlay" id="edit_group_{$group->getId()}" href="?op=editFriendGroup&groupId={$group->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
+ <a href="?op=deleteFriendGroup&groupId={$group->getId()}" onClick="Lifetype.Forms.performRequest(this);return(false)"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+ </div>
+ </td>
+ </tr>
+ {/foreach}
+</tbody>
+</table>
+{adminpagerajax style=list}
\ No newline at end of file
Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/templates/admin/menus.xml 2007-10-25 06:00:17 UTC (rev 6011)
@@ -11,18 +11,13 @@
</managePosts>
</Content>
<resources url="?op=resources" andPerms="view_resources" />
- <friendManagement url="?op=friendManagement">
+ <friendManagement url="?op=editFriends">
<manageFriends ignoreBreadCrumbs="1">
- <newFriend url="?op=newFriend"/>
<editFriends url="?op=editFriends"/>
- <newFriendGroup url="?op=newFriendGroup"/>
<editFriendGroups url="?op=editFriendGroups"/>
- </manageFriends>
- <managePrivateMessages ignoreBreadCrumbs="1">
- <newPrivateMessage url="?op=newPrivateMessage"/>
<editInboxPrivateMessages url="?op=editInboxPrivateMessages"/>
<editOutboxPrivateMessages url="?op=editOutboxPrivateMessages"/>
- </managePrivateMessages>
+ </manageFriends>
</friendManagement>
<controlCenter url="?op=controlCenter">
<blogSettings url="?op=blogSettings" andPerms="update_blog" />
Modified: plog/trunk/templates/admin/newfriendgroup.template
===================================================================
--- plog/trunk/templates/admin/newfriendgroup.template 2007-10-25 02:26:51 UTC (rev 6010)
+++ plog/trunk/templates/admin/newfriendgroup.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -1,41 +1,7 @@
{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=newFriendGroup title=$locale->tr("newFriendGroup")}
+{include file="$admintemplatepath/navigation.template" showOpt=editFriendGroups title=$locale->tr("newFriendGroup")}
- <form name="addFriendGroup" method="post" action="admin.php">
- <fieldset class="inputField">
- <legend>{$locale->tr("newFriendGroup")}</legend>
- {include file="$admintemplatepath/formvalidate.template" message=$locale->tr("error_adding_friend_group")}
+{include file="$admintemplatepath/newfriendgroup_form.template"}
- <div class="field">
- <label for="groupName">{$locale->tr("name")}</label>
- <span class="required">*</span>
- <div class="formHelp">{$locale->tr("group_name_help")}</div>
- <input type="text" value="{$groupName}" id="groupName" name="groupName" />
- {include file="$admintemplatepath/validate.template" field=groupName message=$locale->tr("error_empty_name")}
- </div>
-
- <div class="field">
- <label for="groupDescription">{$locale->tr("description")}</label>
- <span class="required"></span>
- <div class="formHelp">{$locale->tr("group_description_help")}</div>
- <textarea name="groupDescription" cols="60" id="groupDescription" rows="5">{$groupDescription}</textarea>
- {include file="$admintemplatepath/validate.template" field=groupDescription message=$locale->tr("error_empty_description")}
- </div>
-
- <div class="field">
- <label for="showGroup">{$locale->tr("show")}</label>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1"
- checked="checked" />
- {$locale->tr("show_group_help")}
- </div>
-
- </fieldset>
- <div class="buttons">
- <input type="hidden" name="op" value="addFriendGroup" />
- <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
- <input type="submit" name="Add" value="{$locale->tr("add")}" />
- </div>
- </form>
{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Added: plog/trunk/templates/admin/newfriendgroup_form.template
===================================================================
--- plog/trunk/templates/admin/newfriendgroup_form.template (rev 0)
+++ plog/trunk/templates/admin/newfriendgroup_form.template 2007-10-25 06:00:17 UTC (rev 6011)
@@ -0,0 +1,30 @@
+<form id="newFriendGroup" method="post" action="admin.php" onSubmit="Lifetype.UI.Pages.FriendGroups.addSubmitHook(this);return(false);">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("newFriendGroup")}</legend>
+ {include file="$admintemplatepath/formvalidateajax.template"}
+ <div class="field">
+ <label for="groupName">{$locale->tr("name")}</label>
+ <span class="required">*</span>
+ <div class="formHelp">{$locale->tr("group_name_help")}</div>
+ <input type="text" value="{$groupName}" id="groupName" name="groupName" />
+ {include file="$admintemplatepath/validateajax.template" field=groupName}
+ </div>
+ <div class="field">
+ <label for="groupDescription">{$locale->tr("description")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("group_description_help")}</div>
+ <textarea name="groupDescription" cols="60" id="groupDescription" rows="5">{$groupDescription}</textarea>
+ </div>
+ <div class="field">
+ <label for="showGroup">{$locale->tr("show")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" id="showGroup" name="showGroup" value="1" checked="checked" />
+ {$locale->tr("show_group_help")}
+ </div>
+ </fieldset>
+ <div class="buttons">
+ <input type="hidden" name="op" value="addFriendGroup" />
+ <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
+ <input type="submit" name="Add" value="{$locale->tr("add")}" />
+ </div>
+ </form>
\ No newline at end of file
More information about the pLog-svn
mailing list