Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher 2.0 Release Candidate 14.2
#31

[eluser]irvin[/eluser]
jTaby - I've found this special char error. It's caused in "inflector_helper.php" file, bu line:
Code:
return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
And more precisley by: "strtolower" wich cuts some unicode characters...

The worst thing is that, we don't have good replacement for this, but for quick fix, i've added one extra function called 'nationalise':

Code:
// --------------------------------------------------------------------

/**
* Nationalize
*
* Takes multiple words separated by underscores and changes them to spaces
* It also have special fix for special national chars (for instance polish)
*
* @access    public
* @param    string
* @return    str
*/    

if (! function_exists('nationalise'))
{    
    function nationalise($str)
    {
        $en_up_pattern = '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]';
        $en_lw_pattern = '[abcdefghijklmnopqrstuvwxyz]';
        $special_up_pattern = '[ĄĆĘŁŃÓŚŹŻ]';
        $special_lw_pattern = '[ąćęłńóśźż]';
        
        return ucwords(preg_replace('/[_]+/', ' ', strtr((trim($str)), $en_up_pattern.$special_up_pattern, $en_lw_pattern.$special_lw_pattern)));
    }
}
It makes an simple replacement with all English characters + additionally replaces Polish special chars. I don't know how efficient it is, but it's simple, dummy and it works.

If you want use it, you should change the lines with link names like:
Code:
if(strcmp(humanize($name),humanize($this->page_header)) == 0) echo ' id="active-page"';
echo '>'.anchor($link,humanize($name))."</li>\n"; ?&gt;

to

Code:
if(strcmp(humanize($name),humanize($this->page_header)) == 0) echo ' id="active-page"';
echo '>'.anchor($link,nationalise($name))."</li>\n"; ?&gt;


It should help a bit.
#32

[eluser]Majd Taby[/eluser]
abmcr, you want $this->CI->codexadmin->rules....codexadmin is a library in the CI object
#33

[eluser]Majd Taby[/eluser]
irvin, if you are having trouble with the inflector, then that is a CI issue which needs to be addressed in the Feature Requests or Bug Reports section, i'll try to fix the issue in codex though
#34

[eluser]SpooF[/eluser]
I like to put all my backend files under the public directory, so that would include the codex app. Doing so however makes it imposable to access the CSS and any other file stored in the template directory. Might look at moving that to the assets folder rather than inside of the application folder.
#35

[eluser]Unknown[/eluser]
jTaby,

This is a great little extension--it's already saved me a bunch of time, in just the past day.

I'd like to extend the package a bit to handle timestamps a little differently. CE automagically takes care of timestamp fields in the database. That's nice, but if I have 2 timestamp fields in a table, the second one never gets touched.

Here's what I want to do: track a create time stamp and an update time stamp. I don't want the user to see either of the fields, but I need access to them. The create time stamp (and update time stamp) will get set when CE adds a new record to the database. Only the update time stamp will get modified when CE edits the record.

Can you point me to the code where I should be starting? I can't find any references to timestamp fields in the code (with a few quick grep's). Perhaps you're just letting the SQL server deal with them?

Thanks!
#36

[eluser]abmcr[/eluser]
I have a problem if i want to set a callback as rules....
in my controller i have this code
Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

include("codexcontroller.php");

class Example extends codexController
{
    function Example ()
    {
        // Load the CodexController
        codexController::codexController();

      
        $rules['textbox_test'] = "trim|required|callback_username_check";

        $config = array(
                    'db_table' => 'example', //The name of the table associated with this controller
                    'form_setup' => $this->spyc->YAMLLOAD($this->codexadmin->getDefinitionFileName('example_form')), //The array that holds our elements
                    'controller_name' => 'Example', //The name of the controller, so that it can be used when generating the URLs
                    'primary_key' => 'my_id', //The name of the controller, so that it can be used when generating the URLs
                    'display_fields'=>array('textbox_test','date_test','related_example'),
                    'rules'=>$rules
                    );
        $this->setConfig($config);
    }
    
    function username_check($str)
    {
        if ($str == 'test')
        {
            $this->validation->set_message('username_check', 'The %s field can not be the word "test"');
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
}
?&gt;

And the callback not work... Why?

Another small bug: the Select all link in the display mode not work...

[quote author="jTaby" date="1211413715"]abmcr, you want $this->CI->codexadmin->rules....codexadmin is a library in the CI object[/quote]

ok .... i have made this small feature for get a rule required indicator as in attached image
in the codexforms.php librarie insert this function

Code:
/*
     * The function create a * symbol for a field with a rule required
     */
    function required($field){
        $this->CI = &get;_instance();
        $required=NULL;
        if (isset($this->CI->codexadmin->rules)){
            if (array_key_exists($field,$this->CI->codexadmin->rules)) {
                //search if a rule is 'required' in the rules
                $rules=explode("|",$this->CI->codexadmin->rules[$field]);
                $required=((in_array("required", $rules))?"<span class='required'>*</span>":NULL);
            }
        }
        return $required;
    }

after, in each plugin where you want the symbol change the lines
Code:
$html .= '
            <label for="'.$this->element_name.'">
                '.$this->label.'
            </label>';
in
Code:
$html .= '
            <label for="'.$this->element_name.'">
                '.$this->label.$this->required($this->name).'
            </label>';
Finally, insert into the css a .required class.
#37

[eluser]abmcr[/eluser]
I have translate the language for italian user... send me an email for get it....ciao
#38

[eluser]Majd Taby[/eluser]
abmcr, the callback worked fine with me, except that you need to change $this->validation to $this->codexvalidation.

also, for your required extension, I would add a function to codexforms and call it at the end of the initiate method, that way it can all be done automatically.
#39

[eluser]Majd Taby[/eluser]
Hey guys, just wanted to let you all know that a new release has been posted (RC14.2) which mainly addresses issues found with RC14. The main post has been updated.


EDIT: I prematurely released 14.2, I have since fixed the downoad, but if you downloaded it before and it's not working, then please just download again...sorry about that.
#40

[eluser]abmcr[/eluser]
Thank you JTaby for the new release.... i have insert another little feature: the table hover effect (see the attached image) and see this page for a demo.
Simply, insert into assets/js the file you download at http://p.sohei.org/jquery-plugins/tablehover/.
After, edit the css file of ypur template and insert these lines
Code:
/*class for zebra like table*/
tr.odd {
background-color:#BFDEFF;
}

tr.even {
background-color:#333666;
}
/*jquery table hover*/
td.click, th.click {
background-color:#A7C1DE;
color:white;
}
td.hover, tr.hover {
background-color:#1A2227;
}
th.hover, tfoot td.hover {
background-color:ivory;
}
td.hovercell, th.hovercell {
background-color:#AABBCC;
}
td.hoverrow, th.hoverrow {
background-color:#66DDFF;
}
Edit views/table.php and edit as
Code:
&lt;?php
$this->codextemplates->jsFromAssets('js-tablesorter','jquery.tablesorter.pack.js');
$this->codextemplates->jsFromAssets('js-tablesorter-pager','jquery.tablesorter.pager.js');
//this line insert the table hover effect:
//attach the file you have downloaded, in this example is jquery.tablehover.min.js
$this->codextemplates->jsFromAssets('js-tablehover','jquery.tablehover.min.js');

$table_sorter_js = "

    $(document).ready(function() {
         $('#main-table').tableHover({clickClass: 'click'});
        $('#main-table')
            .tablesorter({widthFixed: true, widgets: ['zebra']})
.......
That's all




Theme © iAndrew 2016 - Forum software by © MyBB