<?php
use Orchard\Feature\Feature;

//Get userObj from registry for application user
$userObj = Zend_Registry::get("UserObj");
$logger = Zend_Registry::get('applicationLoggerWS');

$logger = Zend_Registry::get('applicationLoggerWS');
$awsConfigs = yaml_parse_file(APPLICATION_PATH . '/configs/aws.yml');
$oauthConfig = Zend_Registry::get('oauthconfig');
$projectManagerFeatureEnabled = Feature::isEnabled('project_manager', 'enabled', $this->featureVendorContext);
$projectManagerUIEnabled = $userObj->isAllowed('', '', 'uiproject');
$projectManagerEnabled = $projectManagerFeatureEnabled && $projectManagerUIEnabled;
$conflictManagerEnabled = Feature::isEnabled('alw_conflict_manager', 'enabled', $this->featureVendorContext);

if ($userObj->isWorkstationExperienceFilm()) {
    $searchPlaceholder = $this->translate->_('i.e. Release, Collection, or UPC');
} else if ($userObj->isWorkstationExperienceTV()) {
    $searchPlaceholder = $this->translate->_('i.e. Release, Volume, or UPC');
} else {
    if ($projectManagerEnabled) {
        $searchPlaceholder = $this->translate('i.e. project, product, UPC, artist, etc.');
    } else {
        $searchPlaceholder = $this->translate('i.e. Album, Artist, UPC or CAT#');
    }
}
    $isAccountingNavigationEnabled = $userObj->isAllowed('', '', 'navaccounting');
    //@TODO(jviletto) ows-product-digital teardown

    $alwMobileAnalyticsEnabled = Feature::isEnabled('alw_mobile_analytics', 'enabled', $this->featureVendorContext);
    $workstationAccountingPeriodEnabled = Feature::isEnabled('workstation_accounting_period', 'enabled', $this->featureVendorContext);
    $accountingSnapshotEnabled = $this->has_accounting_resource
        && $this->userObj->isAllowed('', '', 'alw_accounting_snapshot_widget');
?>
<link rel="stylesheet" type="text/css"
    href="/alw/styles/jquery.autocomplete.css">
<script src="/alw/scripts/jquery.autocomplete.js"></script>
<script type="text/javascript">
    var releaseData = '';
    var artistData = '';
    var subgenreRows = 0;
    var genre_id = '';
    var correction = 'false';
    $(document).ready(function(){
        $("#apply_search").click(applySearch);
        $("#search_release_inputbox").keydown(function(e){
            //Execute filter if user presses enter on search box
            if (e.which == 13) {
                e.preventDefault();
                applySearch();
            }
        });
    });

    jQuery(window).bind('load', function() {
       if (window.location.href.indexOf('helpcenter') > -1) {
            jQuery('html, body').animate({
                scrollTop: jQuery('#footer').offset().top
            }, '1000');
        }
    });
</script>

<!-- Start Left Side Content -->
<div id="content" class="clearfix no-bg-layout">

<?php
    if ($accountingSnapshotEnabled) { ?>
            <div class="modular-section react-app-module">
            <?php if ($this->isGrossAccountingEnabled && $userObj->isAllowed(null, null, 'uigross_accounting')) { ?>
                <h3><?=$this->translate('Recent Gross Revenue') ?></h3>
            <?php } else { ?>
                <h3><?=$this->translate('Recent Revenue') ?></h3>
            <?php } ?>
            <div class="recent-revenue-display">
                <?php echo $this->partial('partials/react-app.phtml', $this->reactAccountingSnapshotBundle);?>
            </div>
        </div>
<?php
    } ?>
    <div id="contentLeft" class="no-margin-top" onload="loadDashboard()">
        <?php  
            if ($projectManagerEnabled) { ?>
                <div class="modular-section react-app-module">
                    <h3><?=$this->translate('Search your catalog') ?></h3>
                    <?php echo $this->partial('partials/react-app.phtml', $this->reactProjectCreateBundle); ?>
                </div>
        <?php
            } else {
                echo $this->createReleaseButtons(true, new Web_Validate_Checkroleresourceprivilege(),$this->vendorcontractdistributiontypes, $this->releaseBuilderV2FeatureEnabled, $this->featureVendorContext);
            }
            ?>
        <!-- Search bar panel -->
        <?php 
            if (!$projectManagerEnabled) { ?>
                <div class="panel panel-default modular-section">
                    <!-- Header -->
                    <div class="panel-heading">
                        <h3 class="panel-title"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Search Products') : $this->translate->_('Search Releases')?></h3>
                    </div>
                   <div id="search-releases">
                        <div class="input-group-btn">
                            <input id="search_release_inputbox" class="form-control" placeholder="<?=$searchPlaceholder?>">
                            <span class="home-search-btn handPointer">
                                <img id="apply_search" src="/alw/images/icons/Search.svg" height="14" />
                            </span>
                       </div>
                    </div>
                </div>
        <?php 
            } ?>
        <?php 
            if ($projectManagerEnabled) { ?>
                <div class="panel panel-default modular-section react-app-module">
                    <h3><?=$this->translate('Recent Projects') ?></h3>
                <?php
                    echo $this->partial('partials/react-app.phtml', $this->reactProjectRecentListBundle); ?>
                </div>
        <?php
            } ?>
        <!-- Releases in Progress panel -->
        <?php
            if (count($this->ex_a_releases)) { ?>
                <div class="panel panel-default modular-section">
                <!-- Header -->
                <div class="panel-heading">
                    <h3 class="panel-title"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Products In Progress') :$this->translate->_('Release Builder')?></h3>
                </div>
                <table id="in-progress" width="100%" border="0" cellspacing="0" cellpadding="0" class="table-sorter table">
                    <thead>                
                    <tr>
                        <th>&nbsp;</th>
                        <th class="ri releaseType_th text-nowrap"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Product Name') : $this->translate->_('Release Name')?></th>
                        <th><?=$this->translate("Artists")?></th>
                        <th class="rd text-nowrap"><?=$this->translate("Release date")?></th>
                        <!-- <th class="art"><? //=$this->translate->_("Release Status")?></th> -->
                    </tr>
                </thead>
                <tbody>
                    <?php
                        foreach($this->ex_a_releases as $key=>$values){
                            $upc = $values['upc'];
                            $showStepsStatus = false;
                            $release_name = $values['release_name'];
                            $artist_name = $values['artist_name'];
                            $release_date = $values['release_date'];
                            $release_id = $values['release_id'];
                            $version = $values['version'];
                            $subaccount_name = (isset($values['subaccount_name']) && Zend_Registry::get('UserObj')->isAllowed("","","viewsubaccountinindexreleases"))? $values['subaccount_name'] : "";
                            if ($values['distribution_format_media_name'] == 'Digital' || $values['context_type'] == 'physical') {
                                $image_info = array();
                                $response = $this->owsAssetsServiceClient->getCoverImagePath($release_id, 'cover');
                                if ($response->getStatusCode() !== 200) {
                                    $image_info['path'] = "/images/noArtwork.png";
                                } else {
                                    $image_info['path'] = $response->getBody()->getContents();
                                }
                                //Original Image size 110x110 for thumbnail size should be 40x40
                                $image_info['width'] = 40;
                                $image_info['height'] = 40;
                            } else {
                                $image_info = Web_Controller_Plugin_ImagePathLookup::getImage($upc, true, 40, null, $release_id, false, null, 'posterart');
                            }
                            $isDigitalProductBuilder = ($this->isProjectMode
                                && $values['context_type'] == 'digital'
                                && ($values['release_status'] == 'label_processing' || $values['release_status'] == 'transfer_to_content')
                                && $values['status'] != 'rejected'
                            );
                            if ($values['track_type'] != 'video' && $isDigitalProductBuilder || ($values['product_type_id'] == 1 && $values['status'] == 'rejected')) {
                                 $href = '/project/' . $values['project_id'] . '/product/' . $release_id . '/overview';
                            } else {
                                $href = "/releasebuilder/view?release_id=".$release_id;
                            }
                                $randomValue = mt_rand();
                                $image_info['path'] .= "?".$randomValue;
                            /**  ------ BEGIN DISPLAY  LSIT SECTION  ------- */
                            if($showStepsStatus == true){
                        ?>
                    <tr id="homepageTableRelease<?=$release_id?>">
                        <td align="left" width="">
                            <div class="release-thumb">
                                <a class="viewReleasesPhoto" href="<?=$href?>">
                                    <img src="<?=$image_info['path']?>" width="<?=$image_info['width']?>" height="<?=$image_info['height']?>" />
                                </a>
                            </div>
                        </td>
                        <td class="ri" width="0">
                            <div class="releaseInfo">
                                <!--<?=(($values['release_type'] == 'music_video') ? '<img src="/images/icons/videoicon.gif"/>' : '')?>-->
                                <a href="<?=$href?>" class="albumName">
                                    <?=$release_name?>
                                </a>
                            </div>
                        </td>
                        <td>
                            <div class="release-artist">
                                <?=$artist_name?>
                                <!--<?=($version ? "<br>(" . $version . ")" : "")?>-->
                                <?=((trim($subaccount_name) != "") ? "<br>(" . $subaccount_name . ")" : "")?>
                            </div>
                        </td>
                        <td class="release-date text-center" width="">
                            <div class="release-date">
                                <?=$release_date?>
                            </div>
                        </td>
                    </tr>
                    <?php }else{ ?>
                    <tr id="homepageTableContentRelease<?=$values['upc']?>">
                        <td align="left" width="">
                            <div class="release-thumb">
                                <a class="viewReleasesPhoto" href="<?=$href?>">
                                    <img src="<?=$image_info['path']?>" width="<?=$image_info['width']?>" height="<?=$image_info['height']?>" />
                                </a>
                            </div>
                        </td>
                        <td class="ri" width="">
                            <div class="releaseInfo">
                                <!--<?=($values['video_track_count']?'<img src="/images/icons/videoicon.gif"/>':'')?>-->
                                <a href="<?=$href?>" class="albumName">
                                    <?=$release_name?>
                                </a>
                            </div>
                        </td>
                        <td>
                            <div class="release-artist">
                                <?=$artist_name?>
                                <!--<?=($version ? "<br>(".$version.")" : "")?>-->
                                <?=((trim($subaccount_name) != "") ? "<br>(" . $subaccount_name . ")" : "")?>
                            </div>
                        </td>
                        <td class="release-date">
                            <div class="release-date">
                                <?=$release_date?>
                            </div>
                        </td>
                    </tr>
                    <?php
                        } /**  ------ ENDS DISPLAY  LSIT SECTION  ------- */
                    }
                    ?>
                </tbody>
            </table>
            <div class="panel-footer">
                <a class="float-right view-more" href="/index/viewexareleases?filterType=submitted,in_progress,error_correction,rejected&amp;productType=1,2,3,5&amp;release_date=desc">
                    <span class="font-weight"><?=$this->translate('View more')?> <img src="/images/redesign/view-more-arrow.svg" /></span>
                </a>
                <div class="clear"></div>
            </div>
            <!-- End Module Body -->
        </div>
        <?php } ?>
        <!-- End Release Schedule Module -->
        <!-- Your Recent Releases Module -->
        <?php
        if (!$projectManagerEnabled && count($this->releases)) { ?>
        <div class="panel panel-default modular-section">
            <!-- Header -->
            <div class="panel-heading">
                <h3 class="panel-title"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Products In Catalog') : $this->translate->_('Releases In Catalog')?></h3>
            </div>
            <!-- End Header -->
            <!-- Start Module Body -->
                    <!-- REMOVED IN THE DESIGNS
                    <div class="modKey"></div>
                    <div class="clear"></div>
                    -->
            <table id="in-catalog" width="100%" border="0" cellspacing="0" cellpadding="0" class="table-sorter table">
                <thead class="table_header">
                    <tr>
                        <th class="ri releaseType_th text-nowrap"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Product') : $this->translate->_('Release')?></th>
                        <th class="ri"><?=$this->translate("Name")?></th>
                        <th class="rd text-nowrap"><?=$this->translate("Release date")?></th>
                        <th class="wt text-nowrap"><?=$userObj->isAllowed(null, null, 'uiproject') ? $this->translate->_('Product Status') : $this->translate->_('Release Status')?></th>
                    </tr>
                </thead>
                <tbody>
                <?
                /**if(count($this->releases)){
                 **/
                foreach($this->releases as $key => $values) {
                    $release_name = $values['release_name'];
                    $release_date = $values['release_date'];
                    $artist_name = $values['artist_name'];
                    $upc = $values['upc'];
                    $release_id = $values['release_id'];
                    $subaccount_name = (isset($values['subaccount_name']) && Zend_Registry::get('UserObj')->isAllowed("","","viewsubaccountinindexreleases"))? $values['subaccount_name'] : "";
                    if ($projectManagerEnabled) {
                        $product_type = $values['context_type'];
                    }
                    $image_info = Web_Controller_Plugin_ImagePathLookup::getImage($upc, true, 40, null, null, false, null, "posterart");
                    $href = "/releasebuilder/view?release_id=" . $release_id;
                    $vendor_catalog_number = $values['vendor_catalog_number'];
                    ?>
                    <tr id="homepageTableContentRelease2<?=$upc?>">
                        <td align="center" width="">
                            <div class="release-thumb">
                                <a class="viewReleasesPhoto" href="<?=$href?>">
                                    <img src="<?=$image_info['path']?>" width="<?=$image_info['width']?>" height="<?=$image_info['height']?>" />
                                </a>
                            </div>
                        </td>
                        <td class="ri" width="">
                            <div class="releaseInfo">
                            <a href="<?=$href?>" class="albumName" upc="<?php echo $upc ?>">
                                    <?=$release_name?>
                                </a>
                                <?=$artist_name?>
                                <?=((trim($subaccount_name) != "") ? "<br>(" . $subaccount_name . ")" : "")?>
                            </div>
                        </td>
                        <td class="release-date">
                            <div class="release-date">
                                <?=$release_date?>
                            </div>
                        </td>
                        <td class="status text-center" width="">
                            <div class="release-status">
                                <?php if ($userObj->isAllowed("","","icon_marketplace_homepage") && $this->has_marketing_resource) { ?>
                                <a href="/marketing/allapplications/">
                                    <img title="Market this release" src="/images/icons/marketing.png" />
                                </a>
                                <?php }
                                if (!$projectManagerEnabled || $product_type !== 'physical') { ?>
                                        <a href="/releasebuilder/deliveryreport/upc/<?=$upc?>">
                                            <img title="View delivery report" src="/images/icons/delivery.png" />
                                        </a>
                                <?php
                                }
                                //isAllowed method checks if user has access to Analytics Section
                                if ($userObj->isAllowed('', '', 'homepageanalytic') && $this->has_analytics_resource) { ?>
                                    <a href="/analytics/overview?product_ids=<?=$upc?>">
                                        <img title="<?=$this->translate->_('Analyze sales activity')?>" src="/images/icons/analytics.png"/>
                                    </a>
                                <?php
                                }
                                if ($this->has_accounting_resource) { ?>
                                        <?php
                                        $min = (!empty($this->periods->periods[0]->min)) ? $this->periods->periods[0]->min : null;
                                        $max = (!empty($this->periods->periods[0]->max)) ? $this->periods->periods[0]->max : null;
                                        if ($workstationAccountingPeriodEnabled && $isAccountingNavigationEnabled) { ?>
                                            <a href="/accounting/?accounting_start=<?php echo $min; ?>&amp;accounting_end=<?php echo $max; ?>&amp;view_by=release_id&amp;release_ids=<?=$upc?>&amp;page=1"><img title="View accounting data " src="/images/icons/accounting.png" /></a>
                                        <?php } elseif($isAccountingNavigationEnabled) { ?>
                                            <a href="/accounting/?accounting_start=<?php echo $min; ?>&amp;accounting_end=<?php echo $max; ?>&amp;view_by=trackId&amp;releaseIds=<?=$upc?>&amp;page=1"><img title="View accounting data " src="/images/icons/accounting.png" /></a>
                                        <?php }
                                } ?>
                            </div>
                        </td>
                    </tr>
                <? } ?>
                </tbody>
            </table>
            <div class="panel-footer">
                <a class="float-right view-more" href="/index/viewexareleases/?filterType=delivered&amp;productType=1,2,3,5&amp;release_date=desc">
                    <span class="font-weight"><?=$this->translate("View more")?> <img src="/images/redesign/view-more-arrow.svg" /></span>
                </a>
                <div class="clear"></div>
            </div>
        </div><!-- End Module Body -->
        <?php } ?>
<!-- End Recent Releases Module -->
<div id="modal_overlay" class="modal fade in">
    <div id="modal_container"></div>
</div>
<div id="new_artist_overlay" class="modal fade in">
    <div id="new_artist_container"></div>
</div>
</div>
<!-- End Left Side Content --> <!-- Start Right Side Content -->
<div id="contentRight">
    <div id="conflictManagerWidget" class="clearfix react-app-module">
        <div class="recent-revenue-display">
            <?php echo $this->partial('partials/react-app.phtml', $this->reactConflictManagerWidgetBundle);?>
        </div>
    </div>
    <?php
        if($this->has_accounting_resource){
            if($this->userObj->isAllowed("","","alw_accounting_snapshot_widget")){
            ?>
        <?php
            if($this->flg_travelex) { ?>
                <div class="panel panel-default modular-section">
                    <div class="panel-body">
                        <div class="western-union">
                            <div class="pull-left">
                                <a href="/accounting/westernunion"><b><?=$this->translate->_("Enroll Now for")?> <?=$this->translate->_("Electronic Royalty")?> 
                                <?=$this->translate->_("Payments")?></b></a>
                                <?=$this->translate->_("Already Enrolled")?>
                                <a class="travelexlogin" target="_blank" href="https://payee.globalpay.convera.com/PayeeManager/Beneficiary/Login.aspx"> 
                                <?=$this->translate->_("Login Here")?></a>
                                <div class="clear"></div>
                            </div>
                            <div class="pull-left">
                                <img src="/images/wubs_logo.png" />
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>
        <?php
            }
            ?>
        <?php
            }
        }
        ?>
    <?php
        // Should user see any top ten information what so ever
        if($this->has_accounting_resource && $this->userObj->isAllowed('', '', 'alw_top_ten_widget')):
    ?>
    <section class="top-ten modular-section"></section>
<?php endif; ?>
    <div class="panel panel-default orchard-news modular-section" id="modSmall3">
        <div class="panel-heading">
            <h3 class="panel-title"><?=$this->translate('Orchard News'); ?></h3>
        </div>
        <div id="modSmallTop3"></div>
    </div>
</div>
<!-- End Right Side Content --></div>

<script type="text/javascript">
$(window).bind('load', function() {
    <?php if ($this->openFilmModalWindow === true) { ?>
        modalWindoweditFilmReleaseModal({'product_type': 'Movie'})
    <?php } ?>
    <?php if (!$accountingSnapshotEnabled) {?>
    $("#modSmallTop5").load('/accounting/snapshot');
    <?php } ?>

    $("#modSmallTop3").load('/widgets/widget_inTheNews.php');
    populateTopTen('modSmallTop4','release_id');

});

var modal_overlay = $('#modal_overlay').overlay({
    closeOnEsc:	false,
    closeOnClick: false,
    // custom top position
    top: '5%',
    left: 'center',
    speed: 900,
    // some expose tweaks suitable for facebox-looking dialogs
    expose: {

        // you might also consider a "transparent" color for the mask
        color: '#333',

        // load mask a little faster
        loadSpeed: 900,

        // highly transparent
        opacity: 0.7
    },
    // we want to use the programming API
    api: true
});

var new_artist_overlay = $('#new_artist_overlay').overlay({
    closeOnEsc:	false,
    closeOnClick: false,
    oneInstance: false,
    // custom top position
    top: '5%',
    left: 'center',
    speed: 700,
    // some expose tweaks suitable for facebox-looking dialogs
    expose: {

        // you might also consider a "transparent" color for the mask
        color: '#333',

        // load mask a little faster
        loadSpeed: 700,

        // highly transparent
        opacity: 0.9,

        zIndex: 9999
    },
    // we want to use the programming API
    api: true
});

new_artist_overlay.onStart(function(){
    $('#new_artist_overlay').css({top: $('#modal_overlay').position().top+"px"});
});

function populateTopTen(target_id, action){
    var url = '/accounting/topten';
    $('#top_ten_tracks').attr('disabled', 'disabled');
    $('#top_ten_releases').attr('disabled', 'disabled');
    $('#top_ten_artists').attr('disabled', 'disabled');
    $("#"+target_id).html("<div class='populate-top-ten-loader'><b><?=$this->escapejs($this->translate->_("Loading...."))?></b></div>");
    $("#"+target_id).load('/accounting/topten?view_by=' + action);
}
var tooltipClassName = "";
<?php
if ($this->userObj->isAllowed(null, null, 'labelsdropdown')) {
?>
    tooltipClassName = 'subaccount';
<?php 
} else {
?>
    tooltipClassName = 'meta_language';
<?php
}
?>
var artistNameFieldId = 'createReleaseArtistName_li';
artistNameFieldId = 'inputGroupArtistName';
function createReleaseOnBeforeLoad(){
    modal_overlay.oneInstance = false;
    $("#tooltipForRelease").hide();
    showModalTooltip('tooltipForRelease','createReleaseArtistName_li');
    showModalTooltip('tooltipForRelease',tooltipClassName);
	modal_overlay.oneInstance = false;
	$("#tooltipForRelease").hide();
	showModalTooltip('tooltipForRelease', artistNameFieldId);
	showModalTooltip('tooltipForRelease',tooltipClassName);
}
function createReleaseOnBeforeClose(){
    modal_overlay.oneInstance = true;
    $("#ui-datepicker-div").hide();
}
function createReleaseOnLoad(){
    showModalTooltip('tooltipForRelease','createReleaseArtistName_li');
    showModalTooltip('tooltipForRelease',tooltipClassName);
	showModalTooltip('tooltipForRelease', artistNameFieldId);
	showModalTooltip('tooltipForRelease',tooltipClassName);
}

function createFilmReleaseOnBeforeLoad(){
    modal_overlay.oneInstance = false;
    $("#tooltipForRelease").hide();
    showModalTooltip('tooltipForRelease','createReleaseArtistName_li');
    showModalTooltip('tooltipForRelease',tooltipClassName);
}
function createFilmReleaseOnBeforeClose(){
    modal_overlay.oneInstance = true;
    $("#ui-datepicker-div").hide();
}
function createFilmReleaseOnLoad(){
    showModalTooltip('tooltipForRelease','createReleaseArtistName_li');
    showModalTooltip('tooltipForRelease',tooltipClassName);
}
function newArtistFilmModalOnLoad(){
    $('#modal_overlayeditFilmReleaseModal').css("top",$('#modal_overlaynewArtistFilmModal').css("top"));
}
$(".homepageTable td").click(function(){
    document.location.href = $("#"+$(this).parent().attr("id")+" td.ri a").attr("href");
});

function applySearch(){
    var searchTerm = encodeURIComponent($("#search_release_inputbox").val());
    document.location.href = "/index/viewexareleases?filterType=delivered,submitted,in_progress,error_correction,rejected&productType=1,2,3,5&name="+searchTerm;
}

</script>
<?php
$createReleaseParams = array();
if ($projectManagerEnabled && isset($this->projectId) && isset($this->projectCode)) {
    $createReleaseParams["project_code"] = $this->projectCode;
    $createReleaseParams["project_id"] = $this->projectId;
    $createReleaseParams["artist_id"] = $this->projectArtist;
    $createReleaseParams["product_type"] = $this->productType;
}
if ($projectManagerEnabled && !empty($this->projectSubaccount)) {
    $createReleaseParams["subaccount_id"] = $this->projectSubaccount;
}
$options = array(
    array("uniqueID"=>"editReleaseModal", "link"=>'a[ref="createRelease_button"]', "url"=>"/releasebuilder/createreleasemodal",
        "onBeforeClose"=>"createReleaseOnBeforeClose", "onBeforeLoad"=>"createReleaseOnBeforeLoad", "onLoad"=>"createReleaseOnLoad",
        "closeOnEsc"=>true, "closeOnClick"=>true, "loadSpeed"=>100, "top"=>10, "jsonParams"=>$createReleaseParams),
    array("uniqueID"=>"newArtistModal", "link"=>"#newArtist", "url"=>"/artist/addartistmodal", "closeOnEsc"=>false, "closeOnClick"=>false,
        "loadSpeed"=>100, "top"=>10, "oneInstance"=>false, "onLoad"=>"newArtistModalOnLoad", "jsonParams"=>array("ajax"=>1)),
    array("uniqueID"=>"editFilmReleaseModal","useUniqueID" => true, "link"=>'a[ref="createFilmRelease_button"]', "url"=>"/releasebuilder/createfilmreleasemodal",
        "onBeforeClose"=>"createFilmReleaseOnBeforeClose", "onBeforeLoad"=>"createFilmReleaseOnBeforeLoad", "onLoad"=>"createFilmReleaseOnLoad",
        "closeOnEsc"=>true, "closeOnClick"=>true, "loadSpeed"=>100, "top"=>10),
    array("uniqueID"=>"newArtistFilmModal", "useUniqueID" => true,"link"=>"#newArtist", "url"=>"/artist/addartistmodal", "closeOnEsc"=>false, "closeOnClick"=>false,
        "loadSpeed"=>100, "top"=>10, "oneInstance"=>false, "onLoad"=>"newArtistFilmModalOnLoad", "jsonParams"=>array("ajax"=>1))
);
echo $this->modalwindow($options, $this->featureVendorContext);?>
<?php
$loadbaroptions = array(
    array("loadingbarid"=>"onsaverelease", "loadingtext"=>"Please Wait...."),
    array("loadingbarid"=>"onsavefilmrelease", "loadingtext"=>"Please Wait...."));
echo $this->Loadingimage($loadbaroptions)
?>

<script type="text/json" id="user_data"><?=json_encode($this->user)?></script>
<script type="text/json" id="i18n"><?=json_encode($this->i18n)?></script>
<?php echo $this->feature($oauthConfig, $awsConfigs, $_SESSION); ?>
