Plugin Directory

Changeset 618822


Ignore:
Timestamp:
10/29/2012 09:18:12 PM (13 years ago)
Author:
deepak.seth
Message:

1.0.1

  • Fixed the fatal error issue, The error still persists if using ultimate taxonomy manager, but goes away on refresh.
  • Fixed Taxonomies and page types issues.
  • Fixed Taxonomy Manager to Ultimate CMS transition
  • Fixed Some style issue.
Location:
ultimate-cms/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • ultimate-cms/trunk/class-xydac-cms-module.php

    r618227 r618822  
    5858        if($this->has_custom_fields){
    5959            $active_opt_arr = array();
    60             $active_names = $this->get_active_names();
     60            $active_names = $this->get_main_names();
    6161            if(is_array($active_names))
    6262                foreach($active_names as $opt=>$val)
     
    177177
    178178   
    179     public function insert_object($type,$name,$args,$namefieldname){
     179    public function insert_object($type,$name,$fieldmaster,$args,$namefieldname){
    180180        if($type=='main' || $type=='field'){
    181181            $message='';
     
    183183            if(empty($name))
    184184                $message = new WP_Error('err', $this->module_label.__(" Name is required to create ",XYDAC_CMS_NAME).$this->module_label);
    185             elseif(in_array($name,$this->get_main_names()))
    186             $message = new WP_Error('err', $this->module_label.__(" Name already registered !!!",XYDAC_CMS_NAME));
     185            elseif(($type=='main' && in_array($name,(array)$this->get_main_names())) || ($type=='field' && in_array($name,(array)$this->get_field_names($fieldmaster))))
     186                $message = new WP_Error('err', $this->module_label.__(" Name already registered !!!",XYDAC_CMS_NAME));
    187187            elseif($name=="active"){
    188188                $message = new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME));
     
    190190            else{
    191191                $args[$namefieldname] = sanitize_title_with_dashes($args[$namefieldname]);
    192                 if($this->dao->insert_object($this->get_registered_option($type),$args))
     192                $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster;
     193                if($this->dao->insert_object($opt,$args))
    193194                    $message = $this->module_label.__(' Inserted.',XYDAC_CMS_NAME);
    194195                else
     
    198199        }else return new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME));
    199200    }
    200     public function update_object($type,$name,$args,$oldname,$namefieldname){
     201    //-fieldmaster : the object of whose field has to updated
     202    public function update_object($type,$name,$fieldmaster,$args,$oldname,$namefieldname){
    201203        if($type=='main' || $type=='field'){
    202204            $message='';
     
    205207            if(empty($name))
    206208                $message = new WP_Error('err', $this->module_label.__(" Name is required to create ",XYDAC_CMS_NAME).$this->module_label);
    207             elseif(!in_array($name,$this->get_main_names()))
     209            elseif(($type=='main' && !in_array($name,$this->get_main_names())) || ($type=='field' && !in_array($name,$this->get_field_names($fieldmaster))))
    208210            $message = new WP_Error('err', $this->module_label.__(" Name not registered !!!",XYDAC_CMS_NAME));
    209211            elseif($name=="active"){
     
    213215            }
    214216            else{
    215                 if($this->dao->update_object($this->get_registered_option($type),$args,$oldname,$namefieldname))
     217                $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster;
     218                if($this->dao->update_object($opt,$args,$oldname,$namefieldname))
    216219                {
    217220                    $message = $this->module_label.__(' Updated.',XYDAC_CMS_NAME);
     
    223226        }else return new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME));
    224227    }
    225     public function delete_object($type,$name,$namefieldname){
     228    public function delete_object($type,$name,$fieldmaster,$namefieldname){
    226229        if($type=='main' || $type=='field'){
    227             if($this->dao->delete_object($this->get_registered_option($type),$name,$namefieldname))
     230            $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster;
     231            if($this->dao->delete_object($opt,$name,$namefieldname))
    228232            {
    229233                $this->deactivate_main($name);
     
    310314        return $this->_get_option('field',$args,$name);
    311315    }
     316    function get_field_by_name($name,$field_name,$fieldname_colname=null){
     317        if(!$this->has_custom_fields || !isset($this->registered_option['field']))
     318            return;
     319        if(!empty($fieldname_colname)&&!empty($fieldtype_colname))
     320            return $this->_get_option('field',array(
     321                    'is_value_array'=>'true','match_keys'=>'true',
     322                    'values'=>array($fieldname_colname=>array($field_name))
     323            ),$name);
     324        else
     325            return $this->_get_option('field',array(
     326                    'is_value_array'=>'true','match_keys'=>'true',
     327                    'values'=>array('field_name'=>array($field_name))
     328            ),$name);
     329    }
    312330    /* This function returns the array of field items which are active
    313331     ^ $name: specifies the object name of which field is to be fetched.
     
    330348            return;
    331349        if(!empty($fieldname_colname))
    332             return $this->_get_option('field',array('fields'=>array($fieldname_colname)),$name);
    333         else
    334             return $this->_get_option('field',array('fields'=>array('field_name')),$name);
     350            return $this->_get_option('field',array('fields'=>array($fieldname_colname),'is_value_array'=>'true','filter'=>array('value')),$name);
     351        else
     352            return $this->_get_option('field',array('fields'=>array('field_name'),'is_value_array'=>'true','filter'=>array('value')),$name);
    335353    }
    336354    /* This function returns the string of field's type
     
    450468        {
    451469            $formaction = $tab['href'];
    452             $selectdata = $this->get_active_names();
     470            $selectdata = $this->get_main_names();
    453471            xydac()->log('view_fields_func',$selectdata);
    454472            ?>
     
    483501    private function show_sync_page($arr,$formaction)
    484502    {
    485     $getCustomField = function($resultarr,$var){foreach($resultarr['custom_fields'] as $v)if($v['key']==$var)return $v['value'];};
     503    $getCustomField = create_function('$resultarr,$var',"foreach({$resultarr['custom_fields']} as {$v})if( {$v['key']} == {$var})return {$v['value']};");
    486504    echo '
    487505    <table class="wp-list-table widefat fixed posts" cellspacing="0">
  • ultimate-cms/trunk/class-xydac-ultimate-cms-core.php

    r618272 r618822  
    1010    var $parent_class; // The main class that uses object of this class
    1111    var $type; //used in parent class;
     12    var $field_val; //this has the name of type of which field is being edited.
    1213   
    1314        var $xydac_core_name;
     
    4546        $this->parent_class = $obj;
    4647        $this->xydac_core_name = $obj->get_module_name();
    47         $this->xydac_core_label = $obj->get_module_label();
     48        $this->xydac_core_label = ($type=='main') ? $obj->get_module_label() : $obj->get_module_label().' Fields';
    4849        $this->type = $type;
    4950        $tab = (($this->type=='main')?'modules':(($this->type=='field')?'fields':'xydac_sync'));
    50         $this->baselink = $obj->get_base_path($tab);
     51        $this->baselink = apply_filters( 'xydac_core_editlink',$obj->get_base_path($tab));
    5152            $this->xydac_core_form_array = apply_filters('xydac_core_form_array', $formarray,$this->xydac_core_name);
    52             $field_val = isset($field_val)?$field_val:'';
     53            $this->field_val = $field_val = isset($field_val)?$field_val:'';
    5354        /* if(isset($optionname) && isset($optionvalue) && is_array($optionvalue)){
    5455            $this->option_value = $optionvalue;
     
    6465           
    6566        $this->activation = $obj->uses_active($this->type);
    66         $this->xydac_core_form_action =  $obj->get_base_path($tab);
     67        $this->xydac_core_form_action =  apply_filters( 'xydac_core_editlink',$obj->get_base_path($tab));
    6768            $this->namefield_name = apply_filters( 'xydac_core_field_name', 'name' );
    6869            $this->args = $args;
     
    8081    function postHandler()
    8182    {
     83
    8284        if(isset($_POST[$this->xydac_core_name.'_doaction_submit'])&& isset($_POST['action']))
    8385            $this->bulk_action();
     
    9395            {
    9496                $this->xydac_core_editmode = true;
    95                 $this->xydac_editdata = $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]);
     97                $this->xydac_editdata = ($this->type=='main')? $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]) : $this->parent_class->get_field_by_name($this->field_val,$_GET[$this->xydac_core_name."_name"]) ;
     98                //if manage is set it means we are at fields
     99                if(isset($_GET["manage_".$this->xydac_core_name])){
     100                    $key = $_GET[$this->xydac_core_name."_name"];
     101                    $this->xydac_editdata = $this->xydac_editdata[$key];
     102                }
     103               
     104                //$this->xydac_editdata = $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]);
    96105                $this->xydac_editdata[$this->xydac_core_name.'_old'] = $_GET[$this->xydac_core_name."_name"];
    97106            }
     
    180189    function insert()
    181190    {
    182         $msg = $this->parent_class->insert_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name], apply_filters( 'xydac_core_insert',$_POST[$this->xydac_core_name]),$this->namefield_name);
     191       
     192        $msg = $this->parent_class->insert_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name],$_GET['manage_'.$this->xydac_core_name], apply_filters( 'xydac_core_insert',$_POST[$this->xydac_core_name]),$this->namefield_name);
    183193        if(is_wp_error(($msg)))
    184194            $this->xydac_core_error= $msg;
     
    191201    function update()
    192202    {
     203   
    193204        $this->xydac_core_editmode = true;
    194         $msg= $this->parent_class->update_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name], apply_filters( 'xydac_core_update',$_POST[$this->xydac_core_name]),$_POST[$this->xydac_core_name."_old"],$this->namefield_name);
     205        $msg= $this->parent_class->update_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name],$_GET['manage_'.$this->xydac_core_name], apply_filters( 'xydac_core_update',$_POST[$this->xydac_core_name]),$_POST[$this->xydac_core_name."_old"],$this->namefield_name);
    195206        if(is_wp_error(($msg))){
    196207            $this->xydac_core_error= $msg;
     
    209220    function delete($name)
    210221    {
    211         $msg = $this->parent_class->delete_object($this->type, $name, $this->namefield_name);
     222        $msg = $this->parent_class->delete_object($this->type, $name,$_GET['manage_'.$this->xydac_core_name], $this->namefield_name);
    212223        if(is_wp_error(($msg))){
    213224            $this->xydac_core_error= $msg;
     
    308319    function init()
    309320    {
    310     $xydac_rowdata = apply_filters( 'xydac_core_rowdata', $this->parent_class->get_main() );//!is_array($this->option_name)?get_option($this->option_name):($this->option_name);
     321    $xydac_rowdata = apply_filters( 'xydac_core_rowdata', ($this->type=='main')? $this->parent_class->get_main() : $this->parent_class->get_field($this->field_val) );//!is_array($this->option_name)?get_option($this->option_name):($this->option_name);
    311322    $this->xydac_editdata = stripslashes_deep($this->xydac_editdata);
    312323    ?>
     
    449460                            <div class="xydacfieldform">
    450461                            <h3><?php if($this->xydac_core_editmode) echo __('Edit ',XYDAC_CMS_NAME).$this->xydac_core_label; else echo __('Add ',XYDAC_CMS_NAME).$this->xydac_core_label; ?>
    451                             <?php if($this->xydac_core_editmode) echo "<a  style='color:red;float:right;'  href='".$this->xydac_core_form_action."&edit_".$this->xydac_core_name."=false'>Cancel Edit</a>";  ?>
     462                            <?php if($this->xydac_core_editmode) echo "<a  style='color:red;float:right;'  href='".$this->xydac_core_form_action."&edit_".$this->xydac_core_name."=false"."'>Cancel Edit</a>";  ?>
    452463                            </h3>
    453464                            <div class="form-field form-required <?php if(isset($_POST[$this->xydac_core_name.'_update_submit']) || isset($_POST[$this->xydac_core_name.'_add_submit'])) if(isset($_POST[$this->xydac_core_name][$this->namefield_name]) && empty($_POST[$this->xydac_core_name][$this->namefield_name])) echo 'form-invalid';?>"  >
  • ultimate-cms/trunk/index.php

    r618272 r618822  
    66Author: XYDAC
    77Author URI: http://xydac.com/
    8 Version: 1.0
     8Version: 1.0.1
    99License: GPL2*/
    1010
     
    1515
    1616global $xydac_cms_fields;
     17
     18require_once ABSPATH . 'wp-admin/includes/plugin.php' ;
     19add_action('plugins_loaded', create_function('','deactivate_plugins("ultimate-taxonomy-manager/ultimate-taxonomy-manager.php");'));
    1720//File includes
    1821require_once 'class-field-type.php';
     
    5154                    'userMods'=> ABSPATH.'/wp-content/ultimate_cms/'
    5255            );
     56           
     57           
     58           
    5359            self::$menu_slug = 'xydac_ultimate_cms';
    5460            self::cms()->dao = new xydac_options_dao();
     
    106112            );
    107113   
    108             $modules_root = $path;
     114            $modules_root = rtrim( $path, '\\' );//Knut Sparhell patch.
    109115            $modules_dir = @opendir($modules_root);
    110116            $module_files = array();
     
    219225            {
    220226                $names = $module->get_active_names();
     227                if(is_array($names))
    221228                foreach($names as $name)
    222229                {
     
    282289                    switch_to_blog($blog_id);
    283290                    //$this->xydac_cms_cpt_field_convert();
     291                    $this->xydac_taxonomy_fix();
    284292                    do_action('xydac_cms_activate');
    285293                }
     
    288296            }
    289297        }
     298        $this->xydac_taxonomy_fix();
    290299        //$this->xydac_cms_cpt_field_convert();
    291300        do_action('xydac_cms_activate');
     301    }
     302    function xydac_taxonomy_fix(){
     303    global $wpdb;
     304        $fields = $wpdb->get_results($wpdb->prepare("SELECT tax_name,field_name,field_label,field_type,field_desc,field_val FROM {$wpdb->prefix}taxonomyfield order by tax_name"));
     305        $field_option = self::cms()->modules->taxonomy_type->get_registered_option('field');
     306        $tax_names = array();
     307        foreach($fields as $field){
     308           
     309            $tax_option = $field_option.'_'.$field->tax_name;
     310           
     311            self::cms()->dao->register_option($tax_option);
     312            $tax_field_data = self::cms()->dao->get_options($tax_option);
     313
     314            if(!isset($tax_names[$field->tax_name]) && !$tax_field_data)
     315                $tax_names[$field->tax_name] = true;
     316            if(isset($tax_names[$field->tax_name]) && $tax_names[$field->tax_name])
     317            {
     318                $field_arr = array('field_name'=>$field->field_name,'field_label'=>$field->field_label,'field_type'=>$field->field_type,'field_desc'=>$field->field_desc,'field_val'=>$field->field_val,'field_order'=>0);
     319                self::cms()->dao->insert_object($tax_option,$field_arr);
     320           
     321            }
     322        }
    292323    }
    293324    function xydac_taxonomy_activate()
     
    378409
    379410}
     411
    380412xydac();
    381413
  • ultimate-cms/trunk/modules/page-type/class-xydac-page-type-fields.php

    r618227 r618822  
    2020        add_action('xydac_core_righthead',array($this,'right_head'));
    2121        add_filter('xydac_core_field_name',array($this,'field_name'));
     22        add_filter('xydac_core_editlink',array($this,'xydac_core_editlink_func'));
    2223        add_filter('xydac_core_headfootcolumn',array($this,'headfootcolumn'));
    2324
     
    2728                xydac()->modules->page_type->get_registered_option('field')."_".$name,
    2829                $form_variables); */
    29         parent::__construct(xydac()->modules->page_type,'field',$form_variables);
     30        $args = array('field_val' => $name);
     31        parent::__construct(xydac()->modules->page_type,'field',$form_variables,$args);
    3032    }
    3133
     
    3335    {
    3436        return "field_name";
     37    }
     38    function xydac_core_editlink_func($str)
     39    {
     40        return $str.'&manage_page_type='.$this->name;
    3541    }
    3642    function headfootcolumn()
  • ultimate-cms/trunk/modules/page-type/class-xydac-page-type-manager.php

    r618227 r618822  
    2828        add_filter('xydac_core_leftdiv',array($this,'xydac_core_leftdiv'));
    2929        add_action('xydac_core_bulkaction',array($this,'xydac_core_bulkaction'));
    30         add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));
     30        //add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));
    3131        add_filter('xydac_core_doactions',array($this,'xydac_core_doactions'));
    3232        //parent::__construct(xydac()->modules->page_type->get_module_name(),xydac()->modules->page_type->get_module_label(),xydac()->modules->page_type->get_base_path(),xydac()->modules->page_type->get_registered_option('main'),$form_variables,true,false);
     
    5252        $action = array('activate'=>__("Activate",XYDAC_CMS_NAME),
    5353                'deactivate'=>__("Deactivate",XYDAC_CMS_NAME),
    54                 'delete'=>__("Delete",XYDAC_CMS_NAME),
    55                 'export'=>__("Export",XYDAC_CMS_NAME)
     54                'delete'=>__("Delete",XYDAC_CMS_NAME)
    5655        );
    5756        return $action;
  • ultimate-cms/trunk/modules/taxonomy/class-xydac-taxonomy-type-fields.php

    r618227 r618822  
    1919        add_action('xydac_core_righthead',array($this,'right_head'));
    2020        add_filter('xydac_core_field_name',array($this,'field_name'));
     21        add_filter('xydac_core_editlink',array($this,'xydac_core_editlink_func'));
    2122        add_filter('xydac_core_headfootcolumn',array($this,'headfootcolumn'));
    2223        //parent::__construct(xydac()->modules->taxonomy_type->get_module_name().__("_field",XYDAC_CMS_NAME),xydac()->modules->taxonomy_type->get_module_label().__(" Field",XYDAC_CMS_NAME),xydac()->modules->taxonomy_type->get_base_path()."&manage_".xydac()->modules->taxonomy_type->get_module_name()."=".$name,xydac()->modules->taxonomy_type->get_registered_option('field')."_".$name,$form_variables);
    2324        //parent::__construct("xydac_page_type_custom_field",__("Taxonomy Type Field",XYDAC_CMS_NAME),XYDAC_CMS_TAXONOMY_TYPE_FIELDS_PATH."&manage_taxonomy_type=".$name,XYDAC_CMS_TAXONOMY_TYPE_OPTION."_".$name,$form_variables);
    24         parent::__construct(xydac()->modules->taxonomy_type,'field',$form_variables);
     25        $args = array('field_val' => $name);;
     26        parent::__construct(xydac()->modules->taxonomy_type,'field',$form_variables,$args);
    2527    }
    2628
     
    2830    {
    2931        return "field_name";
     32    }
     33    function xydac_core_editlink_func($str)
     34    {
     35        return $str.'&manage_taxonomy_type='.$this->name;
    3036    }
    3137    function headfootcolumn()
  • ultimate-cms/trunk/modules/taxonomy/class-xydac-taxonomy-type-manager.php

    r618227 r618822  
    6060        add_action('xydac_core_delete',array($this,'xydac_core_delete'));
    6161        add_action('xydac_core_bulkaction',array($this,'xydac_core_bulkaction'));
    62         add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));
     62        //add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));
    6363        add_filter('xydac_core_doactions',array($this,'xydac_core_doactions'));
    6464        add_filter('xydac_core_insert',array($this,'xydac_core_insert'),10,1);
     
    9696    function xydac_core_doactions()
    9797    {
    98         $action = array('activate'=>__("Activate",XYDAC_CMS_NAME),'deactivate'=>__("Deactivate",XYDAC_CMS_NAME),'delete'=>__("Delete",XYDAC_CMS_NAME),'export'=>__("Export",XYDAC_CMS_NAME));
     98        $action = array('activate'=>__("Activate",XYDAC_CMS_NAME),'deactivate'=>__("Deactivate",XYDAC_CMS_NAME),'delete'=>__("Delete",XYDAC_CMS_NAME));
    9999        return $action;
    100100    }
     
    116116    function xydac_core_insert($datas)
    117117    {
     118        $datas = array(0=>$datas);
    118119        foreach($datas as $k=>$data){
    119120            $datas[$k]['args']['labels']['name'] = xydac_mods_inflect::pluralize($datas[$k]['name']);
     
    141142            $datas[$k]['args']['hierarchical']= "false";
    142143        }
    143         return $datas;
     144        return $datas[0];
    144145    }
    145146}
  • ultimate-cms/trunk/readme.txt

    r618227 r618822  
    6262== Changelog ==
    6363
     64= 1.0.1 =
     65* Fixed the fatal error issue, The error still persists if using ultimate taxonomy manager, but goes away on refresh.
     66* Fixed Taxonomies and page types issues.
     67* Fixed Taxonomy Manager to Ultimate CMS transition
     68* Fixed Some style issue.
     69
    6470= 1.0 =
    6571* Lots of enhancements
     
    94100Please let me know if you have any problem.
    95101
     102= I get fatal Error when using Ultimate Taxonomy Manager or Ultimate Post type manager =
     103Deactivate Ultimate taxonomy manager or Ultimate Post type manager you are using and activate Ultimate CMS.Your data will be restored.
     104
     105
    96106== Upgrade Notice ==
     107
     108= 1.0.1 =
     109Fixed the fatal error issue, The error still persists if using ultimate taxonomy manager, but goes away on refresh.Fixed Taxonomies and page types issues.Fixed Taxonomy Manager to Ultimate CMS transition
    97110
    98111= 0.1 =
  • ultimate-cms/trunk/style.css

    r618227 r618822  
    285285    border-width: 0 1px 1px;
    286286    margin: 0px;
     287    padding:8px;
    287288    clear: both;
    288289} /* ---------- */
Note: See TracChangeset for help on using the changeset viewer.