Add the sample usage of $_content_tools that defines the element of content tool...
authorcindy li <cli@ocad.ca>
Mon, 6 Dec 2010 20:39:08 +0000 (20:39 -0000)
committercindy li <cli@ocad.ca>
Mon, 6 Dec 2010 20:39:08 +0000 (20:39 -0000)
mods/hello_world/content_tool_action.js [new file with mode: 0644]
mods/hello_world/module.php
mods/hello_world/module.sql
mods/hello_world/module.xml
mods/hello_world/module_news.php

diff --git a/mods/hello_world/content_tool_action.js b/mods/hello_world/content_tool_action.js
new file mode 100644 (file)
index 0000000..67722ee
--- /dev/null
@@ -0,0 +1,36 @@
+/***********************************************************************/\r
+/* ATutor                                                                                                                         */\r
+/***********************************************************************/\r
+/* Copyright (c) 2002-2010                                             */\r
+/* Inclusive Design Institute                                         */\r
+/* http://atutor.ca                                                                                                       */\r
+/*                                                                                                                                        */\r
+/* This program is free software. You can redistribute it and/or          */\r
+/* modify it under the terms of the GNU General Public License            */\r
+/* as published by the Free Software Foundation.                                          */\r
+/***********************************************************************/\r
+// $Id: login.php 10143 2010-08-19 19:26:05Z cindy $\r
+\r
+/* The javascript is used in module.php @ $this->_content_tools["js"] */\r
+\r
+/*global jQuery*/\r
+/*global ATutor */\r
+/*global tinyMCE */\r
+/*global window */\r
+\r
+ATutor = ATutor || {};\r
+ATutor.mods = ATutor.mods || {};\r
+ATutor.mods.hello_world = ATutor.mods.hello_world || {};\r
+\r
+(function () {\r
+    var helloWorldOnClick = function () {\r
+       alert("Clicked on hello world tool icon!");\r
+    }\r
+    \r
+       //set up click handlers and show/hide appropriate tools\r
+    var initialize = function () {\r
+        jQuery("#helloworld_tool").click(helloWorldOnClick);\r
+    };\r
+    \r
+    jQuery(document).ready(initialize);\r
+})();
\ No newline at end of file
index 5e2a999..189205a 100644 (file)
@@ -77,6 +77,15 @@ $this->_pages[AT_NAV_START]  = array('mods/hello_world/index_mystart.php');
 $this->_pages['mods/hello_world/index_mystart.php']['title_var'] = 'hello_world';
 $this->_pages['mods/hello_world/index_mystart.php']['parent'] = AT_NAV_START;
 
+/* The element of content tool bar that is displayed on "Edit Content" => "Content" tab */
+$this->_content_tools[] = array("id"=>"helloworld_tool", 
+                                "class"=>"fl-col clickable", 
+                                "src"=>AT_BASE_HREF."mods/hello_world/hello_world.jpg",
+                                "title"=>_AT('hello_world_tool'),
+                                "alt"=>_AT('hello_world_tool'),
+                                "text"=>_AT('hello_world'), 
+                                "js"=>AT_BASE_HREF."mods/hello_world/content_tool_action.js");
+
 function hello_world_get_group_url($group_id) {
        return 'mods/hello_world/index.php';
 }
index 2625d8a..b55f655 100644 (file)
@@ -8,4 +8,5 @@ CREATE TABLE `hello_world` (
 );\r
 \r
 INSERT INTO `language_text` VALUES ('en', '_module','hello_world','Hello World',NOW(),'');\r
+INSERT INTO `language_text` VALUES ('en', '_module','hello_world_tool','Hello World Content Tool',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','hello_world_text','A sample Hello World text for detailed homepage.',NOW(),'');
\ No newline at end of file
index 51e40ed..6749b30 100644 (file)
@@ -12,7 +12,7 @@
     <license>BSD</license> \r
        <release> \r
         <version>0.6</version> \r
-        <date>2010-10-25</date> \r
+        <date>2010-12-06</date> \r
         <state>stable</state> \r
         <notes></notes> \r
     </release> \r
index 4348bc3..471b3d2 100644 (file)
@@ -5,11 +5,12 @@
 */
 
 function helloworld_news() {
+       global $db;
        $sql = "SELECT something FROM a table WHERE date < NOW() LIMIT 3";
-       if($result = mysql_query($sql, $db){
-           while($row = mysql_fetch_assoc($result)){
-               $news[] = $row['something'];
-            }
+       if ($result = mysql_query($sql, $db)) {
+               while($row = mysql_fetch_assoc($result)){
+                       $news[] = $row['something'];
+               }
        }
        return $news;
 }