/**
     * shows a tree of system sections
     * 
     * @return void
     */
    public function index()
    {
        theme_add('dojo.data.ItemFileReadStore');
        theme_add('dijit.tree.ForestStoreModel');
        theme_add('dijit.Tree');
        $this->print_text('<div dojoType="dojo.data.ItemFileReadStore" url="' . site_url('section_editor/queryTree') . '" jsId="ordJson"></div>');
        $this->print_text('<div dojoType="dijit.tree.ForestStoreModel" childrenAttrs="line" store="ordJson" jsId="ordModel"></div>');
        $this->print_text('<div dojoType="dijit.Tree" id="ordTree" model="ordModel" showRoot="false" >
		<script type="dojo/method" event="onClick" args="item">
		if( item.id!=undefined )
			document.location.href = "' . site_url('section_editor/edit') . '/"+item.id;
		</script>
		</div>');
    }
<?php

if ($mode == 'config') {
    ?>
resourceFiles:
	type:file list
<?php 
} elseif ($mode == 'layout') {
    ?>
0


<?php 
} elseif ($mode == 'view') {
    theme_add(explode("\n", $resourceFiles));
    if ($ci->system->mode == 'edit') {
        if ($ci->ion_auth->is_admin()) {
            $ci->load->library('gui');
            echo $ci->gui->info('Resource ' . nl2br($resourceFiles));
        }
    }
}
 /**
  * add files and text to the required files array
  * 
  * it could be used for adding css files, javascript files, 
  * dojo required components or even meta tags or any string
  * to the page header, that function is smart enaugh to know the type
  * of text (meta tag, script tag, file path, plain text) and
  * add it to the suitable place.
  * 
  * @param string $input 
  */
 function theme_add($input = NULL)
 {
     if (is_array($input)) {
         foreach ($input as $item) {
             theme_add($item);
         }
         return;
     }
     $input = trim($input);
     $extension = substr($input, strrpos($input, '.') + 1);
     switch ($extension) {
         case 'js':
             theme_js($input);
             return;
         case 'css':
             theme_css($input);
             return;
     }
     $input = trim($input);
     $prefix = substr($input, 0, 5);
     switch ($prefix) {
         case '<!--[':
         case '<scri':
             theme_js($input);
             return;
         case '<styl':
         case '<link':
             theme_css($input);
             return;
         case '<meta':
             theme_meta($input);
             return;
         case 'dojo.':
         case 'dijit':
         case 'dojox':
             theme_dojo($input);
     }
 }
<?php

$ci =& get_instance();
theme_add('assets/admin/edit/edit.css');
$p = new Content($parent);
if (strlen($title) == 0) {
    $title = strrpos($path, '/') != NULL ? substr($path, strrpos($path, '/') + 1, strrpos($path, '.') - strrpos($path, '/') - 1) : substr($path, 0, strrpos($path, '.'));
}
$url = site_url("editor/data/{$id}/{$ci->system->section->id}");
?>
<div class="editCtrl systemCtrl"  >
	<a class="iframe " href="<?php 
echo $url;
?>
" title="<?php 
echo $title;
?>
" ></a>
</div>
<?php 
echo $text;
Exemple #5
0
<?php

if ($mode == 'config') {
    ?>
add:
	type:checkbox
	label:add html to header
Text:
	type:textarea
<?php 
} elseif ($mode == 'view') {
    if ($add == TRUE) {
        theme_add($Text);
    } else {
        echo $Text;
    }
}
Exemple #6
0
<?php

theme_add("assets/style/reset.css");
theme_add("assets/style/text.css");
theme_add("assets/style/style.css");
theme_add("dijit.Menu");
theme_add("dijit.MenuBar");
theme_add("dijit.PopupMenuBarItem");
// layouts used in page
theme_add("dijit.layout.ContentPane");
theme_add("dijit.layout.BorderContainer");
theme_add("dijit.Dialog");
echo theme_doctype();
?>
<html>
	<head>
		<?php 
echo theme_head();
?>
		
	<style>
	html,body{
		width: 99.9%;
		height: 99.8%;
	}
	body{
		font-size: 12px;
	}
	label{
		display: block;
		text-align: right;
    public function data($edit = NULL, $sec = NULL)
    {
        /********************************************
         * checking if the page has a ID get paramter
         * for edit purposes
         ********************************************/
        $this->load->helper('directory');
        theme_add('dijit.Dialog');
        // getting the content
        $con = new Content($edit);
        if (!$con->exists()) {
            $edit = FALSE;
        } else {
            $info = json_decode($con->info);
        }
        // creating menu if editing a content
        if ($edit) {
            $this->show_toolbar = TRUE;
            $this->pages = array();
            $parent = $con->parent_content;
            $p = new Content($con->parent_content);
            $this->pages['up/' . $con->id] = lang('system_move_up');
            $this->pages['down/' . $con->id] = lang('system_move_down');
            $this->pages['chooser/' . $sec . '/' . $parent . '/' . $con->cell . '/' . $con->sort] = lang('system_add_before');
            $this->pages['chooser/' . $sec . '/' . $parent . '/' . $con->cell . '/' . ($con->sort + 1)] = lang('system_add_after');
            $this->pages['delete/' . $con->id] = lang('system_delete');
            $this->pages['delete_children/' . $con->id] = lang('system_delete_children');
            $this->pages['info/' . $con->id] = lang('system_information');
        }
        // creating hidden properties
        $hidden = array();
        if ($edit === FALSE) {
            $hidden['parent_section'] = $this->input->post("parent_section");
            $hidden['parent_content'] = $this->input->post("parent_content");
            $hidden['cell'] = $this->input->post("cell");
            $hidden['sort'] = $this->input->post("sort");
            $hidden['path'] = $this->input->post("path");
            $hidden['info'] = "";
        } else {
            $hidden['id'] = $con->id;
            $hidden['parent_section'] = $con->parent_section;
            $hidden['parent_content'] = $con->parent_content;
            $hidden['cell'] = $con->cell;
            $hidden['sort'] = $con->sort;
            $hidden['path'] = $con->path;
            $hidden['info'] = $con->info;
        }
        // action of the form button
        $form_ajax_url = site_url('editor/addaction');
        if ($edit === FALSE) {
            $submit_script = "dijit.byId('basic_form').submit();";
        } else {
            $saved_title = lang('system_save_success');
            $error_occured = lang('system_error_occured');
            $submit_script = <<<EOT
\tdojo.xhrPost({           
         url: "{$form_ajax_url}",
         handleAs: "text",
         preventCache: true,               
         content: dojo.formToObject("basic_form"),
         load: function(response, args) {
\t\t\t        Dlg = new dijit.Dialog({
\t\t\t            title: "{$saved_title}",
\t\t\t            style: "width: 300px",
\t\t\t            content : response
\t\t\t        });
\t\t\t        Dlg.show();
\t\t\t        
\t\t\t },
         error: function(response, args) {
\t\t\t\t\tDlg = new dijit.Dialog({
\t\t\t            title: "{$error_occured}",
\t\t\t            style: "width: 300px",
\t\t\t            content : response
\t\t\t        });
\t\t\t        Dlg.show();
\t\t\t }
    });
EOT;
        }
        $script = <<<EOT
<script type="dojo/method" event="onClick" args="evt">
if( dijit.byId('info_form')!=undefined ){
\tdojo.query("[name='info']")[0].value = dojo.toJson(dijit.byId('info_form').getValues());
}
\t\t{$submit_script}
</script>
EOT;
        if ($edit === FALSE) {
            $p_cont = new Content($hidden['parent_content']);
            $Basic_Form = $this->gui->form(site_url('editor/addaction'), array(lang('system_title') => $this->gui->textbox('title'), lang('system_show_in_subsection') => $this->gui->checkbox('subsection'), lang('system_view_perm') => $this->gui->permission('view', $p_cont->view), lang('system_filters') => $this->gui->file_list(site_url('editor/filter_query'), 'filter'), "" => $this->gui->button('', lang('system_save') . $script)), array('id' => 'basic_form'), $hidden);
        } else {
            $Basic_Form = $this->gui->form(site_url('editor/addaction'), array(lang('system_title') => $this->gui->textbox('title', $con->title), lang('system_show_in_subsection') => $this->gui->checkbox('subsection', 'subsection', $con->subsection), lang('system_view_perm') => $this->gui->permission('view', $con->view), lang('system_filters') => $this->gui->file_list(site_url('editor/filter_query'), 'filter', $con->filter), "" => $this->gui->button('', lang('system_save') . $script)), array('id' => 'basic_form'), $hidden);
        }
        //===============================================
        /*OUR YAML OBJECT LIKE THAT
        
        		variableName1:
        			type: varType
        			default: varDefaultValue
        			label: varHumanizedName	
        		variableName2:
        			type: varType
        			default: varDefaultValue
        			label: varHumanizedName	
        				
        		*/
        $this->load->helper('spyc');
        $Plugin_Data = $this->load->view('content/' . $hidden['path'], array("mode" => "config"), TRUE);
        $Plugin_Data = spyc_load($Plugin_Data);
        $Plugin_Form_Data = array();
        // starting to make the form if it is exists
        if (!empty($Plugin_Data)) {
            // building each field
            foreach ($Plugin_Data as $key => $value) {
                // build the field depending on the type
                if (is_array($value)) {
                    // this line gets the default value if in insertion mode and the
                    // stored value if in the edit mode
                    $cVal = '';
                    $cVal = $edit === FALSE ? @$value['default'] : @$info->{$key};
                    $current_field = $this->gui->textbox($key, @$value['default']);
                    switch ($value['type']) {
                        case "textbox":
                            $current_field = $this->gui->textbox($key, $cVal);
                            break;
                        case "textarea":
                            $current_field = $this->gui->textarea($key, $cVal);
                            break;
                        case "date":
                            $current_field = $this->gui->date($key, $cVal);
                            break;
                        case "editor":
                            $current_field = $this->gui->editor($key, $cVal);
                            break;
                        case "file":
                            $current_field = $this->gui->file_chooser(site_url('editor/file_query'), $key, $cVal);
                            break;
                        case "file list":
                            $current_field = $this->gui->file_list(site_url('editor/file_query'), $key, $cVal);
                            break;
                        case "folder":
                            $current_field = $this->gui->folder_chooser(site_url('editor/folder_query'), $key, $cVal);
                            break;
                        case "model":
                            $current_field = $this->gui->file_chooser(site_url('editor/model_query'), $key, $cVal);
                            break;
                        case "number":
                            $current_field = $this->gui->number($key, $cVal);
                            break;
                        case "password":
                            $current_field = $this->gui->password($key, $cVal);
                            break;
                        case "time":
                            $current_field = $this->gui->time($key, $cVal);
                            break;
                        case "checkbox":
                            $current_field = $this->gui->checkbox($key, $key, $cVal);
                            break;
                        case "dropdown":
                            $current_field = $this->gui->dropdown($key, $cVal, @$value['options']);
                            break;
                        case "section":
                            $current_field = $this->gui->section($key, $cVal);
                            break;
                        case "permission":
                            $current_field = $this->gui->permission($key, $cVal);
                            break;
                        case "smalleditor":
                            $current_field = $this->gui->smalleditor($key, $cVal);
                            break;
                    }
                } else {
                    if (is_string($value) == TRUE) {
                        $current_field = $this->gui->info($value);
                    }
                }
                // checking the existance of label
                if (is_array($value) and array_key_exists('label', $value) == TRUE) {
                    $Plugin_Form_Data[$value['label']] = $current_field;
                } else {
                    $Plugin_Form_Data[$key] = $current_field;
                }
            }
        }
        if (count($Plugin_Form_Data) > 0) {
            $Plugin_Form = $this->gui->form('#', $Plugin_Form_Data, array("id" => "info_form"));
            $this->print_text($this->gui->accordion(array(lang('system_basic_data') => $Basic_Form, lang('system_plugin_data') => '<p>' . $Plugin_Form . '</p>')));
        } else {
            $this->print_text($this->gui->accordion(array(lang('system_basic_data') => $Basic_Form)));
        }
    }
$logout = site_url('auth/logout');
$XHR_URL = site_url('editmode/' . ($ci->system->mode == 'edit' ? 'view' : 'edit'));
theme_add(<<<EOT

<script type="text/javascript">

function systemButtonToggler(){
\t\t\$(".panel").toggle("fast");
\t\t\$(this).toggleClass("active");
\t\treturn false;
}

\$(function (){
\t\$(".trigger").click(systemButtonToggler);
\t\$("a.iframe").fancybox({
\t\t\tframeWidth: 600,
\t\t\tframeHeight: 450,
\t});
});

// switching editmode
function admin_editmode_toolbar()
{
\t\$.get( "{$XHR_URL}", function(response){
\t\t\tdocument.location.reload();
\t});
}
</script>
EOT
);
?>
    theme_add(<<<EOT
<style>
body{
\tbackground-color: #C6C6C6;
\tmargin: 30px;
\tfont-family: tahoma;
}
.page{
\tfont-size: 13px;
\tpadding: 30px;
\tbackground-color: #eee;
\twidth: 70%;
\t
}
.title{
\tfont-size: 200%;
\tcolor: #284128;
}
.title2{
\tfont-size: 80%;
\tcolor: #284128;
}
.sep{
\twidth: 80%;
\tborder-top: 1px solid #284128;
\tmargin-top: 10px;
\tmargin-bottom: 10px;
}
</style>
EOT
);
<?php

echo theme_doctype();
theme_pagetitle(lang('system_forgot'));
theme_add('dijit.form.Button');
theme_add('dijit.Dialog');
theme_add('dijit.form.TextBox');
theme_add('dijit.form.Button');
theme_add('assets/style/auth_style.css');
theme_add('assets/style/style.css');
?>
<html>
<head>
	<?php 
echo theme_head();
?>
<script type="text/javascript" >
dojo.addOnLoad( null, function(){
	dijit.byId( 'loginD' ).show();
});
</script>
</head>
	<body class="claro">

		<div id="loginD" dojoType="dijit.Dialog" title="<?php 
echo lang('system_forgot');
?>
" >
		
<p><?php 
echo lang('system_please_enter_email');
    if ($Textstyle) {
        theme_add('assets/style/text.css');
    }
    if (!empty($favIcon)) {
        theme_add('<link rel="icon" href="' . base_url() . $favIcon . '">');
    }
    theme_add(explode("\n", $javascript_files));
    theme_add(explode("\n", $css_files));
    $style = '';
    if ($background_image != '') {
        $style .= "background-image: url({$local}{$background_image});";
        $style .= "background-position: {$horizontal_position} {$vertical_position};";
        $style .= "background-repeat: {$repeat};";
        $style .= "background-attachment: {$attachment};";
    }
    $style .= $style;
    if ($style != '') {
        theme_add("\n<style>\nbody{\n\t{$style}\n}\n</style>\n\n\t\t");
        if (!empty($class)) {
            theme_add('jquery/jquery.js');
            theme_add(<<<EOT
<script language="javascript" >
\t\$(function(){
\t\t\$(document).addClass('{$class}');
\t});
</script>
EOT
);
        }
    }
}
Exemple #12
0
    /**
     * a file list chooser that return a text with some lines every line is
     * a choosen file ( it's a textarea interface with jquery)
     * 
     * @param string $connector URL to php file to use as ajax backend, with object like this
     * <pre>
     * {"identifier":"id","label":"description","items":[
     * 	{"id":2,"description":"leaf1"},{"id":3,"description":"category","c":[
     * 		{"id":4,"description":"subleaf1"},
     * 		{"id":5,"description":"subleaf2"}
     * 	]}
     * ]}
     * </pre>
     * @param string $NAME text input name and id
     * @param strin $value text input value
     * @param array/object/string $attr attributes->value associative array
     * @param array/object/string $style property->value associative array
     * @return string HTML string for the chooser
     */
    public function file_list($connector, $NAME = '', $value = '', $attr = array(), $param = array(), $style = array())
    {
        theme_add('jquery/jquery.js');
        $ci =& get_instance();
        $ci->load->library('gui');
        theme_add(<<<EOT
<script language="javascript" >
function updateList(list){

\t\$(list).each(function(){
\t\ti = \$(this).children('textarea').val();
\t\tif( i!="" ){
\t\t\ti = i.split("\\n");
\t\t\ti = '<div class="item dijitTitlePaneTitle" >'+i.join('</div><div class="item dijitTitlePaneTitle" >')+'</div>';
\t\t}
\t\t
\t\t\$(this).children('.items').html(i);
\t\t
\t\t\$(this).children('.items').children('.item').click(
\t\t\t\tfunction(){
\t\t\t\t\t\$(this).parent().parent().find('input').val(\$(this).text());
\t\t\t\t});
\t});
}

\$(function(){
\t\$('.filelist>textarea').hide();
\t
\t\$('.filelist').each(function(){
\t\t\tupdateList(this);
\t
\t\t\t\$(this).children('.add').click(function(){
\t\t\t\tinput = \$(this).parent().find('input');
\t\t\t\ttextarea = \$(this).siblings('textarea');
\t\t\t\tif( textarea.val().length>0)
\t\t\t\t\ti = "\\n"+input.val();
\t\t\t\telse
\t\t\t\t\ti = input.val();
\t\t\t\ttextarea.val(textarea.val()+i);
\t\t\t\tupdateList(\$(this).parent());
\t\t\t\tinput.val('');
\t\t\t});
\t\t\t\$(this).children('.del').click(function(){
\t\t\t\tta = \$(this).siblings('textarea');
\t\t\t\tinp = \$(this).parent().find('input').val();
\t\t\t\tlist = ta.val();
\t\t\t\tlist = list.split("\\n");
\t\t\t\tnewList = new Array();
\t\t\t\tfor( i=0; i<list.length; i++)
\t\t\t\t{
\t\t\t\t\tif( inp!=list[i] )
\t\t\t\t\t\tnewList.push(list[i]);
\t\t\t\t}
\t\t\t\tif( newList.length>0)
\t\t\t\t\tta.val(newList.join("\\n"));
\t\t\t\telse
\t\t\t\t\tta.val('');
\t\t\t\tupdateList(\$(this).parent());
\t\t\t\t \$(this).parent().find('input').val('');
\t\t\t});
\t});
\t
});
</script>
<style>
.filelist .items .item{padding: 3px;}
.filelist img{padding-top: 5px;}
</style>
EOT
);
        $input = $this->file_chooser($connector, 'd' . rand(1, 10000), '', $attr, $param, $style);
        $textarea = $this->textarea($NAME, $value);
        $base_url = base_url();
        return <<<EOT
<div class="filelist" >
<div class="items" ></div>
\t\t{$textarea}
\t\t{$input}
<img class="add" src="{$base_url}assets/admin/edit/add.png" >
<img class="del" src="{$base_url}assets/admin/edit/delete.png" >
</div>
EOT;
    }