Skip to content

Commit

Permalink
[BF] Fix inex#227 (and other small chosen issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Aug 22, 2015
1 parent c421248 commit a675853
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 55 deletions.
44 changes: 21 additions & 23 deletions application/controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@
*/
class DashboardController extends IXP_Controller_AuthRequiredAction
{

public function preDispatch()
{
if( $this->getUser()->getPrivs() != \Entities\User::AUTH_CUSTUSER )
$this->_redirect( '' );
}

public function indexAction()
{
// Get the three most recent members
$this->view->recentMembers = $this->getD2EM()->getRepository( '\\Entities\\Customer' )->getRecent();

$this->view->cust = $this->getUser()->getCustomer();

/*
// is there a meeting available to register for?
$this->view->meeting = false;
if( ( $meeting = MeetingTable::getUpcomingMeeting() ) !== false
&& ( !isset( $this->session->dashboard_skip_meeting ) || !$this->session->dashboard_skip_meeting )
)
{
$rsvp = $this->getUser()->hasPreference( 'meeting.attending.' . $meeting['id'] );
if( $rsvp === false )
{
$this->view->meeting = $meeting;
Expand All @@ -72,7 +72,7 @@ public function indexAction()

$this->getNocDetailsForm();
$this->getBillingDetailsForm();

if( $this->getCustomer()->isRouteServerClient() )
{
$this->view->rsRoutes = $this->getD2EM()->getRepository( '\\Entities\\RSPrefix' )
Expand All @@ -82,15 +82,15 @@ public function indexAction()

if( $this->multiIXP() )
$this->view->validIXPs = $this->getD2R( "\\Entities\\IXP" )->getNamesNotAssignedToCustomer( $this->getUser()->getCustomer()->getId() );

// do we have any notes?
$this->_fetchCustomerNotes( $this->getCustomer()->getId(), true );
}

public function updateNocAction()
{
$form = $this->getNocDetailsForm();

if( $this->getRequest()->isPost() )
{
if( $form->isValid( $_POST ) )
Expand All @@ -104,43 +104,43 @@ public function updateNocAction()
$this->addMessage( 'There was an error updating your NOC details', OSS_Message::ERROR );
}
}

$this->forward( 'index' );
}

protected function getNocDetailsForm()
{
$form = new IXP_Form_Customer_NocDetails();
$form->assignEntityToForm( $this->getCustomer(), $this, true );
$form->setAction( OSS_Utils::genUrl( 'dashboard', 'update-noc' ) );

if( !isset( $this->view->nocDetails ) )
$this->view->nocDetails = $form;

return $form;
}


public function updateBillingAction()
{
$form = $this->getBillingDetailsForm();

if( $this->getRequest()->isPost() )
{
if( $form->isValid( $_POST ) )
{
if( $this->_options['billing_updates']['notify'] )
if( isset( $this->_options['billing_updates'] ) && $this->_options['billing_updates']['notify'] )
$old = clone $this->getCustomer()->getBillingDetails();

$form->assignFormToEntity( $this->getCustomer()->getBillingDetails(), $this, true );
$this->getD2EM()->flush();
$this->addMessage( 'Your billing details have been updated', OSS_Message::SUCCESS );

if( isset( $this->_options['billing_updates']['notify'] ) )
{
$this->view->oldDetails = $old;
$this->view->customer = $this->getCustomer();

$this->getMailer()
->setFrom( $this->_options['identity']['email'], $this->_options['identity']['name'] )
->setSubject( $this->_options['identity']['sitename'] . ' - ' . _( 'Billing Details Change Notification' ) )
Expand All @@ -155,21 +155,19 @@ public function updateBillingAction()
$this->addMessage( 'There was an error updating your billing details', OSS_Message::ERROR );
}
}

$this->forward( 'index' );
}

protected function getBillingDetailsForm()
{
$form = new IXP_Form_Customer_BillingDetails();

if( !isset( $this->view->billingDetails ) )
$this->view->billingDetails = $form;

$form->assignEntityToForm( $this->getCustomer()->getBillingDetails(), $this, true );
$form->setAction( OSS_Utils::genUrl( 'dashboard', 'update-billing' ) );
return $form;
}
}


14 changes: 7 additions & 7 deletions application/views/dashboard/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
{/if}
<li><a href="#tab-details" data-toggle="tab">My Details</a></li>
<li><a href="#tab3" data-toggle="tab">Ports</a></li>

{if $resellerMode && $cust->isReseller()}
<li>
<a href="#tab-resold-customers" data-toggle="tab">Resold Customers</a>
</li>
{/if}

{if count( $custNotes )}
<li>
<a href="#tab-content-notes" id="tab-notes" data-toggle="tab">
Expand All @@ -42,9 +42,9 @@
<li>
<a href="{genUrl controller="rs-prefixes" action="list" tab='adv_nacc'}">
Prefixes
{if $rsRoutes.adv_nacc.total gt 0}
<span class="badge badge-important">{$rsRoutes.adv_nacc.total}</span>
{/if}
{if $rsRoutes.adv_nacc.total gt 0}
<span class="badge badge-important">{$rsRoutes.adv_nacc.total}</span>
{/if}
&raquo;
</a>
</li>
Expand All @@ -68,7 +68,7 @@
<!-- Overview Tab -->
{tmplinclude file="dashboard/index-tabs/overview.phtml"}
</div>

{if $multiIXP}
<div class="tab-pane" id="tab-ixps">
{tmplinclude file="dashboard/index-tabs/ixps.phtml"}
Expand All @@ -93,7 +93,7 @@
{tmplinclude file="customer/overview-tabs/resold-customers.phtml"}
</div>
{/if}

{if count( $custNotes )}
<div class="tab-pane" id="tab-content-notes">
{tmplinclude file="customer/overview-tabs/notes.phtml"}
Expand Down
4 changes: 2 additions & 2 deletions application/views/footer.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{tmplinclude file='footer-content.phtml'}

{if !isset( $mode ) or $mode neq 'fluid'}

</div> <!-- </div class="container"> -->

{/if}

{if isset( $hasIdentity ) and $hasIdentity}
<script>
$( ".chzn-select" ).chosen();
$( ".chzn-select" ).chosen( { width: '100%' } );

{if isset( $user ) and $user->getPrivs() eq 3}
$( "#menu-select-customer" ).chosen().change( function(){
Expand Down
5 changes: 2 additions & 3 deletions library/IXP/Form/Customer/BillingDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public function init()
->setValue( 'IE' )
->setLabel( 'Country' )
->setRequired( false )
->setAttrib( 'class', 'chzn-select' )
->setAttrib( 'chzn-fix-width', '1' );
->setAttrib( 'class', 'chzn-select' );


$this->addElement( $billingCountry );
Expand Down Expand Up @@ -167,7 +166,7 @@ public function init()
'billingPostcode', 'billingCountry', 'billingEmail', 'billingTelephone',
'invoiceEmail'
],
'billingDisplayGroup'
'billingDisplayGroup'
);
$this->getDisplayGroup( 'billingDisplayGroup' )->setLegend( 'Billing Details' );

Expand Down
39 changes: 19 additions & 20 deletions public/js/900-oss-framework.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file is a combination of other JavaScript files from the OSS-Framework.
*
* See: https://github.com/opensolutions/OSS-Framework/tree/master/data/js
* See: https://github.com/opensolutions/OSS-Framework/tree/master/data/js
*
* NOTICE: Do not edit this file as it will be overwritten the next time you run
* the by update-oss-js.sh script referenced above.
Expand All @@ -14,7 +14,7 @@
* Author: Open Source Solutions Limited <info _at_ opensolutions.ie>
*
*/


//****************************************************************************
// Alert message functions
Expand Down Expand Up @@ -286,7 +286,7 @@ function ossToggle( e, Url, data, delElement )
});

if( typeof( delElement ) != undefined ) {
$( delElement ).hide( 'slow', function(){ $( delElement ).remove() } );;
$( delElement ).hide( 'slow', function(){ $( delElement ).remove() } );;
}

}
Expand Down Expand Up @@ -374,14 +374,14 @@ function ossPopover()
//****************************************************************************

$( 'document' ).ready( function(){

$(".chzn-select").each( function( index ){
$( this ).chosen();
$( this ).chosen();
ossChosenFixWidth( $( this ) );
});

$(".chzn-select-deselect").each( function( index ) {
$( this ).chosen( { allow_single_deselect:true } );
$( this ).chosen( { allow_single_deselect:true } );
ossChosenFixWidth( $( this ) );
});
});
Expand All @@ -392,7 +392,7 @@ function ossChosenFixWidth( obj, force ) {
if( ( force != undefined && force == true ) || obj.attr( 'chzn-fix-width' ) === '1' ) {
czn_id = "#" + obj.attr( "id" ) + "_chzn";
width = parseInt( obj.css( "width" ) );

if( $( czn_id ).length == 0)
czn_id = czn_id.replace( /\-/g, "_" );

Expand All @@ -418,7 +418,7 @@ function ossChosenSet( id, options, value ) {
$( id ).html( options );

if( value != undefined )
$( id ).val( value );
$( id ).val( value );

$( id ).trigger( "liszt:updated" );
}
Expand Down Expand Up @@ -472,9 +472,9 @@ function ossThrobberWithOverlay( size, lines, strokewidth, selector, fallback )
var Throb = new Throbber({
"color": 'white',
"size": size,
"fade": 500,
"fade": 500,
"fallback": fallback,
"rotationspeed": 0,
"rotationspeed": 0,
"lines": lines,
"strokewidth": strokewidth,
"alpha": 1
Expand All @@ -489,7 +489,7 @@ function ossThrobberWithOverlay( size, lines, strokewidth, selector, fallback )

$("#overlay").height( $( selector ).height() + 23 - padding ).width( $( selector ).width() + 23 );
$("#overlay").fadeIn( "slow" );

Throb.appendTo( $( '#overlay' ).get(0) ).start();

return Throb;
Expand All @@ -504,9 +504,9 @@ function ossThrobberWithOverlay( size, lines, strokewidth, selector, fallback )
*/
function ossSortByName(a, b)
{
var aName = a.name.toLowerCase();
var bName = b.name.toLowerCase();
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
var aName = a.name.toLowerCase();
var bName = b.name.toLowerCase();
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
}

/**
Expand All @@ -515,12 +515,12 @@ function ossSortByName(a, b)
function ossFormatFieldset()
{
$( ".legend-fieldset-bordered" ).css( "width", $( ".legend-fieldset-bordered > label" ).width() + 20 );
$( ".fieldset-bordered-elements> .control-group > .control-label" ).each(function( index ) {

$( ".fieldset-bordered-elements> .control-group > .control-label" ).each(function( index ) {
$(this).width( "100" );
});
$( ".fieldset-bordered-elements > .control-group > .controls" ).each(function( index ) {

$( ".fieldset-bordered-elements > .control-group > .controls" ).each(function( index ) {
$(this).css( "margin-left", "120px" );
});
}
Expand Down Expand Up @@ -779,4 +779,3 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );

0 comments on commit a675853

Please sign in to comment.