Manufacturer as squadron logo source in Custom Content Plugin?

Are you having problems with using or developing a plugin? Let me know here.
dedevillela
Posts: 9
Joined: Mon Jan 18, 2016 7:11 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by dedevillela » Mon Mar 07, 2016 10:04 pm

Nice, it worked like a charm!

Only missing feature (last one, I promisse) is to display different flag if its a military vehicle, something like "<Country Name>_Mil.bmp". All coutries already have such file with roundel art on it instead of the country flag.

Best regards,

Andre Villela

agw
Posts: 2249
Joined: Fri Feb 17, 2012 3:20 am

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by agw » Sat Mar 12, 2016 1:39 am

No worries :) Change this line:

Code: Select all

hasChangedCallback:     function(aircraft) { return aircraft.country.chg; },
to this:

Code: Select all

hasChangedCallback:     function(aircraft) { return aircraft.country.chg || aircraft.isMilitary.chg; },
and then change this:

Code: Select all

var codeToUse = aircraft.country.val;
to this:

Code: Select all

var codeToUse = aircraft.country.val + (aircraft.isMilitary.val ? '_Mil' : '');
I think that should do it but I've not actually tried it.

dedevillela
Posts: 9
Joined: Mon Jan 18, 2016 7:11 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by dedevillela » Mon Mar 14, 2016 2:57 pm

Thank you very much!

I'm just waiting for a military aircraft to pass by and check it out, it would'n take that long, I hope... :)

Best regards!

Andre

Edit: it worked fine with military insignias replacing the country flags! As a side note, I've edited the flags to a new size to best fit with OpFlag and Silhouette, so the new flag size is 27x20px. See below for a screenshot with the result:
Image

DeWoert
Posts: 42
Joined: Mon Feb 29, 2016 9:36 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by DeWoert » Sun Nov 27, 2016 11:09 am

Hi there,
Been trying to get this code to work, but no luck so far.
Running VRS 2.4.0

What i want as result:
When the Operator-field is empty, it should show a "custom" operator-flag, based on the ICAO-Type.
Example:
Aircraft (Model) ICAO type: C172
Operator ICAO should become also C172

In the Operatorflags directory if have .bmp's like "c172.bmp".

Looks like this code would make that possible ?

agw
Posts: 2249
Joined: Fri Feb 17, 2012 3:20 am

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by agw » Mon Nov 28, 2016 1:54 am

I think to get the effect you're after you need to use the script from this posting back in the thread:

viewtopic.php?f=5&t=815&start=10#p4323

and then in this bit where it puts the URL together:

Code: Select all

        codeToUse = customPipeSeparatedCode(codeToUse, registration);
        codeToUse = customPipeSeparatedCode(codeToUse, manufacturer);
        codeToUse = customPipeSeparatedCode(codeToUse, operatorIcao);
        codeToUse = customPipeSeparatedCode(codeToUse, icao);
you need to change the order so that the operator ICAO comes before the manufacturer ICAO:

Code: Select all

        codeToUse = customPipeSeparatedCode(codeToUse, operatorIcao);
        codeToUse = customPipeSeparatedCode(codeToUse, manufacturer);
        codeToUse = customPipeSeparatedCode(codeToUse, registration);
        codeToUse = customPipeSeparatedCode(codeToUse, icao);
Also that script was using the manufacturer field, which you don't want. You want the modal ICAO. You can fix that by changing this function from:

Code: Select all

    function customFormatOperatorIcaoImageHtmlAircraft(aircraft)
    {
        return customFormatOperatorIcaoImageHtml(aircraft.manufacturer.val, aircraft.operatorIcao.val, aircraft.registration.val, aircraft.icao.val);
    }
to

Code: Select all

    function customFormatOperatorIcaoImageHtmlAircraft(aircraft)
    {
        return customFormatOperatorIcaoImageHtml(aircraft.modelIcao.val, aircraft.operatorIcao.val, aircraft.registration.val, aircraft.icao.val);
    }
and then search for this line:

Code: Select all

renderCallback:     function(/** VRS_JSON_REPORT_AIRCRAFT */ json) { return customFormatOperatorIcaoImageHtml(json.manufacturer, json.opFlag, json.reg, json.icao); },
and change it to this:

Code: Select all

renderCallback:     function(/** VRS_JSON_REPORT_AIRCRAFT */ json) { return customFormatOperatorIcaoImageHtml(json.typ, json.opFlag, json.reg, json.icao); },
I think that should work :)

DeWoert
Posts: 42
Joined: Mon Feb 29, 2016 9:36 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by DeWoert » Mon Nov 28, 2016 7:38 am

Perfect !!! :!: :!:
Many thanks, was editing this by hand, this way is so much easier... :mrgreen:

RatbyVRS
Posts: 4
Joined: Fri Apr 01, 2016 4:28 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by RatbyVRS » Mon Nov 28, 2016 1:52 pm

I was looking for something similar. I am looking to be able to bring up the Operator Flag based on both the Operator and Aircraft type. I have file names like TOMB788.bmp so that flag would show for Thomson Airway Boeing 787-800's, etc

Is there a way to alter the script to do this or do I need to make a change in the Database to allow this?

Cheers

Alistair

batrakiu
Posts: 11
Joined: Sat Oct 15, 2016 10:14 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by batrakiu » Thu Dec 01, 2016 10:54 pm

RatbyVRS wrote:I was looking for something similar. I am looking to be able to bring up the Operator Flag based on both the Operator and Aircraft type. I have file names like TOMB788.bmp so that flag would show for Thomson Airway Boeing 787-800's, etc

Is there a way to alter the script to do this or do I need to make a change in the Database to allow this?

Cheers

Alistair
I was trying the same thing, and got it with the help of egpd1701. ;)
viewtopic.php?f=3&t=1005&hilit=silhouettes&start=13
Now, I'm just missing the part of the reports.

The script in that link is for the Silhouette, but you can follow the first that agw said, but in the "codeToUse" use from the link I sent you.

batrakiu
Posts: 11
Joined: Sat Oct 15, 2016 10:14 pm

Re: Manufacturer as squadron logo source in Custom Content Plugin?

Post by batrakiu » Fri Dec 02, 2016 7:53 pm

I'm using the Silhouette to be shown as "Operator"+"ModelIcao" (ex. BAW+A320 to get the BAWA320.bmp),

Code: Select all

 function customFormatTypeIcaoImageHtml(aircraft)
    {
        var codeToUse = '';
        codeToUse = customPipeSeparatedCode(codeToUse, aircraft.registration.val);
	codeToUse = customPipeSeparatedCode(codeToUse, aircraft.manufacturer.val);
	codeToUse = customPipeSeparatedCode(codeToUse, aircraft.operatorIcao.val + '' + aircraft.modelIcao.val);
How can I use this aircraft.operatorIcao.val + '' + aircraft.modelIcao.val in the reports?
The examples that we have here is to use the manufacturer, but I would like to use this "meshed name" to the Silhouettes in reports.

Perhaps I could also auto-populate my Database's Manufacturer field whit this "BAWA320" and then just "say" to the report to get that value, like it is in the example. :?:

Post Reply