示例#1
0
/**
* Generate the menus for the cms:tag- elements
*
* @vars   array ids - the ids of the element taken from the idtype from the
*                     table cms_types
*		  array infos['container_number']
*                    ['cmstag_id']
*                    ['pre_compiled'] - full editstring, used by typegroup and edit_container
*                    ['mod_repeat_id']
*                    ['title']
*                    ['base_url']
*                    ['mode']
*         bool delete
*         bool new
*         bool up
*         bool down
*         bool inline
*/
function _type_get_layer_menu($ids, $infos, $delete, $new, $up, $down, $inline = false)
{
    global $p_menu, $cfg_cms, $cms_lang;
    if (!is_object($p_menu)) {
        include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'inc/class.popupmenubuilder_js.php';
        $p_menu = new popupmenubuilder_js();
        $p_menu->set_image('cms/img/but_edit.gif', 16, 16);
    }
    //generate sublink {typeid}-{mod_repeat_id},{typeid}-{mod_repeat_id}...
    //generate edit-sublink for normal contentelements, like, text, wysiwyg, image...
    if (empty($infos['pre_compiled'])) {
        $subs = array();
        foreach ($ids as $v) {
            array_push($subs, $v . '-' . $infos['cmstag_id']);
        }
        $subs_to_string = implode(',', $subs);
    } else {
        $subs_to_string = $infos['pre_compiled'];
        //container und repeat id, sind bei precompielt schon vorhanden und sind daher
        //sp�ter doppelt, m�ssen daher ersetzt werden
        if ($infos['tag_type'] == 'edit_container') {
            $to_replace = $infos['container_number'] . '.' . $infos['mod_repeat_id'];
            $subs_to_string = substr($subs_to_string, strlen($to_replace) + 1);
        }
    }
    //generate menu
    $p_menu->add_title($infos['title']);
    if ($inline) {
        $p_menu->add_entry($cms_lang['type_save'], $infos['base_url'], '_self', $cms_lang['type_save'], 'con_setcontent(' . $infos['container_number'] . ',' . $infos['mod_repeat_id'] . ',' . $ids['0'] . ',' . $infos['cmstag_id'] . ');return;');
    }
    if ($subs_to_string != '-') {
        $p_menu->add_entry($cms_lang['type_edit'], $infos['base_url'] . '&action=edit&content=' . $infos['container_number'] . '.' . $infos['mod_repeat_id'] . '.' . $subs_to_string, '_self', $cms_lang['type_edit']);
    }
    if ($infos['mode'] == 'advanced') {
        if (($new || $delete || $up || $down) && ($subs_to_string != '-' || $inline)) {
            $p_menu->add_seperator();
        }
        if ($new) {
            $p_menu->add_entry($cms_lang['type_new'], $infos['base_url'] . '&action=new&entry=' . $infos['mod_repeat_id'] . '&content=' . $infos['container_number'] . '.new.' . $subs_to_string, '_self', $cms_lang['type_new']);
        }
        if ($delete) {
            $p_menu->add_entry($cms_lang['type_delete'], $infos['base_url'] . '&action=delete&content=' . $infos['container_number'] . '.' . $infos['mod_repeat_id'], '_self', $cms_lang['type_delete'], 'if(delete_confirm())');
        }
        if ($up) {
            $p_menu->add_entry($cms_lang['type_up'], $infos['base_url'] . '&action=move_up&content=' . $infos['container_number'] . '.' . $infos['mod_repeat_id'], '_self', $cms_lang['type_up']);
        }
        if ($down) {
            $p_menu->add_entry($cms_lang['type_down'], $infos['base_url'] . '&action=move_down&content=' . $infos['container_number'] . '.' . $infos['mod_repeat_id'], '_self', $cms_lang['type_down']);
        }
    }
    return $p_menu->get_menu_and_flush();
}
 function flex2_popup_menu()
 {
     global $modtemp, $cms_mod, $con_side, $cfg_cms, $idcatside, $perm;
     if (!is_object($pop_menu)) {
         include_once $cfg_cms['cms_path'] . 'inc/class.popupmenubuilder_js.php';
         $pop_menu = new popupmenubuilder_js();
         $pop_menu->set_image($cfg_cms['cms_html_path'] . 'tpl/' . $cfg_cms['skin'] . '/img/but_addelement.gif', 16, 16);
     }
     //generate menu
     $pop_menu->add_title('{entry_txt}');
     $modtemp['el_nr'] = $cms_mod['value']['100'];
     for ($modtemp['i'] = 1; $modtemp['i'] <= $modtemp['el_nr']; $modtemp['i']++) {
         $modtemp['el_title'] = $cms_mod['value'][round($modtemp['i'] * 10 + 100)];
         $modtemp['el_tpl'] = $cms_mod['value'][round($modtemp['i'] * 10 + 101)];
         $modtemp['el_unique_id'] = $cms_mod['value'][round($modtemp['i'] * 10 + 102)];
         $modtemp['el_activ'] = $cms_mod['value'][round($modtemp['i'] * 10 + 103)];
         if ($modtemp['el_activ'] == 'active' && _type_check_editable(true, $cms_mod['value'][round($modtemp['i'] * 10 + 104)], 'edit')) {
             // index.php?idcatside=17&view=edit&action=new&entry=3&content=30.new.3-1,1-1
             $pop_menu->add_entry($modtemp['el_title'], $con_side[$idcatside]['link'] . '&newflex2_' . $cms_mod['container']['id'] . '_' . $cms_mod['modul']['id'] . '=insert&entry={entry}&flex2tpl=' . $modtemp['el_unique_id'], '_self', $modtemp['el_title']);
         }
     }
     return $pop_menu->get_menu_and_flush();
 }
 function flex2_popup_menu()
 {
     global $modtemp;
     $modinfo = sf_api('LIB', 'Modinfo');
     $cfg = sf_api('LIB', 'Config');
     $idcatside = $cfg->env('idcatside');
     if (!is_object($pop_menu)) {
         include_once $cfg->env('path_backend') . 'inc/class.popupmenubuilder_js.php';
         $pop_menu = new popupmenubuilder_js();
         $pop_menu->set_image($cfg->env('path_backend_http') . 'tpl/' . $cfg->cms('skin') . '/img/but_addelement.gif', 16, 16);
     }
     //generate menu
     $pop_menu->add_title('{entry_txt}');
     $modtemp['el_nr'] = $modinfo->getVal('100');
     //print_r($modinfo);
     for ($modtemp['i'] = 1; $modtemp['i'] <= $modtemp['el_nr']; $modtemp['i']++) {
         $id = (int) round($modtemp['i'] * 10 + 100);
         $modtemp['el_title'] = $modinfo->getVal($id);
         $modtemp['el_tpl'] = $modinfo->getVal($id + 1);
         $modtemp['el_unique_id'] = $modinfo->getVal($id + 2);
         $modtemp['el_activ'] = $modinfo->getVal($id + 3);
         if ($modtemp['el_activ'] == 'active' && _type_check_editable($modinfo->getVal($id + 4))) {
             // index.php?idcatside=17&view=edit&action=new&entry=3&content=30.new.3-1,1-1
             $pop_menu->add_entry($modtemp['el_title'], 'cms://idcatside=' . $idcatside . '?newflex2_' . $modinfo->getIdContainer() . '_' . $modinfo->getEntryNr() . '=insert&entry={entry}&flex2tpl=' . $modtemp['el_unique_id'], '_self', $modtemp['el_title']);
         }
     }
     return $pop_menu->get_menu_and_flush();
 }
示例#4
0
 protected function _getLayermenuConfig()
 {
     global $cms_db, $db, $sess, $cfg_cms, $cfg_client;
     global $cms_lang, $con_side, $con_tree;
     $cfg = sf_api('LIB', 'Config');
     $view = $cfg->env('view');
     $idcatside = $cfg->env('idcatside');
     $idcat = $cfg->env('idcat');
     $lang = $cfg->env('idlang');
     $perm = $cfg->perm();
     include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . 'inc/class.popupmenubuilder_js.php';
     $p_menu = new popupmenubuilder_js();
     // Bearbeitungsrecht auf dieser Seite?
     if ($perm->have_perm(19, 'side', $idcatside, $con_side[$idcatside]['idcat']) || $perm->have_perm(2, 'cat', $con_side[$idcatside]['idcat'])) {
         $p_menu->set_image('cms/img/but_editside.gif', 16, 16);
         // Seite
         if ($idcatside && $perm->have_perm(18, 'side', $idcatside, $idcat) || $idcatside && $perm->have_perm(19, 'side', $idcatside, $idcat) || ($perm->have_perm('10', 'cat', $idcat) || $perm->have_perm('11', 'cat', $idcat)) || $idcatside && $perm->have_perm('12', 'cat', $idcat)) {
             $p_menu->add_title($cms_lang['type_edit_side']);
         }
         // Seite konfigurieren
         if ($idcatside && $perm->have_perm(20, 'side', $idcatside, $idcat)) {
             $entry = $cms_lang['side_config'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con_configside&view=' . $view . '&idcatside=' . $idcatside . '&idside=' . $con_side[$idcatside]['idside'] . '&idcat=' . $con_side[$idcatside]['idcat'] . '&idtplconf=' . $con_side[$idcatside]['idtplconf']);
             $target = '_self';
             $mouseover_text = $cms_lang['side_config'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Seite anlegen
         if ($perm->have_perm('18', 'cat', $idcat)) {
             $entry = $cms_lang['side_new'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con_configside&view=' . $view . '&idcat=' . $idcat . '&idtplconf=0');
             $target = '_self';
             $mouseover_text = $cms_lang['side_new'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Seite löschen
         if ($idcatside && $perm->have_perm(21, 'side', $idcatside, $idcat)) {
             $entry = $cms_lang['side_delete'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con&view=' . $view . '&action=side_delete&idcat=' . $idcat . '&idside=' . $con_side[$idcatside]['idside']);
             $target = '_self';
             $mouseover_text = $cms_lang['side_delete'];
             $optional_js = 'return delete_confirm();';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Ordner
         if ($perm->have_perm('2', 'cat', $idcat) || ($perm->have_perm('3', 'cat', $idcat) || $perm->have_perm('4', 'cat', $idcat)) || !$idcatside && $perm->have_perm('5', 'cat', $idcat)) {
             $p_menu->add_title($cms_lang['type_edit_folder']);
         }
         // Ordner konfigurieren
         if ($perm->have_perm('2', 'cat', $idcat)) {
             $entry = $cms_lang['side_config'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con_configcat&view=' . $view . '&idcat=' . $idcat . '&idcatside=' . $idcatside . '&idcatlang=' . $con_tree[$idcat]['idcatlang'] . '&idtplconf=' . $con_tree[$idcat]['idtplconf']);
             $target = '_self';
             $mouseover_text = $cms_lang['side_config'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Ordner anlegen
         if ($perm->have_perm('3', 'cat', $idcat) || $perm->have_perm('4', 'cat', $idcat)) {
             $entry = $cms_lang['side_new'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con_configcat&view=' . $view . '&idcatside=' . $idcatside . '&parent=' . $idcat . '&idtplconf=0');
             $target = '_self';
             $mouseover_text = $cms_lang['side_new'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Ordner löschen
         if (!$idcatside && $perm->have_perm('5', 'cat', $idcat)) {
             $entry = $cms_lang['side_delete'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con&view=' . $view . '&action=cat_delete&idcat=' . $idcat);
             $target = '_self';
             $mouseover_text = $cms_lang['side_delete'];
             $optional_js = 'return delete_confirm();';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Modus
         $p_menu->add_title($cms_lang['side_mode']);
         // Seitenübersicht
         if ($perm->have_perm('1', 'area_con')) {
             $entry = $cms_lang['side_overview'];
             $link = $sess->url($cfg_cms['path_base_http'] . $cfg_cms['path_backend_rel'] . 'main.php?area=con');
             $target = '_top';
             $mouseover_text = $cms_lang['side_overview'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
         // Editor / Vorschau
         if ($view == 'preview') {
             $entry = $cms_lang['side_edit'];
             $link = $sess->url($cfg_client['path_http_edit'] . $cfg_client['path_rel'] . $cfg_client['contentfile'] . '?lang=' . $lang . '&idcat=' . $idcat . '&idcatside=' . $idcatside . '&view=edit');
             $target = '_self';
             $mouseover_text = $cms_lang['side_edit'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         } else {
             $entry = $cms_lang['side_preview'];
             $link = $sess->url($cfg_client['path_http_edit'] . $cfg_client['path_rel'] . $cfg_client['contentfile'] . '?lang=' . $lang . '&idcat=' . $idcat . '&idcatside=' . $idcatside . '&view=preview');
             $target = '_self';
             $mouseover_text = $cms_lang['side_preview'];
             $optional_js = '';
             $p_menu->add_entry($entry, $link, $target, $mouseover_text, $optional_js);
         }
     }
     return $p_menu->get_menu_and_flush();
 }