bug fixe ?

This commit is contained in:
Bachir Soussi Chiadmi 2014-04-28 17:09:33 +02:00
parent a08a5287fc
commit 05a41ebf3a

View File

@ -2,10 +2,10 @@
/**
* materio_flag_refresh_blocks($flag)
*
*
*/
function materio_flag_refresh_block($flag){
switch ($flag) {
case 'bookmarks':
$block_name = 'materio_flag_mybookmarks';
@ -18,7 +18,7 @@ function materio_flag_refresh_block($flag){
if(!isset($block_name))
return;
$rep = array();
$block = block_load('materio_flag', $block_name);
@ -27,20 +27,20 @@ function materio_flag_refresh_block($flag){
$block_rendered = drupal_render($build);
$rep['block'] = $block_rendered;
if(isset($block_nav_name))
if(isset($block_nav_name)){
$block = block_load('materio_flag', $block_nav_name);
$block_content = _block_render_blocks(array($block));
$build = _block_get_renderable_array($block_content);
$block_rendered = drupal_render($build);
$rep['block_nav'] = $block_rendered;
}
drupal_json_output($rep);
}
/**
* materio_flag_createlist($type)
*
*
*/
function materio_flag_createlist_form($type){
$debug = false;
@ -55,7 +55,7 @@ function materio_flag_createlist_form($type){
// menu_set_active_item($path);
// $return = menu_execute_active_handler($path, FALSE);
// if (is_int($return)) {
// switch ($return) {
// case MENU_NOT_FOUND :
@ -69,7 +69,7 @@ function materio_flag_createlist_form($type){
// break;
// }
// } elseif (isset($return)) {
// $form_state['build_info']['args'] = array(NULL, 'breve');
// $f = drupal_get_form('flag_lists_form', $form_state);
// dsm($f);
@ -86,11 +86,11 @@ function materio_flag_createlist_form($type){
);
$form['listname'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Create new @name', array('@name'=>variable_get('flag_lists_name', 'list'))),
'#default_value' => '',
// '#size' => 100,
'#maxlength' => 255,
'#default_value' => '',
// '#size' => 100,
'#maxlength' => 255,
'#name' => 'flag-lists-name',
'#description' => t('A short, descriptive title for this Folder list. Limit to 255 characters.'),
);
@ -111,21 +111,21 @@ function materio_flag_createlist_form($type){
'#value' => t('cancel'),
'#name' => 'cancel',
);
// dsm($form, 'form');
$return = drupal_render($form);
$return = drupal_render($form);
$rep = array(
'rendered_form'=>$return,
);
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
drupal_json_output($rep);
drupal_json_output($rep);
}
}
@ -172,7 +172,7 @@ function materio_flag_editlist_form($type, $fid){
'#value' => $fid,
'#name' => 'fid',
);
$form['name'] = array(
'#type' => 'hidden',
'#value' => $name,
@ -180,11 +180,11 @@ function materio_flag_editlist_form($type, $fid){
);
$form['listtitle'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Edit this '.variable_get('flag_lists_name', 'list')),
'#value' => $flag->title,
// '#size' => 100,
'#maxlength' => 255,
'#value' => $flag->title,
// '#size' => 100,
'#maxlength' => 255,
'#name' => 'flag-lists-title',
'#description' => t('A short, descriptive title for this Folder list. Limit to 255 characters.'),
);
@ -211,10 +211,10 @@ function materio_flag_editlist_form($type, $fid){
'#value' => t('cancel'),
'#name' => 'cancel',
);
// dsm($form, 'form');
$return = drupal_render($form);
$return = drupal_render($form);
$rep = array(
'rendered_form'=>$return,
@ -225,12 +225,12 @@ function materio_flag_editlist_form($type, $fid){
'message' => t('you do not have rights to edit this '.variable_get('flag_lists_name', 'list')),
);
}
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
drupal_json_output($rep);
drupal_json_output($rep);
}
}
@ -270,7 +270,7 @@ function materio_flag_edit_list($fid, $name, $title){
}
drupal_json_output($rep);
drupal_json_output($rep);
}
function materio_flag_delete_list($fid){
@ -299,15 +299,15 @@ function materio_flag_delete_list($fid){
}
$flag = flag_lists_get_flag($name);
flag_lists_fl_delete($flag);
flag_lists_fl_delete($flag);
$rep = array(
'status' => 'saved',
);
}
drupal_json_output($rep);
drupal_json_output($rep);
}
function materio_flag_nodelinks(){
@ -324,19 +324,19 @@ function materio_flag_nodelinks(){
"status" => 1,
"nids" => $nids,
'links' => $links,
);
);
}else{
$rep['status'] = 0;
}
drupal_json_output($rep);
drupal_json_output($rep);
}
function materio_flag_user_bookmarks(){
global $user;
drupal_set_title(t('My bookmarks'), PASS_THROUGH);
$flaged = flag_get_user_flags('node');
// dsm($flaged, 'flaged');
@ -363,7 +363,7 @@ function materio_flag_user_bookmarks(){
}
}
}
$ret['#items'] = $items;
$ret['#theme'] = 'materio_flag_mylists_list';
$ret['#view_mode'] = $viewmode;
@ -397,12 +397,12 @@ function materio_flag_user_lists($fid){
$count = count($flaged_content);
$max = $offset+$limit > $count ? $count : $offset+$limit;
for ($i=$offset; $i < $max; $i++) {
for ($i=$offset; $i < $max; $i++) {
if($flaged_content[$i]->entity_type == 'node'){
$items[] = node_load($flaged_content[$i]->entity_id);
}
}
}
$ret['#items'] = $items;
$ret['#theme'] = 'materio_flag_mylists_list';
$ret['#view_mode'] = $viewmode;
@ -425,9 +425,9 @@ function materio_flag_ajax_list($fid, $page = 0){
$list_path = $path = 'bookmarks';
}else{
$list_path = 'lists';
$path = $list_path.'/'.$fid;
$path = $list_path.'/'.$fid;
}
// check if request is ajax, if not rediret to search_api_page page with right keys
if (!$debug && (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')) {
@ -462,7 +462,7 @@ function materio_flag_ajax_list($fid, $page = 0){
$return = menu_execute_active_handler($path, FALSE);
dsm($return, '$return');
if (is_int($return)) {
switch ($return) {
case MENU_NOT_FOUND :
@ -480,18 +480,18 @@ function materio_flag_ajax_list($fid, $page = 0){
if (is_array($return)) {
$rendered = drupal_render($return);
}
$rep = array(
'rendered' => $rendered,
'path' => $path,
'title' => drupal_get_title(),
);
if ($debug) {
dsm($rep, 'rep');
return "debug display";
}else{
drupal_json_output($rep);
drupal_json_output($rep);
}
}
}