Changeset 5778

Show
Ignore:
Timestamp:
04/21/07 03:04:17 (2 years ago)
Author:
solt
Message:

Added:

  • Create new elements
  • Upload elements from file
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/midcom.admin.styleeditor/handler/edit.php

    r5620 r5778  
    106106             
    107107            unset($this->_request_data['style_element_object']); 
     108 
    108109        } 
    109110        elseif (array_key_exists('midcom_admin_styleeditor_style_edit', $_POST)) 
    110111        { 
     112                // do we have file uploaded? 
     113                // TODO: file should be text/plain only 
     114                 
     115            if ($_FILES['midcom_admin_styleeditor_style_file']) 
     116            { 
     117                $value = file_get_contents($_FILES['midcom_admin_styleeditor_style_file']['tmp_name']); 
     118            } 
     119            else 
     120            { 
     121                $value = $_POST['midcom_admin_styleeditor_style_edit']; 
     122            } 
     123 
    111124            // User is saving, do it 
    112125            if (!isset($this->_request_data['style_element_object'])) 
     
    118131                $this->_request_data['style_element_object']->style = $this->_request_data['style']->id; 
    119132                $this->_request_data['style_element_object']->name = $this->_request_data['style_element']; 
    120                 $this->_request_data['style_element_object']->value = $_POST['midcom_admin_styleeditor_style_edit']
     133                $this->_request_data['style_element_object']->value = $value
    121134                 
    122135                if (!$this->_request_data['style_element_object']->create()) 
     
    133146                $this->_request_data['style_element_object']->require_do('midgard:update'); 
    134147                 
    135                 $this->_request_data['style_element_object']->value = $_POST['midcom_admin_styleeditor_style_edit']
     148                $this->_request_data['style_element_object']->value = $value
    136149                 
    137150                if (!$this->_request_data['style_element_object']->update()) 
  • trunk/src/midcom.admin.styleeditor/handler/list.php

    r5461 r5778  
    119119            ) 
    120120        ); 
    121          
     121 
     122        $this->_view_toolbar->add_item 
     123        ( 
     124            array 
     125            ( 
     126                MIDCOM_TOOLBAR_URL => "__mfa/styleeditor/create/", 
     127                MIDCOM_TOOLBAR_LABEL => $_MIDCOM->i18n->get_string('new style element', 'midcom.admin.styleeditor'), 
     128                MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/text-x-generic-template.png', 
     129            ) 
     130        );         
    122131        // Set the variables 
    123132        $this->_component = $this->_topic->component; 
  • trunk/src/midcom.admin.styleeditor/locale/default.en.txt

    r5478 r5778  
    44---LANGUAGE en 
    55 
     6---STRING add text file 
     7Add text file 
     8---STRINGEND 
     9 
    610---STRING all style elements 
    711All style elements 
     12---STRINGEND 
     13 
     14---STRING cascading style sheet 
     15Cascading Style Sheet 
    816---STRINGEND 
    917 
     
    1220---STRINGEND 
    1321 
    14 ---STRING style element list 
    15 List of style elements 
    16 ---STRINGEND 
    17  
    18 ---STRING style elements for %s 
    19 Style elements for style %s 
    20 ---STRINGEND 
    21  
    22 ---STRING style editor 
    23 Style editor 
    24 ---STRINGEND 
    25  
    2622---STRING copy to editor 
    2723Copy to editor 
    2824---STRINGEND 
    2925 
    30 ---STRING add text file 
    31 Add text file 
    32 ---STRINGEND 
    33  
    34 ---STRING cascading style sheet 
    35 Cascading Style Sheet 
     26---STRING create new element 
     27Create new element 
    3628---STRINGEND 
    3729 
     
    5042---STRING edit text file 
    5143Edit text file 
     44---STRINGEND 
     45 
     46---STRING element %s exists 
     47Element '%s' exists 
     48---STRINGEND 
     49 
     50---STRING element from file 
     51Upload element 
     52---STRINGEND 
     53 
     54---STRING element name 
     55Element name 
    5256---STRINGEND 
    5357 
     
    7680---STRINGEND 
    7781 
     82---STRING plain text 
     83Plain text 
     84---STRINGEND 
     85 
    7886---STRING style attachments 
    7987Style attachments 
     88---STRINGEND 
     89 
     90---STRING style editor 
     91Style editor 
     92---STRINGEND 
     93 
     94---STRING style element list 
     95List of style elements 
     96---STRINGEND 
     97 
     98---STRING style elements for %s 
     99Style elements for style %s 
    80100---STRINGEND 
    81101 
     
    92112---STRINGEND 
    93113 
    94 ---STRING plain text 
    95 Plain text 
     114---STRING element name required 
     115Element name is required 
    96116---STRINGEND 
    97117 
  • trunk/src/midcom.admin.styleeditor/static/style-editor.css

    r5553 r5778  
    277277    overflow: auto; 
    278278} 
     279 
     280#midcom_admin_styleeditor_style div.message 
     281{ 
     282        color: red; 
     283} 
  • trunk/src/midcom.admin.styleeditor/style/midcom-admin-styleeditor-style-edit.php

    r5554 r5778  
    2222    } 
    2323    ?> 
    24     <form class="midcom_admin_styleeditor_styleeditor" method="post" action="."> 
     24    <form class="midcom_admin_styleeditor_styleeditor" method="post" action="." enctype="multipart/form-data"> 
     25        <fieldset>                                                                                                                             
     26            <legend><?php echo $_MIDCOM->i18n->get_string('element from file', 'midcom.admin.styleeditor'); ?></legend>                             
     27            <input type="file" name="midcom_admin_styleeditor_style_file" id="midcom_admin_styleeditor_style_file" class="file" />             
     28        </fieldset>  
    2529        <fieldset> 
    2630            <legend><?php echo $_MIDCOM->i18n->get_string('local element', 'midcom.admin.styleeditor'); ?></legend> 
  • trunk/src/midcom.admin.styleeditor/viewer.php

    r5448 r5778  
    6262                'variable_args' => 1, 
    6363            ), 
    64              
     64            /** 
     65                 * Create new style element 
     66                 * 
     67                 * Match /create/ 
     68                 * 
     69                 */ 
     70                 'style_element_create' => array 
     71                 ( 
     72                        'handler' => array ('midcom_admin_styleeditor_handler_create','create'), 
     73                        'fixed_args' => array ('create'), 
     74                 ), 
    6575            /** 
    6676             * Create a new file