Yii Framework Forum: Yii skeleton app - Yii Framework Forum

Jump to content

  • (9 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • This topic is locked

Yii skeleton app Rate Topic: -----

#141 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 22 August 2009 - 08:38 PM

@whoopass thanks for sharing, might be helpful to some people

@moho Thanks! and thanks for pointing out the link was dead.

I checked in a few updates today! See the Google page: http://code.google.c...i-skeleton-app/
http://php-thoughts.cubedwater.com - my bloggings about Yii
0

#142 User is offline   moho 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 103
  • Joined: 25-April 09

Posted 24 August 2009 - 03:13 PM

Great. Thanks for the updates, especially R113.
years of web development (for fun) using PHP. RawPHP->Own PHP FrameWork->CakePHP>Yii
0

#143 User is offline   Cooler 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-August 09

Posted 02 September 2009 - 04:26 AM

hi, great work. But how do I get the UrlManager to work when format is 'path'?
1. uncomment in protected/config/main.php:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
//'caseSensitive'=>false,
'rules'=>array(
'user/register/*'=>'user/create',
'user/settings/*'=>'user/update',
),
),
2. click on any link(eg.contact)
3. get 404 page not found error.
0

#144 User is offline   dhanya_kr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 04-May 09

Posted 19 September 2009 - 10:16 AM

Hi All,

From where will I be able to download this 'yii-skeleton-app'. I didn't find any download like anywhere.

Can anyone tell me?
0

#145 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,834
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 19 September 2009 - 10:30 AM

View Postdhanya_kr, on 19 September 2009 - 10:16 AM, said:

Hi All,

From where will I be able to download this 'yii-skeleton-app'. I didn't find any download like anywhere.

Can anyone tell me?


Follow the link given in the first message in this thread. Use svn to check out the source.

/Tommy
Don't forget to read The Definitive Guide to Yii (1.1/2.0 en) | The class reference (1.1/2.0) has the details
0

#146 User is offline   dimis283 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 364
  • Joined: 24-January 09

Posted 19 September 2009 - 01:34 PM

I use netbeans subversion and there is the error

Quote

svn: URL 'http://yii-skeleton-app.googlecode.com/svn/trunk/yii-skeleton-app-read-only' non-existent in revision 119

What is exactly the url?
Posted Image
0

#147 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,834
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 19 September 2009 - 04:32 PM

If you want your local dir tree under the subdir "yii-skeleton-app-read-only", it is:
svn co http://yii-skeleton-app.googlecode.com/svn/trunk/  yii-skeleton-app-read-only


/Tommy
Don't forget to read The Definitive Guide to Yii (1.1/2.0 en) | The class reference (1.1/2.0) has the details
0

#148 User is offline   dhanya_kr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 04-May 09

Posted 20 September 2009 - 08:52 AM

Hi,
I got the app. but when i try the links i am getting the following error.

'Not Found The requested URL /yii/site/contact was not found on this server.'

Can anyone help me to solve this?
0

#149 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,834
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 20 September 2009 - 09:02 AM

Read this section of the Yii guide
http://www.yiiframew...uide/topics.url

/Tommy
Don't forget to read The Definitive Guide to Yii (1.1/2.0 en) | The class reference (1.1/2.0) has the details
0

#150 User is offline   daonhack 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 02-June 09

Posted 24 September 2009 - 04:22 AM

I got CException:

Description

Alias "textedit.components.TextEditor" is invalid. Make sure it points to an existing directory or file.

Source File

C:\xampp\htdocs\yii\framework\YiiBase.php(251)

00239:                     require($path.'.php');
00240:                 else
00241:                     self::$_classes[$className]=$path.'.php';
00242:                 return $className;
00243:             }
00244:             else  // a directory
00245:             {
00246:                 set_include_path(get_include_path().PATH_SEPARATOR.$path);
00247:                 return self::$_imports[$alias]=$path;
00248:             }
00249:         }
00250:         else
00251: throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing directory or file.',
00252:                 array('{alias}'=>$alias)));
00253:     }
00254: 
00255:     /**
00256:      * Translates an alias into a file path.
00257:      * Note, this method does not ensure the existence of the resulting file path.
00258:      * It only checks if the root alias is valid or not.
00259:      * @param string alias (e.g. system.web.CController)
00260:      * @return mixed file path corresponding to the alias, false if the alias is invalid.
00261:      */
00262:     public static function getPathOfAlias($alias)
00263:     {

Stack Trace

#0 C:\xampp\htdocs\yii\framework\web\CBaseController.php(137): YiiBase::import('textedit.compon...', true)
#1 C:\xampp\htdocs\yii\framework\web\CBaseController.php(153): CBaseController->createWidget('textedit.compon...', Array)
#2 C:\xampp\htdocs\website\protected\views\user\recover.php(8): CBaseController->widget('textedit.compon...', Array)
#3 C:\xampp\htdocs\yii\framework\web\CBaseController.php(119): require('C:\xampp\htdocs...')
#4 C:\xampp\htdocs\yii\framework\web\CBaseController.php(88): CBaseController->renderInternal('C:\xampp\htdocs...', Array, true)
#5 C:\xampp\htdocs\yii\framework\web\CController.php(701): CBaseController->renderFile('C:\xampp\htdocs...', Array, true)
#6 C:\xampp\htdocs\yii\framework\web\CController.php(640): CController->renderPartial('recover', Array, true)
#7 C:\xampp\htdocs\website\protected\controllers\UserController.php(172): CController->render('recover', Array)
#8 C:\xampp\htdocs\yii\framework\web\actions\CInlineAction.php(32): UserController->actionRecover()
#9 C:\xampp\htdocs\yii\framework\web\CController.php(300): CInlineAction->run()
#10 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(129): CController->runAction(Object(CInlineAction))
#11 C:\xampp\htdocs\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()
#12 C:\xampp\htdocs\website\protected\components\Controller.php(8): CFilter->filter(Object(CFilterChain))
#13 C:\xampp\htdocs\yii\framework\web\filters\CInlineFilter.php(59): Controller->filterAccessControl(Object(CFilterChain))
#14 C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))
#15 C:\xampp\htdocs\yii\framework\web\CController.php(283): CFilterChain->run()
#16 C:\xampp\htdocs\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#17 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(332): CController->run('recover')
#18 C:\xampp\htdocs\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('user/recover')
#19 C:\xampp\htdocs\yii\framework\base\CApplication.php(133): CWebApplication->processRequest()
#20 C:\xampp\htdocs\website\index.php(12): CApplication->run()
#21 {main}


Just user/recovery error, the rest everything worked well. Any suggestion for this situation?
0

#151 User is offline   adrianliem 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 27-December 09

Posted 30 December 2009 - 10:04 AM

i consider myself lucky for saving a lot of experiment hours -- and possible frustration -- after trying this skeleton application in the first place just after learning yii. i literally felt overly excited a few moments ago when i just tried the skeleton :D

i think this skeleton application is at least just as important as the blog example application. it has provides yii a basic skeleton which has push yii a step forward to a complete application.

if i may suggest, it will be great if this topic can be pinned in the forum, as surely it is being a great time saver for yii beginners like myself :)
0

#152 User is offline   koleto 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 07-July 09
  • Location:Bulgaria

Posted 16 January 2010 - 05:33 PM

If you want to use TinyMCE in your TextEditor module, you just have to change couple of files.

application.modules.textedit.components.TextEditor :
<?php

/**
* Call it like this:
* $this->widget('path.to.widget', array('id'=><unique id>));
*/

class TextEditor extends CWidget
{
    /**
    * string unique id of the text editor
    */
    public $id;
    public $AR = null;
    public $defaultMsg = '<b>Click here to enter text</b>';

    protected $model;

    /**
     * Initializes the widget.
     * This method starts the output buffering.
     */
    public function init()
    {
        Yii::app()->getModule('textedit');

        if ($this->AR == null) {
            $this->model = Textedit::model()->find('namedId=:id', array('id'=>$this->id));
            if (!$this->model) {
                $this->model = new Textedit;
                $this->model->namedId = $this->id;
            }
        } else {
            $this->model = $this->AR;
        }

        if (!Yii::app()->user->hasAuth(Group::ADMIN)) {
            if ($this->model->content)
            echo $this->model->getMarkdown('content', false);
            return;
        }

        $this->registerScript();
        echo '<div class="texteditId">Id: '.$this->model->namedId.'</div>
        <div class="textedit" id="textedit_'.$this->model->namedId.'">';

        if ($this->model->content)
        echo $this->model->getMarkdown('content', false);
        else
        echo '<p>'.$this->defaultMsg.'</p>';

        echo '</div>';
    }

    protected function registerScript() {
        if (Yii::app()->clientScript->isScriptRegistered('textedit', CClientScript::POS_READY))
        return;
        Yii::app()->clientScript->registerScriptFile(Html::jsUrl('tiny_mce/tiny_mce_src.js'));
        Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/jquery.jeditable.mini.js');
        $controllerProcess = CHtml::normalizeUrl(array('/textedit/textedit/process'));
        $controllerLoadRaw = CHtml::normalizeUrl(array('/textedit/textedit/loadraw'));
        $prepare = <<<EOD
                $.fn.tinymce = function(options){
                   return this.each(function(){
                      tinyMCE.execCommand("mceAddControl", true, this.id);
                   });
                }

                function initMCE(){
                   tinyMCE.init({
                        mode : "textareas",
                        theme : "advanced",
                        plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

                        // Theme options
                        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
                        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
                        theme_advanced_toolbar_location : "top",
                        theme_advanced_toolbar_align : "left",
                        theme_advanced_statusbar_location : "bottom",
                        theme_advanced_resizing : true,

                        // Example content CSS (should be your site CSS)
                        content_css : "css/example.css",

                        // Drop lists for link/image/media/template dialogs
                        template_external_list_url : "js/template_list.js",
                        external_link_list_url : "js/link_list.js",
                        external_image_list_url : "js/image_list.js",
                        media_external_list_url : "js/media_list.js",
                                          strict_loading_mode : true
                                        });
                                    }



                        initMCE();

                        $.editable.addInputType('mce', {
                           element : function(settings, original) {
                              var textarea = $('<textarea id="'+$(original).attr("id")+'_mce"/>');
                              if (settings.rows) {
                                 textarea.attr('rows', settings.rows);
                              } else {
                                 textarea.height(settings.height);
                              }
                              if (settings.cols) {
                                 textarea.attr('cols', settings.cols);
                              } else {
                                 textarea.width(settings.width);
                              }
                              $(this).append(textarea);
                                 return(textarea);
                              },
                           plugin : function(settings, original) {
                              tinyMCE.execCommand("mceAddControl", true, $(original).attr("id")+'_mce');
                              },
                           submit : function(settings, original) {
                              tinyMCE.triggerSave();
                              tinyMCE.execCommand("mceRemoveControl", true, $(original).attr("id")+'_mce');
                              },
                           reset : function(settings, original) {
                              tinyMCE.execCommand("mceRemoveControl", true, $(original).attr("id")+'_mce');
                              original.reset();
                           }
                        });
EOD;
        $script = <<<EOD
                $(function(){
                $('#test').tinymce();

                        $('.textedit').editable('$controllerProcess', {
                            type: 'mce',
                            loadurl: '$controllerLoadRaw',
                            loaddata: {id: $(this).attr('id')},
                            submitdata: {id: $(this).attr('id')},
                            tooltip : 'Click to edit...',
                            submit: 'OK',
                            cancel: 'Cancel'
                        }).hover(function() {
                            $(this).css({'backgroundColor': '#FDFD72'});
                        }, function() {
                            $(this).css({'backgroundColor': ''});
                        });
                });
EOD;
        Yii::app()->clientScript->registerScript('textedit', $prepare, CClientScript::POS_HEAD);
        Yii::app()->clientScript->registerScript('textedit1', $script, CClientScript::POS_READY);
    }
}




jquery.jeditable.mini.js
/*
 * Jeditable - jQuery in place edit plugin
 *
 * Copyright (c) 2006-2008 Mika Tuupola, Dylan Verheul
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/jeditable
 *
 * Based on editable by Dylan Verheul <dylan_at_dyve.net>:
 *    http://www.dyve.net/jquery/?editable
 *
 * Revision: $Id: jquery.jeditable.js 401 2008-07-21 15:01:00Z tuupola $
 *
 */

/**
  * Version 1.6.0
  *
  * @name  Jeditable
  * @type  jQuery
  * @param String  target             POST URL or function name to send edited content
  * @param Hash    options            additional options 
  * @param Function options[callback] Function to run after submitting edited content
  * @param String  options[name]      POST parameter name of edited content
  * @param String  options[id]        POST parameter name of edited div id
  * @param Hash    options[submitdata] Extra parameters to send when submitting edited content.
  * @param String  options[type]      text, textarea or select
  * @param Integer options[rows]      number of rows if using textarea
  * @param Integer options[cols]      number of columns if using textarea
  * @param Mixed   options[height]    'auto', 'none' or height in pixels
  * @param Mixed   options[width]     'auto', 'none' or width in pixels 
  * @param String  options[loadurl]   URL to fetch input content before editing
  * @param String  options[loadtype]  Request type for load url. Should be GET or POST.
  * @param String  options[loadtext]  Text to display while loading external content.
  * @param Hash    options[loaddata]  Extra parameters to pass when fetching content before editing.
  * @param String  options[data]      Or content given as paramameter.
  * @param String  options[indicator] indicator html to show when saving
  * @param String  options[tooltip]   optional tooltip text via title attribute
  * @param String  options[event]     jQuery event such as 'click' of 'dblclick'
  * @param String  options[onblur]    'cancel', 'submit', 'ignore' or function
  * @param String  options[submit]    submit button value, empty means no button
  * @param String  options[cancel]    cancel button value, empty means no button
  * @param String  options[cssclass]  CSS class to apply to input form. 'inherit' to copy from parent.
  * @param String  options[style]     Style to apply to input form 'inherit' to copy from parent.
  * @param String  options[select]    true or false, when true text is highlighted
  * @param String  options[placeholder] Placeholder text or html to insert when element is empty.
  *             
  */

(function($) {

    $.fn.editable = function(target, options) {
    
        var settings = {
            target     : target,
            name       : 'value',
            id         : 'id',
            type       : 'textarea',
            width      : 'auto',
            height     : 'auto',
            event      : 'click',
            onblur     : 'cancel',
            loadtype   : 'GET',
            loadtext   : 'Loading...',
            placeholder: 'Click to edit',
            loaddata   : {},
            submitdata : {}
        };
        
        if(options) {
            $.extend(settings, options);
        }
    
        /* setup some functions */
        var plugin   = $.editable.types[settings.type].plugin || function() { };
        var submit   = $.editable.types[settings.type].submit || function() { };
        var buttons  = $.editable.types[settings.type].buttons 
                    || $.editable.types['defaults'].buttons;
        var content  = $.editable.types[settings.type].content 
                    || $.editable.types['defaults'].content;
        var element  = $.editable.types[settings.type].element 
                    || $.editable.types['defaults'].element;
        var reset    = $.editable.types[settings.type].reset 
                    || $.editable.types['defaults'].reset;
        var callback = settings.callback || function() { };
        
        /* add custom event if it does not exist */
        if  (!$.isFunction($(this)[settings.event])) {
            $.fn[settings.event] = function(fn){
          		return fn ? this.bind(settings.event, fn) : this.trigger(settings.event);
          	}
        }
          
        /* TODO: remove this when form is displayed */
        $(this).attr('title', settings.tooltip);
        
        settings.autowidth  = 'auto' == settings.width;
        settings.autoheight = 'auto' == settings.height;

        return this.each(function() {

            /* save this to self because this changes when scope changes */
            var self = this;  
                   
            /* inlined block elements lose their width and height after first edit */
            /* save them for later use as workaround */
            var savedwidth  = $(self).width();
            var savedheight = $(self).height();
            
            /* if element is empty add something clickable (if requested) */
            if (!$.trim($(this).html())) {
                $(this).html(settings.placeholder);
            }
            
            $(this)[settings.event](function(e) {

                /* prevent throwing an exeption if edit field is clicked again */
                if (self.editing) {
                    return;
                }

                /* figure out how wide and tall we are, saved width and height */
                /* are workaround for http://dev.jquery.com/ticket/2190 */
                if (0 == $(self).width()) {
                    //$(self).css('visibility', 'hidden');
                    settings.width  = savedwidth;
                    settings.height = savedheight;
                } else {
                    if (settings.width != 'none') {
                        settings.width = 
                            settings.autowidth ? $(self).width()  : settings.width;
                    }
                    if (settings.height != 'none') {
                        settings.height = 
                            settings.autoheight ? $(self).height() : settings.height;
                    }
                }
                //$(this).css('visibility', '');
                
                /* remove placeholder text, replace is here because of IE */
                if ($(this).html().toLowerCase().replace(/;/, '') == 
                    settings.placeholder.toLowerCase().replace(/;/, '')) {
                        $(this).html('');
                }
                                
                self.editing    = true;
                self.revert     = $(self).html();
                $(self).html('');

                /* create the form object */
                var form = $('<form/>');
                
                /* apply css or style or both */
                if (settings.cssclass) {
                    if ('inherit' == settings.cssclass) {
                        form.attr('class', $(self).attr('class'));
                    } else {
                        form.attr('class', settings.cssclass);
                    }
                }

                if (settings.style) {
                    if ('inherit' == settings.style) {
                        form.attr('style', $(self).attr('style'));
                        /* IE needs the second line or display wont be inherited */
                        form.css('display', $(self).css('display'));                
                    } else {
                        form.attr('style', settings.style);
                    }
                }

                /* add main input element to form and store it in input */
                var input = element.apply(form, [settings, self]);

                /* set input content via POST, GET, given data or existing value */
                var input_content;
                
                if (settings.loadurl) {
                    var t = setTimeout(function() {
                        input.disabled = true;
                        content.apply(form, [settings.loadtext, settings, self]);
                    }, 100);

                    var loaddata = {};
                    loaddata[settings.id] = self.id;
                    if ($.isFunction(settings.loaddata)) {
                        $.extend(loaddata, settings.loaddata.apply(self, [self.revert, settings]));
                    } else {
                        $.extend(loaddata, settings.loaddata);
                    }
                    $.ajax({
                       type : settings.loadtype,
                       url  : settings.loadurl,
                       data : loaddata,
                       async : false,
                       success: function(result) {
                       	  window.clearTimeout(t);
                       	  input_content = result;
                          input.disabled = false;
                       }
                    });
                } else if (settings.data) {
                    input_content = settings.data;
                    if ($.isFunction(settings.data)) {
                        input_content = settings.data.apply(self, [self.revert, settings]);
                    }
                } else {
                    input_content = self.revert; 
                }
                content.apply(form, [input_content, settings, self]);

                input.attr('name', settings.name);
        
                /* add buttons to the form */
                buttons.apply(form, [settings, self]);
         
                /* add created form to self */
                $(self).append(form);
         
                /* attach 3rd party plugin if requested */
                plugin.apply(form, [settings, self]);

                /* focus to first visible form element */
                $(':input:visible:enabled:first', form).focus();

                /* highlight input contents when requested */
                if (settings.select) {
                    input.select();
                }
        
                /* discard changes if pressing esc */
                input.keydown(function(e) {
                    if (e.keyCode == 27) {
                        e.preventDefault();
                        //self.reset();
                        reset.apply(form, [settings, self]);
                    }
                });

                /* discard, submit or nothing with changes when clicking outside */
                /* do nothing is usable when navigating with tab */
                var t;
                if ('cancel' == settings.onblur) {
                    input.blur(function(e) {
                        //t = setTimeout(self.reset, 500);
                        t = setTimeout(function() {
                            reset.apply(form, [settings, self]);
                        }, 500);
                    });
                } else if ('submit' == settings.onblur) {
                    input.blur(function(e) {
                        form.submit();
                    });
                } else if ($.isFunction(settings.onblur)) {
                    input.blur(function(e) {
                        settings.onblur.apply(self, [input.val(), settings]);
                    });
                } else {
                    input.blur(function(e) {
                      /* TODO: maybe something here */
                    });
                }

                form.submit(function(e) {

                    if (t) { 
                        clearTimeout(t);
                    }

                    /* do no submit */
                    e.preventDefault(); 
            
                    /* call before submit hook. if it returns false abort submitting */
                    if (false !== submit.apply(form, [settings, self])) { 
                      
                      /* check if given target is function */
                      if ($.isFunction(settings.target)) {
                          var str = settings.target.apply(self, [input.val(), settings]);
                          $(self).html(str);
                          self.editing = false;
                          callback.apply(self, [self.innerHTML, settings]);
                          /* TODO: this is not dry */                              
                          if (!$.trim($(self).html())) {
                              $(self).html(settings.placeholder);
                          }
                      } else {
                          /* add edited content and id of edited element to POST */
                          var submitdata = {};
                          submitdata[settings.name] = input.val();
                          submitdata[settings.id] = self.id;
                          /* add extra data to be POST:ed */
                          if ($.isFunction(settings.submitdata)) {
                              $.extend(submitdata, settings.submitdata.apply(self, [self.revert, settings]));
                          } else {
                              $.extend(submitdata, settings.submitdata);
                          }          

                          /* show the saving indicator */
                          $(self).html(settings.indicator);
                          $.post(settings.target, submitdata, function(str) {
                              $(self).html(str);
                              self.editing = false;
                              callback.apply(self, [self.innerHTML, settings]);
                              /* TODO: this is not dry */                              
                              if (!$.trim($(self).html())) {
                                  $(self).html(settings.placeholder);
                              }
                          });
                      }
                      
                    }
                     
                    return false;
                });
            });
            
            /* privileged methods */
            this.reset = function() {
                $(self).html(self.revert);
                self.editing   = false;
                if (!$.trim($(self).html())) {
                    $(self).html(settings.placeholder);
                }
            }            
        });

    };


    $.editable = {
        types: {
            defaults: {
                element : function(settings, original) {
                    var input = $('<input type="hidden">');                
                    $(this).append(input);
                    return(input);
                },
                content : function(string, settings, original) {
                    $(':input:first', this).val(string);
                },
                reset : function(settings, original) {
                  original.reset();
                },
                buttons : function(settings, original) {
                    var form = this;
                    if (settings.submit) {
                        /* if given html string use that */
                        if (settings.submit.match(/>$/)) {
                            var submit = $(settings.submit).click(function() {
                                form.submit();
                            });
                        /* otherwise use button with given string as text */
                        } else {
                            var submit = $('<button type="submit">');
                            submit.html(settings.submit);                            
                        }
                        $(this).append(submit);
                    }
                    if (settings.cancel) {
                        /* if given html string use that */
                        if (settings.cancel.match(/>$/)) {
                            var cancel = $(settings.cancel);
                        /* otherwise use button with given string as text */
                        } else {
                            var cancel = $('<button type="cancel">');
                            cancel.html(settings.cancel);
                        }
                        $(this).append(cancel);

                        $(cancel).click(function(event) {
                            //original.reset();
                            if ($.isFunction($.editable.types[settings.type].reset)) {
                                var reset = $.editable.types[settings.type].reset;                                                                
                            } else {
                                var reset = $.editable.types['defaults'].reset;                                
                            }
                            reset.apply(form, [settings, original]);
                            return false;
                        });
                    }
                }
            },
            text: {
                element : function(settings, original) {
                    var input = $('<input>');
                    if (settings.width  != 'none') { input.width(settings.width);  }
                    if (settings.height != 'none') { input.height(settings.height); }
                    /* https://bugzilla.mozilla.org/show_bug.cgi?id=236791 */
                    //input[0].setAttribute('autocomplete','off');
                    input.attr('autocomplete','off');
                    $(this).append(input);
                    return(input);
                }
            },
            textarea: {
                element : function(settings, original) {
                    var textarea = $('<textarea>');
                    if (settings.rows) {
                        textarea.attr('rows', settings.rows);
                    } else {
                        textarea.height(settings.height);
                    }
                    if (settings.cols) {
                        textarea.attr('cols', settings.cols);
                    } else {
                        textarea.width(settings.width);
                    }
                    $(this).append(textarea);
                    return(textarea);
                }
            },
            select: {
                element : function(settings, original) {
                    var select = $('<select>');
                    $(this).append(select);
                    return(select);
                },
                content : function(string, settings, original) {
                    if (String == string.constructor) { 	 
                        eval ('var json = ' + string);
                        for (var key in json) {
                            if (!json.hasOwnProperty(key)) {
                                continue;
                            }
                            if ('selected' == key) {
                                continue;
                            } 
                            var option = $('<option>').val(key).append(json[key]);
                            $('select', this).append(option); 	 
                        }
                    }
                    /* Loop option again to set selected. IE needed this... */ 
                    $('select', this).children().each(function() {
                        if ($(this).val() == json['selected'] || 
                            $(this).text() == original.revert) {
                                $(this).attr('selected', 'selected');
                        };
                    });
                }
            }
        },

        /* Add new input type */
        addInputType: function(name, input) {
            $.editable.types[name] = input;
        }
    };

})(jQuery);

I want to fix the world but they won't give me the source code
0

#153 User is offline   windigo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-January 10

Posted 24 January 2010 - 04:38 PM

Can anyone help on this CDbExcetion?
CDbException
Description
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user.created' in 'order clause'

Source File
D:\Server\xampplite\htdocs\yii\framework\db\CDbCommand.php(375)

00363:             }
00364: 
00365:             if($this->_connection->enableProfiling)
00366:                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00367: 
00368:             return $result;
00369:         }
00370:         catch(Exception $e)
00371:         {
00372:             if($this->_connection->enableProfiling)
00373:                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00374:             Yii::log('Error in querying SQL: '.$this->getText().$par,CLogger::LEVEL_ERROR,'system.db.CDbCommand');
00375:             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
00376:                 array('{error}'=>$e->getMessage())));
00377:         }
00378:     }
00379: }
Stack Trace
#0 D:\Server\xampplite\htdocs\yii\framework\db\CDbCommand.php(265): CDbCommand->queryInternal('fetchAll', 2, Array)
#1 D:\Server\xampplite\htdocs\yii\framework\db\ar\CActiveFinder.php(704): CDbCommand->queryAll()
#2 D:\Server\xampplite\htdocs\yii\framework\db\ar\CActiveFinder.php(396): CJoinElement->runQuery(Object(CJoinQuery))
#3 D:\Server\xampplite\htdocs\yii\framework\db\ar\CActiveFinder.php(73): CJoinElement->find(Object(CDbCriteria))
#4 D:\Server\xampplite\htdocs\yii\framework\db\ar\CActiveFinder.php(101): CActiveFinder->query(Object(CDbCriteria), true)
#5 D:\Server\xampplite\htdocs\yii\demos\trunk\protected\controllers\UserController.php(69): CActiveFinder->findAll(Object(CDbCriteria))
#6 D:\Server\xampplite\htdocs\yii\framework\web\actions\CInlineAction.php(32): UserController->actionList()
#7 D:\Server\xampplite\htdocs\yii\framework\web\CController.php(300): CInlineAction->run()
#8 D:\Server\xampplite\htdocs\yii\framework\web\filters\CFilterChain.php(129): CController->runAction(Object(CInlineAction))
#9 D:\Server\xampplite\htdocs\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()
#10 D:\Server\xampplite\htdocs\yii\demos\trunk\protected\components\Controller.php(8): CFilter->filter(Object(CFilterChain))
#11 D:\Server\xampplite\htdocs\yii\framework\web\filters\CInlineFilter.php(59): Controller->filterAccessControl(Object(CFilterChain))
#12 D:\Server\xampplite\htdocs\yii\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))
#13 D:\Server\xampplite\htdocs\yii\framework\web\CController.php(283): CFilterChain->run()
#14 D:\Server\xampplite\htdocs\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#15 D:\Server\xampplite\htdocs\yii\framework\web\CWebApplication.php(320): CController->run('list')
#16 D:\Server\xampplite\htdocs\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('user/list')
#17 D:\Server\xampplite\htdocs\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#18 D:\Server\xampplite\htdocs\yii\demos\trunk\index.php(12): CApplication->run()
#19 {main}


When I removing this line everything works fine
$sort->defaultOrder = '`user`.`created` DESC';
0

#154 User is offline   Lucky Murari 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 20-November 09

Posted 24 January 2010 - 08:43 PM

@windigo
You need to change all the references to the User DB to 't' .IN the above example change
$sort->defaultOrder = '`user`.`created` DESC'; to
$sort->defaultOrder = '`t`.`created` DESC';
0

#155 User is offline   windigo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-January 10

Posted 26 January 2010 - 10:08 AM

View PostLucky Murari, on 24 January 2010 - 08:43 PM, said:

@windigo
You need to change all the references to the User DB to 't' .IN the above example change
$sort->defaultOrder = '`user`.`created` DESC'; to
$sort->defaultOrder = '`t`.`created` DESC';


Thanks, just now read Changes Related with Table Alias in Relational Active Record in 1.1 topic :)
0

#156 User is offline   ithank 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 07-June 10
  • Location:Costa Rica

Posted 07 June 2010 - 04:27 PM

Hey Jonah,
I like this app. It's been a help. Just wondering where you are on the rewrite for 1.1.x?

Thanks,
Henry


Nevermind! I found that with a few changes here and there, it runs mostly OK under 1.1.2.
0

#157 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 159
  • Joined: 17-April 10

Posted 29 June 2010 - 07:04 AM

Hi,

Do you need to be a member to checkout the code? what is the most easy to use SVN to install to get this code??
0

#158 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 159
  • Joined: 17-April 10

Posted 29 June 2010 - 08:34 AM

ok just download the svn and checkout the codes.. but the sql scripts in config are given errors like contentParsed no value.. and foreign key constraint error.
0

#159 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 159
  • Joined: 17-April 10

Posted 29 June 2010 - 12:28 PM

Am I doing anything wrong? downloaded v1.20 and got it running with the sql scripts (changed contentParsed to accept NULL) but get these errors

clicking on post or user :
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'post.created' in 'order clause'

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'created' doesn't have a default value

clicking on add new group:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'created' doesn't have a default value


Btw, this is way better than yiiblog as the base app to start. Thanks for sharing..

Update :
Sorry in all my eagerness to get this running I skipped post #153-#156, Will try to read up more instead of creating multiple post..

This post has been edited by Joe Storm: 29 June 2010 - 12:40 PM

0

#160 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 159
  • Joined: 17-April 10

Posted 29 June 2010 - 01:11 PM

View Postithank, on 07 June 2010 - 04:27 PM, said:

Hey Jonah,
I like this app. It's been a help. Just wondering where you are on the rewrite for 1.1.x?

Thanks,
Henry


Nevermind! I found that with a few changes here and there, it runs mostly OK under 1.1.2.


Sigh.. I changed all user. to t. in UserController and listPage.php but still getting errors. Can you post the list of changes needed to work with 1.1.2?

Description

Trying to get property of non-object
Source File

D:\yiitestdrive\protected\views\user\listPage.php(18)

00006:         <th><?php echo $sort->link('t.username'); ?></th>
00007:         <th>Posts</th>
00008:         <th><?php echo $sort->link('t.group_id'); ?></th>
00009:         <th><?php echo $sort->link('t.email'); ?></th>

0

Share this topic:


  • (9 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users