summaryrefslogtreecommitdiff
blob: 4a740ff7ea68643cfb03871854af948560243a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<script type="text/javascript">
    if (window.WMPJSInterface && window.WMPJSInterface != null){
        jQuery(document).ready(function(){

            WMPJSInterface.localpath = "<?php echo plugins_url()."/".WMP_DOMAIN."/"; ?>";
            WMPJSInterface.init();
        });
    }
</script>
<?php
// Load Free or Premium menu
$menu_type = 'free';

if (WMobilePack_Options::get_setting('premium_active') == 1 && WMobilePack_Options::get_setting('premium_api_key') != '') {

    $menu_type = 'premium_classic';

    $kit_type = WMobilePack::get_kit_type();
    if ($kit_type == 'wpmp'){
        $menu_type = 'premium_wpmp';
    }
}
?>
<div id="wmpack-admin">
    <div class="spacer-60"></div>
    <!-- set title -->
    <h1><?php echo WMP_PLUGIN_NAME.' '.WMP_VERSION;?><?php echo $menu_type != 'free' ? ' - Premium' : '';?></h1>
    <div class="spacer-20"></div>
    <div class="content">
        <div class="left-side">

            <!-- add nav menu -->
            <?php
            if ($menu_type == 'free')
                include_once(WMP_PLUGIN_PATH.'admin/sections/admin-menu.php');
            elseif ($menu_type == 'premium_wpmp')
                include_once(WMP_PLUGIN_PATH.'admin/sections/admin-menu-premium.php');
            ?>
            <div class="spacer-0"></div>

            <div class="details branding-category">
                <h2 class="title">Add image for category "<?php echo $category->name;?>"</h2>
                <div class="spacer-15"></div>
                <div class="grey-line"></div>
                <div class="spacer-15"></div>
                <p>
                    The image will be displayed in the mobile web app (categories menu).<br/>
                    <strong>Editing the content from the below section will not change your desktop category settings.</strong>
                </p>
                <div class="spacer-15"></div>
                <div class="left">
                    <form name="wmp_categoryedit_form" id="wmp_categoryedit_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_theme_editimages&type=upload" method="post" enctype="multipart/form-data">

                        <?php
                        $icon_path = '';
                        $categories_details = WMobilePack_Options::get_setting('categories_details');

                        if (is_array($categories_details)) {

                            if (array_key_exists($category->cat_ID, $categories_details)) {

                                if (is_array($categories_details[$category->cat_ID])) {

                                    if (array_key_exists('icon', $categories_details[$category->cat_ID])) {

                                        $icon_path = $categories_details[$category->cat_ID]['icon'];

                                        if ($icon_path != ''){
                                            if (!file_exists(WMP_FILES_UPLOADS_DIR . $icon_path))
                                                $icon_path = '';
                                            else
                                                $icon_path = WMP_FILES_UPLOADS_URL . $icon_path;
                                        }
                                    }
                                }
                            }
                        }
                        ?>
                        <input type="hidden" name="wmp_categoryedit_id" id="wmp_categoryedit_id" value="<?php echo $category->cat_ID;?>" />

                        <!-- upload icon field -->
                        <div class="wmp_categoryedit_uploadicon" style="display: <?php echo $icon_path == '' ? 'block' : 'none';?>;">

                            <label for="wmp_categoryedit_icon">Upload your category image</label>

                            <div class="custom-upload">

                                <input type="file" id="wmp_categoryedit_icon" name="wmp_categoryedit_icon" />
                                <div class="fake-file">
                                    <input type="text" id="fakefileicon" disabled="disabled" />
                                    <a href="#" class="btn grey smaller">Browse</a>
                                </div>

                                <a href="javascript:void(0)" id="wmp_categoryedit_icon_removenew" class="remove" style="display: none;"></a>
                            </div>
                            <!-- cancel upload icon button -->
                            <div class="wmp_categoryedit_changeicon_cancel cancel-link" style="display: none;">
                                <a href="javascript:void(0);" class="cancel">cancel</a>
                            </div>
                            <div class="field-message error" id="error_icon_container"></div>

                        </div>

                        <!-- icon image -->
                        <div class="wmp_categoryedit_iconcontainer display-icon" style="display: <?php echo $icon_path != '' ? 'block' : 'none';?>;;">

                            <label for="branding_icon">Category image</label>
                            <img src="<?php echo $icon_path;?>" id="wmp_categoryedit_currenticon" />

                            <!-- edit/delete icon links -->
                            <a href="javascript:void(0);" class="wmp_categoryedit_changeicon btn grey smaller edit">Change</a>
                            <a href="#" class="wmp_categoryedit_deleteicon smaller remove">remove</a>
                        </div>

                        <div class="spacer-20"></div>
                        <div class="inline-btns-container">
                            <a href="javascript:void(0);" id="wmp_categoryedit_send_btn" class="btn blue smaller spaced-right" style="cursor: pointer; opacity: 1;">Save</a>
                            <a href="<?php echo add_query_arg(array('page'=>'wmp-options-content'), network_admin_url('admin.php'));?>" class="btn grey smaller" style="cursor: pointer; opacity: 1; text-transform:none;">Back</a>
                        </div>
                    </form>
                </div>


                <div class="spacer-0"></div>
            </div>
            <div class="spacer-15"></div>
        </div>


        <div class="right-side">
            <!-- waitlist form -->
            <?php
            if ($menu_type == 'free')
                include_once(WMP_PLUGIN_PATH.'admin/sections/waitlist.php');
            ?>

            <!-- add feedback form -->
            <?php include_once(WMP_PLUGIN_PATH.'admin/sections/feedback.php'); ?>
        </div>
    </div>
</div>

<script type="text/javascript">
    if (window.WMPJSInterface && window.WMPJSInterface != null){
        jQuery(document).ready(function(){
            window.WMPJSInterface.add("UI_categorydetails","WMP_CATEGORY_DETAILS",{'DOMDoc':window.document}, window);
        });
    }
</script>