}
if($current_tab == 0) {
- $_custom_head .= '
+ global $_content_tools;
+
+ $_custom_head .= '
<link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-layout.css" />
<link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-text.css" />
- <script type="text/javascript" src="'.$_base_path.'mods/_core/editor/js/edit.js"></script>
';
+ $_content_tools = is_array($_content_tools) ? $_content_tools : array();
+
+ $current_tool_pos = 0;
+ $_content_tools[] = array("id"=>"previewtool",
+ "class"=>"fl-col clickable",
+ "src"=>AT_BASE_HREF."images/preview.png",
+ "title"=>_AT('preview').' - '._AT('new_window'),
+ "alt"=>_AT('preview').' - '._AT('new_window'),
+ "text"=>_AT('preview'),
+ "js"=>AT_BASE_HREF."mods/_core/editor/js/edit.js",
+ "position"=>++$current_tool_pos);
+
+ $_content_tools[] = array("id"=>"accessibilitytool", "class"=>"fl-col", "text"=>_AT('accessibility'), "position"=>++$current_tool_pos);
+ $_content_tools[] = array("id"=>"headtool", "class"=>"fl-col", "text"=>_AT('customized_head'), "position"=>++$current_tool_pos);
+ $_content_tools[] = array("id"=>"pastetool", "class"=>"fl-col", "text"=>_AT('paste'), "position"=>++$current_tool_pos);
+ $_content_tools[] = array("id"=>"filemantool", "class"=>"fl-col", "text"=>_AT('files'), "position"=>++$current_tool_pos);
+
+ foreach ($_content_tools as $tool) {
+ if (isset($tool["js"])) {
+ $_custom_head .= '<script type="text/javascript" src="'.$tool["js"].'"></script>'."\n";
+ }
+ }
}
if ($cid) {
load_editor($simple, false, "none");
}
-//TODO*************BOLOGNA****************REMOVE ME**************/
+// Generate the last content tool elements
//loading toolbar for insert discussion topic or web link into the content
if ($current_tab == 0){
if(authenticate(AT_PRIV_CONTENT,AT_PRIV_RETURN)){
break;
}
}
- if(!$check)
- $all_tools[]=$main;
- else
+ if(!$check && $main['tool_file'] != '' && $main['table'] != '') {
+ $_content_tools[] = array("class"=>"fl-col clickable tool",
+ "src"=>$main['img'],
+ "alt"=>$main['alt'],
+ "title"=>$main['title'],
+ "text"=>$main['title'],
+ "position"=>++$current_tool_pos);
+
+ if(isset($main['tool_file'])) {
+ echo '<!-- TODO LAW note problem here with one tool_file variable for multiple tools -->'."\n";
+ echo ' <script type="text/javascript" language="javascript">'."\n";
+ echo ' //<!--'."\n";
+ echo ' ATutor.mods.editor.tool_file = "'. $main['tool_file'].'";'."\n";
+ echo ' //-->'."\n";
+ echo ' </script>'."\n";
+ }
+
+ }
+ else {
$check=false;
+ }
}
}
}
+// The customized function to sort multi-dimentional array $_content_tools
+function compare($x, $y) {
+ if (!isset($x["position"])) return 1;
+ if (!isset($y["position"])) return -1;
+ if ( $x["position"] == $y["position"] )
+ return 0;
+ else if ( $x["position"] < $y["position"] )
+ return -1;
+ else
+ return 1;
+}
+
+// Sort $_content_tools. Always append the element with empty "position" to the end of the result array.
+usort($_content_tools, 'compare');
$cid = intval($_REQUEST['cid']);
$pid = intval($_REQUEST['pid']);
<div>
<?php output_tabs($current_tab, $changes_made); ?>
-
</div>
+
<span style="clear:both;"/></span>
<div class="input-form">
\r
<div class="fl-container fl-fix">\r
<ul id="content-tool-links">\r
- <li><img id="previewtool" class="fl-col clickable" src="<?php echo AT_BASE_HREF.'images/preview.png'?>" title="<?php echo _AT('preview').' - '._AT('new_window'); ?>" alt="<?php echo _AT('preview').' - '._AT('new_window'); ?>" height="30" width="30" /><?php echo _AT('preview'); ?></li>\r
- <li><img id="accessibilitytool" class="fl-col" src="" title="" alt="" height="30" width="30" /><?php echo _AT('accessibility'); ?></li>\r
- <li><img id="headtool" class="fl-col" src="" title="" alt="" height="30" width="30" /><?php echo _AT('customized_head'); ?></li>\r
- <li><img id="pastetool" class="fl-col" title="" src="" alt="" height="30" width="30"/><?php echo _AT('paste'); ?></li> \r
- <li><img id="filemantool" class="fl-col" title="" src="" alt="" height="30" width="30" /><?php echo _AT('files'); ?></li>\r
- \r
-<!-- ******** Tool Manager ******* -->\r
-<?php\r
- $count = 0;\r
- foreach($all_tools as $tool) {\r
- if($tool['tool_file'] != '' && $tool['table'] != '') {\r
- $sql_assoc = "SELECT * FROM ".TABLE_PREFIX.$tool['table']." WHERE content_id='$cid'";\r
- $result_assoc = mysql_query($sql_assoc,$db);\r
-\r
- if($num_row = mysql_num_rows($result_assoc)){\r
- $tool['alt'] = $tool['title'].' '._AT('added');\r
- } else {\r
- $tool['alt'] = $tool['title'].' '._AT('none');\r
- }\r
-\r
- $count++; \r
-?>\r
- <!-- TODO LAW note problem here with one tool_file variable for multiple tools -->\r
- <script type="text/javascript" language="javascript">\r
- //<!--\r
- ATutor.mods.editor.tool_file = "<?php if(isset($tool['tool_file'])) echo $tool['tool_file'] ?>";\r
- //-->\r
- </script>\r
- <li><img class="fl-col clickable tool" src="<?php echo $tool['img']; ?>" alt="<?php echo $tool['alt']; ?>" title="<?php echo $tool['title']; ?>" height="30" width="30" /><?php echo $tool['title']?></li>\r
-<?php \r
+ <?php \r
+ foreach ($_content_tools as $tool) {\r
+ echo '<li><img id="'.$tool["id"].'" class="'.$tool["class"].'" title="'.$tool['title'].'" src="'.$tool['src'].'" alt="'.$tool['alt'].'" height="30" width="30" />'.$tool["text"].'</li>'."\n";\r
}\r
- }\r
-?>\r
+ ?>\r
</ul>\r
-\r
-<!-- ****** end Tool Manager ***** -->\r
</div> <!-- end toolbar -->\r
\r
<!-- Customized head -->\r
var $_properties; // array from xml
var $_cron_interval; // cron interval
var $_cron_last_run; // cron last run date stamp
+ var $_content_tools; // content tool icons on "edit content" page
// constructor
function Module($row) {
+ global $_content_tools;
+
if (is_array($row)) {
$this->_directoryName = $row['dir_name'];
$this->_status = $row['status'];
$this->_display_defaults= 0;
$this->_type = AT_MODULE_TYPE_EXTRA; // standard/core are installed by default
}
+ $this->_content_tools = array();
}
// statuses
function load() {
if (is_file(AT_MODULE_PATH . $this->_directoryName.'/module.php')) {
- global $_modules, $_pages, $_stacks, $_list, $_tool; // $_list is for sublinks on "detail view"
+ global $_modules, $_pages, $_stacks, $_list, $_tool, $_content_tools; // $_list is for sublinks on "detail view"
require(AT_MODULE_PATH . $this->_directoryName.'/module.php');
$_list = array_merge((array)$_list, $this->_list);
}
- //TODO***********BOLOGNA***********REMOVE ME***********/
+ if(isset($this->_content_tools)) {
+ $_content_tools = array_merge((array)$_content_tools, $this->_content_tools);
+ }
+
+ //TODO***********BOLOGNA***********REMOVE ME***********/
//tool manager (content editing)
if(isset($this->_tool)) {
$_tool = array_merge((array)$_tool, $this->_tool);