Page 3 of 3

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

Posted: Mon Mar 07, 2016 10:04 pm
by dedevillela
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

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

Posted: Sat Mar 12, 2016 1:39 am
by agw
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.

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

Posted: Mon Mar 14, 2016 2:57 pm
by dedevillela
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

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

Posted: Sun Nov 27, 2016 11:09 am
by DeWoert
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 ?

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

Posted: Mon Nov 28, 2016 1:54 am
by agw
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 :)

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

Posted: Mon Nov 28, 2016 7:38 am
by DeWoert
Perfect !!! :!: :!:
Many thanks, was editing this by hand, this way is so much easier... :mrgreen:

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

Posted: Mon Nov 28, 2016 1:52 pm
by RatbyVRS
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

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

Posted: Thu Dec 01, 2016 10:54 pm
by batrakiu
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.

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

Posted: Fri Dec 02, 2016 7:53 pm
by batrakiu
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. :?: