Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
18f1968d
Commit
18f1968d
authored
Feb 04, 2016
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ask the user if they are sure they want to load new blocks (replace workspace).
parent
77da5c9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
ardublockly/ardublockly.js
ardublockly/ardublockly.js
+26
-18
ardublockly/ardublockly_blockly.js
ardublockly/ardublockly_blockly.js
+2
-2
No files found.
ardublockly/ardublockly.js
View file @
18f1968d
...
@@ -293,28 +293,36 @@ Ardublockly.changeIdeButtons = function(value) {
...
@@ -293,28 +293,36 @@ Ardublockly.changeIdeButtons = function(value) {
};
};
/**
/**
* Loads an XML file from the server and
adds the blocks into the Blockly
* Loads an XML file from the server and
replaces the current blocks into the
* workspace.
*
Blockly
workspace.
* @param {!string} xmlFile Server location of the XML file to load.
* @param {!string} xmlFile Server location of the XML file to load.
*/
*/
Ardublockly
.
loadServerXmlFile
=
function
(
xmlFile
)
{
Ardublockly
.
loadServerXmlFile
=
function
(
xmlFile
)
{
// The loadXmlBlockFile loads the file asynchronously and needs a callback
var
loadXmlfileAccepted
=
function
()
{
var
loadXmlCallback
=
function
(
sucess
)
{
// loadXmlBlockFile loads the file asynchronously and needs a callback
if
(
sucess
)
{
var
loadXmlCallback
=
function
(
sucess
)
{
Ardublockly
.
renderContent
();
if
(
sucess
)
{
}
else
{
Ardublockly
.
renderContent
();
Ardublockly
.
alertMessage
(
}
else
{
'
Invalid XML
'
,
Ardublockly
.
alertMessage
(
'
The XML file was not successfully parsed into blocks.
'
+
'
Invalid XML
'
,
'
Please review the XML code and try again.
'
,
'
The XML file was not successfully parsed into blocks.
'
+
false
);
'
Please review the XML code and try again.
'
,
}
false
);
};
}
var
callbackConnectionError
=
function
()
{
};
Ardublockly
.
openNotConnectedModal
();
var
callbackConnectionError
=
function
()
{
Ardublockly
.
openNotConnectedModal
();
};
Ardublockly
.
loadXmlBlockFile
(
xmlFile
,
loadXmlCallback
,
callbackConnectionError
);
};
};
Ardublockly
.
loadXmlBlockFile
(
xmlFile
,
loadXmlCallback
,
callbackConnectionError
);
Ardublockly
.
alertMessage
(
'
Load new blocks?
'
,
'
Loading a new XML file will replace the current blocks from the
'
+
'
workspace.
\n
Are you sure you want to proceed?
'
,
true
,
loadXmlfileAccepted
);
};
};
/**
/**
...
...
ardublockly/ardublockly_blockly.js
View file @
18f1968d
...
@@ -61,8 +61,8 @@ Ardublockly.bindBlocklyEventListeners = function() {
...
@@ -61,8 +61,8 @@ Ardublockly.bindBlocklyEventListeners = function() {
};
};
/**
/**
* Loads an XML file from the server and
adds the blocks into the Blockly
* Loads an XML file from the server and
replaces the current blocks into the
* workspace.
*
Blockly
workspace.
* @param {!string} xmlFile XML file path in a reachable server (no local path).
* @param {!string} xmlFile XML file path in a reachable server (no local path).
* @param {!function} callbackFileLoaded Function to be called once the file is
* @param {!function} callbackFileLoaded Function to be called once the file is
* loaded.
* loaded.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment