Skip to content
Snippets Groups Projects
Commit c9ded45d authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#3621] Improve HTML template

parent c0860519
No related branches found
No related tags found
No related merge requests found
...@@ -519,6 +519,9 @@ call_im (void* foo UNUSED) ...@@ -519,6 +519,9 @@ call_im (void* foo UNUSED)
im_window_add (im); im_window_add (im);
im->call = selectedCall; im->call = selectedCall;
selectedCall->_im_widget = im; selectedCall->_im_widget = im;
/* Update the informations about the call in the chat window */
im_widget_add_call_header (selectedCall);
} }
} }
} }
......
...@@ -43,8 +43,20 @@ im_widget_add_message (callable_obj_t *call, const gchar *message) ...@@ -43,8 +43,20 @@ im_widget_add_message (callable_obj_t *call, const gchar *message)
if (im) { if (im) {
/* Create the main instant messaging window */ /* Prepare and execute the Javascript code */
// im_window_add (im); gchar *script = g_strdup_printf("add_message('%s', '%s', '%s', '%s');", message, call->_peer_name, call->_peer_number, call->_peer_info);
webkit_web_view_execute_script (WEBKIT_WEB_VIEW(_this->web_view), script);
/* Cleanup */
g_free(script);
}
else {
im = im_widget_new ();
im_window_add (im);
im->call = call;
call->_im_widget = im;
/* Prepare and execute the Javascript code */ /* Prepare and execute the Javascript code */
gchar *script = g_strdup_printf("add_message('%s', '%s', '%s', '%s');", message, call->_peer_name, call->_peer_number, call->_peer_info); gchar *script = g_strdup_printf("add_message('%s', '%s', '%s', '%s');", message, call->_peer_name, call->_peer_number, call->_peer_info);
...@@ -52,9 +64,20 @@ im_widget_add_message (callable_obj_t *call, const gchar *message) ...@@ -52,9 +64,20 @@ im_widget_add_message (callable_obj_t *call, const gchar *message)
/* Cleanup */ /* Cleanup */
g_free(script); g_free(script);
} }
} }
void
im_widget_add_call_header (callable_obj_t *call) {
gchar *script = g_strdup_printf("add_call_info_header('%s', '%s', '%s');", call->_peer_name, call->_peer_number, call->_peer_info);
webkit_web_view_execute_script (WEBKIT_WEB_VIEW(_this->web_view), script);
/* Cleanup */
g_free(script);
}
static gboolean static gboolean
web_view_nav_requested_cb( web_view_nav_requested_cb(
WebKitWebView *web_view, WebKitWebView *web_view,
...@@ -150,6 +173,8 @@ im_widget_init (IMWidget *im) ...@@ -150,6 +173,8 @@ im_widget_init (IMWidget *im)
im->js_global = JSContextGetGlobalObject(im->js_context); im->js_global = JSContextGetGlobalObject(im->js_context);
webkit_web_view_load_uri (WEBKIT_WEB_VIEW(im->web_view), "file://" DATA_DIR "/webkit/im/im.html"); webkit_web_view_load_uri (WEBKIT_WEB_VIEW(im->web_view), "file://" DATA_DIR "/webkit/im/im.html");
_this = im; _this = im;
} }
......
...@@ -19,7 +19,7 @@ font-family: "Georgia","Verdana","Arial","Helvetica",sans-serif; ...@@ -19,7 +19,7 @@ font-family: "Georgia","Verdana","Arial","Helvetica",sans-serif;
} }
body { body {
background: #fbfdfe url(sflphone.png) no-repeat top right; background: #fbfdfe url(sflphone.png) no-repeat fixed bottom right;
} }
.peername { .peername {
......
<html> <html>
<head> <head>
<script src="im.js"></script> <script src="im.js"></script>
<script src="jquery-1.4.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="im.css" /> <link rel="stylesheet" type="text/css" href="im.css" />
</head> </head>
<body> <body>
<div class='page'> <div class='page'>
<div id="call-info"></div>
<div id="messages"></div> <div id="messages"></div>
</div> </div>
</body> </body>
......
...@@ -17,7 +17,18 @@ function linkify(text){ ...@@ -17,7 +17,18 @@ function linkify(text){
function add_message (message, peer_name, peer_number, peer_info) function add_message (message, peer_name, peer_number, peer_info)
{ {
var display_name = 'Unknown';
if (peer_name != '') {
display_name = peer_name;
}
var msgBody = document.getElementById ('messages'); var msgBody = document.getElementById ('messages');
msgBody.innerHTML = msgBody.innerHTML + '<div class="message"><div class="peername">' + peer_name + '</div><div class="peernumber">' + peer_number + '</div>' + linkify (message) + '</div>' ; msgBody.innerHTML = msgBody.innerHTML + '<div class="message">' + '<span class="peername">' + display_name + ': </span>' + '<span class="text">' + linkify (message) + '</span></div>' ;
} }
function add_call_info_header (peer_name, peer_number, peer_info)
{
var infoBody = document.getElementById ('call-info');
infoBody.innerHTML = '<h2>Calling ' + peer_number + '</h2><p>' + peer_info + '</p></h4>';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment