Example #1
0
/**
 * Prints tab that displays form for editing mediafile metadata
 *
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_tab_edit($image, $ns, $auth = null)
{
    if (is_null($auth)) {
        $auth = auth_quickaclcheck("{$ns}:*");
    }
    if ($image) {
        list(, $mime) = mimetype($image);
        if ($mime == 'image/jpeg') {
            media_metaform($image, $auth);
        }
    }
}
Example #2
0
/**
 * prints the "main content" in the mediamanger popup
 *
 * Depending on the user's actions this may be a list of
 * files in a namespace, the meta editing dialog or
 * a message of referencing pages
 *
 * Only allowed in mediamanager.php
 *
 * @triggers MEDIAMANAGER_CONTENT_OUTPUT
 * @param bool $fromajax - set true when calling this function via ajax
 * @author Andreas Gohr <*****@*****.**>
 */
function tpl_mediaContent($fromajax = false)
{
    global $IMG;
    global $AUTH;
    global $INUSE;
    global $NS;
    global $JUMPTO;
    if (is_array($_REQUEST['do'])) {
        $do = array_shift(array_keys($_REQUEST['do']));
    } else {
        $do = $_REQUEST['do'];
    }
    if (in_array($do, array('save', 'cancel'))) {
        $do = '';
    }
    if (!$do) {
        if ($_REQUEST['edit']) {
            $do = 'metaform';
        } elseif (is_array($INUSE)) {
            $do = 'filesinuse';
        } else {
            $do = 'filelist';
        }
    }
    // output the content pane, wrapped in an event.
    if (!$fromajax) {
        ptln('<div id="media__content">');
    }
    $data = array('do' => $do);
    $evt = new Doku_Event('MEDIAMANAGER_CONTENT_OUTPUT', $data);
    if ($evt->advise_before()) {
        $do = $data['do'];
        if ($do == 'metaform') {
            media_metaform($IMG, $AUTH);
        } elseif ($do == 'filesinuse') {
            media_filesinuse($INUSE, $IMG);
        } elseif ($do == 'filelist') {
            media_filelist($NS, $AUTH, $JUMPTO);
        } elseif ($do == 'searchlist') {
            media_searchlist($_REQUEST['q'], $NS, $AUTH);
        } else {
            msg('Unknown action ' . hsc($do), -1);
        }
    }
    $evt->advise_after();
    unset($evt);
    if (!$fromajax) {
        ptln('</div>');
    }
}
/**
 * prints the "main content" in the mediamanger popup
 *
 * Depending on the user's actions this may be a list of
 * files in a namespace, the meta editing dialog or
 * a message of referencing pages
 *
 * Only allowed in mediamanager.php
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function tpl_mediaContent()
{
    global $IMG;
    global $AUTH;
    global $INUSE;
    global $NS;
    global $JUMPTO;
    ptln('<div id="media__content">');
    if ($_REQUEST['edit']) {
        media_metaform($IMG, $AUTH);
    } elseif (is_array($INUSE)) {
        media_filesinuse($INUSE, $IMG);
    } else {
        media_filelist($NS, $AUTH, $JUMPTO);
    }
    ptln('</div>');
}