forked from extern/egroupware
WIP EGroupware tutorial:
- Implement tutorials navigator in tutorial popup
This commit is contained in:
parent
b926795898
commit
8fa12bc9d5
@ -34,13 +34,38 @@ class home_tutorial_ui {
|
||||
|
||||
// Get tutorial object id
|
||||
$tuid_indx = explode('-',$_GET['tuid']);
|
||||
|
||||
// read tutorials json file to fetch data
|
||||
$tutorials = json_decode(self::getJsonData(), true);
|
||||
|
||||
$content = $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]];
|
||||
if (!is_array($content))
|
||||
{
|
||||
// read tutorials json file to fetch data
|
||||
$tutorials = json_decode(self::getJsonData(), true);
|
||||
$apps = array();
|
||||
foreach ($tutorials as $app => $val)
|
||||
{
|
||||
$apps [$app] = $app;
|
||||
}
|
||||
$sel_options = array(
|
||||
'apps' => $apps,
|
||||
);
|
||||
$content = array (
|
||||
'src' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['src'],
|
||||
'title' => $tutorials[$tuid_indx[0]][$tuid_indx[1]][$tuid_indx[2]]['title'],
|
||||
);
|
||||
}
|
||||
|
||||
$tmpl->exec('home.home_tutorial_ui.popup', $content,array(),array(),array(),array(),2);
|
||||
$tmpl->exec('home.home_tutorial_ui.popup', $content,$sel_options,array(),array(),array(),2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax function to retrive selected app's tutorials based on prefered user lang
|
||||
*
|
||||
* @param type $_app application name
|
||||
*/
|
||||
function ajax_getAppsTutorials($_app)
|
||||
{
|
||||
$tutorials = json_decode(self::getJsonData(), true);
|
||||
$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
|
||||
$response = egw_json_response::get();
|
||||
$response->data($tutorials[$_app][$lang]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -746,6 +746,46 @@ app.classes.home = AppJS.extend(
|
||||
nm.div.toggleClass('header_hidden');
|
||||
nm.set_hide_header(nm.div.hasClass('header_hidden'));
|
||||
nm.resize();
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to set apps and tutorials selectboxes values
|
||||
*
|
||||
* @param {type} egw
|
||||
* @param {type} widget apps selectbox widget
|
||||
*/
|
||||
tutorial_appChange: function (egw, widget) {
|
||||
var tutorials = etemplate2.getByApplication('home')[0].widgetContainer.getWidgetById('tutorials');
|
||||
var sel_options = {};
|
||||
if (widget)
|
||||
{
|
||||
this.egw.json('home.home_tutorial_ui.ajax_getAppsTutorials', [widget.get_value()], function(_data){
|
||||
if(_data && tutorials)
|
||||
{
|
||||
for (var i=0;i<_data.length;i++)
|
||||
{
|
||||
sel_options[i] = {label:_data[i].title, value:_data[i].src};
|
||||
}
|
||||
tutorials.set_select_options(sel_options);
|
||||
}
|
||||
}).sendRequest();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to set video iframe base on selected tutorial from
|
||||
* tutorials selectbox
|
||||
*
|
||||
* @param {type} egw
|
||||
* @param {type} widget tutorials selectbox
|
||||
*/
|
||||
tutorial_tutorialsChange: function (egw, widget)
|
||||
{
|
||||
var frame = etemplate2.getByApplication('home')[0].widgetContainer.getWidgetById('src');
|
||||
if (frame)
|
||||
{
|
||||
frame.set_value(widget.get_value());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -7,7 +7,15 @@
|
||||
<iframe id="src" height="100%" width="100%" seamless="true" fullscreen="true"/>
|
||||
</hbox>
|
||||
<hbox class="dialogFooterToolbar">
|
||||
<button align="left" statustext="Close this window" label="Close" id="button[close]" onclick="window.close()" image="close" background_image="1"/>
|
||||
<button align="left" statustext="Close this window" label="Close" id="button[close]" onclick="window.close()" image="close" background_image="1"/>
|
||||
<hbox>
|
||||
<menulist>
|
||||
<menupopup id="apps" label="Applications" statustext="Please select application name" options="Please select" onchange="app.home.tutorial_appChange"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup id="tutorials" label="Tutorilas" statustext="Please select a tutorial" options="Please select" onchange="app.home.tutorial_tutorialsChange"/>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</template>
|
||||
</overlay>
|
||||
|
Loading…
Reference in New Issue
Block a user