~dangarner/xibo/client-132

« back to all changes in this revision

Viewing changes to server/modules/microblog.module.php

MergedĀ ~dangarner/xibo/server-layout-media-permissions

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        <form id="ModuleForm" class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=AddMedia">
51
51
            <input type="hidden" name="layoutid" value="$layoutid">
52
52
            <input type="hidden" id="iRegionId" name="regionid" value="$regionid">
 
53
            <input type="hidden" name="showRegionOptions" value="$this->showRegionOptions" />
53
54
            <table>
54
55
                <tr>
55
56
                    <td colspan="2"><input type="checkbox" name="twitter" /><label for="twitter" title="">Twitter</label></td>
93
94
        $this->response->dialogTitle    = 'Add Microblog';
94
95
        $this->response->callBack       = 'microblog_callback';
95
96
        $this->response->AddButton(__('Help'), 'XiboHelpRender("index.php?p=help&q=Display&Topic=Microblog&Category=Media")');
96
 
        $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=layout&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
 
97
 
 
98
        if ($this->showRegionOptions)
 
99
        {
 
100
            $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=layout&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
 
101
        }
 
102
        else
 
103
        {
 
104
            $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
 
105
        }
 
106
 
97
107
        $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
98
108
 
99
109
        return $this->response;
111
121
        $regionid       = $this->regionid;
112
122
        $mediaid        = $this->mediaid;
113
123
 
 
124
        // Permissions
 
125
        if (!$this->auth->edit)
 
126
        {
 
127
            $this->response->SetError('You do not have permission to edit this assignment.');
 
128
            $this->response->keepOpen = true;
 
129
            return $this->response;
 
130
        }
 
131
 
114
132
        // Get some options
115
133
        $searchTerm     = $this->GetOption('searchTerm');
116
134
        $fadeInterval   = $this->GetOption('fadeInterval');
143
161
        $nocontentNode  = $nocontentNodes->item(0);
144
162
        $nocontent      = $nocontentNode->nodeValue;
145
163
 
 
164
        $durationFieldEnabled = ($this->auth->modifyPermissions) ? '' : ' readonly';
 
165
 
146
166
        //Output the form
147
167
        $form = <<<FORM
148
168
        <form id="ModuleForm" class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia">
149
169
            <input type="hidden" name="layoutid" value="$layoutid">
150
170
            <input type="hidden" id="iRegionId" name="regionid" value="$regionid">
151
171
            <input type="hidden" name="mediaid" value="$mediaid">
 
172
            <input type="hidden" name="showRegionOptions" value="$this->showRegionOptions" />
152
173
            <table>
153
174
                <tr>
154
175
                    <td colspan="2"><input type="checkbox" name="twitter" $twitterChecked /><label for="twitter" title="">Twitter</label></td>
158
179
                    <td><label for="searchTerm" title="">Search Term<span class="required">*</span></label></td>
159
180
                    <td><input id="searchTerm" name="searchTerm" type="text" value="$searchTerm"></td>
160
181
                    <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td>
161
 
                    <td><input id="duration" name="duration" type="text" value="$this->duration"></td>
 
182
                    <td><input id="duration" name="duration" type="text" value="$this->duration" $durationFieldEnabled></td>
162
183
                </tr>
163
184
                <tr>
164
185
                    <td><label for="fadeInterval" title="">Fade Interval</label></td>
192
213
        $this->response->dialogTitle    = 'Edit MicroBlog';
193
214
        $this->response->callBack       = 'microblog_callback';
194
215
        $this->response->AddButton(__('Help'), 'XiboHelpRender("index.php?p=help&q=Display&Topic=Microblog&Category=Media")');
195
 
        $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=layout&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
 
216
        if ($this->showRegionOptions)
 
217
        {
 
218
            $this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=layout&layoutid=' . $layoutid . '&regionid=' . $regionid . '&q=RegionOptions")');
 
219
        }
 
220
        else
 
221
        {
 
222
            $this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
 
223
        }
196
224
        $this->response->AddButton(__('Save'), '$("#ModuleForm").submit()');
197
225
        
198
226
        return $this->response;
251
279
        //Set this as the session information
252
280
        setSession('content', 'type', 'microblog');
253
281
 
254
 
        // We want to load a new form
255
 
        $this->response->loadForm   = true;
256
 
        $this->response->loadFormUri= $url;
 
282
        if ($this->showRegionOptions)
 
283
        {
 
284
            // We want to load a new form
 
285
            $this->response->loadForm = true;
 
286
            $this->response->loadFormUri = $url;
 
287
        }
257
288
 
258
289
        return $this->response;
259
290
    }
271
302
        $mediaid        = $this->mediaid;
272
303
        $url            = "index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions";
273
304
 
 
305
        if (!$this->auth->edit)
 
306
        {
 
307
            $this->response->SetError('You do not have permission to edit this assignment.');
 
308
            $this->response->keepOpen = false;
 
309
            return $this->response;
 
310
        }
 
311
 
274
312
        //Other properties
275
313
        $searchTerm     = Kit::GetParam('searchTerm', _POST, _STRING);
276
 
        $duration       = Kit::GetParam('duration', _POST, _INT, 0);
277
314
        $fadeInterval   = Kit::GetParam('fadeInterval', _POST, _INT);
278
315
        $speedInterval  = Kit::GetParam('speedInterval', _POST, _INT);
279
316
        $updateInterval = Kit::GetParam('updateInterval', _POST, _INT);
284
321
        $nocontent      = Kit::GetParam('nocontent', _POST, _HTMLSTRING);
285
322
 
286
323
        // Validation
287
 
        if ($duration == 0)
 
324
        // If we have permission to change it, then get the value from the form
 
325
        if ($this->auth->modifyPermissions)
 
326
            $this->duration = Kit::GetParam('duration', _POST, _INT, 0);
 
327
            
 
328
        if ($this->duration == 0)
288
329
            $this->response->Error('You must enter a duration.', true);
289
330
 
290
331
        if ($template == '')
291
332
            $this->response->Error('You must enter a Message Template.', true);
292
333
 
293
 
        // Required Attributes
294
 
        $this->duration = $duration;
295
 
 
296
334
        // Any Options
297
335
        $this->SetOption('searchTerm', $searchTerm);
298
336
        $this->SetOption('fadeInterval', $fadeInterval);
312
350
        //Set this as the session information
313
351
        setSession('content', 'type', 'microblog');
314
352
 
315
 
        // We want to load a new form
316
 
        $this->response->loadForm   = true;
317
 
        $this->response->loadFormUri= $url;
 
353
        if ($this->showRegionOptions)
 
354
        {
 
355
            // We want to load a new form
 
356
            $this->response->loadForm = true;
 
357
            $this->response->loadFormUri = $url;
 
358
        }
318
359
 
319
360
        return $this->response;
320
361
    }