Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
d8b0d44b
Commit
d8b0d44b
authored
Aug 09, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
8d0a7119
69e5f24a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
908 additions
and
883 deletions
+908
-883
index.html
resources/library/interactive/Calculator.wgt/index.html
+28
-28
ubw-main.js
resources/library/interactive/Calculator.wgt/js/ubw-main.js
+454
-333
ubw-main.js
resources/library/interactive/Notes.wgt/js/ubw-main.js
+177
-170
index.html
resources/library/interactive/WebBrowser.wgt/index.html
+196
-201
jquery.oembed.js
...brary/interactive/WebBrowser.wgt/scripts/jquery.oembed.js
+0
-146
UniboardSankoreTransition.cpp
src/transition/UniboardSankoreTransition.cpp
+51
-5
UniboardSankoreTransition.h
src/transition/UniboardSankoreTransition.h
+2
-0
No files found.
resources/library/interactive/Calculator.wgt/index.html
View file @
d8b0d44b
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
ubwidget
</title>
<script
src=
"js/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery-ui-1.7.2.custom.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.disable.text.select.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.center.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.ubwidget.js"
type=
"text/javascript"
></script>
<script
src=
"js/DD_roundies_0.0.2a.js"
type=
"text/javascript"
></script>
<script
src=
"js/ubw-main.js"
type=
"text/javascript"
></script>
<script
src=
"js/calculate.js"
type=
"text/javascript"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/ubwidget.css"
/>
</head>
<body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
init
();
});
</script>
<div
id=
"ubwidget"
></div>
</body>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
ubwidget
</title>
<script
src=
"js/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery-ui-1.7.2.custom.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.disable.text.select.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.center.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.ubwidget.js"
type=
"text/javascript"
></script>
<script
src=
"js/DD_roundies_0.0.2a.js"
type=
"text/javascript"
></script>
<script
src=
"js/ubw-main.js"
type=
"text/javascript"
></script>
<script
src=
"js/calculate.js"
type=
"text/javascript"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/ubwidget.css"
/>
</head>
<body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
init
();
});
</script>
<div
id=
"ubwidget"
></div>
</body>
</html>
\ No newline at end of file
resources/library/interactive/Calculator.wgt/js/ubw-main.js
View file @
d8b0d44b
This diff is collapsed.
Click to expand it.
resources/library/interactive/Notes.wgt/js/ubw-main.js
View file @
d8b0d44b
This diff is collapsed.
Click to expand it.
resources/library/interactive/WebBrowser.wgt/index.html
View file @
d8b0d44b
This diff is collapsed.
Click to expand it.
resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js
deleted
100644 → 0
View file @
8d0a7119
(
function
(
$
)
{
$
.
fn
.
oembed
=
function
(
url
,
options
)
{
options
=
$
.
extend
({},
$
.
fn
.
oembed
.
defaults
,
options
);
return
this
.
each
(
function
()
{
var
container
=
$
(
this
),
target
=
(
url
!=
null
)
?
url
:
container
.
attr
(
"href"
),
provider
;
if
(
target
!=
null
)
{
provider
=
getOEmbedProvider
(
target
);
if
(
provider
!=
null
)
{
provider
.
maxWidth
=
options
.
maxWidth
;
provider
.
maxHeight
=
options
.
maxHeight
;
provider
.
embedCode
(
target
,
function
(
code
)
{
container
.
html
(
code
);
});
}
}
});
};
// Plugin defaults
$
.
fn
.
oembed
.
defaults
=
{
maxWidth
:
500
,
maxHeight
:
400
};
$
.
fn
.
oembed
.
getPhotoCode
=
function
(
url
,
data
)
{
var
code
=
'<div><a href="'
+
url
+
'" target="_blank"><img src="'
+
data
.
url
+
'"/></a></div>'
;
if
(
data
.
html
)
code
+=
"<div>"
+
data
.
html
+
"</div>"
;
return
code
;
};
$
.
fn
.
oembed
.
getVideoCode
=
function
(
url
,
data
)
{
var
code
=
data
.
html
;
return
code
;
};
$
.
fn
.
oembed
.
getRichCode
=
function
(
url
,
data
)
{
var
code
=
data
.
html
;
return
code
;
};
$
.
fn
.
oembed
.
getGenericCode
=
function
(
url
,
data
)
{
var
title
=
(
data
.
title
!=
null
)
?
data
.
title
:
url
,
code
=
'<a href="'
+
url
+
'">'
+
title
+
'</a>'
;
if
(
data
.
html
)
code
+=
"<div>"
+
data
.
html
+
"</div>"
;
return
code
;
};
$
.
fn
.
oembed
.
isAvailable
=
function
(
url
)
{
var
provider
=
getOEmbedProvider
(
url
);
return
(
provider
!=
null
);
};
/* Private Methods */
function
getOEmbedProvider
(
url
)
{
for
(
var
i
=
0
;
i
<
providers
.
length
;
i
++
)
{
if
(
providers
[
i
].
matches
(
url
))
return
providers
[
i
];
}
return
null
;
}
var
providers
=
[
new
OEmbedProvider
(
"fivemin"
,
"5min.com"
),
new
OEmbedProvider
(
"amazon"
,
"amazon.com"
),
new
OEmbedProvider
(
"flickr"
,
"flickr"
,
"http://flickr.com/services/oembed"
,
"jsoncallback"
),
new
OEmbedProvider
(
"googlevideo"
,
"video.google."
),
new
OEmbedProvider
(
"hulu"
,
"hulu.com"
),
new
OEmbedProvider
(
"imdb"
,
"imdb.com"
),
new
OEmbedProvider
(
"metacafe"
,
"metacafe.com"
),
new
OEmbedProvider
(
"qik"
,
"qik.com"
),
new
OEmbedProvider
(
"revision3"
,
"slideshare"
),
new
OEmbedProvider
(
"slideshare"
,
"5min.com"
),
new
OEmbedProvider
(
"twitpic"
,
"twitpic.com"
),
new
OEmbedProvider
(
"viddler"
,
"viddler.com"
),
new
OEmbedProvider
(
"vimeo"
,
"vimeo.com"
,
"http://vimeo.com/api/oembed.json"
),
new
OEmbedProvider
(
"wikipedia"
,
"wikipedia.org"
),
new
OEmbedProvider
(
"wordpress"
,
"wordpress.com"
),
new
OEmbedProvider
(
"youtube"
,
"youtube.com"
)
];
function
OEmbedProvider
(
name
,
urlPattern
,
oEmbedUrl
,
callbackparameter
)
{
this
.
name
=
name
;
this
.
urlPattern
=
urlPattern
;
this
.
oEmbedUrl
=
(
oEmbedUrl
!=
null
)
?
oEmbedUrl
:
"http://oohembed.com/oohembed/"
;
this
.
callbackparameter
=
(
callbackparameter
!=
null
)
?
callbackparameter
:
"callback"
;
this
.
maxWidth
=
500
;
this
.
maxHeight
=
400
;
this
.
matches
=
function
(
externalUrl
)
{
// TODO: Convert to Regex
return
externalUrl
.
indexOf
(
this
.
urlPattern
)
>=
0
;
};
this
.
getRequestUrl
=
function
(
externalUrl
)
{
var
url
=
this
.
oEmbedUrl
;
if
(
url
.
indexOf
(
"?"
)
<=
0
)
url
=
url
+
"?"
;
url
+=
"maxwidth="
+
this
.
maxWidth
+
"&maxHeight="
+
this
.
maxHeight
+
"&format=json"
+
"&url="
+
escape
(
externalUrl
)
+
"&"
+
this
.
callbackparameter
+
"=?"
;
return
url
;
}
this
.
embedCode
=
function
(
externalUrl
,
embedCallback
)
{
var
request
=
this
.
getRequestUrl
(
externalUrl
);
$
.
getJSON
(
request
,
function
(
data
)
{
var
code
,
type
=
data
.
type
;
switch
(
type
)
{
case
"photo"
:
code
=
$
.
fn
.
oembed
.
getPhotoCode
(
externalUrl
,
data
);
break
;
case
"video"
:
code
=
$
.
fn
.
oembed
.
getVideoCode
(
externalUrl
,
data
);
break
;
case
"rich"
:
code
=
$
.
fn
.
oembed
.
getRichCode
(
externalUrl
,
data
);
break
;
default
:
code
=
$
.
fn
.
oembed
.
getGenericCode
(
externalUrl
,
data
);
break
;
}
embedCallback
(
code
);
});
}
}
})(
jQuery
);
src/transition/UniboardSankoreTransition.cpp
View file @
d8b0d44b
...
...
@@ -105,16 +105,35 @@ bool UniboardSankoreTransition::checkPage(QString& sankorePagePath)
;
sankoreDirectory
=
QUrl
::
fromLocalFile
(
sankoreDirectory
).
toString
();
QString
documentString
(
documentByteArray
);
qDebug
()
<<
documentString
;
documentString
.
replace
(
"xlink:href=
\"
videos/"
,
"xlink:href=
\"
"
+
sankoreDirectory
+
"/videos/"
);
documentString
.
replace
(
"xlink:href=
\"
widgets/"
,
"xlink:href=
\"
"
+
sankoreDirectory
+
"/widget
s/"
);
documentString
.
replace
(
"xlink:href=
\"
videos/"
,
"xlink:href=
\"
"
+
sankoreDirectory
+
"/video
s/"
);
documentString
.
replace
(
"xlink:href=
\"
objects/"
,
"xlink:href=
\"
"
+
sankoreDirectory
+
"/objects/"
);
documentString
.
replace
(
"xlink:href=
\"
audios/"
,
"xlink:href=
\"
"
+
sankoreDirectory
+
"/audios/"
);
qDebug
()
<<
documentString
;
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
return
false
;
file
.
write
(
documentString
.
toAscii
());
file
.
close
();
return
true
;
}
bool
UniboardSankoreTransition
::
checkWidget
(
QString
&
sankoreWidgetIndexPath
)
{
QFile
file
(
sankoreWidgetIndexPath
);
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
return
false
;
QByteArray
documentByteArray
=
file
.
readAll
();
file
.
close
();
QString
documentString
(
documentByteArray
);
documentString
.
replace
(
"/Uniboard/interactive content"
,
"/Sankore/interactive content"
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
return
false
;
...
...
@@ -125,6 +144,28 @@ bool UniboardSankoreTransition::checkPage(QString& sankorePagePath)
return
true
;
}
bool
UniboardSankoreTransition
::
updateIndexWidget
(
QString
&
sankoreWidgetPath
)
{
bool
result
=
true
;
QFileInfoList
fileInfoList
=
UBFileSystemUtils
::
allElementsInDirectory
(
sankoreWidgetPath
);
QFileInfoList
::
iterator
fileInfo
;
for
(
fileInfo
=
fileInfoList
.
begin
();
fileInfo
!=
fileInfoList
.
end
()
&&
result
;
fileInfo
+=
1
)
{
if
(
fileInfo
->
fileName
().
endsWith
(
"wgt"
)){
QString
path
=
fileInfo
->
absolutePath
()
+
"/"
+
fileInfo
->
fileName
()
+
"/index.html"
;
if
(
QFile
(
path
).
exists
())
result
=
checkWidget
(
path
);
path
=
fileInfo
->
absolutePath
()
+
"/"
+
fileInfo
->
fileName
()
+
"/index.htm"
;
if
(
QFile
(
path
).
exists
())
result
&=
checkWidget
(
path
);
}
}
return
result
;
}
bool
UniboardSankoreTransition
::
updateSankoreHRef
(
QString
&
sankoreDocumentPath
)
{
bool
result
=
true
;
...
...
@@ -135,7 +176,6 @@ bool UniboardSankoreTransition::updateSankoreHRef(QString& sankoreDocumentPath)
for
(
fileInfo
=
fileInfoList
.
begin
();
fileInfo
!=
fileInfoList
.
end
()
&&
result
;
fileInfo
+=
1
)
{
if
(
fileInfo
->
fileName
().
endsWith
(
"svg"
)){
qDebug
()
<<
fileInfo
->
absolutePath
();
QString
path
=
fileInfo
->
absolutePath
()
+
"/"
+
fileInfo
->
fileName
();
result
=
checkPage
(
path
);
}
...
...
@@ -166,6 +206,8 @@ void UniboardSankoreTransition::executeTransition()
QString
sankoreDocumentPath
=
sankoreDocumentDirectory
+
"/"
+
sankoreDocumentName
;
result
=
UBFileSystemUtils
::
copyDir
(
fileInfo
->
filePath
(),
sankoreDocumentPath
);
result
&=
updateSankoreHRef
(
sankoreDocumentPath
);
QString
sankoreWidgetPath
=
sankoreDocumentDirectory
+
"/"
+
sankoreDocumentName
+
"/widgets"
;
result
&=
updateIndexWidget
(
sankoreWidgetPath
);
}
}
...
...
@@ -175,6 +217,10 @@ void UniboardSankoreTransition::executeTransition()
UBFileSystemUtils
::
deleteDir
(
backupDestinationPath
);
}
else
{
QString
sankoreInteractiveAppPath
=
sankoreDocumentDirectory
;
sankoreInteractiveAppPath
=
sankoreInteractiveAppPath
.
replace
(
"document"
,
""
)
+
"interactive content/"
;
UBFileSystemUtils
::
copyDir
(
mOldSankoreDirectory
+
"/interactive content"
,
sankoreInteractiveAppPath
);
UBFileSystemUtils
::
copyDir
(
mUniboardSourceDirectory
+
"/interactive content"
,
sankoreInteractiveAppPath
);
UBFileSystemUtils
::
deleteDir
(
mOldSankoreDirectory
);
UBFileSystemUtils
::
deleteDir
(
mUniboardSourceDirectory
);
}
...
...
src/transition/UniboardSankoreTransition.h
View file @
d8b0d44b
...
...
@@ -41,6 +41,8 @@ public:
void
documentTransition
();
bool
checkPage
(
QString
&
sankorePagePath
);
bool
updateSankoreHRef
(
QString
&
sankoreDocumentPath
);
bool
checkWidget
(
QString
&
sankoreWidgetPath
);
bool
updateIndexWidget
(
QString
&
sankoreWidgetPath
);
void
executeTransition
();
...
...
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