Page MenuHomeWildfire Games

Visit mod URL button
ClosedPublic

Authored by elexis on Dec 2 2017, 1:38 PM.

Details

Summary

The second button could be moved to a separate line above the save/cancel/launch buttons (described here D1079).

Test Plan

Notice that the engine function doesnt execute for play0ad.com.

This might mean that we might consider changing the engine function and
also consider requiring the scheme part of the URL (https://en.wikipedia.org/wiki/URL#Syntax)

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Dec 2 2017, 1:38 PM
Vulcan added a subscriber: Vulcan.Dec 2 2017, 2:26 PM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Vulcan added a comment.Dec 2 2017, 2:27 PM
Executing section Default...
Executing section Source...
Executing section JS...
ffffffff added inline comments.
binaries/data/mods/mod/gui/modmod/modmod.xml
105 ↗(On Diff #4490)

name="websiteButton" enable="false"

var g_Url = "";

list.onSelectionChange = checkModWebsite(this)

function checkModWebsite(list)
{
let folder = list.list_folder[list.selected];
g_Url = folder && g_Mods[folder] && g_Mods[folder].url;
Engine.GetGUIObjectByName(listName).enable = g_Url ? true : false;
}

function visitModWebsite()
{
if (!g_Url.startsWith("http://") || g_Url.startsWith("https://"))

		g_Url = "http://" + g_Url;

Engine.OpenURL(g_Url);
}

ffffffff added inline comments.Dec 5 2017, 10:29 PM
binaries/data/mods/mod/gui/modmod/modmod.xml
105 ↗(On Diff #4490)

Engine.GetGUIObjectByName(listName) wrong mean Engine.GetGUIObjectByName("websiteButton")

ffffffff added inline comments.Dec 5 2017, 10:30 PM
binaries/data/mods/mod/gui/modmod/modmod.xml
105 ↗(On Diff #4490)

function visitModWebsite()
{
if (!g_Url)
return;
if (!g_Url.startsWith("http://") || g_Url.startsWith("https://"))

		g_Url = "http://" + g_Url;

Engine.OpenURL(g_Url);
}

Grugnas accepted this revision.Dec 6 2017, 8:46 PM
Grugnas added a subscriber: Grugnas.

Accepted after the discussion about buttons organization.

This revision is now accepted and ready to land.Dec 6 2017, 8:46 PM
elexis added a comment.Dec 6 2017, 8:55 PM

Thanks for the reviews.

binaries/data/mods/mod/gui/modmod/modmod.xml
105 ↗(On Diff #4490)

I agree that the button should be disabled, but it won't work with only a single global.
I think a disable-button implementation should encompass all buttons simultaneously.

This revision was automatically updated to reflect the committed changes.