New folders block nav

++
search field : select on focus

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2012-11-16 20:02:37 +01:00
parent 7dafe10be1
commit d2285db42a
11 changed files with 231 additions and 111 deletions

View File

@@ -150,7 +150,7 @@ function materio_flag_block_view($delta = '') {
$node = node_load($entity->entity_id);
// dsm($node, 'node');
$node->flag_names[] = $name;
// $node->flag_names[] = $name;
$fcn[] = $node;
}
}
@@ -162,7 +162,7 @@ function materio_flag_block_view($delta = '') {
}
if(isset($lists)){
$block['subject'] = t('My !listname'.'s', array('!listname'=>variable_get('flag_lists_name', 'list')));
$block['subject'] = t('My !listname'.'s', array('!listname'=>t(variable_get('flag_lists_name', 'list'))));
$block['content'] = theme('materio_flag_mylists_block', array("lists"=>$lists, "viewmode"=>"bookmark"));
// $block['content'] = theme('flag_lists_user_page', array('uid' => $user->uid));
}else{
@@ -176,10 +176,12 @@ function materio_flag_block_view($delta = '') {
case 'materio_flag_mylists_nav':
if(user_access('create flag lists')){
$flags = flag_lists_get_user_flags(NULL, $user);
// foreach ($flags as $name => $flag) {
// # code...
// }
foreach ($flags as $name => $flag) {
$flaged_content = flag_lists_get_flagged_content($flag->fid, $user->uid);
$flag->flaged_content = $flaged_content;
$flags[$name] = $flag;
}
$block['subject'] = t('My !listname'.'s', array('!listname'=>variable_get('flag_lists_name', 'list')));
$block['content'] = theme('materio_flag_mylists_nav_block', array("flags"=>$flags));
@@ -208,13 +210,25 @@ function materio_flag_entity_info_alter(&$entity_info) {
function materio_flag_entity_view($entity, $type, $view_mode, $langcode) {
if($type == 'node'){
if(user_access('create flag lists')){
$flaglists_links = materio_flag_get_entity_links($entity, $type, $view_mode);
// dsm($flaglists_links, 'flaglists_links');
$entity->content['links']['flaglistslinks'] = array('#markup' => $flaglists_links,"#html"=>true);
$entity->content['flaglistslinks'] = materio_flag_get_entity_links($entity, $type, $view_mode);
drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
// Do we have a list template for this node type, or are we s
if (flag_lists_template_exists($entity->type)) {
global $user;
if ($flags = flag_lists_get_user_flags($entity->type, $user)) {
foreach ($flags as $flag) {
// dsm($flag, 'flag');
if ( ($flag->module == 'flag_lists' && _flag_lists_is_flagged($flag, $entity->nid, $user->uid, 0)) || $flag->is_flagged($entity->nid) ) {
$entity->flags[] = $flag;
}
}
}
}
}
}
}
@@ -228,7 +242,7 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
}
global $user;
$links = array();
# if flag name is provided we are on flaglists content list (block mylists)
if($view_mode == 'bookmark'){
// TODO: define view mode in settings
@@ -287,15 +301,17 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
'data' => $link,
'class' => array('flag-lists-link', $action.'-action'),
);
}
}
// dsm($items, 'items '.$entity->title);
#create new list
$link = l(
'<span>' . t('New @name', array('@name' => variable_get('flag_lists_name', t('list')))) . '</span>&nbsp;<i class="icon-plus"></i>',
'flag-lists/add/' . $entity->type,
array(
// 'query' => drupal_get_destination(),
'attributes' => array(
'class' => array('flag-lists-create'),
'title' => t('create a new @name and use it.', array('@name'=>variable_get('flag_lists_name', t('list')))),
@@ -312,27 +328,22 @@ function materio_flag_get_entity_links($entity, $type, $view_mode = null){
);
}
// if( (!isset($items) || !count($items)) && !isset($create))
// return;
if(isset($items)){
$ops = array(
'node' => $entity,
'items' => $items,
'#node' => $entity,
'#items' => $items,
);
}
if(isset($create)){
$ops['create'] = $create;
// drupal_add_css(drupal_get_path('module', 'flag') . '/theme/flag.css');
// drupal_add_js(drupal_get_path('module', 'flag') . '/theme/flag.js');
$ops['#create'] = $create;
}
if(isset($ops)){
// dsm($ops, 'ops');
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
return theme('materio_flag_mylists_entity_links', $ops);
$ops['#theme'] = "materio_flag_mylists_entity_links";
return $ops;
}
return;