Bienvenue sur Geeklog France, anonyme 27 août 2016 - 05:00


 24 novembre 2010 - 11:40 (Lu 22878 fois)  

Status : hors ligne

Ben

Administrateur

Admin
Enregistré: 18/10/2006
Réponses: 136
Localisation:la rochelle, France
Hi, jQuery plugin is very nice! Thanks. But the plugin links flicker image.
Direct message sent by GeeklogとOSS開発 今駒哲子 (@ivyjp) to you (@Geeklog_Ben) on Nov 24, 12:50 AM.


Yes it's a bug but this do not affect the plugin usage. I will replace the public folder in the next version. Thanks to Ivy for pointing.

 03 décembre 2010 - 16:52  

Status : hors ligne

Ivy

Utilisateur

Junior
Enregistré: 10/02/2009
Réponses: 16
Localisation:Shibuya-ku Tokyo, Japan
I see, Thanks.

http://geeklog.fr/wiki/plugins:jquery

How can I use datepicker?
Insert?
id="datepicker"
Geeklog Japanese

 03 décembre 2010 - 18:23  

Status : hors ligne

Ben

Administrateur

Admin
Enregistré: 18/10/2006
Réponses: 136
Localisation:la rochelle, France
Ivy,

I taked the following exemple in the [wiki:plugins:maps Maps plugins] with a start date input and an end date input.

Add the script before your form:

PHP Formatted Code
<script type="text/javascript">
jQuery(function() {
        jQuery('#from').DatePicker({
                format:'m/d/Y',
                date: jQuery('#from').val(),
                current: jQuery('#from').val(),
                starts: 1,
                position: 'top',
                onBeforeShow: function(){
                        jQuery('#from').DatePickerSetDate(jQuery('#from').val(), true);
                },
                onChange: function(formated){
                        jQuery('#from').val(formated);
                        jQuery('#from').DatePickerHide();
                }
        });
        jQuery('#to').DatePicker({
                format:'m/d/Y',
                date: jQuery('#to').val(),
                current: jQuery('#to').val(),
                starts: 1,
                position: 'top',
                onBeforeShow: function(){
                        jQuery('#to').DatePickerSetDate(jQuery('#to').val(), true);
                },
                onChange: function(formated){
                        jQuery('#to').val(formated);
                        jQuery('#to').DatePickerHide();
                }
        });
});
</script>

and in the form:

PHP Formatted Code

<input type="text" class="inputDate" id="from" name="from">
<input type="text" class="inputDate" id="to" name="to">
 

 04 décembre 2010 - 18:39  

Status : hors ligne

Ivy

Utilisateur

Junior
Enregistré: 10/02/2009
Réponses: 16
Localisation:Shibuya-ku Tokyo, Japan
Thanks!


Geeklog Japanese

 30 décembre 2010 - 17:18  

Status : hors ligne

Ivy

Utilisateur

Junior
Enregistré: 10/02/2009
Réponses: 16
Localisation:Shibuya-ku Tokyo, Japan
I found.
functions.inc line:101

from
PHP Formatted Code
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/js/jquery.lightbox-0.5.1.js"' . XHTML . '></script>' . LB;
 


to:
PHP Formatted Code
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/js/jquery.lightbox-0.5.1.js"'  . '></script>' . LB;
 


Geeklog Japanese

 30 décembre 2010 - 18:15  

Status : hors ligne

Ben

Administrateur

Admin
Enregistré: 18/10/2006
Réponses: 136
Localisation:la rochelle, France
Oops! big mistakes. Sorry for this and thanks for the feedback.

Here is the new functions.inc code

PHP Formatted Code

<?php

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | jQuery Plugin 1.2.2                                                       |
// +---------------------------------------------------------------------------+
// | functions.inc                                                             |
// |                                                                           |
// | This file does two things: 1) it implements the necessary Geeklog Plugin  |
// | API methods and 2) implements all the common code needed by this plugin.  |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2010 by the following authors:                              |
// |                                                                           |
// | Authors: ::Ben - cordiste AT free DOT fr                                  |
// +---------------------------------------------------------------------------+
// | Created with the Geeklog Plugin Toolkit.                                  |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+

/**
* @package jQuery
*/


if (strpos(strtolower($_SERVER['PHP_SELF']), 'functions.inc') !== false) {
    die ('This file can not be used on its own.');
}

/**
 * Language file include
 */

$plugin_path = $_CONF['path'] . 'plugins/jquery/';
$langfile = $plugin_path . 'language/' . $_CONF['language'] . '.php';

if (file_exists($langfile)) {
    require_once $langfile;
} else {
    require_once $plugin_path . 'language/english.php';
}

/**
 * Load our config
 */

require_once $_CONF['path_system'].'classes/config.class.php';
$c = config::get_instance();
$_JQ_CONF = $c->get_config('jquery');

// +---------------------------------------------------------------------------+
// | Geeklog Plugin API Implementation                                         |
// +---------------------------------------------------------------------------+

if (!COM_isAnonUser()) {
    $_SESSION['UseCKFinder'] = true;
}

function plugin_getheadercode_jquery()
{
    global $_CONF, $_JQ_CONF, $LANG_JQUERY_FEEDBACK;

    $str = null;
        $str .= LB . LB . '<!-- Begin jquery plugin http://geeklog.fr Javascript include -->' . LB;
        if(!defined('JQUERY')){
            if ($_JQ_CONF['use_CND'] == true ) {
            $str .= '<script type="text/javascript" src="' . $_JQ_CONF['CND_url'] .'"></script>' . LB;
        } else {
                    $str .= '<script type="text/javascript" src="' . $_CONF['site_url'] . '/jquery/js/jquery-1.4.4.min.js"></script>' . LB;
                }
                $str .= '<script type="text/javascript">
    if(jQueryNoConflict == undefined){
    jQuery.noConflict();
    var jQueryNoConflict = true;
    }
</script>'
. LB;

        define('JQUERY', 'true');
    } else {
            $str .= '<!-- jquery was loaded by another plugin :) -->' . LB;
        }
    //Define the blogurl
    $str .= '<script type="text/javascript">' . LB;
    $str .= '    var theblogurl ="'. $_CONF['site_url'] .'";' . LB;
    $str .= '</script>' . LB;
        // Lightbox
        if($_JQ_CONF['use_lightbox'] == true){
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/js/jquery.lightbox-0.5.1.js"></script>' . LB;
                $str .= '<link rel="stylesheet" type="text/css" href="'
        . $_CONF['site_url'] . '/jquery/css/jquery.lightbox-0.5.css"' . XHTML . '>' . LB;
                $str .= '<script type="text/javascript">' . LB;
        $str .= '    jQuery(document).ready(function() {' . LB;
                $str .= '    jQuery(\'a.lightbox\').lightBox()' . LB;
                $str .= '    });' . LB;
                $str .= '</script>' . LB;
        }
        // Date picker
        if($_JQ_CONF['use_datepicker'] == true){
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/datepicker/datepicker.js"></script>' . LB;
                $str .= '<link rel="stylesheet" type="text/css" href="'
        . $_CONF['site_url'] . '/jquery/datepicker/datepicker.css"' . XHTML . '>' . LB;
        }

        // color picker
        if($_JQ_CONF['use_colorpicker'] == true){
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/colorpicker/ColorPicker.js"></script>' . LB;
                $str .= '<link rel="stylesheet" type="text/css" href="'
        . $_CONF['site_url'] . '/jquery/colorpicker/ColorPicker.css"' . XHTML . '>' . LB;
        }

    // Feedback
    if($_JQ_CONF['use_feedback'] == true){
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/feedback/jquery.validate.pack.js"></script>' . LB;
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/feedback/jquery.contactable.php"></script>' . LB;
                $str .= '<link rel="stylesheet" type="text/css" href="'
        . $_CONF['site_url'] . '/jquery/feedback/contactable.css"' . XHTML . '>' . LB;
        $str .= '<script type="text/javascript">' . LB;
        $str .= '   jQuery(function(){' . LB;
                $str .= '       jQuery(\'#contact\').contactable({' . LB;
                $str .= '           subject: \'' . $LANG_JQUERY_FEEDBACK['feedback'] . '\'' . LB;
                $str .= '       });' . LB;
        $str .= '   });' . LB;
        $str .= '</script>' . LB;
        }

    // Code highlighter
    if($_JQ_CONF['use_codehighlighter'] == true){
        $str .= '<script type="text/javascript" src="'
        . $_CONF['site_url'] . '/jquery/codehighlighter/jquery.beautyOfCode.js"></script>' . LB;
        $str .= '<script type="text/javascript">' . LB;
        $str .= '   jQuery.beautyOfCode.init({' . LB;
                $str .= '       brushes: [\'Xml\', \'JScript\', \'CSharp\', \'Plain\', \'Php\'],' . LB;
                $str .= '           ready: function() {' . LB;
                $str .= '           jQuery.beautyOfCode.beautifyAll();' . LB;
                $str .= '       }' . LB;
        $str .= '   });' . LB;
        $str .= '</script>' . LB;
        }

    //ckeditor
     if($_JQ_CONF['use_ckeditor'] == true && $_CONF['advanced_editor'] == false){
        $str .= '<script type="text/javascript" src="' .  $_CONF['site_url'] . '/jquery/ckeditor/ckeditor.js"></script>' . LB;
        $str .= '<script type="text/javascript" src="' .  $_CONF['site_url'] . '/jquery/ckeditor/adapters/jquery.js"></script>' . LB;
        $str .= '<script type="text/javascript">' . LB;
        $str .= '    jQuery(document).ready(function() {' . LB;
        $str .= ' jQuery(\'textarea[name=introtext]\').ckeditor( {
            filebrowserBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html\',
            filebrowserImageBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Images\',
            filebrowserFlashBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Flash\',
            filebrowserUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
            filebrowserImageUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
            filebrowserFlashUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\'
        });'
. LB;
        $str .= ' jQuery(\'textarea[name=bodytext]\').ckeditor( {
            filebrowserBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html\',
            filebrowserImageBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Images\',
            filebrowserFlashBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Flash\',
            filebrowserUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
            filebrowserImageUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
            filebrowserFlashUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\'
        });'
. LB;
        $str .= ' jQuery(\'textarea[name=sp_content]\').ckeditor( {
            filebrowserBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html\',
            filebrowserImageBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Images\',
            filebrowserFlashBrowseUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/ckfinder.html?type=Flash\',
            filebrowserUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
            filebrowserImageUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
            filebrowserFlashUploadUrl : \''
.  $_CONF['site_url'] . '/jquery/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\'
        });'
. LB;
        $str .= ' jQuery(\'textarea[name=comment]\').ckeditor({ toolbar : \'Basic\'});'. LB;
        $str .= '    });' . LB;
        $str .= '</script>' . LB;
        $str .= '<!-- End jquery plugin includes -->' . LB;
    }
       
    return $str;
}

/**
* Implements a [lightbox:] autotag.
*
* @param    string  $op         operation to perform
* @param    string  $content    item (e.g. story text), including the autotag
* @param    array   $autotag    parameters used in the autotag
* @param    mixed               tag names (for $op='tagname') or formatted content
*
*/


function plugin_autotags_jquery($op, $content = '', $autotag = '')
{
    global $_CONF;
       
        $lightbox = '';

    if ($op == 'tagname') {
        return 'lightbox';
                break;
    } elseif ($op == 'parse') {
        $picture_url = COM_applyFilter($autotag['parm1']);
        if (!empty($picture_url)) {
            if (empty($autotag['parm2'])) {
                $linktext = ''; // or get title from db
            } else {
                $linktext = $autotag['parm2'];
            }

                        $lightbox .= LB . '<a class="lightbox" href="'. $autotag['parm1'] . '" alt="' . $linktext . '"><img class="lightbox" style="background:#EEEEEE; padding:5px; border:1px solid #CCC;" src="' . $_CONF['site_url'] . '/jquery/timthumb.php?src=' . $autotag['parm1'] . '&amp;w=75&amp;h=75&amp;zc=1&amp;q=100" alt="' . $linktext . '" title="' . $linktext . '" /></a>';
                }
            $content = str_replace($autotag['tagstr'], $lightbox, $content);
        }

    return $content;
}


/**
* Return plugin entry for "Command and Control" (moderation.php)
*
* @return  array  Array containing (plugin name, admin url, url of plugin icon)
*
*/

function plugin_cclabel_jquery()
{
    global $_CONF, $LANG_JQUERY_1;

    $retval = array();
    if (SEC_hasRights('jquery.admin')) {
        $retval = array($LANG_JQUERY_1['plugin_name'],
            $_CONF['site_admin_url'] . '/plugins/jquery/index.php',
            plugin_geticon_jquery());
    }

    return $retval;
}

/**
* Return plugin entry for the Admins Only block
*
* @return array Array containing (plugin name, plugin admin url, # of plugin items or '')
*/

function plugin_getadminoption_jquery()
{
    global $_CONF, $LANG_JQUERY_1;

    if (SEC_hasRights('jquery.admin')) {
        return array($LANG_JQUERY_1['plugin_name'],
            $_CONF['site_admin_url'] . '/plugins/jquery/index.php', 0);
    }
}

/**
* Returns the URL of the plugin's icon
*
* @return   string      URL of the icon
*
*/

function plugin_geticon_jquery()
{
    global $_CONF;

    // popular alternative location:
    // return $_CONF['site_url'] . '/jquery/images/jquery.png';

    return $_CONF['site_admin_url'] . '/plugins/jquery/images/jquery.png';
}

/**
 * Returns the current plugin code version
 *
 * @return string    plugin version
 */

function plugin_chkVersion_jquery()
{
    global $_CONF;

    require_once $_CONF['path'] . 'plugins/jquery/autoinstall.php';

    $inst_parms = plugin_autoinstall_jquery('jquery');

    return $inst_parms['info']['pi_version'];
}

/**
* Returns doc uri for Geeklog-1.6.0 or later
*/

function plugin_getdocumentationurl_jquery() {
       
        return 'http://geeklog.fr/wiki/plugins:jquery#Configuration';
}

/**
* Update the plugin
*
* @return   int     Number of message to display or true for success
*
*/

function plugin_upgrade_jquery()
{
    global $_CONF, $_TABLES;

    $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
                                    "pi_name = 'jquery'");
    $code_version = plugin_chkVersion_jquery();
    if ($installed_version == $code_version) {
        // nothing to do
        return true;
    }
        require_once $_CONF['path'] . 'plugins/jquery/install_defaults.php';
        require_once $_CONF['path_system'] . 'classes/config.class.php';
    require_once $_CONF['path'] . 'plugins/jquery/autoinstall.php';

    if (! plugin_compatible_with_this_version_jquery('jquery')) {
        return 3002;
    }

    // other update code goes here
    switch( $installed_version ) {
       
                case '1.0':
            $c = config::get_instance();
            $c->add('use_feedback', $_JQ_DEFAULT['use_feedback'],
                    'select', 0, 1, 3, 60, true, 'jquery');
            $c->set('CND_url', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', 'jquery');

        case '1.1':
            $c = config::get_instance();
            $c->add('use_codehighlighter', $_JQ_DEFAULT['use_codehighlighter'],
                'select', 0, 1, 3, 70, true, 'jquery');

        case '1.1.1':
            $c = config::get_instance();
            $c->add('use_ckeditor', $_JQ_DEFAULT['use_ckeditor'],
                'select', 0, 1, 3, 80, true, 'jquery');

        default :
                        // update plugin version number
            $inst_parms = plugin_autoinstall_jquery('jquery');
            $pi_gl_version = $inst_parms['info']['pi_gl_version'];
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '$code_version', pi_gl_version = '$pi_gl_version' WHERE pi_name = 'jquery'");
                COM_errorLog( "Updated jQuery plugin from v$installed_version to v$code_version", 1 );
    }
    return true;
}

/**
* Automatic uninstall function for plugins
*
* This code is automatically uninstalling the plugin.
* It passes an array to the core code function that removes
* tables, groups, features and php blocks from the tables.
* Additionally, this code can perform special actions that cannot be
* foreseen by the core code (interactions with other plugins for example)
*
* @return   array   Plugin information
*
*/

function plugin_autouninstall_jquery()
{
    $out = array (
        /* give the name of the tables, without $_TABLES[] */
        'tables' => array(/* e.g. 'jquery' */),
        /* give the full name of the group, as in the db */
        'groups' => array('jQuery Admin'),
        /* give the full name of the feature, as in the db */
        'features' => array('jquery.admin'),
        /* give the full name of the block, including 'phpblock_', etc */
        'php_blocks' => array(),
        /* give all vars with their name */
        'vars' => array()
    );

    return $out;
}
?>
 

 10 mars 2011 - 18:09  

Status : hors ligne

Ivy

Utilisateur

Junior
Enregistré: 10/02/2009
Réponses: 16
Localisation:Shibuya-ku Tokyo, Japan
How can I use date picker?

Geeklog Japanese

 11 mars 2011 - 16:00  

Status : hors ligne

Ben

Administrateur

Admin
Enregistré: 18/10/2006
Réponses: 136
Localisation:la rochelle, France
Hi Ivy,

You can see an exemple above.

 16 août 2011 - 12:13  

Status : hors ligne

Fitztyp0

Utilisateur

Newbie
Enregistré: 16/08/2011
Réponses: 1
I interests the same question.
How can I use datepicker?

 16 août 2011 - 15:07  

Status : hors ligne

Ben

Administrateur

Admin
Enregistré: 18/10/2006
Réponses: 136
Localisation:la rochelle, France
This feature is for developpers. You can read more here.

Thanks.

Le fuseau horaire est CEST. Il est maintenant 05:00 .

  • Sujet Normal
  • Sujet important
  • Sujet clos
  • Nouvelle Contribution
  • Nouveau sujet important
  • Nouveau sujet clos
  • Vous pouvez lire ce forum 
  • Les anonymes peuvent dans ce forum 
  • HTML autorisé 
  • Contrôle vocabulaire