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

[eluser]Unknown[/eluser]
Hey there jTaby,

First of all, thanks for Codex. A real time-saver.

I skimmed through the thread and couldn't see if it's already been addressed but I think you forgot to output rawHeaderHTML, therefore any encoding tags and such inside codextemplates library:

-original
Code:
{$this->content['doctype']}
<html>
    <head>
        <title>{$this->content['title']}</title>
        $head
    </head>
    <body>
        {$this->content['body']}
    </body>
</html>

-modified
Code:
{$this->content['doctype']}
<html>
    <head>
        <title>{$this->content['title']}</title>
        //here we go
        {$this->content['head']}
        $head
    </head>
    <body>
        {$this->content['body']}
    </body>
</html>

Thanks again.
#42

[eluser]abmcr[/eluser]
I have found a bug: in the preview if you search a text and you choose as field related example you get an SQL error.
I have this suggestion : insert another form parameter for exclusion of some field. I post the code
In the controller set a line as
Code:
'not_in_search'=>'array('field')
Code:
$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'),
                    'not_in_search'=>array('related_example'),
                    'rules'=>$rules
                    );
        $this->setConfig($config);
In the codexadmin.php change the firsts lines as
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class codexAdmin {

    var $CI;
    var $db_table;
    var $form_setup;
    var $controller_name;
    var $form_prefix;
    var $form_suffix;
    var $messages;
    var $rules;
    var $active_id;
    var $primary_key;
    var $asset_folder;
    var $display_fields;
   //line inserted
    var $not_in_search;
    var $state = '';
    var $params = array();

    /*
     * Constructor:
     *      Loads the codexadmin language file.
     */
    function codexAdmin(){
        $this->CI = &get;_instance();
        $this->CI->lang->load('codexadmin');
    }

    /*
     * Initializes all the parameters with default values.
     * Throws an error on missing required arguments.
     */
    function _initialize($params){
        $this->db_table        = (isset($params['db_table']))? $params['db_table'] : show_error($this->CI->lang->line('codex_table_not_defined'));
        $this->form_setup      = (isset($params['form_setup']))? $params['form_setup'] : show_error($this->CI->lang->line('codex_form_not_defined'));
        $this->controller_name = (isset($params['controller_name']))? $params['controller_name'] : show_error($this->CI->lang->line('codex_controller_not_defined'));
        $this->form_prefix     = (isset($params['form_prefix']))? $params['form_prefix'] : '<div class="form-element">';
        $this->form_suffix     = (isset($params['form_suffix']))? $params['form_suffix'] : '<div class="clear"></div></div>';
        $this->rules           = (isset($params['rules']))? $params['rules'] : array();
        $this->primary_key     = (isset($params['primary_key']))? $params['primary_key'] : 'id';
    //line inserted
    $this->not_in_search           = (isset($params['not_in_search']))? $params['not_in_search'] : array();
And finally change the templates/your_template/codex_search.php as (see next post... the forum breack the lines)
#43

[eluser]abmcr[/eluser]
Code:
&lt;?php

$js = "
    $(document).ready(function() {
            $('.search-remove').click(function(){
                $(this).parent().slideUp('fast',function(){\$(this).remove();});
            });

            $('#search-expand').click(function(){
                $('#search-overflow-html .search-item').clone(true).appendTo('#search-overflow').hide().slideDown('fast');
            });
    });
";
$this->codextemplates->inlineJS('js-search', $js);
function getSearchItemHTML($fields,$query,$selected_field,$asset_folder,$not_in_search){
(print_r($not_in_search));
    $search_item_expand = '<div class="search-item">
                                <a href="#" class="search-remove"><img src="'.$asset_folder.'images/minus.png"></a>
                                '.form_input('query[]',$query).'
                                <select name="fields[]">';
                                    foreach($fields as $field=>$header){
                                        if (!(in_array($field,$not_in_search))){
                                                if($field == $selected_field)
                                                $search_item_expand .= '<option value="'.$field.'" selected>'.humanize($field).'</option>';
                                            else
                                                $search_item_expand .= '<option value="'.$field.'">'.humanize($field).'</option>';
                                          }
                                    }
    $search_item_expand.='
                                </select>
                            </div>
                            ';
    return $search_item_expand;
};

?&gt;

                <div id="search-form">
                    <img src="&lt;?php echo base_url().APPPATH.'views/templates/'.$this->template.'/images/'.$this->template; ?&gt;/codexnew_03.gif">
                    <div id="search-form-content">
                        &lt;?php echo form_open($this->search_action); ?&gt;
                        <a href="#" id="search-expand"><img src="&lt;?php echo $this->codexadmin->asset_folder; ?&gt;images/plus.png"></a>
                        &lt;?php
                            $queries = $this->input->post('query');
                            $fields = $this->input->post('fields');

                            if(count($queries) != count($fields))
                                show_error("Problem with setup of keywords vs fields...");

                            if($queries){
                                echo form_input('query[]',current($queries));
                                array_shift($queries);
                            }
                            else
                                echo form_input('query[]');
                            
                        ?&gt;
                        <select name="fields[]">
                        &lt;?php
                            $headers = $this->codexforms->iterate('getDisplayName');
                            foreach($this->codexadmin->display_fields as $field=>$header){
                                   if (!(in_array($field,$this->codexadmin->not_in_search))){
                                         if($fields AND $field == reset($fields)){
                                            echo '<option value="'.current($fields).'" selected>'.humanize(current($fields))."</option>\n";
                                        }
                                        else
                                            echo '<option value="'.$field.'">'.humanize($field)."</option>\n";
                                }
                            }
                            if(is_array($fields))
                                array_shift($fields);
                            ?&gt;
                        </select>
                        &lt;input type="image" src="&lt;?php echo $this-&gt;codexadmin->asset_folder; ?&gt;/images/search.png" id="search-submit" />

                        <div id="search-overflow">
                        &lt;?php
                            if($queries)
                                for($i=0;$i<count($queries);$i++){
                                    echo getSearchItemHTML($this->codexadmin->display_fields,$queries[$i],$fields[$i],$this->codexadmin->asset_folder,$this->codexadmin->not_in_search);
                                }
                        ?&gt;
                        </div>
                        &lt;/form&gt;
                    </div>
                    <img src="&lt;?php echo base_url().APPPATH.'views/templates/'.$this->template.'/images/'.$this->template; ?&gt;/codexnew_10.gif">
                </div>
            <div class="hidden" id="search-overflow-html">
                &lt;?php echo getSearchItemHTML($this->codexadmin->display_fields,'','',$this->codexadmin->asset_folder,$this->codexadmin->not_in_search); ?&gt;
            </div>
I hope this is useful..... ciao
#44

[eluser]minimal design[/eluser]
DAMN! I missed the update cause I was only subscribed to the old thread... Nice update!! I don't have time to really play with it right now but I just wanted to say thanks! so... THANKS!
#45

[eluser]Bruce Brown[/eluser]
Hello, I just finished installing. Works great.

Then, I tried to move Codex app to my general apps directory for CI, which is in a common location for a multi-site install up from my site root (../ci/apps/). I was able to modify things in backend.php and in codex_choosers.php to get the application displaying, but, couldn't find where to get the proper css applying to the pages.
#46

[eluser]Majd Taby[/eluser]
you need to change codex_assets_dir (or something similar) in config/codex.php
#47

[eluser]Bruce Brown[/eluser]
JTaby. Thanks for the reply.

In so far, I've attempted to customize my install as follows:

1. I've moved the codex app folder into a folder which is, from my site root, at "../ci/apps/"
2. I've renamed the "backend.php" to "form.php"
3 I've changed the index page setting to "form.php" in /codex/application/config/config.php
4. In /codex/application/config/codex.php, I've modified the following line of that file:
Code:
$config['codex_asset_folder'] = $config['base_url'].'../ci/apps/codex/assets/';


That didn't get the clean blue css appying, so I also:


5. modified the following line is /codex/application/views/clean_blue/codex_choosers.php:
Code:
$view_modes_dir = '../ci/apps/codex/application/views/view_modes/';
Code:
$templates_dir = '../ci/apps/codex/application/views/templates/';

After making these changes. The css for clean_blue still does not apply to the app --although the app is running.

Thanks for any help.
#48

[eluser]Majd Taby[/eluser]
ok, unfortunately I'm not on a computer where I can browse my code (i'm off the phone), but what I might have done was hard code the path for the css and javascript assets. Could you please open controllers/codexcontroller.php and search for 'css' and you should see a line that looks something like this:

$this->codextemplates->css(...)

try changing that to use $this->config->item('codex_asset_folder') or something.

if that fixes it, then i'll upload a new release that fixes it shortly.
#49

[eluser]matthewr[/eluser]
Cool!

jTaby, is it possible to hide the specify permissions box? I have no use for it and it just confuses my clients.

Any how do I hide that pesky Related Example link on top?

Cheers,
Matt
#50

[eluser]Bruce Brown[/eluser]
JTaby, I wasn't able to get that css working. Thanks for the help so far.

Bruce




Theme © iAndrew 2016 - Forum software by © MyBB