After End Evaluation

So it was end of the Google Summer of Code 2012. I have been  successfully passed the Final Evaluations. I have learned so much and gain lot of experience. This is the first time I works with foreigners. It is an excellent experience and likes to continue that. I really felt the worm of sharing our time, knowledge, ideas and resources with the Open Source World.

In GSoC, all of us have only words and links for resources. Prove your worth and capability to handle a project for mentors by effectively using both of them. Your effectiveness is proportion to how much you would concentrate in achieving project specification.

Advertisements

Integrating TimeLineJS – GSoC – week #11

TimelineJS library contain with examples. It have good reference with aid of HTML code. Referring it I have try to complete the necessary codes which needs to render the timeline . But it was’t successful.

<!– BEGIN Timeline Embed –>
<div id=”timeline-embed”></div>
<script type=”text/javascript”>
    var timeline_config = {
    width: “900”,
     height: “900”,
     source: ‘example_kitchensink.json’,
}
</script>
<script type=”text/javascript” src=”../compiled/js/timeline-embed.js”></script>
<!– END Timeline Embed –>

In html code, it provide source for get timeline event details as a JSON string. My target was provide the source as JSON encode of php object which returned  the user events. Obviously php object is the $node, which created in week 9.

 

Integrating JavaScript to Drupal 7 – GSoC – week #10

The retriview events from tables was success.s the integrating timelineJS was taken place through out the week. But it wasn’t success.

The simplest method to add JavaScript and CSS to a page is by adding them to the
.info files for a module. When JavaScript and CSS files are specified in a .info file they
are added to all pages and configured to use preprocessing (more on that later). An
example that adds a script and CSS file looks like:
scripts[] = foo.js
stylesheets[screen][] = bar.css

The most common method of adding JavaScript to a page is by using the function
drupal_add_js(). This utility function provides the ability to add files (both
external to Drupal and within the file system), add inline JavaScript, and pass
variables between PHP and JavaScript.

Adding a file is the default behavior of drupal_add_js() and drupal_add_css()Adding a JavaScript file and a CSS file to a page would look like the following:

$path = drupal_get_path(‘module’, ‘hello_world’);
drupal_add_js($path . ‘/hello_world.js’);
drupal_add_css($path . ‘/hello_world.css’);

 

Drupal provides a means of passing variables from PHP to JavaScript using
drupal_add_js(). Many applications want to pass configuration information
to JavaScript that runs on a page. This function is the means in Drupal to pass
that information easily.
Drupal calls the variables passed from PHP to JavaScript settings. A simple example
of a setting that passes the text “Hello World!” from PHP to JavaScript would
look like:
drupal_add_js(array(‘helloWorld’ => “Hello World!”), ‘setting’); 

 

Retriview Event Data – GSoC – week #9

To create event, new content type was declared as ‘Event’ content type. There were used Date , Views , Calendar and OG  modules. With aid of OG module I was capable to create Event nodes  with specific to group visible.
Next part is getting these Event node from database and pass it to TimelineJS as JSON string. For that function implementing taken in this week.

The function is all about mapping user ID with OG group table and and realated nodes. Its take 3 steps.
1. Get user groups IDs by User ID mapping.

global $user;
$sql1 = ‘SELECT gid FROM {og_membership} ogm WHERE ogm.etid = :log’;
$group_result = db_query($sql1,
array(
‘:log’ => $user->uid,
)
);
2. Get Node IDs by each of groups IDs.

foreach ($group_result as $groupID){
$sql2 = ‘SELECT etid FROM {og_membership} ogm WHERE ogm.gid = :group AND entity_type = :type’;
$events_group = db_query($sql2,
array(
‘:type’ => ‘node’,
‘:group’ => $groupID->gid,
)
);

3. Load the all node IDs data in to render array .

foreach ($events_group as $row) {
$node = node_load($row->etid);
$renderable_array[‘node_list’][]= node_view($node, ‘example_node_list’);
}
}

Review the Works Already Done– GSoC – week #8

With mid evaluation, weak points and things need to be change have been identified. So  far implementing events in calendar. For more customization, the events should be show in  timeline. The “TimelineJS” is decided be integrate into Drupal 7.

 

 

obviously  TimelineJS is a JavaScript library . Its import event detail as JSON string or a Google spread sheet.